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

/* Variables and functions */
int /*<<< orphan*/ B115200;
int /*<<< orphan*/ B1200;
int /*<<< orphan*/ B19200;
int /*<<< orphan*/ B2400;
int /*<<< orphan*/ B300;
int /*<<< orphan*/ B38400;
int /*<<< orphan*/ B4800;
int /*<<< orphan*/ B57600;
int /*<<< orphan*/ B600;
int /*<<< orphan*/ B9600;
speed_t _convertBaudRate(int baudrate) {
  speed_t speed = 0;
  switch (baudrate) {
  case 300:
    speed = B300;
    break;
  case 600:
    speed = B600;
    break;
  case 1200:
    speed = B1200;
    break;
  case 2400:
    speed = B2400;
    break;
  case 4800:
    speed = B4800;
    break;
  case 9600:
    speed = B9600;
    break;
  case 19200:
    speed = B19200;
    break;
  case 38400:
    speed = B38400;
    break;
  case 57600:
    speed = B57600;
    break;
  case 115200:
    speed = B115200;
    break;
  default:
    speed = B9600;
  }
  return speed;
}


x86 assembly (clang, -O0):
<_convertBaudRate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x12c,%eax
je     11cf <_convertBaudRate+0xcf>
jmp    1124 <_convertBaudRate+0x24>
mov    -0xc(%rbp),%eax
sub    $0x258,%eax
je     11e0 <_convertBaudRate+0xe0>
jmp    1137 <_convertBaudRate+0x37>
mov    -0xc(%rbp),%eax
sub    $0x4b0,%eax
je     11f1 <_convertBaudRate+0xf1>
jmp    114a <_convertBaudRate+0x4a>
mov    -0xc(%rbp),%eax
sub    $0x960,%eax
je     1202 <_convertBaudRate+0x102>
jmp    115d <_convertBaudRate+0x5d>
mov    -0xc(%rbp),%eax
sub    $0x12c0,%eax
je     1213 <_convertBaudRate+0x113>
jmp    1170 <_convertBaudRate+0x70>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     1224 <_convertBaudRate+0x124>
jmp    1183 <_convertBaudRate+0x83>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     1235 <_convertBaudRate+0x135>
jmp    1196 <_convertBaudRate+0x96>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     1246 <_convertBaudRate+0x146>
jmp    11a9 <_convertBaudRate+0xa9>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     1257 <_convertBaudRate+0x157>
jmp    11bc <_convertBaudRate+0xbc>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     1268 <_convertBaudRate+0x168>
jmp    1279 <_convertBaudRate+0x179>
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2da7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2db4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2d43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2d62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1285 <_convertBaudRate+0x185>
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_convertBaudRate>:
cmp    $0x257f,%edi
jg     113a <_convertBaudRate+0x3a>
cmp    $0x4af,%edi
jle    1164 <_convertBaudRate+0x64>
cmp    $0x4b0,%edi
je     11a2 <_convertBaudRate+0xa2>
cmp    $0x960,%edi
je     11ac <_convertBaudRate+0xac>
cmp    $0x12c0,%edi
jne    1198 <_convertBaudRate+0x98>
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x95ff,%edi
jle    117e <_convertBaudRate+0x7e>
cmp    $0x9600,%edi
je     11b6 <_convertBaudRate+0xb6>
cmp    $0xe100,%edi
je     11c0 <_convertBaudRate+0xc0>
cmp    $0x1c200,%edi
jne    1198 <_convertBaudRate+0x98>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x12c,%edi
je     11ca <_convertBaudRate+0xca>
cmp    $0x258,%edi
jne    1198 <_convertBaudRate+0x98>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x2580,%edi
je     1198 <_convertBaudRate+0x98>
cmp    $0x4b00,%edi
jne    1198 <_convertBaudRate+0x98>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2dff(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2dd3(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2df9(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@B300 = global i32 0
@B600 = 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
define i32 @_convertBaudRate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %25 [
i32 300, label %5
i32 600, 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
]
5: ; preds = %1
%6 = load i32, i32* @B300
store i32 %6, i32* %3
br label %27
7: ; preds = %1
%8 = load i32, i32* @B600
store i32 %8, i32* %3
br label %27
9: ; preds = %1
%10 = load i32, i32* @B1200
store i32 %10, i32* %3
br label %27
11: ; preds = %1
%12 = load i32, i32* @B2400
store i32 %12, i32* %3
br label %27
13: ; preds = %1
%14 = load i32, i32* @B4800
store i32 %14, i32* %3
br label %27
15: ; preds = %1
%16 = load i32, i32* @B9600
store i32 %16, i32* %3
br label %27
17: ; preds = %1
%18 = load i32, i32* @B19200
store i32 %18, i32* %3
br label %27
19: ; preds = %1
%20 = load i32, i32* @B38400
store i32 %20, i32* %3
br label %27
21: ; preds = %1
%22 = load i32, i32* @B57600
store i32 %22, i32* %3
br label %27
23: ; preds = %1
%24 = load i32, i32* @B115200
store i32 %24, i32* %3
br label %27
25: ; preds = %1
%26 = load i32, i32* @B9600
store i32 %26, i32* %3
br label %27
27: ; preds = %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@B300 = global i32 0
@B600 = 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
define i32 @_convertBaudRate(i32 %0) {
switch i32 %0, label %11 [
i32 300, label %12
i32 600, label %2
i32 1200, label %3
i32 2400, label %4
i32 4800, label %5
i32 9600, label %6
i32 19200, label %7
i32 38400, label %8
i32 57600, label %9
i32 115200, label %10
]
2: ; preds = %1
br label %12
3: ; preds = %1
br label %12
4: ; preds = %1
br label %12
5: ; preds = %1
br label %12
6: ; preds = %1
br label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%13 = phi i32* [ @B9600, %11 ], [ @B115200, %10 ], [ @B57600, %9 ], [ @B38400, %8 ], [ @B19200, %7 ], [ @B9600, %6 ], [ @B4800, %5 ], [ @B2400, %4 ], [ @B1200, %3 ], [ @B600, %2 ], [ @B300, %1 ]
%14 = load i32, i32* %13
ret i32 %14
}