1

I am having trouble figuring out this code. We are supposed to difuse this bomb by figuring out how to not enter the explode bomb calls by entering 2 digits seperated by a space. I found out the 2 digits stuff by myself. I realize that the mov and jmps in the second half of the problem is basically a case statement, but i cant seem to get out of it. I thought that the jmpq was the key to this whole problem. It seems the only number that effects this code is the first one i put in. The second 1 seems to not effect it much at all. I am assuming i use the jmpq to jump past all the case statements and go straight to the last two operations. If my first number is greater than 8 the bomb explodes, other than that the other number seems to kind of effect where the jump goes but i couldnt get it past a certain point. Please help me understand what is going on in this code.

Dump of assembler code for function phase_3:
=> 0x0000000000400f53 <+0>: sub    $0x18,%rsp
   0x0000000000400f57 <+4>: lea    0x8(%rsp),%rcx
   0x0000000000400f5c <+9>: lea    0xc(%rsp),%rdx
   0x0000000000400f61 <+14>:    mov    $0x4027ad,%esi
   0x0000000000400f66 <+19>:    mov    $0x0,%eax
   0x0000000000400f6b <+24>:    callq  0x400c30 <__isoc99_sscanf@plt>
   0x0000000000400f70 <+29>:    cmp    $0x1,%eax
   0x0000000000400f73 <+32>:    jg     0x400f7a <phase_3+39>
   0x0000000000400f75 <+34>:    callq  0x40154f <explode_bomb>
   0x0000000000400f7a <+39>:    cmpl   $0x7,0xc(%rsp)
   0x0000000000400f7f <+44>:    ja     0x400fbd <phase_3+106>
   0x0000000000400f81 <+46>:    mov    0xc(%rsp),%eax
   0x0000000000400f85 <+50>:    jmpq   *0x4024e0(,%rax,8)
   0x0000000000400f8c <+57>:    mov    $0x20d,%eax
   0x0000000000400f91 <+62>:    jmp    0x400fce <phase_3+123>
   0x0000000000400f93 <+64>:    mov    $0x313,%eax
   0x0000000000400f98 <+69>:    jmp    0x400fce <phase_3+123>
   0x0000000000400f9a <+71>:    mov    $0x37f,%eax
   0x0000000000400f9f <+76>:    jmp    0x400fce <phase_3+123>
   0x0000000000400fa1 <+78>:    mov    $0x2dc,%eax
   0x0000000000400fa6 <+83>:    jmp    0x400fce <phase_3+123>
   0x0000000000400fa8 <+85>:    mov    $0x125,%eax
---Type <return> to continue, or q <return> to quit---
   0x0000000000400fad <+90>:    jmp    0x400fce <phase_3+123>
   0x0000000000400faf <+92>:    mov    $0x168,%eax
   0x0000000000400fb4 <+97>:    jmp    0x400fce <phase_3+123>
   0x0000000000400fb6 <+99>:    mov    $0x2d9,%eax
   0x0000000000400fbb <+104>:   jmp    0x400fce <phase_3+123>
   0x0000000000400fbd <+106>:   callq  0x40154f <explode_bomb>
   0x0000000000400fc2 <+111>:   mov    $0x0,%eax
   0x0000000000400fc7 <+116>:   jmp    0x400fce <phase_3+123>
   0x0000000000400fc9 <+118>:   mov    $0x1cb,%eax
   0x0000000000400fce <+123>:   cmp    0x8(%rsp),%eax
   0x0000000000400fd2 <+127>:   je     0x400fd9 <phase_3+134>
   0x0000000000400fd4 <+129>:   callq  0x40154f <explode_bomb>
   0x0000000000400fd9 <+134>:   add    $0x18,%rsp
   0x0000000000400fdd <+138>:   retq

0 Answers0