As far as I understood:
- %rdi = 1st argument = x
- %rsi = 2nd argument = y
- %rdx = 3rd argument = z
- The others manipulate these registers... and store in a return value register
The 3rd line on the assembly code leaq (%rsi, %rsi, 2), %rdx
, which as I translate it: z = y + 2*y
.
I'm confused, is this code wrong, or is it an assembly magic?