Size of int is 4 bytes, Size of pointer to int is 8bytes(64bit machine) QUESTION
ID: 3741645 • Letter: S
Question
Size of int is 4 bytes, Size of pointer to int is 8bytes(64bit machine)
QUESTION 3 The code segment below is to get the value of AliJNI] for an integer array A[NJNM] for some constant values N and M. Assume the address of the array is in %rax, the row is in %rdi and the column is in %rsi lea (%rdi,%rdi,4),%rax lea (%rsi,%rax,41%rax mov (%rax.%rax,41%eax Which of the following statements is true? 0 The array has 20 rows (N-20) The array has 20 columns (M-20) The array has 80 columns (M-80) All of the statements are false The array has 80 rows (N-80)Explanation / Answer
Solution:
The array has 80 rows.
Explanation:
I am going line by line to explain,
1 rax= rdi + rdi*4=> rax= 5* rdi
rax= rsi + rax * 4
=> rsi + (rax*4)
=> rsi + (rdi*5)*4= rsi + rdi * 20
3 eax= rdx + rdx * 4
= rdx + (rsi + rdi*20)*4
eax= rdx + 4 * rsi + 80 * rdi.
Hence the 80 rows.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.