subroutine:
# save $ra and stack
sw $fp, -4($sp)
addi $fp, $sp, -4
sw $ra, -4($fp)
# save the $s*
sw $s2, -8($fp)
sw $s3, -12($fp)
addi $sp, $fp, -12
...
# restore the $s*
lw $s2, -8($fp)
lw $s3, -12($fp)
# restore the ra and stack
lw $ra, -4($fp)
addi $sp, $fp, 4
lw $fp, -4($sp)
jr $ra
subroutine:
# save $ra and stack
sw $fp, -4($sp)
addi $fp, $sp, -4
sw $ra, -4($fp)
# save the $s*
sw $s2, -8($fp)
sw $s3, -12($fp)
# int ary[10];
# $fp -16 to $fp -52 is the array
addi $sp, $fp, -52
...
# restore the $s*
lw $s2, -8($fp)
lw $s3, -12($fp)
# restore the ra and stack
lw $ra, -4($fp)
addi $sp, $fp, 4
lw $fp, -4($sp)
jr $ra