A downward arc corresponds to a push of one stack frame. An upward arc corresponds to a pop of one stack frame.
main() Here is the main routine's pseudocode and prolog. The linkage for follows the Rules for Main, on page 8 of this chapter. Notice that there are two variables.
# main()
# {
# int a, b; // a: 0($fp), b: 4($fp)
# write("enter an int:")
# read( a );
# b = fact( a );
# write("factorial is:")
# print( b );
# }
.text
.globl main
main:
# prolog
# 1. $sp has been initialized by QTSPIM
sub $fp,$sp, # 2. $fp = $sp - space_for_variables
move $sp,$fp # 3. $sp = $fp
Fill in the blanks.