Question: Translate the following MIPS function back to equivalent C code: func: addi $t0, $zero, 1 # i = 1 addi $v0, $zero, 1 # v

Translate the following MIPS function back to equivalent C code:

func:

addi $t0, $zero, 1 # i = 1

addi $v0, $zero, 1 # v = 1

Loop:

sle $t1, $t0, $a0 # set $t1 to 1 if (i <= arg)

beq $t1, $zero, Exit # exit loop if (i > arg)

mul $v0, $v0, $t0 # v *= i

addi $t0, $t0, 1 # i++

j Loop # loop

Exit:

jr $ra

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!