Complete the code to define the base case check in a recursive factorial function.
cmp r0, [1]
beq end_factorialThe base case for factorial is when the input is 0, so the function returns 1. The comparison should be with 0.
Complete the code to decrement the argument register before the recursive call.
sub r0, r0, [1]To compute factorial recursively, the argument must be decremented by 1 before the recursive call.
Fix the error in the recursive call instruction to correctly branch to the factorial function.
bl [1]The label for the factorial function is 'factorial', so the branch with link instruction must call 'factorial'.
Fill both blanks to multiply the current argument with the result of the recursive call.
mul r0, r0, [1] mov [2], r0
After the recursive call, the result is in r0. Multiply r0 by the current argument (saved in r1). Then move the result back to r1 for further use.
Fill all three blanks to correctly save and restore the link register around the recursive call.
push [1] bl factorial pop [2] mov [3], r0
Before the recursive call, save the link register (lr) on the stack with push. After the call, restore it with pop. Finally, move the result from r0 to the desired register.