Question Write an ARM legv8 program that takes takes an input n and uses recursion to print n down to zero and back to n. Your inputs n cannot be stored as a global variable at any point. This means you cannot store them at a data section address, even when accepting them from scanf; they must be returned from scanf on the stack. X19-X27 are global variables. You may not use X19-X27 in your recursive function. If you want, you may use X19-X27 in your main function. You can use any registers you want to in your main function. A recursion procedure requires: Allocate stack space Save the return address and argument on the stack Recursively call procedure with BL Unwind the stack by restoring the return address and arguments and deallocating stack memory. no chat gpt allowed for this answer.

U4TTKP The Asker · Computer Science

Write an ARM legv8 program that takes takes an input n and uses recursion to print n down to zero and back to n. Your inputs n cannot be stored as a global variable at any point. This means you cannot store them at a data section address, even when accepting them from scanf; they must be returned from scanf on the stack. X19-X27 are global variables. You may not use X19-X27 in your recursive function. If you want, you may use X19-X27 in your main function. You can use any registers you want to in your main function. A recursion procedure requires: Allocate stack space Save the return address and argument on the stack Recursively call procedure with BL Unwind the stack by restoring the return address and arguments and deallocating stack memory. no chat gpt allowed for this answer.

More
Community Answer
X659LR

【General guidance】The answer provided below has been developed in a clear step by step manner.Step1/2Here's an example ARM legv8 program that takes an input n and prints n down to zero and back to n using recursion: .text .global mainmain: // Allocate stack space for main function sub sp, sp, #16 // Prompt user for input adrp x0, message add x0, x0, #:lo12:message bl printf // Read input from user and store on stack add x1, sp, #8 mov x2, #0 bl scanf // Call recursive function add x0, sp, #8 bl recursive // Deallocate stack space for main function and exit add sp, sp, #16 mov w0, #0 retrecursive: // Allocate stack space for recursive function sub sp, sp, #32 // Save return address and argument on stack str x30, [sp, #24] str x0, [sp, #16] // Check if argument is zero cmp x0, #0 b.eq end_recursive // Print argument mov x1, x0 adrp x0, message_num add x0, x0, #:lo12:message_num bl printf // Recursiv ... See the full answer