int func4(int nums, int x, int y){
int ret = y - x;
int k = (unsigned)(ret) >> 31;
ret = (k + ret) >> 1;
k = ret + x;
if (k > nums) return 2 * func4(nums, x, k - 1);
ret = 0;
if (k < nums) return 2 * func4(nums, k + 1, y) + 1;
return ret;
}
0x000000000040104d <+65>: test %eax,%eax
0x000000000040104f <+67>: jne 0x401058 <phase_4+76>
0x0000000000401051 <+69>: cmpl $0x0,0xc(%rsp)
0x0000000000401056 <+74>: je 0x40105d <phase_4+81>
$ ./bomb ans
Welcome to my fiendish little bomb. You have 6 phases with
which to blow yourself up. Have a nice day!
Phase 1 defused. How about the next one?
That's number 2. Keep going!
Halfway there!
So you got that one. Try this one.
Good work! On to the next...
Congratulations! You've defused the bomb!