#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*/ printf(char *, ...);
int main() {
  int isBlockComment, isLineComment, currChar;
  isBlockComment = isLineComment = currChar = 0;
  while ((currChar = getchar()) != EOF) {
    if (isBlockComment == 1) {
      if (currChar == '*' &&
          ((currChar = getchar()) != EOF && currChar == '/')) {
        isBlockComment = 0;
      }
    } else if (isLineComment == 1) {
      if (currChar == '\n') {
        isLineComment = 0;
        printf("\n");
      }
    } else if ((isBlockComment == 0 || isLineComment == 0) && currChar == '/') {
      if ((currChar = getchar()) != EOF && currChar == '/') {
        isLineComment = 1;
      } else if (currChar == '*') {
        isBlockComment = 1;
      } else {
        printf("/%c", currChar);
      }
    } else {
      printf("%c", currChar);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     126c <main+0x14c>
cmpl   $0x1,-0x8(%rbp)
jne    11a0 <main+0x80>
cmpl   $0x2a,-0x10(%rbp)
jne    119b <main+0x7b>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%eax
je     119b <main+0x7b>
cmpl   $0x2f,-0x10(%rbp)
jne    119b <main+0x7b>
movl   $0x0,-0x8(%rbp)
jmp    1267 <main+0x147>
cmpl   $0x1,-0xc(%rbp)
jne    11ce <main+0xae>
cmpl   $0xa,-0x10(%rbp)
jne    11c9 <main+0xa9>
movl   $0x0,-0xc(%rbp)
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
cmpl   $0x0,-0x8(%rbp)
je     11e2 <main+0xc2>
cmpl   $0x0,-0xc(%rbp)
jne    124c <main+0x12c>
cmpl   $0x2f,-0x10(%rbp)
jne    124c <main+0x12c>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    0x2deb(%rip),%rcx
cmp    (%rcx),%eax
je     121b <main+0xfb>
cmpl   $0x2f,-0x10(%rbp)
jne    121b <main+0xfb>
movl   $0x1,-0xc(%rbp)
jmp    1247 <main+0x127>
cmpl   $0x2a,-0x10(%rbp)
jne    1231 <main+0x111>
movl   $0x1,-0x8(%rbp)
jmp    1242 <main+0x122>
mov    -0x10(%rbp),%esi
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1247 <main+0x127>
jmp    125d <main+0x13d>
mov    -0x10(%rbp),%esi
lea    0xdad(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
jmp    1267 <main+0x147>
jmp    1144 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2ea3(%rip),%r15
cmp    (%r15),%eax
jne    1157 <main+0x27>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea2(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    117c <main+0x4c>
mov    $0x1,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r15),%eax
je     114a <main+0x1a>
cmp    $0x1,%ebp
jne    11b0 <main+0x80>
mov    $0x1,%ebp
cmp    $0x2a,%eax
jne    1170 <main+0x40>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x2f,%eax
setne  %al
cmpl   $0x2f,(%r15)
sete   %cl
or     %al,%cl
movzbl %cl,%ebp
jmp    1170 <main+0x40>
cs nopw 0x0(%rax,%rax,1)
cmp    $0x1,%ebx
jne    11d0 <main+0xa0>
cmp    $0xa,%eax
jne    1164 <main+0x34>
mov    $0xa,%edi
jmp    1201 <main+0xd1>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    $0x2f,%eax
jne    11ff <main+0xcf>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0x2f,%eax
jne    11ee <main+0xbe>
mov    $0x1,%ebx
cmpl   $0x2f,(%r15)
jne    1170 <main+0x40>
cmp    $0x2a,%eax
jne    120f <main+0xdf>
xor    %ebx,%ebx
mov    $0x1,%ebp
jmp    1170 <main+0x40>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1170 <main+0x40>
xor    %ebp,%ebp
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1208 <main+0xd8>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [4 x i8] c"/%c\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
br label %5
5: ; preds = %64, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %4
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %65
9: ; preds = %5
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 42
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = call i32 (...) @getchar()
store i32 %16, i32* %4
%17 = load i32, i32* @EOF
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 47
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %2
br label %23
23: ; preds = %22, %19, %15, %12
br label %64
24: ; preds = %9
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 10
br i1 %29, label %30, label %32
30: ; preds = %27
store i32 0, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
br label %63
33: ; preds = %24
%34 = load i32, i32* %2
%35 = icmp eq i32 %34, 0
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* %3
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %59
39: ; preds = %36, %33
%40 = load i32, i32* %4
%41 = icmp eq i32 %40, 47
br i1 %41, label %42, label %59
42: ; preds = %39
%43 = call i32 (...) @getchar()
store i32 %43, i32* %4
%44 = load i32, i32* @EOF
%45 = icmp ne i32 %43, %44
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* %4
%48 = icmp eq i32 %47, 47
br i1 %48, label %49, label %50
49: ; preds = %46
store i32 1, i32* %3
br label %58
50: ; preds = %46, %42
%51 = load i32, i32* %4
%52 = icmp eq i32 %51, 42
br i1 %52, label %53, label %54
53: ; preds = %50
store i32 1, i32* %2
br label %57
54: ; preds = %50
%55 = load i32, i32* %4
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %54, %53
br label %58
58: ; preds = %57, %49
br label %62
59: ; preds = %39, %36
%60 = load i32, i32* %4
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %59, %58
br label %63
63: ; preds = %62, %32
br label %64
64: ; preds = %63, %23
br label %5
65: ; preds = %5
%66 = load i32, i32* %1
ret i32 %66
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [4 x i8] c"/%c\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %44, label %4
4: ; preds = %0, %38
%5 = phi i32 [ %41, %38 ], [ %1, %0 ]
%6 = phi i32 [ %40, %38 ], [ 0, %0 ]
%7 = phi i32 [ %39, %38 ], [ 0, %0 ]
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %18
9: ; preds = %4
%10 = icmp eq i32 %5, 42
br i1 %10, label %11, label %38
11: ; preds = %9
%12 = tail call i32 (...) @getchar()
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %12, 47
%15 = icmp eq i32 %13, 47
%16 = or i1 %14, %15
%17 = zext i1 %16 to i32
br label %38
18: ; preds = %4
%19 = icmp eq i32 %6, 1
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = icmp eq i32 %5, 10
br i1 %21, label %22, label %38
22: ; preds = %20
%23 = tail call i32 @putchar(i32 10)
br label %38
24: ; preds = %18
%25 = icmp eq i32 %5, 47
br i1 %25, label %26, label %36
26: ; preds = %24
%27 = tail call i32 (...) @getchar()
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, 47
%30 = icmp ne i32 %28, 47
%31 = and i1 %29, %30
br i1 %31, label %38, label %32
32: ; preds = %26
%33 = icmp eq i32 %27, 42
br i1 %33, label %38, label %34
34: ; preds = %32
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %27)
br label %38
36: ; preds = %24
%37 = tail call i32 @putchar(i32 %5)
br label %38
38: ; preds = %11, %32, %26, %22, %20, %34, %36, %9
%39 = phi i32 [ 1, %9 ], [ 0, %22 ], [ 0, %20 ], [ 0, %34 ], [ 0, %36 ], [ %17, %11 ], [ 0, %26 ], [ 1, %32 ]
%40 = phi i32 [ %6, %9 ], [ 0, %22 ], [ 1, %20 ], [ 0, %34 ], [ 0, %36 ], [ %6, %11 ], [ 1, %26 ], [ 0, %32 ]
%41 = tail call i32 (...) @getchar()
%42 = load i32, i32* @EOF
%43 = icmp eq i32 %41, %42
br i1 %43, label %44, label %4
44: ; preds = %38, %0
ret i32 0
}