0

I'm not understanding what the function below does. From what I gather, function 4 does something like (x+x)*2 or it does something like (high-low)/2 if a condition is reached. (I might be wrong on this). From reading the code, I also understood that in order to "defuse" the bomb. I need two decimal inputs, and the second one should be 14. I'm stuck trying to figure out the first value, and trying to identify the correct formula to use in order to figure out the first value.

Function_4

00000000004010b2 <func4>:
  4010b2:   55                      push   %rbp
  4010b3:   48 89 e5                mov    %rsp,%rbp
  4010b6:   89 d0                   mov    %edx,%eax
  4010b8:   29 f0                   sub    %esi,%eax
  4010ba:   89 c1                   mov    %eax,%ecx
  4010bc:   c1 e9 1f                shr    $0x1f,%ecx
  4010bf:   01 c8                   add    %ecx,%eax
  4010c1:   d1 f8                   sar    %eax
  4010c3:   8d 0c 30                lea    (%rax,%rsi,1),%ecx
  4010c6:   39 f9                   cmp    %edi,%ecx
  4010c8:   7e 0c                   jle    4010d6 <func4+0x24>
  4010ca:   8d 51 ff                lea    -0x1(%rcx),%edx
  4010cd:   e8 e0 ff ff ff          callq  4010b2 <func4>
  4010d2:   01 c0                   add    %eax,%eax
  4010d4:   eb 15                   jmp    4010eb <func4+0x39>
  4010d6:   b8 00 00 00 00          mov    $0x0,%eax
  4010db:   39 f9                   cmp    %edi,%ecx
  4010dd:   7d 0c                   jge    4010eb <func4+0x39>
  4010df:   8d 71 01                lea    0x1(%rcx),%esi
  4010e2:   e8 cb ff ff ff          callq  4010b2 <func4>
  4010e7:   8d 44 00 01             lea    0x1(%rax,%rax,1),%eax
  4010eb:   5d                      pop    %rbp
  4010ec:   c3                      retq   

Phase_4

00000000004010ed <phase_4>:
  4010ed:   55                      push   %rbp
  4010ee:   48 89 e5                mov    %rsp,%rbp
  4010f1:   48 83 ec 10             sub    $0x10,%rsp
  4010f5:   48 8d 4d fc             lea    -0x4(%rbp),%rcx
  4010f9:   48 8d 55 f8             lea    -0x8(%rbp),%rdx
  4010fd:   be 6d 2a 40 00          mov    $0x402a6d,%esi
  401102:   b8 00 00 00 00          mov    $0x0,%eax
  401107:   e8 a4 fb ff ff          callq  400cb0 <__isoc99_sscanf@plt>
  40110c:   83 f8 02                cmp    $0x2,%eax
  40110f:   75 0b                   jne    40111c <phase_4+0x2f>
  401111:   8b 45 f8                mov    -0x8(%rbp),%eax
  401114:   83 e8 20                sub    $0x20,%eax
  401117:   83 f8 1e                cmp    $0x1e,%eax
  40111a:   76 05                   jbe    401121 <phase_4+0x34>
  40111c:   e8 b4 05 00 00          callq  4016d5 <explode_bomb>
  401121:   ba 3e 00 00 00          mov    $0x3e,%edx
  401126:   be 20 00 00 00          mov    $0x20,%esi
  40112b:   8b 7d f8                mov    -0x8(%rbp),%edi
  40112e:   e8 7f ff ff ff          callq  4010b2 <func4>
  401133:   83 f8 0e                cmp    $0xe,%eax
  401136:   75 06                   jne    40113e <phase_4+0x51>
  401138:   83 7d fc 0e             cmpl   $0xe,-0x4(%rbp)
  40113c:   74 05                   je     401143 <phase_4+0x56>
  40113e:   e8 92 05 00 00          callq  4016d5 <explode_bomb>
  401143:   c9                      leaveq 
  401144:   c3                      retq   
Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • 1) Why is this tagged c? 2) You should probably tell the exact system you are using. – Support Ukraine Oct 09 '17 at 05:47
  • And you just assume that some random people on the internet know what "Bomb lab phase 4" means? – Art Oct 09 '17 at 06:27
  • @Art well, to be fair, this 'Binary Bomb' thing has been around for years, tossed aroud SO like a grenade with the pin out. I would be very surprised if there were no dupes. – Martin James Oct 09 '17 at 08:42
  • Possible duplicate of [Binary Bomb - Phase 4](https://stackoverflow.com/questions/19640148/binary-bomb-phase-4) – Bo Persson Oct 09 '17 at 11:27
  • Since you posted question about phase5, can we assume you solved this? You should delete the question then. – Jester Oct 09 '17 at 11:30

0 Answers0