#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 B9600;
int checkbaudrate(int baud) {
  switch (baud) {
  case 1200:
    baud = B1200;
    break;
  case 2400:
    baud = B2400;
    break;
  case 4800:
    baud = B4800;
    break;
  case 9600:
    baud = B9600;
    break;
  case 19200:
    baud = B19200;
    break;
  case 38400:
    baud = B38400;
    break;
  case 115200:
    baud = B115200;
    break;
  default:
    baud = B38400;
    break;
  }
  return baud;
}


x86 assembly (clang, -O0):
<checkbaudrate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x4b0,%eax
je     118f <checkbaudrate+0x8f>
jmp    111d <checkbaudrate+0x1d>
mov    -0x8(%rbp),%eax
sub    $0x960,%eax
je     11a0 <checkbaudrate+0xa0>
jmp    1130 <checkbaudrate+0x30>
mov    -0x8(%rbp),%eax
sub    $0x12c0,%eax
je     11b1 <checkbaudrate+0xb1>
jmp    1143 <checkbaudrate+0x43>
mov    -0x8(%rbp),%eax
sub    $0x2580,%eax
je     11c2 <checkbaudrate+0xc2>
jmp    1156 <checkbaudrate+0x56>
mov    -0x8(%rbp),%eax
sub    $0x4b00,%eax
je     11d3 <checkbaudrate+0xd3>
jmp    1169 <checkbaudrate+0x69>
mov    -0x8(%rbp),%eax
sub    $0x9600,%eax
je     11e4 <checkbaudrate+0xe4>
jmp    117c <checkbaudrate+0x7c>
mov    -0x8(%rbp),%eax
sub    $0x1c200,%eax
je     11f5 <checkbaudrate+0xf5>
jmp    1206 <checkbaudrate+0x106>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2e21(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2e28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2e0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2e16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2dbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2dbc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1212 <checkbaudrate+0x112>
mov    0x2d9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkbaudrate>:
cmp    $0x257f,%edi
jle    112a <checkbaudrate+0x2a>
cmp    $0x95ff,%edi
jg     114c <checkbaudrate+0x4c>
cmp    $0x2580,%edi
je     1170 <checkbaudrate+0x70>
cmp    $0x4b00,%edi
jne    1166 <checkbaudrate+0x66>
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x4b0,%edi
je     117a <checkbaudrate+0x7a>
cmp    $0x960,%edi
je     1184 <checkbaudrate+0x84>
cmp    $0x12c0,%edi
jne    1166 <checkbaudrate+0x66>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x9600,%edi
je     1166 <checkbaudrate+0x66>
cmp    $0x1c200,%edi
jne    1166 <checkbaudrate+0x66>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e3b(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e61(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e3d(%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
@B115200 = global i32 0
define i32 @checkbaudrate(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %18 [
i32 1200, label %4
i32 2400, label %6
i32 4800, label %8
i32 9600, label %10
i32 19200, label %12
i32 38400, label %14
i32 115200, label %16
]
4: ; preds = %1
%5 = load i32, i32* @B1200
store i32 %5, i32* %2
br label %20
6: ; preds = %1
%7 = load i32, i32* @B2400
store i32 %7, i32* %2
br label %20
8: ; preds = %1
%9 = load i32, i32* @B4800
store i32 %9, i32* %2
br label %20
10: ; preds = %1
%11 = load i32, i32* @B9600
store i32 %11, i32* %2
br label %20
12: ; preds = %1
%13 = load i32, i32* @B19200
store i32 %13, i32* %2
br label %20
14: ; preds = %1
%15 = load i32, i32* @B38400
store i32 %15, i32* %2
br label %20
16: ; preds = %1
%17 = load i32, i32* @B115200
store i32 %17, i32* %2
br label %20
18: ; preds = %1
%19 = load i32, i32* @B38400
store i32 %19, i32* %2
br label %20
20: ; preds = %18, %16, %14, %12, %10, %8, %6, %4
%21 = load i32, i32* %2
ret i32 %21
}

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