#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_iflag;
  int c_lflag;
  int c_cflag;
  int *c_cc;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ B57600;
int BRKINT;
int CS8;
int CSIZE;
int ECHO;
int ECHONL;
int ICANON;
int ICRNL;
int IEXTEN;
int IGNBRK;
int INLCR;
int INPCK;
int ISIG;
int ISTRIP;
int IXON;
int O_NOCTTY;
int O_RDONLY;
int PARENB;
int PARMRK;
int /*<<< orphan*/ TCSAFLUSH;
size_t VMIN;
size_t VTIME;
scalar_t__ cfsetispeed(struct termios *, int /*<<< orphan*/);
scalar_t__ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int open(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
scalar_t__ tcgetattr(int, struct termios *);
scalar_t__ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int main(void) {
  int serial_fd = open("/dev/ttyACM0", O_RDONLY | O_NOCTTY);
  struct termios config;
  if (tcgetattr(serial_fd, &config) < 0)
    exit(1);
  config.c_iflag &=
      ~(IGNBRK | BRKINT | ICRNL | INLCR | PARMRK | INPCK | ISTRIP | IXON);
  config.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
  config.c_cflag &= ~(CSIZE | PARENB);
  config.c_cflag |= CS8;
  config.c_cc[VMIN] = 1;
  config.c_cc[VTIME] = 0;
  if (cfsetispeed(&config, B57600) < 0 || cfsetospeed(&config, B57600) < 0)
    exit(1);
  if (tcsetattr(serial_fd, TCSAFLUSH, &config) < 0)
    exit(1);
  FILE *serial = fdopen(serial_fd, "r");
  setbuf(stdout, NULL);
  setbuf(serial, NULL);
  char l[255];
  while (1) {
    if (fgets(l, 255, serial) == NULL)
      return 0;
    char *c = l;
    int spaces = 0;
    while (*c != 0) {
      if ((*c < '0' || *c > '9') && *c != '\r' && *c != ' ')
        *c = '\n';
      if (*c == '\r') {
        *c = '\n';
        *(c + 1) = '\0';
        break;
      }
      if (*c == ' ')
        spaces++;
      c++;
    }
    if (spaces == 5)
      printf("%s", l);
  }
  return 42;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%esi
mov    0x2da6(%rip),%rax
or     (%rax),%esi
lea    0xe35(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1080 <tcgetattr@plt>
cmp    $0x0,%rax
jge    11f3 <main+0x53>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2d46(%rip),%rax
mov    (%rax),%eax
mov    0x2d9d(%rip),%rcx
or     (%rcx),%eax
mov    0x2dd4(%rip),%rcx
or     (%rcx),%eax
mov    0x2dc3(%rip),%rcx
or     (%rcx),%eax
mov    0x2dd2(%rip),%rcx
or     (%rcx),%eax
mov    0x2d39(%rip),%rcx
or     (%rcx),%eax
mov    0x2d28(%rip),%rcx
or     (%rcx),%eax
mov    0x2d87(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d65(%rip),%rax
mov    (%rax),%eax
mov    0x2cfc(%rip),%rcx
or     (%rcx),%eax
mov    0x2cd3(%rip),%rcx
or     (%rcx),%eax
mov    0x2d12(%rip),%rcx
or     (%rcx),%eax
mov    0x2d39(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d07(%rip),%rax
mov    (%rax),%eax
mov    0x2d2e(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2cfc(%rip),%rax
mov    (%rax),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ce1(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
mov    0x2c74(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdi
call   10b0 <cfsetispeed@plt>
cmp    $0x0,%rax
jl     1306 <main+0x166>
mov    0x2c8f(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdi
call   1030 <cfsetospeed@plt>
cmp    $0x0,%rax
jge    1310 <main+0x170>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    0x2cb6(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1090 <tcsetattr@plt>
cmp    $0x0,%rax
jge    1339 <main+0x199>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x8(%rbp),%edi
lea    0xcca(%rip),%rsi
call   1070 <fdopen@plt>
mov    %rax,-0x28(%rbp)
mov    0x2bf5(%rip),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
mov    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0xff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
jne    1396 <main+0x1f6>
xor    %eax,%eax
add    $0x140,%rsp
pop    %rbp
ret
lea    -0x130(%rbp),%rax
mov    %rax,-0x138(%rbp)
movl   $0x0,-0x13c(%rbp)
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     147d <main+0x2dd>
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     13e7 <main+0x247>
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    1417 <main+0x277>
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     1417 <main+0x277>
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1417 <main+0x277>
mov    -0x138(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
jne    1444 <main+0x2a4>
mov    -0x138(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x138(%rbp),%rax
movb   $0x0,0x1(%rax)
jmp    147d <main+0x2dd>
mov    -0x138(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1466 <main+0x2c6>
mov    -0x13c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13c(%rbp)
mov    -0x138(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x138(%rbp)
jmp    13ae <main+0x20e>
cmpl   $0x5,-0x13c(%rbp)
jne    149d <main+0x2fd>
lea    -0x130(%rbp),%rsi
lea    0xb77(%rip),%rdi
call   1050 <printf@plt>
jmp    136c <main+0x1cc>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x120,%rsp
mov    0x2e12(%rip),%rax
mov    0x2dab(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0xe38(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,%ebp
lea    0x8(%rsp),%rsi
mov    %eax,%edi
call   1080 <tcgetattr@plt>
test   %rax,%rax
js     13f7 <main+0x257>
mov    0x2d55(%rip),%rax
mov    0x2dae(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2de3(%rip),%rax
or     (%rax),%ecx
mov    0x2dd2(%rip),%rax
or     (%rax),%ecx
mov    0x2de1(%rip),%rax
or     (%rax),%ecx
mov    0x2d48(%rip),%rax
or     (%rax),%ecx
mov    0x2d37(%rip),%rax
or     (%rax),%ecx
mov    0x2d96(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0x8(%rsp)
mov    0x2d77(%rip),%rax
mov    0x2d10(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2ce5(%rip),%rax
or     (%rax),%ecx
mov    0x2d24(%rip),%rax
or     (%rax),%ecx
mov    0x2d4b(%rip),%rax
or     (%rax),%ecx
not    %ecx
and    %ecx,0xc(%rsp)
mov    0x2d1c(%rip),%rax
mov    0x2d45(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
not    %ecx
and    0x10(%rsp),%ecx
mov    0x2d14(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x10(%rsp)
mov    0x18(%rsp),%rax
mov    0x2cfa(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2c91(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2cc8(%rip),%rbx
mov    (%rbx),%esi
lea    0x8(%rsp),%rdi
call   10b0 <cfsetispeed@plt>
test   %rax,%rax
js     13f7 <main+0x257>
mov    (%rbx),%esi
lea    0x8(%rsp),%rdi
call   1030 <cfsetospeed@plt>
test   %rax,%rax
js     13f7 <main+0x257>
mov    0x2ce7(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebp,%edi
call   1090 <tcsetattr@plt>
test   %rax,%rax
js     13f7 <main+0x257>
lea    0xd06(%rip),%rsi
mov    %ebp,%edi
call   1070 <fdopen@plt>
mov    %rax,%rbx
mov    0x2c30(%rip),%rax
mov    (%rax),%rdi
xor    %esi,%esi
call   1040 <setbuf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <setbuf@plt>
lea    0x20(%rsp),%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13e5 <main+0x245>
lea    0x21(%rsp),%r12
lea    0x20(%rsp),%r14
lea    0xcb7(%rip),%r15
jmp    1375 <main+0x1d5>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0xff,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13e5 <main+0x245>
mov    0x20(%rsp),%dl
test   %dl,%dl
je     1360 <main+0x1c0>
xor    %eax,%eax
mov    %r12,%rcx
jmp    139e <main+0x1fe>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
movzbl (%rcx),%edx
add    $0x1,%rcx
test   %dl,%dl
je     13d0 <main+0x230>
lea    -0x3a(%rdx),%esi
cmp    $0xf5,%sil
ja     13c0 <main+0x220>
cmp    $0x20,%dl
je     1390 <main+0x1f0>
cmp    $0xd,%dl
je     13ca <main+0x22a>
movb   $0xa,-0x1(%rcx)
jmp    1393 <main+0x1f3>
nopw   0x0(%rax,%rax,1)
cmp    $0x20,%dl
je     1390 <main+0x1f0>
cmp    $0xd,%dl
jne    1393 <main+0x1f3>
movw   $0xa,-0x1(%rcx)
cmp    $0x5,%eax
jne    1360 <main+0x1c0>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <printf@plt>
jmp    1360 <main+0x1c0>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i32* }
@.str = [13 x i8] c"/dev/ttyACM0\00"
@O_RDONLY = global i32 0
@O_NOCTTY = global i32 0
@IGNBRK = global i32 0
@BRKINT = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@PARMRK = global i32 0
@INPCK = global i32 0
@ISTRIP = global i32 0
@IXON = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@ICANON = global i32 0
@IEXTEN = global i32 0
@ISIG = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@B57600 = global i32 0
@TCSAFLUSH = global i32 0
@.str.1 = [2 x i8] c"r\00"
@stdout = global i32* null
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.termios
%4 = alloca i32*
%5 = alloca [255 x i8]
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %1
%8 = load i32, i32* @O_RDONLY
%9 = load i32, i32* @O_NOCTTY
%10 = or i32 %8, %9
%11 = call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = call i64 @tcgetattr(i32 %12, %struct.termios* %3)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %0
%18 = load i32, i32* @IGNBRK
%19 = load i32, i32* @BRKINT
%20 = or i32 %18, %19
%21 = load i32, i32* @ICRNL
%22 = or i32 %20, %21
%23 = load i32, i32* @INLCR
%24 = or i32 %22, %23
%25 = load i32, i32* @PARMRK
%26 = or i32 %24, %25
%27 = load i32, i32* @INPCK
%28 = or i32 %26, %27
%29 = load i32, i32* @ISTRIP
%30 = or i32 %28, %29
%31 = load i32, i32* @IXON
%32 = or i32 %30, %31
%33 = xor i32 %32, -1
%34 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%35 = load i32, i32* %34
%36 = and i32 %35, %33
store i32 %36, i32* %34
%37 = load i32, i32* @ECHO
%38 = load i32, i32* @ECHONL
%39 = or i32 %37, %38
%40 = load i32, i32* @ICANON
%41 = or i32 %39, %40
%42 = load i32, i32* @IEXTEN
%43 = or i32 %41, %42
%44 = load i32, i32* @ISIG
%45 = or i32 %43, %44
%46 = xor i32 %45, -1
%47 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 1
%48 = load i32, i32* %47
%49 = and i32 %48, %46
store i32 %49, i32* %47
%50 = load i32, i32* @CSIZE
%51 = load i32, i32* @PARENB
%52 = or i32 %50, %51
%53 = xor i32 %52, -1
%54 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 2
%55 = load i32, i32* %54
%56 = and i32 %55, %53
store i32 %56, i32* %54
%57 = load i32, i32* @CS8
%58 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 2
%59 = load i32, i32* %58
%60 = or i32 %59, %57
store i32 %60, i32* %58
%61 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 3
%62 = load i32*, i32** %61
%63 = load i64, i64* @VMIN
%64 = getelementptr inbounds i32, i32* %62, i64 %63
store i32 1, i32* %64
%65 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 3
%66 = load i32*, i32** %65
%67 = load i64, i64* @VTIME
%68 = getelementptr inbounds i32, i32* %66, i64 %67
store i32 0, i32* %68
%69 = load i32, i32* @B57600
%70 = call i64 @cfsetispeed(%struct.termios* %3, i32 %69)
%71 = icmp slt i64 %70, 0
br i1 %71, label %76, label %72
72: ; preds = %17
%73 = load i32, i32* @B57600
%74 = call i64 @cfsetospeed(%struct.termios* %3, i32 %73)
%75 = icmp slt i64 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %72, %17
%77 = call i32 @exit(i32 1)
unreachable
78: ; preds = %72
%79 = load i32, i32* %2
%80 = load i32, i32* @TCSAFLUSH
%81 = call i64 @tcsetattr(i32 %79, i32 %80, %struct.termios* %3)
%82 = icmp slt i64 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %78
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %78
%86 = load i32, i32* %2
%87 = call i32* @fdopen(i32 %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %87, i32** %4
%88 = load i32*, i32** @stdout
%89 = call i32 @setbuf(i32* %88, i32* null)
%90 = load i32*, i32** %4
%91 = call i32 @setbuf(i32* %90, i32* null)
br label %92
92: ; preds = %85, %153
%93 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%94 = load i32*, i32** %4
%95 = call i32* @fgets(i8* %93, i32 255, i32* %94)
%96 = icmp eq i32* %95, null
br i1 %96, label %97, label %98
97: ; preds = %92
ret i32 0
98: ; preds = %92
%99 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
store i8* %99, i8** %6
store i32 0, i32* %7
br label %100
100: ; preds = %144, %98
%101 = load i8*, i8** %6
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp ne i32 %103, 0
br i1 %104, label %105, label %147
105: ; preds = %100
%106 = load i8*, i8** %6
%107 = load i8, i8* %106
%108 = sext i8 %107 to i32
%109 = icmp slt i32 %108, 48
br i1 %109, label %115, label %110
110: ; preds = %105
%111 = load i8*, i8** %6
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp sgt i32 %113, 57
br i1 %114, label %115, label %127
115: ; preds = %110, %105
%116 = load i8*, i8** %6
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp ne i32 %118, 13
br i1 %119, label %120, label %127
120: ; preds = %115
%121 = load i8*, i8** %6
%122 = load i8, i8* %121
%123 = sext i8 %122 to i32
%124 = icmp ne i32 %123, 32
br i1 %124, label %125, label %127
125: ; preds = %120
%126 = load i8*, i8** %6
store i8 10, i8* %126
br label %127
127: ; preds = %125, %120, %115, %110
%128 = load i8*, i8** %6
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp eq i32 %130, 13
br i1 %131, label %132, label %136
132: ; preds = %127
%133 = load i8*, i8** %6
store i8 10, i8* %133
%134 = load i8*, i8** %6
%135 = getelementptr inbounds i8, i8* %134, i64 1
store i8 0, i8* %135
br label %147
136: ; preds = %127
%137 = load i8*, i8** %6
%138 = load i8, i8* %137
%139 = sext i8 %138 to i32
%140 = icmp eq i32 %139, 32
br i1 %140, label %141, label %144
141: ; preds = %136
%142 = load i32, i32* %7
%143 = add nsw i32 %142, 1
store i32 %143, i32* %7
br label %144
144: ; preds = %141, %136
%145 = load i8*, i8** %6
%146 = getelementptr inbounds i8, i8* %145, i32 1
store i8* %146, i8** %6
br label %100
147: ; preds = %132, %100
%148 = load i32, i32* %7
%149 = icmp eq i32 %148, 5
br i1 %149, label %150, label %153
150: ; preds = %147
%151 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%152 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %151)
br label %153
153: ; preds = %150, %147
br label %92
}

LLVM IR (-O2):
%struct.termios = type { i32, i32, i32, i32* }
@.str = [13 x i8] c"/dev/ttyACM0\00"
@O_RDONLY = global i32 0
@O_NOCTTY = global i32 0
@IGNBRK = global i32 0
@BRKINT = global i32 0
@ICRNL = global i32 0
@INLCR = global i32 0
@PARMRK = global i32 0
@INPCK = global i32 0
@ISTRIP = global i32 0
@IXON = global i32 0
@ECHO = global i32 0
@ECHONL = global i32 0
@ICANON = global i32 0
@IEXTEN = global i32 0
@ISIG = global i32 0
@CSIZE = global i32 0
@PARENB = global i32 0
@CS8 = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@B57600 = global i32 0
@TCSAFLUSH = global i32 0
@.str.1 = [2 x i8] c"r\00"
@stdout = global i32* null
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca %struct.termios
%2 = alloca [255 x i8]
%3 = load i32, i32* @O_RDONLY
%4 = load i32, i32* @O_NOCTTY
%5 = or i32 %4, %3
%6 = tail call i32 @open(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = bitcast %struct.termios* %1 to i8*
%8 = call i64 @tcgetattr(i32 %6, %struct.termios* %1)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
%13 = load i32, i32* @IGNBRK
%14 = load i32, i32* @BRKINT
%15 = or i32 %14, %13
%16 = load i32, i32* @ICRNL
%17 = or i32 %15, %16
%18 = load i32, i32* @INLCR
%19 = or i32 %17, %18
%20 = load i32, i32* @PARMRK
%21 = or i32 %19, %20
%22 = load i32, i32* @INPCK
%23 = or i32 %21, %22
%24 = load i32, i32* @ISTRIP
%25 = or i32 %23, %24
%26 = load i32, i32* @IXON
%27 = or i32 %25, %26
%28 = xor i32 %27, -1
%29 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%30 = load i32, i32* %29
%31 = and i32 %30, %28
store i32 %31, i32* %29
%32 = load i32, i32* @ECHO
%33 = load i32, i32* @ECHONL
%34 = or i32 %33, %32
%35 = load i32, i32* @ICANON
%36 = or i32 %34, %35
%37 = load i32, i32* @IEXTEN
%38 = or i32 %36, %37
%39 = load i32, i32* @ISIG
%40 = or i32 %38, %39
%41 = xor i32 %40, -1
%42 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 1
%43 = load i32, i32* %42
%44 = and i32 %43, %41
store i32 %44, i32* %42
%45 = load i32, i32* @CSIZE
%46 = load i32, i32* @PARENB
%47 = or i32 %46, %45
%48 = xor i32 %47, -1
%49 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 2
%50 = load i32, i32* %49
%51 = and i32 %50, %48
%52 = load i32, i32* @CS8
%53 = or i32 %52, %51
store i32 %53, i32* %49
%54 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 3
%55 = load i32*, i32** %54
%56 = load i64, i64* @VMIN
%57 = getelementptr inbounds i32, i32* %55, i64 %56
store i32 1, i32* %57
%58 = load i64, i64* @VTIME
%59 = getelementptr inbounds i32, i32* %55, i64 %58
store i32 0, i32* %59
%60 = load i32, i32* @B57600
%61 = call i64 @cfsetispeed(%struct.termios* %1, i32 %60)
%62 = icmp slt i64 %61, 0
br i1 %62, label %67, label %63
63: ; preds = %12
%64 = load i32, i32* @B57600
%65 = call i64 @cfsetospeed(%struct.termios* %1, i32 %64)
%66 = icmp slt i64 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %63, %12
%68 = call i32 @exit(i32 1)
unreachable
69: ; preds = %63
%70 = load i32, i32* @TCSAFLUSH
%71 = call i64 @tcsetattr(i32 %6, i32 %70, %struct.termios* %1)
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %69
%76 = call i32* @fdopen(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%77 = load i32*, i32** @stdout
%78 = call i32 @setbuf(i32* %77, i32* null)
%79 = call i32 @setbuf(i32* %76, i32* null)
%80 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%81 = call i32* @fgets(i8* %80, i32 255, i32* %76)
%82 = icmp eq i32* %81, null
br i1 %82, label %86, label %83
83: ; preds = %75, %110
%84 = load i8, i8* %80
%85 = icmp eq i8 %84, 0
br i1 %85, label %110, label %87
86: ; preds = %110, %75
ret i32 0
87: ; preds = %83, %100
%88 = phi i8 [ %103, %100 ], [ %84, %83 ]
%89 = phi i32 [ %101, %100 ], [ 0, %83 ]
%90 = phi i8* [ %102, %100 ], [ %80, %83 ]
%91 = add i8 %88, -58
%92 = icmp ult i8 %91, -10
br i1 %92, label %93, label %95
93: ; preds = %87
switch i8 %88, label %94 [
i8 13, label %96
i8 32, label %98
]
94: ; preds = %93
store i8 10, i8* %90
br label %100
95: ; preds = %87
switch i8 %88, label %100 [
i8 13, label %96
i8 32, label %98
]
96: ; preds = %93, %95
store i8 10, i8* %90
%97 = getelementptr inbounds i8, i8* %90, i64 1
store i8 0, i8* %97
br label %105
98: ; preds = %93, %95
%99 = add nsw i32 %89, 1
br label %100
100: ; preds = %94, %95, %98
%101 = phi i32 [ %99, %98 ], [ %89, %95 ], [ %89, %94 ]
%102 = getelementptr inbounds i8, i8* %90, i64 1
%103 = load i8, i8* %102
%104 = icmp eq i8 %103, 0
br i1 %104, label %105, label %87
105: ; preds = %100, %96
%106 = phi i32 [ %89, %96 ], [ %101, %100 ]
%107 = icmp eq i32 %106, 5
br i1 %107, label %108, label %110
108: ; preds = %105
%109 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %80)
br label %110
110: ; preds = %83, %108, %105
%111 = call i32* @fgets(i8* %80, i32 255, i32* %76)
%112 = icmp eq i32* %111, null
br i1 %112, label %86, label %83
}