#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*/ B1000000;
int /*<<< orphan*/ B115200;
int /*<<< orphan*/ B19200;
int /*<<< orphan*/ B230400;
int /*<<< orphan*/ B38400;
int /*<<< orphan*/ B57600;
int /*<<< orphan*/ B9600;
speed_t SerialGetBaudRate(int baud) {
  switch (baud) {
  case 9600:
    return B9600;
  case 19200:
    return B19200;
  case 57600:
    return B57600;
  case 115200:
    return B115200;
  case 230400:
    return B230400;
  case 1000000:
    return B1000000;
  default:
    return B38400;
  }
}


x86 assembly (clang, -O0):
<SerialGetBaudRate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2580,%eax
je     117c <SerialGetBaudRate+0x7c>
jmp    111d <SerialGetBaudRate+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     118d <SerialGetBaudRate+0x8d>
jmp    1130 <SerialGetBaudRate+0x30>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     119e <SerialGetBaudRate+0x9e>
jmp    1143 <SerialGetBaudRate+0x43>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     11af <SerialGetBaudRate+0xaf>
jmp    1156 <SerialGetBaudRate+0x56>
mov    -0xc(%rbp),%eax
sub    $0x38400,%eax
je     11c0 <SerialGetBaudRate+0xc0>
jmp    1169 <SerialGetBaudRate+0x69>
mov    -0xc(%rbp),%eax
sub    $0xf4240,%eax
je     11d1 <SerialGetBaudRate+0xd1>
jmp    11e2 <SerialGetBaudRate+0xe2>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ee <SerialGetBaudRate+0xee>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ee <SerialGetBaudRate+0xee>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ee <SerialGetBaudRate+0xee>
mov    0x2e0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ee <SerialGetBaudRate+0xee>
mov    0x2de9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ee <SerialGetBaudRate+0xee>
mov    0x2e00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ee <SerialGetBaudRate+0xee>
mov    0x2dbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SerialGetBaudRate>:
cmp    $0x1c1ff,%edi
jg     112a <SerialGetBaudRate+0x2a>
cmp    $0x2580,%edi
je     114c <SerialGetBaudRate+0x4c>
cmp    $0x4b00,%edi
je     1156 <SerialGetBaudRate+0x56>
cmp    $0xe100,%edi
jne    1174 <SerialGetBaudRate+0x74>
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x1c200,%edi
je     1160 <SerialGetBaudRate+0x60>
cmp    $0x38400,%edi
je     116a <SerialGetBaudRate+0x6a>
cmp    $0xf4240,%edi
jne    1174 <SerialGetBaudRate+0x74>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@B9600 = global i32 0
@B19200 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@B1000000 = global i32 0
@B38400 = global i32 0
define i32 @SerialGetBaudRate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %17 [
i32 9600, label %5
i32 19200, label %7
i32 57600, label %9
i32 115200, label %11
i32 230400, label %13
i32 1000000, label %15
]
5: ; preds = %1
%6 = load i32, i32* @B9600
store i32 %6, i32* %2
br label %19
7: ; preds = %1
%8 = load i32, i32* @B19200
store i32 %8, i32* %2
br label %19
9: ; preds = %1
%10 = load i32, i32* @B57600
store i32 %10, i32* %2
br label %19
11: ; preds = %1
%12 = load i32, i32* @B115200
store i32 %12, i32* %2
br label %19
13: ; preds = %1
%14 = load i32, i32* @B230400
store i32 %14, i32* %2
br label %19
15: ; preds = %1
%16 = load i32, i32* @B1000000
store i32 %16, i32* %2
br label %19
17: ; preds = %1
%18 = load i32, i32* @B38400
store i32 %18, i32* %2
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7, %5
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@B9600 = global i32 0
@B19200 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@B1000000 = global i32 0
@B38400 = global i32 0
define i32 @SerialGetBaudRate(i32 %0) {
switch i32 %0, label %7 [
i32 9600, label %8
i32 19200, label %2
i32 57600, label %3
i32 115200, label %4
i32 230400, label %5
i32 1000000, label %6
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3, %2
%9 = phi i32* [ @B38400, %7 ], [ @B1000000, %6 ], [ @B230400, %5 ], [ @B115200, %4 ], [ @B57600, %3 ], [ @B19200, %2 ], [ @B9600, %1 ]
%10 = load i32, i32* %9
ret i32 %10
}