#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 */
typedef int speed_t;

/* Variables and functions */
#define B0 146
#define B110 145
#define B115200 144
#define B1200 143
#define B134 142
#define B150 141
#define B1800 140
#define B19200 139
#define B200 138
#define B230400 137
#define B2400 136
#define B300 135
#define B38400 134
#define B4800 133
#define B50 132
#define B57600 131
#define B600 130
#define B75 129
#define B9600 128
int GetRealBaudRate(speed_t spSpeed) {
  switch (spSpeed) {
  case B0:
    return 0;
  case B50:
    return 50;
  case B75:
    return 75;
  case B110:
    return 110;
  case B134:
    return 134;
  case B150:
    return 150;
  case B200:
    return 200;
  case B300:
    return 300;
  case B600:
    return 600;
  case B1200:
    return 1200;
  case B1800:
    return 1800;
  case B2400:
    return 2400;
  case B4800:
    return 4800;
  case B9600:
    return 9600;
  case B19200:
    return 19200;
  case B38400:
    return 38400;
  case B57600:
    return 57600;
  case B115200:
    return 115200;
  case B230400:
    return 230400;
  default:
    return -1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<GetRealBaudRate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x12,%eax
ja     1214 <GetRealBaudRate+0x114>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x32,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x4b,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x6e,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x86,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x96,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0xc8,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x12c,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x258,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x4b0,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x708,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x960,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x12c0,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x2580,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x4b00,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x9600,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0xe100,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x1c200,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0x38400,-0x4(%rbp)
jmp    121b <GetRealBaudRate+0x11b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetRealBaudRate>:
add    $0xffffff80,%edi
mov    $0xffffffff,%eax
cmp    $0x12,%edi
ja     111a <GetRealBaudRate+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @GetRealBaudRate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %24 [
i32 146, label %5
i32 132, label %6
i32 129, label %7
i32 145, label %8
i32 142, label %9
i32 141, label %10
i32 138, label %11
i32 135, label %12
i32 130, label %13
i32 143, label %14
i32 140, label %15
i32 136, label %16
i32 133, label %17
i32 128, label %18
i32 139, label %19
i32 134, label %20
i32 131, label %21
i32 144, label %22
i32 137, label %23
]
5: ; preds = %1
store i32 0, i32* %2
br label %25
6: ; preds = %1
store i32 50, i32* %2
br label %25
7: ; preds = %1
store i32 75, i32* %2
br label %25
8: ; preds = %1
store i32 110, i32* %2
br label %25
9: ; preds = %1
store i32 134, i32* %2
br label %25
10: ; preds = %1
store i32 150, i32* %2
br label %25
11: ; preds = %1
store i32 200, i32* %2
br label %25
12: ; preds = %1
store i32 300, i32* %2
br label %25
13: ; preds = %1
store i32 600, i32* %2
br label %25
14: ; preds = %1
store i32 1200, i32* %2
br label %25
15: ; preds = %1
store i32 1800, i32* %2
br label %25
16: ; preds = %1
store i32 2400, i32* %2
br label %25
17: ; preds = %1
store i32 4800, i32* %2
br label %25
18: ; preds = %1
store i32 9600, i32* %2
br label %25
19: ; preds = %1
store i32 19200, i32* %2
br label %25
20: ; preds = %1
store i32 38400, i32* %2
br label %25
21: ; preds = %1
store i32 57600, i32* %2
br label %25
22: ; preds = %1
store i32 115200, i32* %2
br label %25
23: ; preds = %1
store i32 230400, i32* %2
br label %25
24: ; preds = %1
store i32 -1, i32* %2
br label %25
25: ; preds = %24, %23, %22, %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
@switch.table.GetRealBaudRate = [19 x i32] [i32 9600, i32 75, i32 600, i32 57600, i32 50, i32 4800, i32 38400, i32 300, i32 2400, i32 230400, i32 200, i32 19200, i32 1800, i32 150, i32 134, i32 1200, i32 115200, i32 110, i32 0]
define i32 @GetRealBaudRate(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 19
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [19 x i32], [19 x i32]* @switch.table.GetRealBaudRate, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}