Question: 5. (20 points) Suppose the stack pointer SP is initialized to 0x20000600 A recursive function A recursive assembly code Int factorial(int n) int main(void) AREA
5. (20 points) Suppose the stack pointer SP is initialized to 0x20000600 A recursive function A recursive assembly code Int factorial(int n) int main(void) AREA main, CODE, READONLY EXPORT-main factorial(3) return e ENTRY -main PROC HOV r@.#ex83 BL factorial B stop ENDP int factorial(int n) exe8e08130 int f; if (n-1) exesee01 34 stop return 1; else factorial f n'factorial(n-1); ex88008136 return f; PUSH (r4, 1r) 0x88808138 8x0800813A 8x8888813C ex8808013E 0x88ea0148 loop POP (r4, pc) 8x88000142 NZ 8xe8880144 8xe8800148 0x8800014C MOV r4, re BNE NZ MOVS re, #0x01 SUBS re, r4, #1 BL factorial MUL re, r4, re 8 loop END Show the stack content when factorial(1) is returned. 0x20000618 0x20000614 0x20000610 0x2000060C 0x20000608 0x20008604 0x20000600 0x200005FC 0x200005F8 0x200005F4 0x200005F0 0x200005EC 0x200005E8 0x200005E4 0x200005E0 0x200005DC 0x200005D8 0x200005D4 0x200005De 0x200005CC 0x200005C8 0x200005C4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
