Question: Consider the following source code, where R, S, and T are constants declared with #define: long int A[R][S][T]; int store_ele(int h, int i, int j,
Consider the following source code, where R, S, and T are constants declared with #define:
long int A[R][S][T];
int store_ele(int h, int i, int j, long int *dest)
{
A[h][i][j] = *dest;
return sizeof(A);
}
In compiling this program, GCC generates the following assembly code (with -O2):
store_ele:
movslq %esi, %rsi
movslq %edi, %rdi
movq (%rcx), %rax
leaq (%rdi,%rdi,4), %rdi
leaq (%rsi,%rsi,3), %rcx
movslq %edx, %rdx
leaq (%rcx,%rdi,4), %rcx
addq %rcx, %rdx
movq %rax, A(,%rdx,8)
movl $1280, %eax
ret
Create a text file to show your work and the steps required to determine, R, S, and T.
Use your reverse engineering skills to determine the values of R, S, and T, based upon the assembly code.
Be sure to show all the calculations required to determine R, S, and T.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
