// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movl 0x2c(%rdi), %eax
movl %eax, 0x729f0(%rip)     # 0x11f288
movq 0x10(%rdi), %rax
cmpq %rax, 0x18(%rdi)
je 0xacc35
movq %rdi, %rbp
movl 0x8(%rdi), %ecx
testb $0x8, %cl
jne 0xacbf4
movq %rsi, %rbx
xorl %r12d, %r12d
testb $0x2, %cl
je 0xac8d1
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
movl $0x1, %r12d
movq 0x10(%rbp), %rax
movl %r12d, %ecx
movq (%rax,%rcx,8), %rax
leaq 0x88(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %r15
movq %r15, %rdi
callq 0x37586
leaq 0x72919(%rip), %rdi     # 0x11f220
movq %r15, %rsi
callq 0x3a2e8
leal 0x1(%r12), %r13d
movq 0x72925(%rip), %rsi     # 0x11f240
leaq 0x7291e(%rip), %rdi     # 0x11f240
callq 0xadf46
movq 0x7292a(%rip), %rsi     # 0x11f258
leaq 0x72923(%rip), %rdi     # 0x11f258
callq 0xadf46
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq $0x0, 0x40(%rsp)
testb $0x4, 0x8(%rbp)
je 0xac98d
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 0xac98a
leaq 0x30(%rsp), %r15
movq (%r14), %rsi
addq $0x40, %rsi
movq %r15, %rdi
callq 0x9b36e
addq $0x8, %r14
cmpq %r13, %r14
jne 0xac972
movl %r12d, %r13d
movq 0xe8(%rbx), %r15
leaq 0xb0(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x2478a(%rip), %rsi     # 0xd1131
leaq 0x2478e(%rip), %rdx     # 0xd113c
leaq 0xa0(%rsp), %rdi
callq 0x27dc8
xorps %xmm0, %xmm0
leaq 0xe0(%rsp), %rdx
movaps %xmm0, (%rdx)
movq $0x0, 0x10(%rdx)
leaq 0xa0(%rsp), %rsi
movq %r15, %rdi
callq 0x9aa4c
leaq 0xe0(%rsp), %rdi
callq 0x3740c
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0xaca0b
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x11360
movl %r13d, 0x2c(%rsp)
movq %rbp, 0x98(%rsp)
movq 0xe8(%rbx), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x99736
movq 0x7283b(%rip), %r13     # 0x11f270
cmpq %r13, 0x7283c(%rip)     # 0x11f278
je 0xacaca
xorl %r14d, %r14d
leaq 0x727f4(%rip), %r15     # 0x11f240
leaq 0x72805(%rip), %r12     # 0x11f258
xorl %ebp, %ebp
addq %r14, %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x9b36e
movq %r12, %rdi
movq %r13, %rsi
callq 0x9b36e
movq 0xe8(%rbx), %rdi
movq %r13, %rsi
callq 0x99dfa
decl 0xe0(%rbx)
movq 0xd0(%rbx), %rdi
addq $0x28, %rdi
movq %r13, %rsi
callq 0xaed2a
movq 0xd0(%rbx), %rdi
addq $0x60, %rdi
movq %r13, %rsi
callq 0xaee22
incq %rbp
movq 0x727c5(%rip), %rax     # 0x11f278
movq 0x727b6(%rip), %r13     # 0x11f270
subq %r13, %rax
sarq $0x5, %rax
addq $0x20, %r14
cmpq %rbp, %rax
ja 0xaca55
callq 0x23132
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbp
cmpq %rbp, %r13
je 0xacbc2
movq %rax, %r15
leaq 0x50(%rsp), %r12
movabsq $0x100000001b3, %r14    # imm = 0x100000001B3
movq (%r13), %rax
movq 0x8(%r13), %rcx
movabsq $-0x340d631b7bdddcdb, %rdx # imm = 0xCBF29CE484222325
testq %rcx, %rcx
je 0xacb2e
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 0xacb17
movq %rdx, 0xc0(%rsp)
movq %rcx, 0xc8(%rsp)
movq %rax, 0xd0(%rsp)
movw $0x0, 0xd8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x60(%rsp)
movq %rbx, 0x50(%rsp)
leaq 0x17d(%rip), %rax       # 0xacce6
movq %rax, 0x68(%rsp)
leaq 0x2a5(%rip), %rax       # 0xace1a
movq %rax, 0x60(%rsp)
movups 0xc0(%rsp), %xmm0
movups 0xd0(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x25a06
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0xacbb5
movq %r12, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq *%rax
addq $0x20, %r13
cmpq %rbp, %r13
jne 0xacaf4
movl 0x2c(%rsp), %r14d
movq 0x98(%rsp), %r15
movq 0x10(%r15), %rax
movq 0x18(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0xacc09
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
incq %r14
jmp 0xacbcf
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0x7266e(%rip), %rdi     # 0x11f270
callq 0x9b36e
jmp 0xacc35
leaq 0x30(%rsp), %rdi
callq 0x3740c
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xacc35
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x11360
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xaccaf
jmp 0xaccaf
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x3740c
movq 0xa0(%rsp), %rdi
cmpq %r14, %rdi
je 0xaccb2
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x11360
jmp 0xaccb2
jmp 0xaccaf
movq %rax, %rbx
jmp 0xaccbc
jmp 0xaccaf
jmp 0xacca7
jmp 0xaccaf
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0xaccb2
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0xaccb2
movq %rax, %rdi
callq 0x2789a
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3740c
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0xaccde
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x11360
movq %rbx, %rdi
callq 0x11580