#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 */
struct lemon {
  int dummy;
};

/* Variables and functions */
int input_getchar(struct lemon *);
int /*<<< orphan*/ input_ungetchar(struct lemon *, int);
void lexer_scan_block_comment(struct lemon *lemon, int c) {
  while (c != '\0') {
    if (c == '*') {
      c = input_getchar(lemon);
      if (c == '/') {
        return;
      }
    } else {
      c = input_getchar(lemon);
    }
  }
  input_ungetchar(lemon, c);
}


x86 assembly (clang, -O0):
<lexer_scan_block_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1174 <lexer_scan_block_comment+0x54>
cmpl   $0x2a,-0xc(%rbp)
jne    1163 <lexer_scan_block_comment+0x43>
mov    -0x8(%rbp),%rdi
call   1040 <input_getchar@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2f,-0xc(%rbp)
jne    115e <lexer_scan_block_comment+0x3e>
jmp    1180 <lexer_scan_block_comment+0x60>
jmp    116f <lexer_scan_block_comment+0x4f>
mov    -0x8(%rbp),%rdi
call   1040 <input_getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    112f <lexer_scan_block_comment+0xf>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <input_ungetchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_scan_block_comment>:
push   %rbx
mov    %esi,%eax
mov    %rdi,%rbx
cmp    $0x2a,%eax
jne    1142 <lexer_scan_block_comment+0x22>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <input_getchar@plt>
cmp    $0x2f,%eax
je     1155 <lexer_scan_block_comment+0x35>
cmp    $0x2a,%eax
je     1130 <lexer_scan_block_comment+0x10>
test   %eax,%eax
je     1157 <lexer_scan_block_comment+0x37>
mov    %rbx,%rdi
call   1040 <input_getchar@plt>
cmp    $0x2a,%eax
jne    1142 <lexer_scan_block_comment+0x22>
jmp    1130 <lexer_scan_block_comment+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
xor    %esi,%esi
pop    %rbx
jmp    1030 <input_ungetchar@plt>

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

LLVM IR (-O2):
%struct.lemon = type { i32 }
define void @lexer_scan_block_comment(%struct.lemon* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i32 [ %1, %2 ], [ %9, %8 ]
switch i32 %4, label %10 [
i32 0, label %12
i32 42, label %5
]
5: ; preds = %3
%6 = tail call i32 @input_getchar(%struct.lemon* %0)
%7 = icmp eq i32 %6, 47
br i1 %7, label %14, label %8
8: ; preds = %5, %10
%9 = phi i32 [ %6, %5 ], [ %11, %10 ]
br label %3
10: ; preds = %3
%11 = tail call i32 @input_getchar(%struct.lemon* %0)
br label %8
12: ; preds = %3
%13 = tail call i32 @input_ungetchar(%struct.lemon* %0, i32 0)
br label %14
14: ; preds = %5, %12
ret void
}