#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*/ ungetChar();
int check_comment(int ch) {
  if (ch != '/')
    return 0;
  char ch2 = getChar();
  if (ch2 == '/') {
    while ((ch2 = getChar()) != EOF && ch2 != '\n')
      ;
    return 1;
  } else if (ch2 == '*') {
    for (ch = getChar(); ch != EOF; ch = getChar()) {
      if (ch == '*') {
        if (getChar() == '/')
          return 1;
      }
    }
    return 1;
  } else {
    ungetChar();
    return 0;
  }
}


x86 assembly (clang, -O0):
<check_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2f,-0x8(%rbp)
je     1141 <check_comment+0x21>
movl   $0x0,-0x4(%rbp)
jmp    123d <check_comment+0x11d>
mov    $0x0,%al
call   1030 <getChar@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x2f,%eax
jne    11af <check_comment+0x8f>
jmp    115d <check_comment+0x3d>
mov    $0x0,%al
call   1030 <getChar@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%ecx
mov    0x2e77(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0xa(%rbp)
je     118e <check_comment+0x6e>
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    119e <check_comment+0x7e>
jmp    11a3 <check_comment+0x83>
jmp    115d <check_comment+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    123d <check_comment+0x11d>
movsbl -0x9(%rbp),%eax
cmp    $0x2a,%eax
jne    122f <check_comment+0x10f>
mov    $0x0,%al
call   1030 <getChar@plt>
movsbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e15(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1223 <check_comment+0x103>
cmpl   $0x2a,-0x8(%rbp)
jne    120c <check_comment+0xec>
mov    $0x0,%al
call   1030 <getChar@plt>
movsbl %al,%eax
cmp    $0x2f,%eax
jne    1207 <check_comment+0xe7>
movl   $0x1,-0x4(%rbp)
jmp    123d <check_comment+0x11d>
jmp    120c <check_comment+0xec>
jmp    1211 <check_comment+0xf1>
mov    $0x0,%al
call   1030 <getChar@plt>
movsbl %al,%eax
mov    %eax,-0x8(%rbp)
jmp    11c9 <check_comment+0xa9>
movl   $0x1,-0x4(%rbp)
jmp    123d <check_comment+0x11d>
mov    $0x0,%al
call   1040 <ungetChar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_comment>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x2f,%edi
jne    11a6 <check_comment+0x86>
xor    %eax,%eax
call   1030 <getChar@plt>
cmp    $0x2a,%al
je     1162 <check_comment+0x42>
cmp    $0x2f,%al
jne    119d <check_comment+0x7d>
mov    0x2ea7(%rip),%r14
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getChar@plt>
cmp    $0xa,%al
je     11a6 <check_comment+0x86>
cmp    (%r14),%al
jne    1150 <check_comment+0x30>
jmp    11a6 <check_comment+0x86>
xor    %eax,%eax
call   1030 <getChar@plt>
mov    0x2e78(%rip),%r14
mov    $0x1,%ebx
jmp    1187 <check_comment+0x67>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getChar@plt>
cmp    (%r14),%al
je     11a6 <check_comment+0x86>
cmp    $0x2a,%al
jne    1180 <check_comment+0x60>
xor    %eax,%eax
call   1030 <getChar@plt>
cmp    $0x2f,%al
jne    1180 <check_comment+0x60>
jmp    11a6 <check_comment+0x86>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <ungetChar@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i8 0
define i32 @check_comment(i32 %0) {
%2 = icmp eq i32 %0, 47
br i1 %2, label %3, label %27
3: ; preds = %1
%4 = tail call signext i8 (...) @getChar()
switch i8 %4, label %25 [
i8 47, label %5
i8 42, label %11
]
5: ; preds = %3, %5
%6 = tail call signext i8 (...) @getChar()
%7 = load i8, i8* @EOF
%8 = icmp ne i8 %6, %7
%9 = icmp ne i8 %6, 10
%10 = and i1 %9, %8
br i1 %10, label %5, label %27
11: ; preds = %3
%12 = tail call signext i8 (...) @getChar()
%13 = load i8, i8* @EOF
%14 = icmp eq i8 %12, %13
br i1 %14, label %27, label %15
15: ; preds = %11, %21
%16 = phi i8 [ %22, %21 ], [ %12, %11 ]
%17 = icmp eq i8 %16, 42
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = tail call signext i8 (...) @getChar()
%20 = icmp eq i8 %19, 47
br i1 %20, label %27, label %21
21: ; preds = %15, %18
%22 = tail call signext i8 (...) @getChar()
%23 = load i8, i8* @EOF
%24 = icmp eq i8 %22, %23
br i1 %24, label %27, label %15
25: ; preds = %3
%26 = tail call i32 (...) @ungetChar()
br label %27
27: ; preds = %21, %18, %5, %11, %25, %1
%28 = phi i32 [ 0, %1 ], [ 0, %25 ], [ 1, %11 ], [ 1, %5 ], [ 1, %18 ], [ 1, %21 ]
ret i32 %28
}