//
// sub_18009DF50 from 0x18009df50 to 0x18009dff6 (166 bytes)
//
// 2 xrefs:
// > cocos2d::CCSpriteBatchNode::removeSpriteFromAtlas @ 0x18008eed8
// > ??> @ 0x1801b7500
//
// 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
//
unsigned __int64 __fastcall sub_18009DF50(__int64 a1, unsigned int a2, char a3)
{
__int64 v3; // rbx
__int64 v5; // rsi
cocos2d::CCObject *v6; // rcx
unsigned __int64 result; // rax
__int64 v8; // rdx
v3 = (int)a2;
v5 = 8LL * a2;
*(_DWORD *)(*(_QWORD *)(v5 + *(_QWORD *)(a1 + 16)) + 40LL) = -1;
if ( a3 )
{
v6 = *(cocos2d::CCObject **)(v5 + *(_QWORD *)(a1 + 16));
if ( v6 )
cocos2d::CCObject::release(v6);
}
result = (unsigned int)(--*(_DWORD *)a1 - v3);
if ( *(_DWORD *)a1 != (_DWORD)v3 )
{
result = (unsigned __int64)memmove(
(void *)(*(_QWORD *)(a1 + 16) + v5),
(const void *)(*(_QWORD *)(a1 + 16) + 8LL * (unsigned int)(v3 + 1)),
8LL * (unsigned int)result);
if ( (unsigned int)v3 < *(_DWORD *)a1 )
{
v8 = 8 * v3;
do
{
result = *(_QWORD *)(a1 + 16);
v8 += 8;
*(_DWORD *)(*(_QWORD *)(v8 + result - 8) + 40LL) = v3;
LODWORD(v3) = v3 + 1;
}
while ( (unsigned int)v3 < *(_DWORD *)a1 );
}
}
return result;
}