#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*/ B1200;
int /*<<< orphan*/ B19200;
int /*<<< orphan*/ B2400;
int /*<<< orphan*/ B38400;
int /*<<< orphan*/ B4800;
int /*<<< orphan*/ B9600;
int /*<<< orphan*/ fatal(char *, unsigned int);
speed_t mkspeed(unsigned br) {
  switch (br) {
  case 1200:
    return B1200;
  case 2400:
    return B2400;
  case 4800:
    return B4800;
  case 9600:
    return B9600;
  case 19200:
    return B19200;
  case 38400:
    return B38400;
  default:
    fatal("Unsupported serial speed: %d\n", br);
    return 0;
  }
}


x86 assembly (clang, -O0):
<mkspeed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x4b0,%eax
je     1190 <mkspeed+0x80>
jmp    1131 <mkspeed+0x21>
mov    -0xc(%rbp),%eax
sub    $0x960,%eax
je     11a1 <mkspeed+0x91>
jmp    1144 <mkspeed+0x34>
mov    -0xc(%rbp),%eax
sub    $0x12c0,%eax
je     11b2 <mkspeed+0xa2>
jmp    1157 <mkspeed+0x47>
mov    -0xc(%rbp),%eax
sub    $0x2580,%eax
je     11c3 <mkspeed+0xb3>
jmp    116a <mkspeed+0x5a>
mov    -0xc(%rbp),%eax
sub    $0x4b00,%eax
je     11d4 <mkspeed+0xc4>
jmp    117d <mkspeed+0x6d>
mov    -0xc(%rbp),%eax
sub    $0x9600,%eax
je     11e5 <mkspeed+0xd5>
jmp    11f6 <mkspeed+0xe6>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <mkspeed+0xfc>
mov    0x2e20(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <mkspeed+0xfc>
mov    0x2e27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <mkspeed+0xfc>
mov    0x2e0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <mkspeed+0xfc>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <mkspeed+0xfc>
mov    0x2dc4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    120c <mkspeed+0xfc>
mov    -0x8(%rbp),%esi
lea    0xe00(%rip),%rdi
call   1030 <fatal@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkspeed>:
push   %rax
mov    %edi,%esi
cmp    $0x257f,%edi
jg     113c <mkspeed+0x2c>
cmp    $0x4b0,%esi
je     115d <mkspeed+0x4d>
cmp    $0x960,%esi
je     1166 <mkspeed+0x56>
cmp    $0x12c0,%esi
jne    1183 <mkspeed+0x73>
mov    0x2ea6(%rip),%rax
jmp    117f <mkspeed+0x6f>
cmp    $0x2580,%esi
je     116f <mkspeed+0x5f>
cmp    $0x4b00,%esi
je     1178 <mkspeed+0x68>
cmp    $0x9600,%esi
jne    1183 <mkspeed+0x73>
mov    0x2e55(%rip),%rax
jmp    117f <mkspeed+0x6f>
mov    0x2e5c(%rip),%rax
jmp    117f <mkspeed+0x6f>
mov    0x2e5b(%rip),%rax
jmp    117f <mkspeed+0x6f>
mov    0x2e62(%rip),%rax
jmp    117f <mkspeed+0x6f>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
lea    0xe76(%rip),%rdi
call   1030 <fatal@plt>
xor    %eax,%eax
pop    %rcx
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
@.str = [30 x i8] c"Unsupported serial speed: %d\0A\00"
define i32 @mkspeed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %17 [
i32 1200, label %5
i32 2400, label %7
i32 4800, label %9
i32 9600, label %11
i32 19200, label %13
i32 38400, label %15
]
5: ; preds = %1
%6 = load i32, i32* @B1200
store i32 %6, i32* %2
br label %20
7: ; preds = %1
%8 = load i32, i32* @B2400
store i32 %8, i32* %2
br label %20
9: ; preds = %1
%10 = load i32, i32* @B4800
store i32 %10, i32* %2
br label %20
11: ; preds = %1
%12 = load i32, i32* @B9600
store i32 %12, i32* %2
br label %20
13: ; preds = %1
%14 = load i32, i32* @B19200
store i32 %14, i32* %2
br label %20
15: ; preds = %1
%16 = load i32, i32* @B38400
store i32 %16, i32* %2
br label %20
17: ; preds = %1
%18 = load i32, i32* %3
%19 = call i32 @fatal(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %18)
store i32 0, i32* %2
br label %20
20: ; preds = %17, %15, %13, %11, %9, %7, %5
%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
@.str = [30 x i8] c"Unsupported serial speed: %d\0A\00"
define i32 @mkspeed(i32 %0) {
switch i32 %0, label %14 [
i32 1200, label %2
i32 2400, label %4
i32 4800, label %6
i32 9600, label %8
i32 19200, label %10
i32 38400, label %12
]
2: ; preds = %1
%3 = load i32, i32* @B1200
br label %16
4: ; preds = %1
%5 = load i32, i32* @B2400
br label %16
6: ; preds = %1
%7 = load i32, i32* @B4800
br label %16
8: ; preds = %1
%9 = load i32, i32* @B9600
br label %16
10: ; preds = %1
%11 = load i32, i32* @B19200
br label %16
12: ; preds = %1
%13 = load i32, i32* @B38400
br label %16
14: ; preds = %1
%15 = tail call i32 @fatal(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %16
16: ; preds = %14, %12, %10, %8, %6, %4, %2
%17 = phi i32 [ 0, %14 ], [ %13, %12 ], [ %11, %10 ], [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ %3, %2 ]
ret i32 %17
}