x86-64 Registers

64-bit 32-bit 16-bit 8-bit Special Purpose
for functions
When calling
a function
When writing
a function
raxeaxaxah,al Return Value Might be changed Use freely
rbxebxbxbh,bl   Will not be changed Save before using!
rcxecxcxch,cl 4th integer argument Might be changed Use freely
rdxedxdxdh,dl 3rd integer argument Might be changed Use freely
rsiesisisil 2nd integer argument Might be changed Use freely
rdiedidisil 1st integer argument Might be changed Use freely
rbpebpbpbpl Frame Pointer Maybe Be Careful Maybe Be Careful
rspespspspl Stack Pointer Be Very Careful! Be Very Careful!
r8r8dr8wr8b 5th integer argument Might be changed Use freely
r9r9dr9wr9b 6th integer argument Might be changed Use freely
r10r10dr10wr10b   Might be changed Use freely
r11r11dr11wr11b   Might be changed Use freely
r12r12dr12wr12b   Will not be changed Save before using!
r13r13dr13wr13b   Will not be changed Save before using!
r14r14dr14wr14b   Will not be changed Save before using!
r15r15dr15wr15b   Will not be changed Save before using!

"Might be changed" = "Caller saved";  "Will not be changed" = "Callee saved".

The first 8 floating point arguments are passed in registers xmm0 to xmm7.


Basic x86-64 Instructions

Arithmetic Logic Jumps Stack
add ⟨dest⟩ ⟨src⟩
sub ⟨dest⟩ ⟨src⟩
inc ⟨dest⟩
dec ⟨dest⟩
imul ⟨dest⟩ ⟨src⟩
div ⟨dest⟩
and ⟨dest⟩ ⟨src⟩
or ⟨dest⟩ ⟨src⟩
not ⟨dest⟩
shr ⟨dest⟩, ⟨imm⟩
shr ⟨dest⟩, cl
shl ⟨dest⟩, ⟨imm⟩
shl ⟨dest⟩, cl
sar ⟨dest⟩, ⟨imm⟩
sar ⟨dest⟩, cl
jmp ⟨label⟩
cmp ⟨dest⟩ ⟨src⟩
je ⟨label⟩
jne ⟨label⟩
jg ⟨label⟩
jge ⟨label⟩
jl ⟨label⟩
jle ⟨label⟩
call ⟨label⟩
ret
push ⟨src⟩
pop ⟨dest⟩

⟨dest⟩ is register or memory
⟨src⟩ is register or memory or immediate
⟨imm⟩ is immediate (byte only)