#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*/ tty;
struct termios {
  int c_iflag;
  int c_lflag;
  int c_cflag;
  int *c_cc;
  scalar_t__ c_oflag;
};
typedef int speed_t;

/* Variables and functions */
int B115200;
int B19200;
int B230400;
int B2400;
int B4800;
int B57600;
int B9600;
int BRKINT;
int CS8;
int CSIZE;
int ECHO;
int ECHONL;
int ICANON;
int ICRNL;
int IEXTEN;
int IGNBRK;
int INLCR;
int INPCK;
int ISIG;
int ISTRIP;
int IXON;
int O_NDELAY;
int O_NOCTTY;
int O_RDWR;
int PARENB;
int PARMRK;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
scalar_t__ cfsetispeed(struct termios *, int);
scalar_t__ cfsetospeed(struct termios *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ memset(struct termios *, int /*<<< orphan*/, int);
int open(char const *, int);
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int rs232_open(const char *path, unsigned long baud_rate) {
  struct termios tty;
  speed_t speed;
  int fd;
  switch (baud_rate) {
  case 2400L:
    speed = B2400;
    break;
  case 4800L:
    speed = B4800;
    break;
  case 9600L:
    speed = B9600;
    break;
  case 19200L:
    speed = B19200;
    break;
  case 57600L:
    speed = B57600;
    break;
  case 115200L:
    speed = B115200;
    break;
  case 230400L:
    speed = B230400;
    break;
  case 460800L:
    speed = 460800;
    break;
  case 500000L:
    speed = 500000L;
    break;
  case 1000000L:
    speed = 1000000L;
    break;
  default:
    return -1;
  }
  fd = open(path, O_RDWR | O_NOCTTY | O_NDELAY);
  if (fd < 0)
    return -1;
  memset(&tty, 0, sizeof(tty));
  if (tcgetattr(fd, &tty) != 0)
    goto fail;
  tty.c_iflag &=
      ~(IGNBRK | BRKINT | ICRNL | INLCR | PARMRK | INPCK | ISTRIP | IXON);
  tty.c_oflag = 0;
  tty.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
  tty.c_cflag &= ~(CSIZE | PARENB);
  tty.c_cflag |= CS8;
  tty.c_cc[VMIN] = 1;
  tty.c_cc[VTIME] = 2;
  if (cfsetospeed(&tty, speed) < 0 || cfsetispeed(&tty, speed) < 0)
    goto fail;
  if (tcsetattr(fd, TCSANOW, &tty) != 0)
    goto fail;
  return fd;
fail:
  close(fd);
  return -1;
}


x86 assembly (clang, -O0):
<rs232_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
sub    $0x960,%rax
je     1256 <rs232_open+0xe6>
jmp    1199 <rs232_open+0x29>
mov    -0x48(%rbp),%rax
sub    $0x12c0,%rax
je     1267 <rs232_open+0xf7>
jmp    11ae <rs232_open+0x3e>
mov    -0x48(%rbp),%rax
sub    $0x2580,%rax
je     1278 <rs232_open+0x108>
jmp    11c3 <rs232_open+0x53>
mov    -0x48(%rbp),%rax
sub    $0x4b00,%rax
je     1289 <rs232_open+0x119>
jmp    11d8 <rs232_open+0x68>
mov    -0x48(%rbp),%rax
sub    $0xe100,%rax
je     129a <rs232_open+0x12a>
jmp    11ed <rs232_open+0x7d>
mov    -0x48(%rbp),%rax
sub    $0x1c200,%rax
je     12ab <rs232_open+0x13b>
jmp    1202 <rs232_open+0x92>
mov    -0x48(%rbp),%rax
sub    $0x38400,%rax
je     12bc <rs232_open+0x14c>
jmp    1217 <rs232_open+0xa7>
mov    -0x48(%rbp),%rax
sub    $0x70800,%rax
je     12cd <rs232_open+0x15d>
jmp    122c <rs232_open+0xbc>
mov    -0x48(%rbp),%rax
sub    $0x7a120,%rax
je     12d9 <rs232_open+0x169>
jmp    1241 <rs232_open+0xd1>
mov    -0x48(%rbp),%rax
sub    $0xf4240,%rax
je     12e5 <rs232_open+0x175>
jmp    12f1 <rs232_open+0x181>
mov    0x2ceb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
mov    0x2d2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
mov    0x2d11(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
mov    0x2d60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
mov    0x2cc7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
mov    0x2c66(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
mov    0x2c35(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
movl   $0x70800,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
movl   $0x7a120,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
movl   $0xf4240,-0x3c(%rbp)
jmp    12fd <rs232_open+0x18d>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <rs232_open+0x347>
mov    -0x10(%rbp),%rdi
mov    0x2cd0(%rip),%rax
mov    (%rax),%esi
mov    0x2c3f(%rip),%rax
or     (%rax),%esi
mov    0x2c1e(%rip),%rax
or     (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jge    133a <rs232_open+0x1ca>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b7 <rs232_open+0x347>
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    -0x40(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1060 <tcgetattr@plt>
cmp    $0x0,%rax
je     1365 <rs232_open+0x1f5>
jmp    14a8 <rs232_open+0x338>
mov    0x2bb4(%rip),%rax
mov    (%rax),%eax
mov    0x2c13(%rip),%rcx
or     (%rcx),%eax
mov    0x2c52(%rip),%rcx
or     (%rcx),%eax
mov    0x2c41(%rip),%rcx
or     (%rcx),%eax
mov    0x2c58(%rip),%rcx
or     (%rcx),%eax
mov    0x2ba7(%rip),%rcx
or     (%rcx),%eax
mov    0x2b8e(%rip),%rcx
or     (%rcx),%eax
mov    0x2c15(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2be3(%rip),%rax
mov    (%rax),%eax
mov    0x2b5a(%rip),%rcx
or     (%rcx),%eax
mov    0x2b31(%rip),%rcx
or     (%rcx),%eax
mov    0x2b80(%rip),%rcx
or     (%rcx),%eax
mov    0x2bb7(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    0x2b75(%rip),%rax
mov    (%rax),%eax
mov    0x2bb4(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2b6a(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2b4f(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    0x2ad2(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
mov    -0x3c(%rbp),%esi
lea    -0x38(%rbp),%rdi
call   1030 <cfsetospeed@plt>
cmp    $0x0,%rax
jl     1474 <rs232_open+0x304>
mov    -0x3c(%rbp),%esi
lea    -0x38(%rbp),%rdi
call   1090 <cfsetispeed@plt>
cmp    $0x0,%rax
jge    1479 <rs232_open+0x309>
jmp    14a8 <rs232_open+0x338>
mov    -0x40(%rbp),%edi
mov    0x2b2d(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1070 <tcsetattr@plt>
cmp    $0x0,%rax
je     149d <rs232_open+0x32d>
jmp    14a8 <rs232_open+0x338>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    14b7 <rs232_open+0x347>
mov    -0x40(%rbp),%edi
call   1050 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rs232_open>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    $0xffffffff,%r14d
cmp    $0x1c1ff,%rsi
jg     11c5 <rs232_open+0x55>
cmp    $0x257f,%rsi
jle    11f5 <rs232_open+0x85>
cmp    $0x2580,%rsi
je     1233 <rs232_open+0xc3>
cmp    $0x4b00,%rsi
je     123c <rs232_open+0xcc>
cmp    $0xe100,%rsi
jne    12b8 <rs232_open+0x148>
mov    0x2da8(%rip),%rax
jmp    1265 <rs232_open+0xf5>
cmp    $0x707ff,%rsi
jle    1214 <rs232_open+0xa4>
cmp    $0x70800,%rsi
je     1245 <rs232_open+0xd5>
cmp    $0x7a120,%rsi
je     124d <rs232_open+0xdd>
cmp    $0xf4240,%rsi
jne    12b8 <rs232_open+0x148>
mov    $0xf4240,%r15d
jmp    1268 <rs232_open+0xf8>
cmp    $0x960,%rsi
je     1255 <rs232_open+0xe5>
cmp    $0x12c0,%rsi
jne    12b8 <rs232_open+0x148>
mov    0x2d86(%rip),%rax
jmp    1265 <rs232_open+0xf5>
cmp    $0x1c200,%rsi
je     125e <rs232_open+0xee>
cmp    $0x38400,%rsi
jne    12b8 <rs232_open+0x148>
mov    0x2cc7(%rip),%rax
jmp    1265 <rs232_open+0xf5>
mov    0x2d56(%rip),%rax
jmp    1265 <rs232_open+0xf5>
mov    0x2dad(%rip),%rax
jmp    1265 <rs232_open+0xf5>
mov    $0x70800,%r15d
jmp    1268 <rs232_open+0xf8>
mov    $0x7a120,%r15d
jmp    1268 <rs232_open+0xf8>
mov    0x2cec(%rip),%rax
jmp    1265 <rs232_open+0xf5>
mov    0x2cb3(%rip),%rax
mov    (%rax),%r15d
mov    0x2d69(%rip),%rax
mov    0x2cda(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2cb7(%rip),%rax
or     (%rax),%esi
call   1080 <open@plt>
test   %eax,%eax
js     12b8 <rs232_open+0x148>
mov    %eax,%ebx
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1040 <memset@plt>
mov    %ebx,%edi
mov    %rbp,%rsi
call   1060 <tcgetattr@plt>
test   %rax,%rax
je     12c6 <rs232_open+0x156>
mov    %ebx,%edi
call   1050 <close@plt>
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c53(%rip),%rax
mov    0x2cb4(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2cf1(%rip),%rax
or     (%rax),%ecx
mov    0x2ce0(%rip),%rax
or     (%rax),%ecx
mov    0x2cf7(%rip),%rax
or     (%rax),%ecx
mov    0x2c46(%rip),%rax
or     (%rax),%ecx
mov    0x2c2d(%rip),%rax
or     (%rax),%ecx
mov    0x2cb4(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x8(%rsp)
mov    0x2c8d(%rip),%rax
mov    0x2c06(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2bdb(%rip),%rax
or     (%rax),%ecx
movq   $0x0,0x20(%rsp)
mov    0x2c21(%rip),%rax
or     (%rax),%ecx
mov    0x2c58(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0xc(%rsp)
mov    0x2c19(%rip),%rax
mov    0x2c5a(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
not    %ecx
and    0x10(%rsp),%ecx
mov    0x2c11(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x10(%rsp)
mov    0x18(%rsp),%rax
mov    0x2bf7(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2b7e(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x2,(%rax,%rcx,4)
lea    0x8(%rsp),%rdi
mov    %r15d,%esi
call   1030 <cfsetospeed@plt>
test   %rax,%rax
js     12b1 <rs232_open+0x141>
lea    0x8(%rsp),%rdi
mov    %r15d,%esi
call   1090 <cfsetispeed@plt>
test   %rax,%rax
js     12b1 <rs232_open+0x141>
mov    0x2be1(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <tcsetattr@plt>
test   %rax,%rax
jne    12b1 <rs232_open+0x141>
mov    %ebx,%r14d
jmp    12b8 <rs232_open+0x148>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i32*, i64 }
@B2400 = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
@IGNBRK = global i32 0
@BRKINT = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@PARMRK = global i32 0
@INPCK = global i32 0
@ISTRIP = global i32 0
@IXON = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@ICANON = global i32 0
@IEXTEN = global i32 0
@ISIG = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
define i32 @rs232_open(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca %struct.termios
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
%9 = load i64, i64* %5
switch i64 %9, label %27 [
i64 2400, label %10
i64 4800, label %12
i64 9600, label %14
i64 19200, label %16
i64 57600, label %18
i64 115200, label %20
i64 230400, label %22
i64 460800, label %24
i64 500000, label %25
i64 1000000, label %26
]
10: ; preds = %2
%11 = load i32, i32* @B2400
store i32 %11, i32* %7
br label %28
12: ; preds = %2
%13 = load i32, i32* @B4800
store i32 %13, i32* %7
br label %28
14: ; preds = %2
%15 = load i32, i32* @B9600
store i32 %15, i32* %7
br label %28
16: ; preds = %2
%17 = load i32, i32* @B19200
store i32 %17, i32* %7
br label %28
18: ; preds = %2
%19 = load i32, i32* @B57600
store i32 %19, i32* %7
br label %28
20: ; preds = %2
%21 = load i32, i32* @B115200
store i32 %21, i32* %7
br label %28
22: ; preds = %2
%23 = load i32, i32* @B230400
store i32 %23, i32* %7
br label %28
24: ; preds = %2
store i32 460800, i32* %7
br label %28
25: ; preds = %2
store i32 500000, i32* %7
br label %28
26: ; preds = %2
store i32 1000000, i32* %7
br label %28
27: ; preds = %2
store i32 -1, i32* %3
br label %117
28: ; preds = %26, %25, %24, %22, %20, %18, %16, %14, %12, %10
%29 = load i8*, i8** %4
%30 = load i32, i32* @O_RDWR
%31 = load i32, i32* @O_NOCTTY
%32 = or i32 %30, %31
%33 = load i32, i32* @O_NDELAY
%34 = or i32 %32, %33
%35 = call i32 @open(i8* %29, i32 %34)
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %28
store i32 -1, i32* %3
br label %117
39: ; preds = %28
%40 = call i32 @memset(%struct.termios* %6, i32 0, i32 32)
%41 = load i32, i32* %8
%42 = call i64 @tcgetattr(i32 %41, %struct.termios* %6)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %39
br label %114
45: ; preds = %39
%46 = load i32, i32* @IGNBRK
%47 = load i32, i32* @BRKINT
%48 = or i32 %46, %47
%49 = load i32, i32* @ICRNL
%50 = or i32 %48, %49
%51 = load i32, i32* @INLCR
%52 = or i32 %50, %51
%53 = load i32, i32* @PARMRK
%54 = or i32 %52, %53
%55 = load i32, i32* @INPCK
%56 = or i32 %54, %55
%57 = load i32, i32* @ISTRIP
%58 = or i32 %56, %57
%59 = load i32, i32* @IXON
%60 = or i32 %58, %59
%61 = xor i32 %60, -1
%62 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
%63 = load i32, i32* %62
%64 = and i32 %63, %61
store i32 %64, i32* %62
%65 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 4
store i64 0, i64* %65
%66 = load i32, i32* @ECHO
%67 = load i32, i32* @ECHONL
%68 = or i32 %66, %67
%69 = load i32, i32* @ICANON
%70 = or i32 %68, %69
%71 = load i32, i32* @IEXTEN
%72 = or i32 %70, %71
%73 = load i32, i32* @ISIG
%74 = or i32 %72, %73
%75 = xor i32 %74, -1
%76 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 1
%77 = load i32, i32* %76
%78 = and i32 %77, %75
store i32 %78, i32* %76
%79 = load i32, i32* @CSIZE
%80 = load i32, i32* @PARENB
%81 = or i32 %79, %80
%82 = xor i32 %81, -1
%83 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 2
%84 = load i32, i32* %83
%85 = and i32 %84, %82
store i32 %85, i32* %83
%86 = load i32, i32* @CS8
%87 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 2
%88 = load i32, i32* %87
%89 = or i32 %88, %86
store i32 %89, i32* %87
%90 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 3
%91 = load i32*, i32** %90
%92 = load i64, i64* @VMIN
%93 = getelementptr inbounds i32, i32* %91, i64 %92
store i32 1, i32* %93
%94 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 3
%95 = load i32*, i32** %94
%96 = load i64, i64* @VTIME
%97 = getelementptr inbounds i32, i32* %95, i64 %96
store i32 2, i32* %97
%98 = load i32, i32* %7
%99 = call i64 @cfsetospeed(%struct.termios* %6, i32 %98)
%100 = icmp slt i64 %99, 0
br i1 %100, label %105, label %101
101: ; preds = %45
%102 = load i32, i32* %7
%103 = call i64 @cfsetispeed(%struct.termios* %6, i32 %102)
%104 = icmp slt i64 %103, 0
br i1 %104, label %105, label %106
105: ; preds = %101, %45
br label %114
106: ; preds = %101
%107 = load i32, i32* %8
%108 = load i32, i32* @TCSANOW
%109 = call i64 @tcsetattr(i32 %107, i32 %108, %struct.termios* %6)
%110 = icmp ne i64 %109, 0
br i1 %110, label %111, label %112
111: ; preds = %106
br label %114
112: ; preds = %106
%113 = load i32, i32* %8
store i32 %113, i32* %3
br label %117
114: ; preds = %111, %105, %44
%115 = load i32, i32* %8
%116 = call i32 @close(i32 %115)
store i32 -1, i32* %3
br label %117
117: ; preds = %114, %112, %38, %27
%118 = load i32, i32* %3
ret i32 %118
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32*, i64 }
@B2400 = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@B230400 = global i32 0
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
@IGNBRK = global i32 0
@BRKINT = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@PARMRK = global i32 0
@INPCK = global i32 0
@ISTRIP = global i32 0
@IXON = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@ICANON = global i32 0
@IEXTEN = global i32 0
@ISIG = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
define i32 @rs232_open(i8* nocapture %0, i64 %1) {
%3 = alloca %struct.termios
%4 = bitcast %struct.termios* %3 to i8*
switch i64 %1, label %94 [
i64 2400, label %5
i64 4800, label %7
i64 9600, label %9
i64 19200, label %11
i64 57600, label %13
i64 115200, label %15
i64 230400, label %17
i64 460800, label %21
i64 500000, label %19
i64 1000000, label %20
]
5: ; preds = %2
%6 = load i32, i32* @B2400
br label %21
7: ; preds = %2
%8 = load i32, i32* @B4800
br label %21
9: ; preds = %2
%10 = load i32, i32* @B9600
br label %21
11: ; preds = %2
%12 = load i32, i32* @B19200
br label %21
13: ; preds = %2
%14 = load i32, i32* @B57600
br label %21
15: ; preds = %2
%16 = load i32, i32* @B115200
br label %21
17: ; preds = %2
%18 = load i32, i32* @B230400
br label %21
19: ; preds = %2
br label %21
20: ; preds = %2
br label %21
21: ; preds = %2, %20, %19, %17, %15, %13, %11, %9, %7, %5
%22 = phi i32 [ 1000000, %20 ], [ 500000, %19 ], [ %18, %17 ], [ %16, %15 ], [ %14, %13 ], [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ 460800, %2 ]
%23 = load i32, i32* @O_RDWR
%24 = load i32, i32* @O_NOCTTY
%25 = or i32 %24, %23
%26 = load i32, i32* @O_NDELAY
%27 = or i32 %25, %26
%28 = tail call i32 @open(i8* %0, i32 %27)
%29 = icmp slt i32 %28, 0
br i1 %29, label %94, label %30
30: ; preds = %21
%31 = call i32 @memset(%struct.termios* %3, i32 0, i32 32)
%32 = call i64 @tcgetattr(i32 %28, %struct.termios* %3)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %92
34: ; preds = %30
%35 = load i32, i32* @IGNBRK
%36 = load i32, i32* @BRKINT
%37 = or i32 %36, %35
%38 = load i32, i32* @ICRNL
%39 = or i32 %37, %38
%40 = load i32, i32* @INLCR
%41 = or i32 %39, %40
%42 = load i32, i32* @PARMRK
%43 = or i32 %41, %42
%44 = load i32, i32* @INPCK
%45 = or i32 %43, %44
%46 = load i32, i32* @ISTRIP
%47 = or i32 %45, %46
%48 = load i32, i32* @IXON
%49 = or i32 %47, %48
%50 = xor i32 %49, -1
%51 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 0
%52 = load i32, i32* %51
%53 = and i32 %52, %50
store i32 %53, i32* %51
%54 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 4
store i64 0, i64* %54
%55 = load i32, i32* @ECHO
%56 = load i32, i32* @ECHONL
%57 = or i32 %56, %55
%58 = load i32, i32* @ICANON
%59 = or i32 %57, %58
%60 = load i32, i32* @IEXTEN
%61 = or i32 %59, %60
%62 = load i32, i32* @ISIG
%63 = or i32 %61, %62
%64 = xor i32 %63, -1
%65 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 1
%66 = load i32, i32* %65
%67 = and i32 %66, %64
store i32 %67, i32* %65
%68 = load i32, i32* @CSIZE
%69 = load i32, i32* @PARENB
%70 = or i32 %69, %68
%71 = xor i32 %70, -1
%72 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 2
%73 = load i32, i32* %72
%74 = and i32 %73, %71
%75 = load i32, i32* @CS8
%76 = or i32 %75, %74
store i32 %76, i32* %72
%77 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 3
%78 = load i32*, i32** %77
%79 = load i64, i64* @VMIN
%80 = getelementptr inbounds i32, i32* %78, i64 %79
store i32 1, i32* %80
%81 = load i64, i64* @VTIME
%82 = getelementptr inbounds i32, i32* %78, i64 %81
store i32 2, i32* %82
%83 = call i64 @cfsetospeed(%struct.termios* %3, i32 %22)
%84 = icmp slt i64 %83, 0
br i1 %84, label %92, label %85
85: ; preds = %34
%86 = call i64 @cfsetispeed(%struct.termios* %3, i32 %22)
%87 = icmp slt i64 %86, 0
br i1 %87, label %92, label %88
88: ; preds = %85
%89 = load i32, i32* @TCSANOW
%90 = call i64 @tcsetattr(i32 %28, i32 %89, %struct.termios* %3)
%91 = icmp eq i64 %90, 0
br i1 %91, label %94, label %92
92: ; preds = %88, %34, %85, %30
%93 = call i32 @close(i32 %28)
br label %94
94: ; preds = %88, %21, %2, %92
%95 = phi i32 [ -1, %92 ], [ -1, %2 ], [ -1, %21 ], [ %28, %88 ]
ret i32 %95
}