Yet again, I am having issues finding answers to the most basic of questions. This time I am working on phase 2 of a binary bomb for a class assignment. I'll post the disassembled code below.
I am having a hard time understanding what is happening on line <+107>. From what I understand so far, it is trying to load the address from the arithmetic operation of ((4 * %edx) + %eax) into the %eax register. As of now, which I could very well be wrong, this is what is located in my registers where x, y, z are the three arguments entered in the call to scanf:
%eax: y
%edx: z
Thus, the program is trying to load the address of ((4*z)+y)? I don't know what this value would look like in order for it to be stored into %eax.
My question relates to a specific application of the lea instruction within a binary bomb. I had previously read through the post here: What's the purpose of the LEA instruction? but I still did not understand how it applied to my scenario.
0x08048764 <+0>: sub $0x3c,%esp
0x08048767 <+3>: lea 0x2c(%esp),%eax
0x0804876b <+7>: mov %eax,0x10(%esp)
0x0804876f <+11>: lea 0x28(%esp),%eax
0x08048773 <+15>: mov %eax,0xc(%esp)
0x08048777 <+19>: lea 0x24(%esp),%eax
0x0804877b <+23>: mov %eax,0x8(%esp)
0x0804877f <+27>: movl $0x8048ba7,0x4(%esp)
0x08048787 <+35>: mov 0x804b040,%eax
0x0804878c <+40>: mov %eax,(%esp)
0x0804878f <+43>: call 0x8048480 <__isoc99_fscanf@plt>
0x08048794 <+48>: cmp $0x3,%eax
0x08048797 <+51>: je 0x80487a5 <phase_2_of_5+65>
0x08048799 <+53>: movl $0x2,(%esp)
0x080487a0 <+60>: call 0x80486ef <explode>
0x080487a5 <+65>: mov 0x24(%esp),%edx
0x080487a9 <+69>: cmp $0x4,%edx
0x080487ac <+72>: jg 0x80487ba <phase_2_of_5+86>
0x080487ae <+74>: movl $0x2,(%esp)
0x080487b5 <+81>: call 0x80486ef <explode>
0x080487ba <+86>: mov 0x28(%esp),%eax
0x080487be <+90>: cmp $0xa,%eax
0x080487c1 <+93>: jle 0x80487cf <phase_2_of_5+107>
0x080487c3 <+95>: movl $0x2,(%esp)
0x080487ca <+102>: call 0x80486ef <explode>
0x080487cf <+107>: lea (%eax,%edx,4),%eax
0x080487d2 <+110>: cmp 0x2c(%esp),%eax
0x080487d6 <+114>: je 0x80487e4 <phase_2_of_5+128>
0x080487d8 <+116>: movl $0x2,(%esp)
0x080487df <+123>: call 0x80486ef <explode>
0x080487e4 <+128>: add $0x3c,%esp
0x080487e7 <+131>: ret