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

Consider the following funtion int recursive(int n) f...] The assembly code equi

ID: 3707195 • Letter: C

Question

Consider the following funtion int recursive(int n) f...] The assembly code equivalent of the above function is recursive: push %ebp mov %esp,%ebp push %ebx sub $0x14,%esp cmpl $0x1,0x8(Sebp) je .L1 cmpl $0x2,0x8 (8ebp) jne .L2 L1: m0v 0x8(%ebp),Seax 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) recursive all imul %ebx,%eax L3: add $0x14, %esp pop %ebx pop %ebp ret What would be the values returned for the code below? int int ret-val-1 ret-val-2 recursive(1); recursive(2); O return_val_1 is 1 and return_val_2 is2 O return_val_1 is 2 and return_val_2 is2 O return_val_1 is 1 and return_val_2 is1 O return_val_1 is 2 and return_val_2 is1 O return_val_1 is 3 and return_val_2 is3

Explanation / Answer

Question:- What would be the values returned for the code below?

int ret_val_1 = recursive(1);

int ret_val_2 = recursive(2);

Answer:-

return_val_1 is 2 and return_val_2 is 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote