// File: /workspace/github_cpp_makefile_star2_O1/tsoding[P]wcc/src/./wcc_alexer.cpp
// Function: Alexer::tokenize()
void Alexer::tokenize()
{
    auto source = input.trim_begin();
    while (source.count > 0) {
        if (is_symbol_start(*source.data)) {
            String_View token_text = chop_while(&source, is_symbol);

            if (token_text == "while"_sv) {
                tokens.push(Token {Token_Type::While, token_text});
            } else if (token_text == "func"_sv) {
                tokens.push(Token {Token_Type::Func, token_text});
            } else if (token_text == "local"_sv) {
                tokens.push(Token {Token_Type::Local, token_text});
            } else if (token_text == "if"_sv) {
                tokens.push(Token {Token_Type::If, token_text});
            } else if (token_text == "else"_sv) {
                tokens.push(Token {Token_Type::Else, token_text});
            } else if (token_text == "return"_sv) {
                tokens.push(Token {Token_Type::Return, token_text});
            } else if (token_text == "true"_sv) {
                tokens.push(Token {Token_Type::True, token_text});
            } else if (token_text == "false"_sv) {
                tokens.push(Token {Token_Type::False, token_text});
            } else {
                tokens.push(Token {Token_Type::Symbol, token_text});
            }
        } else if (isdigit(*source.data)) {
            String_View token_text = chop_while(&source, isdigit);
            tokens.push(Token {Token_Type::Number_Literal, token_text});
        } else {
            switch (*source.data) {
            case '(':
                tokens.push(Token {Token_Type::Open_Paren, chop_off(&source, 1)});
                break;
            case ')':
                tokens.push(Token {Token_Type::Closed_Paren, chop_off(&source, 1)});
                break;
            case ':':
                tokens.push(Token {Token_Type::Colon, chop_off(&source, 1)});
                break;
            case '{':
                tokens.push(Token {Token_Type::Open_Curly, chop_off(&source, 1)});
                break;
            case '}':
                tokens.push(Token {Token_Type::Closed_Curly, chop_off(&source, 1)});
                break;
            case '=':
                if (source.count > 1 && source.data[1] == '=') {
                    tokens.push(Token {Token_Type::Equals_Equals, chop_off(&source, 2)});
                } else {
                    tokens.push(Token {Token_Type::Equals, chop_off(&source, 1)});
                }
                break;
            case '>':
                tokens.push(Token {Token_Type::Greater, chop_off(&source, 1)});
                break;
            case '<':
                if (source.count > 1 && source.data[1] == '=') {
                    tokens.push(Token {Token_Type::Less_Equals, chop_off(&source, 2)});
                } else {
                    reporter.fail(static_cast<size_t>(source.data - input.data), "Unexpected character `", *source.data, "`");
                }
                break;
            case '&':
                if (source.count > 1 && source.data[1] == '&') {
                    tokens.push(Token {Token_Type::And, chop_off(&source, 2)});
                } else {
                    reporter.fail(static_cast<size_t>(source.data - input.data), "Unexpected character `", *source.data, "`");
                }
                break;
            case ',':
                tokens.push(Token {Token_Type::Comma, chop_off(&source, 1)});
                break;
            case '+':
                if (source.count > 1 && source.data[1] == '=') {
                    tokens.push(Token {Token_Type::Plus_Equals, chop_off(&source, 2)});
                } else {
                    tokens.push(Token {Token_Type::Plus, chop_off(&source, 1)});
                }
                break;
            case '*':
                tokens.push(Token {Token_Type::Asterisk, chop_off(&source, 1)});
                break;
            case '/':
                if (source.count > 1 && source.data[1] == '/') {
                    chop_while(&source, is_not_newline);
                } else {
                    reporter.fail(static_cast<size_t>(source.data - input.data), "Unexpected character `", *source.data, "`");
                }
                break;
            case '%':
                tokens.push(Token {Token_Type::Rem, chop_off(&source, 1)});
                break;
            case '-':
                if (source.count > 1 && source.data[1] == '=') {
                    tokens.push(Token {Token_Type::Minus_Equals, chop_off(&source, 2)});
                } else {
                    tokens.push(Token {Token_Type::Minus, chop_off(&source, 1)});
                }
                break;
            case ';':
                tokens.push(Token {Token_Type::Semicolon, chop_off(&source, 1)});
                break;

            default: {
                assert(input.data <= source.data);
                reporter.fail(static_cast<size_t>(source.data - input.data), "Unexpected character `", *source.data, "`");
            }
            }
        }
        source = source.trim_begin();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, -0x40(%rbp)
callq 0x7298
movq %rax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
testq %rax, %rax
je 0x315d
movq %rax, %r14
movq %rdx, %r12
movq -0x40(%rbp), %rax
leaq 0x10(%rax), %rbx
leaq -0x38(%rbp), %r13
movq %rbx, -0x48(%rbp)
movsbl (%r12), %r15d
movl %r15d, %edi
callq 0x1150
cmpl $0x5f, %r15d
je 0x2908
testl %eax, %eax
jne 0x2908
leal -0x30(%r15), %eax
cmpl $0x9, %eax
ja 0x2a8e
cmpq $0x1, %r14
movq %r14, %rcx
adcq $0x0, %rcx
xorl %eax, %eax
movsbl (%r12,%rax), %edx
addl $-0x3a, %edx
cmpl $-0xa, %edx
jb 0x28e9
incq %rax
cmpq %rax, %rcx
jne 0x28d1
movq %rcx, %rax
movq %r14, %rcx
subq %rax, %rcx
jae 0x2aeb
addq %r14, %r12
movq %r12, -0x30(%rbp)
xorl %eax, %eax
xorl %r12d, %r12d
xorl %ecx, %ecx
jmp 0x2af3
cmpq $0x1, %r14
movq %r14, %rbx
adcq $0x0, %rbx
xorl %r15d, %r15d
movsbl (%r12,%r15), %r13d
movl %r13d, %edi
callq 0x10b0
cmpl $0x5f, %r13d
je 0x292d
testl %eax, %eax
je 0x2938
incq %r15
cmpq %r15, %rbx
jne 0x2916
movq %rbx, %r15
movq %r14, %rax
subq %r15, %rax
movq -0x48(%rbp), %rbx
jae 0x2955
addq %r14, %r12
movq %r12, -0x30(%rbp)
xorl %r15d, %r15d
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0x295d
leaq (%r12,%r15), %rcx
movq %rcx, -0x30(%rbp)
leaq -0x38(%rbp), %r13
movq %rax, -0x38(%rbp)
cmpq $0x5, %r15
jne 0x2985
movq %r12, %rdi
leaq 0x7fa4(%rip), %rsi      # 0xa919
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2b20
cmpq $0x4, %r15
jne 0x29a5
movq %r12, %rdi
leaq 0x7f8a(%rip), %rsi      # 0xa91f
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2b49
cmpq $0x5, %r15
jne 0x29c5
movq %r12, %rdi
leaq 0x82c6(%rip), %rsi      # 0xac7b
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2b72
cmpq $0x2, %r15
jne 0x29e5
movq %r12, %rdi
leaq 0x8fbf(%rip), %rsi      # 0xb994
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2b9b
cmpq $0x4, %r15
jne 0x2a05
movq %r12, %rdi
leaq 0x7f2f(%rip), %rsi      # 0xa924
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2bc4
cmpq $0x6, %r15
jne 0x2a25
movq %r12, %rdi
leaq 0x7f14(%rip), %rsi      # 0xa929
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2bed
cmpq $0x4, %r15
jne 0x2a45
movq %r12, %rdi
leaq 0x7987(%rip), %rsi      # 0xa3bc
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2c65
cmpq $0x5, %r15
jne 0x2a65
movq %r12, %rdi
leaq 0x796c(%rip), %rsi      # 0xa3c1
movq %r15, %rdx
callq 0x10c0
testl %eax, %eax
je 0x2c8e
movl $0x1, -0x228(%rbp)
movq %r15, -0x220(%rbp)
movq %r12, -0x218(%rbp)
movq %r12, 0x10(%rsp)
movups -0x228(%rbp), %xmm0
jmp 0x3123
movzbl %r15b, %eax
leal -0x25(%rax), %ecx
cmpl $0x19, %ecx
ja 0x2c16
leaq 0x763f(%rip), %rdx      # 0xa0e4
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movl $0x15, -0xa8(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0xa0(%rbp)
movq %r12, -0x98(%rbp)
movq %r12, 0x10(%rsp)
movups -0xa8(%rbp), %xmm0
jmp 0x3123
leaq (%r12,%rax), %rdx
movq %rdx, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
movl $0xb, -0x210(%rbp)
movq %rax, -0x208(%rbp)
movq %r12, -0x200(%rbp)
movq %r12, 0x10(%rsp)
movups -0x210(%rbp), %xmm0
jmp 0x3123
movl $0xc, -0x2e8(%rbp)
movq %r15, -0x2e0(%rbp)
movq %r12, -0x2d8(%rbp)
movq %r12, 0x10(%rsp)
movups -0x2e8(%rbp), %xmm0
jmp 0x3123
movl $0x0, -0x2d0(%rbp)
movq %r15, -0x2c8(%rbp)
movq %r12, -0x2c0(%rbp)
movq %r12, 0x10(%rsp)
movups -0x2d0(%rbp), %xmm0
jmp 0x3123
movl $0x8, -0x2b8(%rbp)
movq %r15, -0x2b0(%rbp)
movq %r12, -0x2a8(%rbp)
movq %r12, 0x10(%rsp)
movups -0x2b8(%rbp), %xmm0
jmp 0x3123
movl $0x16, -0x2a0(%rbp)
movq %r15, -0x298(%rbp)
movq %r12, -0x290(%rbp)
movq %r12, 0x10(%rsp)
movups -0x2a0(%rbp), %xmm0
jmp 0x3123
movl $0x17, -0x288(%rbp)
movq %r15, -0x280(%rbp)
movq %r12, -0x278(%rbp)
movq %r12, 0x10(%rsp)
movups -0x288(%rbp), %xmm0
jmp 0x3123
movl $0x19, -0x270(%rbp)
movq %r15, -0x268(%rbp)
movq %r12, -0x260(%rbp)
movq %r12, 0x10(%rsp)
movups -0x270(%rbp), %xmm0
jmp 0x3123
cmpl $0x7b, %eax
je 0x3046
cmpl $0x7d, %eax
jne 0x3194
movl $0x7, -0x198(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x190(%rbp)
movq %r12, -0x188(%rbp)
movq %r12, 0x10(%rsp)
movups -0x198(%rbp), %xmm0
jmp 0x3123
movl $0x1a, -0x258(%rbp)
movq %r15, -0x250(%rbp)
movq %r12, -0x248(%rbp)
movq %r12, 0x10(%rsp)
movups -0x258(%rbp), %xmm0
jmp 0x3123
movl $0x1b, -0x240(%rbp)
movq %r15, -0x238(%rbp)
movq %r12, -0x230(%rbp)
movq %r12, 0x10(%rsp)
movups -0x240(%rbp), %xmm0
jmp 0x3123
movl $0xd, -0x150(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x148(%rbp)
movq %r12, -0x140(%rbp)
movq %r12, 0x10(%rsp)
movups -0x150(%rbp), %xmm0
jmp 0x3123
cmpq $0x1, %r14
je 0x3083
cmpb $0x3d, 0x1(%r12)
jne 0x3083
movl $0xa, -0x180(%rbp)
leaq 0x2(%r12), %rax
movq %rax, -0x30(%rbp)
addq $-0x2, %r14
movq %r14, -0x38(%rbp)
movq $0x2, -0x178(%rbp)
movq %r12, -0x170(%rbp)
movq %r12, 0x10(%rsp)
movups -0x180(%rbp), %xmm0
jmp 0x3123
movl $0x13, -0x60(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x58(%rbp)
movq %r12, -0x50(%rbp)
movq %r12, 0x10(%rsp)
movups -0x60(%rbp), %xmm0
jmp 0x3123
movl $0x18, -0xc0(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0xb8(%rbp)
movq %r12, -0xb0(%rbp)
movq %r12, 0x10(%rsp)
movups -0xc0(%rbp), %xmm0
jmp 0x3123
movl $0x4, -0x1c8(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x1c0(%rbp)
movq %r12, -0x1b8(%rbp)
movq %r12, 0x10(%rsp)
movups -0x1c8(%rbp), %xmm0
jmp 0x3123
cmpq $0x1, %r14
je 0x316f
cmpb $0x26, 0x1(%r12)
jne 0x316f
movl $0x14, -0x120(%rbp)
leaq 0x2(%r12), %rax
movq %rax, -0x30(%rbp)
addq $-0x2, %r14
movq %r14, -0x38(%rbp)
movq $0x2, -0x118(%rbp)
movq %r12, -0x110(%rbp)
movq %r12, 0x10(%rsp)
movups -0x120(%rbp), %xmm0
jmp 0x3123
movl $0x3, -0x1e0(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x1d8(%rbp)
movq %r12, -0x1d0(%rbp)
movq %r12, 0x10(%rsp)
movups -0x1e0(%rbp), %xmm0
jmp 0x3123
movl $0x5, -0x108(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x100(%rbp)
movq %r12, -0xf8(%rbp)
movq %r12, 0x10(%rsp)
movups -0x108(%rbp), %xmm0
jmp 0x3123
cmpq $0x1, %r14
je 0x30bd
cmpb $0x3d, 0x1(%r12)
jne 0x30bd
movl $0x10, -0x90(%rbp)
leaq 0x2(%r12), %rax
movq %rax, -0x30(%rbp)
addq $-0x2, %r14
movq %r14, -0x38(%rbp)
movq $0x2, -0x88(%rbp)
movq %r12, -0x80(%rbp)
movq %r12, 0x10(%rsp)
movups -0x90(%rbp), %xmm0
jmp 0x3123
movl $0x2, -0x1f8(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x1f0(%rbp)
movq %r12, -0x1e8(%rbp)
movq %r12, 0x10(%rsp)
movups -0x1f8(%rbp), %xmm0
jmp 0x3123
cmpq $0x1, %r14
je 0x316f
cmpb $0x2f, 0x1(%r12)
jne 0x316f
cmpq $0x1, %r14
movq %r14, %rcx
adcq $0x0, %rcx
xorl %eax, %eax
cmpb $0xa, (%r12,%rax)
je 0x2f84
incq %rax
cmpq %rax, %rcx
jne 0x2f72
movq %rcx, %rax
movq %r14, %rcx
subq %rax, %rcx
jae 0x3150
addq %r14, %r12
movq %r12, -0x30(%rbp)
xorl %ecx, %ecx
jmp 0x3157
cmpq $0x1, %r14
je 0x30eb
cmpb $0x3d, 0x1(%r12)
jne 0x30eb
movl $0x11, -0xf0(%rbp)
leaq 0x2(%r12), %rax
movq %rax, -0x30(%rbp)
addq $-0x2, %r14
movq %r14, -0x38(%rbp)
movq $0x2, -0xe8(%rbp)
movq %r12, -0xe0(%rbp)
movq %r12, 0x10(%rsp)
movups -0xf0(%rbp), %xmm0
jmp 0x3123
cmpq $0x1, %r14
je 0x316f
cmpb $0x3d, 0x1(%r12)
jne 0x316f
movl $0xe, -0x138(%rbp)
leaq 0x2(%r12), %rax
movq %rax, -0x30(%rbp)
addq $-0x2, %r14
movq %r14, -0x38(%rbp)
movq $0x2, -0x130(%rbp)
movq %r12, -0x128(%rbp)
movq %r12, 0x10(%rsp)
movups -0x138(%rbp), %xmm0
jmp 0x3123
movl $0x6, -0x1b0(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x1a8(%rbp)
movq %r12, -0x1a0(%rbp)
movq %r12, 0x10(%rsp)
movups -0x1b0(%rbp), %xmm0
jmp 0x3123
movl $0x9, -0x168(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x160(%rbp)
movq %r12, -0x158(%rbp)
movq %r12, 0x10(%rsp)
movups -0x168(%rbp), %xmm0
jmp 0x3123
movl $0x12, -0x78(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0x70(%rbp)
movq %r12, -0x68(%rbp)
movq %r12, 0x10(%rsp)
movups -0x78(%rbp), %xmm0
jmp 0x3123
movl $0xf, -0xd8(%rbp)
leaq 0x1(%r12), %rax
movq %rax, -0x30(%rbp)
decq %r14
movq %r14, -0x38(%rbp)
movq $0x1, -0xd0(%rbp)
movq %r12, -0xc8(%rbp)
movq %r12, 0x10(%rsp)
movups -0xd8(%rbp), %xmm0
movups %xmm0, (%rsp)
movq %rbx, %rdi
callq 0x72e0
movq %r13, %rdi
callq 0x7298
movq %rax, %r14
movq %rdx, %r12
movq %rax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
testq %rax, %rax
jne 0x28a0
jmp 0x315d
addq %rax, %r12
movq %r12, -0x30(%rbp)
movq %rcx, -0x38(%rbp)
jmp 0x312f
addq $0x2d8, %rsp            # imm = 0x2D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x40(%rbp), %rdi
subq 0x8(%rdi), %r12
addq $0x28, %rdi
leaq 0x77ae(%rip), %rdx      # 0xa930
leaq 0x74f8(%rip), %r8       # 0xa681
movq %r12, %rsi
movl %r15d, %ecx
callq 0x7362
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
cmpq %r12, %rax
jbe 0x31c0
leaq 0x779f(%rip), %rdi      # 0xa947
leaq 0x77b2(%rip), %rsi      # 0xa961
leaq 0x77c0(%rip), %rcx      # 0xa976
movl $0xb2, %edx
callq 0x1090
movq -0x40(%rbp), %rdi
addq $0x28, %rdi
subq %rax, %r12
jmp 0x317b
nop