#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 */
int B115200;
int B1200;
int B134;
int B150;
int B1800;
int B19200;
int B200;
int B2400;
int B300;
int B38400;
int B4800;
int B57600;
int B600;
int B9600;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
uint32_t serial_convertBaudRateToFlag(uint32_t baudrate) {
  uint32_t baudrateValue;
  switch (baudrate) {
  case 134:
    baudrateValue = B134;
    break;
  case 150:
    baudrateValue = B150;
    break;
  case 200:
    baudrateValue = B200;
    break;
  case 300:
    baudrateValue = B300;
    break;
  case 600:
    baudrateValue = B600;
    break;
  case 1200:
    baudrateValue = B1200;
    break;
  case 1800:
    baudrateValue = B1800;
    break;
  case 2400:
    baudrateValue = B2400;
    break;
  case 4800:
    baudrateValue = B4800;
    break;
  case 9600:
    baudrateValue = B9600;
    break;
  case 19200:
    baudrateValue = B19200;
    break;
  case 38400:
    baudrateValue = B38400;
    break;
  case 57600:
    baudrateValue = B57600;
    break;
  case 115200:
    baudrateValue = B115200;
    break;
  default:
    baudrateValue = B9600;
    fprintf(stdout, "unknwon speed value, set to 9600bps\n");
    break;
  }
  return baudrateValue;
}


x86 assembly (clang, -O0):
<serial_convertBaudRateToFlag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x86,%eax
je     1228 <serial_convertBaudRateToFlag+0x118>
jmp    1131 <serial_convertBaudRateToFlag+0x21>
mov    -0xc(%rbp),%eax
sub    $0x96,%eax
je     1239 <serial_convertBaudRateToFlag+0x129>
jmp    1144 <serial_convertBaudRateToFlag+0x34>
mov    -0xc(%rbp),%eax
sub    $0xc8,%eax
je     124a <serial_convertBaudRateToFlag+0x13a>
jmp    1157 <serial_convertBaudRateToFlag+0x47>
mov    -0xc(%rbp),%eax
sub    $0x12c,%eax
je     125b <serial_convertBaudRateToFlag+0x14b>
jmp    116a <serial_convertBaudRateToFlag+0x5a>
mov    -0xc(%rbp),%eax
sub    $0x258,%eax
je     126c <serial_convertBaudRateToFlag+0x15c>
jmp    117d <serial_convertBaudRateToFlag+0x6d>
mov    -0xc(%rbp),%eax
sub    $0x4b0,%eax
je     127d <serial_convertBaudRateToFlag+0x16d>
jmp    1190 <serial_convertBaudRateToFlag+0x80>
mov    -0xc(%rbp),%eax
sub    $0x708,%eax
je     128e <serial_convertBaudRateToFlag+0x17e>
jmp    11a3 <serial_convertBaudRateToFlag+0x93>
mov    -0xc(%rbp),%eax
sub    $0x960,%eax
je     129f <serial_convertBaudRateToFlag+0x18f>
jmp    11b6 <serial_convertBaudRateToFlag+0xa6>
mov    -0xc(%rbp),%eax
sub    $0x12c0,%eax
je     12b0 <serial_convertBaudRateToFlag+0x1a0>
jmp    11c9 <serial_convertBaudRateToFlag+0xb9>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     12c1 <serial_convertBaudRateToFlag+0x1b1>
jmp    11dc <serial_convertBaudRateToFlag+0xcc>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     12d2 <serial_convertBaudRateToFlag+0x1c2>
jmp    11ef <serial_convertBaudRateToFlag+0xdf>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     12e3 <serial_convertBaudRateToFlag+0x1d3>
jmp    1202 <serial_convertBaudRateToFlag+0xf2>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     12f4 <serial_convertBaudRateToFlag+0x1e4>
jmp    1215 <serial_convertBaudRateToFlag+0x105>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     1305 <serial_convertBaudRateToFlag+0x1f5>
jmp    1316 <serial_convertBaudRateToFlag+0x206>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d67(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2cf2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2c7e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2cb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2c6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1337 <serial_convertBaudRateToFlag+0x227>
mov    0x2cab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2c57(%rip),%rax
mov    (%rax),%edi
lea    0xcce(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_convertBaudRateToFlag>:
push   %rbx
cmp    $0x95f,%edi
jg     1153 <serial_convertBaudRateToFlag+0x43>
cmp    $0x12b,%edi
jle    118d <serial_convertBaudRateToFlag+0x7d>
cmp    $0x4af,%edi
jg     11f1 <serial_convertBaudRateToFlag+0xe1>
cmp    $0x12c,%edi
je     122e <serial_convertBaudRateToFlag+0x11e>
cmp    $0x258,%edi
jne    1286 <serial_convertBaudRateToFlag+0x176>
mov    0x2e94(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
cmp    $0x4aff,%edi
jle    11bf <serial_convertBaudRateToFlag+0xaf>
cmp    $0xe0ff,%edi
jg     1213 <serial_convertBaudRateToFlag+0x103>
cmp    $0x4b00,%edi
je     1239 <serial_convertBaudRateToFlag+0x129>
cmp    $0x9600,%edi
jne    1286 <serial_convertBaudRateToFlag+0x176>
mov    0x2de2(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
cmp    $0x86,%edi
je     1244 <serial_convertBaudRateToFlag+0x134>
cmp    $0x96,%edi
je     124f <serial_convertBaudRateToFlag+0x13f>
cmp    $0xc8,%edi
jne    1286 <serial_convertBaudRateToFlag+0x176>
mov    0x2e00(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
cmp    $0x960,%edi
je     125a <serial_convertBaudRateToFlag+0x14a>
cmp    $0x12c0,%edi
je     1265 <serial_convertBaudRateToFlag+0x155>
cmp    $0x2580,%edi
jne    1286 <serial_convertBaudRateToFlag+0x176>
mov    0x2dde(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
cmp    $0x4b0,%edi
je     1270 <serial_convertBaudRateToFlag+0x160>
cmp    $0x708,%edi
jne    1286 <serial_convertBaudRateToFlag+0x176>
mov    0x2d94(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
cmp    $0xe100,%edi
je     127b <serial_convertBaudRateToFlag+0x16b>
cmp    $0x1c200,%edi
jne    1286 <serial_convertBaudRateToFlag+0x176>
mov    0x2d4e(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d8b(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2db0(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d8d(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d3a(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d37(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d64(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d11(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d2e(%rip),%rax
mov    (%rax),%ebx
jmp    12a4 <serial_convertBaudRateToFlag+0x194>
mov    0x2d3b(%rip),%rax
mov    (%rax),%ebx
mov    0x2cea(%rip),%rax
mov    (%rax),%edi
lea    0xd61(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@B134 = global i32 0
@B150 = global i32 0
@B200 = global i32 0
@B300 = global i32 0
@B600 = global i32 0
@B1200 = global i32 0
@B1800 = 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
@stdout = global i32 0
@.str = [37 x i8] c"unknwon speed value, set to 9600bps\0A\00"
define i32 @serial_convertBaudRateToFlag(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %33 [
i32 134, label %5
i32 150, label %7
i32 200, label %9
i32 300, label %11
i32 600, label %13
i32 1200, label %15
i32 1800, label %17
i32 2400, label %19
i32 4800, label %21
i32 9600, label %23
i32 19200, label %25
i32 38400, label %27
i32 57600, label %29
i32 115200, label %31
]
5: ; preds = %1
%6 = load i32, i32* @B134
store i32 %6, i32* %3
br label %37
7: ; preds = %1
%8 = load i32, i32* @B150
store i32 %8, i32* %3
br label %37
9: ; preds = %1
%10 = load i32, i32* @B200
store i32 %10, i32* %3
br label %37
11: ; preds = %1
%12 = load i32, i32* @B300
store i32 %12, i32* %3
br label %37
13: ; preds = %1
%14 = load i32, i32* @B600
store i32 %14, i32* %3
br label %37
15: ; preds = %1
%16 = load i32, i32* @B1200
store i32 %16, i32* %3
br label %37
17: ; preds = %1
%18 = load i32, i32* @B1800
store i32 %18, i32* %3
br label %37
19: ; preds = %1
%20 = load i32, i32* @B2400
store i32 %20, i32* %3
br label %37
21: ; preds = %1
%22 = load i32, i32* @B4800
store i32 %22, i32* %3
br label %37
23: ; preds = %1
%24 = load i32, i32* @B9600
store i32 %24, i32* %3
br label %37
25: ; preds = %1
%26 = load i32, i32* @B19200
store i32 %26, i32* %3
br label %37
27: ; preds = %1
%28 = load i32, i32* @B38400
store i32 %28, i32* %3
br label %37
29: ; preds = %1
%30 = load i32, i32* @B57600
store i32 %30, i32* %3
br label %37
31: ; preds = %1
%32 = load i32, i32* @B115200
store i32 %32, i32* %3
br label %37
33: ; preds = %1
%34 = load i32, i32* @B9600
store i32 %34, i32* %3
%35 = load i32, i32* @stdout
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %37
37: ; preds = %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@B134 = global i32 0
@B150 = global i32 0
@B200 = global i32 0
@B300 = global i32 0
@B600 = global i32 0
@B1200 = global i32 0
@B1800 = 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
@stdout = global i32 0
@.str = [37 x i8] c"unknwon speed value, set to 9600bps\0A\00"
define i32 @serial_convertBaudRateToFlag(i32 %0) {
switch i32 %0, label %30 [
i32 134, label %2
i32 150, label %4
i32 200, label %6
i32 300, label %8
i32 600, label %10
i32 1200, label %12
i32 1800, label %14
i32 2400, label %16
i32 4800, label %18
i32 9600, label %20
i32 19200, label %22
i32 38400, label %24
i32 57600, label %26
i32 115200, label %28
]
2: ; preds = %1
%3 = load i32, i32* @B134
br label %34
4: ; preds = %1
%5 = load i32, i32* @B150
br label %34
6: ; preds = %1
%7 = load i32, i32* @B200
br label %34
8: ; preds = %1
%9 = load i32, i32* @B300
br label %34
10: ; preds = %1
%11 = load i32, i32* @B600
br label %34
12: ; preds = %1
%13 = load i32, i32* @B1200
br label %34
14: ; preds = %1
%15 = load i32, i32* @B1800
br label %34
16: ; preds = %1
%17 = load i32, i32* @B2400
br label %34
18: ; preds = %1
%19 = load i32, i32* @B4800
br label %34
20: ; preds = %1
%21 = load i32, i32* @B9600
br label %34
22: ; preds = %1
%23 = load i32, i32* @B19200
br label %34
24: ; preds = %1
%25 = load i32, i32* @B38400
br label %34
26: ; preds = %1
%27 = load i32, i32* @B57600
br label %34
28: ; preds = %1
%29 = load i32, i32* @B115200
br label %34
30: ; preds = %1
%31 = load i32, i32* @B9600
%32 = load i32, i32* @stdout
%33 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
%35 = phi i32 [ %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, %4 ], [ %3, %2 ]
ret i32 %35
}