//
// cocos2d::extension::CCArrayForObjectSorting::insertSortedObject from 0x100429f60 to 0x10042a06d (269 bytes)
//
// 1 xrefs:
// > cocos2d::extension::CCTableView::_addCellIfNecessary @ 0x10042cf72
//
// 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
//
void __fastcall cocos2d::extension::CCArrayForObjectSorting::insertSortedObject(
cocos2d::extension::CCArrayForObjectSorting *a1,
cocos2d::extension::CCSortableObject *a2)
{
void *v2; // r14
unsigned int v3; // eax
unsigned int v4; // r12d
cocos2d::ccArray *data; // rax
const void **arr; // r13
const void **v7; // r14
unsigned int v8; // r15d
unsigned int v9; // ebx
void *v10; // rax
unsigned int v11; // eax
void *v12; // [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 *)(cocos2d::extension::CCSortableObject *))a2->getObjectID)(a2);
if ( a1 && (v4 = v3, data = a1->data, data->num) )
{
v12 = v2;
arr = (const void **)data->arr;
v7 = &arr[data->num - 1];
v8 = 0;
v9 = 0;
do
{
if ( !*arr )
break;
v10 = __dynamic_cast(
*arr,
(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;
++arr;
v9 = v11;
}
while ( arr <= v7 );
v2 = v12;
}
else
{
v8 = 0;
}
}
else
{
v8 = -1;
}
sub_1007201F0(a1, v2, v8);
}