// File: /workspace/github_cpp_makefile_star2_O2/Heptagon196[P]Gos/GosASTCompiler.cpp
// Function: Gos::AST::ClassDef::CompileAST(Gos::Compiler::VMCompiler&)
Compile(ClassDef) {
    START();
    int start = 0;
    if (branch & 1) {
        SUB(start++);
    }
    if (branch & 2) {
        // Func
        code.MoveToNew();
        code.funcScope = code.currentScope;
        std::string name = nodes[start++]->token.str;
        std::vector<std::string> argTypes;
        std::vector<std::string> argNames;
        if (branch & 8) {
            // DefArgList
            auto* ast = nodes[start++];
            for (auto* arg : ast->nodes) {
                argNames.push_back(arg->nodes[0]->token.str);
                argTypes.push_back(arg->nodes[1]->token.str);
            }
        }
        std::string ret = nodes[start++]->token.str;
        auto jmp = vm.WriteCommandDefFunc(name, ret, argTypes);

        auto setMemsize = vm.WriteAlloc();
        code.ClearTmp();
        pc = 1;

        int id = pc++;
        code.currentScope->varID["this"] = id;
        vm.WriteCommandArg(id, 0);

        for (int i = 0; i < argNames.size(); i++) {
            id = pc++;
            code.currentScope->varID[argNames[i]] = id;
            code.currentScope->varType[argNames[i]] = argTypes[i];
            vm.WriteCommandArg(id, i + 1);
        }

        SUB(start++);
        vm.WriteCommandRet(0);
        jmp(vm.GetProgress());
        setMemsize(pc);
        pc = 1;
        code.MoveBack();
    } else if (branch & 4) {
        // Field
        std::string varName = nodes[start++]->token.str;
        std::string typeName = nodes[start++]->token.str;
        compilingClassVars.push_back(varName);
        compilingClassVarTypes.push_back(typeName);
        vm.WriteCommandDefVar(typeName, varName);
        pc--;
        code.currentScope->varID.erase(varName);
        code.currentScope->varType.erase(typeName);
    } else if (branch & 16) {
        // using
        std::string name = nodes[start++]->token.str;
        compilingClassVars.push_back(name);
        compilingClassVarTypes.push_back(name);
        vm.WriteCommandNamespace(name);
        pc--;
        code.currentScope->varID.erase(name);
        code.currentScope->varType.erase(name);
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl 0x2c(%rdi), %eax
movl %eax, 0x7f458(%rip)     # 0x107278
movq 0x10(%rdi), %rcx
cmpq %rcx, 0x18(%rdi)
je 0x88266
movq %rsi, %rbx
movq %rdi, %r12
movl 0x8(%rdi), %eax
xorl %r15d, %r15d
testb $0x1, %al
je 0x87e52
movq (%rcx), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
movl 0x8(%r12), %eax
pushq $0x1
popq %r15
movl %r15d, %r14d
testb $0x2, %al
jne 0x87eed
testb $0x4, %al
jne 0x87f52
testb $0x10, %al
je 0x88266
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2b71e
leaq 0x7f3a2(%rip), %rdi     # 0x107230
movq %r14, %rsi
callq 0x79a38
leaq 0x7f3ab(%rip), %rdi     # 0x107248
leaq 0x8(%rsp), %rsi
callq 0x79a38
movq 0xe8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x78be2
decl 0xe0(%rbx)
movq 0xd0(%rbx), %rdi
addq $0x28, %rdi
leaq 0x8(%rsp), %rsi
callq 0x8a6dc
movq 0xd0(%rbx), %rdi
addq $0x60, %rdi
leaq 0x8(%rsp), %rsi
callq 0x8a7ea
jmp 0x8825c
movq %rbx, %rdi
callq 0x84f42
movq 0xd0(%rbx), %rax
movq %rax, 0xd8(%rbx)
leal 0x1(%r15), %ebp
movq 0x10(%r12), %rax
movq (%rax,%r14,8), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %rdi
callq 0x2b71e
xorps %xmm0, %xmm0
andq $0x0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
andq $0x0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
testb $0x8, 0x8(%r12)
movq 0x10(%r12), %rax
jne 0x87ffc
movl %ebp, %ecx
jmp 0x8806d
movq 0x10(%r12), %rax
shll $0x3, %r15d
movq (%rax,%r15), %rsi
addq $0x40, %rsi
leaq 0x8(%rsp), %rdi
callq 0x2b71e
movq 0x10(%r12), %rax
movq 0x8(%rax,%r15), %rsi
addq $0x40, %rsi
leaq 0x50(%rsp), %rdi
callq 0x2b71e
leaq 0x7f2a4(%rip), %rdi     # 0x107230
leaq 0x8(%rsp), %rsi
callq 0x79a38
leaq 0x7f2ab(%rip), %rdi     # 0x107248
leaq 0x50(%rsp), %rsi
callq 0x79a38
movq 0xe8(%rbx), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x78886
decl 0xe0(%rbx)
movq 0xd0(%rbx), %rdi
addq $0x28, %rdi
leaq 0x8(%rsp), %rsi
callq 0x8a6dc
movq 0xd0(%rbx), %rdi
addq $0x60, %rdi
leaq 0x50(%rsp), %rsi
callq 0x8a7ea
leaq 0x50(%rsp), %rdi
callq 0x209be
jmp 0x8825c
movq %r12, 0x28(%rsp)
orl $0x2, %r15d
movq %r15, 0x90(%rsp)
movl %ebp, %ecx
movq (%rax,%rcx,8), %rax
movq 0x10(%rax), %rbp
movq 0x18(%rax), %r14
leaq 0x30(%rsp), %r15
leaq 0x70(%rsp), %r12
cmpq %r14, %rbp
je 0x8805b
movq (%rbp), %r13
movq 0x10(%r13), %rax
movq (%rax), %rsi
addq $0x40, %rsi
movq %r15, %rdi
callq 0x79a38
movq 0x10(%r13), %rax
movq 0x8(%rax), %rsi
addq $0x40, %rsi
movq %r12, %rdi
callq 0x79a38
addq $0x8, %rbp
jmp 0x88025
movq 0x28(%rsp), %r12
movq 0x10(%r12), %rax
movq 0x90(%rsp), %rcx
movl %ecx, %r14d
movq (%rax,%r14,8), %rsi
addq $0x40, %rsi
leaq 0x50(%rsp), %rdi
callq 0x2b71e
movq 0xe8(%rbx), %rsi
leaq 0xd8(%rsp), %rdi
leaq 0x8(%rsp), %rdx
leaq 0x50(%rsp), %rcx
leaq 0x70(%rsp), %r8
callq 0x78912
movq 0xe8(%rbx), %rsi
leaq 0xb8(%rsp), %rdi
callq 0x79332
movq %rbx, %rdi
callq 0x85072
movl $0x2, 0xe0(%rbx)
movq 0xd0(%rbx), %r15
leaq 0x22a67(%rip), %rsi     # 0xaab40
leaq 0x98(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x664f4
addq $0x28, %r15
leaq 0x98(%rsp), %rsi
movq %r15, %rdi
callq 0x8a576
movq %r14, 0x28(%rsp)
movq %r12, %r14
movl $0x1, (%rax)
leaq 0x98(%rsp), %rdi
callq 0x209be
movq 0xe8(%rbx), %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x78e38
xorl %ebp, %ebp
xorl %r15d, %r15d
movq 0x30(%rsp), %rsi
movq 0x38(%rsp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r15, %rax
jbe 0x881b7
movl 0xe0(%rbx), %r12d
leal 0x1(%r12), %eax
movl %eax, 0xe0(%rbx)
movq 0xd0(%rbx), %rdi
addq $0x28, %rdi
addq %rbp, %rsi
callq 0x7a76e
movl %r12d, (%rax)
movq 0x70(%rsp), %r13
movq 0xd0(%rbx), %rdi
addq $0x60, %rdi
movq 0x30(%rsp), %rsi
addq %rbp, %rsi
callq 0x89230
addq %rbp, %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x2de0e
movq 0xe8(%rbx), %rdi
incq %r15
addq $0x20, %rbp
movl %r12d, %esi
movl %r15d, %edx
callq 0x78e38
jmp 0x88130
movq 0x10(%r14), %rax
movq 0x28(%rsp), %rcx
movq 0x8(%rax,%rcx,8), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *(%rax)
movq 0xe8(%rbx), %rdi
xorl %esi, %esi
callq 0x7908a
movq 0xe8(%rbx), %rdi
callq 0x7932e
leaq 0xd8(%rsp), %rdi
movl %eax, %esi
callq 0x83e66
movl 0xe0(%rbx), %esi
leaq 0xb8(%rsp), %rdi
callq 0x83e66
movl $0x1, 0xe0(%rbx)
movq 0xd0(%rbx), %rax
movq (%rax), %rax
movq %rax, 0xd0(%rbx)
leaq 0xb8(%rsp), %rdi
callq 0x21f04
leaq 0xd8(%rsp), %rdi
callq 0x21f04
leaq 0x50(%rsp), %rdi
callq 0x209be
leaq 0x30(%rsp), %rdi
callq 0x2b668
leaq 0x70(%rsp), %rdi
callq 0x2b668
leaq 0x8(%rsp), %rdi
callq 0x209be
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x8829c
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x209be
jmp 0x882ba
jmp 0x882b7
movq %rax, %rbx
jmp 0x882c7
movq %rax, %rbx
jmp 0x882d4
jmp 0x882b2
movq %rax, %rbx
jmp 0x882f2
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x209be
jmp 0x882f2
jmp 0x882b7
movq %rax, %rbx
jmp 0x882de
movq %rax, %rbx
leaq 0xb8(%rsp), %rdi
callq 0x21f04
leaq 0xd8(%rsp), %rdi
callq 0x21f04
leaq 0x50(%rsp), %rdi
callq 0x209be
leaq 0x30(%rsp), %rdi
callq 0x2b668
leaq 0x70(%rsp), %rdi
callq 0x2b668
leaq 0x8(%rsp), %rdi
callq 0x209be
movq %rbx, %rdi
callq 0x11570