I've already read many answers regarding the LEA instruction and I think, I understand them, but if I'm trying to understand the following assembly code, then this subject doesn't make sense to me anymore.
And the corresponding C program:
So leal (%rdi,%rsi), %eax adds two addresses - addresses of x and y and writes the result of this into %eax? What is the point of this? Why would we need an address of t1? There is nothing in there at this address if we dereference it.
Furthermore, in the next instruction, we add the value of z (or the address of z?) and the address that we calculated in the lea instruction. This all doesn't make sense to me.
Or maybe I don't understand the lea instruction correctly? And the lea instruction adds the values of x and y and writes the result of the addition to a memory location and writes the address of this memory location (t1) into %eax? Why would we then say that the lea instruction doesn't perform a memory access?
I am stuck. Could someone please tell me what are the values (values or addresses) in the registers of the first two instructions? It would really help.
Thanks for your help.