I'm fiddling with the gcc's optimisation options and found that these lines:
int bla(int moo) {
return moo * 384;
}
are translated to these:
0: 8d 04 7f lea (%rdi,%rdi,2),%eax
3: c1 e0 07 shl $0x7,%eax
6: c3 retq
I understand shifting represents a multiplication by 2^7. And the first line must be a multiplication by 3.
So i am utterly perplexed by the "lea" line. Isn't lea supposed to load an address?