Question: Here is all the assembly code you'll need. I am trying to debug a binary bomb and phase 4 ' s solution should be two

Here is all the assembly code you'll need. I am trying to debug a binary bomb and phase 4's solution should be two integers:
(gdb) disassemble phase_4
Dump of assembler code for function phase_4:
0x0000000000401041<+0>: sub $0x18,%rsp
0x0000000000401045<+4>: lea0x8(%rsp),%rcx
0x000000000040104a <+9>: lea0xc(%rsp),%rdx
0x000000000040104f <+14>: mov $0x40271e,%esi
0x0000000000401054<+19>: mov $0x0,%eax
0x0000000000401059<+24>: callq0x400c30<__isoc99_sscanf@plt>
0x000000000040105e <+29>: cmp $0x2,%eax
0x0000000000401061<+32>: jne0x40106a
0x0000000000401063<+34>: cmpl $0xe,0xc(%rsp)
0x0000000000401068<+39>: jbe0x40106f
0x000000000040106a <+41>: callq0x4016cd
0x000000000040106f <+46>: mov $0xe,%edx
0x0000000000401074<+51>: mov $0x0,%esi
0x0000000000401079<+56>: mov0xc(%rsp),%edi
0x000000000040107d <+60>: callq0x40100d
0x0000000000401082<+65>: cmp $0x2d,%eax
0x0000000000401085<+68>: jne0x40108e
0x0000000000401087<+70>: cmpl $0x2d,0x8(%rsp)
0x000000000040108c <+75>: je 0x401093
0x000000000040108e <+77>: callq0x4016cd
0x0000000000401093<+82>: add $0x18,%rsp
0x0000000000401097<+86>: retq
End of assembler dump.
(gdb) disassemble func4
Dump of assembler code for function func4:
0x000000000040100d <+0>: push %rbx
0x000000000040100e <+1>: mov%edx,%eax
0x0000000000401010<+3>: sub%esi,%eax
0x0000000000401012<+5>: mov%eax,%ebx
0x0000000000401014<+7>: shr $0x1f,%ebx
0x0000000000401017<+10>: add%eax,%ebx
0x0000000000401019<+12>: sar%ebx
0x000000000040101b <+14>: add%esi,%ebx
0x000000000040101d <+16>: cmp%edi,%ebx
0x000000000040101f <+18>: jg 0x401027
0x0000000000401021<+20>: jl 0x401034
0x0000000000401023<+22>: mov%edi,%eax
0x0000000000401025<+24>: pop%rbx
0x0000000000401026<+25>: retq
0x0000000000401027<+26>: lea-0x1(%rbx),%edx
0x000000000040102a <+29>: callq0x40100d
0x000000000040102f <+34>: lea(%rax,%rbx,1),%edi
0x0000000000401032<+37>: jmp0x401023
0x0000000000401034<+39>: lea0x

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!