#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_oflag;
  int c_lflag;
  int *c_cc;
};

/* Variables and functions */
int /*<<< orphan*/ B9600;
int BRKINT;
int CLOCAL;
int CREAD;
int CS8;
int CSIZE;
int CSTOPB;
int ECHO;
int EIO;
int ICANON;
int ICRNL;
int IEXTEN;
int IGNBRK;
int IGNCR;
int INLCR;
int ISIG;
int ISTRIP;
int IUCLC;
int IXANY;
int IXOFF;
int IXON;
int OCRNL;
int OLCUC;
int ONLCR;
int OPOST;
int O_NDELAY;
int O_NOCTTY;
int O_RDWR;
int PARENB;
int PARMRK;
int PARODD;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ cfsetispeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ memset(struct termios *, int /*<<< orphan*/, int);
int open(unsigned char const *, int);
int tcgetattr(int, struct termios *);
int tcsetattr(int, int /*<<< orphan*/, struct termios *);
int rds_open_serial(const unsigned char *port) {
  int fd = 0;
  int ret = 0;
  struct termios tty;
  memset(&tty, 0, sizeof(struct termios));
  fd = open(port, O_RDWR | O_NOCTTY | O_NDELAY);
  if (fd < 0)
    return -EIO;
  ret = tcgetattr(fd, &tty);
  if (ret < 0)
    return -EIO;
  cfsetispeed(&tty, B9600);
  cfsetospeed(&tty, B9600);
  tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
  tty.c_cflag &= ~(PARENB | PARODD);
  tty.c_iflag &= ~(IXON | IXOFF | IXANY);
  tty.c_iflag &= ~(INLCR | ICRNL | IUCLC | ISTRIP);
  tty.c_oflag &= ~(ONLCR | OCRNL | OLCUC);
  tty.c_lflag &= ~(ECHO | ICANON | ISIG | IEXTEN);
  tty.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | IGNCR);
  tty.c_cflag &= ~CSTOPB;
  tty.c_cflag |= CLOCAL | CREAD;
  tty.c_oflag &= ~OPOST;
  tty.c_cc[VMIN] = 1;
  tty.c_cc[VTIME] = 25;
  ret = tcsetattr(fd, TCSANOW, &tty);
  if (ret < 0)
    return -EIO;
  return fd;
}


x86 assembly (clang, -O0):
<rds_open_serial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
mov    0x2d82(%rip),%rax
or     (%rax),%esi
mov    0x2d71(%rip),%rax
or     (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11ce <rds_open_serial+0x6e>
xor    %eax,%eax
mov    0x2d6c(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    13c6 <rds_open_serial+0x266>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <tcgetattr@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    11fa <rds_open_serial+0x9a>
xor    %eax,%eax
mov    0x2d40(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    13c6 <rds_open_serial+0x266>
mov    0x2d77(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdi
call   1080 <cfsetispeed@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    -0x30(%rbp),%eax
mov    0x2d20(%rip),%rcx
mov    (%rcx),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    0x2d22(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d5e(%rip),%rax
mov    (%rax),%eax
mov    0x2d3d(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
mov    0x2d5a(%rip),%rcx
or     (%rcx),%eax
mov    0x2cb9(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    0x2d46(%rip),%rcx
or     (%rcx),%eax
mov    0x2c5d(%rip),%rcx
or     (%rcx),%eax
mov    0x2c74(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2c52(%rip),%rax
mov    (%rax),%eax
mov    0x2d39(%rip),%rcx
or     (%rcx),%eax
mov    0x2ca8(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x2cbe(%rip),%rax
mov    (%rax),%eax
mov    0x2c0d(%rip),%rcx
or     (%rcx),%eax
mov    0x2c9c(%rip),%rcx
or     (%rcx),%eax
mov    0x2c53(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    0x2c09(%rip),%rax
mov    (%rax),%eax
mov    0x2c68(%rip),%rcx
or     (%rcx),%eax
mov    0x2cd7(%rip),%rcx
or     (%rcx),%eax
mov    0x2c9e(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2bac(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2b92(%rip),%rax
mov    (%rax),%eax
mov    0x2c19(%rip),%rcx
or     (%rcx),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c5a(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2be4(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    0x2b77(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x19,(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
mov    0x2c03(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1060 <tcsetattr@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13c0 <rds_open_serial+0x260>
xor    %eax,%eax
mov    0x2b7a(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    13c6 <rds_open_serial+0x266>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rds_open_serial>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %ebp,%ebp
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
mov    0x2e53(%rip),%rax
mov    0x2d94(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d81(%rip),%rax
or     (%rax),%esi
mov    %rbx,%rdi
call   1070 <open@plt>
test   %eax,%eax
js     1354 <rds_open_serial+0x1f4>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1050 <tcgetattr@plt>
test   %eax,%eax
js     1347 <rds_open_serial+0x1e7>
mov    0x2db2(%rip),%rbp
mov    0x0(%rbp),%esi
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1080 <cfsetispeed@plt>
mov    0x0(%rbp),%esi
mov    %r14,%rdi
call   1030 <cfsetospeed@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%r10d
not    %r10d
and    0x8(%rsp),%r10d
mov    0x2d5e(%rip),%rcx
or     (%rcx),%r10d
mov    0x2d9c(%rip),%rdx
mov    0x2d7d(%rip),%rcx
mov    (%rcx),%ecx
or     (%rdx),%ecx
mov    0x2d92(%rip),%rdx
mov    0x2da3(%rip),%rsi
mov    (%rsi),%esi
or     (%rdx),%esi
mov    0x2d00(%rip),%rdx
or     (%rdx),%esi
mov    0x2d97(%rip),%rdx
mov    0x2d98(%rip),%rdi
mov    (%rdi),%edi
or     (%rdx),%edi
mov    0x2cad(%rip),%rdx
or     (%rdx),%edi
mov    0x2cc4(%rip),%rdx
or     (%rdx),%edi
mov    0x2cab(%rip),%rbp
mov    0x2d94(%rip),%rdx
mov    (%rdx),%edx
or     0x0(%rbp),%edx
mov    0x2d00(%rip),%rbp
or     0x0(%rbp),%edx
mov    0xc(%rsp),%r9d
mov    0x2d19(%rip),%r8
mov    0x2c6a(%rip),%rbp
mov    0x0(%rbp),%ebp
or     (%r8),%ebp
mov    0x10(%rsp),%r8d
mov    0x2cf0(%rip),%rax
or     (%rax),%ebp
mov    0x2ca7(%rip),%rax
or     (%rax),%ebp
not    %ebp
and    %ebp,0x14(%rsp)
mov    0x2c60(%rip),%rax
mov    0x2cc1(%rip),%rbp
mov    0x0(%rbp),%ebp
or     (%rax),%ebp
mov    0x2d2d(%rip),%rax
or     (%rax),%ebp
mov    0x2cf4(%rip),%rax
or     (%rax),%ebp
or     %esi,%edi
or     %edi,%ebp
not    %ebp
and    %r9d,%ebp
mov    %ebp,0xc(%rsp)
mov    0x2bfe(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %r10d,%ecx
mov    0x2be8(%rip),%rax
mov    0x2c71(%rip),%rsi
or     (%rax),%ecx
or     (%rsi),%ecx
mov    %ecx,0x8(%rsp)
mov    0x2cb2(%rip),%rax
or     (%rax),%edx
not    %edx
and    %r8d,%edx
mov    %edx,0x10(%rsp)
mov    0x18(%rsp),%rax
mov    0x2c3b(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2bd2(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x19,(%rax,%rcx,4)
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   1060 <tcsetattr@plt>
test   %eax,%eax
jns    135f <rds_open_serial+0x1ff>
mov    0x2be2(%rip),%rax
xor    %ebx,%ebx
sub    (%rax),%ebx
jmp    135f <rds_open_serial+0x1ff>
mov    0x2bd5(%rip),%rax
sub    (%rax),%ebp
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i32, i32* }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
@EIO = global i32 0
@B9600 = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@INLCR = global i32 0
@ICRNL = global i32 0
@IUCLC = global i32 0
@ISTRIP = global i32 0
@ONLCR = global i32 0
@OCRNL = global i32 0
@OLCUC = global i32 0
@ECHO = global i32 0
@ICANON = global i32 0
@ISIG = global i32 0
@IEXTEN = global i32 0
@IGNBRK = global i32 0
@BRKINT = global i32 0
@PARMRK = global i32 0
@IGNCR = global i32 0
@CSTOPB = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@OPOST = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
define i32 @rds_open_serial(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.termios
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
%7 = call i32 @memset(%struct.termios* %6, i32 0, i32 24)
%8 = load i8*, i8** %3
%9 = load i32, i32* @O_RDWR
%10 = load i32, i32* @O_NOCTTY
%11 = or i32 %9, %10
%12 = load i32, i32* @O_NDELAY
%13 = or i32 %11, %12
%14 = call i32 @open(i8* %8, i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = load i32, i32* @EIO
%19 = sub nsw i32 0, %18
store i32 %19, i32* %2
br label %133
20: ; preds = %1
%21 = load i32, i32* %4
%22 = call i32 @tcgetattr(i32 %21, %struct.termios* %6)
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32, i32* @EIO
%27 = sub nsw i32 0, %26
store i32 %27, i32* %2
br label %133
28: ; preds = %20
%29 = load i32, i32* @B9600
%30 = call i32 @cfsetispeed(%struct.termios* %6, i32 %29)
%31 = load i32, i32* @B9600
%32 = call i32 @cfsetospeed(%struct.termios* %6, i32 %31)
%33 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
%34 = load i32, i32* %33
%35 = load i32, i32* @CSIZE
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = load i32, i32* @CS8
%39 = or i32 %37, %38
%40 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
store i32 %39, i32* %40
%41 = load i32, i32* @PARENB
%42 = load i32, i32* @PARODD
%43 = or i32 %41, %42
%44 = xor i32 %43, -1
%45 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
%46 = load i32, i32* %45
%47 = and i32 %46, %44
store i32 %47, i32* %45
%48 = load i32, i32* @IXON
%49 = load i32, i32* @IXOFF
%50 = or i32 %48, %49
%51 = load i32, i32* @IXANY
%52 = or i32 %50, %51
%53 = xor i32 %52, -1
%54 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 1
%55 = load i32, i32* %54
%56 = and i32 %55, %53
store i32 %56, i32* %54
%57 = load i32, i32* @INLCR
%58 = load i32, i32* @ICRNL
%59 = or i32 %57, %58
%60 = load i32, i32* @IUCLC
%61 = or i32 %59, %60
%62 = load i32, i32* @ISTRIP
%63 = or i32 %61, %62
%64 = xor i32 %63, -1
%65 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 1
%66 = load i32, i32* %65
%67 = and i32 %66, %64
store i32 %67, i32* %65
%68 = load i32, i32* @ONLCR
%69 = load i32, i32* @OCRNL
%70 = or i32 %68, %69
%71 = load i32, i32* @OLCUC
%72 = or i32 %70, %71
%73 = xor i32 %72, -1
%74 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 2
%75 = load i32, i32* %74
%76 = and i32 %75, %73
store i32 %76, i32* %74
%77 = load i32, i32* @ECHO
%78 = load i32, i32* @ICANON
%79 = or i32 %77, %78
%80 = load i32, i32* @ISIG
%81 = or i32 %79, %80
%82 = load i32, i32* @IEXTEN
%83 = or i32 %81, %82
%84 = xor i32 %83, -1
%85 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 3
%86 = load i32, i32* %85
%87 = and i32 %86, %84
store i32 %87, i32* %85
%88 = load i32, i32* @IGNBRK
%89 = load i32, i32* @BRKINT
%90 = or i32 %88, %89
%91 = load i32, i32* @PARMRK
%92 = or i32 %90, %91
%93 = load i32, i32* @IGNCR
%94 = or i32 %92, %93
%95 = xor i32 %94, -1
%96 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 1
%97 = load i32, i32* %96
%98 = and i32 %97, %95
store i32 %98, i32* %96
%99 = load i32, i32* @CSTOPB
%100 = xor i32 %99, -1
%101 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
%102 = load i32, i32* %101
%103 = and i32 %102, %100
store i32 %103, i32* %101
%104 = load i32, i32* @CLOCAL
%105 = load i32, i32* @CREAD
%106 = or i32 %104, %105
%107 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 0
%108 = load i32, i32* %107
%109 = or i32 %108, %106
store i32 %109, i32* %107
%110 = load i32, i32* @OPOST
%111 = xor i32 %110, -1
%112 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 2
%113 = load i32, i32* %112
%114 = and i32 %113, %111
store i32 %114, i32* %112
%115 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 4
%116 = load i32*, i32** %115
%117 = load i64, i64* @VMIN
%118 = getelementptr inbounds i32, i32* %116, i64 %117
store i32 1, i32* %118
%119 = getelementptr inbounds %struct.termios, %struct.termios* %6, i32 0, i32 4
%120 = load i32*, i32** %119
%121 = load i64, i64* @VTIME
%122 = getelementptr inbounds i32, i32* %120, i64 %121
store i32 25, i32* %122
%123 = load i32, i32* %4
%124 = load i32, i32* @TCSANOW
%125 = call i32 @tcsetattr(i32 %123, i32 %124, %struct.termios* %6)
store i32 %125, i32* %5
%126 = load i32, i32* %5
%127 = icmp slt i32 %126, 0
br i1 %127, label %128, label %131
128: ; preds = %28
%129 = load i32, i32* @EIO
%130 = sub nsw i32 0, %129
store i32 %130, i32* %2
br label %133
131: ; preds = %28
%132 = load i32, i32* %4
store i32 %132, i32* %2
br label %133
133: ; preds = %131, %128, %25, %17
%134 = load i32, i32* %2
ret i32 %134
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32, i32* }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
@EIO = global i32 0
@B9600 = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@INLCR = global i32 0
@ICRNL = global i32 0
@IUCLC = global i32 0
@ISTRIP = global i32 0
@ONLCR = global i32 0
@OCRNL = global i32 0
@OLCUC = global i32 0
@ECHO = global i32 0
@ICANON = global i32 0
@ISIG = global i32 0
@IEXTEN = global i32 0
@IGNBRK = global i32 0
@BRKINT = global i32 0
@PARMRK = global i32 0
@IGNCR = global i32 0
@CSTOPB = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@OPOST = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
define i32 @rds_open_serial(i8* nocapture %0) {
%2 = alloca %struct.termios
%3 = bitcast %struct.termios* %2 to i8*
%4 = call i32 @memset(%struct.termios* %2, i32 0, i32 24)
%5 = load i32, i32* @O_RDWR
%6 = load i32, i32* @O_NOCTTY
%7 = or i32 %6, %5
%8 = load i32, i32* @O_NDELAY
%9 = or i32 %7, %8
%10 = call i32 @open(i8* %0, i32 %9)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* @EIO
%14 = sub nsw i32 0, %13
br label %103
15: ; preds = %1
%16 = call i32 @tcgetattr(i32 %10, %struct.termios* %2)
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @EIO
%20 = sub nsw i32 0, %19
br label %103
21: ; preds = %15
%22 = load i32, i32* @B9600
%23 = call i32 @cfsetispeed(%struct.termios* %2, i32 %22)
%24 = load i32, i32* @B9600
%25 = call i32 @cfsetospeed(%struct.termios* %2, i32 %24)
%26 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 0
%27 = load i32, i32* %26
%28 = load i32, i32* @CSIZE
%29 = xor i32 %28, -1
%30 = and i32 %27, %29
%31 = load i32, i32* @CS8
%32 = or i32 %30, %31
%33 = load i32, i32* @PARENB
%34 = load i32, i32* @PARODD
%35 = or i32 %34, %33
%36 = load i32, i32* @IXON
%37 = load i32, i32* @IXOFF
%38 = or i32 %37, %36
%39 = load i32, i32* @IXANY
%40 = or i32 %38, %39
%41 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 1
%42 = load i32, i32* %41
%43 = load i32, i32* @INLCR
%44 = load i32, i32* @ICRNL
%45 = or i32 %44, %43
%46 = load i32, i32* @IUCLC
%47 = or i32 %45, %46
%48 = load i32, i32* @ISTRIP
%49 = or i32 %47, %48
%50 = or i32 %40, %49
%51 = load i32, i32* @ONLCR
%52 = load i32, i32* @OCRNL
%53 = or i32 %52, %51
%54 = load i32, i32* @OLCUC
%55 = or i32 %53, %54
%56 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 2
%57 = load i32, i32* %56
%58 = load i32, i32* @ECHO
%59 = load i32, i32* @ICANON
%60 = or i32 %59, %58
%61 = load i32, i32* @ISIG
%62 = or i32 %60, %61
%63 = load i32, i32* @IEXTEN
%64 = or i32 %62, %63
%65 = xor i32 %64, -1
%66 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 3
%67 = load i32, i32* %66
%68 = and i32 %67, %65
store i32 %68, i32* %66
%69 = load i32, i32* @IGNBRK
%70 = load i32, i32* @BRKINT
%71 = or i32 %70, %69
%72 = load i32, i32* @PARMRK
%73 = or i32 %71, %72
%74 = load i32, i32* @IGNCR
%75 = or i32 %73, %74
%76 = or i32 %50, %75
%77 = xor i32 %76, -1
%78 = and i32 %42, %77
store i32 %78, i32* %41
%79 = load i32, i32* @CSTOPB
%80 = or i32 %35, %79
%81 = xor i32 %80, -1
%82 = and i32 %32, %81
%83 = load i32, i32* @CLOCAL
%84 = load i32, i32* @CREAD
%85 = or i32 %83, %82
%86 = or i32 %85, %84
store i32 %86, i32* %26
%87 = load i32, i32* @OPOST
%88 = or i32 %55, %87
%89 = xor i32 %88, -1
%90 = and i32 %57, %89
store i32 %90, i32* %56
%91 = getelementptr inbounds %struct.termios, %struct.termios* %2, i64 0, i32 4
%92 = load i32*, i32** %91
%93 = load i64, i64* @VMIN
%94 = getelementptr inbounds i32, i32* %92, i64 %93
store i32 1, i32* %94
%95 = load i64, i64* @VTIME
%96 = getelementptr inbounds i32, i32* %92, i64 %95
store i32 25, i32* %96
%97 = load i32, i32* @TCSANOW
%98 = call i32 @tcsetattr(i32 %10, i32 %97, %struct.termios* %2)
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %21
%101 = load i32, i32* @EIO
%102 = sub nsw i32 0, %101
br label %103
103: ; preds = %21, %100, %18, %12
%104 = phi i32 [ %14, %12 ], [ %20, %18 ], [ %102, %100 ], [ %10, %21 ]
ret i32 %104
}