# Execution begins at address 0 .pos 0 init: irmovl Stack, %esp # Set up Stack pointer irmovl Stack, %ebp # Set up base pointer jmp Main # Execute main program Main: irmovl $4,%eax pushl %eax # Push 4 (calling Pow2(4)) call Pow2 # comput 2 to the 4 halt # int Pow2(int x) computes 2^^x Pow2: pushl %ebp rrmovl %esp,%ebp mrmovl 8(%ebp),%edx # edx = x irmovl $1, %eax # answer = 1 andl %edx,%edx je End Loop: dbl %eax irmovl $-1,%ecx # addl %ecx,%edx # x-- jne Loop # Stop when 0 End: popl %ebp ret /* $end sum-ys 0 */ .pos 0x100 Stack: # The stack goes here