While I'm trying to disassemble my own C code I am stuck in a problem of not understanding how this Switch statement is implemented in assembly code. Can anyone please help to figure it out? This the switch assembly. Couldn't understand why so many registers are being used plus at the last line it's written "jmp dword ptr [eax4+0A110E8h]". Is this eax4 necessary for switch in assembly or did by the disassembler on its own?
My C Code:
main() {
int a;
printf("Please enter a no between 1 and 5: ");
scanf("%d", & a);
switch (a) {
case 1:
printf("You chose One");
break;
case 2:
printf("You chose Two");
break;
case 3:
printf("You chose Three");
break;
case 4:
printf("You chose Four");
break;
case 5:
printf("You chose Five.");
break;
default:
printf("Invalid Choice. Enter a no between 1 and 5");
break;
}
}