Directivesbegin with a dot and indicate structural information useful to the assembler, linker, or debugger. but are not in and of themselves assembly instructions. For example,
.filesimply records the name of the original source file.
.dataindicates the start of the data section of the program, while
.textindicates the start of the actual program code.
.stringindicates a string constant within the data section, and
.globlmain indicates that the label main is a global symbol that can be accessed by other code modules. (You can ignore most of the other directives.)
Labelsend with a colon and indicate by their position the association between names and locations. For example, the label
.LC0:indicates that the immediately following string should be called
main:indicates that the instruction pushq %rbp is the first instruction of the main function. By convention, labels beginning with a dot are temporary local labels generated by the compiler, while other symbols are user-visible functions and global variables.
Instructionsare the actual assembly code (pushq %rbp), typically indented to visually distinguish them from directives and labels.
pushq %rbp ; Save address of previous stack frame movq %rsp, %rbp ; Address of current stack frame subq $16, %rsp ; Reserve 16 bytes for local variables ; ... function ... movq %rbp, %rsp ; \ equivalent to the popq %rbp ; / 'leave' instruction ret