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

SOLVE THE FOLLOWING. PROVIDE ALGORITHM EMPLOYED BY ASSEMBLY CODE. Dump of assemb

ID: 3601690 • Letter: S

Question

SOLVE THE FOLLOWING. PROVIDE ALGORITHM EMPLOYED BY ASSEMBLY CODE.

Dump of assembler code for function phase_5:
0x0000000000401066 <+0>: push %rbx
0x0000000000401067 <+1>: mov %rdi,%rbx
0x000000000040106a <+4>: callq 0x40129a <string_length>
0x000000000040106f <+9>: cmp $0x6,%eax
0x0000000000401072 <+12>: je 0x401079 <phase_5+19>
0x0000000000401074 <+14>: callq 0x40151f <explode_bomb>
0x0000000000401079 <+19>: mov %rbx,%rax
0x000000000040107c <+22>: lea 0x6(%rbx),%rdi
0x0000000000401080 <+26>: mov $0x0,%ecx
0x0000000000401085 <+31>: movzbl (%rax),%edx
0x0000000000401088 <+34>: and $0xf,%edx
0x000000000040108b <+37>: add 0x402540(,%rdx,4),%ecx
0x0000000000401092 <+44>: add $0x1,%rax
0x0000000000401096 <+48>: cmp %rdi,%rax
0x0000000000401099 <+51>: jne 0x401085 <phase_5+31>
0x000000000040109b <+53>: cmp $0x22,%ecx
0x000000000040109e <+56>: je 0x4010a5 <phase_5+63>
0x00000000004010a0 <+58>: callq 0x40151f <explode_bomb>
0x00000000004010a5 <+63>: pop %rbx
0x00000000004010a6 <+64>: retq

Explanation / Answer

Dump of assembler code for function phase_5:
0x0000000000401066 <+0>: push %rbx
0x0000000000401067 <+1>: mov %rdi,%rbx
0x000000000040106a <+4>: callq 0x40129a <string_length>
0x000000000040106f <+9>: cmp $0x6,%eax
0x0000000000401072 <+12>: je 0x401079 <phase_5+19>
0x0000000000401074 <+14>: callq 0x40151f <explode_bomb>
0x0000000000401079 <+19>: mov %rbx,%rax
0x000000000040107c <+22>: lea 0x6(%rbx),%rdi
0x0000000000401080 <+26>: mov $0x0,%ecx
0x0000000000401085 <+31>: movzbl (%rax),%edx
0x0000000000401088 <+34>: and $0xf,%edx
0x000000000040108b <+37>: add 0x402540(,%rdx,4),%ecx
0x0000000000401092 <+44>: add $0x1,%rax
0x0000000000401096 <+48>: cmp %rdi,%rax
0x0000000000401099 <+51>: jne 0x401085 <phase_5+31>
0x000000000040109b <+53>: cmp $0x22,%ecx
0x000000000040109e <+56>: je 0x4010a5 <phase_5+63>
0x00000000004010a0 <+58>: callq 0x40151f <explode_bomb>
0x00000000004010a5 <+63>: pop %rbx
0x00000000004010a6 <+64>: retq