#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_cc;
  int /*<<< orphan*/ c_iflag;
};

/* Variables and functions */
int CS7;
int CS8;
int CSIZE;
int CSTOPB;
int /*<<< orphan*/ INPCK;
int PARENB;
int PARODD;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int Serial_Set_Parity(int fd, int databits, int stopbits, int parity) {
  struct termios options;
  if (tcgetattr(fd, &options) != 0) {
    perror("SetupSerial 1");
    return 0;
    ;
  }
  options.c_cflag &= ~CSIZE;
  switch (databits) {
  case 7:
    options.c_cflag |= CS7;
    break;
  case 8:
    options.c_cflag |= CS8;
    break;
  default:
    fprintf(stderr, "Unsupported data size\n");
    return 0;
    ;
  }
  switch (parity) {
  case 'n':
  case 'N':
    options.c_cflag &= ~PARENB;
    options.c_iflag &= ~INPCK;
    break;
  case 'o':
  case 'O':
    options.c_cflag |= (PARODD | PARENB);
    options.c_iflag |= INPCK;
    break;
  case 'e':
  case 'E':
    options.c_cflag |= PARENB;
    options.c_cflag &= ~PARODD;
    options.c_iflag |= INPCK;
    break;
  case 'S':
  case 's':
    options.c_cflag &= ~PARENB;
    options.c_cflag &= ~CSTOPB;
    break;
  default:
    fprintf(stderr, "Unsupported parity\n");
    return 0;
    ;
  }
  switch (stopbits) {
  case 1:
    options.c_cflag &= ~CSTOPB;
    break;
  case 2:
    options.c_cflag |= CSTOPB;
    break;
  default:
    fprintf(stderr, "Unsupported stop bits\n");
    return 0;
    ;
  }
  if (parity != 'n')
    options.c_iflag |= INPCK;
  tcflush(fd, TCIFLUSH);
  options.c_cc[VTIME] = 150;
  options.c_cc[VMIN] = 0;
  if (tcsetattr(fd, TCSANOW, &options) != 0) {
    perror("SetupSerial 3");
    return 0;
    ;
  }
  return 1;
  ;
}


x86 assembly (clang, -O0):
<Serial_Set_Parity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <tcgetattr@plt>
cmp    $0x0,%rax
je     1192 <Serial_Set_Parity+0x42>
lea    0xf3b(%rip),%rdi
call   1070 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    1413 <Serial_Set_Parity+0x2c3>
mov    0x2e27(%rip),%rax
mov    (%rax),%ecx
not    %ecx
mov    -0x30(%rbp),%eax
and    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
sub    $0x7,%eax
je     11ca <Serial_Set_Parity+0x7a>
jmp    11b9 <Serial_Set_Parity+0x69>
mov    -0x34(%rbp),%eax
sub    $0x8,%eax
je     11de <Serial_Set_Parity+0x8e>
jmp    11f2 <Serial_Set_Parity+0xa2>
mov    0x2daf(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1213 <Serial_Set_Parity+0xc3>
mov    0x2deb(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1213 <Serial_Set_Parity+0xc3>
mov    0x2daf(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1413 <Serial_Set_Parity+0x2c3>
mov    -0x14(%rbp),%eax
add    $0xffffffbb,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x2e,%eax
ja     12ef <Serial_Set_Parity+0x19f>
mov    -0x40(%rbp),%rax
lea    0xdcd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d4b(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1310 <Serial_Set_Parity+0x1c0>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
mov    0x2d73(%rip),%rcx
or     (%rcx),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d1c(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1310 <Serial_Set_Parity+0x1c0>
mov    0x2d50(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2ce7(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1310 <Serial_Set_Parity+0x1c0>
mov    0x2d1b(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2ca9(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1310 <Serial_Set_Parity+0x1c0>
mov    0x2cb2(%rip),%rax
mov    (%rax),%edi
lea    0xde2(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1413 <Serial_Set_Parity+0x2c3>
mov    -0x10(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x1,%eax
je     1335 <Serial_Set_Parity+0x1e5>
jmp    1324 <Serial_Set_Parity+0x1d4>
mov    -0x44(%rbp),%eax
sub    $0x2,%eax
je     134c <Serial_Set_Parity+0x1fc>
jmp    1360 <Serial_Set_Parity+0x210>
mov    0x2c4c(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1381 <Serial_Set_Parity+0x231>
mov    0x2c35(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    1381 <Serial_Set_Parity+0x231>
mov    0x2c41(%rip),%rax
mov    (%rax),%edi
lea    0xd85(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1413 <Serial_Set_Parity+0x2c3>
cmpl   $0x6e,-0x14(%rbp)
je     139a <Serial_Set_Parity+0x24a>
mov    0x2c0e(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2c0c(%rip),%rax
mov    (%rax),%esi
call   1030 <tcflush@plt>
mov    -0x28(%rbp),%rax
mov    0x2be2(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x96,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    0x2bfd(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%edi
mov    0x2c01(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1060 <tcsetattr@plt>
cmp    $0x0,%rax
je     140c <Serial_Set_Parity+0x2bc>
lea    0xd11(%rip),%rdi
call   1070 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    1413 <Serial_Set_Parity+0x2c3>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Serial_Set_Parity>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
mov    %rsp,%rsi
call   1050 <tcgetattr@plt>
test   %rax,%rax
jne    1327 <Serial_Set_Parity+0x1d7>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
not    %eax
and    (%rsp),%eax
mov    %eax,(%rsp)
cmp    $0x7,%ebp
je     1199 <Serial_Set_Parity+0x49>
cmp    $0x8,%ebp
jne    11da <Serial_Set_Parity+0x8a>
mov    0x2e39(%rip),%rcx
jmp    11a0 <Serial_Set_Parity+0x50>
mov    0x2de0(%rip),%rcx
or     (%rcx),%eax
mov    %eax,(%rsp)
lea    -0x45(%r14),%ecx
cmp    $0x2e,%ecx
ja     1310 <Serial_Set_Parity+0x1c0>
lea    0xe47(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    0x2e1f(%rip),%rcx
or     (%rcx),%eax
mov    0x2e06(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %ecx,%eax
jmp    122d <Serial_Set_Parity+0xdd>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1333 <Serial_Set_Parity+0x1e3>
mov    0x2ded(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %ecx,%eax
mov    %eax,(%rsp)
mov    0x2d95(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %ecx,0x10(%rsp)
cmp    $0x2,%r15d
jne    1243 <Serial_Set_Parity+0xf3>
jmp    1291 <Serial_Set_Parity+0x141>
mov    0x2db6(%rip),%rcx
mov    0x2dbf(%rip),%rdx
or     (%rcx),%eax
or     (%rdx),%eax
mov    %eax,(%rsp)
mov    0x2d69(%rip),%rcx
mov    (%rcx),%ecx
or     %ecx,0x10(%rsp)
cmp    $0x2,%r15d
je     1291 <Serial_Set_Parity+0x141>
cmp    $0x1,%r15d
jne    1258 <Serial_Set_Parity+0x108>
mov    0x2d38(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %ecx,%eax
jmp    129a <Serial_Set_Parity+0x14a>
mov    0x2d49(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1333 <Serial_Set_Parity+0x1e3>
mov    0x2d6f(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2d06(%rip),%rdx
or     (%rdx),%ecx
not    %ecx
and    %ecx,%eax
mov    %eax,(%rsp)
cmp    $0x2,%r15d
jne    1243 <Serial_Set_Parity+0xf3>
mov    0x2cf0(%rip),%rcx
or     (%rcx),%eax
mov    %eax,(%rsp)
cmp    $0x6e,%r14d
je     12b0 <Serial_Set_Parity+0x160>
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
or     %eax,0x10(%rsp)
mov    0x2cf9(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <tcflush@plt>
mov    0x8(%rsp),%rax
mov    0x2ccc(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x96,(%rax,%rcx,4)
mov    0x2ceb(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
mov    %ebx,%edi
call   1060 <tcsetattr@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1335 <Serial_Set_Parity+0x1e5>
lea    0xdfe(%rip),%rdi
jmp    132e <Serial_Set_Parity+0x1de>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
lea    0xdc1(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1333 <Serial_Set_Parity+0x1e3>
lea    0xd8e(%rip),%rdi
call   1070 <perror@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32*, i32 }
@.str = [14 x i8] c"SetupSerial 1\00"
@CSIZE = global i32 0
@CS7 = global i32 0
@CS8 = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unsupported data size\0A\00"
@PARENB = global i32 0
@INPCK = global i32 0
@PARODD = global i32 0
@CSTOPB = global i32 0
@.str.2 = [20 x i8] c"Unsupported parity\0A\00"
@.str.3 = [23 x i8] c"Unsupported stop bits\0A\00"
@TCIFLUSH = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCSANOW = global i32 0
@.str.4 = [14 x i8] c"SetupSerial 3\00"
define i32 @Serial_Set_Parity(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca %struct.termios
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%11 = load i32, i32* %6
%12 = call i64 @tcgetattr(i32 %11, %struct.termios* %10)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %131
16: ; preds = %4
%17 = load i32, i32* @CSIZE
%18 = xor i32 %17, -1
%19 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%20 = load i32, i32* %19
%21 = and i32 %20, %18
store i32 %21, i32* %19
%22 = load i32, i32* %7
switch i32 %22, label %33 [
i32 7, label %23
i32 8, label %28
]
23: ; preds = %16
%24 = load i32, i32* @CS7
%25 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%26 = load i32, i32* %25
%27 = or i32 %26, %24
store i32 %27, i32* %25
br label %36
28: ; preds = %16
%29 = load i32, i32* @CS8
%30 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%31 = load i32, i32* %30
%32 = or i32 %31, %29
store i32 %32, i32* %30
br label %36
33: ; preds = %16
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %131
36: ; preds = %28, %23
%37 = load i32, i32* %9
switch i32 %37, label %85 [
i32 110, label %38
i32 78, label %38
i32 111, label %49
i32 79, label %49
i32 101, label %60
i32 69, label %60
i32 83, label %74
i32 115, label %74
]
38: ; preds = %36, %36
%39 = load i32, i32* @PARENB
%40 = xor i32 %39, -1
%41 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%42 = load i32, i32* %41
%43 = and i32 %42, %40
store i32 %43, i32* %41
%44 = load i32, i32* @INPCK
%45 = xor i32 %44, -1
%46 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 2
%47 = load i32, i32* %46
%48 = and i32 %47, %45
store i32 %48, i32* %46
br label %88
49: ; preds = %36, %36
%50 = load i32, i32* @PARODD
%51 = load i32, i32* @PARENB
%52 = or i32 %50, %51
%53 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%54 = load i32, i32* %53
%55 = or i32 %54, %52
store i32 %55, i32* %53
%56 = load i32, i32* @INPCK
%57 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 2
%58 = load i32, i32* %57
%59 = or i32 %58, %56
store i32 %59, i32* %57
br label %88
60: ; preds = %36, %36
%61 = load i32, i32* @PARENB
%62 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%63 = load i32, i32* %62
%64 = or i32 %63, %61
store i32 %64, i32* %62
%65 = load i32, i32* @PARODD
%66 = xor i32 %65, -1
%67 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%68 = load i32, i32* %67
%69 = and i32 %68, %66
store i32 %69, i32* %67
%70 = load i32, i32* @INPCK
%71 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 2
%72 = load i32, i32* %71
%73 = or i32 %72, %70
store i32 %73, i32* %71
br label %88
74: ; preds = %36, %36
%75 = load i32, i32* @PARENB
%76 = xor i32 %75, -1
%77 = getelementptr inbounds %struct.termios, %struct.termios* %10, 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* %10, i32 0, i32 0
%83 = load i32, i32* %82
%84 = and i32 %83, %81
store i32 %84, i32* %82
br label %88
85: ; preds = %36
%86 = load i32, i32* @stderr
%87 = call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %131
88: ; preds = %74, %60, %49, %38
%89 = load i32, i32* %8
switch i32 %89, label %101 [
i32 1, label %90
i32 2, label %96
]
90: ; preds = %88
%91 = load i32, i32* @CSTOPB
%92 = xor i32 %91, -1
%93 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%94 = load i32, i32* %93
%95 = and i32 %94, %92
store i32 %95, i32* %93
br label %104
96: ; preds = %88
%97 = load i32, i32* @CSTOPB
%98 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 0
%99 = load i32, i32* %98
%100 = or i32 %99, %97
store i32 %100, i32* %98
br label %104
101: ; preds = %88
%102 = load i32, i32* @stderr
%103 = call i32 @fprintf(i32 %102, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %5
br label %131
104: ; preds = %96, %90
%105 = load i32, i32* %9
%106 = icmp ne i32 %105, 110
br i1 %106, label %107, label %112
107: ; preds = %104
%108 = load i32, i32* @INPCK
%109 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 2
%110 = load i32, i32* %109
%111 = or i32 %110, %108
store i32 %111, i32* %109
br label %112
112: ; preds = %107, %104
%113 = load i32, i32* %6
%114 = load i32, i32* @TCIFLUSH
%115 = call i32 @tcflush(i32 %113, i32 %114)
%116 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 1
%117 = load i32*, i32** %116
%118 = load i64, i64* @VTIME
%119 = getelementptr inbounds i32, i32* %117, i64 %118
store i32 150, i32* %119
%120 = getelementptr inbounds %struct.termios, %struct.termios* %10, i32 0, i32 1
%121 = load i32*, i32** %120
%122 = load i64, i64* @VMIN
%123 = getelementptr inbounds i32, i32* %121, i64 %122
store i32 0, i32* %123
%124 = load i32, i32* %6
%125 = load i32, i32* @TCSANOW
%126 = call i64 @tcsetattr(i32 %124, i32 %125, %struct.termios* %10)
%127 = icmp ne i64 %126, 0
br i1 %127, label %128, label %130
128: ; preds = %112
%129 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %5
br label %131
130: ; preds = %112
store i32 1, i32* %5
br label %131
131: ; preds = %130, %128, %101, %85, %33, %14
%132 = load i32, i32* %5
ret i32 %132
}

LLVM IR (-O2):
%struct.termios = type { i32, i32*, i32 }
@.str = [14 x i8] c"SetupSerial 1\00"
@CSIZE = global i32 0
@CS7 = global i32 0
@CS8 = global i32 0
@stderr = global i32 0
@.str.1 = [23 x i8] c"Unsupported data size\0A\00"
@PARENB = global i32 0
@INPCK = global i32 0
@PARODD = global i32 0
@CSTOPB = global i32 0
@.str.2 = [20 x i8] c"Unsupported parity\0A\00"
@.str.3 = [23 x i8] c"Unsupported stop bits\0A\00"
@TCIFLUSH = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCSANOW = global i32 0
@.str.4 = [14 x i8] c"SetupSerial 3\00"
define i32 @Serial_Set_Parity(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.termios
%6 = bitcast %struct.termios* %5 to i8*
%7 = call i64 @tcgetattr(i32 %0, %struct.termios* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %96
11: ; preds = %4
%12 = load i32, i32* @CSIZE
%13 = xor i32 %12, -1
%14 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 0
%15 = load i32, i32* %14
%16 = and i32 %15, %13
store i32 %16, i32* %14
switch i32 %1, label %18 [
i32 7, label %21
i32 8, label %17
]
17: ; preds = %11
br label %21
18: ; preds = %11
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %96
21: ; preds = %11, %17
%22 = phi i32* [ @CS8, %17 ], [ @CS7, %11 ]
%23 = load i32, i32* %22
%24 = or i32 %23, %16
store i32 %24, i32* %14
switch i32 %3, label %59 [
i32 110, label %25
i32 78, label %25
i32 111, label %34
i32 79, label %34
i32 101, label %43
i32 69, label %43
i32 83, label %53
i32 115, label %53
]
25: ; preds = %21, %21
%26 = load i32, i32* @PARENB
%27 = xor i32 %26, -1
%28 = and i32 %24, %27
store i32 %28, i32* %14
%29 = load i32, i32* @INPCK
%30 = xor i32 %29, -1
%31 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 2
%32 = load i32, i32* %31
%33 = and i32 %32, %30
store i32 %33, i32* %31
br label %62
34: ; preds = %21, %21
%35 = load i32, i32* @PARODD
%36 = load i32, i32* @PARENB
%37 = or i32 %35, %24
%38 = or i32 %37, %36
store i32 %38, i32* %14
%39 = load i32, i32* @INPCK
%40 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 2
%41 = load i32, i32* %40
%42 = or i32 %41, %39
store i32 %42, i32* %40
br label %62
43: ; preds = %21, %21
%44 = load i32, i32* @PARENB
%45 = or i32 %44, %24
%46 = load i32, i32* @PARODD
%47 = xor i32 %46, -1
%48 = and i32 %45, %47
store i32 %48, i32* %14
%49 = load i32, i32* @INPCK
%50 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 2
%51 = load i32, i32* %50
%52 = or i32 %51, %49
store i32 %52, i32* %50
br label %62
53: ; preds = %21, %21
%54 = load i32, i32* @PARENB
%55 = load i32, i32* @CSTOPB
%56 = or i32 %54, %55
%57 = xor i32 %56, -1
%58 = and i32 %24, %57
store i32 %58, i32* %14
br label %62
59: ; preds = %21
%60 = load i32, i32* @stderr
%61 = call i32 @fprintf(i32 %60, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %96
62: ; preds = %53, %43, %34, %25
%63 = phi i32 [ %58, %53 ], [ %48, %43 ], [ %38, %34 ], [ %28, %25 ]
switch i32 %2, label %71 [
i32 1, label %64
i32 2, label %68
]
64: ; preds = %62
%65 = load i32, i32* @CSTOPB
%66 = xor i32 %65, -1
%67 = and i32 %63, %66
br label %74
68: ; preds = %62
%69 = load i32, i32* @CSTOPB
%70 = or i32 %63, %69
br label %74
71: ; preds = %62
%72 = load i32, i32* @stderr
%73 = call i32 @fprintf(i32 %72, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %96
74: ; preds = %68, %64
%75 = phi i32 [ %70, %68 ], [ %67, %64 ]
store i32 %75, i32* %14
%76 = icmp eq i32 %3, 110
br i1 %76, label %82, label %77
77: ; preds = %74
%78 = load i32, i32* @INPCK
%79 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 2
%80 = load i32, i32* %79
%81 = or i32 %80, %78
store i32 %81, i32* %79
br label %82
82: ; preds = %77, %74
%83 = load i32, i32* @TCIFLUSH
%84 = call i32 @tcflush(i32 %0, i32 %83)
%85 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 1
%86 = load i32*, i32** %85
%87 = load i64, i64* @VTIME
%88 = getelementptr inbounds i32, i32* %86, i64 %87
store i32 150, i32* %88
%89 = load i64, i64* @VMIN
%90 = getelementptr inbounds i32, i32* %86, i64 %89
store i32 0, i32* %90
%91 = load i32, i32* @TCSANOW
%92 = call i64 @tcsetattr(i32 %0, i32 %91, %struct.termios* %5)
%93 = icmp eq i64 %92, 0
br i1 %93, label %96, label %94
94: ; preds = %82
%95 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %96
96: ; preds = %82, %94, %71, %59, %18, %9
%97 = phi i32 [ 0, %9 ], [ 0, %18 ], [ 0, %59 ], [ 0, %71 ], [ 0, %94 ], [ 1, %82 ]
ret i32 %97
}