//
// cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject from 0x100416f00 to 0x100417156 (598 bytes)
//
// 0 xrefs:
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:30:11 +0000
//
__int64 __fastcall cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject(
__int64 a1,
unsigned int a2,
__int64 a3)
{
unsigned int v3; // eax
unsigned int v4; // r12d
unsigned int v5; // r14d
unsigned int *v6; // rax
const void **v7; // r13
const void **v8; // rbx
unsigned int v9; // r15d
void *v10; // rax
unsigned int v11; // eax
__int64 result; // rax
const void *v13; // rax
void *v14; // rax
const void *v15; // r14
void *v16; // r15
int v17; // ebx
unsigned int v18; // eax
unsigned int v19; // r15d
unsigned int v20; // r14d
unsigned int *v21; // rax
const void **v22; // r12
unsigned __int64 v23; // rbx
unsigned int v24; // r13d
void *v25; // rax
unsigned int v26; // eax
void *v28; // [rsp+8h] [rbp-38h]
void *v29; // [rsp+10h] [rbp-30h]
if ( !a3 )
return sub_1007FEF90(a1);
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a3 + 24LL))(a3);
v4 = 0;
if ( a1 )
{
v5 = v3;
v6 = *(unsigned int **)(a1 + 56);
if ( *v6 )
{
v7 = *((const void ***)v6 + 2);
v8 = &v7[*v6 - 1];
v4 = 0;
v9 = 0;
do
{
if ( !*v7 )
break;
v10 = __dynamic_cast(
*v7,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
-2);
v11 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v10 + 24LL))(v10);
if ( v5 == v11 )
break;
if ( v5 < v11 && v5 >= v9 )
break;
++v4;
++v7;
v9 = v11;
}
while ( v7 <= v8 );
}
}
result = sub_1007FEF90(a1);
if ( v4 < (unsigned int)result )
{
v13 = (const void *)sub_1007FEFE0(a1, v4);
if ( v13
&& (v14 = __dynamic_cast(
v13,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
-2)) != nullptr )
{
v15 = v14;
v16 = __dynamic_cast(
v14,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
-2);
}
else
{
v15 = nullptr;
v16 = nullptr;
}
cocos2d::CCObject::retain(v16);
v17 = (*(__int64 (__fastcall **)(const void *))(*(_QWORD *)v15 + 24LL))(v15);
if ( v17 == (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)a3 + 24LL))(a3) )
{
v28 = v16;
sub_1007FF150(a1, v4, 1);
(*(void (__fastcall **)(const void *, _QWORD))(*(_QWORD *)v15 + 16LL))(v15, a2);
v29 = __dynamic_cast(
v15,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
-2);
v18 = (*(__int64 (__fastcall **)(const void *))(*(_QWORD *)v15 + 24LL))(v15);
v19 = 0;
if ( a1 )
{
v20 = v18;
v21 = *(unsigned int **)(a1 + 56);
if ( *v21 )
{
v22 = *((const void ***)v21 + 2);
v23 = (unsigned __int64)&v22[*v21 - 1];
v19 = 0;
v24 = 0;
do
{
if ( !*v22 )
break;
v25 = __dynamic_cast(
*v22,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
-2);
v26 = (*(__int64 (__fastcall **)(void *))(*(_QWORD *)v25 + 24LL))(v25);
if ( v20 == v26 || v20 >= v24 && v20 < v26 )
break;
++v19;
++v22;
v24 = v26;
}
while ( (unsigned __int64)v22 <= v23 );
}
}
sub_1007FF110(a1, v29, v19);
return cocos2d::CCObject::release(v28);
}
else
{
return cocos2d::CCObject::release(v16);
}
}
return result;
}