//
// cocos2d::extension::CCArrayForObjectSorting::insertSortedObject from 0x100416bd0 to 0x100416cdd (269 bytes)
//
// 1 xrefs:
// > cocos2d::extension::CCTableView::_addCellIfNecessary @ 0x100419be2
//
// 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::insertSortedObject(__int64 a1, const void *a2)
{
void *v2; // r14
unsigned int v3; // eax
unsigned int v4; // r12d
unsigned int *v5; // rax
const void **v6; // r13
const void **v7; // r14
unsigned int v8; // r15d
unsigned int v9; // ebx
void *v10; // rax
unsigned int v11; // eax
void *v13; // [rsp+10h] [rbp-30h]
v2 = nullptr;
if ( a2 )
{
v2 = __dynamic_cast(
a2,
(const struct __class_type_info *)&`typeinfo for'cocos2d::extension::CCSortableObject,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
-2);
v3 = (*(__int64 (__fastcall **)(const void *))(*(_QWORD *)a2 + 24LL))(a2);
if ( a1 && (v4 = v3, v5 = *(unsigned int **)(a1 + 56), *v5) )
{
v13 = v2;
v6 = *((const void ***)v5 + 2);
v7 = &v6[*v5 - 1];
v8 = 0;
v9 = 0;
do
{
if ( !*v6 )
break;
v10 = __dynamic_cast(
*v6,
(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 ( v4 == v11 )
break;
if ( v4 < v11 && v4 >= v9 )
break;
++v8;
++v6;
v9 = v11;
}
while ( v6 <= v7 );
v2 = v13;
}
else
{
v8 = 0;
}
}
else
{
v8 = -1;
}
return sub_1007FF110(a1, v2, v8);
}