Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please help with this. I have it due tonight at 12.. (gdb) disas phase_5 Dump of

ID: 3631342 • Letter: P

Question

please help with this. I have it due tonight at 12..

(gdb) disas phase_5
Dump of assembler code for function phase_5:
0x08048d89 <phase_5+0>: push %ebp
0x08048d8a <phase_5+1>: mov %esp,%ebp
0x08048d8c <phase_5+3>: sub $0x28,%esp
0x08048d8f <phase_5+6>: lea -0x8(%ebp),%eax
0x08048d92 <phase_5+9>: mov %eax,0xc(%esp)
0x08048d96 <phase_5+13>: lea -0x4(%ebp),%eax
0x08048d99 <phase_5+16>: mov %eax,0x8(%esp)
0x08048d9d <phase_5+20>: movl $0x804a38a,0x4(%esp)
0x08048da5 <phase_5+28>: mov 0x8(%ebp),%eax
0x08048da8 <phase_5+31>: mov %eax,(%esp)
0x08048dab <phase_5+34>: call 0x8048884 <sscanf@plt>
0x08048db0 <phase_5+39>: cmp $0x1,%eax
0x08048db3 <phase_5+42>: jg 0x8048dba <phase_5+49>
0x08048db5 <phase_5+44>: call 0x8049165 <explode_bomb>
0x08048dba <phase_5+49>: mov -0x4(%ebp),%eax
0x08048dbd <phase_5+52>: and $0xf,%eax
0x08048dc0 <phase_5+55>: mov %eax,-0x4(%ebp)
0x08048dc3 <phase_5+58>: cmp $0xf,%eax
0x08048dc6 <phase_5+61>: je 0x8048df4 <phase_5+107>
0x08048dc8 <phase_5+63>: mov $0x0,%edx
0x08048dcd <phase_5+68>: mov $0x0,%ecx
0x08048dd2 <phase_5+73>: add $0x1,%edx
0x08048dd5 <phase_5+76>: mov 0x804a2e0(,%eax,4),%eax
0x08048ddc <phase_5+83>: add %eax,%ecx
0x08048dde <phase_5+85>: cmp $0xf,%eax
0x08048de1 <phase_5+88>: jne 0x8048dd2 <phase_5+73>
0x08048de3 <phase_5+90>: movl $0xf,-0x4(%ebp)
0x08048dea <phase_5+97>: cmp $0xf,%edx
0x08048ded <phase_5+100>: jne 0x8048df4 <phase_5+107>
0x08048def <phase_5+102>: cmp %ecx,-0x8(%ebp)
0x08048df2 <phase_5+105>: je 0x8048df9 <phase_5+112>
0x08048df4 <phase_5+107>: call 0x8049165 <explode_bomb>
0x08048df9 <phase_5+112>: leave
0x08048dfa <phase_5+113>: ret




SOmeone pls help, you will be my life saver

Explanation / Answer

Dump of assembler code for function phase_5: 0x08048c6f : push %ebp 0x08048c70 : mov %esp,%ebp 0x08048c72 : push %esi 0x08048c73 : push %ebx 0x08048c74 : mov 0x8(%ebp),%esi //esi=%(ebp+8) 0x08048c77 : sub $0xc,%esp //esp=esp-12 0x08048c7a : push %esi 0x08048c7b : call 0x8048ed7 0x08048c80 : add $0x10,%esp //esp=esp+16 0x08048c83 : cmp $0x6,%eax //if %eax==6 then 0x08048c86 : je 0x8048c8d //jump after explosion 0x08048c88 : call 0x80493be 0x08048c8d : mov $0x0,%ecx //%ecx=0 0x08048c92 : mov $0x0,%edx //%edx=0 0x08048c97 : mov $0x804a5a0,%ebx //%ebx=0x804a5a0 0x08048c9c : movsbl (%esi,%edx,1),%eax // makes 0x08048ca0 : and $0xf,%eax //eax=eax & 15 0x08048ca3 : add (%ebx,%eax,4),%ecx //%ecx=%(ecx)+%(ebx+4*eax) 0x08048ca6 : inc %edx edx=(edx+1) 0x08048ca7 : cmp $0x5,%edx // if %edx