#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);
int main() {
  int c, prevc, state;
  prevc = state = 0;
  while ((c = getchar()) != EOF) {
    if (state == 1 || state == 2) {
      if (state == 1) {
        if (c == '\n')
          state = 0;
      }
      if (state == 2) {
        if (prevc == '*' && c == '/')
          state = 3;
      }
    } else if (c == '/') {
      if (prevc == '/')
        state = 1;
    } else if (c == '*') {
      if (prevc == '/')
        state = 2;
    } else {
      printf("%c", c);
    }
    prevc = c;
  }
  return 0;
}


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)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     121d <main+0xfd>
cmpl   $0x1,-0x10(%rbp)
je     116a <main+0x4a>
cmpl   $0x2,-0x10(%rbp)
jne    11b9 <main+0x99>
cmpl   $0x1,-0x10(%rbp)
jne    118a <main+0x6a>
cmpl   $0xa,-0x8(%rbp)
jne    1185 <main+0x65>
movl   $0x0,-0x10(%rbp)
jmp    118a <main+0x6a>
cmpl   $0x2,-0x10(%rbp)
jne    11b4 <main+0x94>
cmpl   $0x2a,-0xc(%rbp)
jne    11af <main+0x8f>
cmpl   $0x2f,-0x8(%rbp)
jne    11af <main+0x8f>
movl   $0x3,-0x10(%rbp)
jmp    11b4 <main+0x94>
jmp    1212 <main+0xf2>
cmpl   $0x2f,-0x8(%rbp)
jne    11d9 <main+0xb9>
cmpl   $0x2f,-0xc(%rbp)
jne    11d4 <main+0xb4>
movl   $0x1,-0x10(%rbp)
jmp    120d <main+0xed>
cmpl   $0x2a,-0x8(%rbp)
jne    11f9 <main+0xd9>
cmpl   $0x2f,-0xc(%rbp)
jne    11f4 <main+0xd4>
movl   $0x2,-0x10(%rbp)
jmp    1208 <main+0xe8>
mov    -0x8(%rbp),%esi
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
jmp    120d <main+0xed>
jmp    1212 <main+0xf2>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eac(%rip),%rbx
cmp    (%rbx),%eax
jne    1151 <main+0x31>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r13d
lea    0xea2(%rip),%r14
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    117b <main+0x5b>
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
nop
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%eax
je     1140 <main+0x20>
mov    %ebp,%ecx
mov    %eax,%ebp
lea    -0x1(%r12),%eax
cmp    $0x1,%eax
ja     11c0 <main+0xa0>
mov    %r12d,%eax
xor    $0x1,%eax
mov    %ebp,%edx
xor    $0xa,%edx
or     %eax,%edx
cmove  %r15d,%r12d
cmp    $0x2,%r12d
jne    1170 <main+0x50>
xor    $0x2a,%ecx
mov    %ebp,%eax
xor    $0x2f,%eax
xor    %r12d,%r12d
or     %ecx,%eax
sete   %r12b
or     $0x2,%r12d
jmp    1170 <main+0x50>
nopw   0x0(%rax,%rax,1)
cmp    $0x2a,%ebp
je     11d3 <main+0xb3>
cmp    $0x2f,%ebp
jne    1165 <main+0x45>
cmp    $0x2f,%ecx
cmove  %r13d,%r12d
jmp    1170 <main+0x50>
cmp    $0x2f,%ecx
mov    $0x2,%eax
cmove  %eax,%r12d
jmp    1170 <main+0x50>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [3 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 %35, label %4
4: ; preds = %0, %30
%5 = phi i32 [ %32, %30 ], [ %1, %0 ]
%6 = phi i32 [ %31, %30 ], [ 0, %0 ]
%7 = phi i32 [ %5, %30 ], [ 0, %0 ]
%8 = add i32 %6, -1
%9 = icmp ult i32 %8, 2
br i1 %9, label %10, label %21
10: ; preds = %4
%11 = icmp eq i32 %6, 1
%12 = icmp eq i32 %5, 10
%13 = and i1 %11, %12
%14 = select i1 %13, i32 0, i32 %6
%15 = icmp eq i32 %14, 2
br i1 %15, label %16, label %30
16: ; preds = %10
%17 = icmp eq i32 %7, 42
%18 = icmp eq i32 %5, 47
%19 = and i1 %17, %18
%20 = select i1 %19, i32 3, i32 2
br label %30
21: ; preds = %4
switch i32 %5, label %28 [
i32 47, label %22
i32 42, label %25
]
22: ; preds = %21
%23 = icmp eq i32 %7, 47
%24 = select i1 %23, i32 1, i32 %6
br label %30
25: ; preds = %21
%26 = icmp eq i32 %7, 47
%27 = select i1 %26, i32 2, i32 %6
br label %30
28: ; preds = %21
%29 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %30
30: ; preds = %25, %22, %16, %28, %10
%31 = phi i32 [ %14, %10 ], [ %6, %28 ], [ %20, %16 ], [ %24, %22 ], [ %27, %25 ]
%32 = tail call i32 (...) @getchar()
%33 = load i32, i32* @EOF
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %4
35: ; preds = %30, %0
ret i32 0
}