Question: Consider the following source code, where R, S, and T are constants declared with #define: Long A[R][S][T]; long store_ele(long I, long j, long k, long

 Consider the following source code, where R, S, and T are

Consider the following source code, where R, S, and T are constants declared with #define: Long A[R][S][T]; long store_ele(long I, long j, long k, long *dest) { *dest = A[R][S][T]; return sizeof(A); } In compiling this program, GCC generates the following assembly code: long store_ele(long I, long j, long k, long *dest) store_ele: leaq (%rsi, %rsi, 2), %rax leaq (%rsi, %rsi, 4), %rax movq %rdi, %rsi salq dollar6, %rsi addq %rsi, %rdi addq %rax, %rdi addq %rdi, %rdx movq A(,%rdx, 8), %rax movq %rax, (%rcx) mov1 dollar3640, %eax ret Extend Equation 3.1 from two dimensions to three to provide a formula for the location of array element A[i][j][k]. Use your reverse engineering skills to determine the values of R, S, and T based on the assembly code. Consider the following source code, where R, S, and T are constants declared with #define: Long A[R][S][T]; long store_ele(long I, long j, long k, long *dest) { *dest = A[R][S][T]; return sizeof(A); } In compiling this program, GCC generates the following assembly code: long store_ele(long I, long j, long k, long *dest) store_ele: leaq (%rsi, %rsi, 2), %rax leaq (%rsi, %rsi, 4), %rax movq %rdi, %rsi salq dollar6, %rsi addq %rsi, %rdi addq %rax, %rdi addq %rdi, %rdx movq A(,%rdx, 8), %rax movq %rax, (%rcx) mov1 dollar3640, %eax ret Extend Equation 3.1 from two dimensions to three to provide a formula for the location of array element A[i][j][k]. Use your reverse engineering skills to determine the values of R, S, and T based on the assembly code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!