#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 EOF;
int getchar();
int /*<<< orphan*/ putchar(int);
int main() {
  int ch;
  do {
    if ((ch = getchar()) == '\n')
      putchar('\n');
    else if ((ch >= 32) && (ch < 127))
      putchar(ch);
    else if (ch == 27)
      while (((ch = getchar()) == '[') || (ch == ',') ||
             ((ch >= '0') && (ch <= '9')) || (ch == ';'))
        ;
  } while (ch != EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xa,%eax
jne    1151 <main+0x31>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11f1 <main+0xd1>
cmpl   $0x20,-0x8(%rbp)
jl     1172 <main+0x52>
cmpl   $0x7f,-0x8(%rbp)
jge    1172 <main+0x52>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ec <main+0xcc>
cmpl   $0x1b,-0x8(%rbp)
jne    11e7 <main+0xc7>
jmp    1181 <main+0x61>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
mov    $0x1,%al
cmp    $0x5b,%ecx
mov    %al,-0x9(%rbp)
je     11cd <main+0xad>
mov    $0x1,%al
cmpl   $0x2c,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11cd <main+0xad>
cmpl   $0x30,-0x8(%rbp)
jl     11c3 <main+0xa3>
mov    $0x1,%al
cmpl   $0x39,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jle    11cd <main+0xad>
cmpl   $0x3b,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11dd <main+0xbd>
jmp    11e2 <main+0xc2>
jmp    1181 <main+0x61>
jmp    11e7 <main+0xc7>
jmp    11ec <main+0xcc>
jmp    11f1 <main+0xd1>
jmp    11f6 <main+0xd6>
mov    -0x8(%rbp),%eax
mov    0x2de8(%rip),%rcx
cmp    (%rcx),%eax
jne    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%r14
jmp    1140 <main+0x20>
nopl   (%rax)
mov    %eax,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
cmp    (%r14),%eax
je     1180 <main+0x60>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    $0xa,%ebx
cmp    $0xa,%eax
je     1132 <main+0x12>
lea    -0x20(%rax),%ecx
cmp    $0x5f,%ecx
jb     1130 <main+0x10>
cmp    $0x1b,%eax
jne    113b <main+0x1b>
xchg   %ax,%ax
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x2c,%eax
je     1160 <main+0x40>
cmp    $0x5b,%eax
je     1160 <main+0x40>
lea    -0x30(%rax),%ecx
cmp    $0x3b,%eax
je     1160 <main+0x40>
cmp    $0xa,%ecx
jb     1160 <main+0x40>
jmp    113b <main+0x1b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %43, %0
%4 = call i32 (...) @getchar()
store i32 %4, i32* %2
%5 = icmp eq i32 %4, 10
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 @putchar(i32 10)
br label %42
8: ; preds = %3
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 32
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 127
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32, i32* %2
%16 = call i32 @putchar(i32 %15)
br label %41
17: ; preds = %11, %8
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 27
br i1 %19, label %20, label %40
20: ; preds = %17
br label %21
21: ; preds = %38, %20
%22 = call i32 (...) @getchar()
store i32 %22, i32* %2
%23 = icmp eq i32 %22, 91
br i1 %23, label %36, label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 44
br i1 %26, label %36, label %27
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp sge i32 %28, 48
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32, i32* %2
%32 = icmp sle i32 %31, 57
br i1 %32, label %36, label %33
33: ; preds = %30, %27
%34 = load i32, i32* %2
%35 = icmp eq i32 %34, 59
br label %36
36: ; preds = %33, %30, %24, %21
%37 = phi i1 [ true, %30 ], [ true, %24 ], [ true, %21 ], [ %35, %33 ]
br i1 %37, label %38, label %39
38: ; preds = %36
br label %21
39: ; preds = %36
br label %40
40: ; preds = %39, %17
br label %41
41: ; preds = %40, %14
br label %42
42: ; preds = %41, %6
br label %43
43: ; preds = %42
%44 = load i32, i32* %2
%45 = load i32, i32* @EOF
%46 = icmp ne i32 %44, %45
br i1 %46, label %3, label %47
47: ; preds = %43
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
br label %1
1: ; preds = %20, %0
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 10
br i1 %3, label %17, label %4
4: ; preds = %1
%5 = add i32 %2, -32
%6 = icmp ult i32 %5, 95
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = icmp eq i32 %2, 27
br i1 %8, label %9, label %20
9: ; preds = %7, %11
%10 = tail call i32 (...) @getchar()
switch i32 %10, label %12 [
i32 91, label %11
i32 44, label %11
]
11: ; preds = %9, %9, %12
br label %9
12: ; preds = %9
%13 = add i32 %10, -48
%14 = icmp ult i32 %13, 10
%15 = icmp eq i32 %10, 59
%16 = or i1 %15, %14
br i1 %16, label %11, label %20
17: ; preds = %4, %1
%18 = phi i32 [ 10, %1 ], [ %2, %4 ]
%19 = tail call i32 @putchar(i32 %18)
br label %20
20: ; preds = %12, %17, %7
%21 = phi i32 [ %2, %7 ], [ %18, %17 ], [ %10, %12 ]
%22 = load i32, i32* @EOF
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %1
24: ; preds = %20
ret i32 0
}