#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 uint32_t;

/* Variables and functions */
#define B0 154
#define B1000000 153
#define B110 152
#define B115200 151
#define B1152000 150
#define B1200 149
#define B134 148
#define B150 147
#define B1500000 146
#define B1800 145
#define B19200 144
#define B200 143
#define B2000000 142
#define B230400 141
#define B2400 140
#define B300 139
#define B38400 138
#define B460800 137
#define B4800 136
#define B50 135
#define B500000 134
#define B57600 133
#define B576000 132
#define B600 131
#define B75 130
#define B921600 129
#define B9600 128
int _serial_bits_to_baudrate(uint32_t bits) {
  switch (bits) {
  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;
  case B460800:
    return 460800;
  case B500000:
    return 500000;
  case B576000:
    return 576000;
  case B921600:
    return 921600;
  case B1000000:
    return 1000000;
  case B1152000:
    return 1152000;
  case B1500000:
    return 1500000;
  case B2000000:
    return 2000000;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<_serial_bits_to_baudrate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x1a,%eax
ja     1274 <_serial_bits_to_baudrate+0x174>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x32,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x4b,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x6e,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x86,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x96,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0xc8,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x12c,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x258,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x4b0,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x708,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x960,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x12c0,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x2580,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x4b00,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x9600,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0xe100,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x1c200,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x38400,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x70800,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x7a120,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x8ca00,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0xe1000,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0xf4240,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x119400,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x16e360,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0x1e8480,-0x4(%rbp)
jmp    127b <_serial_bits_to_baudrate+0x17b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_serial_bits_to_baudrate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %32 [
i32 154, label %5
i32 135, label %6
i32 130, label %7
i32 152, label %8
i32 148, label %9
i32 147, label %10
i32 143, label %11
i32 139, label %12
i32 131, label %13
i32 149, label %14
i32 145, label %15
i32 140, label %16
i32 136, label %17
i32 128, label %18
i32 144, label %19
i32 138, label %20
i32 133, label %21
i32 151, label %22
i32 141, label %23
i32 137, label %24
i32 134, label %25
i32 132, label %26
i32 129, label %27
i32 153, label %28
i32 150, label %29
i32 146, label %30
i32 142, label %31
]
5: ; preds = %1
store i32 0, i32* %2
br label %33
6: ; preds = %1
store i32 50, i32* %2
br label %33
7: ; preds = %1
store i32 75, i32* %2
br label %33
8: ; preds = %1
store i32 110, i32* %2
br label %33
9: ; preds = %1
store i32 134, i32* %2
br label %33
10: ; preds = %1
store i32 150, i32* %2
br label %33
11: ; preds = %1
store i32 200, i32* %2
br label %33
12: ; preds = %1
store i32 300, i32* %2
br label %33
13: ; preds = %1
store i32 600, i32* %2
br label %33
14: ; preds = %1
store i32 1200, i32* %2
br label %33
15: ; preds = %1
store i32 1800, i32* %2
br label %33
16: ; preds = %1
store i32 2400, i32* %2
br label %33
17: ; preds = %1
store i32 4800, i32* %2
br label %33
18: ; preds = %1
store i32 9600, i32* %2
br label %33
19: ; preds = %1
store i32 19200, i32* %2
br label %33
20: ; preds = %1
store i32 38400, i32* %2
br label %33
21: ; preds = %1
store i32 57600, i32* %2
br label %33
22: ; preds = %1
store i32 115200, i32* %2
br label %33
23: ; preds = %1
store i32 230400, i32* %2
br label %33
24: ; preds = %1
store i32 460800, i32* %2
br label %33
25: ; preds = %1
store i32 500000, i32* %2
br label %33
26: ; preds = %1
store i32 576000, i32* %2
br label %33
27: ; preds = %1
store i32 921600, i32* %2
br label %33
28: ; preds = %1
store i32 1000000, i32* %2
br label %33
29: ; preds = %1
store i32 1152000, i32* %2
br label %33
30: ; preds = %1
store i32 1500000, i32* %2
br label %33
31: ; preds = %1
store i32 2000000, i32* %2
br label %33
32: ; preds = %1
store i32 -1, i32* %2
br label %33
33: ; preds = %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
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@switch.table._serial_bits_to_baudrate = [27 x i32] [i32 9600, i32 921600, i32 75, i32 600, i32 576000, i32 57600, i32 500000, i32 50, i32 4800, i32 460800, i32 38400, i32 300, i32 2400, i32 230400, i32 2000000, i32 200, i32 19200, i32 1800, i32 1500000, i32 150, i32 134, i32 1200, i32 1152000, i32 115200, i32 110, i32 1000000, i32 0]
define i32 @_serial_bits_to_baudrate(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 27
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [27 x i32], [27 x i32]* @switch.table._serial_bits_to_baudrate, 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
}