For the following C code, variables a, b, c, and n correspond to the registers $s0, $s1, $s2 and $a0 respectively and i corresponds to $t0. The callee doesn’t have to preserve registers $t1-$t9, if used. int iterFib(int n) { int a = 0, b = 1, c, i; for(i=2; i<=n; i++) { c = a + b; a = b; b = c; } return b; } What are the missing MIPS instructions? Please record only the letter in lower case. iterFib: addi $sp, $sp, -12 sw $s0, 8($sp) sw $s1, 4($sp) ---Instruction 1--- add $s0, $zero, $zero addi $s1, $zero, 1 add $t0, $zero, $zero addi $t1, $a0, 1 forFib: slt $t2, $t0, $t1 ---Instruction 2--- add $s2, $s1, $s2 add $s0, $zero, $s1 add $s1, $zero, $s2 addi $t0, $t0, 1 j forFib exitFib: add $v0, $zero, $s1 jr $ra Instruction 1 is a. No instruction b. addi $sp, $sp, 4 c. add $sp, $sp, -4 d. lw $s2, 0($sp) e. sw $s2, 0($sp) f. bne $t2, $zero, exitFib g. beq $t2, $zero, exitFib h. None of the above Instruction 2 is a. j iterFib b. addi $sp, $sp, 4 c. add $sp, $sp, -4 d. lw $s0, 0($sp) e. addi $sp, $sp, -4 f. bne $t2, $zero, exitFib g. beq $t2, $zero, exitFib h. None of the above

Respuesta :

Answer:

a)

Instruction 1 will be: sw $s2,0($s0)

Answer is option e.

b)

Instruction 2 will be: beq $t2,$zero,exitFib

Answer is option g.

Explanation:

At the point of instruction 1, It should store the content of s2 into the stack.

At the point of instruction 2, It will check if the value of t2 is one or not. If it is zero it should exit.