Question: do with explanation Assembly Matrix Question: (10 points) Your task is to figure out the values of the P and Q macros that have been
do with explanation
Assembly Matrix Question: (10 points) Your task is to figure out the values of the P and Q macros that have been defined and control the size of the array matrix (double array). Note that the values have been changed from the j.c code and you need to derive the values by reading the assembly code that is given below. We will first show the C code and then the assembly that was generated. This C code: #define P ? #define Q? int mat1[P][Q]; int mat2[Q][P]; void copy_element( int i, int j) { mat1[ i ][ j ] = mat2[ 3 ][ i]; } Is translated into the following X86-64 Assembly: copy_element: movslq %edi, %rdi movslq %esi, %rsi leaq (%rsi, %rsi,2), %rdx leaq (%rdx, %rdx), %rax addq %rdi, %rax movt mat2C, %rax,4), %ecx leaq (%rdi, %rdi,4), %rax (%rdi,%rax,2), %rdx (%rdx, %rdx), %rax adda %rax, %rsi moyl %ecx, mat1(,%rsi,4) ret leaq leaq Your task is to figure out the size of the arrays. What is the value of P? |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
