#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_iflag;
  int c_cflag;
  int *c_cc;
  scalar_t__ c_lflag;
  scalar_t__ c_oflag;
};
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
int /*<<< orphan*/ B110;
int /*<<< orphan*/ B1200;
int /*<<< orphan*/ B134;
int /*<<< orphan*/ B150;
int /*<<< orphan*/ B1800;
int /*<<< orphan*/ B19200;
int /*<<< orphan*/ B200;
int /*<<< orphan*/ B2400;
int /*<<< orphan*/ B300;
int /*<<< orphan*/ B38400;
int /*<<< orphan*/ B4800;
int /*<<< orphan*/ B50;
int /*<<< orphan*/ B600;
int /*<<< orphan*/ B75;
int /*<<< orphan*/ B9600;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int IGNBRK;
int IXOFF;
int IXON;
int O_NDELAY;
int O_RDWR;
int O_WRONLY;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
scalar_t__ cfsetospeed(struct termios *, int /*<<< orphan*/);
scalar_t__ die(char *);
int open(char *, int);
scalar_t__ tcflush(int, int /*<<< orphan*/);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int openRawSerialLine(char *port, int speed, int flow_control, int wrmode) {
  struct termios flags;
  speed_t tioc_speed;
  int fd, softwareFlow;
  softwareFlow = (flow_control == 1) ? 1 : 0;
  ((fd = open(port, wrmode | O_NDELAY)) >= 0) ||
      die("failed opening serial port");
  ((tcflush(fd, TCIFLUSH)) >= 0) || die("failed flushing line");
  flags.c_iflag = IGNBRK | ((flow_control == 1) ? (IXOFF | IXON) : 0);
  flags.c_cflag = CLOCAL | CS8 | ((flow_control == 2) ? CRTSCTS : 0) |
                  ((wrmode == O_WRONLY || wrmode == O_RDWR) ? CREAD : 0);
  flags.c_oflag = flags.c_lflag = 0;
  flags.c_cc[VMIN] = 1;
  flags.c_cc[VTIME] = 0;
  switch (speed) {
  case 50:
    tioc_speed = B50;
    break;
  case 75:
    tioc_speed = B75;
    break;
  case 110:
    tioc_speed = B110;
    break;
  case 134:
    tioc_speed = B134;
    break;
  case 150:
    tioc_speed = B150;
    break;
  case 200:
    tioc_speed = B200;
    break;
  case 300:
    tioc_speed = B300;
    break;
  case 600:
    tioc_speed = B600;
    break;
  case 1200:
    tioc_speed = B1200;
    break;
  case 1800:
    tioc_speed = B1800;
    break;
  case 2400:
    tioc_speed = B2400;
    break;
  case 4800:
    tioc_speed = B4800;
    break;
  case 9600:
    tioc_speed = B9600;
    break;
  case 19200:
    tioc_speed = B19200;
    break;
  case 38400:
    tioc_speed = B38400;
    break;
  default:
    die("Unknown baud date");
    break;
  }
  ((cfsetospeed(&flags, tioc_speed)) >= 0) ||
      die("failed setting output speed");
  ((tcsetattr(fd, TCSANOW, &flags)) >= 0) || die("failed setting port attribs");
  return (fd);
}


x86 assembly (clang, -O0):
<openRawSerialLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x10(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2db2(%rip),%rax
or     (%rax),%esi
call   1060 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x40(%rbp)
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x45(%rbp)
jge    11b6 <openRawSerialLine+0x66>
lea    0xe59(%rip),%rdi
call   1070 <die@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x45(%rbp)
mov    -0x45(%rbp),%al
mov    -0x40(%rbp),%edi
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x46(%rbp)
jge    11f2 <openRawSerialLine+0xa2>
lea    0xe38(%rip),%rdi
call   1070 <die@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x46(%rbp)
mov    -0x46(%rbp),%al
mov    0x2d2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    1225 <openRawSerialLine+0xd5>
mov    0x2dbe(%rip),%rax
mov    (%rax),%eax
mov    0x2da5(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x50(%rbp)
jmp    122f <openRawSerialLine+0xdf>
xor    %eax,%eax
mov    %eax,-0x50(%rbp)
jmp    122f <openRawSerialLine+0xdf>
mov    -0x4c(%rbp),%eax
mov    -0x50(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    0x2cbf(%rip),%rax
mov    (%rax),%eax
mov    0x2d2e(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x2,-0x10(%rbp)
jne    126a <openRawSerialLine+0x11a>
mov    0x2cb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
jmp    1274 <openRawSerialLine+0x124>
xor    %eax,%eax
mov    %eax,-0x58(%rbp)
jmp    1274 <openRawSerialLine+0x124>
mov    -0x54(%rbp),%eax
mov    -0x58(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2c7f(%rip),%rcx
cmp    (%rcx),%eax
je     12a3 <openRawSerialLine+0x153>
mov    -0x14(%rbp),%eax
mov    0x2d45(%rip),%rcx
cmp    (%rcx),%eax
jne    12b4 <openRawSerialLine+0x164>
mov    0x2cd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
jmp    12be <openRawSerialLine+0x16e>
xor    %eax,%eax
mov    %eax,-0x60(%rbp)
jmp    12be <openRawSerialLine+0x16e>
mov    -0x5c(%rbp),%eax
mov    -0x60(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x30(%rbp),%rax
mov    0x2c8c(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    0x2c27(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
mov    %eax,-0x64(%rbp)
sub    $0x32,%eax
je     141d <openRawSerialLine+0x2cd>
jmp    1317 <openRawSerialLine+0x1c7>
mov    -0x64(%rbp),%eax
sub    $0x4b,%eax
je     142e <openRawSerialLine+0x2de>
jmp    1328 <openRawSerialLine+0x1d8>
mov    -0x64(%rbp),%eax
sub    $0x6e,%eax
je     143f <openRawSerialLine+0x2ef>
jmp    1339 <openRawSerialLine+0x1e9>
mov    -0x64(%rbp),%eax
sub    $0x86,%eax
je     1450 <openRawSerialLine+0x300>
jmp    134c <openRawSerialLine+0x1fc>
mov    -0x64(%rbp),%eax
sub    $0x96,%eax
je     1461 <openRawSerialLine+0x311>
jmp    135f <openRawSerialLine+0x20f>
mov    -0x64(%rbp),%eax
sub    $0xc8,%eax
je     1472 <openRawSerialLine+0x322>
jmp    1372 <openRawSerialLine+0x222>
mov    -0x64(%rbp),%eax
sub    $0x12c,%eax
je     1483 <openRawSerialLine+0x333>
jmp    1385 <openRawSerialLine+0x235>
mov    -0x64(%rbp),%eax
sub    $0x258,%eax
je     1494 <openRawSerialLine+0x344>
jmp    1398 <openRawSerialLine+0x248>
mov    -0x64(%rbp),%eax
sub    $0x4b0,%eax
je     14a5 <openRawSerialLine+0x355>
jmp    13ab <openRawSerialLine+0x25b>
mov    -0x64(%rbp),%eax
sub    $0x708,%eax
je     14b6 <openRawSerialLine+0x366>
jmp    13be <openRawSerialLine+0x26e>
mov    -0x64(%rbp),%eax
sub    $0x960,%eax
je     14c7 <openRawSerialLine+0x377>
jmp    13d1 <openRawSerialLine+0x281>
mov    -0x64(%rbp),%eax
sub    $0x12c0,%eax
je     14d8 <openRawSerialLine+0x388>
jmp    13e4 <openRawSerialLine+0x294>
mov    -0x64(%rbp),%eax
sub    $0x2580,%eax
je     14e9 <openRawSerialLine+0x399>
jmp    13f7 <openRawSerialLine+0x2a7>
mov    -0x64(%rbp),%eax
sub    $0x4b00,%eax
je     14fa <openRawSerialLine+0x3aa>
jmp    140a <openRawSerialLine+0x2ba>
mov    -0x64(%rbp),%eax
sub    $0x9600,%eax
je     150b <openRawSerialLine+0x3bb>
jmp    151c <openRawSerialLine+0x3cc>
mov    0x2b64(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2b93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2b92(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2b51(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2ad8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2aef(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2b06(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2b15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2a84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2a9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2a7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2ac1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2aa8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x2aef(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
mov    0x29e6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    1528 <openRawSerialLine+0x3d8>
lea    0xb0d(%rip),%rdi
call   1070 <die@plt>
mov    -0x3c(%rbp),%esi
lea    -0x38(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x65(%rbp)
jge    155c <openRawSerialLine+0x40c>
lea    0xaf5(%rip),%rdi
call   1070 <die@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x65(%rbp)
mov    -0x65(%rbp),%al
mov    -0x40(%rbp),%edi
mov    0x2a4f(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1050 <tcsetattr@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x66(%rbp)
jge    159c <openRawSerialLine+0x44c>
lea    0xad1(%rip),%rdi
call   1070 <die@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x66(%rbp)
mov    -0x66(%rbp),%al
mov    -0x40(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openRawSerialLine>:
push   %rbx
mov    0x2ea0(%rip),%rax
or     (%rax),%ecx
mov    %ecx,%esi
call   1040 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1153 <openRawSerialLine+0x23>
lea    0xeb2(%rip),%rdi
call   1050 <die@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <tcflush@plt>
lea    0xeb1(%rip),%rdi
call   1050 <die@plt>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@O_NDELAY = global i32 0
@.str = [27 x i8] c"failed opening serial port\00"
@TCIFLUSH = global i32 0
@.str.1 = [21 x i8] c"failed flushing line\00"
@IGNBRK = global i32 0
@IXOFF = global i32 0
@IXON = global i32 0
@CLOCAL = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@O_WRONLY = global i32 0
@O_RDWR = global i32 0
@CREAD = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@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
@.str.2 = [18 x i8] c"Unknown baud date\00"
@.str.3 = [28 x i8] c"failed setting output speed\00"
@TCSANOW = global i32 0
@.str.4 = [28 x i8] c"failed setting port attribs\00"
define i32 @openRawSerialLine(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.termios
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 1
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 0
store i32 %16, i32* %12
%17 = load i8*, i8** %5
%18 = load i32, i32* %8
%19 = load i32, i32* @O_NDELAY
%20 = or i32 %18, %19
%21 = call i32 @open(i8* %17, i32 %20)
store i32 %21, i32* %11
%22 = icmp sge i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %4
%24 = call i64 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i64 %24, 0
br label %26
26: ; preds = %23, %4
%27 = phi i1 [ true, %4 ], [ %25, %23 ]
%28 = zext i1 %27 to i32
%29 = load i32, i32* %11
%30 = load i32, i32* @TCIFLUSH
%31 = call i64 @tcflush(i32 %29, i32 %30)
%32 = icmp sge i64 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %26
%34 = call i64 @die(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br label %36
36: ; preds = %33, %26
%37 = phi i1 [ true, %26 ], [ %35, %33 ]
%38 = zext i1 %37 to i32
%39 = load i32, i32* @IGNBRK
%40 = load i32, i32* %7
%41 = icmp eq i32 %40, 1
br i1 %41, label %42, label %46
42: ; preds = %36
%43 = load i32, i32* @IXOFF
%44 = load i32, i32* @IXON
%45 = or i32 %43, %44
br label %47
46: ; preds = %36
br label %47
47: ; preds = %46, %42
%48 = phi i32 [ %45, %42 ], [ 0, %46 ]
%49 = or i32 %39, %48
%50 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 0
store i32 %49, i32* %50
%51 = load i32, i32* @CLOCAL
%52 = load i32, i32* @CS8
%53 = or i32 %51, %52
%54 = load i32, i32* %7
%55 = icmp eq i32 %54, 2
br i1 %55, label %56, label %58
56: ; preds = %47
%57 = load i32, i32* @CRTSCTS
br label %59
58: ; preds = %47
br label %59
59: ; preds = %58, %56
%60 = phi i32 [ %57, %56 ], [ 0, %58 ]
%61 = or i32 %53, %60
%62 = load i32, i32* %8
%63 = load i32, i32* @O_WRONLY
%64 = icmp eq i32 %62, %63
br i1 %64, label %69, label %65
65: ; preds = %59
%66 = load i32, i32* %8
%67 = load i32, i32* @O_RDWR
%68 = icmp eq i32 %66, %67
br i1 %68, label %69, label %71
69: ; preds = %65, %59
%70 = load i32, i32* @CREAD
br label %72
71: ; preds = %65
br label %72
72: ; preds = %71, %69
%73 = phi i32 [ %70, %69 ], [ 0, %71 ]
%74 = or i32 %61, %73
%75 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 1
store i32 %74, i32* %75
%76 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 3
store i64 0, i64* %76
%77 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 4
store i64 0, i64* %77
%78 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 2
%79 = load i32*, i32** %78
%80 = load i64, i64* @VMIN
%81 = getelementptr inbounds i32, i32* %79, i64 %80
store i32 1, i32* %81
%82 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 2
%83 = load i32*, i32** %82
%84 = load i64, i64* @VTIME
%85 = getelementptr inbounds i32, i32* %83, i64 %84
store i32 0, i32* %85
%86 = load i32, i32* %6
switch i32 %86, label %117 [
i32 50, label %87
i32 75, label %89
i32 110, label %91
i32 134, label %93
i32 150, label %95
i32 200, label %97
i32 300, label %99
i32 600, label %101
i32 1200, label %103
i32 1800, label %105
i32 2400, label %107
i32 4800, label %109
i32 9600, label %111
i32 19200, label %113
i32 38400, label %115
]
87: ; preds = %72
%88 = load i32, i32* @B50
store i32 %88, i32* %10
br label %119
89: ; preds = %72
%90 = load i32, i32* @B75
store i32 %90, i32* %10
br label %119
91: ; preds = %72
%92 = load i32, i32* @B110
store i32 %92, i32* %10
br label %119
93: ; preds = %72
%94 = load i32, i32* @B134
store i32 %94, i32* %10
br label %119
95: ; preds = %72
%96 = load i32, i32* @B150
store i32 %96, i32* %10
br label %119
97: ; preds = %72
%98 = load i32, i32* @B200
store i32 %98, i32* %10
br label %119
99: ; preds = %72
%100 = load i32, i32* @B300
store i32 %100, i32* %10
br label %119
101: ; preds = %72
%102 = load i32, i32* @B600
store i32 %102, i32* %10
br label %119
103: ; preds = %72
%104 = load i32, i32* @B1200
store i32 %104, i32* %10
br label %119
105: ; preds = %72
%106 = load i32, i32* @B1800
store i32 %106, i32* %10
br label %119
107: ; preds = %72
%108 = load i32, i32* @B2400
store i32 %108, i32* %10
br label %119
109: ; preds = %72
%110 = load i32, i32* @B4800
store i32 %110, i32* %10
br label %119
111: ; preds = %72
%112 = load i32, i32* @B9600
store i32 %112, i32* %10
br label %119
113: ; preds = %72
%114 = load i32, i32* @B19200
store i32 %114, i32* %10
br label %119
115: ; preds = %72
%116 = load i32, i32* @B38400
store i32 %116, i32* %10
br label %119
117: ; preds = %72
%118 = call i64 @die(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %119
119: ; preds = %117, %115, %113, %111, %109, %107, %105, %103, %101, %99, %97, %95, %93, %91, %89, %87
%120 = load i32, i32* %10
%121 = call i64 @cfsetospeed(%struct.termios* %9, i32 %120)
%122 = icmp sge i64 %121, 0
br i1 %122, label %126, label %123
123: ; preds = %119
%124 = call i64 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%125 = icmp ne i64 %124, 0
br label %126
126: ; preds = %123, %119
%127 = phi i1 [ true, %119 ], [ %125, %123 ]
%128 = zext i1 %127 to i32
%129 = load i32, i32* %11
%130 = load i32, i32* @TCSANOW
%131 = call i64 @tcsetattr(i32 %129, i32 %130, %struct.termios* %9)
%132 = icmp sge i64 %131, 0
br i1 %132, label %136, label %133
133: ; preds = %126
%134 = call i64 @die(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%135 = icmp ne i64 %134, 0
br label %136
136: ; preds = %133, %126
%137 = phi i1 [ true, %126 ], [ %135, %133 ]
%138 = zext i1 %137 to i32
%139 = load i32, i32* %11
ret i32 %139
}

LLVM IR (-O2):
@O_NDELAY = global i32 0
@.str = [27 x i8] c"failed opening serial port\00"
@TCIFLUSH = global i32 0
@.str.1 = [21 x i8] c"failed flushing line\00"
@IGNBRK = global i32 0
@IXOFF = global i32 0
@IXON = global i32 0
@CLOCAL = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@O_WRONLY = global i32 0
@O_RDWR = global i32 0
@CREAD = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@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
@TCSANOW = global i32 0
define i32 @openRawSerialLine(i8* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @O_NDELAY
%6 = or i32 %5, %3
%7 = tail call i32 @open(i8* %0, i32 %6)
%8 = icmp sgt i32 %7, -1
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i64 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %4
%12 = load i32, i32* @TCIFLUSH
%13 = tail call i64 @tcflush(i32 %7, i32 %12)
%14 = icmp slt i64 %13, 0
%15 = tail call i64 @die(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
unreachable
}