//
// cocos2d::extension::CCArrayForObjectSorting::indexOfSortedObject from 0x180014650 to 0x180014718 (200 bytes)
//
// 5 xrefs:
// > ??> @ 0x1800311e4
// > ??> @ 0x180031220
// > ??> @ 0x180031230
// > ??> @ 0x180032408
// > ??> @ 0x18004c5cc
//
// 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:15:41 +0000
//
__int64 __fastcall cocos2d::extension::CCArrayForObjectSorting::indexOfSortedObject(
cocos2d::extension::CCArrayForObjectSorting *this,
struct cocos2d::extension::CCSortableObject *a2)
{
unsigned int v3; // ebx
unsigned int v4; // ebp
unsigned int v5; // esi
unsigned int *v6; // rdi
__int64 v7; // rax
_QWORD *v8; // rdi
_QWORD *i; // r14
__int64 v10; // rax
unsigned int v11; // eax
v3 = 0;
if ( !a2 )
return 0xFFFFFFFFLL;
v4 = 0;
v5 = (*(__int64 (__fastcall **)(struct cocos2d::extension::CCSortableObject *))(*(_QWORD *)a2 + 16LL))(a2);
if ( !this )
return 0;
v6 = *((unsigned int **)this + 7);
v7 = *v6;
if ( !(_DWORD)v7 )
return 0;
v8 = *((_QWORD **)v6 + 2);
for ( i = &v8[v7 - 1]; v8 <= i; v4 = v11 )
{
if ( !*v8 )
break;
v10 = _RTDynamicCast(
*v8,
0,
&cocos2d::CCObject `RTTI Type Descriptor',
&cocos2d::extension::CCSortableObject `RTTI Type Descriptor',
0);
v11 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v10 + 16LL))(v10);
if ( v5 == v11 || v5 >= v4 && v5 < v11 )
break;
++v3;
++v8;
}
return v3;
}