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

/* Variables and functions */
int ECHO;
int ICANON;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ TCSANOW;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
char getc(int /*<<< orphan*/ *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int /*<<< orphan*/ tcsetattr(int, int /*<<< orphan*/, struct termios *);
int main(int argc, char *argv[]) {
  int tty_fd = open("/dev/tty", O_RDONLY);
  printf("regular reading\n");
  while (1) {
    char c;
    int b = read(tty_fd, &c, 1);
    if (b < 1) {
      printf("nothing read\n");
      continue;
    }
    printf("%c\n", c);
    fflush(stdout);
    if (c == '\n') {
      break;
    }
  }
  struct termios termios_struct;
  struct termios orig_termios_struct;
  tcgetattr(tty_fd, &orig_termios_struct);
  tcgetattr(tty_fd, &termios_struct);
  termios_struct.c_lflag &= (~ICANON) & (~ECHO);
  termios_struct.c_cc[VTIME] = 0;
  termios_struct.c_cc[VMIN] = 1;
  tcsetattr(tty_fd, TCSANOW, &termios_struct);
  sleep(1);
  printf("changed reading\n");
  while (1) {
    char c;
    int b = read(tty_fd, &c, 1);
    if (b < 1) {
      printf("nothing read\n");
      continue;
    }
    printf("%c\n", c);
    fflush(stdout);
    if (c == '\n') {
      break;
    }
  }
  while (1) {
    FILE *tty_file = fdopen(tty_fd, "r");
    char c = getc(tty_file);
    printf("%c\n", c);
    fflush(stdout);
    if (c == '\n') {
      break;
    }
  }
  printf("regular reading\n");
  tcsetattr(tty_fd, TCSANOW, &orig_termios_struct);
  while (1) {
    char c;
    int b = read(tty_fd, &c, 1);
    if (b < 1) {
      printf("nothing read\n");
      continue;
    }
    printf("%c\n", c);
    fflush(stdout);
    if (c == '\n') {
      break;
    }
  }
  close(tty_fd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e1b(%rip),%rax
mov    (%rax),%esi
lea    0xe2a(%rip),%rdi
call   10a0 <open@plt>
mov    %eax,-0x14(%rbp)
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x15(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jge    121d <main+0x6d>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <main+0x3c>
movsbl -0x15(%rbp),%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
movsbl -0x15(%rbp),%eax
cmp    $0xa,%eax
jne    124f <main+0x9f>
jmp    1254 <main+0xa4>
jmp    11ec <main+0x3c>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1080 <tcgetattr@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1080 <tcgetattr@plt>
mov    0x2d3d(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
mov    0x2d59(%rip),%rcx
mov    (%rcx),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
and    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2d21(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x28(%rbp),%rax
mov    0x2d24(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x14(%rbp),%edi
mov    0x2d20(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1090 <tcsetattr@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x41(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x1,-0x48(%rbp)
jge    1314 <main+0x164>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12e3 <main+0x133>
movsbl -0x41(%rbp),%esi
lea    0xd09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
movsbl -0x41(%rbp),%eax
cmp    $0xa,%eax
jne    1346 <main+0x196>
jmp    134b <main+0x19b>
jmp    12e3 <main+0x133>
jmp    1350 <main+0x1a0>
mov    -0x14(%rbp),%edi
lea    0xce3(%rip),%rsi
call   1070 <fdopen@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
call   10d0 <getc@plt>
mov    %al,-0x51(%rbp)
movsbl -0x51(%rbp),%esi
lea    0xcae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
movsbl -0x51(%rbp),%eax
cmp    $0xa,%eax
jne    13a1 <main+0x1f1>
jmp    13a6 <main+0x1f6>
jmp    1350 <main+0x1a0>
lea    0xc5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    0x2c22(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1090 <tcsetattr@plt>
mov    -0x14(%rbp),%edi
lea    -0x52(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
mov    %eax,-0x58(%rbp)
cmpl   $0x1,-0x58(%rbp)
jge    13fa <main+0x24a>
lea    0xc2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    13c9 <main+0x219>
movsbl -0x52(%rbp),%esi
lea    0xc23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2bad(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
movsbl -0x52(%rbp),%eax
cmp    $0xa,%eax
jne    142c <main+0x27c>
jmp    1431 <main+0x281>
jmp    13c9 <main+0x219>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
lea    0xe22(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,%ebx
lea    0xe33(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%r14
lea    0xe32(%rip),%r15
lea    0xe05(%rip),%r12
mov    0x2db5(%rip),%r13
jmp    1218 <main+0x58>
nopl   (%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    1210 <main+0x50>
movsbl 0x8(%rsp),%ebp
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
cmp    $0xa,%ebp
jne    1218 <main+0x58>
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
call   1090 <tcgetattr@plt>
lea    0x8(%rsp),%rbp
mov    %ebx,%edi
mov    %rbp,%rsi
call   1090 <tcgetattr@plt>
mov    0x2d44(%rip),%rax
mov    0x2d65(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
not    %ecx
and    %ecx,0x8(%rsp)
mov    0x10(%rsp),%rax
mov    0x2d2f(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2d36(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    0x2d35(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %rbp,%rdx
call   10a0 <tcsetattr@plt>
mov    $0x1,%edi
call   10d0 <sleep@plt>
lea    0xd47(%rip),%rdi
call   1030 <puts@plt>
lea    0x7(%rsp),%r14
lea    0xd56(%rip),%r15
lea    0xd29(%rip),%r12
jmp    12f8 <main+0x138>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    12f0 <main+0x130>
movsbl 0x7(%rsp),%ebp
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
cmp    $0xa,%ebp
jne    12f8 <main+0x138>
lea    0xcdc(%rip),%r14
lea    0xcd1(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
call   1080 <fdopen@plt>
mov    %rax,%rdi
call   10e0 <getc@plt>
movsbl %al,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
cmp    $0xa,%bpl
jne    1340 <main+0x180>
lea    0xca8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2c5d(%rip),%rax
mov    (%rax),%esi
lea    0x18(%rsp),%rdx
mov    %ebx,%edi
call   10a0 <tcsetattr@plt>
lea    0x7(%rsp),%r14
lea    0xc92(%rip),%r15
lea    0xc65(%rip),%r12
jmp    13b8 <main+0x1f8>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
test   %eax,%eax
jle    13b0 <main+0x1f0>
movsbl 0x7(%rsp),%ebp
mov    %r12,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
cmp    $0xa,%ebp
jne    13b8 <main+0x1f8>
mov    %ebx,%edi
call   1050 <close@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32, i32* }
@.str = [9 x i8] c"/dev/tty\00"
@O_RDONLY = global i32 0
@.str.1 = [17 x i8] c"regular reading\0A\00"
@.str.2 = [14 x i8] c"nothing read\0A\00"
@.str.3 = [4 x i8] c"%c\0A\00"
@stdout = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCSANOW = global i32 0
@.str.4 = [17 x i8] c"changed reading\0A\00"
@.str.5 = [2 x i8] c"r\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
%8 = alloca i32
%9 = alloca %struct.termios
%10 = alloca %struct.termios
%11 = alloca i8
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i8
%15 = alloca i8
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* @O_RDONLY
%18 = call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %17)
store i32 %18, i32* %6
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %2, %25, %37
%21 = load i32, i32* %6
%22 = call i32 @read(i32 %21, i8* %7, i32 1)
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %20
27: ; preds = %20
%28 = load i8, i8* %7
%29 = sext i8 %28 to i32
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = load i32, i32* @stdout
%32 = call i32 @fflush(i32 %31)
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 10
br i1 %35, label %36, label %37
36: ; preds = %27
br label %38
37: ; preds = %27
br label %20
38: ; preds = %36
%39 = load i32, i32* %6
%40 = call i32 @tcgetattr(i32 %39, %struct.termios* %10)
%41 = load i32, i32* %6
%42 = call i32 @tcgetattr(i32 %41, %struct.termios* %9)
%43 = load i32, i32* @ICANON
%44 = xor i32 %43, -1
%45 = load i32, i32* @ECHO
%46 = xor i32 %45, -1
%47 = and i32 %44, %46
%48 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 0
%49 = load i32, i32* %48
%50 = and i32 %49, %47
store i32 %50, i32* %48
%51 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 1
%52 = load i32*, i32** %51
%53 = load i64, i64* @VTIME
%54 = getelementptr inbounds i32, i32* %52, i64 %53
store i32 0, i32* %54
%55 = getelementptr inbounds %struct.termios, %struct.termios* %9, i32 0, i32 1
%56 = load i32*, i32** %55
%57 = load i64, i64* @VMIN
%58 = getelementptr inbounds i32, i32* %56, i64 %57
store i32 1, i32* %58
%59 = load i32, i32* %6
%60 = load i32, i32* @TCSANOW
%61 = call i32 @tcsetattr(i32 %59, i32 %60, %struct.termios* %9)
%62 = call i32 @sleep(i32 1)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %38, %69, %81
%65 = load i32, i32* %6
%66 = call i32 @read(i32 %65, i8* %11, i32 1)
store i32 %66, i32* %12
%67 = load i32, i32* %12
%68 = icmp slt i32 %67, 1
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %64
71: ; preds = %64
%72 = load i8, i8* %11
%73 = sext i8 %72 to i32
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %73)
%75 = load i32, i32* @stdout
%76 = call i32 @fflush(i32 %75)
%77 = load i8, i8* %11
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 10
br i1 %79, label %80, label %81
80: ; preds = %71
br label %82
81: ; preds = %71
br label %64
82: ; preds = %80
br label %83
83: ; preds = %82, %97
%84 = load i32, i32* %6
%85 = call i32* @fdopen(i32 %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %85, i32** %13
%86 = load i32*, i32** %13
%87 = call signext i8 @getc(i32* %86)
store i8 %87, i8* %14
%88 = load i8, i8* %14
%89 = sext i8 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %89)
%91 = load i32, i32* @stdout
%92 = call i32 @fflush(i32 %91)
%93 = load i8, i8* %14
%94 = sext i8 %93 to i32
%95 = icmp eq i32 %94, 10
br i1 %95, label %96, label %97
96: ; preds = %83
br label %98
97: ; preds = %83
br label %83
98: ; preds = %96
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%100 = load i32, i32* %6
%101 = load i32, i32* @TCSANOW
%102 = call i32 @tcsetattr(i32 %100, i32 %101, %struct.termios* %10)
br label %103
103: ; preds = %98, %108, %120
%104 = load i32, i32* %6
%105 = call i32 @read(i32 %104, i8* %15, i32 1)
store i32 %105, i32* %16
%106 = load i32, i32* %16
%107 = icmp slt i32 %106, 1
br i1 %107, label %108, label %110
108: ; preds = %103
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %103
110: ; preds = %103
%111 = load i8, i8* %15
%112 = sext i8 %111 to i32
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %112)
%114 = load i32, i32* @stdout
%115 = call i32 @fflush(i32 %114)
%116 = load i8, i8* %15
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 10
br i1 %118, label %119, label %120
119: ; preds = %110
br label %121
120: ; preds = %110
br label %103
121: ; preds = %119
%122 = load i32, i32* %6
%123 = call i32 @close(i32 %122)
%124 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.termios = type { i32, i32* }
@.str = [9 x i8] c"/dev/tty\00"
@O_RDONLY = global i32 0
@.str.3 = [4 x i8] c"%c\0A\00"
@stdout = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@VTIME = global i64 0
@VMIN = global i64 0
@TCSANOW = global i32 0
@.str.5 = [2 x i8] c"r\00"
@str.6 = [16 x i8] c"changed reading\00"
@str.7 = [16 x i8] c"regular reading\00"
@str.10 = [13 x i8] c"nothing read\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca %struct.termios
%5 = alloca %struct.termios
%6 = alloca i8
%7 = alloca i8
%8 = load i32, i32* @O_RDONLY
%9 = tail call i32 @open(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
br label %11
11: ; preds = %23, %2
%12 = call i32 @read(i32 %9, i8* %3, i32 1)
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
br label %23
16: ; preds = %11
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = load i32, i32* @stdout
%21 = tail call i32 @fflush(i32 %20)
%22 = icmp eq i8 %17, 10
br i1 %22, label %24, label %23
23: ; preds = %16, %14
br label %11
24: ; preds = %16
%25 = bitcast %struct.termios* %4 to i8*
%26 = bitcast %struct.termios* %5 to i8*
%27 = call i32 @tcgetattr(i32 %9, %struct.termios* %5)
%28 = call i32 @tcgetattr(i32 %9, %struct.termios* %4)
%29 = load i32, i32* @ICANON
%30 = load i32, i32* @ECHO
%31 = or i32 %30, %29
%32 = xor i32 %31, -1
%33 = getelementptr inbounds %struct.termios, %struct.termios* %4, i64 0, i32 0
%34 = load i32, i32* %33
%35 = and i32 %34, %32
store i32 %35, i32* %33
%36 = getelementptr inbounds %struct.termios, %struct.termios* %4, i64 0, i32 1
%37 = load i32*, i32** %36
%38 = load i64, i64* @VTIME
%39 = getelementptr inbounds i32, i32* %37, i64 %38
store i32 0, i32* %39
%40 = load i64, i64* @VMIN
%41 = getelementptr inbounds i32, i32* %37, i64 %40
store i32 1, i32* %41
%42 = load i32, i32* @TCSANOW
%43 = call i32 @tcsetattr(i32 %9, i32 %42, %struct.termios* %4)
%44 = call i32 @sleep(i32 1)
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.6, i64 0, i64 0))
br label %46
46: ; preds = %58, %24
%47 = call i32 @read(i32 %9, i8* %6, i32 1)
%48 = icmp slt i32 %47, 1
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
br label %58
51: ; preds = %46
%52 = load i8, i8* %6
%53 = sext i8 %52 to i32
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %53)
%55 = load i32, i32* @stdout
%56 = call i32 @fflush(i32 %55)
%57 = icmp eq i8 %52, 10
br i1 %57, label %59, label %58
58: ; preds = %51, %49
br label %46
59: ; preds = %51
br label %60
60: ; preds = %59, %60
%61 = call i32* @fdopen(i32 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%62 = call signext i8 @getc(i32* %61)
%63 = sext i8 %62 to i32
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %63)
%65 = load i32, i32* @stdout
%66 = call i32 @fflush(i32 %65)
%67 = icmp eq i8 %62, 10
br i1 %67, label %68, label %60
68: ; preds = %60
%69 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
%70 = load i32, i32* @TCSANOW
%71 = call i32 @tcsetattr(i32 %9, i32 %70, %struct.termios* %5)
br label %72
72: ; preds = %84, %68
%73 = call i32 @read(i32 %9, i8* %7, i32 1)
%74 = icmp slt i32 %73, 1
br i1 %74, label %75, label %77
75: ; preds = %72
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.10, i64 0, i64 0))
br label %84
77: ; preds = %72
%78 = load i8, i8* %7
%79 = sext i8 %78 to i32
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %79)
%81 = load i32, i32* @stdout
%82 = call i32 @fflush(i32 %81)
%83 = icmp eq i8 %78, 10
br i1 %83, label %85, label %84
84: ; preds = %77, %75
br label %72
85: ; preds = %77
%86 = call i32 @close(i32 %9)
%87 = call i32 @exit(i32 0)
unreachable
}