Code:

## Program to computes the value of Fibonacci number.
.text
.globl __start
__start:
sub $sp,$sp,4 # push return address
sw $ra,($sp)
sub $sp,$sp,4 # push caller's frame pointer
sw $fp,($sp)
sub $fp,$sp,8 # $fp = $sp - space_for_variables
move $sp,$fp
li $v0,4 # call to print string
la $a0,pr1
syscall
li $v0,5 # call to read integer
syscall
sw $v0,0($fp) # save in $v0
nop
lw $a0,0($fp) # load variable into $a0
nop
jal fib
nop
sw $v0,4($fp) # b = fib(a)
nop
li $v0,4 # call to print string
la $a0,pr2
syscall
lw $a0,4($fp)
li $v0,1 # call to print integer
syscall
add $sp,$fp,8 # $sp = $fp + space_for_variables
lw $fp,($sp) # pop $fp
add $sp,$sp,4
lw $ra,($sp) # pop $ra
add $sp,$sp,4
jr $ra # return to OS
nop
.data
pr1: .asciiz "Enter an interger:"
pr2: .asciiz "\nThe Fibonacci number is:"
# int Fib( int n )
# {
# if( n <= 0 )
# return 0
# else if( n == 1 )
# return 1
# else
# x = Fib( n-1 )
# y = Fib( n-2 )
# return x + y
# endif
# }
.text
.globl fib
fib:
sub $sp,$sp,4 # push return address
sw $ra,($sp)
sub $sp,$sp,4 # push caller's frame pointer
sw $fp,($sp)
sub $sp,$sp,4 # push register $s1
sw $s1,($sp)
sub $fp,$sp,0 # $fp = $sp - space_for_variables (==0)
move $sp,$fp
move $s1,$a0 # save argument in $s1
li $t1,0 # get a==0
bgt $s1,$t1,lo1 # if (n <= 0)
nop
li $v0,0 # return 0
j exit
nop
lo1:
move $s1,$a0 # save argument in $s1
li $t1,1 # get a==1
beq $s1,$t1,lo2 # if (n == 1)
nop
bgt $s1,$t1,lo3 # if (n <=1)
nop
lo2: li $v0,1 # return 1
j exit
nop
lo3:
sub $a0,$s1,1 # param = n-1
jal fib # compute fib(n-1)
nop
move $v0,$s1 # x = Fib( n-1 )
sub $a0,$s1,2 # set param to n-2
jal fib # and make recursive call
nop
add $v0,$v0,$s1# add fib(n-2)
exit:
add $sp,$fp,0 # $sp = $fp + space_for_variables (==0)
lw $s1,($sp)
add $sp,$sp,4
lw $fp,($sp) # pop $fp
add $sp,$sp,4
lw $ra,($sp) # pop $ra
add $sp,$sp,4
jr $ra # return to OS
nop

agrees : good way to put the pwnsauce down CS style