// File: Heptagon196[P]Gos/Reflection/ReflMgr.cpp
// Function: ReflMgr::RawAddMethod(TypeID, std::basic_string_view<char, std::char_traits<char>>, TypeID, ArgsTypeList const&, std::function<SharedObject (ObjectPtr, std::vector<ObjectPtr, std::allocator<ObjectPtr>> const&)>)
void ReflMgr::RawAddMethod(TypeID cls, std::string_view name, TypeID returnType, const ArgsTypeList& argsList, std::function<SharedObject(ObjectPtr, const std::vector<ObjectPtr>&)> func) {
    MethodInfo info{ std::string{name} };
    info.returnType = returnType;
    info.argsList = argsList;
    info.newRet = []() { return SharedObject(); };
    AddMethodInfo(cls, info.name, info.withRegister([func, argsList, cls](void* instance, const std::vector<void*>& params, SharedObject& ret) {
        std::vector<ObjectPtr> args;
        for (int i = 0; i < params.size(); i++) {
            args.push_back(ObjectPtr{argsList[i], params[i]});
        }
        ret = func(ObjectPtr{cls, instance}, args);
    }));
}

// Assembly:
subq $0x308, %rsp            # imm = 0x308
movq %r8, 0x58(%rsp)
leaq 0x330(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x310(%rsp), %rax
movq %rax, 0x68(%rsp)
movq %rsi, 0x2f8(%rsp)
movq %rdx, 0x300(%rsp)
movq %rdi, 0x2f0(%rsp)
movq %rcx, 0x2e8(%rsp)
movq %r8, 0x2e0(%rsp)
movq 0x2f0(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x210(%rsp), %rax
movq %rax, 0x78(%rsp)
leaq 0x20f(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x13570
movq 0x78(%rsp), %rdi
movq 0x80(%rsp), %rdx
leaq 0x2f8(%rsp), %rsi
callq 0x52e80
jmp 0x4ce59
leaq 0x230(%rsp), %rdi
movq %rdi, 0x40(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x250(%rsp)
movups %xmm0, 0x240(%rsp)
movups %xmm0, 0x230(%rsp)
movq $0x0, 0x260(%rsp)
callq 0x69ec0
leaq 0x268(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x6ff70
leaq 0x288(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x6ffb0
leaq 0x2a8(%rsp), %rdi
callq 0x6c730
jmp 0x4cec5
leaq 0x2c8(%rsp), %rdi
movq %rdi, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x2c8(%rsp)
movq $0x0, 0x2d8(%rsp)
callq 0x56250
leaq 0x20f(%rsp), %rdi
callq 0x136a0
movq 0x60(%rsp), %rax
movq 0x38(%rsp), %rdi
movups (%rax), %xmm0
movups 0xa(%rax), %xmm1
movups %xmm1, 0x2b2(%rsp)
movups %xmm0, 0x2a8(%rsp)
movq 0x2e8(%rsp), %rsi
callq 0x192c20
jmp 0x4cf2b
leaq 0x288(%rsp), %rdi
leaq 0x1fb(%rsp), %rsi
callq 0x4d190
movq 0x58(%rsp), %rsi
movq 0x68(%rsp), %rax
movups (%rax), %xmm0
movups 0x10(%rax), %xmm1
movaps %xmm1, 0x1e0(%rsp)
movaps %xmm0, 0x1d0(%rsp)
leaq 0x210(%rsp), %rax
movq %rax, 0x28(%rsp)
leaq 0x88(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x192c50
jmp 0x4cf82
leaq 0xa8(%rsp), %rdi
movq 0x2e8(%rsp), %rsi
callq 0x725b0
jmp 0x4cf99
movq 0x68(%rsp), %rax
movups (%rax), %xmm0
movups 0xa(%rax), %xmm1
movups %xmm1, 0xca(%rsp)
movups %xmm0, 0xc0(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x4d1e0
jmp 0x4cfcc
leaq 0x210(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x4a210
movq %rax, 0x20(%rsp)
jmp 0x4cfe8
movq 0x20(%rsp), %rsi
leaq 0x100(%rsp), %rdi
callq 0x703f0
jmp 0x4cffc
movq 0x28(%rsp), %rsi
movq 0x70(%rsp), %rdi
movaps 0x1d0(%rsp), %xmm0
movaps 0x1e0(%rsp), %xmm1
movq %rsp, %rax
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
leaq 0x100(%rsp), %rdx
movl $0x1, %ecx
callq 0x4a7f0
jmp 0x4d034
leaq 0x100(%rsp), %rdi
callq 0x70530
leaq 0xe0(%rsp), %rdi
callq 0x70000
leaq 0x88(%rsp), %rdi
callq 0x4d290
leaq 0x210(%rsp), %rdi
callq 0x70530
addq $0x308, %rsp            # imm = 0x308
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0x4d0c2
movq 0x50(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
callq 0x6fff0
movq 0x48(%rsp), %rdi
callq 0x70000
movq 0x40(%rsp), %rdi
callq 0x69ed0
movq 0x78(%rsp), %rdi
callq 0x52f50
leaq 0x20f(%rsp), %rdi
callq 0x136a0
jmp 0x4d181
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0x4d174
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
callq 0x192d00
jmp 0x4d174
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0x4d167
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
jmp 0x4d15a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x200(%rsp)
movl %eax, 0x1fc(%rsp)
leaq 0x100(%rsp), %rdi
callq 0x70530
leaq 0xe0(%rsp), %rdi
callq 0x70000
leaq 0x88(%rsp), %rdi
callq 0x4d290
leaq 0x210(%rsp), %rdi
callq 0x70530
movq 0x200(%rsp), %rdi
callq 0x133f0
nop