#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 lexer {
  int dummy;
};

/* Variables and functions */
char lexer_next_char(struct lexer *);
char lexer_next_peek(struct lexer *);
int /*<<< orphan*/ lexer_report_error(struct lexer *, char *);
void lexer_discard_comments(struct lexer *lx) {
  if (lexer_next_peek(lx) != '#')
    lexer_report_error(lx, "Expecting a comment.");
  char c;
  do {
    c = lexer_next_char(lx);
  } while (c != '\n' && c != 26);
}


x86 assembly (clang, -O0):
<lexer_discard_comments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <lexer_next_peek@plt>
movsbl %al,%eax
cmp    $0x23,%eax
je     1161 <lexer_discard_comments+0x31>
mov    -0x8(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1050 <lexer_report_error@plt>
jmp    1166 <lexer_discard_comments+0x36>
mov    -0x8(%rbp),%rdi
call   1040 <lexer_next_char@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xa(%rbp)
je     1191 <lexer_discard_comments+0x61>
movsbl -0x9(%rbp),%eax
cmp    $0x1a,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1166 <lexer_discard_comments+0x36>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_discard_comments>:
push   %rbx
mov    %rdi,%rbx
call   1030 <lexer_next_peek@plt>
cmp    $0x23,%al
je     1150 <lexer_discard_comments+0x20>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1050 <lexer_report_error@plt>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <lexer_next_char@plt>
and    $0xef,%al
cmp    $0xa,%al
jne    1150 <lexer_discard_comments+0x20>
pop    %rbx
ret

LLVM IR (-O0):
%struct.lexer = type { i32 }
@.str = [21 x i8] c"Expecting a comment.\00"
define void @lexer_discard_comments(%struct.lexer* %0) {
%2 = alloca %struct.lexer*
%3 = alloca i8
store %struct.lexer* %0, %struct.lexer** %2
%4 = load %struct.lexer*, %struct.lexer** %2
%5 = call signext i8 @lexer_next_peek(%struct.lexer* %4)
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 35
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load %struct.lexer*, %struct.lexer** %2
%10 = call i32 @lexer_report_error(%struct.lexer* %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %1
br label %12
12: ; preds = %23, %11
%13 = load %struct.lexer*, %struct.lexer** %2
%14 = call signext i8 @lexer_next_char(%struct.lexer* %13)
store i8 %14, i8* %3
br label %15
15: ; preds = %12
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 10
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 26
br label %23
23: ; preds = %19, %15
%24 = phi i1 [ false, %15 ], [ %22, %19 ]
br i1 %24, label %12, label %25
25: ; preds = %23
ret void
}

LLVM IR (-O2):
%struct.lexer = type { i32 }
@.str = [21 x i8] c"Expecting a comment.\00"
define void @lexer_discard_comments(%struct.lexer* %0) {
%2 = tail call signext i8 @lexer_next_peek(%struct.lexer* %0)
%3 = icmp eq i8 %2, 35
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @lexer_report_error(%struct.lexer* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
br label %7
7: ; preds = %6, %7
%8 = tail call signext i8 @lexer_next_char(%struct.lexer* %0)
%9 = and i8 %8, -17
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %7
11: ; preds = %7
ret void
}