#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 B230400;
int B2400;
int B38400;
int B460800;
int B4800;
int B57600;
int B921600;
int B9600;
int uart_speed(int s) {
  switch (s) {
  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;
  case 921600:
    return B921600;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<uart_speed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x4b0,%eax
je     11db <uart_speed+0xdb>
jmp    111d <uart_speed+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x960,%eax
je     11ec <uart_speed+0xec>
jmp    1130 <uart_speed+0x30>
mov    -0xc(%rbp),%eax
sub    $0x12c0,%eax
je     11fd <uart_speed+0xfd>
jmp    1143 <uart_speed+0x43>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     120e <uart_speed+0x10e>
jmp    1156 <uart_speed+0x56>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     121f <uart_speed+0x11f>
jmp    1169 <uart_speed+0x69>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     1230 <uart_speed+0x130>
jmp    117c <uart_speed+0x7c>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     1241 <uart_speed+0x141>
jmp    118f <uart_speed+0x8f>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     1252 <uart_speed+0x152>
jmp    11a2 <uart_speed+0xa2>
mov    -0xc(%rbp),%eax
sub    $0x38400,%eax
je     1263 <uart_speed+0x163>
jmp    11b5 <uart_speed+0xb5>
mov    -0xc(%rbp),%eax
sub    $0x70800,%eax
je     1274 <uart_speed+0x174>
jmp    11c8 <uart_speed+0xc8>
mov    -0xc(%rbp),%eax
sub    $0xe1000,%eax
je     1285 <uart_speed+0x185>
jmp    1296 <uart_speed+0x196>
mov    0x2dc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2dd4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2dbb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2dca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2d51(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2d80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2d26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2d35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
mov    0x2d54(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    129d <uart_speed+0x19d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_speed>:
mov    $0xffffffff,%eax
cmp    $0x95ff,%edi
jle    1145 <uart_speed+0x45>
cmp    $0x383ff,%edi
jg     1172 <uart_speed+0x72>
cmp    $0x9600,%edi
je     11ac <uart_speed+0xac>
cmp    $0xe100,%edi
je     11b5 <uart_speed+0xb5>
cmp    $0x1c200,%edi
jne    11eb <uart_speed+0xeb>
mov    0x2e60(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
cmp    $0x12bf,%edi
jle    1193 <uart_speed+0x93>
cmp    $0x12c0,%edi
je     11be <uart_speed+0xbe>
cmp    $0x2580,%edi
je     11c7 <uart_speed+0xc7>
cmp    $0x4b00,%edi
jne    11eb <uart_speed+0xeb>
mov    0x2e80(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
cmp    $0x38400,%edi
je     11d0 <uart_speed+0xd0>
cmp    $0x70800,%edi
je     11d9 <uart_speed+0xd9>
cmp    $0xe1000,%edi
jne    11eb <uart_speed+0xeb>
mov    0x2e4f(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
cmp    $0x4b0,%edi
je     11e2 <uart_speed+0xe2>
cmp    $0x960,%edi
jne    11eb <uart_speed+0xeb>
mov    0x2e0e(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2dd5(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2e0c(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2e13(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2e02(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2db9(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2dd0(%rip),%rax
jmp    11e9 <uart_speed+0xe9>
mov    0x2dbf(%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
@B230400 = global i32 0
@B460800 = global i32 0
@B921600 = global i32 0
define i32 @uart_speed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %27 [
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
i32 230400, label %21
i32 460800, label %23
i32 921600, label %25
]
5: ; preds = %1
%6 = load i32, i32* @B1200
store i32 %6, i32* %2
br label %28
7: ; preds = %1
%8 = load i32, i32* @B2400
store i32 %8, i32* %2
br label %28
9: ; preds = %1
%10 = load i32, i32* @B4800
store i32 %10, i32* %2
br label %28
11: ; preds = %1
%12 = load i32, i32* @B9600
store i32 %12, i32* %2
br label %28
13: ; preds = %1
%14 = load i32, i32* @B19200
store i32 %14, i32* %2
br label %28
15: ; preds = %1
%16 = load i32, i32* @B38400
store i32 %16, i32* %2
br label %28
17: ; preds = %1
%18 = load i32, i32* @B57600
store i32 %18, i32* %2
br label %28
19: ; preds = %1
%20 = load i32, i32* @B115200
store i32 %20, i32* %2
br label %28
21: ; preds = %1
%22 = load i32, i32* @B230400
store i32 %22, i32* %2
br label %28
23: ; preds = %1
%24 = load i32, i32* @B460800
store i32 %24, i32* %2
br label %28
25: ; preds = %1
%26 = load i32, i32* @B921600
store i32 %26, i32* %2
br label %28
27: ; preds = %1
store i32 -1, i32* %2
br label %28
28: ; preds = %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5
%29 = load i32, i32* %2
ret i32 %29
}

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
@B230400 = global i32 0
@B460800 = global i32 0
@B921600 = global i32 0
define i32 @uart_speed(i32 %0) {
switch i32 %0, label %24 [
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
i32 230400, label %18
i32 460800, label %20
i32 921600, label %22
]
2: ; preds = %1
%3 = load i32, i32* @B1200
br label %24
4: ; preds = %1
%5 = load i32, i32* @B2400
br label %24
6: ; preds = %1
%7 = load i32, i32* @B4800
br label %24
8: ; preds = %1
%9 = load i32, i32* @B9600
br label %24
10: ; preds = %1
%11 = load i32, i32* @B19200
br label %24
12: ; preds = %1
%13 = load i32, i32* @B38400
br label %24
14: ; preds = %1
%15 = load i32, i32* @B57600
br label %24
16: ; preds = %1
%17 = load i32, i32* @B115200
br label %24
18: ; preds = %1
%19 = load i32, i32* @B230400
br label %24
20: ; preds = %1
%21 = load i32, i32* @B460800
br label %24
22: ; preds = %1
%23 = load i32, i32* @B921600
br label %24
24: ; preds = %1, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
%25 = phi i32 [ %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 %25
}