#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 */
int /*<<< orphan*/ lexer_discard_comments(struct lexer *);
int /*<<< orphan*/ lexer_discard_white_space(struct lexer *);
int lexer_next_char(struct lexer *);
char lexer_next_peek(struct lexer *);
int lexer_read_command(struct lexer *);
int /*<<< orphan*/ lexer_read_file_list(struct lexer *);
int lexer_read_syntax_or_variable(struct lexer *);
int lexer_unquoted_look_ahead_count(struct lexer *, char *);
int lexer_read_line(struct lexer *lx) {
  char c = lexer_next_peek(lx);
  int colon, equal;
  switch (c) {
  case 26:
    return lexer_next_char(lx);
    break;
  case '#':
    lexer_discard_comments(lx);
    return 1;
    break;
  case '\t':
  case ' ':
    return lexer_read_command(lx);
    break;
  case '\n':
    lexer_next_char(lx);
    return lexer_read_line(lx);
    break;
  case '@':
    lexer_next_char(lx);
    return lexer_read_syntax_or_variable(lx);
    break;
  default:
    lexer_discard_white_space(lx);
    colon = lexer_unquoted_look_ahead_count(lx, ":");
    equal = lexer_unquoted_look_ahead_count(lx, "=");
    if ((colon != -1) && (equal == -1 || colon < equal)) {
      lexer_read_file_list(lx);
    } else {
      lexer_read_syntax_or_variable(lx);
    }
    return 1;
    break;
  }
}


x86 assembly (clang, -O0):
<lexer_read_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <lexer_next_peek@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xfffffff7,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x37,%eax
ja     123d <lexer_read_line+0xad>
mov    -0x28(%rbp),%rax
lea    0xe37(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rdi
call   1070 <lexer_next_char@plt>
mov    %eax,-0x4(%rbp)
jmp    12aa <lexer_read_line+0x11a>
mov    -0x10(%rbp),%rdi
call   1030 <lexer_discard_comments@plt>
movl   $0x1,-0x4(%rbp)
jmp    12aa <lexer_read_line+0x11a>
mov    -0x10(%rbp),%rdi
call   1040 <lexer_read_command@plt>
mov    %eax,-0x4(%rbp)
jmp    12aa <lexer_read_line+0x11a>
mov    -0x10(%rbp),%rdi
call   1070 <lexer_next_char@plt>
mov    -0x10(%rbp),%rdi
call   10b0 <lexer_read_line@plt>
mov    %eax,-0x4(%rbp)
jmp    12aa <lexer_read_line+0x11a>
mov    -0x10(%rbp),%rdi
call   1070 <lexer_next_char@plt>
mov    -0x10(%rbp),%rdi
call   1050 <lexer_read_syntax_or_variable@plt>
mov    %eax,-0x4(%rbp)
jmp    12aa <lexer_read_line+0x11a>
mov    -0x10(%rbp),%rdi
call   10a0 <lexer_discard_white_space@plt>
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1080 <lexer_unquoted_look_ahead_count@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1080 <lexer_unquoted_look_ahead_count@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
je     129a <lexer_read_line+0x10a>
cmpl   $0xffffffff,-0x1c(%rbp)
je     128c <lexer_read_line+0xfc>
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    129a <lexer_read_line+0x10a>
mov    -0x10(%rbp),%rdi
call   1090 <lexer_read_file_list@plt>
jmp    12a3 <lexer_read_line+0x113>
mov    -0x10(%rbp),%rdi
call   1050 <lexer_read_syntax_or_variable@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_read_line>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <lexer_next_peek@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    11aa <lexer_read_line+0x2a>
mov    %rbx,%rdi
call   1070 <lexer_next_char@plt>
jmp    1190 <lexer_read_line+0x10>
lea    -0x1a(%rax),%ecx
cmp    $0x26,%ecx
ja     11d0 <lexer_read_line+0x50>
lea    0xe47(%rip),%rax
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <lexer_next_char@plt>
cmp    $0x9,%eax
jne    11e3 <lexer_read_line+0x63>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <lexer_read_command@plt>
mov    %rbx,%rdi
call   10a0 <lexer_discard_white_space@plt>
lea    0xeaa(%rip),%rsi
mov    %rbx,%rdi
call   1080 <lexer_unquoted_look_ahead_count@plt>
mov    %eax,%ebp
lea    0xe9b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <lexer_unquoted_look_ahead_count@plt>
cmp    $0xffffffff,%ebp
je     1219 <lexer_read_line+0x99>
cmp    $0xffffffff,%eax
je     1243 <lexer_read_line+0xc3>
cmp    %eax,%ebp
jl     1243 <lexer_read_line+0xc3>
mov    %rbx,%rdi
call   1050 <lexer_read_syntax_or_variable@plt>
jmp    124b <lexer_read_line+0xcb>
mov    %rbx,%rdi
call   1030 <lexer_discard_comments@plt>
jmp    124b <lexer_read_line+0xcb>
mov    %rbx,%rdi
call   1070 <lexer_next_char@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <lexer_read_syntax_or_variable@plt>
mov    %rbx,%rdi
call   1090 <lexer_read_file_list@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.lexer = type { i32 }
@.str = [2 x i8] c":\00"
@.str.1 = [2 x i8] c"=\00"
define i32 @lexer_read_line(%struct.lexer* %0) {
%2 = alloca i32
%3 = alloca %struct.lexer*
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store %struct.lexer* %0, %struct.lexer** %3
%7 = load %struct.lexer*, %struct.lexer** %3
%8 = call signext i8 @lexer_next_peek(%struct.lexer* %7)
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
switch i32 %10, label %30 [
i32 26, label %11
i32 35, label %14
i32 9, label %17
i32 32, label %17
i32 10, label %20
i32 64, label %25
]
11: ; preds = %1
%12 = load %struct.lexer*, %struct.lexer** %3
%13 = call i32 @lexer_next_char(%struct.lexer* %12)
store i32 %13, i32* %2
br label %53
14: ; preds = %1
%15 = load %struct.lexer*, %struct.lexer** %3
%16 = call i32 @lexer_discard_comments(%struct.lexer* %15)
store i32 1, i32* %2
br label %53
17: ; preds = %1, %1
%18 = load %struct.lexer*, %struct.lexer** %3
%19 = call i32 @lexer_read_command(%struct.lexer* %18)
store i32 %19, i32* %2
br label %53
20: ; preds = %1
%21 = load %struct.lexer*, %struct.lexer** %3
%22 = call i32 @lexer_next_char(%struct.lexer* %21)
%23 = load %struct.lexer*, %struct.lexer** %3
%24 = call i32 @lexer_read_line(%struct.lexer* %23)
store i32 %24, i32* %2
br label %53
25: ; preds = %1
%26 = load %struct.lexer*, %struct.lexer** %3
%27 = call i32 @lexer_next_char(%struct.lexer* %26)
%28 = load %struct.lexer*, %struct.lexer** %3
%29 = call i32 @lexer_read_syntax_or_variable(%struct.lexer* %28)
store i32 %29, i32* %2
br label %53
30: ; preds = %1
%31 = load %struct.lexer*, %struct.lexer** %3
%32 = call i32 @lexer_discard_white_space(%struct.lexer* %31)
%33 = load %struct.lexer*, %struct.lexer** %3
%34 = call i32 @lexer_unquoted_look_ahead_count(%struct.lexer* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %34, i32* %5
%35 = load %struct.lexer*, %struct.lexer** %3
%36 = call i32 @lexer_unquoted_look_ahead_count(%struct.lexer* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 %36, i32* %6
%37 = load i32, i32* %5
%38 = icmp ne i32 %37, -1
br i1 %38, label %39, label %49
39: ; preds = %30
%40 = load i32, i32* %6
%41 = icmp eq i32 %40, -1
br i1 %41, label %46, label %42
42: ; preds = %39
%43 = load i32, i32* %5
%44 = load i32, i32* %6
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %49
46: ; preds = %42, %39
%47 = load %struct.lexer*, %struct.lexer** %3
%48 = call i32 @lexer_read_file_list(%struct.lexer* %47)
br label %52
49: ; preds = %42, %30
%50 = load %struct.lexer*, %struct.lexer** %3
%51 = call i32 @lexer_read_syntax_or_variable(%struct.lexer* %50)
br label %52
52: ; preds = %49, %46
store i32 1, i32* %2
br label %53
53: ; preds = %52, %25, %20, %17, %14, %11
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
%struct.lexer = type { i32 }
@.str = [2 x i8] c":\00"
@.str.1 = [2 x i8] c"=\00"
define i32 @lexer_read_line(%struct.lexer* %0) {
br label %2
2: ; preds = %11, %1
%3 = tail call signext i8 @lexer_next_peek(%struct.lexer* %0)
%4 = sext i8 %3 to i32
switch i32 %4, label %16 [
i32 26, label %5
i32 35, label %7
i32 9, label %9
i32 32, label %9
i32 10, label %11
i32 64, label %13
]
5: ; preds = %2
%6 = tail call i32 @lexer_next_char(%struct.lexer* %0)
br label %29
7: ; preds = %2
%8 = tail call i32 @lexer_discard_comments(%struct.lexer* %0)
br label %29
9: ; preds = %2, %2
%10 = tail call i32 @lexer_read_command(%struct.lexer* %0)
br label %29
11: ; preds = %2
%12 = tail call i32 @lexer_next_char(%struct.lexer* %0)
br label %2
13: ; preds = %2
%14 = tail call i32 @lexer_next_char(%struct.lexer* %0)
%15 = tail call i32 @lexer_read_syntax_or_variable(%struct.lexer* %0)
br label %29
16: ; preds = %2
%17 = tail call i32 @lexer_discard_white_space(%struct.lexer* %0)
%18 = tail call i32 @lexer_unquoted_look_ahead_count(%struct.lexer* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @lexer_unquoted_look_ahead_count(%struct.lexer* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i32 %18, -1
br i1 %20, label %27, label %21
21: ; preds = %16
%22 = icmp eq i32 %19, -1
%23 = icmp slt i32 %18, %19
%24 = select i1 %22, i1 true, i1 %23
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = tail call i32 @lexer_read_file_list(%struct.lexer* %0)
br label %29
27: ; preds = %21, %16
%28 = tail call i32 @lexer_read_syntax_or_variable(%struct.lexer* %0)
br label %29
29: ; preds = %25, %27, %13, %9, %7, %5
%30 = phi i32 [ %15, %13 ], [ %10, %9 ], [ 1, %7 ], [ %6, %5 ], [ 1, %27 ], [ 1, %25 ]
ret i32 %30
}