//
// sub_7620E8 from 0x7620e8 to 0x7621e2 (250 bytes)
//
// 53 xrefs:
// > GameToolbox::stringSetupToMap @ 0x2eea70
// > FMODAudioEngine::updateChannel @ 0x3031ec
// > std::set,std::allocator>::insert @ 0x31507c
// > std::_Rb_tree,std::pair,std::_Identity>,std::less>,std::allocator>>::_M_insert_unique>>> @ 0x31d434
// > GameManager::isIconLoaded @ 0x324e20
// > std::map,std::allocator>>::operator[] @ 0x324eb8
// > std::map,std::allocator>>::operator[] @ 0x325208
// > std::map>,std::less,std::allocator>>>>::operator[] @ 0x325382
// > std::map,std::allocator>>,std::less,std::allocator,std::allocator>>>>>::operator[] @ 0x32559e
// > std::map,std::allocator>>::operator[] @ 0x34db9a
// > std::_Rb_tree,std::less,std::allocator>::_M_insert_unique @ 0x37025a
// > LevelEditorLayer::getSongIDs @ 0x374bc6
// > EditorUI::updateObjectInfoLabel @ 0x3a0f10
// > GJLevelList::hasMatchingLevels @ 0x3ce35c
// > std::_Rb_tree,std::less,std::allocator>::_M_insert_unique @ 0x3ce410
// > std::map,std::allocator>>::operator[] @ 0x3dcce0
// > std::map,std::allocator>>::operator[] @ 0x3dcd76
// > CustomSongWidget::processNextMultiAsset @ 0x3dffb6
// > EventLinkTrigger::customObjectSetup @ 0x3ed1f8
// > SpawnTriggerGameObject::changeRemap @ 0x3ed9a6
// > std::map,std::allocator>>::operator[] @ 0x4042e6
// > std::set,std::less>,std::allocator>>::insert @ 0x413dc0
// > std::map,std::allocator>>::operator[] @ 0x4369f2
// > ObjectToolbox::intKeyToFrame @ 0x4516bc
// > SongInfoObject::addTags @ 0x45ada4
// > std::map,std::allocator>>::operator[] @ 0x45b8ec
// > std::_Rb_tree,std::tuple,std::_Identity>,std::less>,std::allocator>>::_M_insert_unique const&> @ 0x481702
// > std::_Rb_tree,std::pair const,SFXTriggerInstance>,std::_Select1st const,SFXTriggerInstance>>,std::less>,std::allocator const,SFXTriggerInstance>>>::_M_insert_unique const,SFXTriggerInstance>>>> @ 0x484966
// > GJBaseGameLayer::addProximityVolumeEffect @ 0x484a2a
// > std::map,std::pair,std::less>,std::allocator const,std::pair>>>::operator[] @ 0x48c7dc
// > std::map,int,std::less>,std::allocator const,int>>>::operator[] @ 0x48caba
// > std::map,int,std::less>,std::allocator const,int>>>::operator[] @ 0x48dcd2
// > std::map,std::vector>,std::less>,std::allocator const,std::vector>>>>::operator[] @ 0x4910f0
// > std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_insert_unique>>> @ 0x4953dc
// > GJEffectManager::storeTriggeredID @ 0x49ba1a
// > std::map,std::allocator>>::operator[] @ 0x49d8e2
// > std::map,std::vector>,std::less>,std::allocator const,std::vector>>>>::operator[] @ 0x49e4a0
// > GJAccountSettingsLayer::init @ 0x4b6226
// > std::map,std::allocator>>::operator[] @ 0x53c310
// > SelectEventLayer::onCustomToggleTriggerValue @ 0x57ee20
// > SecretRewardsLayer::generateChestItems @ 0x589a5c
// > SecretRewardsLayer::generateChestItems @ 0x589c1e
// > EnterEffectInstance::animateValue @ 0x58af28
// > std::map,int,std::less>,std::allocator const,int>>>::operator[] @ 0x596d14
// > cocos2d::extension::CCControl::addHandleOfControlEvent @ 0x5a0f6a
// > cocos2d::extension::CCScrollView::registerScriptHandler @ 0x5a93ce
// > cocos2d::extension::CCTableView::_addCellIfNecessary @ 0x5a99d2
// > cocos2d::CCSet::addObject @ 0x5c163a
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x5cc8ec
// > std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_insert_unique> @ 0x5df72e
// > cocos2d::CCSpriteFrameCache::addSpriteFramesWithFile @ 0x5e9b84
// > sub_5F05AC @ 0x5f072e
// > std::map,std::allocator>>::operator[] @ 0x5ffa36
//
// 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
//
int __fastcall sub_7620E8(int result, int *a2, _DWORD *a3, _DWORD *a4)
{
_DWORD *v5; // r10
int *v6; // r6
int *v7; // r1
int *v8; // r5
int *v9; // r4
int *v10; // r2
int v11; // r2
int v12; // r1
v5 = a4 + 1;
v6 = a2;
a2[1] = (int)a3;
a2[2] = 0;
a2[3] = 0;
*a2 = 0;
if ( result )
{
a3[2] = a2;
if ( a3 == a4 )
{
a4[1] = a2;
a4[3] = a2;
}
else if ( (_DWORD *)a4[2] == a3 )
{
a4[2] = a2;
}
}
else
{
a3[3] = a2;
if ( (_DWORD *)a4[3] == a3 )
a4[3] = a2;
}
v7 = (int *)a4[1];
LABEL_7:
if ( v6 != v7 )
{
do
{
v8 = (int *)v6[1];
if ( *v8 )
break;
v9 = (int *)v8[1];
v10 = (int *)v9[2];
if ( v8 == v10 )
{
v10 = (int *)v9[3];
if ( !v10 || (result = *v10) != 0 )
{
if ( (int *)v8[3] == v6 )
{
sub_761F50(v6[1], v5);
v6 = v8;
v8 = (int *)v8[1];
}
*v8 = 1;
*v9 = 0;
result = sub_761F7C((int)v9, v5);
v7 = (int *)a4[1];
goto LABEL_7;
}
}
else if ( !v10 || (result = *v10) != 0 )
{
if ( (int *)v8[2] == v6 )
{
result = sub_761F7C(v6[1], v5);
v6 = v8;
v8 = (int *)v8[1];
}
v11 = v9[3];
*v8 = 1;
*v9 = 0;
v12 = *(_DWORD *)(v11 + 8);
v9[3] = v12;
if ( v12 )
*(_DWORD *)(v12 + 4) = v9;
*(_DWORD *)(v11 + 4) = v9[1];
if ( v9 == (int *)a4[1] )
{
a4[1] = v11;
}
else
{
result = v9[1];
if ( v9 == *(int **)(result + 8) )
*(_DWORD *)(result + 8) = v11;
else
*(_DWORD *)(result + 12) = v11;
}
*(_DWORD *)(v11 + 8) = v9;
v9[1] = v11;
v7 = (int *)a4[1];
goto LABEL_7;
}
v6 = (int *)v8[1];
*v8 = 1;
*v10 = 1;
*v9 = result;
}
while ( v9 != v7 );
}
*v7 = 1;
return result;
}