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

/* Variables and functions */
int /*<<< orphan*/ B19200;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS7;
int CSIZE;
int CSTOPB;
int IGNCR;
int IGNPAR;
int IXANY;
int IXOFF;
int IXON;
int /*<<< orphan*/ ONLCR;
int /*<<< orphan*/ O_RDWR;
int PARENB;
int PARODD;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ bzero(struct termios *, int);
scalar_t__ cfsetispeed(struct termios *, int /*<<< orphan*/);
scalar_t__ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ isatty(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int write(int, char const *, int);
int main(void) {
  int fd = open("/dev/ttyUSB0", O_RDWR);
  const char *buf = "s0c\n";
  int res;
  struct termios newtio;
  printf("port %d opened->", fd);
  printf("Setting port %d params->", fd);
  if (!isatty(fd)) {
    printf("port %d is not a tty\n", fd);
    return -1;
  }
  bzero(&newtio, sizeof(newtio));
  if (cfsetispeed(&newtio, B19200) < 0 || cfsetospeed(&newtio, B19200) < 0) {
    printf("Impossible to set baud rates of port %d\n", fd);
    return -1;
  }
  newtio.c_cflag |= PARENB;
  newtio.c_cflag &= ~PARODD;
  newtio.c_cflag &= ~CSTOPB;
  newtio.c_cflag &= ~CSIZE;
  newtio.c_cflag |= CS7;
  newtio.c_cflag |= (CREAD | CLOCAL);
  newtio.c_cflag &= ~CRTSCTS;
  newtio.c_lflag = 0;
  newtio.c_iflag |= IGNCR;
  newtio.c_iflag |= IGNPAR;
  newtio.c_iflag &= ~(IXON | IXOFF | IXANY);
  newtio.c_oflag |= ONLCR;
  newtio.c_cc[VMIN] = 13;
  newtio.c_cc[VTIME] = 1;
  tcflush(fd, TCIFLUSH);
  if (tcsetattr(fd, TCSANOW, &newtio) < 0) {
    printf("Unsable to apply given port settings\n");
    return -1;
  }
  printf("succeed in setting port %d params\n", fd);
  res = write(fd, buf, 4);
  printf("write res = %d", res);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e2a(%rip),%rax
mov    (%rax),%esi
lea    0xe41(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x8(%rbp)
lea    0xe3f(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <isatty@plt>
cmp    $0x0,%eax
jne    1222 <main+0x82>
mov    -0x8(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1415 <main+0x275>
lea    -0x38(%rbp),%rdi
mov    $0x20,%esi
call   10c0 <bzero@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdi
call   10b0 <cfsetispeed@plt>
cmp    $0x0,%rax
jl     1268 <main+0xc8>
mov    0x2d9d(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdi
call   1050 <cfsetospeed@plt>
cmp    $0x0,%rax
jge    1285 <main+0xe5>
mov    -0x8(%rbp),%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1415 <main+0x275>
mov    0x2d34(%rip),%rax
mov    (%rax),%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2ca3(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2cd9(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c77(%rip),%rax
mov    (%rax),%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2cc8(%rip),%rax
mov    (%rax),%eax
mov    0x2c57(%rip),%rcx
or     (%rcx),%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2c60(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2cbe(%rip),%rax
mov    (%rax),%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    0x2c47(%rip),%rax
mov    (%rax),%eax
or     -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    0x2c98(%rip),%rax
mov    (%rax),%eax
mov    0x2c9f(%rip),%rcx
or     (%rcx),%eax
mov    0x2c46(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    0x2c24(%rip),%rax
mov    (%rax),%eax
or     -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    0x2c39(%rip),%rcx
mov    (%rcx),%rcx
movl   $0xd,(%rax,%rcx,4)
mov    -0x30(%rbp),%rax
mov    0x2bf4(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%edi
mov    0x2bf0(%rip),%rax
mov    (%rax),%esi
call   1060 <tcflush@plt>
mov    -0x8(%rbp),%edi
mov    0x2c17(%rip),%rax
mov    (%rax),%esi
lea    -0x38(%rbp),%rdx
call   1090 <tcsetattr@plt>
cmp    $0x0,%rax
jge    13d0 <main+0x230>
lea    0xcbe(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1415 <main+0x275>
mov    -0x8(%rbp),%esi
lea    0xcc7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1040 <write@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xcc5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x8(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    0x2e21(%rip),%rax
mov    (%rax),%esi
lea    0xe38(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,%ebx
lea    0xe3c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %ebx,%edi
call   1040 <isatty@plt>
test   %eax,%eax
je     1378 <main+0x1c8>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x20,%esi
call   10d0 <bzero@plt>
mov    0x2ddb(%rip),%r14
mov    (%r14),%esi
mov    %rbp,%rdi
call   10c0 <cfsetispeed@plt>
test   %rax,%rax
js     136f <main+0x1bf>
mov    (%r14),%esi
mov    %rsp,%rdi
call   1060 <cfsetospeed@plt>
test   %rax,%rax
js     136f <main+0x1bf>
mov    0x2d7c(%rip),%rax
mov    (%rsp),%ecx
or     (%rax),%ecx
mov    0x2d60(%rip),%rax
mov    (%rax),%edx
mov    0x2cf7(%rip),%rax
or     (%rax),%edx
mov    0x2d36(%rip),%rax
or     (%rax),%edx
not    %edx
and    %ecx,%edx
mov    0x2cd9(%rip),%rax
or     (%rax),%edx
mov    0x4(%rsp),%eax
mov    0x2d2c(%rip),%rcx
or     (%rcx),%edx
mov    0x2cbb(%rip),%rcx
or     (%rcx),%edx
mov    0x2cca(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %edx,%ecx
mov    %ecx,(%rsp)
movq   $0x0,0x18(%rsp)
mov    0x2d29(%rip),%rcx
or     (%rcx),%eax
mov    0x2cb8(%rip),%rcx
or     (%rcx),%eax
mov    0x2d0f(%rip),%rcx
mov    0x2d18(%rip),%rdx
mov    (%rdx),%edx
or     (%rcx),%edx
mov    0x2cbd(%rip),%rcx
or     (%rcx),%edx
not    %edx
and    %eax,%edx
mov    %edx,0x4(%rsp)
mov    0x2c9c(%rip),%rax
mov    (%rax),%eax
or     %eax,0x10(%rsp)
mov    0x8(%rsp),%rax
mov    0x2cb2(%rip),%rcx
mov    (%rcx),%rcx
movl   $0xd,(%rax,%rcx,4)
mov    0x2c71(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2c70(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1070 <tcflush@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %ebx,%edi
call   10a0 <tcsetattr@plt>
test   %rax,%rax
js     1398 <main+0x1e8>
lea    0xd43(%rip),%rdi
xor    %ebp,%ebp
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xcc3(%rip),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1050 <write@plt>
lea    0xd41(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %ebx,%edi
call   1090 <close@plt>
jmp    138d <main+0x1dd>
lea    0xcdc(%rip),%rdi
jmp    137f <main+0x1cf>
lea    0xcbd(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xd0e(%rip),%rdi
call   1030 <puts@plt>
jmp    1388 <main+0x1d8>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32*, i32, i64 }
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@O_RDWR = global i32 0
@.str.1 = [5 x i8] c"s0c\0A\00"
@.str.2 = [17 x i8] c"port %d opened->\00"
@.str.3 = [25 x i8] c"Setting port %d params->\00"
@.str.4 = [22 x i8] c"port %d is not a tty\0A\00"
@B19200 = global i32 0
@.str.5 = [41 x i8] c"Impossible to set baud rates of port %d\0A\00"
@PARENB = global i32 0
@PARODD = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS7 = global i32 0
@CREAD = global i32 0
@CLOCAL = global i32 0
@CRTSCTS = global i32 0
@IGNCR = global i32 0
@IGNPAR = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ONLCR = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.6 = [38 x i8] c"Unsable to apply given port settings\0A\00"
@.str.7 = [35 x i8] c"succeed in setting port %d params\0A\00"
@.str.8 = [15 x i8] c"write res = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.termios
store i32 0, i32* %1
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 %7, i32* %2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %3
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @isatty(i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %0
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %16)
store i32 -1, i32* %1
br label %114
18: ; preds = %0
%19 = call i32 @bzero(%struct.termios* %5, i32 32)
%20 = load i32, i32* @B19200
%21 = call i64 @cfsetispeed(%struct.termios* %5, i32 %20)
%22 = icmp slt i64 %21, 0
br i1 %22, label %27, label %23
23: ; preds = %18
%24 = load i32, i32* @B19200
%25 = call i64 @cfsetospeed(%struct.termios* %5, i32 %24)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23, %18
%28 = load i32, i32* %2
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %28)
store i32 -1, i32* %1
br label %114
30: ; preds = %23
%31 = load i32, i32* @PARENB
%32 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%33 = load i32, i32* %32
%34 = or i32 %33, %31
store i32 %34, i32* %32
%35 = load i32, i32* @PARODD
%36 = xor i32 %35, -1
%37 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%38 = load i32, i32* %37
%39 = and i32 %38, %36
store i32 %39, i32* %37
%40 = load i32, i32* @CSTOPB
%41 = xor i32 %40, -1
%42 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%43 = load i32, i32* %42
%44 = and i32 %43, %41
store i32 %44, i32* %42
%45 = load i32, i32* @CSIZE
%46 = xor i32 %45, -1
%47 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%48 = load i32, i32* %47
%49 = and i32 %48, %46
store i32 %49, i32* %47
%50 = load i32, i32* @CS7
%51 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%52 = load i32, i32* %51
%53 = or i32 %52, %50
store i32 %53, i32* %51
%54 = load i32, i32* @CREAD
%55 = load i32, i32* @CLOCAL
%56 = or i32 %54, %55
%57 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%58 = load i32, i32* %57
%59 = or i32 %58, %56
store i32 %59, i32* %57
%60 = load i32, i32* @CRTSCTS
%61 = xor i32 %60, -1
%62 = getelementptr inbounds %struct.termios, %struct.termios* %5, 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* %5, i32 0, i32 4
store i64 0, i64* %65
%66 = load i32, i32* @IGNCR
%67 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 1
%68 = load i32, i32* %67
%69 = or i32 %68, %66
store i32 %69, i32* %67
%70 = load i32, i32* @IGNPAR
%71 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 1
%72 = load i32, i32* %71
%73 = or i32 %72, %70
store i32 %73, i32* %71
%74 = load i32, i32* @IXON
%75 = load i32, i32* @IXOFF
%76 = or i32 %74, %75
%77 = load i32, i32* @IXANY
%78 = or i32 %76, %77
%79 = xor i32 %78, -1
%80 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 1
%81 = load i32, i32* %80
%82 = and i32 %81, %79
store i32 %82, i32* %80
%83 = load i32, i32* @ONLCR
%84 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 3
%85 = load i32, i32* %84
%86 = or i32 %85, %83
store i32 %86, i32* %84
%87 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 2
%88 = load i32*, i32** %87
%89 = load i64, i64* @VMIN
%90 = getelementptr inbounds i32, i32* %88, i64 %89
store i32 13, i32* %90
%91 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 2
%92 = load i32*, i32** %91
%93 = load i64, i64* @VTIME
%94 = getelementptr inbounds i32, i32* %92, i64 %93
store i32 1, i32* %94
%95 = load i32, i32* %2
%96 = load i32, i32* @TCIFLUSH
%97 = call i32 @tcflush(i32 %95, i32 %96)
%98 = load i32, i32* %2
%99 = load i32, i32* @TCSANOW
%100 = call i64 @tcsetattr(i32 %98, i32 %99, %struct.termios* %5)
%101 = icmp slt i64 %100, 0
br i1 %101, label %102, label %104
102: ; preds = %30
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %1
br label %114
104: ; preds = %30
%105 = load i32, i32* %2
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %105)
%107 = load i32, i32* %2
%108 = load i8*, i8** %3
%109 = call i32 @write(i32 %107, i8* %108, i32 4)
store i32 %109, i32* %4
%110 = load i32, i32* %4
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %110)
%112 = load i32, i32* %2
%113 = call i32 @close(i32 %112)
store i32 0, i32* %1
br label %114
114: ; preds = %104, %102, %27, %15
%115 = load i32, i32* %1
ret i32 %115
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32*, i32, i64 }
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@O_RDWR = global i32 0
@.str.1 = [5 x i8] c"s0c\0A\00"
@.str.2 = [17 x i8] c"port %d opened->\00"
@.str.3 = [25 x i8] c"Setting port %d params->\00"
@.str.4 = [22 x i8] c"port %d is not a tty\0A\00"
@B19200 = global i32 0
@.str.5 = [41 x i8] c"Impossible to set baud rates of port %d\0A\00"
@PARENB = global i32 0
@PARODD = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS7 = global i32 0
@CREAD = global i32 0
@CLOCAL = global i32 0
@CRTSCTS = global i32 0
@IGNCR = global i32 0
@IGNPAR = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ONLCR = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.7 = [35 x i8] c"succeed in setting port %d params\0A\00"
@.str.8 = [15 x i8] c"write res = %d\00"
@str = [37 x i8] c"Unsable to apply given port settings\00"
define i32 @main() {
%1 = alloca %struct.termios
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = bitcast %struct.termios* %1 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i32 %3)
%7 = tail call i32 @isatty(i32 %3)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %3)
br label %79
11: ; preds = %0
%12 = call i32 @bzero(%struct.termios* %1, i32 32)
%13 = load i32, i32* @B19200
%14 = call i64 @cfsetispeed(%struct.termios* %1, i32 %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %11
%17 = load i32, i32* @B19200
%18 = call i64 @cfsetospeed(%struct.termios* %1, i32 %17)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16, %11
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i32 %3)
br label %79
22: ; preds = %16
%23 = load i32, i32* @PARENB
%24 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%25 = load i32, i32* %24
%26 = or i32 %25, %23
%27 = load i32, i32* @PARODD
%28 = load i32, i32* @CSTOPB
%29 = or i32 %27, %28
%30 = load i32, i32* @CSIZE
%31 = or i32 %29, %30
%32 = xor i32 %31, -1
%33 = and i32 %26, %32
%34 = load i32, i32* @CS7
%35 = or i32 %34, %33
%36 = load i32, i32* @CREAD
%37 = load i32, i32* @CLOCAL
%38 = or i32 %36, %35
%39 = or i32 %38, %37
%40 = load i32, i32* @CRTSCTS
%41 = xor i32 %40, -1
%42 = and i32 %39, %41
store i32 %42, i32* %24
%43 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 4
store i64 0, i64* %43
%44 = load i32, i32* @IGNCR
%45 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%46 = load i32, i32* %45
%47 = or i32 %46, %44
%48 = load i32, i32* @IGNPAR
%49 = or i32 %48, %47
%50 = load i32, i32* @IXON
%51 = load i32, i32* @IXOFF
%52 = or i32 %51, %50
%53 = load i32, i32* @IXANY
%54 = or i32 %52, %53
%55 = xor i32 %54, -1
%56 = and i32 %49, %55
store i32 %56, i32* %45
%57 = load i32, i32* @ONLCR
%58 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 3
%59 = load i32, i32* %58
%60 = or i32 %59, %57
store i32 %60, i32* %58
%61 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 2
%62 = load i32*, i32** %61
%63 = load i64, i64* @VMIN
%64 = getelementptr inbounds i32, i32* %62, i64 %63
store i32 13, i32* %64
%65 = load i64, i64* @VTIME
%66 = getelementptr inbounds i32, i32* %62, i64 %65
store i32 1, i32* %66
%67 = load i32, i32* @TCIFLUSH
%68 = call i32 @tcflush(i32 %3, i32 %67)
%69 = load i32, i32* @TCSANOW
%70 = call i64 @tcsetattr(i32 %3, i32 %69, %struct.termios* %1)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %22
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %79
74: ; preds = %22
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %3)
%76 = call i32 @write(i32 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %76)
%78 = call i32 @close(i32 %3)
br label %79
79: ; preds = %74, %72, %20, %9
%80 = phi i32 [ -1, %20 ], [ -1, %72 ], [ 0, %74 ], [ -1, %9 ]
ret i32 %80
}