#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;
int /*<<< orphan*/ discard_char();
char peek_char();
int /*<<< orphan*/ update_line_number(char);
void skip_single_line_comment(void) {
  char c = peek_char();
  while (((c = peek_char()) != '\n') && ((int)c != EOF)) {
    discard_char();
  }
  update_line_number(c);
  discard_char();
}


x86 assembly (clang, -O0):
<skip_single_line_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <peek_char@plt>
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1040 <peek_char@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     1170 <skip_single_line_comment+0x40>
movsbl -0x1(%rbp),%eax
mov    0x2e80(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1180 <skip_single_line_comment+0x50>
jmp    118c <skip_single_line_comment+0x5c>
mov    $0x0,%al
call   1050 <discard_char@plt>
jmp    1142 <skip_single_line_comment+0x12>
movsbl -0x1(%rbp),%edi
call   1030 <update_line_number@plt>
mov    $0x0,%al
call   1050 <discard_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_single_line_comment>:
push   %rbx
xor    %eax,%eax
call   1040 <peek_char@plt>
xor    %eax,%eax
call   1040 <peek_char@plt>
cmp    $0xa,%al
je     1179 <skip_single_line_comment+0x49>
movsbl %al,%ecx
mov    0x2e9b(%rip),%rbx
cmp    %ecx,(%rbx)
je     1179 <skip_single_line_comment+0x49>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <discard_char@plt>
xor    %eax,%eax
call   1040 <peek_char@plt>
cmp    $0xa,%al
je     1179 <skip_single_line_comment+0x49>
movsbl %al,%ecx
cmp    %ecx,(%rbx)
jne    1160 <skip_single_line_comment+0x30>
movsbl %al,%edi
call   1030 <update_line_number@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <discard_char@plt>

LLVM IR (-O0):
@EOF = global i32 0
define void @skip_single_line_comment() {
%1 = alloca i8
%2 = call signext i8 (...) @peek_char()
store i8 %2, i8* %1
br label %3
3: ; preds = %14, %0
%4 = call signext i8 (...) @peek_char()
store i8 %4, i8* %1
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = load i8, i8* %1
%9 = sext i8 %8 to i32
%10 = load i32, i32* @EOF
%11 = icmp ne i32 %9, %10
br label %12
12: ; preds = %7, %3
%13 = phi i1 [ false, %3 ], [ %11, %7 ]
br i1 %13, label %14, label %16
14: ; preds = %12
%15 = call i32 (...) @discard_char()
br label %3
16: ; preds = %12
%17 = load i8, i8* %1
%18 = call i32 @update_line_number(i8 signext %17)
%19 = call i32 (...) @discard_char()
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @skip_single_line_comment() {
%1 = tail call signext i8 (...) @peek_char()
%2 = tail call signext i8 (...) @peek_char()
%3 = sext i8 %2 to i32
%4 = icmp ne i8 %2, 10
%5 = load i32, i32* @EOF
%6 = icmp ne i32 %5, %3
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %8, label %16
8: ; preds = %0, %8
%9 = tail call i32 (...) @discard_char()
%10 = tail call signext i8 (...) @peek_char()
%11 = sext i8 %10 to i32
%12 = icmp ne i8 %10, 10
%13 = load i32, i32* @EOF
%14 = icmp ne i32 %13, %11
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %8, label %16
16: ; preds = %8, %0
%17 = phi i8 [ %2, %0 ], [ %10, %8 ]
%18 = tail call i32 @update_line_number(i8 signext %17)
%19 = tail call i32 (...) @discard_char()
ret void
}