// File: /workspace/github_cpp_makefile_star2_O3/Heptagon196[P]Gos/GosASTCompiler.cpp
// Function: Gos::AST::Preprocess::CompileAST(Gos::Compiler::VMCompiler&)
Compile(Preprocess) {
    START();
    // using
    if (branch & 8) {
        usings.push_back(nodes[0]->token.str);
        return 0;
    }
    // class def
    int start = 0;
    if (branch & 2) {
        SUB(start++);
    }
    std::string className = nodes[start++]->token.str;
    compilingClassName = className;
    compilingClassVars.clear();
    compilingClassVarTypes.clear();
    std::vector<std::string> inherits;
    if (branch & 4) {
        GosAST* idList = nodes[start++];
        for (GosAST* ast : idList->nodes) {
            inherits.push_back(ast->token.str);
        }
    }
    vm.WriteCommandAttributes("GosInstance", {});
    vm.WriteCommandDefClass(className, inherits);
    for (int i = 0; i < usings.size(); i++) {
        std::string& name = usings[i];
        compilingClassVars.push_back(name);
        compilingClassVarTypes.push_back(name);
        vm.WriteCommandNamespace(name);
        pc--;
        code.currentScope->varID.erase(name);
        code.currentScope->varType.erase(name);
    }
    auto& mgr = ReflMgr::Instance();
    for (const std::string& cls : inherits) {
        mgr.IterateField(TypeID::getRaw(cls), std::function([&](const FieldInfo& field) {
            std::string varName = field.name;
            std::string typeName = (std::string)field.varType.getName();
            compilingClassVars.push_back(varName);
            compilingClassVarTypes.push_back(typeName);
            vm.WriteCommandDefVar(typeName, varName);
            pc--;
            code.currentScope->varID.erase(varName);
            code.currentScope->varType.erase(typeName);
        }));
    }
    for (int i = start; i < nodes.size(); i++) {
        SUB(i);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl 0x2c(%rdi), %eax
movl %eax, 0x72852(%rip)     # 0x11e288
movq 0x10(%rdi), %rax
cmpq %rax, 0x18(%rdi)
je 0xabdc9
movq %rdi, %rbp
movl 0x8(%rdi), %ecx
testb $0x8, %cl
jne 0xabd8e
movq %rsi, %rbx
xorl %r12d, %r12d
testb $0x2, %cl
je 0xaba73
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
movq 0x10(%rbp), %rax
movl $0x1, %r12d
movl %r12d, %ecx
movq (%rax,%rcx,8), %rax
leaq 0x58(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %r15
movq %r15, %rdi
callq 0x36954
leaq 0x7277e(%rip), %rdi     # 0x11e220
movq %r15, %rsi
callq 0x39678
leal 0x1(%r12), %r13d
movq 0x7278a(%rip), %rsi     # 0x11e240
leaq 0x72783(%rip), %rdi     # 0x11e240
callq 0xad0d2
movq 0x7278f(%rip), %rsi     # 0x11e258
leaq 0x72788(%rip), %rdi     # 0x11e258
callq 0xad0d2
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testb $0x4, 0x8(%rbp)
je 0xabb28
orl $0x2, %r12d
movq 0x10(%rbp), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %r14
movq 0x18(%rax), %r13
cmpq %r13, %r14
je 0xabb25
leaq 0x30(%rsp), %r15
movq (%r14), %rsi
addq $0x40, %rsi
movq %r15, %rdi
callq 0x9a724
addq $0x8, %r14
cmpq %r13, %r14
jne 0xabb0d
movl %r12d, %r13d
movq 0xe8(%rbx), %r15
leaq 0xa0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x245bf(%rip), %rsi     # 0xd0101
leaq 0x245c3(%rip), %rdx     # 0xd010c
leaq 0x90(%rsp), %rdi
callq 0x27370
xorps %xmm0, %xmm0
leaq 0xd0(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x90(%rsp), %rsi
movq %r15, %rdi
callq 0x99dfe
leaq 0xd0(%rsp), %rdi
callq 0x367d6
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xabba6
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x11360
movl %r13d, 0x2c(%rsp)
movq %rbp, 0x68(%rsp)
movq 0xe8(%rbx), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x98b10
movq 0x726a3(%rip), %r13     # 0x11e270
cmpq %r13, 0x726a4(%rip)     # 0x11e278
je 0xabc62
xorl %r14d, %r14d
leaq 0x7265c(%rip), %r15     # 0x11e240
leaq 0x7266d(%rip), %r12     # 0x11e258
xorl %ebp, %ebp
addq %r14, %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x9a724
movq %r12, %rdi
movq %r13, %rsi
callq 0x9a724
movq 0xe8(%rbx), %rdi
movq %r13, %rsi
callq 0x991c0
decl 0xe0(%rbx)
movq 0xd0(%rbx), %rdi
addq $0x28, %rdi
movq %r13, %rsi
callq 0xadea4
movq 0xd0(%rbx), %rdi
addq $0x60, %rdi
movq %r13, %rsi
callq 0xadf8c
incq %rbp
movq 0x7262d(%rip), %rax     # 0x11e278
movq 0x7261e(%rip), %r13     # 0x11e270
subq %r13, %rax
sarq $0x5, %rax
addq $0x20, %r14
cmpq %rbp, %rax
ja 0xabbed
callq 0x227b2
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbp
cmpq %rbp, %r13
je 0xabd5f
movq %rax, %r15
leaq 0x70(%rsp), %r12
movabsq $0x100000001b3, %r14    # imm = 0x100000001B3
movq (%r13), %rax
movq 0x8(%r13), %rcx
movabsq $-0x340d631b7bdddcdb, %rdx # imm = 0xCBF29CE484222325
testq %rcx, %rcx
je 0xabcc6
xorl %esi, %esi
movabsq $-0x340d631b7bdddcdb, %rdi # imm = 0xCBF29CE484222325
movsbq (%rax,%rsi), %rdx
xorq %rdi, %rdx
imulq %r14, %rdx
incq %rsi
movq %rdx, %rdi
cmpq %rsi, %rcx
jne 0xabcaf
movq %rdx, 0xb0(%rsp)
movq %rcx, 0xb8(%rsp)
movq %rax, 0xc0(%rsp)
movw $0x0, 0xc8(%rsp)
movq $0x0, 0x78(%rsp)
movq %rbx, 0x70(%rsp)
leaq 0x17b(%rip), %rax       # 0xabe78
movq %rax, 0x88(%rsp)
leaq 0x2a0(%rip), %rax       # 0xabfac
movq %rax, 0x80(%rsp)
movups 0xb0(%rsp), %xmm0
movups 0xc0(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x24fc8
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0xabd52
movq %r12, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq *%rax
addq $0x20, %r13
cmpq %rbp, %r13
jne 0xabc8c
movl 0x2c(%rsp), %r14d
movq 0x68(%rsp), %r15
movq 0x10(%r15), %rax
movq 0x18(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0xabda3
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
incq %r14
jmp 0xabd69
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0x724d4(%rip), %rdi     # 0x11e270
callq 0x9a724
jmp 0xabdc9
leaq 0x30(%rsp), %rdi
callq 0x367d6
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xabdc9
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x11360
xorl %eax, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xabe46
jmp 0xabe46
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x367d6
movq 0x90(%rsp), %rdi
cmpq %r14, %rdi
je 0xabe49
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x11360
jmp 0xabe49
jmp 0xabe46
movq %rax, %rbx
jmp 0xabe53
jmp 0xabe46
jmp 0xabe3e
jmp 0xabe46
movq %rax, %rbx
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0xabe49
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0xabe49
movq %rax, %rdi
callq 0x26e38
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x367d6
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0xabe6f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x11360
movq %rbx, %rdi
callq 0x11580
nop