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:
longswitch_prob(long x,long n) {long result = x;switch(n) { /* Fill in code here */ }return result;}
Below 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 0x4006f8. Using the GDB debugger, we can examine the six 8-byte words of memory comprising the jump table with the command x/6gx 0x4006f8. GDB prints the following:
longswitch_prob(long x,long n) {long result = x;switch(n) {case60:case62: result =8* x;break;case63: result = x >>3;break;case64: x =15* x;case65: x *= x;default: result =75+ x; }return result;}