(gdb) disas phase_4 Dump of assembler code for function phase_4: 0x08048dfb <pha
ID: 3631348 • Letter: #
Question
(gdb) disas phase_4Dump of assembler code for function phase_4:
0x08048dfb <phase_4+0>: push %ebp
0x08048dfc <phase_4+1>: mov %esp,%ebp
0x08048dfe <phase_4+3>: sub $0x28,%esp
0x08048e01 <phase_4+6>: lea -0x8(%ebp),%eax
0x08048e04 <phase_4+9>: mov %eax,0xc(%esp)
0x08048e08 <phase_4+13>: lea -0x4(%ebp),%eax
0x08048e0b <phase_4+16>: mov %eax,0x8(%esp)
0x08048e0f <phase_4+20>: movl $0x804a38a,0x4(%esp)
0x08048e17 <phase_4+28>: mov 0x8(%ebp),%eax
0x08048e1a <phase_4+31>: mov %eax,(%esp)
0x08048e1d <phase_4+34>: call 0x8048884 <sscanf@plt>
0x08048e22 <phase_4+39>: cmp $0x2,%eax
0x08048e25 <phase_4+42>: jne 0x8048e33 <phase_4+56>
0x08048e27 <phase_4+44>: mov -0x4(%ebp),%eax
0x08048e2a <phase_4+47>: test %eax,%eax
0x08048e2c <phase_4+49>: js 0x8048e33 <phase_4+56>
0x08048e2e <phase_4+51>: cmp $0xe,%eax
0x08048e31 <phase_4+54>: jle 0x8048e38 <phase_4+61>
0x08048e33 <phase_4+56>: call 0x8049165 <explode_bomb>
0x08048e38 <phase_4+61>: movl $0xe,0x8(%esp)
0x08048e40 <phase_4+69>: movl $0x0,0x4(%esp)
0x08048e48 <phase_4+77>: mov -0x4(%ebp),%eax
0x08048e4b <phase_4+80>: mov %eax,(%esp)
0x08048e4e <phase_4+83>: call 0x8048b00 <func4>
0x08048e53 <phase_4+88>: cmp $0x12,%eax
0x08048e56 <phase_4+91>: jne 0x8048e5e <phase_4+99>
0x08048e58 <phase_4+93>: cmpl $0x12,-0x8(%ebp)
0x08048e5c <phase_4+97>: je 0x8048e65 <phase_4+106>
0x08048e5e <phase_4+99>: xchg %ax,%ax
0x08048e60 <phase_4+101>: call 0x8049165 <explode_bomb>
0x08048e65 <phase_4+106>: leave
0x08048e66 <phase_4+107>: ret
End of assembler dump.
(gdb) disas func4
Dump of assembler code for function func4:
0x08048b00 <func4+0>: push %ebp
0x08048b01 <func4+1>: mov %esp,%ebp
0x08048b03 <func4+3>: sub $0x18,%esp
0x08048b06 <func4+6>: mov %ebx,-0xc(%ebp)
0x08048b09 <func4+9>: mov %esi,-0x8(%ebp)
0x08048b0c <func4+12>: mov %edi,-0x4(%ebp)
0x08048b0f <func4+15>: mov 0x8(%ebp),%esi
0x08048b12 <func4+18>: mov 0xc(%ebp),%ecx
0x08048b15 <func4+21>: mov 0x10(%ebp),%edi
0x08048b18 <func4+24>: mov %edi,%edx
0x08048b1a <func4+26>: sub %ecx,%edx
0x08048b1c <func4+28>: mov %edx,%eax
0x08048b1e <func4+30>: shr $0x1f,%eax
0x08048b21 <func4+33>: add %edx,%eax
0x08048b23 <func4+35>: sar %eax
0x08048b25 <func4+37>: lea (%eax,%ecx,1),%ebx
0x08048b28 <func4+40>: cmp %esi,%ebx
0x08048b2a <func4+42>: jle 0x8048b43 <func4+67>
0x08048b2c <func4+44>: lea -0x1(%ebx),%eax
0x08048b2f <func4+47>: mov %eax,0x8(%esp)
0x08048b33 <func4+51>: mov %ecx,0x4(%esp)
0x08048b37 <func4+55>: mov %esi,(%esp)
---Type <return> to continue, or q <return> to quit---
0x08048b3a <func4+58>: call 0x8048b00 <func4>
0x08048b3f <func4+63>: add %eax,%ebx
0x08048b41 <func4+65>: jmp 0x8048b5c <func4+92>
0x08048b43 <func4+67>: cmp %esi,%ebx
0x08048b45 <func4+69>: jge 0x8048b5c <func4+92>
0x08048b47 <func4+71>: mov %edi,0x8(%esp)
0x08048b4b <func4+75>: lea 0x1(%ebx),%eax
0x08048b4e <func4+78>: mov %eax,0x4(%esp)
0x08048b52 <func4+82>: mov %esi,(%esp)
0x08048b55 <func4+85>: call 0x8048b00 <func4>
0x08048b5a <func4+90>: add %eax,%ebx
0x08048b5c <func4+92>: mov %ebx,%eax
0x08048b5e <func4+94>: mov -0xc(%ebp),%ebx
0x08048b61 <func4+97>: mov -0x8(%ebp),%esi
0x08048b64 <func4+100>: mov -0x4(%ebp),%edi
0x08048b67 <func4+103>: mov %ebp,%esp
0x08048b69 <func4+105>: pop %ebp
0x08048b6a <func4+106>: ret
End of assembler dump.
Explanation / Answer
Dump of assembler code for function phase_4: 0x08048c2c : push %ebp 0x08048c2d : mov %esp,%ebp 0x08048c2f : sub $0xc,%esp //esp=esp-12 0x08048c32 : lea 0xfffffffc(%ebp),%eax //eax=ebp-4 0x08048c35 : push %eax 0x08048c36 : push $0x8049717 // %d Bad Host (1) / Bad Host (2) / Error ... 0x08048c3b : pushl 0x8(%ebp) // address points to gibberish 0x08048c3e : call 0x8048870 // unknown function 0x08048c43 : add $0x10,%esp // esp=esp+16 0x08048c46 : cmp $0x1,%eax // if eax!=1 0x08048c49 : jne 0x8048c51 //jump to explosion 0x08048c4b : cmpl $0x0,0xfffffffc(%ebp) //if $ebp-4>0 0x08048c4f : jg 0x8048c56 // jump past explosion 0x08048c51 : call 0x80493be 0x08048c56 : pushl 0xfffffffc(%ebp) // push $ebp-4 onto stack 0x08048c59 : call 0x8048bf7 // call func4 0x08048c5e : add $0x4,%esp // esp = esp+4 0x08048c61 : cmp $0x262,%eax // if eax==x262==106 0x08048c66 : je 0x8048c6d // jump past explosion 0x08048c68 : call 0x80493be 0x08048c6d : leave 0x08048c6e : ret End of assembler dump. Dump of assembler code for function func4: 0x08048bf7 : push %ebp 0x08048bf8 : mov %esp,%ebp 0x08048bfa : push %esi 0x08048bfb : push %ebx 0x08048bfc : mov 0x8(%ebp),%esi //esi=ebp+8 0x08048bff : mov $0x1,%eax //eax=1 0x08048c04 : cmp $0x1,%esi //if esiRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.