#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 */

/* Variables and functions */
int /*<<< orphan*/ i_setup();
int /*<<< orphan*/ i_tidyup();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ t_read(char *, int);
int main() {
  char ch[7];
  i_setup();
  while (1) {
    t_read(ch, 7);
    printf("I got (%s)\n", ch);
    if (ch[0] == 27 && ch[1] == 0) {
    }
    if (ch[0] == 27 && ch[1] == 'q' && ch[2] == 0) {
      break;
    }
  }
  i_tidyup();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <i_setup@plt>
lea    -0xb(%rbp),%rdi
mov    $0x7,%esi
call   1050 <t_read@plt>
lea    -0xb(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
movsbl -0xb(%rbp),%eax
cmp    $0x1b,%eax
jne    1193 <main+0x53>
movsbl -0xa(%rbp),%eax
cmp    $0x0,%eax
jne    1193 <main+0x53>
jmp    1193 <main+0x53>
movsbl -0xb(%rbp),%eax
cmp    $0x1b,%eax
jne    11bf <main+0x7f>
movsbl -0xa(%rbp),%eax
cmp    $0x71,%eax
jne    11bf <main+0x7f>
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    11bf <main+0x7f>
jmp    11c4 <main+0x84>
jmp    1156 <main+0x16>
mov    $0x0,%al
call   1040 <i_tidyup@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <i_setup@plt>
lea    0x1(%rsp),%rbx
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <t_read@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
cmpb   $0x1b,0x1(%rsp)
jne    1160 <main+0x20>
cmpb   $0x71,0x2(%rsp)
jne    1160 <main+0x20>
cmpb   $0x0,0x3(%rsp)
jne    1160 <main+0x20>
xor    %eax,%eax
call   1040 <i_tidyup@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"I got (%s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
store i32 0, i32* %1
%3 = call i32 (...) @i_setup()
br label %4
4: ; preds = %0, %35
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%6 = call i32 @t_read(i8* %5, i32 7)
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 27
br i1 %12, label %13, label %19
13: ; preds = %4
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %13
br label %19
19: ; preds = %18, %13, %4
%20 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 27
br i1 %23, label %24, label %35
24: ; preds = %19
%25 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 113
br i1 %28, label %29, label %35
29: ; preds = %24
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %29
br label %36
35: ; preds = %29, %24, %19
br label %4
36: ; preds = %34
%37 = call i32 (...) @i_tidyup()
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [12 x i8] c"I got (%s)\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @i_setup()
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 1
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 2
br label %6
6: ; preds = %6, %0
%7 = call i32 @t_read(i8* %2, i32 7)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = load i8, i8* %2
%10 = icmp eq i8 %9, 27
%11 = load i8, i8* %4
%12 = icmp eq i8 %11, 113
%13 = select i1 %10, i1 %12, i1 false
%14 = load i8, i8* %5
%15 = icmp eq i8 %14, 0
%16 = select i1 %13, i1 %15, i1 false
br i1 %16, label %17, label %6
17: ; preds = %6
%18 = call i32 (...) @i_tidyup()
ret i32 0
}