Question: 3 MIPS: Translate MIPS program into C program [ 1 2 pts ] Read the following MIPS code segment and comments. Translate it into C

3 MIPS: Translate MIPS program into C program [12pts]
Read the following MIPS code segment and comments. Translate it into C code. Specifically,
the registers $s0,$s1,$s2,$s3 store signed integers x,y,z,w, respectively. Complete the C
code using expressions of x,y,z,w. Do not care too much about the grammars of C. You will
get full marks as long as the meanings are correct.
MIPS code segment:
bge $s0,$s1,L1,# go to L1 if $s0$s1
bgt $s2, $s3, skip # go to skip if $s2>$s3
L1:
bne $s0,$s2, skip # go to skip if $s0$s2
L2: , # inner if statement
bne $s2, $s3, L3 # go to L3 if $s2!= $s3
addu $s0,$s1,$s2
j skip
L3:
addiu $s2,$s1,-2
skip:
C code you need to complete:
if (some condition 1[5pts]){
if (some condition 2[3pts])
{
some code 1[1pt]
}else{
some code 2[1pt]
}
}
 3 MIPS: Translate MIPS program into C program [12pts] Read the

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!