The code that follows shows an example of branching on an enumerated type value in a switch statement. Recall that enumerated types in C are simple a way to introduce a set of names having associated integer values. By default, the values assigned to the names count from zero upward. In our code, the actions associated with the different case labels have been omitted.
/* Enumerated type creates set of constants numbered 0 and upward */typedefenum {MODE_A, MODE_B, MODE_C, MODE_D, MODE_E} mode_t;longswitch3(long*p1,long*p2,mode_t action) {long result =0;switch(action) {case MODE_A: result =*p2;*p2 =*p1;break;case MODE_B: result =*p1 +*p2; result =*p1;break;case MODE_C:*p1 =59; result =*p2;break;case MODE_D:*p1 =*p2; result =27;break;case MODE_E: result =27;break;default: result =12;break; }return result;}
The part of the generated assembly code implementing the different actions is shown below. The annotations indicate the argument locations, the register values, and the case labels for the different jump destinations.
Fill in the missing parts of the C code. It contained one case that fell through to another--try to reconstruct this.