//
// cocos2d::extension::CCArrayForObjectSorting::insertSortedObject from 0x180014540 to 0x180014637 (247 bytes)
//
// 5 xrefs:
// > cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject @ 0x1800148ea
// > cocos2d::extension::CCTableView::_addCellIfNecessary @ 0x18001589c
// > ??> @ 0x18002fdf8
// > ??> @ 0x18004a62c
// > ??> @ 0x18004a638
//
// 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 *this,
struct cocos2d::extension::CCSortableObject *a2)
{
struct cocos2d::CCObject *v4; // r12
unsigned int v5; // edi
unsigned int v6; // ebp
unsigned int v7; // esi
unsigned int *v8; // rbx
__int64 v9; // rcx
_QWORD *v10; // rbx
_QWORD *i; // r14
__int64 v12; // rax
unsigned int v13; // eax
v4 = (struct cocos2d::CCObject *)_RTDynamicCast(
a2,
0,
&cocos2d::extension::CCSortableObject `RTTI Type Descriptor',
&cocos2d::CCObject `RTTI Type Descriptor',
0);
v5 = 0;
if ( a2 )
{
v6 = 0;
v7 = (*(__int64 (__fastcall **)(struct cocos2d::extension::CCSortableObject *))(*(_QWORD *)a2 + 16LL))(a2);
if ( this )
{
v8 = *((unsigned int **)this + 7);
v9 = *v8;
if ( (_DWORD)v9 )
{
v10 = *((_QWORD **)v8 + 2);
for ( i = &v10[v9 - 1]; v10 <= i; v6 = v13 )
{
if ( !*v10 )
break;
v12 = _RTDynamicCast(
*v10,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::extension::CCSortableObject `RTTI Type Descriptor',
0);
v13 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v12 + 16LL))(v12);
if ( v7 == v13 || v7 >= v6 && v7 < v13 )
break;
++v5;
++v10;
}
}
}
}
else
{
v5 = -1;
}
cocos2d::CCArray::insertObject(this, v4, v5);
}