// File: /workspace/github_cpp_makefile_star2_O3/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 0x90bea
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 0x8c680
leaq 0x170(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x90d62
movq 0xd0(%rsp), %rax
testq %rax, %rax
je 0x8c32d
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 0x8c562
movups (%rsi), %xmm0
movups 0x10(%rsi), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
addq $0x20, %rsi
leaq 0x40(%rsp), %rdi
callq 0x8c680
leaq 0x170(%rsp), %rdi
callq 0x9104e
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
cmpq $0x0, 0x10(%rbx)
je 0x8c58f
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rbx)
movq %rax, %rbx
testq %rax, %rax
je 0x8c402
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0x8c6de
movq %rbx, %rax
movq %rbx, 0x8(%rsp)
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x8c3ef
leaq 0x40(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
testq %rbx, %rbx
movq 0x38(%rsp), %rbx
je 0x8c347
jmp 0x8c56b
movaps 0x10(%rsp), %xmm0
movaps 0x20(%rsp), %xmm1
movaps %xmm1, 0xb0(%rsp)
movaps %xmm0, 0xa0(%rsp)
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x8f652
testq %rax, %rax
je 0x8c3d6
movq (%rsp), %rdi
movq %r13, %rsi
callq 0x35d16
movq %rax, %r14
movq 0x20(%rax), %r12
cmpq %r12, 0x28(%rax)
je 0x8c3d6
xorl %ebp, %ebp
xorl %r13d, %r13d
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
callq 0x8c680
leaq 0xc0(%rsp), %rdi
movq %r14, %rsi
callq 0x8c744
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 0x8ec4c
leaq 0x170(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x90d62
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x8c4c9
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x158(%rsp), %rax
testq %rax, %rax
je 0x8c4e8
leaq 0x148(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x110(%rsp), %rdi
callq 0x36ac6
leaq 0xf8(%rsp), %rdi
callq 0x36150
movq 0xe0(%rsp), %rdi
testq %rdi, %rdi
je 0x8c51f
movq 0xf0(%rsp), %rsi
subq %rdi, %rsi
callq 0x11360
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x8c539
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 0x8c44b
leaq 0x10(%rsp), %r13
jmp 0x8c3d6
movq $0x0, 0x8(%rsp)
leaq 0x170(%rsp), %rdi
callq 0x8eff2
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 0x8c677
movq %rax, %rbx
movq 0xd0(%rsp), %rax
testq %rax, %rax
je 0x8c660
movq %r14, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x8c660
jmp 0x8c677
jmp 0x8c5cf
jmp 0x8c613
jmp 0x8c677
jmp 0x8c613
movq %rax, %rbx
jmp 0x8c660
jmp 0x8c613
jmp 0x8c677
jmp 0x8c677
jmp 0x8c677
movq %rax, %rbx
movq 0xb0(%rsp), %rax
testq %rax, %rax
je 0x8c647
leaq 0xa0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x8c647
jmp 0x8c677
movq %rax, %rbx
jmp 0x8c63a
movq %rax, %rbx
jmp 0x8c647
movq %rax, %rbx
movq 0x90(%rsp), %rax
testq %rax, %rax
je 0x8c63a
leaq 0x80(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0xa0(%rsp), %rdi
callq 0x8c828
movq 0x50(%rsp), %rax
testq %rax, %rax
je 0x8c660
leaq 0x40(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x170(%rsp), %rdi
callq 0x8eff2
movq %rbx, %rdi
callq 0x11580
jmp 0x8c677
movq %rax, %rdi
callq 0x26e38
nop