Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please explain answer Question 6 Consider the following funtion: int recursive int n) The assembly code equivalent of the above function is recursive push %ebp
Please explain answer
Question 6 Consider the following funtion: int recursive int n) The assembly code equivalent of the above function is recursive push %ebp mov %esp,%ebp push %ebx sub sex 14,%esp cmpl $0x1,0x8(%ebp) je L1 cmpl $0x2,0x8(%ebp) jne L2 L1 mov 0x8 (%ebp),%eax jmp 13 L2 mov 0x8 (%ebp),%eax sub $0x1, %eax mov %eax, (%esp) call recursive mov %eax,%ebx mov 0x83 (%ebp),%eax sub $0x2,%eax mov %eax, (%esp) call recursive imul %ebx,%eax L3 add $0x14,%esp pop %ebx pop %ebp ret What would be the values returned for the code below? int ret val 1 recursive (1); int ret val 2 recursive (2); O return val 1 is 2 and return val 2 is 1 return val 1 is 1 and return val 2 is 1 return val 1 is 1 and return val 2 is 2 O return va 1 is 2 and return val 2 is 2 O return val 1 is 3 and return val 2 is 3 1 pts Question 6 Consider the following funtion: int recursive int n) The assembly code equivalent of the above function is recursive push %ebp mov %esp,%ebp push %ebx sub sex 14,%esp cmpl $0x1,0x8(%ebp) je L1 cmpl $0x2,0x8(%ebp) jne L2 L1 mov 0x8 (%ebp),%eax jmp 13 L2 mov 0x8 (%ebp),%eax sub $0x1, %eax mov %eax, (%esp) call recursive mov %eax,%ebx mov 0x83 (%ebp),%eax sub $0x2,%eax mov %eax, (%esp) call recursive imul %ebx,%eax L3 add $0x14,%esp pop %ebx pop %ebp ret What would be the values returned for the code below? int ret val 1 recursive (1); int ret val 2 recursive (2); O return val 1 is 2 and return val 2 is 1 return val 1 is 1 and return val 2 is 1 return val 1 is 1 and return val 2 is 2 O return va 1 is 2 and return val 2 is 2 O return val 1 is 3 and return val 2 is 3 1 ptsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started