Calling C function from x64 assembly with registers instead of stack
This answer puzzled me. According to the standard C calling conventions , the standard way to call C functions is to push arguments to the stack and to call the subroutine. That is clearly different from syscalls , where you set different registers with appropriate arguments and then syscall . However, the answer mentioned above gives this GAS code: .global main .section .data hello: .asciz "Hello\n" .section .text main: movq $hello, %rdi movq $0, %rax call printf movq $0, %rax ret which works with gcc hello.s -o hello . The part that calls printf is: movq $hello, %rdi movq $0, %rax call