Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- .text
- .globl main
- main:
- li $v0,5
- syscall
- move $a0,$v0
- jal funcion
- move $a0,$v0
- li $v0,1
- syscall
- li $v0,10
- syscall
- funcion:
- beq $a0, $zero, trivial
- li $t0,1
- beq $a0,$t0, trivial
- addi $sp, $sp,-4
- sw $ra,($sp)
- addi $sp,$sp,-4
- sw $a0,($sp)
- srl $a0,$a0,1
- jal funcion
- lw $a0, ($sp)
- addi $sp,$sp,4
- andi $t0,$a0,1
- add $v0,$v0,$t0
- lw $ra, ($sp)
- addi $sp,$sp,4
- jr $ra
- trivial:
- move $v0,$a0
- jr $ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement