Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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[j][i]; \} Is translated into the following X86-64 Assembly: copy_element: movslq \%edi, \%rdi movslq \%esi, \%rsi leaq (\%rsi,\%rsi,2), \%rax leaq (\%rax,\%rax, 8), \%rax addq \%rdi, \%rax movl mat2 (,%rax,4), \%ecx leaq (\%rdi,\%rdi, 8), \%rdx leaq (\%rdx,\%rdx), \%rax addq \%rax, \%rsi movl \%ecx, mat1 (,\%rsi,4) ret 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2000 Database Design

Authors: Louis Davidson

1st Edition

1861004761, 978-1861004765

More Books

Students also viewed these Databases questions