#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);
void uncommentLine() {
  int curchar, prevchar;
  prevchar = ' ';
  bool oneLineComment, multiLineComment;
  oneLineComment = multiLineComment = false;
  while ((curchar = getchar()) != EOF) {
    if (prevchar == '/') {
      if (curchar == '/') {
        oneLineComment = true;
      } else {
        if (curchar == '*')
          multiLineComment = true;
      }
    }
    if (prevchar == '*' && curchar == '/' && multiLineComment)
      multiLineComment = false;
    if (curchar == '\n') {
      oneLineComment = false;
      prevchar = curchar;
    }
    if (!oneLineComment && !multiLineComment && prevchar == '/')
      putchar(prevchar);
    if (!oneLineComment && !multiLineComment && curchar != '/')
      putchar(curchar);
    prevchar = curchar;
  }
}


x86 assembly (clang, -O0):
<uncommentLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x20,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     1224 <uncommentLine+0x104>
cmpl   $0x2f,-0x8(%rbp)
jne    1191 <uncommentLine+0x71>
cmpl   $0x2f,-0x4(%rbp)
jne    1176 <uncommentLine+0x56>
movl   $0x1,-0xc(%rbp)
jmp    118c <uncommentLine+0x6c>
cmpl   $0x2a,-0x4(%rbp)
jne    1187 <uncommentLine+0x67>
movl   $0x1,-0x10(%rbp)
jmp    118c <uncommentLine+0x6c>
jmp    1191 <uncommentLine+0x71>
cmpl   $0x2a,-0x8(%rbp)
jne    11b6 <uncommentLine+0x96>
cmpl   $0x2f,-0x4(%rbp)
jne    11b6 <uncommentLine+0x96>
cmpl   $0x0,-0x10(%rbp)
je     11b6 <uncommentLine+0x96>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x4(%rbp)
jne    11cd <uncommentLine+0xad>
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11f3 <uncommentLine+0xd3>
cmpl   $0x0,-0x10(%rbp)
jne    11f3 <uncommentLine+0xd3>
cmpl   $0x2f,-0x8(%rbp)
jne    11f3 <uncommentLine+0xd3>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1219 <uncommentLine+0xf9>
cmpl   $0x0,-0x10(%rbp)
jne    1219 <uncommentLine+0xf9>
cmpl   $0x2f,-0x4(%rbp)
je     1219 <uncommentLine+0xf9>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    113d <uncommentLine+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uncommentLine>:
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),%r14
cmp    (%r14),%eax
jne    1150 <uncommentLine+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x20,%ecx
xor    %r13d,%r13d
xor    %r12d,%r12d
jmp    116e <uncommentLine+0x4e>
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%r14),%eax
je     1141 <uncommentLine+0x21>
mov    %eax,%ebp
cmp    $0x2f,%ecx
jne    1190 <uncommentLine+0x70>
cmp    $0x2f,%ebp
je     1187 <uncommentLine+0x67>
cmp    $0x2a,%ebp
jne    1190 <uncommentLine+0x70>
mov    $0x1,%r13d
jmp    1190 <uncommentLine+0x70>
mov    $0x1,%r12d
nopl   (%rax)
mov    %r13d,%eax
mov    %ecx,%edx
xor    $0x2a,%edx
mov    %ebp,%esi
xor    $0x2f,%esi
test   %r13d,%r13d
cmovne %r15d,%r13d
or     %edx,%esi
cmovne %eax,%r13d
cmp    $0xa,%ebp
cmove  %r15d,%r12d
mov    %r12d,%eax
or     %r13d,%eax
sete   %bl
cmp    $0x2f,%ecx
jne    11d2 <uncommentLine+0xb2>
cmp    $0xa,%ebp
je     11d2 <uncommentLine+0xb2>
test   %bl,%bl
je     11d2 <uncommentLine+0xb2>
mov    $0x2f,%edi
call   1030 <putchar@plt>
cmp    $0x2f,%ebp
sete   %al
xor    $0x1,%bl
or     %al,%bl
jne    1160 <uncommentLine+0x40>
mov    %ebp,%edi
call   1030 <putchar@plt>
jmp    1160 <uncommentLine+0x40>

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

LLVM IR (-O2):
@EOF = global i32 0
define void @uncommentLine() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %41, label %4
4: ; preds = %0, %37
%5 = phi i32 [ %38, %37 ], [ %1, %0 ]
%6 = phi i32 [ %21, %37 ], [ 0, %0 ]
%7 = phi i32 [ %23, %37 ], [ 0, %0 ]
%8 = phi i32 [ %5, %37 ], [ 32, %0 ]
%9 = icmp eq i32 %8, 47
br i1 %9, label %10, label %13
10: ; preds = %4
switch i32 %5, label %12 [
i32 47, label %13
i32 42, label %11
]
11: ; preds = %10
br label %13
12: ; preds = %10
br label %13
13: ; preds = %10, %12, %11, %4
%14 = phi i32 [ %7, %11 ], [ %7, %4 ], [ 1, %10 ], [ %7, %12 ]
%15 = phi i32 [ 1, %11 ], [ %6, %4 ], [ %6, %10 ], [ %6, %12 ]
%16 = icmp eq i32 %8, 42
%17 = icmp eq i32 %5, 47
%18 = and i1 %16, %17
%19 = icmp ne i32 %15, 0
%20 = select i1 %18, i1 %19, i1 false
%21 = select i1 %20, i32 0, i32 %15
%22 = icmp eq i32 %5, 10
%23 = select i1 %22, i32 0, i32 %14
%24 = icmp eq i32 %23, 0
%25 = icmp eq i32 %21, 0
%26 = select i1 %24, i1 %25, i1 false
%27 = xor i1 %22, true
%28 = and i1 %9, %27
%29 = and i1 %28, %26
br i1 %29, label %30, label %32
30: ; preds = %13
%31 = tail call i32 @putchar(i32 47)
br label %32
32: ; preds = %30, %13
%33 = icmp ne i32 %5, 47
%34 = and i1 %33, %26
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = tail call i32 @putchar(i32 %5)
br label %37
37: ; preds = %35, %32
%38 = tail call i32 (...) @getchar()
%39 = load i32, i32* @EOF
%40 = icmp eq i32 %38, %39
br i1 %40, label %41, label %4
41: ; preds = %37, %0
ret void
}