// File: /workspace/github_cpp_makefile_star2_O1/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)
xorps %xmm0, %xmm0
leaq 0x170(%rsp), %rdi
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
xorl %esi, %esi
callq 0x91796
movaps 0x200(%rsp), %xmm0
movaps 0x210(%rsp), %xmm1
leaq 0xc0(%rsp), %r14
movaps %xmm1, -0x10(%r14)
movaps %xmm0, -0x20(%r14)
movq %r14, %rdi
movq %r15, 0x30(%rsp)
movq %r15, %rsi
callq 0x8d19e
leaq 0x170(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x9190e
movq 0xd0(%rsp), %rax
testq %rax, %rax
je 0x8ce4b
movq %r14, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq *%rax
addq $0x90, (%rsp)
leaq 0xa0(%rsp), %r15
leaq 0x10(%rsp), %r13
movq %rbx, 0x38(%rsp)
movq 0x180(%rsp), %rsi
cmpq %rsi, 0x1a0(%rsp)
je 0x8d080
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
addq $0x20, %rsi
leaq 0x40(%rsp), %rdi
callq 0x8d19e
leaq 0x170(%rsp), %rdi
callq 0x91bf4
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
cmpq $0x0, 0x10(%rbx)
je 0x8d0ad
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rbx)
movq %rax, %rbx
testq %rax, %rax
je 0x8cf20
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x8d1fc
movq %rbx, %rax
movq %rbx, 0x8(%rsp)
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x8cf0d
leaq 0x40(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testq %rbx, %rbx
movq 0x38(%rsp), %rbx
je 0x8ce65
jmp 0x8d089
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x901be
testq %rax, %rax
je 0x8cef4
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x36950
movq %rax, %r14
movq 0x20(%rax), %r12
cmpq %r12, 0x28(%rax)
je 0x8cef4
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x8d19e
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
callq 0x8d262
addq %rbp, %r12
movl %r13d, 0x168(%rsp)
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
leaq 0x80(%rsp), %rdi
movq %r15, %rsi
callq 0x8f7c8
leaq 0x170(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x9190e
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x8cfe7
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x158(%rsp), %rax
testq %rax, %rax
je 0x8d006
leaq 0x148(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x110(%rsp), %rdi
callq 0x376f2
leaq 0xf8(%rsp), %rdi
callq 0x36d86
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x8d03d
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x11360
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x8d057
movq %r15, %rdi
movq %r15, %rsi
movl $0x3, %edx
callq *%rax
incq %r13
movq 0x20(%r14), %r12
movq 0x28(%r14), %rax
subq %r12, %rax
sarq $0x5, %rax
addq $0x20, %rbp
cmpq %r13, %rax
ja 0x8cf69
leaq 0x10(%rsp), %r13
jmp 0x8cef4
movq $0x0, 0x8(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x8fb74
movq 0x8(%rsp), %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11150
jmp 0x8d195
movq %rax, %rbx
movq 0xd0(%rsp), %rax
testq %rax, %rax
je 0x8d17e
movq %r14, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x8d17e
jmp 0x8d195
jmp 0x8d0ed
jmp 0x8d131
jmp 0x8d195
jmp 0x8d131
movq %rax, %rbx
jmp 0x8d17e
jmp 0x8d131
jmp 0x8d195
jmp 0x8d195
jmp 0x8d195
movq %rax, %rbx
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x8d165
leaq 0xa0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x8d165
jmp 0x8d195
movq %rax, %rbx
jmp 0x8d158
movq %rax, %rbx
jmp 0x8d165
movq %rax, %rbx
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x8d158
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0xa0(%rsp), %rdi
callq 0x8d346
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x8d17e
leaq 0x40(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x170(%rsp), %rdi
callq 0x8fb74
movq %rbx, %rdi
callq 0x11580
jmp 0x8d195
movq %rax, %rdi
callq 0x2789a
nop