// File: /workspace/github_cpp_makefile_star2_O3/Mespyr[P]bop-lisp/src/parser.cpp
// Function: tokenize(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
TokenList tokenize(std::string code) 
{
    TokenList stream;
    std::string word;
    bool string_has_started = false;
    bool in_comment = false;

    unsigned int line = 1;

    for (int i = 0; i < code.length(); i++)
    {
        char buf = code.at(i);
        if (buf == '\n') 
        {
            line++;
        }
        if (buf == ';' and !string_has_started) 
        {
            in_comment = !in_comment;
        } 
        else if(in_comment);

        else if (buf == '\'') 
        {
            word.push_back(buf);
            if(!string_has_started) 
            {
                string_has_started = true;
            } 
            else 
            {
                Token tok{line, word};
                stream.token_stream.push_back(tok);
                string_has_started = false;
                word = "";
            }
        } 
        else if (string_has_started) 
        {
            word.push_back(buf);
        }
        else if (isspace(buf)) 
        {
            if (word != "") 
            {
                Token tok{line, word};
                stream.token_stream.push_back(tok);
            }
            word = "";
        } 
        else if (buf == '(') 
        {
            if (word != "") 
            {
                Token tok{line, word};
                stream.token_stream.push_back(tok);
            }
            Token tok{line, "("};
            stream.token_stream.push_back(tok);
            word = "";
        }
        else if (buf == ')') 
        {
            if (word != "") 
            {
                Token tok{line, word};
                stream.token_stream.push_back(tok);
            }
            Token tok{line, ")"};
            stream.token_stream.push_back(tok);
            word = "";
        }
        else 
        {
            word.push_back(buf);
        }
    }

    return stream;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
xorl %eax, %eax
movq %rax, 0x10(%rdi)
xorps %xmm0, %xmm0
movq %rdi, -0x60(%rbp)
movups %xmm0, (%rdi)
leaq -0x70(%rbp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
cmpq %rax, 0x8(%rsi)
je 0x107c6
movq %rsi, %r14
movl $0x1, %ebx
xorl %r15d, %r15d
movq $0x0, -0x88(%rbp)
movl $0x0, -0x54(%rbp)
movl %ebx, %r13d
movq (%r14), %rax
movsbl (%rax,%r15), %r12d
xorl %ebx, %ebx
cmpl $0xa, %r12d
sete %bl
addl %r13d, %ebx
cmpl $0x3b, %r12d
jne 0x104c8
testb $0x1, -0x54(%rbp)
je 0x10562
testb $0x1, -0x88(%rbp)
je 0x1057d
jmp 0x10617
testb $0x1, -0x88(%rbp)
jne 0x10617
cmpb $0x27, %r12b
jne 0x10577
leaq -0x80(%rbp), %rdi
movl $0x27, %esi
callq 0x21d0
testb $0x1, -0x54(%rbp)
je 0x10612
movl %r13d, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x3688
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x114c8
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x2b7b(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10556
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movl $0x0, -0x54(%rbp)
jmp 0x10617
movq -0x88(%rbp), %rax
xorb $0x1, %al
movq %rax, -0x88(%rbp)
jmp 0x10617
testb $0x1, -0x54(%rbp)
je 0x1058e
leaq -0x80(%rbp), %rdi
movl %r12d, %esi
callq 0x21d0
jmp 0x10617
movl %r12d, %edi
callq 0x2070
testl %eax, %eax
je 0x10629
leaq -0x80(%rbp), %rdi
leaq 0x2b07(%rip), %rsi      # 0x130b0
callq 0x20d0
testl %eax, %eax
je 0x105f7
movl %ebx, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x3688
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x114c8
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x105f7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x2aa8(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
jmp 0x10617
movb $0x1, %al
movl %eax, -0x54(%rbp)
incq %r15
cmpq %r15, 0x8(%r14)
ja 0x1048f
jmp 0x107ad
cmpb $0x29, %r12b
je 0x106e8
movzbl %r12b, %eax
cmpl $0x28, %eax
jne 0x1057d
leaq -0x80(%rbp), %rdi
leaq 0x2a65(%rip), %rsi      # 0x130b0
callq 0x20d0
testl %eax, %eax
je 0x1069a
movl %r13d, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x3688
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x114c8
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1069a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movl %r13d, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
leaq 0x381e(%rip), %rsi      # 0x13ecf
leaq 0x3818(%rip), %rdx      # 0x13ed0
callq 0x3774
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x114c8
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x29d5(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
jmp 0x1078b
leaq -0x80(%rbp), %rdi
leaq 0x29bd(%rip), %rsi      # 0x130b0
callq 0x20d0
testl %eax, %eax
je 0x10742
movl %r13d, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x80(%rbp), %rsi
movq -0x78(%rbp), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x3688
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x114c8
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10742
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movl %r13d, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
leaq 0x3653(%rip), %rsi      # 0x13dac
leaq 0x364d(%rip), %rdx      # 0x13dad
callq 0x3774
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x114c8
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x292d(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10617
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
jmp 0x10617
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x107c6
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2240
movq -0x60(%rbp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x107ef
jmp 0x1080d
jmp 0x107ef
jmp 0x1080d
jmp 0x1080d
jmp 0x1080d
jmp 0x107ef
jmp 0x107ef
jmp 0x107ef
jmp 0x1080d
jmp 0x1080d
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10810
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
jmp 0x10810
movq %rax, %r14
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x10829
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2240
movq -0x60(%rbp), %rdi
callq 0x10218
movq %r14, %rdi
callq 0x23a0