See Below
The epilog of a subroutine is the part that prepares the values that are returned to the caller and restores the registers and stack to where they were when the caller made the call.
# int mysub( int arg )
# {
# int b,c; // b: 0($fp)
# // c: 4($fp)
# b = arg*2;
# c = b + 7;
#
# return c;
# }
.text
.globl mysub
mysub:
# prolog
sub $sp,$sp,4 # 1. Push return address
sw $ra,($sp)
sub $sp,$sp,4 # 2. Push caller's frame pointer
sw $ra,($sp)
sub $sp,$sp,4 # 3. Push register $s1
sw $s1,($sp)
addiu $fp,$sp,8 # 4. $fp = $sp + space_for_variables
move $sp,$fp # 5. $sp = $fp
# body of subroutine
mul $s1,$a0,2 # arg*2
sw $s1,0($fp) # b = " "
lw $t0,0($fp) # get b
add $t0,$t0,7 # b+7
sw $t0,4($fp) # c = " "
# epilog
lw $v0,___(___) # 1. Put return value in $v0
add $sp,$fp,____ # 2. $sp = $fp +space_for_variables
lw $s1,(____) # 3. Pop register $s1
add ___,___,___ #
lw $fp,(____) # 4. Pop $fp
add ___,___,___ #
lw $ra,(____) # 5. Pop $ra
add ___,___,___ #
jr $ra # 6. return to caller