//
// cocos2d::extension::CCArrayForObjectSorting::indexOfSortedObject from 0xd1aebc to 0xd1afa4 (232 bytes)
//
// 7 xrefs:
// > cocos2d::extension::CCTableView::removeCellAtIndex @ 0xd1a424
// > cocos2d::extension::CCTableView::insertCellAtIndex @ 0xd1a9f4
// > cocos2d::extension::CCArrayForObjectSorting::insertSortedObject @ 0xd1afe8
// > cocos2d::extension::CCArrayForObjectSorting::removeSortedObject @ 0xd1b048
// > cocos2d::extension::CCArrayForObjectSorting::setObjectID_ofSortedObject @ 0xd1b108
// > cocos2d::extension::CCArrayForObjectSorting::objectWithObjectID @ 0xd1b284
// > ??> @ 0x1015d8
//
// This function is hookable on this platform (idp: arm, 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 13:07:08 +0000
//
__int64 __fastcall cocos2d::extension::CCArrayForObjectSorting::indexOfSortedObject(__int64 a1, __int64 a2)
{
unsigned int v2; // w20
unsigned int v4; // w22
unsigned int *v5; // x1
const void **v6; // x19
const void **v7; // x21
const void *v8; // x0
unsigned int v9; // w23
void *v10; // x0
unsigned int v11; // w0
v2 = -1;
if ( a2 )
{
v4 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 24LL))(a2);
if ( a1 )
{
v5 = *(unsigned int **)(a1 + 56);
v2 = 0;
if ( *v5 )
{
v6 = *((const void ***)v5 + 2);
v7 = &v6[*v5 - 1];
if ( v6 <= v7 )
{
v8 = *v6;
if ( *v6 )
{
v9 = 0;
do
{
++v6;
v10 = _dynamic_cast(
v8,
(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 || v4 < v11 && v4 >= v9 )
break;
++v2;
v9 = v11;
if ( v7 < v6 )
break;
v8 = *v6;
}
while ( *v6 );
}
}
}
}
else
{
return 0;
}
}
return v2;
}