# Execution begins at address 0 .pos 0 irmovq stack, %rsp # Set up stack pointer call main # Execute main program halt # Terminate program # Sample linked list .align 8 # Source block src: .quad 0x00a .quad 0x0b0 .quad 0xc00 # Destination block dest: .quad 0x111 .quad 0x222 .quad 0x333 main: irmovq src , %rdi irmovq dest , %rsi irmovq $3 , %rdx call copyblock ret # sum_list - Recursive version of sum_list # start in %rdi copyblock: xorq %rax , %rax loop: andq %rdx , %rdx jle end mrmovq (%rdi) , %rcx irmovq $8 , %rbx addq %rbx , %rdi rmmovq %rcx , (%rsi) addq %rbx , %rsi xorq %rcx , %rax irmovq $1 , %rbx subq %rbx , %rdx jmp loop end: ret # Stack starts here and grows to lower addresses .pos 0x200 stack: