#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 */
struct termios {
  int c_cflag;
};

/* Variables and functions */
int B110;
int B115200;
int B1200;
int B134;
int B150;
int B1800;
int B19200;
int B200;
int B230400;
int B2400;
int B300;
int B38400;
int B4800;
int B50;
int B57600;
int B600;
int B75;
int B9600;
int CBAUD;
int set_baud_rate(struct termios *t, int rate) {
  int i;
  switch (rate) {
  case 50:
    i = B50;
    break;
  case 75:
    i = B75;
    break;
  case 110:
    i = B110;
    break;
  case 134:
    i = B134;
    break;
  case 150:
    i = B150;
    break;
  case 200:
    i = B200;
    break;
  case 300:
    i = B300;
    break;
  case 600:
    i = B600;
    break;
  case 1200:
    i = B1200;
    break;
  case 1800:
    i = B1800;
    break;
  case 2400:
    i = B2400;
    break;
  case 4800:
    i = B4800;
    break;
  case 9600:
    i = B9600;
    break;
  case 19200:
    i = B19200;
    break;
  case 38400:
    i = B38400;
    break;
  case 57600:
    i = B57600;
    break;
  case 115200:
    i = B115200;
    break;
  case 230400:
    i = B230400;
    break;
  default:
    return -1;
  }
  t->c_cflag = (t->c_cflag & ~CBAUD) | i;
  return 0;
}


x86 assembly (clang, -O0):
<set_baud_rate>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x32,%eax
je     125e <set_baud_rate+0x15e>
jmp    111f <set_baud_rate+0x1f>
mov    -0x1c(%rbp),%eax
sub    $0x4b,%eax
je     126f <set_baud_rate+0x16f>
jmp    1130 <set_baud_rate+0x30>
mov    -0x1c(%rbp),%eax
sub    $0x6e,%eax
je     1280 <set_baud_rate+0x180>
jmp    1141 <set_baud_rate+0x41>
mov    -0x1c(%rbp),%eax
sub    $0x86,%eax
je     1291 <set_baud_rate+0x191>
jmp    1154 <set_baud_rate+0x54>
mov    -0x1c(%rbp),%eax
sub    $0x96,%eax
je     12a2 <set_baud_rate+0x1a2>
jmp    1167 <set_baud_rate+0x67>
mov    -0x1c(%rbp),%eax
sub    $0xc8,%eax
je     12b3 <set_baud_rate+0x1b3>
jmp    117a <set_baud_rate+0x7a>
mov    -0x1c(%rbp),%eax
sub    $0x12c,%eax
je     12c4 <set_baud_rate+0x1c4>
jmp    118d <set_baud_rate+0x8d>
mov    -0x1c(%rbp),%eax
sub    $0x258,%eax
je     12d5 <set_baud_rate+0x1d5>
jmp    11a0 <set_baud_rate+0xa0>
mov    -0x1c(%rbp),%eax
sub    $0x4b0,%eax
je     12e6 <set_baud_rate+0x1e6>
jmp    11b3 <set_baud_rate+0xb3>
mov    -0x1c(%rbp),%eax
sub    $0x708,%eax
je     12f7 <set_baud_rate+0x1f7>
jmp    11c6 <set_baud_rate+0xc6>
mov    -0x1c(%rbp),%eax
sub    $0x960,%eax
je     1308 <set_baud_rate+0x208>
jmp    11d9 <set_baud_rate+0xd9>
mov    -0x1c(%rbp),%eax
sub    $0x12c0,%eax
je     1319 <set_baud_rate+0x219>
jmp    11ec <set_baud_rate+0xec>
mov    -0x1c(%rbp),%eax
sub    $0x2580,%eax
je     132a <set_baud_rate+0x22a>
jmp    11ff <set_baud_rate+0xff>
mov    -0x1c(%rbp),%eax
sub    $0x4b00,%eax
je     133b <set_baud_rate+0x23b>
jmp    1212 <set_baud_rate+0x112>
mov    -0x1c(%rbp),%eax
sub    $0x9600,%eax
je     134c <set_baud_rate+0x24c>
jmp    1225 <set_baud_rate+0x125>
mov    -0x1c(%rbp),%eax
sub    $0xe100,%eax
je     135d <set_baud_rate+0x25d>
jmp    1238 <set_baud_rate+0x138>
mov    -0x1c(%rbp),%eax
sub    $0x1c200,%eax
je     136e <set_baud_rate+0x26e>
jmp    124b <set_baud_rate+0x14b>
mov    -0x1c(%rbp),%eax
sub    $0x38400,%eax
je     137f <set_baud_rate+0x27f>
jmp    1390 <set_baud_rate+0x290>
mov    0x2d43(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2d62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2d59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2d30(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2ccf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2ce5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2cf4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2c83(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2c8a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2c71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2ca0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2c87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2cae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2bf5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2c34(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2bf3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
mov    0x2bca(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
jmp    139c <set_baud_rate+0x29c>
movl   $0xffffffff,-0x4(%rbp)
jmp    13c0 <set_baud_rate+0x2c0>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    0x2baf(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%ecx
or     -0x18(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_baud_rate>:
mov    $0xffffffff,%eax
cmp    $0x707,%esi
jg     1155 <set_baud_rate+0x55>
cmp    $0x95,%esi
jle    1199 <set_baud_rate+0x99>
cmp    $0x12b,%esi
jle    11f0 <set_baud_rate+0xf0>
cmp    $0x12c,%esi
je     126b <set_baud_rate+0x16b>
cmp    $0x258,%esi
je     1274 <set_baud_rate+0x174>
cmp    $0x4b0,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2e20(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x4aff,%esi
jle    11c0 <set_baud_rate+0xc0>
cmp    $0xe0ff,%esi
jle    1214 <set_baud_rate+0x114>
cmp    $0xe100,%esi
je     127d <set_baud_rate+0x17d>
cmp    $0x1c200,%esi
je     1286 <set_baud_rate+0x186>
cmp    $0x38400,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2dbc(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x6d,%esi
jg     1238 <set_baud_rate+0x138>
cmp    $0x32,%esi
je     128f <set_baud_rate+0x18f>
cmp    $0x4b,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2e1d(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x12bf,%esi
jg     1252 <set_baud_rate+0x152>
cmp    $0x708,%esi
je     1298 <set_baud_rate+0x198>
cmp    $0x960,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2d95(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x96,%esi
je     12a1 <set_baud_rate+0x1a1>
cmp    $0xc8,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2d91(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x4b00,%esi
je     12aa <set_baud_rate+0x1aa>
cmp    $0x9600,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2d15(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x6e,%esi
je     12b3 <set_baud_rate+0x1b3>
cmp    $0x86,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2d78(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
cmp    $0x12c0,%esi
je     12bc <set_baud_rate+0x1bc>
cmp    $0x2580,%esi
jne    12d6 <set_baud_rate+0x1d6>
mov    0x2d4f(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2d3e(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2d55(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2d14(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2cdb(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2d12(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2ce9(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2cd0(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2d3f(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2d26(%rip),%rax
jmp    12c3 <set_baud_rate+0x1c3>
mov    0x2cfd(%rip),%rax
mov    0x2c8e(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    (%rdi),%ecx
or     (%rax),%ecx
mov    %ecx,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@B50 = global i32 0
@B75 = global i32 0
@B110 = global i32 0
@B134 = global i32 0
@B150 = global i32 0
@B200 = global i32 0
@B300 = global i32 0
@B600 = global i32 0
@B1200 = global i32 0
@B1800 = global i32 0
@B2400 = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@CBAUD = global i32 0
define i32 @set_baud_rate(%struct.termios* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.termios*
%5 = alloca i32
%6 = alloca i32
store %struct.termios* %0, %struct.termios** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
switch i32 %7, label %44 [
i32 50, label %8
i32 75, label %10
i32 110, label %12
i32 134, label %14
i32 150, label %16
i32 200, label %18
i32 300, label %20
i32 600, label %22
i32 1200, label %24
i32 1800, label %26
i32 2400, label %28
i32 4800, label %30
i32 9600, label %32
i32 19200, label %34
i32 38400, label %36
i32 57600, label %38
i32 115200, label %40
i32 230400, label %42
]
8: ; preds = %2
%9 = load i32, i32* @B50
store i32 %9, i32* %6
br label %45
10: ; preds = %2
%11 = load i32, i32* @B75
store i32 %11, i32* %6
br label %45
12: ; preds = %2
%13 = load i32, i32* @B110
store i32 %13, i32* %6
br label %45
14: ; preds = %2
%15 = load i32, i32* @B134
store i32 %15, i32* %6
br label %45
16: ; preds = %2
%17 = load i32, i32* @B150
store i32 %17, i32* %6
br label %45
18: ; preds = %2
%19 = load i32, i32* @B200
store i32 %19, i32* %6
br label %45
20: ; preds = %2
%21 = load i32, i32* @B300
store i32 %21, i32* %6
br label %45
22: ; preds = %2
%23 = load i32, i32* @B600
store i32 %23, i32* %6
br label %45
24: ; preds = %2
%25 = load i32, i32* @B1200
store i32 %25, i32* %6
br label %45
26: ; preds = %2
%27 = load i32, i32* @B1800
store i32 %27, i32* %6
br label %45
28: ; preds = %2
%29 = load i32, i32* @B2400
store i32 %29, i32* %6
br label %45
30: ; preds = %2
%31 = load i32, i32* @B4800
store i32 %31, i32* %6
br label %45
32: ; preds = %2
%33 = load i32, i32* @B9600
store i32 %33, i32* %6
br label %45
34: ; preds = %2
%35 = load i32, i32* @B19200
store i32 %35, i32* %6
br label %45
36: ; preds = %2
%37 = load i32, i32* @B38400
store i32 %37, i32* %6
br label %45
38: ; preds = %2
%39 = load i32, i32* @B57600
store i32 %39, i32* %6
br label %45
40: ; preds = %2
%41 = load i32, i32* @B115200
store i32 %41, i32* %6
br label %45
42: ; preds = %2
%43 = load i32, i32* @B230400
store i32 %43, i32* %6
br label %45
44: ; preds = %2
store i32 -1, i32* %3
br label %56
45: ; preds = %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8
%46 = load %struct.termios*, %struct.termios** %4
%47 = getelementptr inbounds %struct.termios, %struct.termios* %46, i32 0, i32 0
%48 = load i32, i32* %47
%49 = load i32, i32* @CBAUD
%50 = xor i32 %49, -1
%51 = and i32 %48, %50
%52 = load i32, i32* %6
%53 = or i32 %51, %52
%54 = load %struct.termios*, %struct.termios** %4
%55 = getelementptr inbounds %struct.termios, %struct.termios* %54, i32 0, i32 0
store i32 %53, i32* %55
store i32 0, i32* %3
br label %56
56: ; preds = %45, %44
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@B50 = global i32 0
@B75 = global i32 0
@B110 = global i32 0
@B134 = global i32 0
@B150 = global i32 0
@B200 = global i32 0
@B300 = global i32 0
@B600 = global i32 0
@B1200 = global i32 0
@B1800 = global i32 0
@B2400 = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@CBAUD = global i32 0
define i32 @set_baud_rate(%struct.termios* nocapture %0, i32 %1) {
switch i32 %1, label %29 [
i32 50, label %20
i32 75, label %3
i32 110, label %4
i32 134, label %5
i32 150, label %6
i32 200, label %7
i32 300, label %8
i32 600, label %9
i32 1200, label %10
i32 1800, label %11
i32 2400, label %12
i32 4800, label %13
i32 9600, label %14
i32 19200, label %15
i32 38400, label %16
i32 57600, label %17
i32 115200, label %18
i32 230400, label %19
]
3: ; preds = %2
br label %20
4: ; preds = %2
br label %20
5: ; preds = %2
br label %20
6: ; preds = %2
br label %20
7: ; preds = %2
br label %20
8: ; preds = %2
br label %20
9: ; preds = %2
br label %20
10: ; preds = %2
br label %20
11: ; preds = %2
br label %20
12: ; preds = %2
br label %20
13: ; preds = %2
br label %20
14: ; preds = %2
br label %20
15: ; preds = %2
br label %20
16: ; preds = %2
br label %20
17: ; preds = %2
br label %20
18: ; preds = %2
br label %20
19: ; preds = %2
br label %20
20: ; preds = %2, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%21 = phi i32* [ @B230400, %19 ], [ @B115200, %18 ], [ @B57600, %17 ], [ @B38400, %16 ], [ @B19200, %15 ], [ @B9600, %14 ], [ @B4800, %13 ], [ @B2400, %12 ], [ @B1800, %11 ], [ @B1200, %10 ], [ @B600, %9 ], [ @B300, %8 ], [ @B200, %7 ], [ @B150, %6 ], [ @B134, %5 ], [ @B110, %4 ], [ @B75, %3 ], [ @B50, %2 ]
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%24 = load i32, i32* %23
%25 = load i32, i32* @CBAUD
%26 = xor i32 %25, -1
%27 = and i32 %24, %26
%28 = or i32 %27, %22
store i32 %28, i32* %23
br label %29
29: ; preds = %2, %20
%30 = phi i32 [ 0, %20 ], [ -1, %2 ]
ret i32 %30
}