#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 B57600;
int B9600;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int baud_to_baud(int baud) {
  switch (baud) {
  case 1200:
  case 12:
    baud = B1200;
    break;
  case 2400:
  case 24:
    baud = B2400;
    break;
  case 9600:
  case 96:
    baud = B9600;
    break;
  case 19200:
  case 192:
  case 19:
    baud = B19200;
    break;
  case 0:
  case 38400:
  case 384:
  case 38:
    baud = B38400;
    break;
  case 57600:
  case 576:
  case 57:
    baud = B57600;
    break;
  case 115200:
  case 1152:
  case 115:
    baud = B115200;
    break;
  default:
    printf("Unsupported baud rate %d\n", baud);
    exit(1);
  }
  return baud;
}


x86 assembly (clang, -O0):
<baud_to_baud>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     12ca <baud_to_baud+0x1aa>
jmp    113e <baud_to_baud+0x1e>
mov    -0x8(%rbp),%eax
sub    $0xc,%eax
je     1286 <baud_to_baud+0x166>
jmp    114f <baud_to_baud+0x2f>
mov    -0x8(%rbp),%eax
sub    $0x13,%eax
je     12b9 <baud_to_baud+0x199>
jmp    1160 <baud_to_baud+0x40>
mov    -0x8(%rbp),%eax
sub    $0x18,%eax
je     1297 <baud_to_baud+0x177>
jmp    1171 <baud_to_baud+0x51>
mov    -0x8(%rbp),%eax
sub    $0x26,%eax
je     12ca <baud_to_baud+0x1aa>
jmp    1182 <baud_to_baud+0x62>
mov    -0x8(%rbp),%eax
sub    $0x39,%eax
je     12db <baud_to_baud+0x1bb>
jmp    1193 <baud_to_baud+0x73>
mov    -0x8(%rbp),%eax
sub    $0x60,%eax
je     12a8 <baud_to_baud+0x188>
jmp    11a4 <baud_to_baud+0x84>
mov    -0x8(%rbp),%eax
sub    $0x73,%eax
je     12ec <baud_to_baud+0x1cc>
jmp    11b5 <baud_to_baud+0x95>
mov    -0x8(%rbp),%eax
sub    $0xc0,%eax
je     12b9 <baud_to_baud+0x199>
jmp    11c8 <baud_to_baud+0xa8>
mov    -0x8(%rbp),%eax
sub    $0x180,%eax
je     12ca <baud_to_baud+0x1aa>
jmp    11db <baud_to_baud+0xbb>
mov    -0x8(%rbp),%eax
sub    $0x240,%eax
je     12db <baud_to_baud+0x1bb>
jmp    11ee <baud_to_baud+0xce>
mov    -0x8(%rbp),%eax
sub    $0x480,%eax
je     12ec <baud_to_baud+0x1cc>
jmp    1201 <baud_to_baud+0xe1>
mov    -0x8(%rbp),%eax
sub    $0x4b0,%eax
je     1286 <baud_to_baud+0x166>
jmp    1214 <baud_to_baud+0xf4>
mov    -0x8(%rbp),%eax
sub    $0x960,%eax
je     1297 <baud_to_baud+0x177>
jmp    1227 <baud_to_baud+0x107>
mov    -0x8(%rbp),%eax
sub    $0x2580,%eax
je     12a8 <baud_to_baud+0x188>
jmp    123a <baud_to_baud+0x11a>
mov    -0x8(%rbp),%eax
sub    $0x4b00,%eax
je     12b9 <baud_to_baud+0x199>
jmp    124d <baud_to_baud+0x12d>
mov    -0x8(%rbp),%eax
sub    $0x9600,%eax
je     12ca <baud_to_baud+0x1aa>
jmp    1260 <baud_to_baud+0x140>
mov    -0x8(%rbp),%eax
sub    $0xe100,%eax
je     12db <baud_to_baud+0x1bb>
jmp    1273 <baud_to_baud+0x153>
mov    -0x8(%rbp),%eax
sub    $0x1c200,%eax
je     12ec <baud_to_baud+0x1cc>
jmp    12fd <baud_to_baud+0x1dd>
mov    0x2d33(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    0x2d2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    0x2d30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    0x2cc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1316 <baud_to_baud+0x1f6>
mov    -0x4(%rbp),%esi
lea    0xcf9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baud_to_baud>:
push   %rax
mov    %edi,%esi
mov    0x2e96(%rip),%rax
cmp    $0x23f,%edi
jg     1152 <baud_to_baud+0x32>
cmp    $0x5f,%esi
jg     117f <baud_to_baud+0x5f>
cmp    $0x39,%esi
ja     121c <baud_to_baud+0xfc>
mov    %esi,%ecx
lea    0xeb7(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
cmp    $0x257f,%esi
jle    119a <baud_to_baud+0x7a>
cmp    $0x95ff,%esi
jle    11c4 <baud_to_baud+0xa4>
cmp    $0x9600,%esi
je     11e6 <baud_to_baud+0xc6>
cmp    $0xe100,%esi
je     11bb <baud_to_baud+0x9b>
cmp    $0x1c200,%esi
je     11b2 <baud_to_baud+0x92>
jmp    121c <baud_to_baud+0xfc>
cmp    $0xbf,%esi
jg     11d6 <baud_to_baud+0xb6>
cmp    $0x60,%esi
je     1211 <baud_to_baud+0xf1>
cmp    $0x73,%esi
je     11b2 <baud_to_baud+0x92>
jmp    121c <baud_to_baud+0xfc>
cmp    $0x4af,%esi
jg     11f8 <baud_to_baud+0xd8>
cmp    $0x240,%esi
je     11bb <baud_to_baud+0x9b>
cmp    $0x480,%esi
jne    121c <baud_to_baud+0xfc>
mov    0x2dff(%rip),%rax
jmp    1218 <baud_to_baud+0xf8>
mov    0x2e16(%rip),%rax
jmp    1218 <baud_to_baud+0xf8>
cmp    $0x2580,%esi
je     1211 <baud_to_baud+0xf1>
cmp    $0x4b00,%esi
je     11ef <baud_to_baud+0xcf>
jmp    121c <baud_to_baud+0xfc>
cmp    $0xc0,%esi
je     11ef <baud_to_baud+0xcf>
cmp    $0x180,%esi
jne    121c <baud_to_baud+0xfc>
mov    0x2dbb(%rip),%rax
jmp    1218 <baud_to_baud+0xf8>
mov    0x2dfa(%rip),%rax
jmp    1218 <baud_to_baud+0xf8>
cmp    $0x4b0,%esi
je     1218 <baud_to_baud+0xf8>
cmp    $0x960,%esi
jne    121c <baud_to_baud+0xfc>
mov    0x2db9(%rip),%rax
jmp    1218 <baud_to_baud+0xf8>
mov    0x2dc8(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@B1200 = global i32 0
@B2400 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@.str = [26 x i8] c"Unsupported baud rate %d\0A\00"
define i32 @baud_to_baud(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 12, label %4
i32 2400, label %6
i32 24, label %6
i32 9600, label %8
i32 96, label %8
i32 19200, label %10
i32 192, label %10
i32 19, label %10
i32 0, label %12
i32 38400, label %12
i32 384, label %12
i32 38, label %12
i32 57600, label %14
i32 576, label %14
i32 57, label %14
i32 115200, label %16
i32 1152, label %16
i32 115, label %16
]
4: ; preds = %1, %1
%5 = load i32, i32* @B1200
store i32 %5, i32* %2
br label %22
6: ; preds = %1, %1
%7 = load i32, i32* @B2400
store i32 %7, i32* %2
br label %22
8: ; preds = %1, %1
%9 = load i32, i32* @B9600
store i32 %9, i32* %2
br label %22
10: ; preds = %1, %1, %1
%11 = load i32, i32* @B19200
store i32 %11, i32* %2
br label %22
12: ; preds = %1, %1, %1, %1
%13 = load i32, i32* @B38400
store i32 %13, i32* %2
br label %22
14: ; preds = %1, %1, %1
%15 = load i32, i32* @B57600
store i32 %15, i32* %2
br label %22
16: ; preds = %1, %1, %1
%17 = load i32, i32* @B115200
store i32 %17, i32* %2
br label %22
18: ; preds = %1
%19 = load i32, i32* %2
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %19)
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %16, %14, %12, %10, %8, %6, %4
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@B1200 = global i32 0
@B2400 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@.str = [26 x i8] c"Unsupported baud rate %d\0A\00"
define i32 @baud_to_baud(i32 %0) {
switch i32 %0, label %8 [
i32 1200, label %11
i32 12, label %11
i32 2400, label %2
i32 24, label %2
i32 9600, label %3
i32 96, label %3
i32 19200, label %4
i32 192, label %4
i32 19, label %4
i32 0, label %5
i32 38400, label %5
i32 384, label %5
i32 38, label %5
i32 57600, label %6
i32 576, label %6
i32 57, label %6
i32 115200, label %7
i32 1152, label %7
i32 115, label %7
]
2: ; preds = %1, %1
br label %11
3: ; preds = %1, %1
br label %11
4: ; preds = %1, %1, %1
br label %11
5: ; preds = %1, %1, %1, %1
br label %11
6: ; preds = %1, %1, %1
br label %11
7: ; preds = %1, %1, %1
br label %11
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %1, %1, %7, %6, %5, %4, %3, %2
%12 = phi i32* [ @B115200, %7 ], [ @B57600, %6 ], [ @B38400, %5 ], [ @B19200, %4 ], [ @B9600, %3 ], [ @B2400, %2 ], [ @B1200, %1 ], [ @B1200, %1 ]
%13 = load i32, i32* %12
ret i32 %13
}