#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_oflag;
  scalar_t__ c_lflag;
};
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
int /*<<< orphan*/ B115200;
int /*<<< orphan*/ B19200;
int /*<<< orphan*/ B38400;
int /*<<< orphan*/ B57600;
int /*<<< orphan*/ B9600;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int CSIZE;
int CSTOPB;
int HUPCL;
int IGNBRK;
int IXANY;
int IXOFF;
int IXON;
int O_NOCTTY;
int O_RDWR;
int O_SYNC;
int PARENB;
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 errno;
int /*<<< orphan*/ memset(struct termios *, int /*<<< orphan*/, int);
int open(char *, int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int serialOpen(char *device, int baud) {
  int fd = open(device, O_RDWR | O_NOCTTY | O_SYNC);
  struct termios tty;
  memset(&tty, 0, sizeof tty);
  if (tcgetattr(fd, &tty) != 0) {
    printf("Error %d from tcgetattr\n", errno);
    return -1;
  }
  speed_t baudRate;
  switch (baud) {
  case 9600:
    baudRate = B9600;
    break;
  case 19200:
    baudRate = B19200;
    break;
  case 38400:
    baudRate = B38400;
    break;
  case 57600:
    baudRate = B57600;
    break;
  case 115200:
    baudRate = B115200;
    break;
  default:
    printf("Unsupported baud rate: %d\n", baud);
    return -1;
  }
  cfsetospeed(&tty, baudRate);
  cfsetispeed(&tty, baudRate);
  tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
  tty.c_iflag &= ~IGNBRK;
  tty.c_lflag = 0;
  tty.c_oflag = 0;
  tty.c_iflag &= ~(IXON | IXOFF | IXANY);
  tty.c_cflag |= (CLOCAL | CREAD);
  tty.c_cflag &= ~(PARENB | PARODD);
  tty.c_cflag &= ~CSTOPB;
  tty.c_cflag &= ~CRTSCTS;
  tty.c_cflag &= ~HUPCL;
  tty.c_cc[VMIN] = 0;
  tty.c_cc[VTIME] = 10;
  if (tcsetattr(fd, TCSANOW, &tty) != 0) {
    printf("Error %d setting term attributes\n", errno);
    return -1;
  }
  return fd;
}


x86 assembly (clang, -O0):
<serialOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e56(%rip),%rax
mov    (%rax),%esi
mov    0x2dd5(%rip),%rax
or     (%rax),%esi
mov    0x2e3c(%rip),%rax
or     (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    -0x18(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1060 <tcgetattr@plt>
cmp    $0x0,%rax
je     11ed <serialOpen+0x7d>
mov    0x2d8d(%rip),%rax
mov    (%rax),%esi
lea    0xe24(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1413 <serialOpen+0x2a3>
mov    -0x14(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0x2580,%eax
je     124f <serialOpen+0xdf>
jmp    1203 <serialOpen+0x93>
mov    -0x40(%rbp),%eax
sub    $0x4b00,%eax
je     1260 <serialOpen+0xf0>
jmp    1216 <serialOpen+0xa6>
mov    -0x40(%rbp),%eax
sub    $0x9600,%eax
je     1271 <serialOpen+0x101>
jmp    1229 <serialOpen+0xb9>
mov    -0x40(%rbp),%eax
sub    $0xe100,%eax
je     1282 <serialOpen+0x112>
jmp    123c <serialOpen+0xcc>
mov    -0x40(%rbp),%eax
sub    $0x1c200,%eax
je     1293 <serialOpen+0x123>
jmp    12a4 <serialOpen+0x134>
mov    0x2d52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12bf <serialOpen+0x14f>
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12bf <serialOpen+0x14f>
mov    0x2ca0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12bf <serialOpen+0x14f>
mov    0x2cf7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12bf <serialOpen+0x14f>
mov    0x2cb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
jmp    12bf <serialOpen+0x14f>
mov    -0x14(%rbp),%esi
lea    0xd6b(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1413 <serialOpen+0x2a3>
mov    -0x3c(%rbp),%esi
lea    -0x38(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    -0x3c(%rbp),%esi
lea    -0x38(%rbp),%rdi
call   1090 <cfsetispeed@plt>
mov    -0x38(%rbp),%eax
mov    0x2ca7(%rip),%rcx
mov    (%rcx),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    0x2ca9(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c5d(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2cab(%rip),%rax
mov    (%rax),%eax
mov    0x2caa(%rip),%rcx
or     (%rcx),%eax
mov    0x2c41(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    0x2bdf(%rip),%rax
mov    (%rax),%eax
mov    0x2c56(%rip),%rcx
or     (%rcx),%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c67(%rip),%rax
mov    (%rax),%eax
mov    0x2c4e(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2bb4(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2baa(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2ba8(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    0x2be2(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    0x2b85(%rip),%rcx
mov    (%rcx),%rcx
movl   $0xa,(%rax,%rcx,4)
mov    -0x18(%rbp),%edi
mov    0x2be1(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1070 <tcsetattr@plt>
cmp    $0x0,%rax
je     140d <serialOpen+0x29d>
mov    0x2b6d(%rip),%rax
mov    (%rax),%esi
lea    0xc38(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1413 <serialOpen+0x2a3>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialOpen>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    0x2e5f(%rip),%rcx
mov    0x2de0(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    %esi,%ebp
mov    0x2e43(%rip),%rcx
or     (%rcx),%eax
mov    %eax,%esi
call   1080 <open@plt>
mov    %eax,%r15d
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
call   1060 <tcgetattr@plt>
test   %rax,%rax
je     11da <serialOpen+0x6a>
mov    0x2d94(%rip),%rax
mov    (%rax),%esi
lea    0xe2b(%rip),%rdi
jmp    1344 <serialOpen+0x1d4>
cmp    $0x95ff,%ebp
jle    1207 <serialOpen+0x97>
cmp    $0x9600,%ebp
je     1224 <serialOpen+0xb4>
cmp    $0xe100,%ebp
je     122d <serialOpen+0xbd>
cmp    $0x1c200,%ebp
jne    133b <serialOpen+0x1cb>
mov    0x2d4b(%rip),%rax
jmp    123d <serialOpen+0xcd>
cmp    $0x2580,%ebp
je     1236 <serialOpen+0xc6>
cmp    $0x4b00,%ebp
jne    133b <serialOpen+0x1cb>
mov    0x2dce(%rip),%rax
jmp    123d <serialOpen+0xcd>
mov    0x2ced(%rip),%rax
jmp    123d <serialOpen+0xcd>
mov    0x2d4c(%rip),%rax
jmp    123d <serialOpen+0xcd>
mov    0x2d6b(%rip),%rax
mov    (%rax),%ebx
lea    0x8(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <cfsetospeed@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1090 <cfsetispeed@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%eax
not    %eax
and    0x8(%rsp),%eax
mov    0x2d2a(%rip),%rcx
or     (%rcx),%eax
mov    0x2ce1(%rip),%rcx
xorps  %xmm0,%xmm0
movups %xmm0,0x18(%rsp)
mov    0x2d42(%rip),%rdx
mov    0x2d43(%rip),%rsi
mov    (%rsi),%esi
or     (%rdx),%esi
mov    0x2cd8(%rip),%rdx
or     (%rdx),%esi
or     (%rcx),%esi
not    %esi
and    %esi,0xc(%rsp)
mov    0x2c77(%rip),%rcx
or     (%rcx),%eax
mov    0x2cee(%rip),%rcx
or     (%rcx),%eax
mov    0x2d05(%rip),%rcx
mov    0x2cee(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2c5b(%rip),%rcx
or     (%rcx),%edx
mov    0x2c5a(%rip),%rcx
or     (%rcx),%edx
mov    0x2c61(%rip),%rcx
or     (%rcx),%edx
not    %edx
and    %eax,%edx
mov    %edx,0x8(%rsp)
mov    0x10(%rsp),%rax
mov    0x2c9b(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2c42(%rip),%rcx
mov    (%rcx),%rcx
movl   $0xa,(%rax,%rcx,4)
mov    0x2ca1(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    %r14,%rdx
call   1070 <tcsetattr@plt>
test   %rax,%rax
je     134f <serialOpen+0x1df>
mov    0x2c30(%rip),%rax
mov    (%rax),%esi
lea    0xcfb(%rip),%rdi
jmp    1344 <serialOpen+0x1d4>
lea    0xcd7(%rip),%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
mov    $0xffffffff,%r15d
mov    %r15d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_SYNC = global i32 0
@.str = [25 x i8] c"Error %d from tcgetattr\0A\00"
@errno = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@.str.1 = [27 x i8] c"Unsupported baud rate: %d\0A\00"
@CSIZE = global i32 0
@CS8 = global i32 0
@IGNBRK = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@CSTOPB = global i32 0
@CRTSCTS = global i32 0
@HUPCL = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
@.str.2 = [34 x i8] c"Error %d setting term attributes\0A\00"
define i32 @serialOpen(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca %struct.termios
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%9 = load i8*, i8** %4
%10 = load i32, i32* @O_RDWR
%11 = load i32, i32* @O_NOCTTY
%12 = or i32 %10, %11
%13 = load i32, i32* @O_SYNC
%14 = or i32 %12, %13
%15 = call i32 @open(i8* %9, i32 %14)
store i32 %15, i32* %6
%16 = call i32 @memset(%struct.termios* %7, i32 0, i32 32)
%17 = load i32, i32* %6
%18 = call i64 @tcgetattr(i32 %17, %struct.termios* %7)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = load i32, i32* @errno
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %21)
store i32 -1, i32* %3
br label %112
23: ; preds = %2
%24 = load i32, i32* %5
switch i32 %24, label %35 [
i32 9600, label %25
i32 19200, label %27
i32 38400, label %29
i32 57600, label %31
i32 115200, label %33
]
25: ; preds = %23
%26 = load i32, i32* @B9600
store i32 %26, i32* %8
br label %38
27: ; preds = %23
%28 = load i32, i32* @B19200
store i32 %28, i32* %8
br label %38
29: ; preds = %23
%30 = load i32, i32* @B38400
store i32 %30, i32* %8
br label %38
31: ; preds = %23
%32 = load i32, i32* @B57600
store i32 %32, i32* %8
br label %38
33: ; preds = %23
%34 = load i32, i32* @B115200
store i32 %34, i32* %8
br label %38
35: ; preds = %23
%36 = load i32, i32* %5
%37 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %36)
store i32 -1, i32* %3
br label %112
38: ; preds = %33, %31, %29, %27, %25
%39 = load i32, i32* %8
%40 = call i32 @cfsetospeed(%struct.termios* %7, i32 %39)
%41 = load i32, i32* %8
%42 = call i32 @cfsetispeed(%struct.termios* %7, i32 %41)
%43 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%44 = load i32, i32* %43
%45 = load i32, i32* @CSIZE
%46 = xor i32 %45, -1
%47 = and i32 %44, %46
%48 = load i32, i32* @CS8
%49 = or i32 %47, %48
%50 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
store i32 %49, i32* %50
%51 = load i32, i32* @IGNBRK
%52 = xor i32 %51, -1
%53 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 1
%54 = load i32, i32* %53
%55 = and i32 %54, %52
store i32 %55, i32* %53
%56 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 4
store i64 0, i64* %56
%57 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 3
store i64 0, i64* %57
%58 = load i32, i32* @IXON
%59 = load i32, i32* @IXOFF
%60 = or i32 %58, %59
%61 = load i32, i32* @IXANY
%62 = or i32 %60, %61
%63 = xor i32 %62, -1
%64 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 1
%65 = load i32, i32* %64
%66 = and i32 %65, %63
store i32 %66, i32* %64
%67 = load i32, i32* @CLOCAL
%68 = load i32, i32* @CREAD
%69 = or i32 %67, %68
%70 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%71 = load i32, i32* %70
%72 = or i32 %71, %69
store i32 %72, i32* %70
%73 = load i32, i32* @PARENB
%74 = load i32, i32* @PARODD
%75 = or i32 %73, %74
%76 = xor i32 %75, -1
%77 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%78 = load i32, i32* %77
%79 = and i32 %78, %76
store i32 %79, i32* %77
%80 = load i32, i32* @CSTOPB
%81 = xor i32 %80, -1
%82 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%83 = load i32, i32* %82
%84 = and i32 %83, %81
store i32 %84, i32* %82
%85 = load i32, i32* @CRTSCTS
%86 = xor i32 %85, -1
%87 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%88 = load i32, i32* %87
%89 = and i32 %88, %86
store i32 %89, i32* %87
%90 = load i32, i32* @HUPCL
%91 = xor i32 %90, -1
%92 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%93 = load i32, i32* %92
%94 = and i32 %93, %91
store i32 %94, i32* %92
%95 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 2
%96 = load i32*, i32** %95
%97 = load i64, i64* @VMIN
%98 = getelementptr inbounds i32, i32* %96, i64 %97
store i32 0, i32* %98
%99 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 2
%100 = load i32*, i32** %99
%101 = load i64, i64* @VTIME
%102 = getelementptr inbounds i32, i32* %100, i64 %101
store i32 10, i32* %102
%103 = load i32, i32* %6
%104 = load i32, i32* @TCSANOW
%105 = call i64 @tcsetattr(i32 %103, i32 %104, %struct.termios* %7)
%106 = icmp ne i64 %105, 0
br i1 %106, label %107, label %110
107: ; preds = %38
%108 = load i32, i32* @errno
%109 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %108)
store i32 -1, i32* %3
br label %112
110: ; preds = %38
%111 = load i32, i32* %6
store i32 %111, i32* %3
br label %112
112: ; preds = %110, %107, %35, %20
%113 = load i32, i32* %3
ret i32 %113
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32*, i64, i64 }
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_SYNC = global i32 0
@.str = [25 x i8] c"Error %d from tcgetattr\0A\00"
@errno = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B38400 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@.str.1 = [27 x i8] c"Unsupported baud rate: %d\0A\00"
@CSIZE = global i32 0
@CS8 = global i32 0
@IGNBRK = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@CLOCAL = global i32 0
@CREAD = global i32 0
@PARENB = global i32 0
@PARODD = global i32 0
@CSTOPB = global i32 0
@CRTSCTS = global i32 0
@HUPCL = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
@.str.2 = [34 x i8] c"Error %d setting term attributes\0A\00"
define i32 @serialOpen(i8* nocapture %0, i32 %1) {
%3 = alloca %struct.termios
%4 = load i32, i32* @O_RDWR
%5 = load i32, i32* @O_NOCTTY
%6 = or i32 %5, %4
%7 = load i32, i32* @O_SYNC
%8 = or i32 %6, %7
%9 = tail call i32 @open(i8* %0, i32 %8)
%10 = bitcast %struct.termios* %3 to i8*
%11 = call i32 @memset(%struct.termios* %3, i32 0, i32 32)
%12 = call i64 @tcgetattr(i32 %9, %struct.termios* %3)
%13 = icmp eq i64 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %2
%15 = load i32, i32* @errno
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %76
17: ; preds = %2
switch i32 %1, label %22 [
i32 9600, label %24
i32 19200, label %18
i32 38400, label %19
i32 57600, label %20
i32 115200, label %21
]
18: ; preds = %17
br label %24
19: ; preds = %17
br label %24
20: ; preds = %17
br label %24
21: ; preds = %17
br label %24
22: ; preds = %17
%23 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %76
24: ; preds = %17, %21, %20, %19, %18
%25 = phi i32* [ @B115200, %21 ], [ @B57600, %20 ], [ @B38400, %19 ], [ @B19200, %18 ], [ @B9600, %17 ]
%26 = load i32, i32* %25
%27 = call i32 @cfsetospeed(%struct.termios* %3, i32 %26)
%28 = call i32 @cfsetispeed(%struct.termios* %3, i32 %26)
%29 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 0
%30 = load i32, i32* %29
%31 = load i32, i32* @CSIZE
%32 = xor i32 %31, -1
%33 = and i32 %30, %32
%34 = load i32, i32* @CS8
%35 = or i32 %33, %34
%36 = load i32, i32* @IGNBRK
%37 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 1
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 3
%40 = bitcast i64* %39 to i8*
%41 = load i32, i32* @IXON
%42 = load i32, i32* @IXOFF
%43 = or i32 %42, %41
%44 = load i32, i32* @IXANY
%45 = or i32 %43, %44
%46 = or i32 %36, %45
%47 = xor i32 %46, -1
%48 = and i32 %38, %47
store i32 %48, i32* %37
%49 = load i32, i32* @CLOCAL
%50 = load i32, i32* @CREAD
%51 = or i32 %49, %35
%52 = or i32 %51, %50
%53 = load i32, i32* @PARENB
%54 = load i32, i32* @PARODD
%55 = or i32 %54, %53
%56 = load i32, i32* @CSTOPB
%57 = or i32 %55, %56
%58 = load i32, i32* @CRTSCTS
%59 = or i32 %57, %58
%60 = load i32, i32* @HUPCL
%61 = or i32 %59, %60
%62 = xor i32 %61, -1
%63 = and i32 %52, %62
store i32 %63, i32* %29
%64 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 2
%65 = load i32*, i32** %64
%66 = load i64, i64* @VMIN
%67 = getelementptr inbounds i32, i32* %65, i64 %66
store i32 0, i32* %67
%68 = load i64, i64* @VTIME
%69 = getelementptr inbounds i32, i32* %65, i64 %68
store i32 10, i32* %69
%70 = load i32, i32* @TCSANOW
%71 = call i64 @tcsetattr(i32 %9, i32 %70, %struct.termios* %3)
%72 = icmp eq i64 %71, 0
br i1 %72, label %76, label %73
73: ; preds = %24
%74 = load i32, i32* @errno
%75 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %22, %73, %24, %14
%77 = phi i32 [ -1, %14 ], [ -1, %22 ], [ -1, %73 ], [ %9, %24 ]
ret i32 %77
}