#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 EOF;
scalar_t__ block_comment_open_detected();
int /*<<< orphan*/ discard_char();
scalar_t__ is_white_space(char);
char peek_char();
scalar_t__ single_line_comment_detected();
int /*<<< orphan*/ skip_block_comments();
int /*<<< orphan*/ skip_single_line_comment();
int /*<<< orphan*/ update_line_number(char);
void skip_whitespace_and_comments(void) {
  char c = peek_char();
  while ((((int)(c = peek_char())) != EOF) &&
         (is_white_space(c) || single_line_comment_detected() ||
          block_comment_open_detected())) {
    if (single_line_comment_detected()) {
      skip_single_line_comment();
    } else if (block_comment_open_detected()) {
      skip_block_comments();
    } else {
      update_line_number(c);
      discard_char();
    }
  }
}


x86 assembly (clang, -O0):
<skip_whitespace_and_comments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <peek_char@plt>
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1070 <peek_char@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
mov    0x2e40(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x2(%rbp)
je     11fe <skip_whitespace_and_comments+0x7e>
movsbl -0x1(%rbp),%edi
call   1080 <is_white_space@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x3(%rbp)
jne    11f8 <skip_whitespace_and_comments+0x78>
mov    $0x0,%al
call   1040 <single_line_comment_detected@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x3(%rbp)
jne    11f8 <skip_whitespace_and_comments+0x78>
mov    $0x0,%al
call   10a0 <block_comment_open_detected@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    120e <skip_whitespace_and_comments+0x8e>
jmp    1262 <skip_whitespace_and_comments+0xe2>
mov    $0x0,%al
call   1040 <single_line_comment_detected@plt>
cmp    $0x0,%rax
je     122b <skip_whitespace_and_comments+0xab>
mov    $0x0,%al
call   1060 <skip_single_line_comment@plt>
jmp    125d <skip_whitespace_and_comments+0xdd>
mov    $0x0,%al
call   10a0 <block_comment_open_detected@plt>
cmp    $0x0,%rax
je     1248 <skip_whitespace_and_comments+0xc8>
mov    $0x0,%al
call   1050 <skip_block_comments@plt>
jmp    1258 <skip_whitespace_and_comments+0xd8>
movsbl -0x1(%rbp),%edi
call   1030 <update_line_number@plt>
mov    $0x0,%al
call   1090 <discard_char@plt>
jmp    125d <skip_whitespace_and_comments+0xdd>
jmp    1192 <skip_whitespace_and_comments+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_whitespace_and_comments>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <peek_char@plt>
xor    %eax,%eax
call   1070 <peek_char@plt>
movsbl %al,%ecx
mov    0x2e4c(%rip),%r14
jmp    11b1 <skip_whitespace_and_comments+0x31>
xchg   %ax,%ax
xor    %eax,%eax
call   1060 <skip_single_line_comment@plt>
xor    %eax,%eax
call   1070 <peek_char@plt>
movsbl %al,%ecx
cmp    %ecx,(%r14)
je     1211 <skip_whitespace_and_comments+0x91>
movsbl %al,%ebx
mov    %ebx,%edi
call   1080 <is_white_space@plt>
test   %rax,%rax
jne    11e0 <skip_whitespace_and_comments+0x60>
xor    %eax,%eax
call   1040 <single_line_comment_detected@plt>
test   %rax,%rax
jne    11e0 <skip_whitespace_and_comments+0x60>
xor    %eax,%eax
call   10a0 <block_comment_open_detected@plt>
test   %rax,%rax
je     1211 <skip_whitespace_and_comments+0x91>
nopl   (%rax)
xor    %eax,%eax
call   1040 <single_line_comment_detected@plt>
test   %rax,%rax
jne    11a0 <skip_whitespace_and_comments+0x20>
xor    %eax,%eax
call   10a0 <block_comment_open_detected@plt>
test   %rax,%rax
je     1201 <skip_whitespace_and_comments+0x81>
xor    %eax,%eax
call   1050 <skip_block_comments@plt>
jmp    11a7 <skip_whitespace_and_comments+0x27>
mov    %ebx,%edi
call   1030 <update_line_number@plt>
xor    %eax,%eax
call   1090 <discard_char@plt>
jmp    11a7 <skip_whitespace_and_comments+0x27>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @skip_whitespace_and_comments() {
%1 = alloca i8
%2 = call signext i8 (...) @peek_char()
store i8 %2, i8* %1
br label %3
3: ; preds = %37, %0
%4 = call signext i8 (...) @peek_char()
store i8 %4, i8* %1
%5 = sext i8 %4 to i32
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = load i8, i8* %1
%10 = call i64 @is_white_space(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %8
%13 = call i64 (...) @single_line_comment_detected()
%14 = icmp ne i64 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = call i64 (...) @block_comment_open_detected()
%17 = icmp ne i64 %16, 0
br label %18
18: ; preds = %15, %12, %8
%19 = phi i1 [ true, %12 ], [ true, %8 ], [ %17, %15 ]
br label %20
20: ; preds = %18, %3
%21 = phi i1 [ false, %3 ], [ %19, %18 ]
br i1 %21, label %22, label %38
22: ; preds = %20
%23 = call i64 (...) @single_line_comment_detected()
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (...) @skip_single_line_comment()
br label %37
27: ; preds = %22
%28 = call i64 (...) @block_comment_open_detected()
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (...) @skip_block_comments()
br label %36
32: ; preds = %27
%33 = load i8, i8* %1
%34 = call i32 @update_line_number(i8 signext %33)
%35 = call i32 (...) @discard_char()
br label %36
36: ; preds = %32, %30
br label %37
37: ; preds = %36, %25
br label %3
38: ; preds = %20
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @skip_whitespace_and_comments() {
%1 = tail call signext i8 (...) @peek_char()
%2 = tail call signext i8 (...) @peek_char()
%3 = sext i8 %2 to i32
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %4, %3
br i1 %5, label %34, label %6
6: ; preds = %0, %29
%7 = phi i8 [ %30, %29 ], [ %2, %0 ]
%8 = tail call i64 @is_white_space(i8 signext %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = tail call i64 (...) @single_line_comment_detected()
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = tail call i64 (...) @block_comment_open_detected()
%15 = icmp eq i64 %14, 0
br i1 %15, label %34, label %16
16: ; preds = %6, %10, %13
%17 = tail call i64 (...) @single_line_comment_detected()
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = tail call i32 (...) @skip_single_line_comment()
br label %29
21: ; preds = %16
%22 = tail call i64 (...) @block_comment_open_detected()
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21
%25 = tail call i32 (...) @skip_block_comments()
br label %29
26: ; preds = %21
%27 = tail call i32 @update_line_number(i8 signext %7)
%28 = tail call i32 (...) @discard_char()
br label %29
29: ; preds = %24, %26, %19
%30 = tail call signext i8 (...) @peek_char()
%31 = sext i8 %30 to i32
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %32, %31
br i1 %33, label %34, label %6
34: ; preds = %13, %29, %0
ret void
}