Basic syntax & instructions in Intel syntax assembly.
mov dest, src                   ; dest = src (if src is a register)
lea dest, [src]                 ; dest = src (load the address stored in src register into dest register)
test a, b                       ; performs a AND b and sets the FLAGS registers accordingly
cmp a, b                        ; performs a MINUS b and sets the FLAGS registers accordinglyAlign stack to 16-bit for certain library calls
push ebp
mov ebp, esp
and esp, 0xfffffff0
; ...
mov esp, ebp
pop ebp- Save EBP value on stack
 - Save ESP value into EBP
 - Now:
- EBP points to top of stack
 - ESP points to top of stack
 
 - Truncate ESP bottom 4 bits for alignment (this makes sure the address is a multiple of 16; since stack grows towards 0, no data will be overwritten)
 - Now:
- EBP points to original top-of-stack
 - ESP points to newly aligned top-of-stack
 
 - Do stuff with library calls
 - Restore ESP from EBP register
 - Restore EBP from stack
 
x86 leave instruction
mov esp, ebp   ; restore caller ESP from EBP
pop ebp        ; restore caller EBP at ESP