// File: /workspace/github_cpp_makefile_star2_O2/Heptagon196[P]Gos/Reflection/ReflMgr.cpp
// Function: FieldInfo* ReflMgr::WalkThroughInherits<FieldInfo>(std::function<void* (void*)>*, TypeID, std::function<FieldInfo* (TypeID)>)
Ret* ReflMgr::WalkThroughInherits(std::function<void*(void*)>* conv, TypeID id, std::function<Ret*(TypeID)> func) {
    std::queue<std::pair<TypeID, std::function<void*(void*)>>> q;
    q.push({id, *conv});
    while (!q.empty()) {
        auto type = q.front().first;
        auto convFunc = q.front().second;
        q.pop();
        auto* ret = func(type);
        if (ret != nullptr) {
            *conv = convFunc;
            return ret;
        }
        if (HasClassInfo(type)) {
            ClassInfo& info = classInfo[type];
            for (int i = 0; i < info.parents.size(); i++) {
                q.push({info.parents[i], [convFunc, info, i](void* instance) { return info.cast[i](convFunc(instance)); }});
            }
        }
    }
    return nullptr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, (%rsp)
leaq 0x60(%rsp), %rdi
callq 0x6f9ba
movaps 0x200(%rsp), %xmm0
movaps 0x210(%rsp), %xmm1
leaq 0x110(%rsp), %r14
movaps %xmm1, -0x10(%r14)
movaps %xmm0, -0x20(%r14)
movq %r14, %rdi
movq %r15, 0x10(%rsp)
movq %r15, %rsi
callq 0x6f9d6
leaq 0x60(%rsp), %rdi
leaq 0xf0(%rsp), %rsi
callq 0x732e0
movq %r14, %rdi
callq 0x21f04
addq $0x90, (%rsp)
leaq 0xf0(%rsp), %r15
movq %rbx, 0x18(%rsp)
movq 0x70(%rsp), %rsi
cmpq %rsi, 0x90(%rsp)
je 0x6f920
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
addq $0x20, %rsi
leaq 0x40(%rsp), %rdi
callq 0x6f9d6
leaq 0x60(%rsp), %rdi
callq 0x7355e
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movaps %xmm1, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
cmpq $0x0, 0x10(%rbx)
je 0x6f94a
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rbx)
movq %rax, %r13
testq %rax, %rax
je 0x6f846
movq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x6fa1c
movq %r13, %rax
movq %r13, 0x8(%rsp)
leaq 0x40(%rsp), %rdi
callq 0x21f04
testq %r13, %r13
movq 0x18(%rsp), %rbx
je 0x6f7a0
jmp 0x6f929
movaps 0x20(%rsp), %xmm0
movaps 0x30(%rsp), %xmm1
movaps %xmm1, 0x100(%rsp)
movaps %xmm0, 0xf0(%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x71b30
testq %rax, %rax
je 0x6f829
movq (%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x2aae8
movq %rax, %rbx
xorl %r14d, %r14d
xorl %ebp, %ebp
movq 0x20(%rbx), %r12
movq 0x28(%rbx), %rax
subq %r12, %rax
sarq $0x5, %rax
cmpq %rbp, %rax
jbe 0x6f829
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x6f9d6
leaq 0x110(%rsp), %rdi
movq %rbx, %rsi
callq 0x6fa6a
addq %r14, %r12
movl %ebp, 0x1b8(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movaps %xmm0, 0xb0(%rsp)
movaps %xmm1, 0xc0(%rsp)
leaq 0xd0(%rsp), %rdi
movq %r15, %rsi
callq 0x71304
leaq 0x60(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x732e0
leaq 0xd0(%rsp), %rdi
callq 0x21f04
movq %r15, %rdi
callq 0x6fb06
incq %rbp
addq $0x20, %r14
jmp 0x6f887
movq $0x0, 0x8(%rsp)
leaq 0x60(%rsp), %rdi
callq 0x71638
movq 0x8(%rsp), %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11150
movq %rax, %rbx
movq %r14, %rdi
jmp 0x6f9a2
jmp 0x6f95b
jmp 0x6f964
movq %rax, %rbx
jmp 0x6f9a7
jmp 0x6f964
jmp 0x6f964
movq %rax, %rbx
jmp 0x6f99d
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x21f04
jmp 0x6f99d
movq %rax, %rbx
leaq 0xd0(%rsp), %rdi
callq 0x21f04
jmp 0x6f990
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x6fb06
leaq 0x40(%rsp), %rdi
callq 0x21f04
leaq 0x60(%rsp), %rdi
callq 0x71638
movq %rbx, %rdi
callq 0x11570
nop