//
// sub_140066A60 from 0x140066a60 to 0x140066b44 (228 bytes)
//
// 37 xrefs:
// > FMODAudioEngine::playEffectAdvanced @ 0x14005fe02
// > FMODAudioEngine::playEffectAdvanced @ 0x14005fe12
// > FMODAudioEngine::unregisterChannel @ 0x140060908
// > FMODAudioEngine::unregisterChannel @ 0x1400609b9
// > FMODAudioEngine::unregisterChannel @ 0x1400609ca
// > DeathStatsPopup::onFetch @ 0x14011f156
// > DeathStatsPopup::onFetch @ 0x14011f176
// > DeathStatsPopup::showResult @ 0x14011f493
// > DeathStatsPopup::showResult @ 0x14011f4b5
// > CustomSFXWidget::onToggleFavorite @ 0x140162104
// > CustomSFXWidget::onToggleFavorite @ 0x14016216c
// > CustomSongWidget::onToggleFavorite @ 0x14016b85a
// > EditorSFXManager::removeSoundAt @ 0x140185ba9
// > EditorSFXManager::deserializeAll @ 0x140189559
// > EditorSFXSettingsPopup::valueDidChange @ 0x14018d847
// > EditorUI::dynamicGroupUpdate @ 0x1401b882b
// > GameLevelManager::deleteLevel @ 0x14021c8d4
// > GameLevelManager::deleteLevel @ 0x14021c8f6
// > GameLevelManager::applyDeathBlob @ 0x140227fe5
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140321dc7
// > GJBaseGameLayer::toggleGroup @ 0x14032b99d
// > GJBaseGameLayer::addToGroupParents @ 0x14032cbd3
// > GJBaseGameLayer::processAreaEffects @ 0x140331143
// > GJBaseGameLayer::processFollowActions @ 0x1403393d3
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x14033d8b5
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x14033da4f
// > GJBaseGameLayer::resetLevelVariables @ 0x140345237
// > GJBaseGameLayer::updateParticles @ 0x14034b49e
// > GJEffectManager::handleObjectCollision @ 0x14036695f
// > GJEffectManager::playerButton @ 0x14036cae7
// > GJEffectManager::updateCountForItem @ 0x14036cc7a
// > GJEffectManager::updateCountForItem @ 0x14036cff3
// > GJEffectManager::transferPersistentItems @ 0x14036d6f6
// > LevelEditorLayer::addSpecial @ 0x1403f5257
// > LevelEditorLayer::toggleGroupPreview @ 0x1403fcf19
// > MusicDownloadManager::deleteCustomSFXObject @ 0x14048a1c5
// > ??> @ 0x140910f1c
//
// 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:46 +0000
//
__int64 __fastcall sub_140066A60(_QWORD *a1, unsigned __int8 *a2)
{
_DWORD *v4; // r9
void **v5; // rdx
_DWORD *v6; // rcx
_DWORD *v7; // rax
__int64 v8; // rdx
v4 = (_DWORD *)a1[1];
v5 = (void **)(a1[3]
+ 16
* (a1[6]
& (0x100000001B3LL
* (a2[3]
^ (0x100000001B3LL
* (a2[2] ^ (0x100000001B3LL * (a2[1] ^ (0x100000001B3LL * (*a2 ^ 0xCBF29CE484222325uLL))))))))));
v6 = v5[1];
if ( v6 != v4 )
{
if ( *(_DWORD *)a2 == v6[4] )
goto LABEL_7;
while ( v6 != *v5 )
{
v6 = *((_DWORD **)v6 + 1);
if ( *(_DWORD *)a2 == v6[4] )
goto LABEL_7;
}
}
v6 = nullptr;
LABEL_7:
if ( !v6 )
return 0;
v7 = *v5;
if ( v5[1] == v6 )
{
if ( v7 == v6 )
*v5 = v4;
else
v4 = *((_DWORD **)v6 + 1);
v5[1] = v4;
}
else if ( v7 == v6 )
{
*v5 = *(void **)v6;
}
v8 = *(_QWORD *)v6;
--a1[2];
**((_QWORD **)v6 + 1) = v8;
*(_QWORD *)(v8 + 8) = *((_QWORD *)v6 + 1);
j_j_free(v6);
return 1;
}