//
// EditorSFXManager::removeSoundAt from 0x140185b10 to 0x140185d83 (627 bytes)
//
// 4 xrefs:
// > EditorSFXActionConfigLayer::onDeleteSound @ 0x140184c0d
// > ??> @ 0x14089e7c8
// > ??> @ 0x14089e7d8
// > ??> @ 0x140918e0c
//
// 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 11:27:38 +0000
//
void __fastcall EditorSFXManager::removeSoundAt(_QWORD *a1, int a2, signed int a3)
{
cocos2d::CCArray **Binding; // rax
cocos2d::CCArray **v7; // rsi
_QWORD *v8; // rbx
__int64 v9; // r14
__int64 v10; // r15
__int64 v11; // r12
_DWORD *v12; // r8
void **v13; // rdx
_DWORD *v14; // r9
_QWORD *v15; // rcx
_QWORD *v16; // rax
__int64 v17; // rdx
__int64 v18; // r8
_QWORD *v19; // rdx
__int64 v20; // r9
__int64 v21; // rax
_QWORD *v22; // rax
__int64 v23; // r8
int v24; // [rsp+58h] [rbp+10h] BYREF
v24 = a2;
Binding = (cocos2d::CCArray **)EditorSFXManager::findBinding(a1, a2);
v7 = Binding;
if ( !Binding || !*Binding || a3 < 0 || a3 >= (int)cocos2d::CCArray::count(*Binding) )
return;
cocos2d::CCArray::removeObjectAtIndex(*v7, a3, 1);
v8 = nullptr;
if ( *((_DWORD *)v7 + 3) >= (signed int)cocos2d::CCArray::count(*v7) )
*((_DWORD *)v7 + 3) = 0;
if ( cocos2d::CCArray::count(*v7) )
return;
sub_140066A60(a1 + 16, (unsigned __int8 *)&v24);
v9 = BYTE1(v24);
v10 = BYTE2(v24);
v11 = HIBYTE(v24);
v12 = (_DWORD *)a1[9];
v13 = (void **)(a1[11]
+ 16
* (a1[14]
& (0x100000001B3LL
* (HIBYTE(v24)
^ (0x100000001B3LL
* (BYTE2(v24)
^ (0x100000001B3LL
* (BYTE1(v24) ^ (0x100000001B3LL * ((unsigned __int8)a2 ^ 0xCBF29CE484222325uLL))))))))));
v14 = v13[1];
v15 = v14;
if ( v14 == v12 )
goto LABEL_13;
if ( a2 != v14[4] )
{
while ( v15 != *v13 )
{
v15 = (_QWORD *)v15[1];
if ( a2 == *((_DWORD *)v15 + 4) )
goto LABEL_14;
}
LABEL_13:
v15 = nullptr;
}
LABEL_14:
if ( v15 )
{
v16 = *v13;
if ( v14 == (_DWORD *)v15 )
{
if ( v16 == v15 )
*v13 = v12;
else
v12 = (_DWORD *)v15[1];
v13[1] = v12;
}
else if ( v16 == v15 )
{
*v13 = (void *)*v15;
}
v17 = *v15;
--a1[10];
*(_QWORD *)v15[1] = v17;
*(_QWORD *)(v17 + 8) = v15[1];
j_j_free(v15);
}
if ( *v7 )
{
cocos2d::CCObject::release(*v7);
*v7 = nullptr;
}
sub_140069730((__int64)(v7 + 6));
sub_14003D310((__int64)(v7 + 2));
j_j_free(v7);
v18 = a1[1];
v19 = (_QWORD *)(a1[3]
+ 16
* (a1[6]
& (0x100000001B3LL
* (v11
^ (0x100000001B3LL
* (v10
^ (0x100000001B3LL * (v9 ^ (0x100000001B3LL * ((unsigned __int8)a2 ^ 0xCBF29CE484222325uLL))))))))));
v20 = v19[1];
v21 = v20;
if ( v20 != v18 )
{
if ( a2 == *(_DWORD *)(v20 + 16) )
{
LABEL_29:
v8 = (_QWORD *)v21;
}
else
{
while ( v21 != *v19 )
{
v21 = *(_QWORD *)(v21 + 8);
if ( a2 == *(_DWORD *)(v21 + 16) )
goto LABEL_29;
}
}
}
if ( v8 )
{
v22 = (_QWORD *)*v19;
if ( (_QWORD *)v20 == v8 )
{
if ( v22 == v8 )
*v19 = v18;
else
v18 = v8[1];
v19[1] = v18;
}
else if ( v22 == v8 )
{
*v19 = *v8;
}
v23 = *v8;
--a1[2];
*(_QWORD *)v8[1] = v23;
*(_QWORD *)(v23 + 8) = v8[1];
j_j_free(v8);
}
}