.global main main: mov $12, %r8 mov $16, %r9 call addem mov $format, %rdi mov %rax, %rsi xor %rax, %rax call printf ret format: .asciz "Result: %ld\n" # Parameters: Passed as R8 and R9 # Return value will be in rax addem: push %rbp mov %rsp, %rbp sub $8, %rsp movq $54, -8(%rbp) # push $17 add %r8, %r9 add -8(%rbp), %r9 # Put something into a local variable, then add it into the sum mov %r9, %rax mov %rbp, %rsp pop %rbp ret