Question: Converting assembly to C: C code written below, has some assembly code beside it, please help with the questions on the bottom to convert the
Converting assembly to C:
C code written below, has some assembly code beside it, please help with the questions on the bottom to convert the asked Registor items in to C expressions, thank you.

Because the compiler has optimized some of the accesses to the array, the registers dont all correspond exactly to variables in the source code. (And the statements and instructions dont line up exactly one-toone either, so dont put too much significance in the way weve spaced the lines.) For each of the following registers, as it is used in a particular range of instructions (shown by their assembly code line number), write a C expression that corresponds to the value in the register. Your expressions should be written using the C variables mat, r, and c, together with C operators and constants; dont use register names.
| Register | C Expression |
|---|---|
| %eax, lines 8-11 | |
| %edi, lines 14-37 | |
| %ebx, lines 10-35 | |
| %edx, lines 22-27 | |
| %esi, lines 23-30 | |
| %eax, lines 23-30 |
#define SIZE 10 prob3: pushl movl pushl pushl pushl subl movl movl leal movl addl movl movl void prob3 (int mat [SIZE] [SIZE]) 2 %ebp %esp, %ebp %edi %esi %ebx $4,%esp 8 (%ebp), $1, (%eax) 40 (%eax), $1,40(%eax) $80,%eax %eax,-16(%ebp) $1, %edi . L2 int r, c %eax mat [0] [0] 1; = 10 %ebx 13 14 15 -16(%ebp), $1, (%ebx) $1, Sedi movl movl cmpl jle movl subl leal movl %ebx mat [r] [0] 1; 18 = 3 %ebx, $40, %edx -1 (%edi), $0, 20 21 %edx %esi 23 24 25 26 %eax for (c = 1; c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
