Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve in an hour Assembly Matrix Question: (10 points) Your task is to figure out the values of the P and Q macros that
please solve in an hour
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started