Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please give explanation as well Which one of the following assembly code fragmen

ID: 3810819 • Letter: P

Question

Please give explanation as well

Which one of the following assembly code fragments saves the caller's frame pointer and sets the frame pointer to the bottom of the caller's stack frame? push1 %ebp mov1 %esp, %ebp mov1 %ebp, %esp push1 %esp push1 %ebp mov1 %ebp, %esp mov1 %ebp, (%esp) mov1 %ebp, %esp mov1 %esp, %ebp push1 %esp Consider the following function: int recursive(int n) {...} The assembly code equivalent of the above function is, WHICH IS THE SAME AS THE PRIOR QUESTION: recursive: push %ebp mov %esp, %ebp push %ebx sub $0x14, %esp cmp1 $0x1, 0x8(%ebp) je .L1 cmp1 $0x2, 0x8(%ebp) jne .L2 .L1: mov 0x8(%ebp), %eax jmp .L3 .L2: mov 0x8(%ebp), %eax sub $0x1, %eax mov %eax, (%esp) call recursive mov %eax, %ebx mov 0x8(%ebp), %eax sub $0x2, %eax mov %eax, (%esp) call recursive imu1 %ebx, %eax .L3: add $0x14, %esp pop %ebx pop %ebp ret What would be the value returned by the code below? int return_va1 - recursive(5); 6 12 15 5 8

Explanation / Answer

Question 1:- option 1 is the answer

Push1 %ebp

Mov1 %esp,%ebp

Because push ebp will push the value and them because of the second statement the value will be moved to the esp .