Conditional: switch
switch( i ) {
// falls through
case 2: i += 2 ;
$s1
i
break; $s4 temp
case 3: i += 3 ;
}
addi $s4, $zero, 1 # case 1: set temp to 1
bne $s1, $s4, C2_COND # false: branch to case 2 cond
j C1_BODY # true: branch to case 1 body
C2_COND: addi $s4, $zero, 2 # case 2: set temp to 2
bne $s1, $s4, C3_COND # false: branch to case 3 cond
j C2_BODY # true: branch to case 2 body
C3_COND: addi $s4, $zero, 3 # case 3: set temp to 3
bne $s1, $s4, EXIT # false: branch to exit
j C3_BODY # true: branch to case 3 body
C1_BODY: addi $s1, $s1, 1 # case 1 body: i++
C2_BODY: addi $s1, $s1, 2 # case 2 body: i += 2
j EXIT # break
C3_BODY: addi $s1, $s1, 3 # case 3 body: i += 3
EXIT: