Question: I'm having a hard time to find my second input number. In scan, the input requires %d %d. I think they take one of my
I'm having a hard time to find my second input number. In scan, the input requires "%d %d". I think they take one of my input numbers and use it as a base case and i would have to figure out the second input number looking in func4. Can someone help me find the pattern ?
Dump of assembler code for function phase_4:
0x00000000004010c0 <+0>: sub $0x18,%rsp
0x00000000004010c4 <+4>: lea 0xc(%rsp),%rcx
0x00000000004010c9 <+9>: lea 0x8(%rsp),%rdx
0x00000000004010ce <+14>: mov $0x4029ad,%esi
0x00000000004010d3 <+19>: mov $0x0,%eax
0x00000000004010d8 <+24>: callq 0x400cb0 <__isoc99_sscanf@plt>
0x00000000004010dd <+29>: cmp $0x2,%eax
0x00000000004010e0 <+32>: jne 0x4010e9
0x00000000004010e2 <+34>: cmpl $0xe,0x8(%rsp)
0x00000000004010e7 <+39>: jbe 0x4010ee
0x00000000004010e9 <+41>: callq 0x40169d
=> 0x00000000004010ee <+46>: mov $0xe,%edx
0x00000000004010f3 <+51>: mov $0x0,%esi
0x00000000004010f8 <+56>: mov 0x8(%rsp),%edi
0x00000000004010fc <+60>: callq 0x401082
0x0000000000401101 <+65>: test %eax,%eax
0x0000000000401103 <+67>: jne 0x40110c
0x0000000000401105 <+69>: cmpl $0x0,0xc(%rsp)
0x000000000040110a <+74>: je 0x401111
0x000000000040110c <+76>: callq 0x40169d
0x0000000000401111 <+81>: add $0x18,%rsp
0x0000000000401115 <+85>: retq
End of assembler dump.
Dump of assembler code for function func4:
0x0000000000401082 <+0>: sub $0x8,%rsp
0x0000000000401086 <+4>: mov %edx,%eax
0x0000000000401088 <+6>: sub %esi,%eax
0x000000000040108a <+8>: mov %eax,%ecx
0x000000000040108c <+10>: shr $0x1f,%ecx
0x000000000040108f <+13>: add %ecx,%eax
0x0000000000401091 <+15>: sar %eax
0x0000000000401093 <+17>: lea (%rax,%rsi,1),%ecx
0x0000000000401096 <+20>: cmp %edi,%ecx
0x0000000000401098 <+22>: jle 0x4010a6
0x000000000040109a <+24>: lea -0x1(%rcx),%edx
0x000000000040109d <+27>: callq 0x401082
0x00000000004010a2 <+32>: add %eax,%eax
0x00000000004010a4 <+34>: jmp 0x4010bb
0x00000000004010a6 <+36>: mov $0x0,%eax
0x00000000004010ab <+41>: cmp %edi,%ecx
0x00000000004010ad <+43>: jge 0x4010bb
0x00000000004010af <+45>: lea 0x1(%rcx),%esi
0x00000000004010b2 <+48>: callq 0x401082
=> 0x00000000004010b7 <+53>: lea 0x1(%rax,%rax,1),%eax
0x00000000004010bb <+57>: add $0x8,%rsp
0x00000000004010bf <+61>: retq
End of assembler dump.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
