//
// sub_14005D290 from 0x14005d290 to 0x14005d342 (178 bytes)
//
// 20 xrefs:
// > FMODAudioEngine::stopAllEffects @ 0x140059973
// > FMODAudioEngine::stopAllEffects @ 0x14005997f
// > sub_140207A90 @ 0x14020838b
// > GJBaseGameLayer::checkCollisions @ 0x1402138f8
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x1402197da
// > GJBaseGameLayer::generateTargetGroups @ 0x140224eb6
// > GJBaseGameLayer::resetLevelVariables @ 0x14023b4a0
// > sub_140251130 @ 0x140251136
// > sub_14025A480 @ 0x14025a65e
// > sub_14025A480 @ 0x14025a66a
// > sub_14025A480 @ 0x14025a676
// > GJEffectManager::reset @ 0x14025b295
// > sub_1402606B0 @ 0x1402607f7
// > sub_1402D11F0 @ 0x1402d12f2
// > LevelEditorLayer::onStopPlaytest @ 0x1402e07b0
// > PlayerObject::resetObject @ 0x14039730c
// > ShaderLayer::resetAllShaders @ 0x1404895fb
// > ??> @ 0x1406650f8
// > ??> @ 0x140665108
// > ??> @ 0x1406c54cc
//
// 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
//
__int64 __fastcall sub_14005D290(_QWORD *a1)
{
unsigned __int64 v2; // rcx
__int64 result; // rax
_QWORD **v4; // rcx
_QWORD *v5; // rcx
_QWORD *v6; // rbx
__int64 v7; // rdx
__int64 v8; // rcx
__int64 v9; // [rsp+30h] [rbp+8h] BYREF
v2 = a1[2];
if ( v2 )
{
if ( a1[7] >> 3 <= v2 )
{
v4 = (_QWORD **)a1[1];
*v4[1] = 0;
v5 = *v4;
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 = a1[4];
v8 = a1[3];
v9 = a1[1];
return sub_140060560(v8, v7, &v9);
}
else
{
return sub_14005E490(a1, *(_QWORD *)a1[1], a1[1]);
}
}
return result;
}