//
// sub_140066610 from 0x140066610 to 0x1400666b4 (164 bytes)
//
// 25 xrefs:
// > FMODAudioEngine::stopAllEffects @ 0x1400625b3
// > FMODAudioEngine::stopAllEffects @ 0x1400625bf
// > EditorSFXManager::clearAll @ 0x140185e04
// > EditorSFXManager::clearAll @ 0x140185e0d
// > sub_14018D060 @ 0x14018d066
// > GameManager::firstLoad @ 0x140285460
// > sub_14030DAE0 @ 0x14030e3db
// > GJBaseGameLayer::checkCollisions @ 0x14031abf2
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140320d71
// > GJBaseGameLayer::generateTargetGroups @ 0x14032d664
// > GJBaseGameLayer::resetLevelVariables @ 0x14034545f
// > GJEffectManager::dGJEffectManager @ 0x140364934
// > GJEffectManager::dGJEffectManager @ 0x140364940
// > GJEffectManager::dGJEffectManager @ 0x14036494c
// > GJEffectManager::reset @ 0x140365595
// > sub_14036ADE0 @ 0x14036af28
// > DrawGridLayer::dDrawGridLayer @ 0x1403eca5d
// > LevelEditorLayer::onStopPlaytest @ 0x140400080
// > PlayerObject::resetObject @ 0x1404f5595
// > sub_140529CD0 @ 0x140529dcd
// > sub_14052A4F0 @ 0x14052a5f0
// > ShaderLayer::resetAllShaders @ 0x14062a6bb
// > ??> @ 0x1408889d8
// > ??> @ 0x1408889e8
// > ??> @ 0x140910e68
//
// 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:25:45 +0000
//
unsigned __int64 __fastcall sub_140066610(_QWORD *a1)
{
unsigned __int64 v1; // rdx
__int64 v3; // rcx
unsigned __int64 result; // rax
_QWORD *v5; // rcx
_QWORD *v6; // rbx
unsigned __int64 *v7; // rdx
unsigned __int64 *v8; // rcx
unsigned __int64 v9; // [rsp+30h] [rbp+8h] BYREF
v1 = a1[2];
if ( v1 )
{
v3 = a1[1];
if ( a1[7] >> 3 <= v1 )
{
**(_QWORD **)(v3 + 8) = 0;
v5 = *(_QWORD **)v3;
if ( v5 )
{
do
{
v6 = (_QWORD *)*v5;
j_j_free(v5);
v5 = v6;
}
while ( v6 );
}
*(_QWORD *)a1[1] = a1[1];
*(_QWORD *)(a1[1] + 8LL) = a1[1];
a1[2] = 0;
v7 = (unsigned __int64 *)a1[4];
v8 = (unsigned __int64 *)a1[3];
v9 = a1[1];
return sub_14003EC90(v8, v7, &v9);
}
else
{
return sub_140068EB0(a1, *(_QWORD *)v3, v3);
}
}
return result;
}