// File: Mespyr[P]bop-lisp/src/main.cpp
// Function: evalString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int evalString(std::string code) 
{
    TokenList tokens = tokenize(code);
    AST ast = parse(tokens);

    if (ast.error_found) 
    {
        std::cout << ast.error.error() << std::endl;
        return 1;
    }
    AST_Handler ast_buf{ast};
    Evaluator eval;

    while (!ast_buf.eof) 
    {
        Node node = ast_buf.next();
        // ast_out(node.nodes);
        eval.evaluate(node);
        if (eval.error_found) 
        {
            std::cout << eval.error.error() << std::endl;
            ast_buf.eof = true;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3b0, %rsp            # imm = 0x3B0
movq %rdi, %rsi
movq %rsi, -0x10(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0x398(%rbp)
callq 0x3180
movq -0x398(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x18c40
jmp 0x16e04
leaq -0x48(%rbp), %rdi
callq 0x3210
leaq -0xe0(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x17830
jmp 0x16e1f
leaq -0xc8(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x19be0
jmp 0x16e34
leaq -0xe0(%rbp), %rdi
callq 0x17860
testb $0x1, -0xb0(%rbp)
je 0x16f2b
leaq -0xa8(%rbp), %rsi
leaq -0x100(%rbp), %rdi
callq 0x7f80
jmp 0x16e62
movq 0xf15f(%rip), %rdi      # 0x25fc8
leaq -0x100(%rbp), %rsi
callq 0x32b0
movq %rax, -0x3a0(%rbp)
jmp 0x16e7e
movq -0x3a0(%rbp), %rdi
movq 0xf11c(%rip), %rsi      # 0x25fa8
callq 0x3340
jmp 0x16e93
leaq -0x100(%rbp), %rdi
callq 0x3210
movl $0x1, -0x4(%rbp)
movl $0x1, -0x104(%rbp)
jmp 0x17100
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3210
jmp 0x17136
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x1712d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x17860
jmp 0x1712d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x17121
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x3210
jmp 0x17121
leaq -0x180(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x17880
jmp 0x16f40
movl $0x0, -0x110(%rbp)
movb $0x0, -0x10c(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x178f0
jmp 0x16f5f
jmp 0x16f61
movb -0x10c(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x16f72
jmp 0x170bb
leaq -0x2c0(%rbp), %rdi
leaq -0x180(%rbp), %rsi
callq 0x8ce0
jmp 0x16f87
leaq -0x370(%rbp), %rdi
leaq -0x2c0(%rbp), %rsi
callq 0x13dc0
jmp 0x16f9c
leaq -0x300(%rbp), %rdi
leaq -0x250(%rbp), %rsi
leaq -0x370(%rbp), %rdx
callq 0x96e0
jmp 0x16fb8
leaq -0x300(%rbp), %rdi
callq 0x40f0
leaq -0x370(%rbp), %rdi
callq 0x141d0
testb $0x1, -0x188(%rbp)
je 0x1709c
leaq -0x238(%rbp), %rsi
leaq -0x390(%rbp), %rdi
callq 0x8850
jmp 0x16ff2
movq 0xefcf(%rip), %rdi      # 0x25fc8
leaq -0x390(%rbp), %rsi
callq 0x32b0
movq %rax, -0x3a8(%rbp)
jmp 0x1700e
movq -0x3a8(%rbp), %rdi
movq 0xef8c(%rip), %rsi      # 0x25fa8
callq 0x3340
jmp 0x17023
leaq -0x390(%rbp), %rdi
callq 0x3210
movb $0x1, -0x10c(%rbp)
jmp 0x1709c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x170f2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x170e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x170ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x370(%rbp), %rdi
callq 0x141d0
jmp 0x170ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x390(%rbp), %rdi
callq 0x3210
jmp 0x170ad
leaq -0x2c0(%rbp), %rdi
callq 0x141d0
jmp 0x16f61
leaq -0x2c0(%rbp), %rdi
callq 0x141d0
jmp 0x170e6
movl $0x0, -0x4(%rbp)
movl $0x1, -0x104(%rbp)
leaq -0x250(%rbp), %rdi
callq 0x17930
leaq -0x180(%rbp), %rdi
callq 0x17960
jmp 0x17100
leaq -0x250(%rbp), %rdi
callq 0x17930
leaq -0x180(%rbp), %rdi
callq 0x17960
jmp 0x17121
leaq -0xc8(%rbp), %rdi
callq 0x17980
leaq -0x28(%rbp), %rdi
callq 0x17860
movl -0x4(%rbp), %eax
addq $0x3b0, %rsp            # imm = 0x3B0
popq %rbp
retq
leaq -0xc8(%rbp), %rdi
callq 0x17980
leaq -0x28(%rbp), %rdi
callq 0x17860
movq -0x50(%rbp), %rdi
callq 0x3510
nop