When the LEGv8 assembly code named "fact" (recursive factorial calculation procedure) given in Ch2 lecture slides is called with X0 = 4, what is the total number of 64-bit doublewords pushed onto the stack during the execution? Clearly justify your answer. [20pt]
Added by Carlos R.
Close
Step 1
LE end SUB X1, X0, #1 BL fact LDUR X29, [SP, #8] LDUR X30, [SP, #16] ADD SP, SP, #16 MUL X0, X0, X1 RET Now, let's analyze the code and see when the stack is being used. Show more…
Show all steps
Your feedback will help us improve your experience
Frank Deng and 86 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
For a recursive function Factorial(8), how many function calls are made at most?
Lien L.
assuming f(n) as a function that returns the factorial of a number n, if f(n) is implemented tail recursively and the compiler is capable of optimizing tail recursion, what would be the maximum depth of the call stack, at any given time, created by the call f(10)?
Shelayah R.
Adi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD