#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 get_next_char();
int /*<<< orphan*/ unget_next_char();
int iscomment(int ch) {
  int result = 0;
  int next;
  if (ch == '/') {
    if ((next = get_next_char()) == '*')
      result = 1;
    unget_next_char();
  } else if (ch == '*') {
    if ((next = get_next_char()) == '/')
      result = 1;
    unget_next_char();
  }
  return result;
}


x86 assembly (clang, -O0):
<iscomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2f,-0x4(%rbp)
jne    1162 <iscomment+0x42>
mov    $0x0,%al
call   1030 <get_next_char@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x2a,%eax
jne    1156 <iscomment+0x36>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1040 <unget_next_char@plt>
jmp    1192 <iscomment+0x72>
cmpl   $0x2a,-0x4(%rbp)
jne    118d <iscomment+0x6d>
mov    $0x0,%al
call   1030 <get_next_char@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x2f,%eax
jne    1186 <iscomment+0x66>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1040 <unget_next_char@plt>
jmp    1192 <iscomment+0x72>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscomment>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x2f,%edi
je     1136 <iscomment+0x16>
xor    %ebx,%ebx
cmp    $0x2a,%edi
jne    1150 <iscomment+0x30>
mov    $0x2f,%ebp
jmp    113b <iscomment+0x1b>
mov    $0x2a,%ebp
xor    %eax,%eax
call   1030 <get_next_char@plt>
xor    %ebx,%ebx
cmp    %ebp,%eax
sete   %bl
xor    %eax,%eax
call   1040 <unget_next_char@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iscomment(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 47
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = call i32 (...) @get_next_char()
store i32 %8, i32* %4
%9 = icmp eq i32 %8, 42
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %3
br label %11
11: ; preds = %10, %7
%12 = call i32 (...) @unget_next_char()
br label %23
13: ; preds = %1
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 42
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = call i32 (...) @get_next_char()
store i32 %17, i32* %4
%18 = icmp eq i32 %17, 47
br i1 %18, label %19, label %20
19: ; preds = %16
store i32 1, i32* %3
br label %20
20: ; preds = %19, %16
%21 = call i32 (...) @unget_next_char()
br label %22
22: ; preds = %20, %13
br label %23
23: ; preds = %22, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @iscomment(i32 %0) {
switch i32 %0, label %9 [
i32 47, label %3
i32 42, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ 47, %2 ], [ 42, %1 ]
%5 = tail call i32 (...) @get_next_char()
%6 = icmp eq i32 %5, %4
%7 = tail call i32 (...) @unget_next_char()
%8 = zext i1 %6 to i32
br label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %10
}