#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_lflag;
  int *c_cc;
  int /*<<< orphan*/ c_oflag;
};
typedef int speed_t;

/* Variables and functions */
int B115200;
int B19200;
int B4800;
int B57600;
int B9600;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int CSIZE;
int CSTOPB;
int ECHO;
int ECHOE;
int ICANON;
int ISIG;
int IXANY;
int IXOFF;
int IXON;
int /*<<< orphan*/ OPOST;
int O_NOCTTY;
int O_RDWR;
int PARENB;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ cfsetispeed(struct termios *, int);
int /*<<< orphan*/ cfsetospeed(struct termios *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int open(char const *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
char *strerror(int /*<<< orphan*/);
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int serialport_init(const char *serialport, int baud) {
  struct termios toptions;
  int fd;
  printf("Open %s\n...", serialport);
  fd = open(serialport, O_RDWR | O_NOCTTY);
  if (fd < 0) {
    printf("[%d]: Error: %s\n", 24, strerror(errno));
    exit(-1);
  }
  if (tcgetattr(fd, &toptions) < 0) {
    printf("[%d]: Error: %s\n", 29, strerror(errno));
    exit(-1);
  }
  speed_t brate = baud;
  switch (baud) {
  case 4800:
    brate = B4800;
    break;
  case 9600:
    brate = B9600;
    break;
  case 19200:
    brate = B19200;
    break;
  case 57600:
    brate = B57600;
    break;
  case 115200:
    brate = B115200;
    break;
  }
  cfsetispeed(&toptions, brate);
  cfsetospeed(&toptions, brate);
  toptions.c_cflag &= ~PARENB;
  toptions.c_cflag &= ~CSTOPB;
  toptions.c_cflag &= ~CSIZE;
  toptions.c_cflag |= CS8;
  toptions.c_cflag &= ~CRTSCTS;
  toptions.c_cflag |= CREAD | CLOCAL;
  toptions.c_iflag &= ~(IXON | IXOFF | IXANY);
  toptions.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
  toptions.c_oflag &= ~OPOST;
  toptions.c_cc[VMIN] = 0;
  toptions.c_cc[VTIME] = 20;
  if (tcsetattr(fd, TCSANOW, &toptions) < 0) {
    perror("init_serialport: Couldn't set term attributes");
    exit(-1);
  }
  return fd;
}


x86 assembly (clang, -O0):
<serialport_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
mov    0x2d8b(%rip),%rax
or     (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1207 <serialport_init+0x77>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    %rax,%rdx
lea    0xe1b(%rip),%rdi
mov    $0x18,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1050 <tcgetattr@plt>
cmp    $0x0,%rax
jge    124b <serialport_init+0xbb>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    %rax,%rdx
lea    0xdd7(%rip),%rdi
mov    $0x1d,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x12c0,%eax
je     12b3 <serialport_init+0x123>
jmp    1267 <serialport_init+0xd7>
mov    -0x3c(%rbp),%eax
sub    $0x2580,%eax
je     12c4 <serialport_init+0x134>
jmp    127a <serialport_init+0xea>
mov    -0x3c(%rbp),%eax
sub    $0x4b00,%eax
je     12d5 <serialport_init+0x145>
jmp    128d <serialport_init+0xfd>
mov    -0x3c(%rbp),%eax
sub    $0xe100,%eax
je     12e6 <serialport_init+0x156>
jmp    12a0 <serialport_init+0x110>
mov    -0x3c(%rbp),%eax
sub    $0x1c200,%eax
je     12f7 <serialport_init+0x167>
jmp    1303 <serialport_init+0x173>
mov    0x2cde(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
jmp    1303 <serialport_init+0x173>
mov    0x2cc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
jmp    1303 <serialport_init+0x173>
mov    0x2d14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
jmp    1303 <serialport_init+0x173>
mov    0x2c7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
jmp    1303 <serialport_init+0x173>
mov    0x2c42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    -0x30(%rbp),%rdi
call   1080 <cfsetispeed@plt>
mov    -0x38(%rbp),%esi
lea    -0x30(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    0x2c9e(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2be4(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c2a(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c28(%rip),%rax
mov    (%rax),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2bb9(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c0f(%rip),%rax
mov    (%rax),%eax
mov    0x2b8e(%rip),%rcx
or     (%rcx),%eax
or     -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    0x2c37(%rip),%rax
mov    (%rax),%eax
mov    0x2c3e(%rip),%rcx
or     (%rcx),%eax
mov    0x2bb5(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2b7b(%rip),%rax
mov    (%rax),%eax
mov    0x2bf2(%rip),%rcx
or     (%rcx),%eax
mov    0x2be1(%rip),%rcx
or     (%rcx),%eax
mov    0x2bd0(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x2bee(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2b80(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
mov    0x2b2b(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x14,(%rax,%rcx,4)
mov    -0x34(%rbp),%edi
mov    0x2b97(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1060 <tcsetattr@plt>
cmp    $0x0,%rax
jge    144c <serialport_init+0x2bc>
lea    0xbe0(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialport_init>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xe5c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e2b(%rip),%rax
mov    0x2d94(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    %rbx,%rdi
call   1070 <open@plt>
test   %eax,%eax
js     1348 <serialport_init+0x1b8>
mov    %eax,%ebx
mov    %rsp,%rsi
mov    %eax,%edi
call   1050 <tcgetattr@plt>
test   %rax,%rax
js     1364 <serialport_init+0x1d4>
cmp    $0x4aff,%ebp
jle    120e <serialport_init+0x7e>
cmp    $0x4b00,%ebp
je     1227 <serialport_init+0x97>
cmp    $0xe100,%ebp
je     1230 <serialport_init+0xa0>
cmp    $0x1c200,%ebp
jne    1242 <serialport_init+0xb2>
mov    0x2d34(%rip),%rax
jmp    1240 <serialport_init+0xb0>
cmp    $0x12c0,%ebp
je     1239 <serialport_init+0xa9>
cmp    $0x2580,%ebp
jne    1242 <serialport_init+0xb2>
mov    0x2d6b(%rip),%rax
jmp    1240 <serialport_init+0xb0>
mov    0x2dc2(%rip),%rax
jmp    1240 <serialport_init+0xb0>
mov    0x2d31(%rip),%rax
jmp    1240 <serialport_init+0xb0>
mov    0x2d58(%rip),%rax
mov    (%rax),%ebp
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebp,%esi
call   1080 <cfsetispeed@plt>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <cfsetospeed@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%eax
mov    0x2caf(%rip),%rcx
or     (%rcx),%eax
mov    0x2cfe(%rip),%rcx
or     (%rcx),%eax
not    %eax
and    (%rsp),%eax
mov    0x2d00(%rip),%rcx
or     (%rcx),%eax
mov    0x2c97(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %eax,%ecx
mov    0x2cf2(%rip),%rax
mov    0x2c73(%rip),%rdx
or     (%rax),%ecx
or     (%rdx),%ecx
mov    %ecx,(%rsp)
mov    0x2d1d(%rip),%rax
mov    0x2d26(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2c9b(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x4(%rsp)
mov    0x2c64(%rip),%rax
mov    0x2cdd(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2cca(%rip),%rax
or     (%rax),%ecx
mov    0x2cb9(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x8(%rsp)
mov    0x2cda(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x18(%rsp)
mov    0x10(%rsp),%rax
mov    0x2c6e(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2c1d(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x14,(%rax,%rcx,4)
mov    0x2c8c(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   1060 <tcsetattr@plt>
test   %rax,%rax
js     1392 <serialport_init+0x202>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2bf9(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xcaf(%rip),%rdi
mov    $0x18,%esi
jmp    137e <serialport_init+0x1ee>
mov    0x2bdd(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xc93(%rip),%rdi
mov    $0x1d,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>
lea    0xc84(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%edi
call   10a0 <exit@plt>

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

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32*, i32 }
@.str = [12 x i8] c"Open %s\0A...\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@.str.1 = [17 x i8] c"[%d]: Error: %s\0A\00"
@errno = global i32 0
@B4800 = global i32 0
@B9600 = global i32 0
@B19200 = global i32 0
@B57600 = global i32 0
@B115200 = global i32 0
@PARENB = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@CREAD = global i32 0
@CLOCAL = global i32 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOE = global i32 0
@ISIG = global i32 0
@OPOST = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@TCSANOW = global i32 0
@.str.2 = [46 x i8] c"init_serialport: Couldn't set term attributes\00"
define i32 @serialport_init(i8* %0, i32 %1) {
%3 = alloca %struct.termios
%4 = bitcast %struct.termios* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @O_RDWR
%7 = load i32, i32* @O_NOCTTY
%8 = or i32 %7, %6
%9 = tail call i32 @open(i8* %0, i32 %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* @errno
%13 = tail call i8* @strerror(i32 %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 24, i8* %13)
%15 = tail call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = call i64 @tcgetattr(i32 %9, %struct.termios* %3)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* @errno
%21 = call i8* @strerror(i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 29, i8* %21)
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %16
switch i32 %1, label %35 [
i32 4800, label %25
i32 9600, label %27
i32 19200, label %29
i32 57600, label %31
i32 115200, label %33
]
25: ; preds = %24
%26 = load i32, i32* @B4800
br label %35
27: ; preds = %24
%28 = load i32, i32* @B9600
br label %35
29: ; preds = %24
%30 = load i32, i32* @B19200
br label %35
31: ; preds = %24
%32 = load i32, i32* @B57600
br label %35
33: ; preds = %24
%34 = load i32, i32* @B115200
br label %35
35: ; preds = %24, %33, %31, %29, %27, %25
%36 = phi i32 [ %1, %24 ], [ %34, %33 ], [ %32, %31 ], [ %30, %29 ], [ %28, %27 ], [ %26, %25 ]
%37 = call i32 @cfsetispeed(%struct.termios* %3, i32 %36)
%38 = call i32 @cfsetospeed(%struct.termios* %3, i32 %36)
%39 = load i32, i32* @PARENB
%40 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 0
%41 = load i32, i32* %40
%42 = load i32, i32* @CSTOPB
%43 = or i32 %39, %42
%44 = load i32, i32* @CSIZE
%45 = or i32 %43, %44
%46 = xor i32 %45, -1
%47 = and i32 %41, %46
%48 = load i32, i32* @CS8
%49 = or i32 %48, %47
%50 = load i32, i32* @CRTSCTS
%51 = xor i32 %50, -1
%52 = and i32 %49, %51
%53 = load i32, i32* @CREAD
%54 = load i32, i32* @CLOCAL
%55 = or i32 %53, %52
%56 = or i32 %55, %54
store i32 %56, i32* %40
%57 = load i32, i32* @IXON
%58 = load i32, i32* @IXOFF
%59 = or i32 %58, %57
%60 = load i32, i32* @IXANY
%61 = or i32 %59, %60
%62 = xor i32 %61, -1
%63 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 1
%64 = load i32, i32* %63
%65 = and i32 %64, %62
store i32 %65, i32* %63
%66 = load i32, i32* @ICANON
%67 = load i32, i32* @ECHO
%68 = or i32 %67, %66
%69 = load i32, i32* @ECHOE
%70 = or i32 %68, %69
%71 = load i32, i32* @ISIG
%72 = or i32 %70, %71
%73 = xor i32 %72, -1
%74 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 2
%75 = load i32, i32* %74
%76 = and i32 %75, %73
store i32 %76, i32* %74
%77 = load i32, i32* @OPOST
%78 = xor i32 %77, -1
%79 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 4
%80 = load i32, i32* %79
%81 = and i32 %80, %78
store i32 %81, i32* %79
%82 = getelementptr inbounds %struct.termios, %struct.termios* %3, i64 0, i32 3
%83 = load i32*, i32** %82
%84 = load i64, i64* @VMIN
%85 = getelementptr inbounds i32, i32* %83, i64 %84
store i32 0, i32* %85
%86 = load i64, i64* @VTIME
%87 = getelementptr inbounds i32, i32* %83, i64 %86
store i32 20, i32* %87
%88 = load i32, i32* @TCSANOW
%89 = call i64 @tcsetattr(i32 %9, i32 %88, %struct.termios* %3)
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %94
91: ; preds = %35
%92 = call i32 @perror(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%93 = call i32 @exit(i32 -1)
unreachable
94: ; preds = %35
ret i32 %9
}