Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the source code below, where M and N are constants declared with #define. int array1[M][N]; int array2[N][M]; int copy(int i, int j) { array1[i][j]

Consider the source code below, where M and N are constants declared with #define.

int array1[M][N];

int array2[N][M];

int copy(int i, int j)

{

array1[i][j] = array2[j][i];

} Suppose the above code generates the following assembly code: copy:

pushl %ebp

movl %esp,%ebp

pushl %ebx

movl 8(%ebp),%ecx

movl 12(%ebp),%ebx

leal (%ecx,%ecx,8),%edx

sall $2,%edx

movl %ebx,%eax

sall $4,%eax

subl %ebx,%eax

sall $2,%eax

movl array2(%eax,%ecx,4),%eax

movl %eax,array1(%edx,%ebx,4)

popl %ebx

movl %ebp,%esp

popl %ebp

ret

What are the values of M and N? Show all of your work or explain how you obtained your answer. No points will be given for just the answer without any explanation!

M = N =

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

Step: 3

blur-text-image

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

For the circuit in Fig. 3.51, obtain v1 and v2. Figure 3.51 2

Answered: 1 week ago

Question

state what is meant by the term performance management

Answered: 1 week ago