WCU / Cybersecurity
~/CSC 471/Class 02/KP 09
Class 02 · KP 09 / 23

lea: Load Effective Address

lea computes an address but does not touch memory —

it just stores the arithmetic result.

lea  rax, [rbx + 8]        ; rax = rbx + 8    (no memory access!)
mov  rax, [rbx + 8]        ; rax = *(rbx + 8) (loads from memory)

; Compilers love lea for fast arithmetic:
lea  rax, [rdi + rdi*4]    ; rax = rdi * 5
lea  rax, [rdi*8]          ; rax = rdi * 8
lea  rcx, [rax + rbx + 3]  ; rcx = rax + rbx + 3  (3-input add)
Key Takeaway

See lea into a non-pointer register? It is almost always arithmetic, not a pointer load.