OK im sure of u guys might of encountered this little exercise before. Anyways, I'm having trouble figuring out one of the phases.
Anyways here's the code:
/* The second phase is harder. No one will ever figure out
* how to defuse this... */
input = read_line();
phase_2(input);
phase_defused();
And here's the assembly of phase_2():
0x08048bbd <phase_2+4>: sub $0x2c,%esp
0x08048bc0 <phase_2+7>: lea 0xffffffd8(%ebp),%eax
0x08048bc3 <phase_2+10>: push %eax
0x08048bc4 <phase_2+11>: pushl 0x8(%ebp)
0x08048bc7 <phase_2+14>: call 0x8048f1d <read_six_numbers>
0x08048bcc <phase_2+19>: add $0x10,%esp
0x08048bcf <phase_2+22>: cmpl $0x1,0xffffffd8(%ebp)
0x08048bd3 <phase_2+26>: je 0x8048bda <phase_2+33>
0x08048bd5 <phase_2+28>: call 0x8049449 <explode_bomb>
0x08048bda <phase_2+33>: mov $0x1,%ebx
0x08048bdf <phase_2+38>: lea 0x1(%ebx),%eax
0x08048be2 <phase_2+41>: imul 0xffffffd4(%ebp,%ebx,4),%e
ax
0x08048be7 <phase_2+46>: cmp %eax,0xffffffd8(%ebp,%ebx,
4)
0x08048beb <phase_2+50>: je 0x8048bf2 <phase_2+57>
0x08048bed <phase_2+52>: call 0x8049449 <explode_bomb>
0x08048bf2 <phase_2+57>: inc %ebx
0x08048bf3 <phase_2+58>: cmp $0x5,%ebx
0x08048bf6 <phase_2+61>: jle 0x8048bdf <phase_2+38>
0x08048bf8 <phase_2+63>: mov 0xfffffffc(%ebp),%ebx
0x08048bfb <phase_2+66>: leave
0x08048bfc <phase_2+67>: ret
End of assembler dump.
And here's the assembly of read_six_numbers:
0x08048f1d <read_six_numbers+0>: push %ebp
0x08048f1e <read_six_numbers+1>: mov %esp,%ebp
0x08048f20 <read_six_numbers+3>: sub $0x8,%esp
0x08048f23 <read_six_numbers+6>: mov 0xc(%ebp),%edx
0x08048f26 <read_six_numbers+9>: lea 0x14(%edx),%eax
0x08048f29 <read_six_numbers+12>: push %eax
0x08048f2a <read_six_numbers+13>: lea 0x10(%edx),%eax
0x08048f2d <read_six_numbers+16>: push %eax
0x08048f2e <read_six_numbers+17>: lea 0xc(%edx),%eax
0x08048f31 <read_six_numbers+20>: push %eax
0x08048f32 <read_six_numbers+21>: lea 0x8(%edx),%eax
0x08048f35 <read_six_numbers+24>: push %eax
0x08048f36 <read_six_numbers+25>: lea 0x4(%edx),%eax
0x08048f39 <read_six_numbers+28>: push %eax
0x08048f3a <read_six_numbers+29>: push %edx
0x08048f3b <read_six_numbers+30>: push $0x80498bd
0x08048f40 <read_six_numbers+35>: pushl 0x8(%ebp)
0x08048f43 <read_six_numbers+38>: call 0x80488f4 <_init+376>
0x08048f48 <read_six_numbers+43>: add $0x20,%esp
0x08048f4b <read_six_numbers+46>: cmp $0x5,%eax
0x08048f4e <read_six_numbers+49>: jg 0x8048f55 <read_six_numbers+56>
0x08048f50 <read_six_numbers+51>: call 0x8049449 <explode_bomb>
0x08048f55 <read_six_numbers+56>: leave
0x08048f56 <read_six_numbers+57>: ret
It's quite obvious that the answers are going to be 6 separate numbers. Any hints on what to do?