8. (15 pts) Given the following recursive Fibonacci function; int Fibonacci (int n) { if (n == 0) { else if (n=1) { else
Posted: Fri Jul 08, 2022 7:28 am
8. (15 pts) Given the following recursive Fibonacci function; int Fibonacci (int n) { if (n == 0) { else if (n=1) { else { return 0; int valuel int value2 The following shows the corresponding MIPS program but incompleted. Please complete the missing part (indicated by ---------) of the following program. Assume the input value is stored in $a0. addi $a0, $a0, -1 jal Fibonacci move $t1, $ve .text Fibonacci: beq $a0, $zero, Case li ste, 1 beq $a0, $t0, Casel addi $a0, $a0, -2 jal Fibonacci move $12, $v0 Case: add $v0, $t1, $tz jr Sra Casel: li $v0, 0 jr $ra return 1; li $v0, 1 Fibonacci (n-1); Fibonacci (n-2); return valuel+ valuez; jr $ra