#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 B0;
int B115200;
int B1200;
int B19200;
int B230400;
int B2400;
int B300;
int B38400;
int B460800;
int B4800;
int B57600;
int B9600;
int bot_serial_translate_baud(int inrate) {
  switch (inrate) {
  case 0:
    return B0;
  case 300:
    return B300;
  case 1200:
    return B1200;
  case 2400:
    return B2400;
  case 4800:
    return B4800;
  case 9600:
    return B9600;
  case 19200:
    return B19200;
  case 38400:
    return B38400;
  case 57600:
    return B57600;
  case 115200:
    return B115200;
  case 230400:
    return B230400;
  case 460800:
    return B460800;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<bot_serial_translate_baud>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     11eb <bot_serial_translate_baud+0xeb>
jmp    111a <bot_serial_translate_baud+0x1a>
mov    -0xc(%rbp),%eax
sub    $0x12c,%eax
je     11fc <bot_serial_translate_baud+0xfc>
jmp    112d <bot_serial_translate_baud+0x2d>
mov    -0xc(%rbp),%eax
sub    $0x4b0,%eax
je     120d <bot_serial_translate_baud+0x10d>
jmp    1140 <bot_serial_translate_baud+0x40>
mov    -0xc(%rbp),%eax
sub    $0x960,%eax
je     121e <bot_serial_translate_baud+0x11e>
jmp    1153 <bot_serial_translate_baud+0x53>
mov    -0xc(%rbp),%eax
sub    $0x12c0,%eax
je     122f <bot_serial_translate_baud+0x12f>
jmp    1166 <bot_serial_translate_baud+0x66>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     1240 <bot_serial_translate_baud+0x140>
jmp    1179 <bot_serial_translate_baud+0x79>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     1251 <bot_serial_translate_baud+0x151>
jmp    118c <bot_serial_translate_baud+0x8c>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     1262 <bot_serial_translate_baud+0x162>
jmp    119f <bot_serial_translate_baud+0x9f>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     1273 <bot_serial_translate_baud+0x173>
jmp    11b2 <bot_serial_translate_baud+0xb2>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     1284 <bot_serial_translate_baud+0x184>
jmp    11c5 <bot_serial_translate_baud+0xc5>
mov    -0xc(%rbp),%eax
sub    $0x38400,%eax
je     1295 <bot_serial_translate_baud+0x195>
jmp    11d8 <bot_serial_translate_baud+0xd8>
mov    -0xc(%rbp),%eax
sub    $0x70800,%eax
je     12a6 <bot_serial_translate_baud+0x1a6>
jmp    12b7 <bot_serial_translate_baud+0x1b7>
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2dcd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2daa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2d0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2cec(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
mov    0x2cfb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12be <bot_serial_translate_baud+0x1be>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_serial_translate_baud>:
mov    $0xffffffff,%eax
cmp    $0x4aff,%edi
jg     1141 <bot_serial_translate_baud+0x41>
cmp    $0x95f,%edi
jg     1171 <bot_serial_translate_baud+0x71>
test   %edi,%edi
je     11b3 <bot_serial_translate_baud+0xb3>
cmp    $0x12c,%edi
je     11bc <bot_serial_translate_baud+0xbc>
cmp    $0x4b0,%edi
jne    11fb <bot_serial_translate_baud+0xfb>
mov    0x2e64(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
cmp    $0x1c1ff,%edi
jg     1192 <bot_serial_translate_baud+0x92>
cmp    $0x4b00,%edi
je     11c5 <bot_serial_translate_baud+0xc5>
cmp    $0x9600,%edi
je     11ce <bot_serial_translate_baud+0xce>
cmp    $0xe100,%edi
jne    11fb <bot_serial_translate_baud+0xfb>
mov    0x2e5c(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
cmp    $0x960,%edi
je     11d7 <bot_serial_translate_baud+0xd7>
cmp    $0x12c0,%edi
je     11e0 <bot_serial_translate_baud+0xe0>
cmp    $0x2580,%edi
jne    11fb <bot_serial_translate_baud+0xfb>
mov    0x2e48(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
cmp    $0x1c200,%edi
je     11e9 <bot_serial_translate_baud+0xe9>
cmp    $0x38400,%edi
je     11f2 <bot_serial_translate_baud+0xf2>
cmp    $0x70800,%edi
jne    11fb <bot_serial_translate_baud+0xfb>
mov    0x2df7(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2dfe(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2e0d(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2e24(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2dab(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2dd2(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2df9(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2da8(%rip),%rax
jmp    11f9 <bot_serial_translate_baud+0xf9>
mov    0x2d8f(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@B0 = global i32 0
@B300 = global i32 0
@B1200 = global i32 0
@B2400 = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@B460800 = global i32 0
define i32 @bot_serial_translate_baud(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %29 [
i32 0, label %5
i32 300, label %7
i32 1200, label %9
i32 2400, label %11
i32 4800, label %13
i32 9600, label %15
i32 19200, label %17
i32 38400, label %19
i32 57600, label %21
i32 115200, label %23
i32 230400, label %25
i32 460800, label %27
]
5: ; preds = %1
%6 = load i32, i32* @B0
store i32 %6, i32* %2
br label %30
7: ; preds = %1
%8 = load i32, i32* @B300
store i32 %8, i32* %2
br label %30
9: ; preds = %1
%10 = load i32, i32* @B1200
store i32 %10, i32* %2
br label %30
11: ; preds = %1
%12 = load i32, i32* @B2400
store i32 %12, i32* %2
br label %30
13: ; preds = %1
%14 = load i32, i32* @B4800
store i32 %14, i32* %2
br label %30
15: ; preds = %1
%16 = load i32, i32* @B9600
store i32 %16, i32* %2
br label %30
17: ; preds = %1
%18 = load i32, i32* @B19200
store i32 %18, i32* %2
br label %30
19: ; preds = %1
%20 = load i32, i32* @B38400
store i32 %20, i32* %2
br label %30
21: ; preds = %1
%22 = load i32, i32* @B57600
store i32 %22, i32* %2
br label %30
23: ; preds = %1
%24 = load i32, i32* @B115200
store i32 %24, i32* %2
br label %30
25: ; preds = %1
%26 = load i32, i32* @B230400
store i32 %26, i32* %2
br label %30
27: ; preds = %1
%28 = load i32, i32* @B460800
store i32 %28, i32* %2
br label %30
29: ; preds = %1
store i32 -1, i32* %2
br label %30
30: ; preds = %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@B0 = global i32 0
@B300 = global i32 0
@B1200 = global i32 0
@B2400 = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@B460800 = global i32 0
define i32 @bot_serial_translate_baud(i32 %0) {
switch i32 %0, label %26 [
i32 0, label %2
i32 300, label %4
i32 1200, label %6
i32 2400, label %8
i32 4800, label %10
i32 9600, label %12
i32 19200, label %14
i32 38400, label %16
i32 57600, label %18
i32 115200, label %20
i32 230400, label %22
i32 460800, label %24
]
2: ; preds = %1
%3 = load i32, i32* @B0
br label %26
4: ; preds = %1
%5 = load i32, i32* @B300
br label %26
6: ; preds = %1
%7 = load i32, i32* @B1200
br label %26
8: ; preds = %1
%9 = load i32, i32* @B2400
br label %26
10: ; preds = %1
%11 = load i32, i32* @B4800
br label %26
12: ; preds = %1
%13 = load i32, i32* @B9600
br label %26
14: ; preds = %1
%15 = load i32, i32* @B19200
br label %26
16: ; preds = %1
%17 = load i32, i32* @B38400
br label %26
18: ; preds = %1
%19 = load i32, i32* @B57600
br label %26
20: ; preds = %1
%21 = load i32, i32* @B115200
br label %26
22: ; preds = %1
%23 = load i32, i32* @B230400
br label %26
24: ; preds = %1
%25 = load i32, i32* @B460800
br label %26
26: ; preds = %1, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
%27 = phi i32 [ %25, %24 ], [ %23, %22 ], [ %21, %20 ], [ %19, %18 ], [ %17, %16 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ], [ -1, %1 ]
ret i32 %27
}