#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 */
#define EOF 128
int /*<<< orphan*/ error(char *);
int get();
char peek();
int next() {
  int c = get();
  if (c == '/') {
    switch (peek()) {
    case '/':
      for (;;) {
        c = get();
        if (c <= '\n') {
          return c;
        }
      }
    case '*':
      get();
      for (;;) {
        switch (get()) {
        case '*':
          if (peek() == '/') {
            get();
            return ' ';
          }
          break;
        case EOF:
          error("Unterminated comment.");
        }
      }
    default:
      return c;
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2f,-0x8(%rbp)
jne    121c <next+0xec>
xor    %eax,%eax
call   1030 <peek@plt>
movsbl %al,%eax
mov    %eax,-0xc(%rbp)
sub    $0x2a,%eax
je     11a1 <next+0x71>
jmp    1167 <next+0x37>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
jne    1211 <next+0xe1>
jmp    1178 <next+0x48>
jmp    117d <next+0x4d>
mov    $0x0,%al
call   1040 <get@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     119c <next+0x6c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <next+0xf2>
jmp    117d <next+0x4d>
mov    $0x0,%al
call   1040 <get@plt>
xor    %eax,%eax
call   1040 <get@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
sub    $0x2a,%eax
je     11d5 <next+0xa5>
jmp    11c2 <next+0x92>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     1200 <next+0xd0>
jmp    120c <next+0xdc>
mov    $0x0,%al
call   1030 <peek@plt>
movsbl %al,%eax
cmp    $0x2f,%eax
jne    11fb <next+0xcb>
mov    $0x0,%al
call   1040 <get@plt>
movl   $0x20,-0x4(%rbp)
jmp    1222 <next+0xf2>
jmp    120c <next+0xdc>
lea    0xdf9(%rip),%rdi
call   1050 <error@plt>
jmp    11a8 <next+0x78>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1222 <next+0xf2>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next>:
push   %rbx
xor    %eax,%eax
call   1040 <get@plt>
cmp    $0x2f,%eax
jne    116c <next+0x3c>
xor    %eax,%eax
call   1030 <peek@plt>
movsbl %al,%ecx
cmp    $0x2a,%ecx
je     116e <next+0x3e>
mov    $0x2f,%eax
cmp    $0x2f,%ecx
jne    116c <next+0x3c>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <get@plt>
cmp    $0xb,%eax
jge    1160 <next+0x30>
pop    %rbx
ret
xor    %eax,%eax
call   1040 <get@plt>
lea    0xe84(%rip),%rbx
jmp    1188 <next+0x58>
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <error@plt>
xor    %eax,%eax
call   1040 <get@plt>
cmp    $0x80,%eax
je     1180 <next+0x50>
cmp    $0x2a,%eax
jne    1188 <next+0x58>
xor    %eax,%eax
call   1030 <peek@plt>
cmp    $0x2f,%al
jne    1188 <next+0x58>
xor    %eax,%eax
call   1040 <get@plt>
mov    $0x20,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Unterminated comment.\00"
define i32 @next() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @get()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 47
br i1 %5, label %6, label %33
6: ; preds = %0
%7 = call signext i8 (...) @peek()
%8 = sext i8 %7 to i32
switch i32 %8, label %31 [
i32 47, label %9
i32 42, label %17
]
9: ; preds = %6
br label %10
10: ; preds = %16, %9
%11 = call i32 (...) @get()
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp sle i32 %12, 10
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i32, i32* %2
store i32 %15, i32* %1
br label %35
16: ; preds = %10
br label %10
17: ; preds = %6
%18 = call i32 (...) @get()
br label %19
19: ; preds = %30, %17
%20 = call i32 (...) @get()
switch i32 %20, label %30 [
i32 42, label %21
i32 128, label %28
]
21: ; preds = %19
%22 = call signext i8 (...) @peek()
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 47
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 (...) @get()
store i32 32, i32* %1
br label %35
27: ; preds = %21
br label %30
28: ; preds = %19
%29 = call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %30
30: ; preds = %28, %19, %27
br label %19
31: ; preds = %6
%32 = load i32, i32* %2
store i32 %32, i32* %1
br label %35
33: ; preds = %0
%34 = load i32, i32* %2
store i32 %34, i32* %1
br label %35
35: ; preds = %33, %31, %25, %14
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [22 x i8] c"Unterminated comment.\00"
define i32 @next() {
%1 = tail call i32 (...) @get()
%2 = icmp eq i32 %1, 47
br i1 %2, label %3, label %21
3: ; preds = %0
%4 = tail call signext i8 (...) @peek()
%5 = sext i8 %4 to i32
switch i32 %5, label %21 [
i32 47, label %6
i32 42, label %9
]
6: ; preds = %3, %6
%7 = tail call i32 (...) @get()
%8 = icmp slt i32 %7, 11
br i1 %8, label %21, label %6
9: ; preds = %3
%10 = tail call i32 (...) @get()
br label %11
11: ; preds = %16, %9
%12 = tail call i32 (...) @get()
switch i32 %12, label %16 [
i32 42, label %13
i32 128, label %19
]
13: ; preds = %11
%14 = tail call signext i8 (...) @peek()
%15 = icmp eq i8 %14, 47
br i1 %15, label %17, label %16
16: ; preds = %13, %19, %11
br label %11
17: ; preds = %13
%18 = tail call i32 (...) @get()
br label %21
19: ; preds = %11
%20 = tail call i32 @error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %16
21: ; preds = %6, %0, %3, %17
%22 = phi i32 [ 32, %17 ], [ 47, %3 ], [ %1, %0 ], [ %7, %6 ]
ret i32 %22
}