#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 */
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
int /*<<< orphan*/ B115200;
int /*<<< orphan*/ B19200;
int /*<<< orphan*/ B38400;
int /*<<< orphan*/ B4800;
int /*<<< orphan*/ B57600;
int /*<<< orphan*/ B9600;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
speed_t map_int_to_speed(int baud) {
  speed_t ret = 0;
  switch (baud) {
  case 4800:
    ret = B4800;
    break;
  case 9600:
    ret = B9600;
    break;
  case 19200:
    ret = B19200;
    break;
  case 38400:
    ret = B38400;
    break;
  case 57600:
    ret = B57600;
    break;
  case 115200:
    ret = B115200;
    break;
  default:
    fprintf(stderr, "Unsupport baud rate %d\n", baud);
    break;
  };
  return ret;
}


x86 assembly (clang, -O0):
<map_int_to_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x12c0,%eax
je     1197 <map_int_to_speed+0x87>
jmp    1138 <map_int_to_speed+0x28>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     11a8 <map_int_to_speed+0x98>
jmp    114b <map_int_to_speed+0x3b>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     11b9 <map_int_to_speed+0xa9>
jmp    115e <map_int_to_speed+0x4e>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     11ca <map_int_to_speed+0xba>
jmp    1171 <map_int_to_speed+0x61>
mov    -0xc(%rbp),%eax
sub    $0xe100,%eax
je     11db <map_int_to_speed+0xcb>
jmp    1184 <map_int_to_speed+0x74>
mov    -0xc(%rbp),%eax
sub    $0x1c200,%eax
je     11ec <map_int_to_speed+0xdc>
jmp    11fd <map_int_to_speed+0xed>
mov    0x2e42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1215 <map_int_to_speed+0x105>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1215 <map_int_to_speed+0x105>
mov    0x2e30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1215 <map_int_to_speed+0x105>
mov    0x2dd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1215 <map_int_to_speed+0x105>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1215 <map_int_to_speed+0x105>
mov    0x2dc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    1215 <map_int_to_speed+0x105>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xdf0(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_int_to_speed>:
push   %rax
mov    %edi,%edx
cmp    $0x95ff,%edi
jg     113c <map_int_to_speed+0x2c>
cmp    $0x12c0,%edx
je     115d <map_int_to_speed+0x4d>
cmp    $0x2580,%edx
je     1166 <map_int_to_speed+0x56>
cmp    $0x4b00,%edx
jne    1183 <map_int_to_speed+0x73>
mov    0x2eb6(%rip),%rax
jmp    117f <map_int_to_speed+0x6f>
cmp    $0x9600,%edx
je     116f <map_int_to_speed+0x5f>
cmp    $0xe100,%edx
je     1178 <map_int_to_speed+0x68>
cmp    $0x1c200,%edx
jne    1183 <map_int_to_speed+0x73>
mov    0x2e5d(%rip),%rax
jmp    117f <map_int_to_speed+0x6f>
mov    0x2e7c(%rip),%rax
jmp    117f <map_int_to_speed+0x6f>
mov    0x2e6b(%rip),%rax
jmp    117f <map_int_to_speed+0x6f>
mov    0x2e32(%rip),%rax
jmp    117f <map_int_to_speed+0x6f>
mov    0x2e51(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"Unsupport baud rate %d\0A\00"
define i32 @map_int_to_speed(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 %17 [
i32 4800, label %5
i32 9600, label %7
i32 19200, label %9
i32 38400, label %11
i32 57600, label %13
i32 115200, label %15
]
5: ; preds = %1
%6 = load i32, i32* @B4800
store i32 %6, i32* %3
br label %21
7: ; preds = %1
%8 = load i32, i32* @B9600
store i32 %8, i32* %3
br label %21
9: ; preds = %1
%10 = load i32, i32* @B19200
store i32 %10, i32* %3
br label %21
11: ; preds = %1
%12 = load i32, i32* @B38400
store i32 %12, i32* %3
br label %21
13: ; preds = %1
%14 = load i32, i32* @B57600
store i32 %14, i32* %3
br label %21
15: ; preds = %1
%16 = load i32, i32* @B115200
store i32 %16, i32* %3
br label %21
17: ; preds = %1
%18 = load i32, i32* @stderr
%19 = load i32, i32* %2
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %15, %13, %11, %9, %7, %5
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"Unsupport baud rate %d\0A\00"
define i32 @map_int_to_speed(i32 %0) {
switch i32 %0, label %14 [
i32 4800, label %2
i32 9600, label %4
i32 19200, label %6
i32 38400, label %8
i32 57600, label %10
i32 115200, label %12
]
2: ; preds = %1
%3 = load i32, i32* @B4800
br label %17
4: ; preds = %1
%5 = load i32, i32* @B9600
br label %17
6: ; preds = %1
%7 = load i32, i32* @B19200
br label %17
8: ; preds = %1
%9 = load i32, i32* @B38400
br label %17
10: ; preds = %1
%11 = load i32, i32* @B57600
br label %17
12: ; preds = %1
%13 = load i32, i32* @B115200
br label %17
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %17
17: ; preds = %14, %12, %10, %8, %6, %4, %2
%18 = phi i32 [ 0, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ]
ret i32 %18
}