#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;
};

/* Variables and functions */
int /*<<< orphan*/ 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*/ TCIFLUSH;
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*/ close(int);
int open(char *, int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char **, int);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
void main(void) {
  int fd;
  printf("\n +----------------------------------+");
  printf("\n |        Serial Port Read          |");
  printf("\n +----------------------------------+");
  fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY);
  if (fd == -1)
    printf("\n  Error! in Opening ttyUSB0  ");
  else
    printf("\n  ttyUSB0 Opened Successfully ");
  struct termios SerialPortSettings;
  tcgetattr(fd, &SerialPortSettings);
  cfsetispeed(&SerialPortSettings, B9600);
  cfsetospeed(&SerialPortSettings, B9600);
  SerialPortSettings.c_cflag &= ~PARENB;
  SerialPortSettings.c_cflag &= ~CSTOPB;
  SerialPortSettings.c_cflag &= ~CSIZE;
  SerialPortSettings.c_cflag |= CS8;
  SerialPortSettings.c_cflag &= ~CRTSCTS;
  SerialPortSettings.c_cflag |= CREAD | CLOCAL;
  SerialPortSettings.c_iflag &= ~(IXON | IXOFF | IXANY);
  SerialPortSettings.c_iflag &= ~(ICANON | ECHO | ECHOE | ISIG);
  SerialPortSettings.c_oflag &= ~OPOST;
  SerialPortSettings.c_cc[VMIN] = 10;
  SerialPortSettings.c_cc[VTIME] = 0;
  if ((tcsetattr(fd, TCSANOW, &SerialPortSettings)) != 0)
    printf("\n  ERROR ! in Setting attributes");
  else
    printf("\n  BaudRate = 9600 \n  StopBits = 1 \n  Parity   = none");
  tcflush(fd, TCIFLUSH);
  char read_buffer[32];
  int bytes_read = 0;
  int i = 0;
  bytes_read = read(fd, &read_buffer, 32);
  printf("\n\n  Bytes Rxed -%d", bytes_read);
  printf("\n\n  ");
  for (i = 0; i < bytes_read; i++)
    printf("%c", read_buffer[i]);
  printf("\n +----------------------------------+\n\n\n");
  close(fd);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
mov    0x2d8e(%rip),%rax
or     (%rax),%esi
lea    0xe73(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1200 <main+0x70>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    120e <main+0x7e>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1080 <tcgetattr@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdi
call   10b0 <cfsetispeed@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdi
call   1030 <cfsetospeed@plt>
mov    0x2d83(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2ce1(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cb6(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cfc(%rip),%rax
mov    (%rax),%eax
mov    0x2c8b(%rip),%rcx
or     (%rcx),%eax
or     -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d1c(%rip),%rax
mov    (%rax),%eax
mov    0x2d23(%rip),%rcx
or     (%rcx),%eax
mov    0x2caa(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2c78(%rip),%rax
mov    (%rax),%eax
mov    0x2cd7(%rip),%rcx
or     (%rcx),%eax
mov    0x2cc6(%rip),%rcx
or     (%rcx),%eax
mov    0x2cb5(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2cd3(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    0x2c6d(%rip),%rcx
mov    (%rcx),%rcx
movl   $0xa,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
mov    0x2c28(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x4(%rbp),%edi
mov    0x2c7c(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1090 <tcsetattr@plt>
cmp    $0x0,%rax
je     136c <main+0x1dc>
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    137a <main+0x1ea>
lea    0xd48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
mov    0x2be4(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x20,%edx
call   1070 <read@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%esi
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1404 <main+0x274>
movslq -0x48(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%esi
lea    0xd1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    13d3 <main+0x243>
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <close@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0xe3f(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2dfe(%rip),%rax
mov    0x2d6f(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe52(%rip),%rdi
call   10c0 <open@plt>
mov    %eax,%r15d
cmp    $0xffffffff,%eax
lea    0xe4d(%rip),%rax
lea    0xe65(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x8(%rsp),%r14
mov    %r15d,%edi
mov    %r14,%rsi
call   10a0 <tcgetattr@plt>
mov    0x2d69(%rip),%rbx
mov    (%rbx),%esi
mov    %r14,%rdi
call   10d0 <cfsetispeed@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1050 <cfsetospeed@plt>
mov    0x2d76(%rip),%rax
mov    (%rax),%eax
mov    0x2cdd(%rip),%rcx
or     (%rcx),%eax
mov    0x2d1c(%rip),%rcx
or     (%rcx),%eax
not    %eax
and    0x8(%rsp),%eax
mov    0x2d1d(%rip),%rcx
or     (%rcx),%eax
mov    0x2cc4(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %eax,%ecx
mov    0x2d0f(%rip),%rax
or     (%rax),%ecx
mov    0x2c9e(%rip),%rax
or     (%rax),%ecx
mov    0x2d35(%rip),%rax
mov    0x2d3e(%rip),%rdx
mov    (%rdx),%edx
or     (%rax),%edx
mov    0x2cc3(%rip),%rax
or     (%rax),%edx
mov    0x2c9a(%rip),%rax
mov    0x2cfb(%rip),%rsi
mov    (%rsi),%esi
or     (%rax),%esi
mov    %ecx,0x8(%rsp)
mov    0x2ce4(%rip),%rax
or     (%rax),%esi
mov    0x2cd3(%rip),%rax
or     (%rax),%esi
or     %edx,%esi
not    %esi
and    %esi,0xc(%rsp)
mov    0x2cf2(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x18(%rsp)
mov    0x10(%rsp),%rax
mov    0x2c8e(%rip),%rcx
mov    (%rcx),%rcx
movl   $0xa,(%rax,%rcx,4)
mov    0x2c4d(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2ca4(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
mov    %r14,%rdx
call   10b0 <tcsetattr@plt>
test   %rax,%rax
lea    0xd88(%rip),%rax
lea    0xd60(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2c1c(%rip),%rax
mov    (%rax),%esi
mov    %r15d,%edi
call   1060 <tcflush@plt>
lea    0x20(%rsp),%rsi
mov    %r15d,%edi
mov    $0x20,%edx
call   1090 <read@plt>
mov    %eax,%ebp
lea    0xd80(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd83(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
test   %ebp,%ebp
jle    13a3 <main+0x1f3>
mov    %ebp,%ebp
xor    %ebx,%ebx
movsbl 0x20(%rsp,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1390 <main+0x1e0>
lea    0xd5f(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%edi
call   1080 <close@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32*, i32 }
@.str = [39 x i8] c"\0A +----------------------------------+\00"
@.str.1 = [39 x i8] c"\0A | Serial Port Read |\00"
@.str.2 = [13 x i8] c"/dev/ttyUSB0\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@.str.3 = [31 x i8] c"\0A Error! in Opening ttyUSB0 \00"
@.str.4 = [32 x i8] c"\0A ttyUSB0 Opened Successfully \00"
@B9600 = 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.5 = [33 x i8] c"\0A ERROR ! in Setting attributes\00"
@.str.6 = [54 x i8] c"\0A BaudRate = 9600 \0A StopBits = 1 \0A Parity = none\00"
@TCIFLUSH = global i32 0
@.str.7 = [19 x i8] c"\0A\0A Bytes Rxed -%d\00"
@.str.8 = [5 x i8] c"\0A\0A \00"
@.str.9 = [3 x i8] c"%c\00"
@.str.10 = [42 x i8] c"\0A +----------------------------------+\0A\0A\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca %struct.termios
%3 = alloca [32 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @O_RDWR
%10 = load i32, i32* @O_NOCTTY
%11 = or i32 %9, %10
%12 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %11)
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = load i32, i32* %1
%21 = call i32 @tcgetattr(i32 %20, %struct.termios* %2)
%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 = load i32, i32* @PARENB
%27 = xor i32 %26, -1
%28 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 0
%29 = load i32, i32* %28
%30 = and i32 %29, %27
store i32 %30, i32* %28
%31 = load i32, i32* @CSTOPB
%32 = xor i32 %31, -1
%33 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 0
%34 = load i32, i32* %33
%35 = and i32 %34, %32
store i32 %35, i32* %33
%36 = load i32, i32* @CSIZE
%37 = xor i32 %36, -1
%38 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 0
%39 = load i32, i32* %38
%40 = and i32 %39, %37
store i32 %40, i32* %38
%41 = load i32, i32* @CS8
%42 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 0
%43 = load i32, i32* %42
%44 = or i32 %43, %41
store i32 %44, i32* %42
%45 = load i32, i32* @CRTSCTS
%46 = xor i32 %45, -1
%47 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 0
%48 = load i32, i32* %47
%49 = and i32 %48, %46
store i32 %49, i32* %47
%50 = load i32, i32* @CREAD
%51 = load i32, i32* @CLOCAL
%52 = or i32 %50, %51
%53 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 0
%54 = load i32, i32* %53
%55 = or i32 %54, %52
store i32 %55, i32* %53
%56 = load i32, i32* @IXON
%57 = load i32, i32* @IXOFF
%58 = or i32 %56, %57
%59 = load i32, i32* @IXANY
%60 = or i32 %58, %59
%61 = xor i32 %60, -1
%62 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 1
%63 = load i32, i32* %62
%64 = and i32 %63, %61
store i32 %64, i32* %62
%65 = load i32, i32* @ICANON
%66 = load i32, i32* @ECHO
%67 = or i32 %65, %66
%68 = load i32, i32* @ECHOE
%69 = or i32 %67, %68
%70 = load i32, i32* @ISIG
%71 = or i32 %69, %70
%72 = xor i32 %71, -1
%73 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 1
%74 = load i32, i32* %73
%75 = and i32 %74, %72
store i32 %75, i32* %73
%76 = load i32, i32* @OPOST
%77 = xor i32 %76, -1
%78 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 3
%79 = load i32, i32* %78
%80 = and i32 %79, %77
store i32 %80, i32* %78
%81 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 2
%82 = load i32*, i32** %81
%83 = load i64, i64* @VMIN
%84 = getelementptr inbounds i32, i32* %82, i64 %83
store i32 10, i32* %84
%85 = getelementptr inbounds %struct.termios, %struct.termios* %2, i32 0, i32 2
%86 = load i32*, i32** %85
%87 = load i64, i64* @VTIME
%88 = getelementptr inbounds i32, i32* %86, i64 %87
store i32 0, i32* %88
%89 = load i32, i32* %1
%90 = load i32, i32* @TCSANOW
%91 = call i64 @tcsetattr(i32 %89, i32 %90, %struct.termios* %2)
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %19
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
br label %97
95: ; preds = %19
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0))
br label %97
97: ; preds = %95, %93
%98 = load i32, i32* %1
%99 = load i32, i32* @TCIFLUSH
%100 = call i32 @tcflush(i32 %98, i32 %99)
store i32 0, i32* %4
store i32 0, i32* %5
%101 = load i32, i32* %1
%102 = bitcast [32 x i8]* %3 to i8**
%103 = call i32 @read(i32 %101, i8** %102, i32 32)
store i32 %103, i32* %4
%104 = load i32, i32* %4
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %104)
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %5
br label %107
107: ; preds = %118, %97
%108 = load i32, i32* %5
%109 = load i32, i32* %4
%110 = icmp slt i32 %108, %109
br i1 %110, label %111, label %121
111: ; preds = %107
%112 = load i32, i32* %5
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 %113
%115 = load i8, i8* %114
%116 = sext i8 %115 to i32
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %116)
br label %118
118: ; preds = %111
%119 = load i32, i32* %5
%120 = add nsw i32 %119, 1
store i32 %120, i32* %5
br label %107
121: ; preds = %107
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
%123 = load i32, i32* %1
%124 = call i32 @close(i32 %123)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32*, i32 }
@.str = [39 x i8] c"\0A +----------------------------------+\00"
@.str.1 = [39 x i8] c"\0A | Serial Port Read |\00"
@.str.2 = [13 x i8] c"/dev/ttyUSB0\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@.str.3 = [31 x i8] c"\0A Error! in Opening ttyUSB0 \00"
@.str.4 = [32 x i8] c"\0A ttyUSB0 Opened Successfully \00"
@B9600 = 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.5 = [33 x i8] c"\0A ERROR ! in Setting attributes\00"
@.str.6 = [54 x i8] c"\0A BaudRate = 9600 \0A StopBits = 1 \0A Parity = none\00"
@TCIFLUSH = global i32 0
@.str.7 = [19 x i8] c"\0A\0A Bytes Rxed -%d\00"
@.str.8 = [5 x i8] c"\0A\0A \00"
@str = [41 x i8] c"\0A +----------------------------------+\0A\0A\00"
define void @main() {
%1 = alloca %struct.termios
%2 = alloca [32 x i8]
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @O_RDWR
%7 = load i32, i32* @O_NOCTTY
%8 = or i32 %7, %6
%9 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %9, -1
%11 = select i1 %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %11)
%13 = bitcast %struct.termios* %1 to i8*
%14 = call i32 @tcgetattr(i32 %9, %struct.termios* %1)
%15 = load i32, i32* @B9600
%16 = call i32 @cfsetispeed(%struct.termios* %1, i32 %15)
%17 = load i32, i32* @B9600
%18 = call i32 @cfsetospeed(%struct.termios* %1, i32 %17)
%19 = load i32, i32* @PARENB
%20 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%21 = load i32, i32* %20
%22 = load i32, i32* @CSTOPB
%23 = or i32 %19, %22
%24 = load i32, i32* @CSIZE
%25 = or i32 %23, %24
%26 = xor i32 %25, -1
%27 = and i32 %21, %26
%28 = load i32, i32* @CS8
%29 = or i32 %28, %27
%30 = load i32, i32* @CRTSCTS
%31 = xor i32 %30, -1
%32 = and i32 %29, %31
%33 = load i32, i32* @CREAD
%34 = load i32, i32* @CLOCAL
%35 = or i32 %33, %32
%36 = or i32 %35, %34
store i32 %36, i32* %20
%37 = load i32, i32* @IXON
%38 = load i32, i32* @IXOFF
%39 = or i32 %38, %37
%40 = load i32, i32* @IXANY
%41 = or i32 %39, %40
%42 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%43 = load i32, i32* %42
%44 = load i32, i32* @ICANON
%45 = load i32, i32* @ECHO
%46 = or i32 %45, %44
%47 = load i32, i32* @ECHOE
%48 = or i32 %46, %47
%49 = load i32, i32* @ISIG
%50 = or i32 %48, %49
%51 = or i32 %41, %50
%52 = xor i32 %51, -1
%53 = and i32 %43, %52
store i32 %53, i32* %42
%54 = load i32, i32* @OPOST
%55 = xor i32 %54, -1
%56 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 3
%57 = load i32, i32* %56
%58 = and i32 %57, %55
store i32 %58, i32* %56
%59 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 2
%60 = load i32*, i32** %59
%61 = load i64, i64* @VMIN
%62 = getelementptr inbounds i32, i32* %60, i64 %61
store i32 10, i32* %62
%63 = load i64, i64* @VTIME
%64 = getelementptr inbounds i32, i32* %60, i64 %63
store i32 0, i32* %64
%65 = load i32, i32* @TCSANOW
%66 = call i64 @tcsetattr(i32 %9, i32 %65, %struct.termios* %1)
%67 = icmp eq i64 %66, 0
%68 = select i1 %67, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %68)
%70 = load i32, i32* @TCIFLUSH
%71 = call i32 @tcflush(i32 %9, i32 %70)
%72 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%73 = bitcast [32 x i8]* %2 to i8**
%74 = call i32 @read(i32 %9, i8** %73, i32 32)
%75 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %74)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%77 = icmp sgt i32 %74, 0
br i1 %77, label %78, label %88
78: ; preds = %0
%79 = zext i32 %74 to i64
br label %80
80: ; preds = %78, %80
%81 = phi i64 [ 0, %78 ], [ %86, %80 ]
%82 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = call i32 @putchar(i32 %84)
%86 = add nuw nsw i64 %81, 1
%87 = icmp eq i64 %86, %79
br i1 %87, label %88, label %80
88: ; preds = %80, %0
%89 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%90 = call i32 @close(i32 %9)
ret void
}