My machine programming class is very cool. One of our assignments is to diffuse 6 different phases of a bomb by figuring what the password is for each phase. I'm just amazed that what started out looking like complete gibberish now makes a lot of sense to me.
I got a huge rush from solving phase_2. There's no better feeling than struggling through a problem and eventually solving it.
This is what the assembler code looked like for phase_2:
Code:
Dump of assembler code for function phase_2:
0x08048b44 <phase_2+0>: push %ebp
0x08048b45 <phase_2+1>: mov %esp,%ebp
0x08048b47 <phase_2+3>: sub $0x28,%esp
0x08048b4a <phase_2+6>: lea -0x1c(%ebp),%eax
0x08048b4d <phase_2+9>: mov %eax,0x4(%esp)
0x08048b51 <phase_2+13>: mov 0x8(%ebp),%eax
0x08048b54 <phase_2+16>: mov %eax,(%esp)
0x08048b57 <phase_2+19>: call 0x8048fcc <read_six_numbers>
0x08048b5c <phase_2+24>: mov -0x1c(%ebp),%eax
0x08048b5f <phase_2+27>: cmp $0x1,%eax
0x08048b62 <phase_2+30>: je 0x8048b69 <phase_2+37>
0x08048b64 <phase_2+32>: call 0x8049635 <explode_bomb>
0x08048b69 <phase_2+37>: movl $0x1,-0x4(%ebp)
0x08048b70 <phase_2+44>: jmp 0x8048b99 <phase_2+85>
0x08048b72 <phase_2+46>: mov -0x4(%ebp),%eax
0x08048b75 <phase_2+49>: mov -0x1c(%ebp,%eax,4),%ecx
0x08048b79 <phase_2+53>: mov -0x4(%ebp),%eax
0x08048b7c <phase_2+56>: sub $0x1,%eax
0x08048b7f <phase_2+59>: mov -0x1c(%ebp,%eax,4),%edx
0x08048b83 <phase_2+63>: mov -0x4(%ebp),%eax
0x08048b86 <phase_2+66>: add $0x1,%eax
0x08048b89 <phase_2+69>: imul %edx,%eax
0x08048b8c <phase_2+72>: cmp %eax,%ecx
0x08048b8e <phase_2+74>: je 0x8048b95 <phase_2+81>
0x08048b90 <phase_2+76>: call 0x8049635 <explode_bomb>
0x08048b95 <phase_2+81>: addl $0x1,-0x4(%ebp)
0x08048b99 <phase_2+85>: cmpl $0x5,-0x4(%ebp)
0x08048b9d <phase_2+89>: jle 0x8048b72 <phase_2+46>
0x08048b9f <phase_2+91>: leave
0x08048ba0 <phase_2+92>: ret
For those who don't understand assembler, I'd be happy to explain what is happening. Let me know.
Onto phase 3...