// File: /workspace/github_cpp_makefile_star2_O2/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, 0x7ee1a(%rip)     # 0x107278
movq 0x10(%rdi), %rax
cmpq %rax, 0x18(%rdi)
je 0x8873d
movq %rdi, %r14
movl 0x8(%rdi), %ecx
testb $0x8, %cl
jne 0x88534
movq %rsi, %rbx
xorl %r12d, %r12d
testb $0x2, %cl
movq %r14, 0x28(%rsp)
je 0x8849e
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
movq 0x10(%r14), %rax
pushq $0x1
popq %r12
movl %r12d, %ecx
movq (%rax,%rcx,8), %rsi
addq $0x40, %rsi
leaq 0xc8(%rsp), %r15
movq %r15, %rdi
callq 0x2b71e
leaq 0x7ed50(%rip), %rdi     # 0x107210
movq %r15, %rsi
callq 0x2de0e
leal 0x1(%r12), %r14d
leaq 0x7ed5c(%rip), %rdi     # 0x107230
callq 0x8896e
leaq 0x7ed68(%rip), %rdi     # 0x107248
callq 0x8896e
andq $0x0, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movq 0x28(%rsp), %rax
testb $0x4, 0x8(%rax)
je 0x8854f
orl $0x2, %r12d
movq 0x10(%rax), %rax
movl %r14d, %ecx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %r14
movq 0x18(%rax), %r13
leaq 0x30(%rsp), %r15
cmpq %r13, %r14
je 0x8854c
movq (%r14), %rsi
addq $0x40, %rsi
movq %r15, %rdi
callq 0x79a38
addq $0x8, %r14
jmp 0x8851a
movq (%rax), %rsi
addq $0x40, %rsi
leaq 0x7ed1e(%rip), %rdi     # 0x107260
callq 0x79a38
jmp 0x8873d
movl %r12d, %r14d
movq 0xe8(%rbx), %r15
leaq 0x225e8(%rip), %rsi     # 0xaab45
leaq 0xa8(%rsp), %rdi
leaq 0x23(%rsp), %rdx
callq 0x664f4
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rdx
movaps %xmm0, (%rdx)
andq $0x0, 0x10(%rdx)
leaq 0xa8(%rsp), %rsi
movq %r15, %rdi
callq 0x79268
leaq 0x90(%rsp), %rdi
callq 0x2b668
leaq 0xa8(%rsp), %rdi
callq 0x209be
movq 0xe8(%rbx), %rdi
leaq 0xc8(%rsp), %rsi
leaq 0x30(%rsp), %rdx
callq 0x787c8
xorl %ebp, %ebp
leaq 0x7ec7a(%rip), %r12     # 0x107248
xorl %r15d, %r15d
movq 0x7ec90(%rip), %rax     # 0x107268
movq 0x7ec81(%rip), %r13     # 0x107260
subq %r13, %rax
sarq $0x5, %rax
cmpq %r15, %rax
jbe 0x8864c
addq %rbp, %r13
leaq 0x7ec3b(%rip), %rdi     # 0x107230
movq %r13, %rsi
callq 0x79a38
movq %r12, %rdi
movq %r13, %rsi
callq 0x79a38
movq 0xe8(%rbx), %rdi
movq %r13, %rsi
callq 0x78be2
decl 0xe0(%rbx)
movq 0xd0(%rbx), %rdi
addq $0x28, %rdi
movq %r13, %rsi
callq 0x8a6dc
movq 0xd0(%rbx), %rdi
addq $0x60, %rdi
movq %r13, %rsi
callq 0x8a7ea
incq %r15
addq $0x20, %rbp
jmp 0x885d1
movl %r14d, 0x24(%rsp)
callq 0x1df9e
movq %rax, 0x48(%rsp)
movq 0x30(%rsp), %r14
movq 0x38(%rsp), %r15
leaq 0x50(%rsp), %r12
cmpq %r15, %r14
je 0x886f7
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x215c2
movq %rax, 0x70(%rsp)
movq %rbp, 0x78(%rsp)
movq %r13, 0x80(%rsp)
andw $0x0, 0x88(%rsp)
andq $0x0, 0x58(%rsp)
movq %rbx, 0x50(%rsp)
leaq 0xfe(%rip), %rax        # 0x887b0
movq %rax, 0x68(%rsp)
leaq 0x1e4(%rip), %rax       # 0x888a2
movq %rax, 0x60(%rsp)
movups 0x70(%rsp), %xmm0
movups 0x80(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
movq 0x48(%rsp), %rdi
movq %r12, %rsi
callq 0x1fcbc
movq %r12, %rdi
callq 0x21f04
addq $0x20, %r14
jmp 0x8866a
movl 0x24(%rsp), %r14d
movq 0x28(%rsp), %r15
movq 0x10(%r15), %rax
movq 0x18(%r15), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r14, %rcx
jbe 0x88726
movq (%rax,%r14,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
incq %r14
jmp 0x88701
leaq 0x30(%rsp), %rdi
callq 0x2b668
leaq 0xc8(%rsp), %rdi
callq 0x209be
xorl %eax, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8878e
jmp 0x8878e
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2b668
leaq 0xa8(%rsp), %rdi
callq 0x209be
jmp 0x88791
jmp 0x8878e
movq %rax, %rbx
jmp 0x8879b
jmp 0x8878e
jmp 0x8878e
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x21f04
jmp 0x88791
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x2b668
leaq 0xc8(%rsp), %rdi
callq 0x209be
movq %rbx, %rdi
callq 0x11570