#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 */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int EOF;
int /*<<< orphan*/ block_comment_close_detected();
int /*<<< orphan*/ discard_char();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ get_source_code_line_number();
char peek_char();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ update_line_number(char);
void skip_block_comments(void) {
  char c;
  uint64_t block_comment_starting_line = get_source_code_line_number();
  discard_char();
  discard_char();
  while (((int)(c = peek_char()) != EOF) && !block_comment_close_detected()) {
    discard_char();
    update_line_number(c);
  }
  if (c == EOF) {
    fprintf(
        stderr,
        "The comment starting on line %lu needs a terminating comment symbol\n",
        block_comment_starting_line);
    exit(-1);
  }
  discard_char();
  discard_char();
}


x86 assembly (clang, -O0):
<skip_block_comments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1090 <get_source_code_line_number@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1070 <discard_char@plt>
mov    $0x0,%al
call   1070 <discard_char@plt>
mov    $0x0,%al
call   1060 <peek_char@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
mov    0x2e42(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x9(%rbp)
je     11c3 <skip_block_comments+0x53>
mov    $0x0,%al
call   1040 <block_comment_close_detected@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11d3 <skip_block_comments+0x63>
jmp    11e8 <skip_block_comments+0x78>
mov    $0x0,%al
call   1070 <discard_char@plt>
movsbl -0x1(%rbp),%edi
call   1030 <update_line_number@plt>
jmp    1190 <skip_block_comments+0x20>
movsbl -0x1(%rbp),%eax
mov    0x2df5(%rip),%rcx
cmp    (%rcx),%eax
jne    121d <skip_block_comments+0xad>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xdf2(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    $0x0,%al
call   1070 <discard_char@plt>
mov    $0x0,%al
call   1070 <discard_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_block_comments>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1090 <get_source_code_line_number@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1070 <discard_char@plt>
xor    %eax,%eax
call   1070 <discard_char@plt>
xor    %eax,%eax
call   1060 <peek_char@plt>
movsbl %al,%ebp
mov    0x2e48(%rip),%r15
cmp    %ebp,(%r15)
je     11db <skip_block_comments+0x6b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <block_comment_close_detected@plt>
test   %eax,%eax
jne    11fd <skip_block_comments+0x8d>
xor    %eax,%eax
call   1070 <discard_char@plt>
movsbl %bl,%edi
call   1030 <update_line_number@plt>
xor    %eax,%eax
call   1060 <peek_char@plt>
movsbl %al,%ebp
cmp    %ebp,(%r15)
jne    11b0 <skip_block_comments+0x40>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xe15(%rip),%rsi
mov    %r14d,%edx
call   1050 <fprintf@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
cmp    %ebp,(%r15)
je     11db <skip_block_comments+0x6b>
xor    %eax,%eax
call   1070 <discard_char@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <discard_char@plt>

LLVM IR (-O0):
@EOF = global i32 0
@stderr = global i32 0
@.str = [69 x i8] c"The comment starting on line %lu needs a terminating comment symbol\0A\00"
define void @skip_block_comments() {
%1 = alloca i8
%2 = alloca i32
%3 = call i32 (...) @get_source_code_line_number()
store i32 %3, i32* %2
%4 = call i32 (...) @discard_char()
%5 = call i32 (...) @discard_char()
br label %6
6: ; preds = %17, %0
%7 = call signext i8 (...) @peek_char()
store i8 %7, i8* %1
%8 = sext i8 %7 to i32
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = call i32 (...) @block_comment_close_detected()
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %11, %6
%16 = phi i1 [ false, %6 ], [ %14, %11 ]
br i1 %16, label %17, label %21
17: ; preds = %15
%18 = call i32 (...) @discard_char()
%19 = load i8, i8* %1
%20 = call i32 @update_line_number(i8 signext %19)
br label %6
21: ; preds = %15
%22 = load i8, i8* %1
%23 = sext i8 %22 to i32
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i32, i32* @stderr
%28 = load i32, i32* %2
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = call i32 @exit(i32 -1)
unreachable
31: ; preds = %21
%32 = call i32 (...) @discard_char()
%33 = call i32 (...) @discard_char()
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@stderr = global i32 0
@.str = [69 x i8] c"The comment starting on line %lu needs a terminating comment symbol\0A\00"
define void @skip_block_comments() {
%1 = tail call i32 (...) @get_source_code_line_number()
%2 = tail call i32 (...) @discard_char()
%3 = tail call i32 (...) @discard_char()
%4 = tail call signext i8 (...) @peek_char()
%5 = sext i8 %4 to i32
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %6, %5
br i1 %7, label %26, label %8
8: ; preds = %0
%9 = tail call i32 (...) @block_comment_close_detected()
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %22
11: ; preds = %14
%12 = tail call i32 (...) @block_comment_close_detected()
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %8, %11
%15 = phi i8 [ %18, %11 ], [ %4, %8 ]
%16 = tail call i32 (...) @discard_char()
%17 = tail call i32 @update_line_number(i8 signext %15)
%18 = tail call signext i8 (...) @peek_char()
%19 = sext i8 %18 to i32
%20 = load i32, i32* @EOF
%21 = icmp eq i32 %20, %19
br i1 %21, label %26, label %11
22: ; preds = %11, %8
%23 = phi i32 [ %5, %8 ], [ %19, %11 ]
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %24, %23
br i1 %25, label %26, label %30
26: ; preds = %14, %0, %22
%27 = load i32, i32* @stderr
%28 = tail call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %1)
%29 = tail call i32 @exit(i32 -1)
unreachable
30: ; preds = %22
%31 = tail call i32 (...) @discard_char()
%32 = tail call i32 (...) @discard_char()
ret void
}