#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 CBUF_Char();
scalar_t__ CBUF_Empty();
int COMMAND_ADC_AsyncMode();
int COMMAND_ADC_ChangeMode();
int COMMAND_ADC_Enable();
int COMMAND_ADC_Read();
int COMMAND_ADC_si();
int COMMAND_APP_Info();
int COMMAND_CAN_ACR();
int COMMAND_CAN_AMR();
int COMMAND_CAN_Close();
int COMMAND_CAN_Open();
int COMMAND_CAN_SerialNumber();
int COMMAND_CAN_SetBitRate();
int COMMAND_CAN_Status();
int COMMAND_CAN_TimeStamp();
int COMMAND_CAN_Transmit(int);
int COMMAND_CAN_Version();
int COMMAND_DIG_AsyncMode();
int COMMAND_DIG_Enable();
int COMMAND_DIG_Read();
int COMMAND_UART_Baud();
int APP_Dispatch(void) {
  if (CBUF_Empty())
    return 0;
  switch (CBUF_Char()) {
  case 'S':
    return COMMAND_CAN_SetBitRate();
  case 'O':
    return COMMAND_CAN_Open();
  case 'C':
    return COMMAND_CAN_Close();
  case 't':
    return COMMAND_CAN_Transmit(0);
  case 'T':
    return COMMAND_CAN_Transmit(1);
  case 'F':
    return COMMAND_CAN_Status();
  case 'M':
    return COMMAND_CAN_ACR();
  case 'm':
    return COMMAND_CAN_AMR();
  case 'V':
    return COMMAND_CAN_Version();
  case 'N':
    return COMMAND_CAN_SerialNumber();
  case 'Z':
    return COMMAND_CAN_TimeStamp();
  case 'A':
    return COMMAND_ADC_Enable();
  case 'a':
    return COMMAND_ADC_AsyncMode();
  case 'b':
    return COMMAND_ADC_ChangeMode();
  case 'r':
    return COMMAND_ADC_Read();
  case 'D':
    return COMMAND_DIG_Enable();
  case 'd':
    return COMMAND_DIG_AsyncMode();
  case 'e':
    return COMMAND_DIG_Read();
  case 's':
    return COMMAND_ADC_si();
  case 'B':
    return COMMAND_UART_Baud();
  case 'i':
    return COMMAND_APP_Info();
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<APP_Dispatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1110 <CBUF_Empty@plt>
cmp    $0x0,%rax
je     1285 <APP_Dispatch+0x25>
movl   $0x0,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
xor    %eax,%eax
call   1050 <CBUF_Char@plt>
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x33,%eax
ja     13f0 <APP_Dispatch+0x190>
mov    -0x10(%rbp),%rax
lea    0xd57(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1130 <COMMAND_CAN_SetBitRate@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1150 <COMMAND_CAN_Open@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1090 <COMMAND_CAN_Close@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
xor    %edi,%edi
call   1100 <COMMAND_CAN_Transmit@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x1,%edi
call   1100 <COMMAND_CAN_Transmit@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   10a0 <COMMAND_CAN_Status@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1030 <COMMAND_CAN_ACR@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   10f0 <COMMAND_CAN_AMR@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   10b0 <COMMAND_CAN_Version@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1040 <COMMAND_CAN_SerialNumber@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1070 <COMMAND_CAN_TimeStamp@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1060 <COMMAND_ADC_Enable@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1080 <COMMAND_ADC_AsyncMode@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   10d0 <COMMAND_ADC_ChangeMode@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   10e0 <COMMAND_ADC_Read@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1180 <COMMAND_DIG_Enable@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1170 <COMMAND_DIG_AsyncMode@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   10c0 <COMMAND_DIG_Read@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1140 <COMMAND_ADC_si@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1160 <COMMAND_UART_Baud@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
mov    $0x0,%al
call   1120 <COMMAND_APP_Info@plt>
mov    %eax,-0x4(%rbp)
jmp    13f7 <APP_Dispatch+0x197>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<APP_Dispatch>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1110 <CBUF_Empty@plt>
test   %rax,%rax
je     1273 <APP_Dispatch+0x13>
mov    %ebx,%eax
pop    %rbx
ret
xor    %eax,%eax
call   1050 <CBUF_Char@plt>
mov    $0xffffffff,%ebx
add    $0xffffffbf,%eax
cmp    $0x33,%eax
ja     126f <APP_Dispatch+0xf>
lea    0xd72(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
pop    %rbx
jmp    1060 <COMMAND_ADC_Enable@plt>
xor    %eax,%eax
pop    %rbx
jmp    1160 <COMMAND_UART_Baud@plt>
xor    %eax,%eax
pop    %rbx
jmp    1090 <COMMAND_CAN_Close@plt>
xor    %eax,%eax
pop    %rbx
jmp    1180 <COMMAND_DIG_Enable@plt>
xor    %eax,%eax
pop    %rbx
jmp    10a0 <COMMAND_CAN_Status@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <COMMAND_CAN_ACR@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <COMMAND_CAN_SerialNumber@plt>
xor    %eax,%eax
pop    %rbx
jmp    1150 <COMMAND_CAN_Open@plt>
xor    %eax,%eax
pop    %rbx
jmp    1130 <COMMAND_CAN_SetBitRate@plt>
mov    $0x1,%edi
pop    %rbx
jmp    1100 <COMMAND_CAN_Transmit@plt>
xor    %eax,%eax
pop    %rbx
jmp    10b0 <COMMAND_CAN_Version@plt>
xor    %eax,%eax
pop    %rbx
jmp    1070 <COMMAND_CAN_TimeStamp@plt>
xor    %eax,%eax
pop    %rbx
jmp    1080 <COMMAND_ADC_AsyncMode@plt>
xor    %eax,%eax
pop    %rbx
jmp    10d0 <COMMAND_ADC_ChangeMode@plt>
xor    %eax,%eax
pop    %rbx
jmp    1170 <COMMAND_DIG_AsyncMode@plt>
xor    %eax,%eax
pop    %rbx
jmp    10c0 <COMMAND_DIG_Read@plt>
xor    %eax,%eax
pop    %rbx
jmp    1120 <COMMAND_APP_Info@plt>
xor    %eax,%eax
pop    %rbx
jmp    10f0 <COMMAND_CAN_AMR@plt>
xor    %eax,%eax
pop    %rbx
jmp    10e0 <COMMAND_ADC_Read@plt>
xor    %eax,%eax
pop    %rbx
jmp    1140 <COMMAND_ADC_si@plt>
xor    %edi,%edi
pop    %rbx
jmp    1100 <COMMAND_CAN_Transmit@plt>

LLVM IR (-O0):
define i32 @APP_Dispatch() {
%1 = alloca i32
%2 = call i64 (...) @CBUF_Empty()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 0, i32* %1
br label %50
5: ; preds = %0
%6 = call i32 (...) @CBUF_Char()
switch i32 %6, label %49 [
i32 83, label %7
i32 79, label %9
i32 67, label %11
i32 116, label %13
i32 84, label %15
i32 70, label %17
i32 77, label %19
i32 109, label %21
i32 86, label %23
i32 78, label %25
i32 90, label %27
i32 65, label %29
i32 97, label %31
i32 98, label %33
i32 114, label %35
i32 68, label %37
i32 100, label %39
i32 101, label %41
i32 115, label %43
i32 66, label %45
i32 105, label %47
]
7: ; preds = %5
%8 = call i32 (...) @COMMAND_CAN_SetBitRate()
store i32 %8, i32* %1
br label %50
9: ; preds = %5
%10 = call i32 (...) @COMMAND_CAN_Open()
store i32 %10, i32* %1
br label %50
11: ; preds = %5
%12 = call i32 (...) @COMMAND_CAN_Close()
store i32 %12, i32* %1
br label %50
13: ; preds = %5
%14 = call i32 @COMMAND_CAN_Transmit(i32 0)
store i32 %14, i32* %1
br label %50
15: ; preds = %5
%16 = call i32 @COMMAND_CAN_Transmit(i32 1)
store i32 %16, i32* %1
br label %50
17: ; preds = %5
%18 = call i32 (...) @COMMAND_CAN_Status()
store i32 %18, i32* %1
br label %50
19: ; preds = %5
%20 = call i32 (...) @COMMAND_CAN_ACR()
store i32 %20, i32* %1
br label %50
21: ; preds = %5
%22 = call i32 (...) @COMMAND_CAN_AMR()
store i32 %22, i32* %1
br label %50
23: ; preds = %5
%24 = call i32 (...) @COMMAND_CAN_Version()
store i32 %24, i32* %1
br label %50
25: ; preds = %5
%26 = call i32 (...) @COMMAND_CAN_SerialNumber()
store i32 %26, i32* %1
br label %50
27: ; preds = %5
%28 = call i32 (...) @COMMAND_CAN_TimeStamp()
store i32 %28, i32* %1
br label %50
29: ; preds = %5
%30 = call i32 (...) @COMMAND_ADC_Enable()
store i32 %30, i32* %1
br label %50
31: ; preds = %5
%32 = call i32 (...) @COMMAND_ADC_AsyncMode()
store i32 %32, i32* %1
br label %50
33: ; preds = %5
%34 = call i32 (...) @COMMAND_ADC_ChangeMode()
store i32 %34, i32* %1
br label %50
35: ; preds = %5
%36 = call i32 (...) @COMMAND_ADC_Read()
store i32 %36, i32* %1
br label %50
37: ; preds = %5
%38 = call i32 (...) @COMMAND_DIG_Enable()
store i32 %38, i32* %1
br label %50
39: ; preds = %5
%40 = call i32 (...) @COMMAND_DIG_AsyncMode()
store i32 %40, i32* %1
br label %50
41: ; preds = %5
%42 = call i32 (...) @COMMAND_DIG_Read()
store i32 %42, i32* %1
br label %50
43: ; preds = %5
%44 = call i32 (...) @COMMAND_ADC_si()
store i32 %44, i32* %1
br label %50
45: ; preds = %5
%46 = call i32 (...) @COMMAND_UART_Baud()
store i32 %46, i32* %1
br label %50
47: ; preds = %5
%48 = call i32 (...) @COMMAND_APP_Info()
store i32 %48, i32* %1
br label %50
49: ; preds = %5
store i32 -1, i32* %1
br label %50
50: ; preds = %49, %47, %45, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %4
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
define i32 @APP_Dispatch() {
%1 = tail call i64 (...) @CBUF_Empty()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %47
3: ; preds = %0
%4 = tail call i32 (...) @CBUF_Char()
switch i32 %4, label %47 [
i32 83, label %5
i32 79, label %7
i32 67, label %9
i32 116, label %11
i32 84, label %13
i32 70, label %15
i32 77, label %17
i32 109, label %19
i32 86, label %21
i32 78, label %23
i32 90, label %25
i32 65, label %27
i32 97, label %29
i32 98, label %31
i32 114, label %33
i32 68, label %35
i32 100, label %37
i32 101, label %39
i32 115, label %41
i32 66, label %43
i32 105, label %45
]
5: ; preds = %3
%6 = tail call i32 (...) @COMMAND_CAN_SetBitRate()
br label %47
7: ; preds = %3
%8 = tail call i32 (...) @COMMAND_CAN_Open()
br label %47
9: ; preds = %3
%10 = tail call i32 (...) @COMMAND_CAN_Close()
br label %47
11: ; preds = %3
%12 = tail call i32 @COMMAND_CAN_Transmit(i32 0)
br label %47
13: ; preds = %3
%14 = tail call i32 @COMMAND_CAN_Transmit(i32 1)
br label %47
15: ; preds = %3
%16 = tail call i32 (...) @COMMAND_CAN_Status()
br label %47
17: ; preds = %3
%18 = tail call i32 (...) @COMMAND_CAN_ACR()
br label %47
19: ; preds = %3
%20 = tail call i32 (...) @COMMAND_CAN_AMR()
br label %47
21: ; preds = %3
%22 = tail call i32 (...) @COMMAND_CAN_Version()
br label %47
23: ; preds = %3
%24 = tail call i32 (...) @COMMAND_CAN_SerialNumber()
br label %47
25: ; preds = %3
%26 = tail call i32 (...) @COMMAND_CAN_TimeStamp()
br label %47
27: ; preds = %3
%28 = tail call i32 (...) @COMMAND_ADC_Enable()
br label %47
29: ; preds = %3
%30 = tail call i32 (...) @COMMAND_ADC_AsyncMode()
br label %47
31: ; preds = %3
%32 = tail call i32 (...) @COMMAND_ADC_ChangeMode()
br label %47
33: ; preds = %3
%34 = tail call i32 (...) @COMMAND_ADC_Read()
br label %47
35: ; preds = %3
%36 = tail call i32 (...) @COMMAND_DIG_Enable()
br label %47
37: ; preds = %3
%38 = tail call i32 (...) @COMMAND_DIG_AsyncMode()
br label %47
39: ; preds = %3
%40 = tail call i32 (...) @COMMAND_DIG_Read()
br label %47
41: ; preds = %3
%42 = tail call i32 (...) @COMMAND_ADC_si()
br label %47
43: ; preds = %3
%44 = tail call i32 (...) @COMMAND_UART_Baud()
br label %47
45: ; preds = %3
%46 = tail call i32 (...) @COMMAND_APP_Info()
br label %47
47: ; preds = %3, %0, %45, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
%48 = phi i32 [ %46, %45 ], [ %44, %43 ], [ %42, %41 ], [ %40, %39 ], [ %38, %37 ], [ %36, %35 ], [ %34, %33 ], [ %32, %31 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ], [ %24, %23 ], [ %22, %21 ], [ %20, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ 0, %0 ], [ -1, %3 ]
ret i32 %48
}