// File: /workspace/github_cpp_makefile_star2_O1/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 $0x58, %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 0x107b7
movq %rsi, %r14
movl $0x1, %ebx
xorl %r13d, %r13d
xorl %r12d, %r12d
movl $0x0, -0x54(%rbp)
movl %ebx, %eax
movq (%r14), %rcx
movsbl (%rcx,%r13), %r15d
xorl %ebx, %ebx
cmpl $0xa, %r15d
sete %bl
addl %eax, %ebx
cmpl $0x3b, %r15d
jne 0x104e8
testb $0x1, -0x54(%rbp)
je 0x1057c
testb $0x1, %r12b
jne 0x10625
cmpb $0x27, %r15b
jne 0x10585
leaq -0x80(%rbp), %rdi
movl %r15d, %esi
callq 0x21d0
testb $0x1, -0x54(%rbp)
je 0x10620
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 0x367e
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1149c
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x2b61(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10570
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movl $0x0, -0x54(%rbp)
jmp 0x10625
xorb $0x1, %r12b
jmp 0x10625
testb $0x1, -0x54(%rbp)
je 0x1059c
leaq -0x80(%rbp), %rdi
movl %r15d, %esi
callq 0x21d0
jmp 0x10625
movl %r15d, %edi
callq 0x2070
testl %eax, %eax
je 0x10637
leaq -0x80(%rbp), %rdi
leaq 0x2af9(%rip), %rsi      # 0x130b0
callq 0x20d0
testl %eax, %eax
je 0x10605
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 0x367e
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1149c
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10605
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x2a9a(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
jmp 0x10625
movb $0x1, %al
movl %eax, -0x54(%rbp)
incq %r13
cmpq %r13, 0x8(%r14)
ja 0x104c3
jmp 0x107b7
cmpb $0x29, %r15b
je 0x106f4
movzbl %r15b, %eax
cmpl $0x28, %eax
jne 0x1058b
leaq -0x80(%rbp), %rdi
leaq 0x2a57(%rip), %rsi      # 0x130b0
callq 0x20d0
testl %eax, %eax
je 0x106a7
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 0x367e
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1149c
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x106a7
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movl %ebx, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
leaq 0x3812(%rip), %rsi      # 0x13ecf
leaq 0x380c(%rip), %rdx      # 0x13ed0
callq 0x3766
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1149c
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x29c9(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
jmp 0x10795
leaq -0x80(%rbp), %rdi
leaq 0x29b1(%rip), %rsi      # 0x130b0
callq 0x20d0
testl %eax, %eax
je 0x1074d
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 0x367e
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1149c
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1074d
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
movl %ebx, -0x50(%rbp)
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
leaq 0x3649(%rip), %rsi      # 0x13dac
leaq 0x3643(%rip), %rdx      # 0x13dad
callq 0x3766
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1149c
movq -0x78(%rbp), %rdx
leaq -0x80(%rbp), %rdi
xorl %esi, %esi
leaq 0x2923(%rip), %rcx      # 0x130b0
xorl %r8d, %r8d
callq 0x2350
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x10625
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
jmp 0x10625
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x107d0
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2240
movq -0x60(%rbp), %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x107f9
jmp 0x10817
jmp 0x107f9
jmp 0x10817
jmp 0x10817
jmp 0x10817
jmp 0x107f9
jmp 0x107f9
jmp 0x107f9
jmp 0x10817
jmp 0x10817
movq %rax, %r14
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1081a
movq -0x38(%rbp), %rsi
incq %rsi
callq 0x2240
jmp 0x1081a
movq %rax, %r14
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x10833
movq -0x70(%rbp), %rsi
incq %rsi
callq 0x2240
movq -0x60(%rbp), %rdi
callq 0x1025e
movq %r14, %rdi
callq 0x23a0