#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ MotorDrive(int, int);
int /*<<< orphan*/ TMR_StartTimer(int);
void CallEntryFunction(unsigned char NewState) {
  switch (NewState) {
  case 0:
    MotorDrive(3, 9);
    break;
  case 1:
    MotorDrive(4, 9);
    TMR_StartTimer(1);
    break;
  case 3:
    MotorDrive(2, 9);
    TMR_StartTimer(1);
    break;
  case 2:
    MotorDrive(5, 9);
    break;
  case 4:
    MotorDrive(1, 9);
    break;
  case 5:
    MotorDrive(3, 0);
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<CallEntryFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x5,%rax
ja     11d8 <CallEntryFunction+0xb8>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x3,%edi
mov    $0x9,%esi
call   1040 <MotorDrive@plt>
jmp    11d8 <CallEntryFunction+0xb8>
mov    $0x4,%edi
mov    $0x9,%esi
call   1040 <MotorDrive@plt>
mov    $0x1,%edi
call   1030 <TMR_StartTimer@plt>
jmp    11d8 <CallEntryFunction+0xb8>
mov    $0x2,%edi
mov    $0x9,%esi
call   1040 <MotorDrive@plt>
mov    $0x1,%edi
call   1030 <TMR_StartTimer@plt>
jmp    11d8 <CallEntryFunction+0xb8>
mov    $0x5,%edi
mov    $0x9,%esi
call   1040 <MotorDrive@plt>
jmp    11d8 <CallEntryFunction+0xb8>
mov    $0x1,%edi
mov    $0x9,%esi
call   1040 <MotorDrive@plt>
jmp    11d8 <CallEntryFunction+0xb8>
mov    $0x3,%edi
xor    %esi,%esi
call   1040 <MotorDrive@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CallEntryFunction>:
push   %rax
cmp    $0x5,%dil
ja     1140 <CallEntryFunction+0x20>
mov    %edi,%eax
lea    0xed0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x3,%edi
jmp    116f <CallEntryFunction+0x4f>
pop    %rax
ret
mov    $0x4,%edi
jmp    1155 <CallEntryFunction+0x35>
mov    $0x5,%edi
jmp    116f <CallEntryFunction+0x4f>
mov    $0x2,%edi
mov    $0x9,%esi
call   1040 <MotorDrive@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <TMR_StartTimer@plt>
mov    $0x1,%edi
mov    $0x9,%esi
pop    %rax
jmp    1040 <MotorDrive@plt>
mov    $0x3,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <MotorDrive@plt>

LLVM IR (-O0):
define void @CallEntryFunction(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
switch i32 %4, label %19 [
i32 0, label %5
i32 1, label %7
i32 3, label %10
i32 2, label %13
i32 4, label %15
i32 5, label %17
]
5: ; preds = %1
%6 = call i32 @MotorDrive(i32 3, i32 9)
br label %19
7: ; preds = %1
%8 = call i32 @MotorDrive(i32 4, i32 9)
%9 = call i32 @TMR_StartTimer(i32 1)
br label %19
10: ; preds = %1
%11 = call i32 @MotorDrive(i32 2, i32 9)
%12 = call i32 @TMR_StartTimer(i32 1)
br label %19
13: ; preds = %1
%14 = call i32 @MotorDrive(i32 5, i32 9)
br label %19
15: ; preds = %1
%16 = call i32 @MotorDrive(i32 1, i32 9)
br label %19
17: ; preds = %1
%18 = call i32 @MotorDrive(i32 3, i32 0)
br label %19
19: ; preds = %1, %17, %15, %13, %10, %7, %5
ret void
}

LLVM IR (-O2):
define void @CallEntryFunction(i8 zeroext %0) {
switch i8 %0, label %16 [
i8 0, label %2
i8 1, label %4
i8 3, label %7
i8 2, label %10
i8 4, label %12
i8 5, label %14
]
2: ; preds = %1
%3 = tail call i32 @MotorDrive(i32 3, i32 9)
br label %16
4: ; preds = %1
%5 = tail call i32 @MotorDrive(i32 4, i32 9)
%6 = tail call i32 @TMR_StartTimer(i32 1)
br label %16
7: ; preds = %1
%8 = tail call i32 @MotorDrive(i32 2, i32 9)
%9 = tail call i32 @TMR_StartTimer(i32 1)
br label %16
10: ; preds = %1
%11 = tail call i32 @MotorDrive(i32 5, i32 9)
br label %16
12: ; preds = %1
%13 = tail call i32 @MotorDrive(i32 1, i32 9)
br label %16
14: ; preds = %1
%15 = tail call i32 @MotorDrive(i32 3, i32 0)
br label %16
16: ; preds = %1, %14, %12, %10, %7, %4, %2
ret void
}