// File: /workspace/github_cpp_makefile_star2_O3/philpoore[P]Math/./src/Lexer.cpp
// Function: Lexer::tokenize()
vector<Token> Lexer::tokenize() {
    vector<Token> tokens;

    while (i < size) {
        char a = peek();
        if (a == 'i' && peek(1) == 'f') {  // if
            Token t = createToken(TOKEN_IF);
            t.source = "if";
            tokens.push_back(t);
            advance(2);
            continue;
        } else if (peekStr(0, 4) == "else") {  // else
            Token t = createToken(TOKEN_ELSE);
            t.source = "else";
            tokens.push_back(t);
            advance(4);
            continue;
        } else if (isalpha(a)) {
            // idents
            string ident = "";
            Token t = createToken(TOKEN_IDENT);
            while (isalpha(a) || isdigit(a)) {
                ident += a;
                advance();
                a = peek();
            }
            t.source = ident;
            tokens.push_back(t);
            continue;
        } else if (isdigit(a)) {
            Token t = createToken(TOKEN_NUMBER_LITERAL);
            // number literal
            string number = "";
            while (isdigit(a)) {
                number += a;
                advance();
                a = peek();
            }

            // decimal point
            if (a == '.') {
                number += a;
                advance();
                a = peek();
                while (isdigit(a)) {
                    number += a;
                    advance();
                    a = peek();
                }
            }

            t.source = number;
            tokens.push_back(t);
            continue;
        } else if (isspace(a)) {
            string whitespace;

            Token t = createToken(TOKEN_WHITESPACE);
            while (isspace(a)) {
                whitespace += a;
                if (a == '\n') {
                    advanceRow();
                }
                advance();
                a = peek();
            }
            t.source = whitespace;
            tokens.push_back(t);
            continue;
        } else if (a == '*' && peek(1) == '*') {
            Token t = createToken(TOKEN_EXP);
            t.source = "**";
            tokens.push_back(t);
            advance(2);
            continue;
        } else {
            TokenType tt =
                tokenTypeMap.count(a) ? tokenTypeMap.at(a) : (TokenType)a;
            Token t = createToken(tt);
            t.source = a;
            tokens.push_back(t);
            advance();
        }
    }

    Token t = createToken(TOKEN_EOF);
    tokens.push_back(t);

    return tokens;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq %rdi, -0x68(%rbp)
movq $0x0, 0x10(%rdi)
movl 0x20(%rsi), %eax
leaq -0x48(%rbp), %rbx
cmpl 0x24(%rsi), %eax
jge 0x7f15
leaq -0x50(%rbp), %r12
leaq -0x60(%rbp), %r13
leaq -0x88(%rbp), %r15
cltq
movq (%r14), %rcx
leaq (%rcx,%rax), %rsi
movb (%rcx,%rax), %al
movb %al, -0x29(%rbp)
cmpb $0x69, %al
jne 0x7a25
cmpb $0x66, 0x1(%rsi)
jne 0x7a25
movl $0x10e, -0x60(%rbp)     # imm = 0x10E
movq %rbx, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
movl $0x2, %r8d
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x594c(%rip), %rcx      # 0xd344
callq 0x32f0
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
addl $0x2, 0x2c(%r14)
addl $0x2, 0x20(%r14)
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x7bd6
jmp 0x7be2
movq %r12, -0x60(%rbp)
leaq 0x4(%rsi), %rdx
movq %r13, %rdi
callq 0xb494
movq %r13, %rdi
leaq 0x5908(%rip), %rsi      # 0xd347
callq 0x30c0
movl %eax, %r13d
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x7a5c
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x3240
testl %r13d, %r13d
je 0x7b76
movb -0x29(%rbp), %bl
movsbl %bl, %r12d
movl %r12d, %edi
callq 0x3310
testl %eax, %eax
leaq -0x60(%rbp), %r13
je 0x7bf5
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %r15, %rdi
leaq 0x5a18(%rip), %rdx      # 0xd4ad
movq %rdx, %rsi
callq 0xb494
movl $0x101, -0x60(%rbp)     # imm = 0x101
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
movb -0x29(%rbp), %bl
movsbl %bl, %r12d
movl %r12d, %edi
callq 0x3310
testl %eax, %eax
setne %al
addl $-0x30, %r12d
cmpl $0xa, %r12d
setb %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x7b2b
movsbl %bl, %esi
movq %r15, %rdi
callq 0x31e0
incl 0x2c(%r14)
movslq 0x20(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x20(%r14)
movq (%r14), %rcx
movb 0x1(%rcx,%rax), %bl
movb %bl, -0x29(%rbp)
movsbl %bl, %r12d
movl %r12d, %edi
callq 0x3310
testl %eax, %eax
setne %al
addl $-0x30, %r12d
cmpl $0xa, %r12d
setb %cl
orb %al, %cl
jne 0x7ae6
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0x3150
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rbx
cmpq %rbx, %rdi
leaq -0x50(%rbp), %r12
je 0x7b60
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x7be2
movq -0x78(%rbp), %rsi
jmp 0x7bda
movl $0x10f, -0x60(%rbp)     # imm = 0x10F
movq %rbx, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
movl $0x4, %r8d
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x579d(%rip), %rcx      # 0xd347
callq 0x32f0
leaq -0x60(%rbp), %r13
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
addl $0x4, 0x2c(%r14)
addl $0x4, 0x20(%r14)
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
leaq -0x50(%rbp), %r12
je 0x7be2
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3240
movl 0x20(%r14), %eax
cmpl 0x24(%r14), %eax
jl 0x79ab
jmp 0x7f15
leal -0x30(%r12), %eax
cmpl $0x9, %eax
ja 0x7d28
movl $0x102, -0x60(%rbp)     # imm = 0x102
leaq -0x48(%rbp), %rbx
movq %rbx, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
movq %r15, %rdi
leaq 0x5872(%rip), %rdx      # 0xd4ad
movq %rdx, %rsi
callq 0xb494
movsbl -0x29(%rbp), %eax
movl %eax, %ecx
addl $-0x30, %ecx
cmpl $0x9, %ecx
leaq -0x50(%rbp), %r12
ja 0x7c85
movsbl %al, %esi
movq %r15, %rdi
callq 0x31e0
incl 0x2c(%r14)
movslq 0x20(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x20(%r14)
movq (%r14), %rcx
movsbl 0x1(%rcx,%rax), %eax
movb %al, -0x29(%rbp)
movl %eax, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x7c55
cmpb $0x2e, %al
jne 0x7ceb
movq %r15, %rdi
movl $0x2e, %esi
callq 0x31e0
incl 0x2c(%r14)
movslq 0x20(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x20(%r14)
movq (%r14), %rcx
movsbl 0x1(%rcx,%rax), %eax
movb %al, -0x29(%rbp)
movl %eax, %ecx
addl $-0x30, %ecx
cmpl $0x9, %ecx
ja 0x7ceb
movsbl %al, %esi
movq %r15, %rdi
callq 0x31e0
incl 0x2c(%r14)
movslq 0x20(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x20(%r14)
movq (%r14), %rcx
movsbl 0x1(%rcx,%rax), %eax
movb %al, -0x29(%rbp)
movl %eax, %ecx
addl $-0x30, %ecx
cmpl $0xa, %ecx
jb 0x7cbb
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0x3150
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x7a13
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x7a13
movl %r12d, %edi
callq 0x3070
testl %eax, %eax
je 0x7df8
leaq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
xorl %ecx, %ecx
movq %rcx, -0x80(%rbp)
movb %cl, -0x78(%rbp)
movl $0x111, -0x60(%rbp)     # imm = 0x111
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
movq %rcx, -0x50(%rbp)
movb %cl, -0x48(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
movl %r12d, %edi
callq 0x3070
testl %eax, %eax
leaq -0x50(%rbp), %r12
je 0x7dca
movsbl %bl, %esi
movq %r15, %rdi
callq 0x31e0
cmpb $0xa, -0x29(%rbp)
jne 0x7d9e
movl $0x1, 0x2c(%r14)
incl 0x28(%r14)
movl $0x2, %eax
jmp 0x7da4
movl 0x2c(%r14), %eax
incl %eax
movl %eax, 0x2c(%r14)
movslq 0x20(%r14), %rax
leaq 0x1(%rax), %rcx
movl %ecx, 0x20(%r14)
movq (%r14), %rcx
movb 0x1(%rcx,%rax), %bl
movb %bl, -0x29(%rbp)
movsbl %bl, %edi
callq 0x3070
testl %eax, %eax
jne 0x7d7a
leaq -0x58(%rbp), %rdi
movq %r15, %rsi
callq 0x3150
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rbx
cmpq %rbx, %rdi
jne 0x7b54
jmp 0x7b60
cmpb $0x2a, %bl
jne 0x7e63
movslq 0x20(%r14), %rax
movq (%r14), %rcx
cmpb $0x2a, 0x1(%rcx,%rax)
jne 0x7e63
movl $0x109, -0x60(%rbp)     # imm = 0x109
leaq -0x48(%rbp), %rbx
movq %rbx, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
movl $0x2, %r8d
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
leaq 0x5447(%rip), %rcx      # 0xd28a
callq 0x32f0
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
addl $0x2, 0x2c(%r14)
addl $0x2, 0x20(%r14)
jmp 0x7bc9
movq 0xa3d6(%rip), %rax      # 0x12240
testq %rax, %rax
je 0x7eb6
leaq 0xa3c2(%rip), %rcx      # 0x12238
xorl %edx, %edx
cmpb %bl, 0x20(%rax)
setl %dl
cmovgeq %rax, %rcx
movq 0x10(%rax,%rdx,8), %rax
testq %rax, %rax
jne 0x7e76
leaq 0xa3a5(%rip), %rax      # 0x12238
cmpq %rax, %rcx
je 0x7eb6
cmpb 0x20(%rcx), %bl
leaq -0x48(%rbp), %rbx
jl 0x7eba
leaq 0xa388(%rip), %rdi      # 0x12230
leaq -0x29(%rbp), %rsi
callq 0xaee4
movl (%rax), %r12d
jmp 0x7eba
leaq -0x48(%rbp), %rbx
movl %r12d, -0x60(%rbp)
movq %rbx, -0x58(%rbp)
xorl %eax, %eax
movq %rax, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq %rax, -0x38(%rbp)
testl %r12d, %r12d
js 0x7f68
movq 0x28(%r14), %rax
movq %rax, -0x38(%rbp)
movsbl -0x29(%rbp), %r8d
movl $0x1, %ecx
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3390
leaq -0x50(%rbp), %r12
movq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0xae78
incl 0x2c(%r14)
incl 0x20(%r14)
jmp 0x7a13
leaq -0x60(%rbp), %rsi
movl $0x112, (%rsi)          # imm = 0x112
movq %rbx, 0x8(%rsi)
movq $0x0, 0x10(%rsi)
movb $0x0, 0x18(%rsi)
movq 0x28(%r14), %rax
movq %rax, 0x28(%rsi)
movq -0x68(%rbp), %rdi
callq 0xae78
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
je 0x7f55
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x68(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x5585(%rip), %rdi      # 0xd4f4
leaq 0x5593(%rip), %rsi      # 0xd509
leaq 0x559c(%rip), %rcx      # 0xd519
movl $0x24, %edx
callq 0x3170
jmp 0x7fae
jmp 0x7f9c
jmp 0x7f9c
jmp 0x7f9c
movq %rax, %r14
jmp 0x7fd4
jmp 0x7fe7
jmp 0x7fb5
jmp 0x7fae
jmp 0x7f9c
movq %rax, %r14
movq -0x58(%rbp), %rdi
cmpq %rbx, %rdi
jne 0x7fe1
jmp 0x801f
jmp 0x7fe7
jmp 0x7fb5
movq %rax, %r14
jmp 0x801f
jmp 0x7fe7
movq %rax, %r14
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x7fd4
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x801f
movq -0x48(%rbp), %rsi
jmp 0x8017
movq %rax, %r14
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x8003
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x801f
movq -0x78(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x68(%rbp), %rdi
callq 0xaf2e
movq %r14, %rdi
callq 0x3370