#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 B115200;
int B1200;
int B19200;
int B2400;
int B38400;
int B4800;
int B57600;
int B9600;
int serio_get_baud(unsigned br) {
  switch (br) {
  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;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<serio_get_baud>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x4b0,%eax
je     11a2 <serio_get_baud+0xa2>
jmp    111d <serio_get_baud+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x960,%eax
je     11b3 <serio_get_baud+0xb3>
jmp    1130 <serio_get_baud+0x30>
mov    -0xc(%rbp),%eax
sub    $0x12c0,%eax
je     11c4 <serio_get_baud+0xc4>
jmp    1143 <serio_get_baud+0x43>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     11d5 <serio_get_baud+0xd5>
jmp    1156 <serio_get_baud+0x56>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     11e6 <serio_get_baud+0xe6>
jmp    1169 <serio_get_baud+0x69>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     11f7 <serio_get_baud+0xf7>
jmp    117c <serio_get_baud+0x7c>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     1208 <serio_get_baud+0x108>
jmp    118f <serio_get_baud+0x8f>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     1219 <serio_get_baud+0x119>
jmp    122a <serio_get_baud+0x12a>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2e06(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2dfc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2e03(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2da2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2dc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
mov    0x2d90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1231 <serio_get_baud+0x131>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<serio_get_baud>:
xor    %eax,%eax
cmp    $0x4aff,%edi
jg     112f <serio_get_baud+0x2f>
cmp    $0x12bf,%edi
jg     1150 <serio_get_baud+0x50>
cmp    $0x4b0,%edi
je     1182 <serio_get_baud+0x82>
cmp    $0x960,%edi
jne    11a6 <serio_get_baud+0xa6>
mov    0x2e93(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
cmp    $0xe0ff,%edi
jg     1169 <serio_get_baud+0x69>
cmp    $0x4b00,%edi
je     118b <serio_get_baud+0x8b>
cmp    $0x9600,%edi
jne    11a6 <serio_get_baud+0xa6>
mov    0x2e52(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
cmp    $0x12c0,%edi
je     1194 <serio_get_baud+0x94>
cmp    $0x2580,%edi
jne    11a6 <serio_get_baud+0xa6>
mov    0x2e71(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
cmp    $0xe100,%edi
je     119d <serio_get_baud+0x9d>
cmp    $0x1c200,%edi
jne    11a6 <serio_get_baud+0xa6>
mov    0x2e30(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
mov    0x2e2f(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
mov    0x2e5e(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
mov    0x2e45(%rip),%rax
jmp    11a4 <serio_get_baud+0xa4>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@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 @serio_get_baud(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %21 [
i32 1200, label %5
i32 2400, label %7
i32 4800, label %9
i32 9600, label %11
i32 19200, label %13
i32 38400, label %15
i32 57600, label %17
i32 115200, label %19
]
5: ; preds = %1
%6 = load i32, i32* @B1200
store i32 %6, i32* %2
br label %22
7: ; preds = %1
%8 = load i32, i32* @B2400
store i32 %8, i32* %2
br label %22
9: ; preds = %1
%10 = load i32, i32* @B4800
store i32 %10, i32* %2
br label %22
11: ; preds = %1
%12 = load i32, i32* @B9600
store i32 %12, i32* %2
br label %22
13: ; preds = %1
%14 = load i32, i32* @B19200
store i32 %14, i32* %2
br label %22
15: ; preds = %1
%16 = load i32, i32* @B38400
store i32 %16, i32* %2
br label %22
17: ; preds = %1
%18 = load i32, i32* @B57600
store i32 %18, i32* %2
br label %22
19: ; preds = %1
%20 = load i32, i32* @B115200
store i32 %20, i32* %2
br label %22
21: ; preds = %1
store i32 0, i32* %2
br label %22
22: ; preds = %21, %19, %17, %15, %13, %11, %9, %7, %5
%23 = load i32, i32* %2
ret i32 %23
}

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