The following C code:
int sum(int x, int y) {
return x + y;
}
Compiles to:
add:
leal (%rdi,%rsi), %eax
ret
I've only seen lea used to move a memory address from one place to another, but here is seems to be moving a value-sum into eax. How does that work?