#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 */
char EOF;
char getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  char c;
  bool is_comment = false;
  while ((c = getchar()) != EOF) {
    if (!is_comment)
      is_comment = (c == '#');
    if (!is_comment)
      putchar(c);
    else if (c == '\n')
      is_comment = false;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11a7 <main+0x87>
cmpl   $0x0,-0xc(%rbp)
jne    1171 <main+0x51>
movsbl -0x5(%rbp),%eax
cmp    $0x23,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1189 <main+0x69>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a2 <main+0x82>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    119d <main+0x7d>
movl   $0x0,-0xc(%rbp)
jmp    11a2 <main+0x82>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb7(%rip),%rbx
cmp    (%rbx),%al
jne    113e <main+0x1e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1163 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %ebp,%ebp
cmp    $0xa,%al
setne  %bpl
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%al
je     1135 <main+0x15>
test   %ebp,%ebp
jne    1150 <main+0x30>
cmp    $0x23,%al
je     1150 <main+0x30>
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    1158 <main+0x38>

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %30, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* @EOF
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %31
10: ; preds = %4
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 35
%17 = zext i1 %16 to i32
store i32 %17, i32* %3
br label %18
18: ; preds = %13, %10
%19 = load i32, i32* %3
%20 = icmp ne i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i8, i8* %2
%23 = call i32 @putchar(i8 signext %22)
br label %30
24: ; preds = %18
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 0, i32* %3
br label %29
29: ; preds = %28, %24
br label %30
30: ; preds = %29, %21
br label %4
31: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %20, label %4
4: ; preds = %0, %15
%5 = phi i8 [ %17, %15 ], [ %1, %0 ]
%6 = phi i32 [ %16, %15 ], [ 0, %0 ]
%7 = icmp eq i32 %6, 0
%8 = icmp ne i8 %5, 35
%9 = and i1 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %4
%11 = tail call i32 @putchar(i8 signext %5)
br label %15
12: ; preds = %4
%13 = icmp ne i8 %5, 10
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %12, %10
%16 = phi i32 [ 0, %10 ], [ %14, %12 ]
%17 = tail call signext i8 (...) @getchar()
%18 = load i8, i8* @EOF
%19 = icmp eq i8 %17, %18
br i1 %19, label %20, label %4
20: ; preds = %15, %0
ret i32 0
}