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

/* Variables and functions */
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int CSIZE;
int CSTOPB;
scalar_t__ EAGAIN;
int /*<<< orphan*/ FNDELAY;
int /*<<< orphan*/ F_SETFL;
int IGNBRK;
int IGNPAR;
int O_NDELAY;
int O_NOCTTY;
int O_RDWR;
int PARENB;
int /*<<< orphan*/ TCSAFLUSH;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ cfmakeraw(struct termios *);
scalar_t__ errno;
scalar_t__ fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int open(char const *, int);
int /*<<< orphan*/ perror(char *);
int read(int, char **, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int open_serial_raw(const char *dev) {
  struct termios options;
  int fd, rv;
  size_t written;
  char buf[64];
  fd = open(dev, O_RDWR | O_NOCTTY | O_NDELAY);
  if (fd < 0) {
    char msg[256];
    snprintf(msg, sizeof(msg), "open_serial_raw: Unable to open %s: ", dev);
    perror(msg);
    return fd;
  }
  tcgetattr(fd, &options);
  cfmakeraw(&options);
  options.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL | CRTSCTS);
  options.c_cflag |= CLOCAL;
  options.c_cflag |= CS8;
  options.c_cflag |= CREAD;
  options.c_iflag = IGNBRK | IGNPAR;
  options.c_oflag = 0;
  options.c_lflag = 0;
  options.c_cc[VMIN] = 1;
  options.c_cc[VTIME] = 0;
  tcsetattr(fd, TCSAFLUSH, &options);
  if (fcntl(fd, F_SETFL, FNDELAY) < 0) {
    perror("fcntl");
    return -1;
  }
  for (;;) {
    rv = read(fd, &buf, 1);
    if (rv < 0 && errno != EAGAIN) {
      perror("read");
      return -1;
    } else if (!rv || errno == EAGAIN) {
      break;
    }
  }
  if (fcntl(fd, F_SETFL, 0) < 0) {
    perror("fcntl");
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<open_serial_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
mov    0x2e05(%rip),%rax
or     (%rax),%esi
mov    0x2de4(%rip),%rax
or     (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    11f3 <open_serial_raw+0x73>
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0x100,%esi
lea    0xe29(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x180(%rbp),%rdi
call   10a0 <perror@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    13ce <open_serial_raw+0x24e>
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1070 <tcgetattr@plt>
lea    -0x30(%rbp),%rdi
call   1060 <cfmakeraw@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
mov    0x2d40(%rip),%rcx
or     (%rcx),%eax
mov    0x2db7(%rip),%rcx
or     (%rcx),%eax
mov    0x2d1e(%rip),%rcx
or     (%rcx),%eax
mov    0x2d2d(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d03(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d0e(%rip),%rax
mov    (%rax),%eax
mov    0x2cf5(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x2c(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2d25(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    0x2cc8(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x34(%rbp),%edi
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1080 <tcsetattr@plt>
mov    -0x34(%rbp),%edi
mov    0x2cc7(%rip),%rax
mov    (%rax),%esi
mov    0x2ca6(%rip),%rax
mov    (%rax),%edx
call   1030 <fcntl@plt>
cmp    $0x0,%rax
jge    130b <open_serial_raw+0x18b>
lea    0xd2b(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ce <open_serial_raw+0x24e>
jmp    1310 <open_serial_raw+0x190>
mov    -0x34(%rbp),%edi
lea    -0x80(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jge    1360 <open_serial_raw+0x1e0>
mov    0x2c63(%rip),%rax
mov    (%rax),%rax
mov    0x2c11(%rip),%rcx
cmp    (%rcx),%rax
je     1360 <open_serial_raw+0x1e0>
lea    0xcdc(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ce <open_serial_raw+0x24e>
cmpl   $0x0,-0x38(%rbp)
je     1384 <open_serial_raw+0x204>
mov    0x2c27(%rip),%rax
mov    (%rax),%rax
mov    0x2bd5(%rip),%rcx
cmp    (%rcx),%rax
jne    1389 <open_serial_raw+0x209>
jmp    1393 <open_serial_raw+0x213>
jmp    138e <open_serial_raw+0x20e>
jmp    1310 <open_serial_raw+0x190>
mov    -0x34(%rbp),%edi
mov    0x2c03(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
cmp    $0x0,%rax
jge    13c8 <open_serial_raw+0x248>
lea    0xc6e(%rip),%rdi
call   10a0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13ce <open_serial_raw+0x24e>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_serial_raw>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x120,%rsp
mov    0x2e52(%rip),%rax
mov    0x2e0b(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %rdi,%rbx
mov    0x2de5(%rip),%rax
or     (%rax),%esi
call   1090 <open@plt>
mov    %eax,%r15d
test   %eax,%eax
js     1315 <open_serial_raw+0x195>
mov    %rsp,%r14
mov    %r15d,%edi
mov    %r14,%rsi
call   1070 <tcgetattr@plt>
mov    %r14,%rdi
call   1060 <cfmakeraw@plt>
mov    0x2dde(%rip),%rax
mov    0x2d77(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2dec(%rip),%rax
or     (%rax),%ecx
mov    0x2d53(%rip),%rax
mov    (%rax),%eax
or     %eax,%ecx
mov    0x2d60(%rip),%rdx
or     (%rdx),%ecx
not    %ecx
and    (%rsp),%ecx
or     %eax,%ecx
mov    0x2db8(%rip),%rax
or     (%rax),%ecx
mov    0x2db7(%rip),%rax
or     (%rax),%ecx
mov    %ecx,(%rsp)
mov    0x2d5b(%rip),%rax
mov    0x2d44(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0x4(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rsp)
mov    0x8(%rsp),%rax
mov    0x2d78(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2d1f(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2d76(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    %r14,%rdx
call   1080 <tcsetattr@plt>
mov    0x2d22(%rip),%r14
mov    (%r14),%esi
mov    0x2d00(%rip),%rax
mov    (%rax),%edx
mov    %r15d,%edi
call   1030 <fcntl@plt>
test   %rax,%rax
js     1301 <open_serial_raw+0x181>
lea    0x20(%rsp),%rbx
mov    0x2cf5(%rip),%rbp
mov    0x2ca6(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <read@plt>
test   %eax,%eax
js     12d2 <open_serial_raw+0x152>
je     12dc <open_serial_raw+0x15c>
mov    0x0(%rbp),%rax
cmp    (%r12),%rax
jne    12b0 <open_serial_raw+0x130>
jmp    12dc <open_serial_raw+0x15c>
mov    0x0(%rbp),%rax
cmp    (%r12),%rax
jne    133b <open_serial_raw+0x1bb>
mov    (%r14),%esi
mov    %r15d,%edi
xor    %edx,%edx
call   1030 <fcntl@plt>
test   %rax,%rax
js     1301 <open_serial_raw+0x181>
mov    %r15d,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd1d(%rip),%rdi
call   10a0 <perror@plt>
mov    $0xffffffff,%r15d
jmp    12ee <open_serial_raw+0x16e>
lea    0xce4(%rip),%rdx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x100,%esi
mov    %rbx,%rcx
call   1040 <snprintf@plt>
mov    %r14,%rdi
call   10a0 <perror@plt>
jmp    12ee <open_serial_raw+0x16e>
lea    0xce9(%rip),%rdi
jmp    1308 <open_serial_raw+0x188>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
@.str = [37 x i8] c"open_serial_raw: Unable to open %s: \00"
@CSIZE = global i32 0
@CSTOPB = global i32 0
@PARENB = global i32 0
@CLOCAL = global i32 0
@CRTSCTS = global i32 0
@CS8 = global i32 0
@CREAD = global i32 0
@IGNBRK = global i32 0
@IGNPAR = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSAFLUSH = global i32 0
@F_SETFL = global i32 0
@FNDELAY = global i32 0
@.str.1 = [6 x i8] c"fcntl\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.2 = [5 x i8] c"read\00"
define i32 @open_serial_raw(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.termios
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
%8 = alloca [64 x i8]
%9 = alloca [256 x i8]
store i8* %0, i8** %3
%10 = load i8*, i8** %3
%11 = load i32, i32* @O_RDWR
%12 = load i32, i32* @O_NOCTTY
%13 = or i32 %11, %12
%14 = load i32, i32* @O_NDELAY
%15 = or i32 %13, %14
%16 = call i32 @open(i8* %10, i32 %15)
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %26
19: ; preds = %1
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%21 = load i8*, i8** %3
%22 = call i32 @snprintf(i8* %20, i32 256, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%24 = call i32 @perror(i8* %23)
%25 = load i32, i32* %5
store i32 %25, i32* %2
br label %111
26: ; preds = %1
%27 = load i32, i32* %5
%28 = call i32 @tcgetattr(i32 %27, %struct.termios* %4)
%29 = call i32 @cfmakeraw(%struct.termios* %4)
%30 = load i32, i32* @CSIZE
%31 = load i32, i32* @CSTOPB
%32 = or i32 %30, %31
%33 = load i32, i32* @PARENB
%34 = or i32 %32, %33
%35 = load i32, i32* @CLOCAL
%36 = or i32 %34, %35
%37 = load i32, i32* @CRTSCTS
%38 = or i32 %36, %37
%39 = xor i32 %38, -1
%40 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 0
%41 = load i32, i32* %40
%42 = and i32 %41, %39
store i32 %42, i32* %40
%43 = load i32, i32* @CLOCAL
%44 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 0
%45 = load i32, i32* %44
%46 = or i32 %45, %43
store i32 %46, i32* %44
%47 = load i32, i32* @CS8
%48 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 0
%49 = load i32, i32* %48
%50 = or i32 %49, %47
store i32 %50, i32* %48
%51 = load i32, i32* @CREAD
%52 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 0
%53 = load i32, i32* %52
%54 = or i32 %53, %51
store i32 %54, i32* %52
%55 = load i32, i32* @IGNBRK
%56 = load i32, i32* @IGNPAR
%57 = or i32 %55, %56
%58 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 1
store i32 %57, i32* %58
%59 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 4
store i64 0, i64* %59
%60 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 3
store i64 0, i64* %60
%61 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 2
%62 = load i32*, i32** %61
%63 = load i64, i64* @VMIN
%64 = getelementptr inbounds i32, i32* %62, i64 %63
store i32 1, i32* %64
%65 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 2
%66 = load i32*, i32** %65
%67 = load i64, i64* @VTIME
%68 = getelementptr inbounds i32, i32* %66, i64 %67
store i32 0, i32* %68
%69 = load i32, i32* %5
%70 = load i32, i32* @TCSAFLUSH
%71 = call i32 @tcsetattr(i32 %69, i32 %70, %struct.termios* %4)
%72 = load i32, i32* %5
%73 = load i32, i32* @F_SETFL
%74 = load i32, i32* @FNDELAY
%75 = call i64 @fcntl(i32 %72, i32 %73, i32 %74)
%76 = icmp slt i64 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %26
%78 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %111
79: ; preds = %26
br label %80
80: ; preds = %101, %79
%81 = load i32, i32* %5
%82 = bitcast [64 x i8]* %8 to i8**
%83 = call i32 @read(i32 %81, i8** %82, i32 1)
store i32 %83, i32* %6
%84 = load i32, i32* %6
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %80
%87 = load i64, i64* @errno
%88 = load i64, i64* @EAGAIN
%89 = icmp ne i64 %87, %88
br i1 %89, label %90, label %92
90: ; preds = %86
%91 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %2
br label %111
92: ; preds = %86, %80
%93 = load i32, i32* %6
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %99
95: ; preds = %92
%96 = load i64, i64* @errno
%97 = load i64, i64* @EAGAIN
%98 = icmp eq i64 %96, %97
br i1 %98, label %99, label %100
99: ; preds = %95, %92
br label %102
100: ; preds = %95
br label %101
101: ; preds = %100
br label %80
102: ; preds = %99
%103 = load i32, i32* %5
%104 = load i32, i32* @F_SETFL
%105 = call i64 @fcntl(i32 %103, i32 %104, i32 0)
%106 = icmp slt i64 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %102
%108 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %111
109: ; preds = %102
%110 = load i32, i32* %5
store i32 %110, i32* %2
br label %111
111: ; preds = %109, %107, %90, %77, %19
%112 = load i32, i32* %2
ret i32 %112
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
@.str = [37 x i8] c"open_serial_raw: Unable to open %s: \00"
@CSIZE = global i32 0
@CSTOPB = global i32 0
@PARENB = global i32 0
@CLOCAL = global i32 0
@CRTSCTS = global i32 0
@CS8 = global i32 0
@CREAD = global i32 0
@IGNBRK = global i32 0
@IGNPAR = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSAFLUSH = global i32 0
@F_SETFL = global i32 0
@FNDELAY = global i32 0
@.str.1 = [6 x i8] c"fcntl\00"
@errno = global i64 0
@EAGAIN = global i64 0
@.str.2 = [5 x i8] c"read\00"
define i32 @open_serial_raw(i8* %0) {
%2 = alloca %struct.termios
%3 = alloca [64 x i8]
%4 = alloca [256 x i8]
%5 = bitcast %struct.termios* %2 to i8*
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%7 = load i32, i32* @O_RDWR
%8 = load i32, i32* @O_NOCTTY
%9 = or i32 %8, %7
%10 = load i32, i32* @O_NDELAY
%11 = or i32 %9, %10
%12 = tail call i32 @open(i8* %0, i32 %11)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %1
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%16 = call i32 @snprintf(i8* %15, i32 256, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
%17 = call i32 @perror(i8* %15)
br label %82
18: ; preds = %1
%19 = call i32 @tcgetattr(i32 %12, %struct.termios* %2)
%20 = call i32 @cfmakeraw(%struct.termios* %2)
%21 = load i32, i32* @CSIZE
%22 = load i32, i32* @CSTOPB
%23 = or i32 %22, %21
%24 = load i32, i32* @PARENB
%25 = or i32 %23, %24
%26 = load i32, i32* @CLOCAL
%27 = or i32 %25, %26
%28 = load i32, i32* @CRTSCTS
%29 = or i32 %27, %28
%30 = xor i32 %29, -1
%31 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 0
%32 = load i32, i32* %31
%33 = and i32 %32, %30
%34 = or i32 %33, %26
%35 = load i32, i32* @CS8
%36 = or i32 %34, %35
%37 = load i32, i32* @CREAD
%38 = or i32 %37, %36
store i32 %38, i32* %31
%39 = load i32, i32* @IGNBRK
%40 = load i32, i32* @IGNPAR
%41 = or i32 %40, %39
%42 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 1
store i32 %41, i32* %42
%43 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 3
%44 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 2
%45 = bitcast i64* %43 to i8*
%46 = load i32*, i32** %44
%47 = load i64, i64* @VMIN
%48 = getelementptr inbounds i32, i32* %46, i64 %47
store i32 1, i32* %48
%49 = load i64, i64* @VTIME
%50 = getelementptr inbounds i32, i32* %46, i64 %49
store i32 0, i32* %50
%51 = load i32, i32* @TCSAFLUSH
%52 = call i32 @tcsetattr(i32 %12, i32 %51, %struct.termios* %2)
%53 = load i32, i32* @F_SETFL
%54 = load i32, i32* @FNDELAY
%55 = call i64 @fcntl(i32 %12, i32 %53, i32 %54)
%56 = icmp slt i64 %55, 0
br i1 %56, label %59, label %57
57: ; preds = %18
%58 = bitcast [64 x i8]* %3 to i8**
br label %61
59: ; preds = %18
%60 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %82
61: ; preds = %57, %72
%62 = call i32 @read(i32 %12, i8** %58, i32 1)
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %61
%65 = load i64, i64* @errno
%66 = load i64, i64* @EAGAIN
%67 = icmp eq i64 %65, %66
br i1 %67, label %76, label %68
68: ; preds = %64
%69 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %82
70: ; preds = %61
%71 = icmp eq i32 %62, 0
br i1 %71, label %76, label %72
72: ; preds = %70
%73 = load i64, i64* @errno
%74 = load i64, i64* @EAGAIN
%75 = icmp eq i64 %73, %74
br i1 %75, label %76, label %61
76: ; preds = %70, %72, %64
%77 = load i32, i32* @F_SETFL
%78 = call i64 @fcntl(i32 %12, i32 %77, i32 0)
%79 = icmp slt i64 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %82
82: ; preds = %76, %80, %68, %59, %14
%83 = phi i32 [ %12, %14 ], [ -1, %59 ], [ -1, %68 ], [ -1, %80 ], [ %12, %76 ]
ret i32 %83
}