// File: Heptagon196[P]Gos/GosASTCompiler.cpp
// Function: Gos::AST::Symbol::CompileAST(Gos::Compiler::VMCompiler&)
Compile(Symbol) { 
    compilingLine = token.line;
    if (token.str == "true" || token.str == "false") {
        int num = code.GetTmpVar();
        int tmp = code.GetTmpVar();
        GosVM::RTConstNum val;
        val.data.i32 = token.str == "true" ? 1 : 0;
        vm.WriteCommandNewNum(1, num, val);
        vm.WriteCommandNew("bool", tmp, { num });
        return tmp;
    }
    std::string errorInfo = "";
    int ret = code.currentScope->GetVarID(token.str, errorInfo);
    if (errorInfo.size() > 0) {
        int& cache = GetFieldCache(code.currentScope, token.str);
        if (cache != -1) {
            return cache;
        }
        for (std::string& s : compilingClassVars) {
            if (s == token.str) {
                int tmp = code.GetTmpVar();
                vm.WriteCommandGetField(tmp, 1, token.str);
                cache = tmp;
                return tmp;
            }
        }
        std::cerr << errorInfo << std::endl;
    }
    return ret;
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x138(%rsp)
movq %rsi, 0x130(%rsp)
movq 0x138(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movl 0x2c(%rdi), %eax
movl %eax, 0x12ce4b(%rip)    # 0x3022f8
addq $0x28, %rdi
addq $0x18, %rdi
leaq 0x4cb74(%rip), %rsi     # 0x222030
callq 0x56430
testb $0x1, %al
jne 0x1d54e7
movq 0x48(%rsp), %rdi
addq $0x28, %rdi
addq $0x18, %rdi
leaq 0x4cb5c(%rip), %rsi     # 0x222035
callq 0x56430
testb $0x1, %al
jne 0x1d54e7
jmp 0x1d56f2
movq 0x130(%rsp), %rdi
callq 0x1d5250
movl %eax, 0x12c(%rsp)
movq 0x130(%rsp), %rdi
callq 0x1d5250
movq 0x48(%rsp), %rdi
movl %eax, 0x128(%rsp)
addq $0x40, %rdi
leaq 0x4cb11(%rip), %rsi     # 0x222030
callq 0x56430
movzbl %al, %eax
movl %eax, 0x120(%rsp)
movq 0x130(%rsp), %rax
movq 0xe8(%rax), %rdi
movl 0x12c(%rsp), %edx
movq 0x120(%rsp), %rax
movq %rax, 0x118(%rsp)
movq 0x118(%rsp), %rcx
movl $0x1, %esi
callq 0x1b10d0
movq 0x130(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x38(%rsp)
leaq 0xf7(%rsp), %rdi
movq %rdi, 0x40(%rsp)
callq 0x13570
movq 0x40(%rsp), %rdx
leaq 0x4caa3(%rip), %rsi     # 0x22203b
leaq 0xf8(%rsp), %rdi
callq 0x165520
jmp 0x1d55a7
movl 0x128(%rsp), %eax
movl %eax, 0x2c(%rsp)
movl 0x12c(%rsp), %eax
movl %eax, 0xb4(%rsp)
leaq 0xb4(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq $0x1, 0xc0(%rsp)
leaq 0xb3(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x5ae50
movq 0x30(%rsp), %rcx
movq 0xb8(%rsp), %rsi
movq 0xc0(%rsp), %rdx
leaq 0xc8(%rsp), %rdi
callq 0x1dd1f0
jmp 0x1d5612
movl 0x2c(%rsp), %edx
movq 0x38(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
leaq 0xc8(%rsp), %rcx
callq 0x1b0f40
jmp 0x1d5632
leaq 0xc8(%rsp), %rdi
callq 0x1dd280
leaq 0xb3(%rsp), %rdi
callq 0x5ae60
leaq 0xf8(%rsp), %rdi
callq 0x52f50
leaq 0xf7(%rsp), %rdi
callq 0x136a0
movl 0x128(%rsp), %eax
movl %eax, 0x144(%rsp)
jmp 0x1d5955
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x1d56e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
jmp 0x1d56c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0xc8(%rsp), %rdi
callq 0x1dd280
leaq 0xb3(%rsp), %rdi
callq 0x5ae60
leaq 0xf8(%rsp), %rdi
callq 0x52f50
leaq 0xf7(%rsp), %rdi
callq 0x136a0
jmp 0x1d5964
leaq 0x8f(%rsp), %rdi
movq %rdi, 0x20(%rsp)
callq 0x13570
movq 0x20(%rsp), %rdx
leaq 0x4b5b6(%rip), %rsi     # 0x220cc6
leaq 0x90(%rsp), %rdi
callq 0x165520
jmp 0x1d571f
leaq 0x8f(%rsp), %rdi
callq 0x136a0
movq 0x48(%rsp), %rsi
movq 0x130(%rsp), %rax
movq 0xd0(%rax), %rdi
addq $0x40, %rsi
leaq 0x90(%rsp), %rdx
callq 0x1d4d90
movl %eax, 0x1c(%rsp)
jmp 0x1d5757
movl 0x1c(%rsp), %eax
movl %eax, 0x88(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x55060
cmpq $0x0, %rax
jbe 0x1d5932
movq 0x48(%rsp), %rsi
movq 0x130(%rsp), %rax
movq 0xd0(%rax), %rdi
addq $0x40, %rsi
callq 0x1d5980
movq %rax, 0x10(%rsp)
jmp 0x1d579d
movq 0x10(%rsp), %rax
movq %rax, 0x80(%rsp)
movq 0x80(%rsp), %rax
cmpl $-0x1, (%rax)
je 0x1d5821
movq 0x80(%rsp), %rax
movl (%rax), %eax
movl %eax, 0x144(%rsp)
movl $0x1, 0x7c(%rsp)
jmp 0x1d5948
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x8f(%rsp), %rdi
callq 0x136a0
jmp 0x1d5964
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xe8(%rsp)
movl %eax, 0xe4(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x52f50
jmp 0x1d5964
leaq 0x12ca88(%rip), %rax    # 0x3022b0
movq %rax, 0x70(%rsp)
leaq 0x12ca7c(%rip), %rdi    # 0x3022b0
callq 0x1b54a0
movq %rax, 0x68(%rsp)
leaq 0x12ca6b(%rip), %rdi    # 0x3022b0
callq 0x1b54d0
movq %rax, 0x60(%rsp)
leaq 0x68(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1b5500
xorb $-0x1, %al
testb $0x1, %al
jne 0x1d5869
jmp 0x1d5902
leaq 0x68(%rsp), %rdi
callq 0x1b5540
movq 0x48(%rsp), %rsi
movq %rax, 0x58(%rsp)
movq 0x58(%rsp), %rdi
addq $0x28, %rsi
addq $0x18, %rsi
callq 0x111710
testb $0x1, %al
jne 0x1d5895
jmp 0x1d58f1
movq 0x130(%rsp), %rdi
callq 0x1d5250
movq 0x48(%rsp), %rcx
movl %eax, 0x54(%rsp)
movq 0x130(%rsp), %rax
movq 0xe8(%rax), %rdi
movl 0x54(%rsp), %esi
addq $0x40, %rcx
movl $0x1, %edx
callq 0x1b1290
jmp 0x1d58ce
movl 0x54(%rsp), %ecx
movq 0x80(%rsp), %rax
movl %ecx, (%rax)
movl 0x54(%rsp), %eax
movl %eax, 0x144(%rsp)
movl $0x1, 0x7c(%rsp)
jmp 0x1d5948
jmp 0x1d58f3
leaq 0x68(%rsp), %rdi
callq 0x1b5550
jmp 0x1d584f
movq 0x12b6e7(%rip), %rdi    # 0x300ff0
leaq 0x90(%rsp), %rsi
callq 0x131a0
movq %rax, 0x8(%rsp)
jmp 0x1d591d
movq 0x8(%rsp), %rdi
movq 0x12b6b7(%rip), %rsi    # 0x300fe0
callq 0x135d0
jmp 0x1d5930
jmp 0x1d5932
movl 0x88(%rsp), %eax
movl %eax, 0x144(%rsp)
movl $0x1, 0x7c(%rsp)
leaq 0x90(%rsp), %rdi
callq 0x52f50
movl 0x144(%rsp), %eax
addq $0x148, %rsp            # imm = 0x148
retq
movq 0xe8(%rsp), %rdi
callq 0x133f0
nopw %cs:(%rax,%rax)