Infinity08 your comments are really helping me understand this better. Could you please let me know if what I wrote is going on here is correct. I can't seem to figure out exactly what this wants, except know it wants a string that is length 6. Thanks again
Dump of assembler code for function phase_5:
0x08048c6f <phase_5+0>: push %ebp
0x08048c70 <phase_5+1>: mov %esp,%ebp
0x08048c72 <phase_5+3>: push %esi
0x08048c73 <phase_5+4>: push %ebx
0x08048c74 <phase_5+5>: mov 0x8(%ebp),%esi //esi=%(ebp+8)
0x08048c77 <phase_5+8>: sub $0xc,%esp //esp=esp-12
0x08048c7a <phase_5+11>: push %esi
0x08048c7b <phase_5+12>: call 0x8048ed7 <string_length>
0x08048c80 <phase_5+17>: add $0x10,%esp //esp=esp+16
0x08048c83 <phase_5+20>: cmp $0x6,%eax //if %eax==6 then
0x08048c86 <phase_5+23>: je 0x8048c8d <phase_5+30> //jump after explosion
0x08048c88 <phase_5+25>: call 0x80493be <explode_bomb>
0x08048c8d <phase_5+30>: mov $0x0,%ecx //%ecx=0
0x08048c92 <phase_5+35>: mov $0x0,%edx //%edx=0
0x08048c97 <phase_5+40>: mov $0x804a5a0,%ebx //%ebx=0x804a5a0
0x08048c9c <phase_5+45>: movsbl (%esi,%edx,1),%eax // makes
0x08048ca0 <phase_5+49>: and $0xf,%eax //eax=eax & 15
0x08048ca3 <phase_5+52>: add (%ebx,%eax,4),%ecx //%ecx=%(ecx)+%(ebx+4*eax)
0x08048ca6 <phase_5+55>: inc %edx edx=(edx+1)
0x08048ca7 <phase_5+56>: cmp $0x5,%edx // if %edx<=5
0x08048caa <phase_5+59>: jle 0x8048c9c <phase_5+45> // then jump back
0x08048cac <phase_5+61>: cmp $0x3a,%ecx // else if %ecx==58
0x08048caf <phase_5+64>: je 0x8048cb6 <phase_5+71> // then jump past explosion
0x08048cb1 <phase_5+66>: call 0x80493be <explode_bomb>
0x08048cb6 <phase_5+71>: lea 0xfffffff8(%ebp),%esp //esp=ebp-8
0x08048cb9 <phase_5+74>: pop %ebx
0x08048cba <phase_5+75>: pop %esi
0x08048cbb <phase_5+76>: leave
0x08048cbc <phase_5+77>: ret
End of assembler dump.
Dump of assembler code for function string_length:
0x08048ed7 <string_length+0>: push %ebp
0x08048ed8 <string_length+1>: mov %esp,%ebp // ebp=esp
0x08048eda <string_length+3>: mov 0x8(%ebp),%edx // edx=%(ebp+8)
0x08048edd <string_length+6>: mov $0x0,%eax // %eax=0
0x08048ee2 <string_length+11>: cmpb $0x0,(%edx) // if %edx==0 then
0x08048ee5 <string_length+14>: je 0x8048eee <string_length+23> // jump to end
0x08048ee7 <string_length+16>: inc %edx // else %edx++ and %eax++
0x08048ee8 <string_length+17>: inc %eax
0x08048ee9 <string_length+18>: cmpb $0x0,(%edx) // if %edx!=0
0x08048eec <string_length+21>: jne 0x8048ee7 <string_length+16>// jump back into loop
0x08048eee <string_length+23>: leave
0x08048eef <string_length+24>: ret
End of assembler dump.
I'm not sure if it is taking each character in the string and adding them up and the sum should be 58, don't know so because when I type ASDFGH the ending value is 43 in ecx. Thanks again
Start Free Trial