Question: 1. (8 points) Write C code for the following assembly code foo: pushl movl movl addl movl movl ???? %ebp %esp, %ebp 12(%ebp) ,%ecx 8(%ebp),

1. (8 points) Write C code for the following assembly code foo: pushl movl movl addl movl movl ???? %ebp %esp, %ebp 12(%ebp) ,%ecx 8(%ebp), %ecx $1, %eax $1,%edx $1,%ecx L7 %ecx, test1 %ecx L6 L8 : mu11 addi %eax, %eax $1,%eax jge jmp .L8 .L6 .L7: L6 : popl %ebp ret LCO: string "%d %d" test: pushl movl subl leal movi leal movi mov1 mov! movl call movl movl movl movl call leave ret %ebp %esp, %ebp $40,%esp -16(%ebp), %eax %eax, 12(%esp) -12(%ebp) ,%eax %eax ,8(%esp) $..LCO , 4(%esp) 8(%ebp), %eax %eax ,(%esp) sscanf -16 (%ebp), %eax %eax, 4(%esp) 12(%ebp), %eax ,(%esp) foo %eax 1. (8 points) Write C code for the following assembly code foo: pushl movl movl addl movl movl ???? %ebp %esp, %ebp 12(%ebp) ,%ecx 8(%ebp), %ecx $1, %eax $1,%edx $1,%ecx L7 %ecx, test1 %ecx L6 L8 : mu11 addi %eax, %eax $1,%eax jge jmp .L8 .L6 .L7: L6 : popl %ebp ret LCO: string "%d %d" test: pushl movl subl leal movi leal movi mov1 mov! movl call movl movl movl movl call leave ret %ebp %esp, %ebp $40,%esp -16(%ebp), %eax %eax, 12(%esp) -12(%ebp) ,%eax %eax ,8(%esp) $..LCO , 4(%esp) 8(%ebp), %eax %eax ,(%esp) sscanf -16 (%ebp), %eax %eax, 4(%esp) 12(%ebp), %eax ,(%esp) foo %eax
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
