# switch.s .text .globl main main: lw $t0,op lw $t1,x bge $t0,3,default sll $t0,$t0,2 lw $t0,stable($t0) jr $t0 case0: mul $t2,$t1,3 # $t2 = x*3 j endswitch case1: addi $t2,$t1,5 # $t2 = x+5 j endswitch case2: div $t2,$t1,2 # $t2 = x/2 j endswitch default: move $t2,$t1 # $t2 = x endswitch: sw $t2,y .data op: .word 1 # provare con 0, 1, 2 e 5 stable: .word case0,case1,case2 x: .word 6 y: .word 0