# using a frame pointer to handle stack growing during function execution f: begin # move frame pointer push $ra # save $ra on stack li $v0, 5 # scanf("%d", &length); syscall mul $v0, $v0, 4 # calculate array size sub $sp, $sp, $v0 # move stack_pointer down to hold array # ... more code ... pop $ra # restore $ra end jr $ra # return