// File: /workspace/github_c_makefile_star2_O3/mahrr[P]raven/src/lexer.c
// Function: lexer_next
Token lexer_next(Lexer *lexer) {
#define New_Token(type) (new_token(lexer, type))

    skip_whitespace(lexer);

    lexer->start = lexer->current;

    if (at_end(lexer)) return New_Token(TOKEN_EOF);

    char c = advance(lexer);
    switch (c) {
    // One-Character Tokens
    case '+': return New_Token(TOKEN_PLUS);
    case '*': return New_Token(TOKEN_STAR);
    case '/': return New_Token(TOKEN_SLASH);
    case '%': return New_Token(TOKEN_PERCENT);
    case ',': return New_Token(TOKEN_COMMA);
    case '(': return New_Token(TOKEN_LEFT_PAREN);
    case ')': return New_Token(TOKEN_RIGHT_PAREN);
    case '[': return New_Token(TOKEN_LEFT_BRACKET);
    case ']': return New_Token(TOKEN_RIGHT_BRACKET);
    case '{': return New_Token(TOKEN_LEFT_BRACE);
    case ';': return New_Token(TOKEN_SEMICOLON);
    case '\\': return New_Token(TOKEN_BACK_SLASH);

    // Possible Two-Charachter Tokens
    case '-':
        if (match(lexer, '>')) return New_Token(TOKEN_ARROW);
        return New_Token(TOKEN_MINUS);

    case '=':
        if (match(lexer, '=')) return New_Token(TOKEN_EQUAL_EQUAL);
        return New_Token(TOKEN_EQUAL);

    case '<':
        if (match(lexer, '=')) return New_Token(TOKEN_LESS_EQUAL);
        return New_Token(TOKEN_LESS);

    case '>':
        if (match(lexer, '=')) return New_Token(TOKEN_GREATER_EQUAL);
        return New_Token(TOKEN_GREATER);

    case ':':
        if (match(lexer, ':')) return New_Token(TOKEN_COLON_COLON);
        return New_Token(TOKEN_COLON);

    case '.':
        if (match(lexer, '.')) return New_Token(TOKEN_DOT_DOT);
        return New_Token(TOKEN_DOT);

    case '!':
        if (match(lexer, '=')) return New_Token(TOKEN_BANG_EQUAL);
        break;

    // Strings
    case '}':
        if (match(lexer, '}')) return string_interpolated(lexer);
        return New_Token(TOKEN_RIGHT_BRACE);
    case '\'':
        return string(lexer);
    case '"':
        return string_interpolated(lexer);

    default:
        if (isalpha(c) || c == '_') return identifier(lexer);
        if (isdigit(c)) return number(lexer);
    }

    return error_token(lexer, "Unexpected symbol");
#undef New_Token
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%rsi), %r8
movzbl (%r8), %eax
cmpl $0xa, %eax
jne 0x9445
incl 0x18(%r14)
cmpb $0x0, (%r8)
je 0x9430
jmp 0x9478
cmpl $0x1f, %eax
jg 0x9456
cmpl $0x9, %eax
je 0x9478
cmpl $0xd, %eax
je 0x9478
jmp 0x9486
cmpl $0x20, %eax
je 0x9478
cmpl $0x23, %eax
jne 0x9486
incq %r8
testb %al, %al
je 0x9481
movzbl %al, %eax
cmpl $0xa, %eax
je 0x9481
movq %r8, 0x10(%r14)
movb (%r8), %al
jmp 0x9460
incq %r8
movq %r8, 0x10(%r14)
jmp 0x9430
decq %r8
jmp 0x9430
movq %r8, 0x8(%r14)
cmpb $0x0, (%r8)
je 0x94db
leaq 0x1(%r8), %rax
movq %rax, 0x10(%r14)
movzbl (%r8), %r15d
cmpl $0x5a, %r15d
jg 0x94f8
leal -0x21(%r15), %ecx
cmpl $0x1d, %ecx
ja 0x96b2
leaq 0x28c6(%rip), %rdx      # 0xbd7c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x3d, (%rax)
jne 0x976e
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x21, (%rbx)
jmp 0x967a
movl $0x36, (%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x14(%rbx)
movq %r8, 0x8(%rbx)
movl $0x0, 0x10(%rbx)
jmp 0x9753
cmpl $0x5c, %r15d
jle 0x953d
cmpl $0x5d, %r15d
je 0x969c
cmpl $0x7b, %r15d
je 0x9691
cmpl $0x7d, %r15d
jne 0x96b2
cmpb $0x7d, (%rax)
jne 0x973b
addq $0x2, %r8
movq %r8, 0x10(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97c4
jmp 0x9753
cmpl $0x5b, %r15d
je 0x96a7
cmpl $0x5c, %r15d
jne 0x96b2
movl $0x2e, (%rbx)
jmp 0x9741
movl $0x10, (%rbx)
jmp 0x9741
movl $0x26, (%rbx)
jmp 0x9741
cmpb $0x3d, (%rax)
jne 0x970b
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x20, (%rbx)
jmp 0x967a
movl $0x25, (%rbx)
jmp 0x9741
movl $0x28, (%rbx)
jmp 0x9741
movl $0x29, (%rbx)
jmp 0x9741
cmpb $0x3d, (%rax)
jne 0x9713
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x1c, (%rbx)
jmp 0x967a
cmpb $0x3e, (%rax)
jne 0x971b
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x24, (%rbx)
jmp 0x967a
movl $0x14, (%rbx)
jmp 0x9741
leaq 0x2(%r8), %rax
movl $0x2, %ebp
movzbl -0x1(%rax), %ecx
cmpl $0x27, %ecx
je 0x96f1
testl %ecx, %ecx
je 0x9782
movq %rax, 0x10(%r14)
incl %ebp
incq %rax
jmp 0x95fb
cmpb $0x3d, (%rax)
jne 0x9723
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x1e, (%rbx)
jmp 0x967a
movl $0x12, (%rbx)
jmp 0x9741
cmpb $0x3a, (%rax)
jne 0x972b
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x1a, (%rbx)
jmp 0x967a
movl $0x13, (%rbx)
jmp 0x9741
cmpb $0x2e, (%rax)
jne 0x9733
leaq 0x2(%r8), %rax
movq %rax, 0x10(%r14)
movl $0x19, (%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x14(%rbx)
movq %r8, 0x8(%rbx)
movl $0x2, 0x10(%rbx)
jmp 0x9753
movl $0x2a, (%rbx)
jmp 0x9741
movl $0x2d, (%rbx)
jmp 0x9741
movl $0x2c, (%rbx)
jmp 0x9741
callq 0x2220
cmpb $0x5f, %r15b
je 0x9761
movsbq %r15b, %rcx
movq (%rax), %rax
movzwl (%rax,%rcx,2), %eax
movl %eax, %ecx
andl $0x400, %ecx            # imm = 0x400
jne 0x9761
btl $0xb, %eax
jae 0x976e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9c22
jmp 0x9753
movq %rax, 0x10(%r14)
movl $0x31, (%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x14(%rbx)
movq %r8, 0x8(%rbx)
movl %ebp, 0x10(%rbx)
jmp 0x9753
movl $0x1f, (%rbx)
jmp 0x9741
movl $0x1b, (%rbx)
jmp 0x9741
movl $0x11, (%rbx)
jmp 0x9741
movl $0x1d, (%rbx)
jmp 0x9741
movl $0x27, (%rbx)
jmp 0x9741
movl $0x15, (%rbx)
jmp 0x9741
movl $0x2b, (%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x14(%rbx)
movq %r8, 0x8(%rbx)
movl $0x1, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9886
jmp 0x9753
leaq 0x26db(%rip), %rdx      # 0xbe50
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2529
jmp 0x9753
movq 0x6867(%rip), %rax      # 0xfff0
movq (%rax), %rdi
movq (%r14), %rdx
movl 0x18(%r14), %ecx
leaq 0x26f6(%rip), %rsi      # 0xbe90
leaq 0x26c1(%rip), %r9       # 0xbe62
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2140
movl $0x35, (%rbx)
movl 0x18(%r14), %eax
movl %eax, 0x14(%rbx)
movq $0x0, 0x8(%rbx)
jmp 0x9706