// File: /workspace/github_c_makefile_star2_O2/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, %r12
movq %rdi, %r14
movq (%r14), %r15
movq 0x20(%r14), %rbx
cmpq 0x8(%r14), %rbx
je 0x17f8
movzbl (%r15,%rbx), %eax
cmpl $0x9, %eax
je 0x17bf
cmpl $0xa, %eax
je 0x17e3
cmpl $0xd, %eax
je 0x17bf
addq %rbx, %r15
cmpl $0x2f, %eax
je 0x17d2
cmpl $0x23, %eax
je 0x17c9
cmpl $0x20, %eax
jne 0x181e
movq %r14, %rdi
callq 0x1ef6
jmp 0x178c
cmpb $0x21, 0x1(%r15)
je 0x17d9
jmp 0x181e
cmpb $0x2f, 0x1(%r15)
jne 0x181e
movq %r14, %rdi
callq 0x1f5a
jmp 0x178c
incq %rbx
movq %rbx, 0x20(%r14)
movq $0x1, 0x18(%r14)
incq 0x10(%r14)
jmp 0x178c
movups 0x10(%r14), %xmm0
movups %xmm0, (%r12)
movl $0x28, 0x20(%r12)
addq %rbx, %r15
movq %r15, 0x10(%r12)
andq $0x0, 0x18(%r12)
jmp 0x1ec8
movq 0x10(%r14), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%r14), %rax
movq %rax, 0x10(%rsp)
movq %r14, %rdi
callq 0x1ef6
movl %eax, %ebp
callq 0x1200
movq %rax, %r13
movq (%rax), %rax
movsbq %bpl, %rcx
movzwl (%rax,%rcx,2), %eax
btl $0xb, %eax
jb 0x188a
testb $0x8, %al
jne 0x18b9
movzbl %bpl, %eax
leal -0x21(%rax), %ecx
cmpl $0x1d, %ecx
ja 0x1994
leaq 0x47fe(%rip), %rax      # 0x606c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq %r14, %rdi
callq 0x1f13
movzbl %al, %eax
orl $0xc, %eax
jmp 0x1d1e
movq 0x20(%r14), %rax
cmpq 0x8(%r14), %rax
je 0x1968
movq (%r13), %rcx
movq (%r14), %rdx
movsbq (%rdx,%rax), %rsi
testb $0x8, 0x1(%rcx,%rsi,2)
je 0x1935
movq %r14, %rdi
callq 0x1ef6
jmp 0x188a
movq %r12, %rbp
movq 0x20(%r14), %r12
cmpq 0x8(%r14), %r12
je 0x18e2
movq (%r13), %rax
movq (%r14), %rcx
movsbq (%rcx,%r12), %rcx
testb $0x8, (%rax,%rcx,2)
je 0x18e2
movq %r14, %rdi
callq 0x1ef6
jmp 0x18bc
subq %rbx, %r12
je 0x1ed7
movzbl (%r15), %eax
addl $-0x61, %eax
cmpl $0x16, %eax
ja 0x1e9b
leaq 0x470e(%rip), %rcx      # 0x6010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
incq %r15
decq %r12
leaq 0x4b74(%rip), %rdi      # 0x648c
pushq $0x2
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x17
jmp 0x1e9d
cmpb $0x2e, %sil
jne 0x1968
movsbq 0x1(%rdx,%rax), %rdx
testb $0x8, 0x1(%rcx,%rdx,2)
je 0x1968
movq %r14, %rdi
callq 0x1ef6
movq 0x20(%r14), %rax
cmpq 0x8(%r14), %rax
je 0x1968
movq (%r13), %rcx
movq (%r14), %rdx
movsbq (%rdx,%rax), %rdx
jmp 0x1941
movq 0x8(%rsp), %rcx
movq %rcx, (%r12)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%r12)
movl $0x16, 0x20(%r12)
subq %rbx, %rax
addq (%r14), %rbx
movq %rbx, 0x10(%r12)
jmp 0x1d48
cmpl $0x7d, %eax
je 0x1dcd
cmpl $0x7b, %eax
jne 0x19c3
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x3, 0x20(%r12)
jmp 0x1d36
movsbl %bpl, %ebp
leaq 0xa762(%rip), %r15      # 0xc130
movl $0x100, %edx            # imm = 0x100
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
leaq 0x4a54(%rip), %rdx      # 0x6438
movl $0xff, %esi
movq %r15, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x10d0
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
jmp 0x1dfb
incq %r15
decq %r12
leaq 0x4a9c(%rip), %rdi      # 0x64ac
pushq $0x3
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e0e
pushq $0x23
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x4a5d(%rip), %rdi      # 0x6497
pushq $0x1
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x1d
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x4a4f(%rip), %rdi      # 0x64b3
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x26
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x4a0b(%rip), %rdi      # 0x6499
pushq $0x2
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x1e
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x49f8(%rip), %rdi      # 0x64b0
pushq $0x2
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x25
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x5212(%rip), %rdi      # 0x6cf4
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e2b
pushq $0x1a
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x51e9(%rip), %rdi      # 0x6cf5
pushq $0x3
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x19
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x4959(%rip), %rdi      # 0x648f
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x18
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x4951(%rip), %rdi      # 0x64b1
pushq $0x1
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x1f
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x4912(%rip), %rdi      # 0x649c
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x20
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x48f3(%rip), %rdi      # 0x64a7
pushq $0x4
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x22
jmp 0x1e9d
incq %r15
decq %r12
leaq 0x48c3(%rip), %rdi      # 0x64a1
pushq $0x5
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x21
jmp 0x1e9d
movq %r14, %rdi
callq 0x1f13
movzbl %al, %eax
orl $0x10, %eax
jmp 0x1d1e
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x9, 0x20(%r12)
jmp 0x1d36
movq %r14, %rdi
callq 0x1f13
movzbl %al, %eax
orl $0x12, %eax
jmp 0x1d1e
movups 0x10(%r14), %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0x20(%r14), %rbx
movq %rbx, %rax
cmpq 0x8(%r14), %rax
je 0x1dee
movq (%r14), %rcx
movzbl (%rcx,%rax), %edx
cmpl $0xa, %edx
je 0x1c80
cmpl $0x22, %edx
je 0x1e48
movq %r14, %rdi
callq 0x1ef6
movq 0x20(%r14), %rax
jmp 0x1c53
incq %rax
movq %rax, 0x20(%r14)
movq $0x1, 0x18(%r14)
incq 0x10(%r14)
jmp 0x1c53
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x8, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x1, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x2, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0xb, 0x20(%r12)
jmp 0x1d36
movq %r14, %rdi
callq 0x1f13
movzbl %al, %eax
orl $0xe, %eax
movq 0x8(%rsp), %rcx
movq %rcx, (%r12)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%r12)
movl %eax, 0x20(%r12)
movq (%r14), %rax
addq %rbx, %rax
movq %rax, 0x10(%r12)
movq 0x20(%r14), %rax
subq %rbx, %rax
movq %rax, 0x18(%r12)
jmp 0x1ec8
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x6, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x7, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0xa, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x5, 0x20(%r12)
jmp 0x1d36
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq 0x10(%rsp), %rax
movq %rax, 0x8(%r12)
movl $0x4, 0x20(%r12)
jmp 0x1d36
leaq 0x46c3(%rip), %rdx      # 0x64b8
movq %r14, %rdi
movq %r12, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1f36
leaq 0x4eda(%rip), %rdi      # 0x6cef
pushq $0x3
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x24
jmp 0x1e9d
leaq 0x4662(%rip), %rdi      # 0x6494
pushq $0x2
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e7e
pushq $0x1b
jmp 0x1e9d
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%r12)
movl $0x15, 0x20(%r12)
addq %rbx, %rcx
movq %rcx, 0x10(%r12)
subq %rbx, %rax
movq %rax, 0x18(%r12)
movq %r14, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ef6
leaq 0x4652(%rip), %rdi      # 0x64d7
pushq $0x2
popq %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0x38c5
testb %al, %al
je 0x1e9b
pushq $0x1c
jmp 0x1e9d
pushq $0x14
popq %rax
movq 0x8(%rsp), %rcx
movq %rcx, (%rbp)
movq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rbp)
movl %eax, 0x20(%rbp)
movq (%r14), %rax
addq %rbx, %rax
movq %rax, 0x10(%rbp)
movq 0x20(%r14), %rax
subq %rbx, %rax
movq %rax, 0x18(%rbp)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x456d(%rip), %rdi      # 0x644b
leaq 0x4571(%rip), %rsi      # 0x6456
leaq 0x4570(%rip), %rcx      # 0x645c
movl $0xb6, %edx
callq 0x10f0