Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

C to assembly - leaq instruction [duplicate]

Writer Andrew Henderson

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?

enter image description here

5

1 Answer

simple explanation

it moves the address not the values

2