Question: b. (5 points) How many instructions are executed for given input n in the recursive factorial in the slides? + MIPS code: fact: addi $sp,


b. (5 points) How many instructions are executed for given input n in the recursive factorial in the slides? + MIPS code: fact: addi $sp, $sp, -8 SW $ra, 4($sp) SW $a0, 0($sp) slti $t0, $a0, 1 beg $t0, $zero, L1 addi $v0, $zero, 1 addi $sp, $sp, 8 jr $ra L1: addi $a0, $a0, -1 jal fact iw $a0, 0($sp) lw $ra, 4($sp). addi $sp, $sp, 8 mul $v0, $a0, $v0 jr $ra # adjust stack for 2 items # save return address # save argument # test for n = 0 # else n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
