#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 getchar_update_lineno();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
int getchar_skipping_comments(void) {
  int c;
  while (1) {
    c = getchar_update_lineno();
    if (c != '/')
      return c;
    c = getchar();
    if (c == '/') {
      do {
        c = getchar_update_lineno();
      } while (c != EOF && c != '\n');
      return c;
    } else if (c == '*') {
      while (1) {
        c = getchar_update_lineno();
        if (c == EOF)
          return EOF;
        if (c == '*') {
          do {
            c = getchar_update_lineno();
          } while (c == '*');
          if (c == '/')
            break;
        }
      }
    } else {
      ungetc(c, stdin);
      return '/';
    }
  }
}


x86 assembly (clang, -O0):
<getchar_skipping_comments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getchar_update_lineno@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2f,-0x8(%rbp)
je     1157 <getchar_skipping_comments+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1255 <getchar_skipping_comments+0x125>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2f,-0x8(%rbp)
jne    11b1 <getchar_skipping_comments+0x81>
jmp    1170 <getchar_skipping_comments+0x40>
mov    $0x0,%al
call   1050 <getchar_update_lineno@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
mov    0x2e5a(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x9(%rbp)
je     119b <getchar_skipping_comments+0x6b>
cmpl   $0xa,-0x8(%rbp)
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1170 <getchar_skipping_comments+0x40>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1255 <getchar_skipping_comments+0x125>
cmpl   $0x2a,-0x8(%rbp)
jne    122e <getchar_skipping_comments+0xfe>
jmp    11c0 <getchar_skipping_comments+0x90>
mov    $0x0,%al
call   1050 <getchar_update_lineno@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2e0c(%rip),%rcx
cmp    (%rcx),%eax
jne    11ed <getchar_skipping_comments+0xbd>
mov    0x2dfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1255 <getchar_skipping_comments+0x125>
cmpl   $0x2a,-0x8(%rbp)
jne    1224 <getchar_skipping_comments+0xf4>
jmp    11fc <getchar_skipping_comments+0xcc>
mov    $0x0,%al
call   1050 <getchar_update_lineno@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2a,-0x8(%rbp)
je     11fc <getchar_skipping_comments+0xcc>
cmpl   $0x2f,-0x8(%rbp)
jne    121f <getchar_skipping_comments+0xef>
jmp    1229 <getchar_skipping_comments+0xf9>
jmp    1224 <getchar_skipping_comments+0xf4>
jmp    11c0 <getchar_skipping_comments+0x90>
jmp    124b <getchar_skipping_comments+0x11b>
mov    -0x8(%rbp),%edi
mov    0x2db0(%rip),%rax
mov    (%rax),%esi
call   1040 <ungetc@plt>
movl   $0x2f,-0x4(%rbp)
jmp    1255 <getchar_skipping_comments+0x125>
jmp    1250 <getchar_skipping_comments+0x120>
jmp    1138 <getchar_skipping_comments+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar_skipping_comments>:
push   %rbx
xor    %eax,%eax
call   1050 <getchar_update_lineno@plt>
cmp    $0x2f,%eax
jne    118d <getchar_skipping_comments+0x5d>
mov    0x2e9c(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0x2a,%eax
jne    118f <getchar_skipping_comments+0x5f>
xor    %eax,%eax
call   1050 <getchar_update_lineno@plt>
cmp    (%rbx),%eax
je     118d <getchar_skipping_comments+0x5d>
cmp    $0x2a,%eax
jne    115c <getchar_skipping_comments+0x2c>
nopl   0x0(%rax)
xor    %eax,%eax
call   1050 <getchar_update_lineno@plt>
cmp    $0x2a,%eax
je     1170 <getchar_skipping_comments+0x40>
cmp    $0x2f,%eax
jne    115c <getchar_skipping_comments+0x2c>
xor    %eax,%eax
call   1050 <getchar_update_lineno@plt>
cmp    $0x2f,%eax
je     1150 <getchar_skipping_comments+0x20>
pop    %rbx
ret
cmp    $0x2f,%eax
jne    11b2 <getchar_skipping_comments+0x82>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar_update_lineno@plt>
cmp    $0xa,%eax
je     118d <getchar_skipping_comments+0x5d>
cmp    (%rbx),%eax
jne    11a0 <getchar_skipping_comments+0x70>
jmp    118d <getchar_skipping_comments+0x5d>
mov    0x2e2f(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1040 <ungetc@plt>
mov    $0x2f,%eax
pop    %rbx
ret

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

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