


You must fill the C programming code in the following format below:

This problem will give you a chance to reverse engineer a switch statement from disassembled machine code. In the following procedure, the body of the switch statement has been omitted: p1 in \%rdi, p2 in \%rsi, action in \%edx 1 .L8: MODE_E 2 movl $27,%ax 3 ret 4 .L3: MODE_A 5 movq (\%rsi), \%rax 6 movq (\%rdi), \%rdx 7 movq \%rdx, (\%rsi) 8 ret 9 .L5: MODE_B 10 movq (\%rdi), \%rax 11 addq (\%rsi), \%rax 12 movq \%rax, (\%rdi) 13 ret 14. L6: MODE_C 15 movq $59,(%rdi)
16 movq (\%rsi), \%rax 17 ret 18. L7: MODE_D 19 movq (\%rsi), \%rax 20 movq \%rax, (\%rdi) 21 movl $27, \%eax 23. ret default 24 movl $12, \%eax 25 ret Figure 3.52 Assembly code for Problem 3.62. This code implements the different branches of a switch statement. Figure 3.53 shows the disassembled machine code for the procedure. The jump table resides in a different area of memory. We can see from the indirect jump on line 5 that the jump table begins at address 0×4006f8. Using the GDB debugger, we can examine the six 8-byte words of memory comprising the jump table with the command x/6gx0×4006f8. GDB prints the following: Fill in the body of the switch statement with C code that will have the same behavior as the machine code.