//
// sub_140060D70 from 0x140060d70 to 0x140060fc9 (601 bytes)
//
// 123 xrefs:
// > FMODAudioEngine::stopChannel_1 @ 0x1400588c0
// > CollisionBlockPopup::onNextItemID @ 0x14008b74e
// > CollisionBlockPopup::onNextItemID @ 0x14008b7c1
// > EditorUI::copyObjects @ 0x140112fa3
// > EditorUI::copyObjects @ 0x140112fe6
// > EditorUI::dynamicGroupUpdate @ 0x140118a87
// > EditorUI::dynamicGroupUpdate @ 0x140118ae9
// > EditorUI::dynamicGroupUpdate @ 0x140118c0f
// > EditorUI::dynamicGroupUpdate @ 0x140118c22
// > EditorUI::dynamicGroupUpdate @ 0x140118c33
// > EditorUI::dynamicGroupUpdate @ 0x140118c44
// > EditorUI::dynamicGroupUpdate @ 0x140118c86
// > EditorUI::dynamicGroupUpdate @ 0x140118c99
// > EditorUI::dynamicGroupUpdate @ 0x140118cac
// > EditorUI::dynamicGroupUpdate @ 0x140118cea
// > EditorUI::dynamicGroupUpdate @ 0x140118d1e
// > EditorUI::dynamicGroupUpdate @ 0x140118d2d
// > EditorUI::dynamicGroupUpdate @ 0x140118d4c
// > EditorUI::dynamicGroupUpdate @ 0x140118d6a
// > EditorUI::dynamicGroupUpdate @ 0x140118eee
// > GJBaseGameLayer::addRemapTargets @ 0x14020dc40
// > GJBaseGameLayer::addRemapTargets @ 0x14020dc65
// > GJBaseGameLayer::playKeyframeAnimation @ 0x140217d20
// > GJBaseGameLayer::playerTouchedRing @ 0x140217ee0
// > sub_1402195E0 @ 0x1402196b0
// > sub_1402195E0 @ 0x1402196c2
// > sub_1402195E0 @ 0x140219716
// > sub_1402195E0 @ 0x140219732
// > sub_1402195E0 @ 0x14021978f
// > sub_1402195E0 @ 0x1402197a1
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219970
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219996
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219bae
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219c83
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219d09
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219d93
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219e7e
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x140219f5d
// > GJBaseGameLayer::prepareSavePositionObjects @ 0x14021a177
// > GJBaseGameLayer::toggleGroup @ 0x140223d25
// > GJBaseGameLayer::sortGroups @ 0x1402243ae
// > GJBaseGameLayer::generateTargetGroups @ 0x140225062
// > GJBaseGameLayer::generateTargetGroups @ 0x1402250e4
// > GJBaseGameLayer::generateTargetGroups @ 0x140225162
// > GJBaseGameLayer::generateTargetGroups @ 0x140225359
// > GJBaseGameLayer::addAreaEffect @ 0x1402277d2
// > GJBaseGameLayer::processFollowActions @ 0x1402308b4
// > GJBaseGameLayer::generateVisibilityGroups @ 0x14023163e
// > GJBaseGameLayer::generateVisibilityGroups @ 0x14023170f
// > GJBaseGameLayer::generateVisibilityGroups @ 0x140231766
// > GJBaseGameLayer::generateVisibilityGroups @ 0x140231812
// > GJBaseGameLayer::generateVisibilityGroups @ 0x140231ac6
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x140234b0c
// > GJBaseGameLayer::activatePersistentItemTrigger @ 0x140234bc7
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236b39
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236c0a
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236d1c
// > GJBaseGameLayer::preUpdateVisibility @ 0x140236eb6
// > GJBaseGameLayer::claimCustomParticle @ 0x140241207
// > GJBaseGameLayer::processSFXObjects @ 0x140241ab3
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x140243e20
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x140243fe8
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x14024405c
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x1402443db
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x14024451b
// > GJBaseGameLayer::processActivatedAudioTriggers @ 0x14024467b
// > sub_14024B110 @ 0x14024b19c
// > GJEffectManager::handleObjectCollision @ 0x14025c69c
// > GJEffectManager::playerButton @ 0x140262383
// > GJEffectManager::updateCountForItem @ 0x1402628ad
// > LevelEditorLayer::getNextFreeGroupID @ 0x1402da7ec
// > LevelEditorLayer::getNextFreeGroupID @ 0x1402da879
// > LevelEditorLayer::getNextFreeGroupID @ 0x1402da8ea
// > LevelEditorLayer::getNextFreeGroupID @ 0x1402da8ff
// > LevelEditorLayer::getNextFreeGroupID @ 0x1402da914
// > LevelEditorLayer::getNextFreeGroupID @ 0x1402da929
// > LevelEditorLayer::getNextFreeItemID @ 0x1402da9ce
// > LevelEditorLayer::getNextFreeItemID @ 0x1402daa5b
// > LevelEditorLayer::getNextFreeOrderChannel @ 0x1402daafe
// > LevelEditorLayer::getNextFreeOrderChannel @ 0x1402dab70
// > LevelEditorLayer::getNextFreeOrderChannel @ 0x1402daba0
// > LevelEditorLayer::getNextFreeEditorLayer @ 0x1402dac3e
// > LevelEditorLayer::getNextFreeEditorLayer @ 0x1402dac9d
// > LevelEditorLayer::getNextFreeEditorLayer @ 0x1402dacc2
// > LevelEditorLayer::getNextFreeEnterChannel @ 0x1402dad6e
// > LevelEditorLayer::getNextFreeEnterChannel @ 0x1402dadcd
// > LevelEditorLayer::getNextFreeEnterChannel @ 0x1402dadfa
// > LevelEditorLayer::getNextFreeAreaEffectID @ 0x1402dae9e
// > LevelEditorLayer::getNextFreeAreaEffectID @ 0x1402daf05
// > LevelEditorLayer::getNextFreeGradientID @ 0x1402dafae
// > LevelEditorLayer::getNextFreeGradientID @ 0x1402db018
// > LevelEditorLayer::getNextColorChannel @ 0x1402db147
// > LevelEditorLayer::getNextColorChannel @ 0x1402db160
// > LevelEditorLayer::getNextColorChannel @ 0x1402db245
// > LevelEditorLayer::resetUnusedColorChannels @ 0x1402db515
// > LevelEditorLayer::resetUnusedColorChannels @ 0x1402db52e
// > LevelEditorLayer::resetUnusedColorChannels @ 0x1402db608
// > LevelEditorLayer::toggleGroupPreview @ 0x1402de4b4
// > sub_1402E2370 @ 0x1402e288b
// > sub_1402E2EF0 @ 0x1402e2fd7
// > sub_1402E2EF0 @ 0x1402e30f5
// > sub_1402E2EF0 @ 0x1402e3105
// > sub_1402E2EF0 @ 0x1402e31f7
// > sub_1402E2EF0 @ 0x1402e34b9
// > sub_1402E3B00 @ 0x1402e3c04
// > sub_1402E3B00 @ 0x1402e4052
// > sub_1402E3B00 @ 0x1402e4151
// > sub_1402E3B00 @ 0x1402e4434
// > sub_1402E3B00 @ 0x1402e4dc1
// > LevelTools::getLevelList @ 0x140324ffb
// > MusicDownloadManager::init @ 0x14033d2df
// > MusicDownloadManager::init @ 0x14033d33f
// > SongInfoObject::init @ 0x140346136
// > PlayerObject::ringJump @ 0x140398db4
// > PlayLayer::loadDefaultColors @ 0x1403b1cd0
// > PlayLayer::loadDefaultColors @ 0x1403b1f16
// > PlayLayer::updateColor @ 0x1403b202d
// > SetupKeyframePopup::onCustomButton @ 0x1404267b7
// > SetupSFXPopup::onPlusButton @ 0x140448fdc
// > SetupSFXPopup::onPlusButton @ 0x140449046
// > SetupSFXPopup::onPlusButton @ 0x14044911c
// > SetupSFXPopup::onPlusButton @ 0x14044919c
// > ??> @ 0x1406c5988
//
// 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
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall sub_140060D70(__int64 a1, __int64 a2, unsigned __int8 *a3)
{
unsigned __int64 v6; // r13
__int64 v7; // rcx
__int64 v8; // rax
__int64 *v9; // rbx
__int64 *v10; // r15
__int64 *v11; // rbp
__int64 *v12; // rcx
_DWORD *v14; // rdi
__int64 v15; // rdx
float v16; // xmm0_4
__int64 v17; // rcx
float v18; // xmm1_4
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rcx
__int64 *v22; // rax
__int64 *v23; // rdx
int v24; // ecx
_QWORD *v25; // rdx
__int64 v26; // rcx
__int64 v27; // rax
__int64 *v28; // r8
__int64 *v29; // [rsp+20h] [rbp-38h]
v6 = 0x100000001B3LL
* (a3[3]
^ (0x100000001B3LL * (a3[2] ^ (0x100000001B3LL * (a3[1] ^ (0x100000001B3LL * (*a3 ^ 0xCBF29CE484222325uLL)))))));
v7 = 2 * (v6 & *(_QWORD *)(a1 + 48));
v8 = *(_QWORD *)(a1 + 24);
v9 = *(__int64 **)(v8 + 8 * v7 + 8);
v10 = *(__int64 **)(a1 + 8);
if ( v9 == v10 )
{
v9 = *(__int64 **)(a1 + 8);
v11 = v9;
goto LABEL_9;
}
v12 = *(__int64 **)(v8 + 8 * v7);
if ( *(_DWORD *)a3 != *((_DWORD *)v9 + 4) )
{
while ( v9 != v12 )
{
v9 = (__int64 *)v9[1];
if ( *(_DWORD *)a3 == *((_DWORD *)v9 + 4) )
goto LABEL_6;
}
v10 = v9;
v11 = v9;
LABEL_9:
if ( *(_QWORD *)(a1 + 16) == 0xAAAAAAAAAAAAAAALL )
std::_Xlength_error("unordered_map/set too long");
v14 = operator new(0x18u);
v14[4] = *(_DWORD *)a3;
v15 = *(_QWORD *)(a1 + 16) + 1LL;
if ( v15 < 0 )
v16 = (float)(v15 & 1 | (unsigned int)((unsigned __int64)v15 >> 1))
+ (float)(v15 & 1 | (unsigned int)((unsigned __int64)v15 >> 1));
else
v16 = (float)(int)v15;
v17 = *(_QWORD *)(a1 + 56);
if ( v17 < 0 )
{
v19 = *(_QWORD *)(a1 + 56) & 1LL | ((unsigned __int64)v17 >> 1);
v18 = (float)(int)v19 + (float)(int)v19;
}
else
{
v18 = (float)(int)v17;
}
if ( (float)(v16 / v18) <= *(float *)a1 )
{
LABEL_25:
v25 = (_QWORD *)v9[1];
++*(_QWORD *)(a1 + 16);
*(_QWORD *)v14 = v10;
*((_QWORD *)v14 + 1) = v25;
*v25 = v14;
v9[1] = (__int64)v14;
v26 = *(_QWORD *)(a1 + 24);
v27 = 2 * (v6 & *(_QWORD *)(a1 + 48));
v28 = *(__int64 **)(v26 + 16 * (v6 & *(_QWORD *)(a1 + 48)));
if ( v28 == *(__int64 **)(a1 + 8) )
{
*(_QWORD *)(v26 + 16 * (v6 & *(_QWORD *)(a1 + 48))) = v14;
LABEL_31:
*(_QWORD *)(v26 + 8 * v27 + 8) = v14;
goto LABEL_32;
}
if ( v28 == v11 )
{
*(_QWORD *)(v26 + 16 * (v6 & *(_QWORD *)(a1 + 48))) = v14;
}
else if ( *(_QWORD **)(v26 + 16 * (v6 & *(_QWORD *)(a1 + 48)) + 8) == v25 )
{
goto LABEL_31;
}
LABEL_32:
*(_QWORD *)a2 = v14;
*(_BYTE *)(a2 + 8) = 1;
return a2;
}
v20 = sub_14005F0F0(a1, v15);
sub_140062E80(a1, v20);
v21 = *(_QWORD *)(a1 + 24);
v22 = *(__int64 **)(v21 + 16 * (*(_QWORD *)(a1 + 48) & v6) + 8);
v9 = *(__int64 **)(a1 + 8);
if ( v22 != v9 )
{
v23 = *(__int64 **)(v21 + 16 * (*(_QWORD *)(a1 + 48) & v6));
v24 = v14[4];
if ( v24 != *((_DWORD *)v22 + 4) )
{
while ( 1 )
{
v9 = v22;
if ( v22 == v23 )
break;
v22 = (__int64 *)v22[1];
if ( v24 == *((_DWORD *)v22 + 4) )
goto LABEL_22;
}
v29 = v22;
goto LABEL_24;
}
LABEL_22:
v9 = (__int64 *)*v22;
}
v29 = v9;
LABEL_24:
v11 = v9;
v10 = v29;
goto LABEL_25;
}
LABEL_6:
*(_QWORD *)a2 = v9;
*(_BYTE *)(a2 + 8) = 0;
return a2;
}