I have a very similar question as "Binary Bomb - Phase 4" but it is still different enough that I'm not entirely sure what to do.
Here is my phase_4 code:
08048d3e <phase_4>:
8048d3e: 83 ec 2c sub $0x2c,%esp
8048d41: 8d 44 24 18 lea 0x18(%esp),%eax
8048d45: 89 44 24 0c mov %eax,0xc(%esp)
8048d49: 8d 44 24 1c lea 0x1c(%esp),%eax
8048d4d: 89 44 24 08 mov %eax,0x8(%esp)
8048d51: c7 44 24 04 75 a7 04 movl $0x804a775,0x4(%esp)
8048d58: 08
8048d59: 8b 44 24 30 mov 0x30(%esp),%eax
8048d5d: 89 04 24 mov %eax,(%esp)
8048d60: e8 6b fb ff ff call 80488d0 <__isoc99_sscanf@plt>
8048d65: 83 f8 02 cmp $0x2,%eax //making sure I have 2 inputs
8048d68: 75 0e jne 8048d78 <phase_4+0x3a> //if not explodes bomb
8048d6a: 8b 44 24 18 mov 0x18(%esp),%eax
8048d6e: 83 f8 01 cmp $0x1,%eax //has to be greater than 1
8048d71: 7e 05 jle 8048d78 <phase_4+0x3a> //otherwise jumps to bomb
8048d73: 83 f8 04 cmp $0x4,%eax
8048d76: 7e 05 jle 8048d7d <phase_4+0x3f> //has to be less than 4 or jumps to bomb
8048d78: e8 af 05 00 00 call 804932c <explode_bomb>
8048d7d: 8b 44 24 18 mov 0x18(%esp),%eax
8048d81: 89 44 24 04 mov %eax,0x4(%esp)
8048d85: c7 04 24 09 00 00 00 movl $0x9,(%esp)
8048d8c: e8 50 ff ff ff call 8048ce1 <func4> //calls function 4
8048d91: 3b 44 24 1c cmp 0x1c(%esp),%eax
8048d95: 74 05 je 8048d9c <phase_4+0x5e> //compares two values and explodes bomb if not equal
8048d97: e8 90 05 00 00 call 804932c <explode_bomb>
8048d9c: 83 c4 2c add $0x2c,%esp
8048d9f: 90 nop
8048da0: c3 ret
And here is func_4 code:
08048ce1 <func4>: //not entirely sure what's happening here but it might be a binary search?
8048ce1: 83 ec 1c sub $0x1c,%esp
8048ce4: 89 5c 24 10 mov %ebx,0x10(%esp)
8048ce8: 89 74 24 14 mov %esi,0x14(%esp)
8048cec: 89 7c 24 18 mov %edi,0x18(%esp)
8048cf0: 8b 74 24 20 mov 0x20(%esp),%esi
8048cf4: 8b 5c 24 24 mov 0x24(%esp),%ebx
8048cf8: 85 f6 test %esi,%esi
8048cfa: 7e 2b jle 8048d27 <func4+0x46>
8048cfc: 83 fe 01 cmp $0x1,%esi
8048cff: 74 2b je 8048d2c <func4+0x4b>
8048d01: 89 5c 24 04 mov %ebx,0x4(%esp)
8048d05: 8d 46 ff lea -0x1(%esi),%eax
8048d08: 89 04 24 mov %eax,(%esp)
8048d0b: e8 d1 ff ff ff call 8048ce1 <func4>
8048d10: 8d 3c 18 lea (%eax,%ebx,1),%edi
8048d13: 89 5c 24 04 mov %ebx,0x4(%esp)
8048d17: 83 ee 02 sub $0x2,%esi
8048d1a: 89 34 24 mov %esi,(%esp)
8048d1d: e8 bf ff ff ff call 8048ce1 <func4>
8048d22: 8d 1c 07 lea (%edi,%eax,1),%ebx
8048d25: eb 05 jmp 8048d2c <func4+0x4b>
8048d27: bb 00 00 00 00 mov $0x0,%ebx
8048d2c: 89 d8 mov %ebx,%eax
8048d2e: 8b 5c 24 10 mov 0x10(%esp),%ebx
8048d32: 8b 74 24 14 mov 0x14(%esp),%esi
8048d36: 8b 7c 24 18 mov 0x18(%esp),%edi
8048d3a: 83 c4 1c add $0x1c,%esp
8048d3d: c3 ret
I checked to make sure that the input must be two decimals, and I can also see that at the end two numbers are being compared with one another (line 8048d97, 0x1c(%esp) and %eax). At the beginning of phase_4 I think the code is also indicating that the first number has to be between 1 and 4, and at the end of phase 4, however the number has been modified, it must equal the second number. Please correct me if I'm wrong.
I'm just not sure what the func_4 is doing, and how to determine what the inputs should be. I think it might be the binary search, but not sure how to check how it corresponds with the first input.