hex: bne $a0,$t1,elseif
li $t1,1
li $t2,2
li $v0,1
jr $ra
elseif: bne $a0, $t2,else
li $v0,6
jr $ra
else: addi $sp,$sp,-12
sw $ra,$ra 0($sp) -
addi $t3,$a0,-1 ~
sll $t3, $t2,1
sw $a0,$a0,4($sp) -
sw $t3,8($sp)
lw $ra -
lw $a0 -
addi $t3,4
sub $t4,$t3,$t0
lw $t4 -
sw $v0,$t4 -
lw $ra -
lw $a0 -
j $ra
if (n == 1)
return 1
else if (n == 2)
return 6
else
return 2*hex(n-1) - hex(n-2) + 4