// File: Heptagon196[P]Gos/GosASTCompiler.cpp
// Function: Gos::AST::DefVar::CompileAST(Gos::Compiler::VMCompiler&)
Compile(DefVar) {
    START();
    std::string symbol = nodes[0]->token.str;
    std::string type = "unknown";
    int assign;
    int id = pc++;
    code.currentScope->varID[symbol] = id;
    if (branch == 1) {
        type = nodes[1]->token.str;
    } else if (branch == 2) {
        assign = SUB(1);
    } else if (branch == 3) {
        type = nodes[1]->token.str;
        assign = SUB(2);
    }
    code.currentScope->varType[symbol] = type;
    if (branch <= 1) {
        vm.WriteCommandNew(type, id, {});
    } else if (branch == 2) {
        vm.WriteCommandRef(id, assign);
    } else if (branch == 3) {
        vm.WriteCommandNew(type, id, {});
        vm.WriteCommandMov(id, assign);
    }
    return id;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x108(%rsp)
movq %rsi, 0x100(%rsp)
movq 0x108(%rsp), %rdi
movq %rdi, 0x58(%rsp)
movl 0x2c(%rdi), %eax
movl %eax, 0x129e4b(%rip)    # 0x3022f8
addq $0x10, %rdi
callq 0x1d1e80
cmpq $0x0, %rax
jne 0x1d84cc
movl $0x0, 0x114(%rsp)
jmp 0x1d88d1
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x1d1e60
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0xe0(%rsp), %rdi
callq 0x6f070
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x13570
movq 0x50(%rsp), %rdx
leaq 0x49b18(%rip), %rsi     # 0x222028
leaq 0xc0(%rsp), %rdi
callq 0x165520
jmp 0x1d851f
leaq 0xbf(%rsp), %rdi
callq 0x136a0
movq 0x100(%rsp), %rcx
movl 0xe0(%rcx), %eax
movl %eax, %edx
incl %edx
movl %edx, 0xe0(%rcx)
movl %eax, 0xa4(%rsp)
movl 0xa4(%rsp), %eax
movl %eax, 0x44(%rsp)
movq 0x100(%rsp), %rax
movq 0xd0(%rax), %rdi
addq $0x28, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x1b4880
movq %rax, 0x48(%rsp)
jmp 0x1d857d
movq 0x58(%rsp), %rax
movq 0x48(%rsp), %rcx
movl 0x44(%rsp), %edx
movl %edx, (%rcx)
cmpl $0x1, 0x8(%rax)
jne 0x1d8600
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x1d1e60
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0xc0(%rsp), %rdi
callq 0x1187a0
jmp 0x1d85bc
jmp 0x1d86b3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0xbf(%rsp), %rdi
callq 0x136a0
jmp 0x1d88c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0x1d88b5
movq 0x58(%rsp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x1d8644
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x1d1e60
movq (%rax), %rdi
movq 0x100(%rsp), %rsi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movl %eax, 0x40(%rsp)
jmp 0x1d8637
movl 0x40(%rsp), %eax
movl %eax, 0xa8(%rsp)
jmp 0x1d86b1
movq 0x58(%rsp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x1d86af
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x1, %esi
callq 0x1d1e60
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0xc0(%rsp), %rdi
callq 0x1187a0
jmp 0x1d8678
movq 0x58(%rsp), %rdi
addq $0x10, %rdi
movl $0x2, %esi
callq 0x1d1e60
movq (%rax), %rdi
movq 0x100(%rsp), %rsi
movq (%rdi), %rax
movq (%rax), %rax
callq *%rax
movl %eax, 0x3c(%rsp)
jmp 0x1d86a4
movl 0x3c(%rsp), %eax
movl %eax, 0xa8(%rsp)
jmp 0x1d86b1
jmp 0x1d86b3
movq 0x100(%rsp), %rax
movq 0xd0(%rax), %rdi
addq $0x60, %rdi
leaq 0xe0(%rsp), %rsi
callq 0x1dcf70
movq %rax, 0x30(%rsp)
jmp 0x1d86da
movq 0x30(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x1187a0
jmp 0x1d86ee
movq 0x58(%rsp), %rax
cmpl $0x1, 0x8(%rax)
jg 0x1d879a
movq 0x100(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, 0x18(%rsp)
movl 0xa4(%rsp), %eax
movl %eax, 0x24(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
leaq 0x80(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x1dd1b0
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %edx
movq 0x28(%rsp), %rcx
leaq 0xc0(%rsp), %rsi
callq 0x1b0f40
jmp 0x1d8762
leaq 0x80(%rsp), %rdi
callq 0x1dd280
jmp 0x1d888b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x1dd280
jmp 0x1d88b5
movq 0x58(%rsp), %rax
cmpl $0x2, 0x8(%rax)
jne 0x1d87ce
movq 0x100(%rsp), %rax
movq 0xe8(%rax), %rdi
movl 0xa4(%rsp), %esi
movl 0xa8(%rsp), %edx
callq 0x1b11a0
jmp 0x1d87c9
jmp 0x1d8889
movq 0x58(%rsp), %rax
cmpl $0x3, 0x8(%rax)
jne 0x1d8887
movq 0x100(%rsp), %rax
movq 0xe8(%rax), %rax
movq %rax, (%rsp)
movl 0xa4(%rsp), %eax
movl %eax, 0xc(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
leaq 0x60(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x1dd1b0
movq (%rsp), %rdi
movl 0xc(%rsp), %edx
movq 0x10(%rsp), %rcx
leaq 0xc0(%rsp), %rsi
callq 0x1b0f40
jmp 0x1d8837
leaq 0x60(%rsp), %rdi
callq 0x1dd280
movq 0x100(%rsp), %rax
movq 0xe8(%rax), %rdi
movl 0xa4(%rsp), %esi
movl 0xa8(%rsp), %edx
callq 0x1b1150
jmp 0x1d8865
jmp 0x1d8887
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x1dd280
jmp 0x1d88b5
jmp 0x1d8889
jmp 0x1d888b
movl 0xa4(%rsp), %eax
movl %eax, 0x114(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0x52f50
leaq 0xe0(%rsp), %rdi
callq 0x52f50
jmp 0x1d88d1
leaq 0xc0(%rsp), %rdi
callq 0x52f50
leaq 0xe0(%rsp), %rdi
callq 0x52f50
jmp 0x1d88e0
movl 0x114(%rsp), %eax
addq $0x118, %rsp            # imm = 0x118
retq
movq 0xb0(%rsp), %rdi
callq 0x133f0
nopl (%rax)