#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 getch();
int /*<<< orphan*/ ungetch(char);
char comment(void) {
  char c;
  while ((c = getch()) != EOF)
    if (c == '*') {
      if ((c = getch()) == '/')
        break;
      else
        ungetch(c);
    }
  return c;
}


x86 assembly (clang, -O0):
<comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
mov    0x2eac(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1182 <comment+0x62>
movsbl -0x1(%rbp),%eax
cmp    $0x2a,%eax
jne    117d <comment+0x5d>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
cmp    $0x2f,%eax
jne    116f <comment+0x4f>
jmp    1182 <comment+0x62>
movsbl -0x1(%rbp),%edi
call   1030 <ungetch@plt>
jmp    117d <comment+0x5d>
jmp    1128 <comment+0x8>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comment>:
push   %rbx
xor    %eax,%eax
call   1040 <getch@plt>
mov    0x2eb9(%rip),%rbx
jmp    1147 <comment+0x27>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getch@plt>
cmp    (%rbx),%al
je     1166 <comment+0x46>
cmp    $0x2a,%al
jne    1140 <comment+0x20>
xor    %eax,%eax
call   1040 <getch@plt>
cmp    $0x2f,%al
je     1164 <comment+0x44>
movsbl %al,%edi
call   1030 <ungetch@plt>
jmp    1140 <comment+0x20>
mov    $0x2f,%al
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define signext i8 @comment() {
%1 = alloca i8
br label %2
2: ; preds = %21, %0
%3 = call signext i8 (...) @getch()
store i8 %3, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* @EOF
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %4, %6
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 42
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = call signext i8 (...) @getch()
store i8 %13, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 47
br i1 %15, label %16, label %17
16: ; preds = %12
br label %22
17: ; preds = %12
%18 = load i8, i8* %1
%19 = call i32 @ungetch(i8 signext %18)
br label %20
20: ; preds = %17
br label %21
21: ; preds = %20, %8
br label %2
22: ; preds = %16, %2
%23 = load i8, i8* %1
ret i8 %23
}

LLVM IR (-O2):
@EOF = global i8 0
define signext i8 @comment() {
%1 = tail call signext i8 (...) @getch()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %12
%5 = phi i8 [ %13, %12 ], [ %1, %0 ]
%6 = icmp eq i8 %5, 42
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = tail call signext i8 (...) @getch()
%9 = icmp eq i8 %8, 47
br i1 %9, label %16, label %10
10: ; preds = %7
%11 = tail call i32 @ungetch(i8 signext %8)
br label %12
12: ; preds = %10, %4
%13 = tail call signext i8 (...) @getch()
%14 = load i8, i8* @EOF
%15 = icmp eq i8 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %12, %7, %0
%17 = phi i8 [ %1, %0 ], [ 47, %7 ], [ %13, %12 ]
ret i8 %17
}