//
// sub_1005D9DE0 from 0x1005d9de0 to 0x1005d9e87 (167 bytes)
//
// 2 xrefs:
// > ??> @ 0x10095e0b0
// > ??> @ 0x100974598
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
_QWORD *__fastcall sub_1005D9DE0(__int64 a1, char a2)
{
_QWORD *result; // rax
__int64 v4; // rdi
const void **v5; // r12
unsigned __int64 v6; // r13
*(_BYTE *)(a1 + 122) = a2;
v4 = *(_QWORD *)(a1 - 160);
if ( v4 )
{
result = (_QWORD *)sub_100720070(v4);
if ( (_DWORD)result )
{
result = *(_QWORD **)(a1 - 160);
if ( result )
{
result = (_QWORD *)result[7];
if ( *(_DWORD *)result )
{
v5 = (const void **)result[2];
v6 = (unsigned __int64)&v5[*(unsigned int *)result - 1];
do
{
if ( !*v5 )
break;
result = __dynamic_cast(
*v5,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCNode,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCRGBAProtocol,
-2);
if ( result )
result = (_QWORD *)(*(__int64 (__fastcall **)(_QWORD *, _QWORD))(*result + 48LL))(
result,
*(unsigned __int8 *)(a1 + 122));
++v5;
}
while ( (unsigned __int64)v5 <= v6 );
}
}
}
}
return result;
}