// File: /workspace/github_c_makefile_star2_O3/gaultier[P]lox-c/lex.c
// Function: lex_scan_token
void lex_scan_token(Lex* lex, Token* token) {
    skip_whitespace(lex);
    const Lex start_lex = *lex;

    if (is_at_end(lex)) {
        init_token(lex, token, TOKEN_EOF, &start_lex);
        return;
    }

    const char c = advance(lex);

    if (isdigit(c)) {
        number(lex, token, &start_lex);
        return;
    }
    if (isalnum(c)) {
        identifier(lex, token, &start_lex);
        return;
    }

    switch (c) {
        case '{':
            init_token(lex, token, TOKEN_LEFT_BRACE, &start_lex);
            return;
        case '}':
            init_token(lex, token, TOKEN_RIGHT_BRACE, &start_lex);
            return;
        case '(':
            init_token(lex, token, TOKEN_LEFT_PAREN, &start_lex);
            return;
        case ')':
            init_token(lex, token, TOKEN_RIGHT_PAREN, &start_lex);
            return;
        case ';':
            init_token(lex, token, TOKEN_SEMICOLON, &start_lex);
            return;
        case ',':
            init_token(lex, token, TOKEN_COMMA, &start_lex);
            return;
        case '.':
            init_token(lex, token, TOKEN_DOT, &start_lex);
            return;
        case '-':
            init_token(lex, token, TOKEN_MINUS, &start_lex);
            return;
        case '+':
            init_token(lex, token, TOKEN_PLUS, &start_lex);
            return;
        case '*':
            init_token(lex, token, TOKEN_STAR, &start_lex);
            return;
        case '/':
            init_token(lex, token, TOKEN_SLASH, &start_lex);
            return;
        case '!':
            init_token(lex, token,
                       match(lex, '=') ? TOKEN_BANG_EQUAL : TOKEN_BANG,
                       &start_lex);
            return;
        case '=':
            init_token(lex, token,
                       match(lex, '=') ? TOKEN_EQUAL_EQUAL : TOKEN_EQUAL,
                       &start_lex);
            return;
        case '<':
            init_token(lex, token,
                       match(lex, '=') ? TOKEN_LESS_EQUAL : TOKEN_LESS,
                       &start_lex);
            return;
        case '>':
            init_token(lex, token,
                       match(lex, '=') ? TOKEN_GREATER_EQUAL : TOKEN_GREATER,
                       &start_lex);
            return;
        case '"':
            string(lex, token);
            return;
        default: {
            static char err[256] = "";
            memset(&err, 0, sizeof(err));

            snprintf(err, sizeof(err) - 1, "Unknown token `%c`", c);
            init_token_err(lex, token, err);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r13
movq 0x8(%rdi), %r12
movq 0x20(%rdi), %rbp
cmpq %r12, %rbp
je 0x23a4
leaq 0x18(%r14), %rax
leaq 0x10(%r14), %rcx
movzbl (%r13,%rbp), %edx
cmpl $0x1f, %edx
jg 0x2323
cmpl $0x9, %edx
je 0x2336
cmpl $0xa, %edx
je 0x2368
cmpl $0xd, %edx
je 0x2336
jmp 0x23d8
cmpl $0x2f, %edx
je 0x2342
cmpl $0x23, %edx
je 0x2384
cmpl $0x20, %edx
jne 0x23d8
incq %rbp
movq %rbp, 0x20(%r14)
movq %rax, %rdx
jmp 0x237a
cmpb $0x2f, 0x1(%r13,%rbp)
jne 0x23d8
cmpb $0xa, (%r13,%rbp)
je 0x237d
incq %rbp
movq %rbp, 0x20(%r14)
incq 0x18(%r14)
cmpq %rbp, %r12
jne 0x234e
jmp 0x23a4
incq %rbp
movq %rbp, 0x20(%r14)
movq $0x1, 0x18(%r14)
movq %rcx, %rdx
incq (%rdx)
cmpq %r12, %rbp
jne 0x2304
jmp 0x23a4
cmpb $0x21, 0x1(%r13,%rbp)
jne 0x23d8
cmpb $0xa, (%r13,%rbp)
je 0x237d
incq %rbp
movq %rbp, 0x20(%r14)
incq 0x18(%r14)
cmpq %rbp, %r12
jne 0x238c
movq 0x10(%r14), %rax
movq 0x18(%r14), %r15
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x28, 0x20(%rbx)
addq %r12, %r13
movq %r13, 0x10(%rbx)
movq $0x0, 0x18(%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%r14), %rax
movq 0x18(%r14), %r15
movq %r12, %rcx
subq %rbp, %rcx
je 0x23ac
movq %rcx, 0x18(%rsp)
movq %rax, (%rsp)
leaq 0x1(%rbp), %rax
movq %rax, 0x10(%rsp)
movq %rax, 0x20(%r14)
leaq 0x1(%r15), %rax
movq %rax, 0x18(%r14)
leaq (%r13,%rbp), %rax
movq %rax, 0x8(%rsp)
movsbq (%r13,%rbp), %rax
movq %rax, 0x20(%rsp)
callq 0x1200
movq 0x20(%rsp), %r8
movq (%rax), %rax
movzwl (%rax,%r8,2), %ecx
btl $0xb, %ecx
jb 0x249d
movq 0x10(%rsp), %rdi
testb $0x8, %cl
jne 0x24b1
movzbl %r8b, %eax
leal -0x21(%rax), %ecx
cmpl $0x1d, %ecx
movq 0x8(%rsp), %rdx
ja 0x25c7
movq %rdi, %rsi
leaq 0x4c10(%rip), %rax      # 0x706c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0xc, %eax
cmpq %r12, %rsi
je 0x29e7
cmpb $0x3d, (%r13,%rsi)
movq (%rsp), %rcx
jne 0x29ee
leaq 0x2(%rbp), %rsi
movq %rsi, 0x20(%r14)
leaq 0x2(%r15), %rax
movq %rax, 0x18(%r14)
movl $0xd, %eax
jmp 0x29ee
cmpq %r12, 0x10(%rsp)
jne 0x24eb
movq %r12, %rcx
movq 0x8(%rsp), %r8
jmp 0x2556
cmpq %r12, %rdi
movq 0x8(%rsp), %rdx
je 0x257b
leaq 0x2(%r15), %rcx
movsbq (%r13,%rdi), %rsi
testb $0x8, (%rax,%rsi,2)
je 0x2578
incq %rdi
movq %rdi, 0x20(%r14)
movq %rcx, 0x18(%r14)
incq %rcx
cmpq %rdi, %r12
jne 0x24c3
jmp 0x257b
leaq 0x2(,%rbp), %rcx
addq %r13, %rcx
movq %rbp, %rsi
notq %rsi
addq %r12, %rsi
xorl %edx, %edx
movq 0x8(%rsp), %r8
movsbq -0x1(%rcx,%rdx), %rdi
testb $0x8, 0x1(%rax,%rdi,2)
je 0x2538
leaq (%rdx,%rbp), %rdi
addq $0x2, %rdi
movq %rdi, 0x20(%r14)
leaq (%r15,%rdx), %rdi
addq $0x2, %rdi
movq %rdi, 0x18(%r14)
incq %rdx
cmpq %rdx, %rsi
jne 0x2506
movq %r12, %rcx
jmp 0x2556
leaq (%rdx,%rbp), %rcx
incq %rcx
cmpb $0x2e, %dil
jne 0x2556
movsbq 0x2(%rdx,%r8), %rsi
testb $0x8, 0x1(%rax,%rsi,2)
jne 0x25ec
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x16, 0x20(%rbx)
movq %r8, 0x10(%rbx)
subq %rbp, %rcx
movq %rcx, 0x18(%rbx)
jmp 0x23c9
movq %rdi, %r12
subq %rbp, %r12
je 0x2aa5
movzbl (%rdx), %eax
addl $-0x61, %eax
cmpl $0x16, %eax
ja 0x28b0
leaq 0x4a76(%rip), %rcx      # 0x7010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
incq %rdx
decq %r12
leaq 0x4edc(%rip), %rdi      # 0x748c
movl $0x2, %esi
movq %r12, %rcx
callq 0x456d
movl $0x17, %ecx
jmp 0x28ac
cmpl $0x7d, %eax
je 0x2a58
cmpl $0x7b, %eax
jne 0x2646
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x3, 0x20(%rbx)
jmp 0x2a6a
leaq (%rdx,%rbp), %rcx
addq $0x2, %rcx
movq 0x18(%rsp), %rdi
addq $-0x2, %rdi
movq %rcx, 0x20(%r14)
leaq (%r15,%rdx), %rsi
addq $0x2, %rsi
movq %rsi, 0x18(%r14)
cmpq %rdx, %rdi
je 0x2533
addq %r15, %rdx
addq $0x3, %rdx
movsbq (%r13,%rcx), %rsi
testb $0x8, 0x1(%rax,%rsi,2)
je 0x2556
incq %rcx
movq %rcx, 0x20(%r14)
movq %rdx, 0x18(%r14)
incq %rdx
cmpq %rcx, %r12
jne 0x261d
jmp 0x2533
leaq 0xaae3(%rip), %r15      # 0xd130
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
movq %r8, %r12
callq 0x1100
leaq 0x4dd2(%rip), %rdx      # 0x7438
movl $0xff, %esi
movq %r15, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x10d0
movups 0x10(%r14), %xmm0
movups %xmm0, (%rbx)
movl $0x27, 0x20(%rbx)
movq %r15, 0x10(%rbx)
movq %r15, %rdi
callq 0x10a0
jmp 0x28d4
incq %rdx
decq %r12
leaq 0x4e07(%rip), %rdi      # 0x74ac
movl $0x3, %esi
movq %r12, %rcx
movq %rdx, %r13
callq 0x456d
movl $0x23, %ecx
testb %al, %al
jne 0x28b5
movq %r13, %rdx
leaq 0x5653(%rip), %rdi      # 0x7d1f
movl $0x3, %esi
movq %r12, %rcx
callq 0x456d
movl $0x24, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4da7(%rip), %rdi      # 0x7497
movl $0x1, %esi
movq %r12, %rcx
callq 0x456d
movl $0x1d, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4d9f(%rip), %rdi      # 0x74b3
movl $0x4, %esi
movq %r12, %rcx
callq 0x456d
movl $0x26, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4d61(%rip), %rdi      # 0x7499
movl $0x2, %esi
movq %r12, %rcx
callq 0x456d
movl $0x1e, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4d54(%rip), %rdi      # 0x74b0
movl $0x2, %esi
movq %r12, %rcx
callq 0x456d
movl $0x25, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x55a4(%rip), %rdi      # 0x7d24
movl $0x4, %esi
movq %r12, %rcx
movq %rdx, %r13
callq 0x456d
movl $0x1a, %ecx
testb %al, %al
jne 0x28b5
movq %r13, %rdx
leaq 0x4ced(%rip), %rdi      # 0x7494
movl $0x2, %esi
movq %r12, %rcx
callq 0x456d
movl $0x1b, %ecx
testb %al, %al
jne 0x28b5
movq %r13, %rdx
leaq 0x4d0c(%rip), %rdi      # 0x74d7
movl $0x2, %esi
movq %r12, %rcx
callq 0x456d
movl $0x1c, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x5536(%rip), %rdi      # 0x7d25
movl $0x3, %esi
movq %r12, %rcx
callq 0x456d
movl $0x19, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4c7c(%rip), %rdi      # 0x748f
movl $0x4, %esi
movq %r12, %rcx
callq 0x456d
movl $0x18, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4c7a(%rip), %rdi      # 0x74b1
movl $0x1, %esi
movq %r12, %rcx
callq 0x456d
movl $0x1f, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4c44(%rip), %rdi      # 0x749c
movl $0x4, %esi
movq %r12, %rcx
callq 0x456d
movl $0x20, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4c2e(%rip), %rdi      # 0x74a7
movl $0x4, %esi
movq %r12, %rcx
callq 0x456d
movl $0x22, %ecx
jmp 0x28ac
incq %rdx
decq %r12
leaq 0x4c07(%rip), %rdi      # 0x74a1
movl $0x5, %esi
movq %r12, %rcx
callq 0x456d
movl $0x21, %ecx
testb %al, %al
jne 0x28b5
movl $0x14, %ecx
movq 0x20(%r14), %rax
movq (%r14), %rdx
addq %rbp, %rdx
movq (%rsp), %rsi
movq %rsi, (%rbx)
movq %r15, 0x8(%rbx)
movl %ecx, 0x20(%rbx)
movq %rdx, 0x10(%rbx)
subq %rbp, %rax
movq %rax, 0x18(%rbx)
jmp 0x23c9
movl $0x10, %eax
cmpq %r12, %rsi
je 0x29e7
cmpb $0x3d, (%r13,%rsi)
movq (%rsp), %rcx
jne 0x29ee
leaq 0x2(%rbp), %rsi
movq %rsi, 0x20(%r14)
leaq 0x2(%r15), %rax
movq %rax, 0x18(%r14)
movl $0x11, %eax
jmp 0x29ee
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x9, 0x20(%rbx)
jmp 0x2a6a
movl $0x12, %eax
cmpq %r12, %rsi
je 0x29e7
cmpb $0x3d, (%r13,%rsi)
movq (%rsp), %rcx
jne 0x29ee
leaq 0x2(%rbp), %rsi
movq %rsi, 0x20(%r14)
leaq 0x2(%r15), %rax
movq %rax, 0x18(%r14)
movl $0x13, %eax
jmp 0x29ee
movq %r14, %rdi
movq %rbx, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2ac4
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x8, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x1, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x2, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0xb, 0x20(%rbx)
jmp 0x2a6a
movl $0xe, %eax
cmpq %r12, %rsi
jne 0x2a7b
movq %r12, %rsi
movq (%rsp), %rcx
movq %rcx, (%rbx)
movq %r15, 0x8(%rbx)
movl %eax, 0x20(%rbx)
movq %rdx, 0x10(%rbx)
subq %rbp, %rsi
movq %rsi, 0x18(%rbx)
jmp 0x23c9
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x6, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x7, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0xa, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x5, 0x20(%rbx)
jmp 0x2a6a
movq (%rsp), %rax
movq %rax, (%rbx)
movq %r15, 0x8(%rbx)
movl $0x4, 0x20(%rbx)
movq %rdx, 0x10(%rbx)
movq $0x1, 0x18(%rbx)
jmp 0x23c9
cmpb $0x3d, (%r13,%rsi)
movq (%rsp), %rcx
jne 0x29ee
leaq 0x2(%rbp), %rsi
movq %rsi, 0x20(%r14)
leaq 0x2(%r15), %rax
movq %rax, 0x18(%r14)
movl $0xf, %eax
jmp 0x29ee
leaq 0x499f(%rip), %rdi      # 0x744b
leaq 0x49a3(%rip), %rsi      # 0x7456
leaq 0x49a2(%rip), %rcx      # 0x745c
movl $0xb6, %edx
callq 0x10f0