#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 B19200;
int B38400;
int B9600;
int get_baud(int baud) {
  int s_baud = 0;
  switch (baud) {
  case 9600:
    s_baud = B9600;
    break;
  case 19200:
    s_baud = B19200;
    break;
  case 38400:
    s_baud = B38400;
    break;
  case 115200:
    s_baud = B115200;
    break;
  default:
    s_baud = B115200;
    break;
  }
  return s_baud;
}


x86 assembly (clang, -O0):
<get_baud>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2580,%eax
je     115d <get_baud+0x5d>
jmp    1124 <get_baud+0x24>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     116e <get_baud+0x6e>
jmp    1137 <get_baud+0x37>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     117f <get_baud+0x7f>
jmp    114a <get_baud+0x4a>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     1190 <get_baud+0x90>
jmp    11a1 <get_baud+0xa1>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <get_baud+0xad>
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <get_baud+0xad>
mov    0x2e3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <get_baud+0xad>
mov    0x2e39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    11ad <get_baud+0xad>
mov    0x2e28(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_baud>:
cmp    $0x95ff,%edi
jg     1122 <get_baud+0x22>
cmp    $0x2580,%edi
je     113a <get_baud+0x3a>
cmp    $0x4b00,%edi
jne    1130 <get_baud+0x30>
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
ret
cmp    $0x9600,%edi
je     1144 <get_baud+0x44>
cmp    $0x1c200,%edi
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
ret
mov    0x2e75(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B115200 = global i32 0
define i32 @get_baud(i32 %0) {
switch i32 %0, label %5 [
i32 9600, label %6
i32 19200, label %2
i32 38400, label %3
i32 115200, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i32* [ @B115200, %5 ], [ @B115200, %4 ], [ @B38400, %3 ], [ @B19200, %2 ], [ @B9600, %1 ]
%8 = load i32, i32* %7
ret i32 %8
}