icp/oer/courses/c-basics/sections/01-introduction/03-assembly/program.c

25 lines
756 B
C

.file "assembly.c" # information for the debugger
.section .rodata # declares read only section
.LC0:
.string "Hello World!" # the Hello World! string we want to print
.text
.globl main # defines main as a global label for the linker
.type main, @function # declares main as a function
main:
pushq %rbp # function prologue
movq %rsp, %rbp
leaq -4144(%rsp), %rsp
orq $0, (%rsp)
leaq 4128(%rsp), %rsp
movl %edi, -4(%rbp)
movq %rsi, -16(%rbp)
leaq .LC0(%rip), %rdi # load hello world! string
movl $0, %eax
call printf@PLT # call printf
movl $0, %eax
leave
ret # return from the program
.size main, .-main # some information
.ident "GCC: (GNU) 6.2.1 20160830"
.section .note.GNU-stack,"",@progbits