Question: 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

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!