//
// GameManager::safePopScene from 0x100376cd0 to 0x100376d31 (97 bytes)
//
// 8 xrefs:
// > LevelInfoLayer::onBack @ 0x1002aef5b
// > LevelBrowserLayer::onBack @ 0x100487241
// > LeaderboardsLayer::onBack @ 0x1005146f1
// > LeaderboardsLayer::keyBackClicked @ 0x1005152f1
// > sub_100515300 @ 0x10051534b
// > LevelSearchLayer::onBack @ 0x1007080f3
// > LevelSearchLayer::keyBackClicked @ 0x1007096f3
// > sub_100709720 @ 0x100709740
//
// 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 12:29:04 +0000
//
__int64 __fastcall GameManager::safePopScene(__int64 a1, __int64 a2)
{
__int64 v2; // rdi
int v3; // r14d
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rax
char *v7; // rax
v2 = cocos2d::CCDirector::sharedDirector(a1, a2);
v3 = cocos2d::CCDirector::sceneCount(v2);
v4 = cocos2d::CCDirector::sharedDirector(v2, a2);
v5 = v4;
if ( v3 > 1 )
return cocos2d::CCDirector::popSceneWithTransition(v4, 0, 0.5);
v6 = MenuLayer::scene(0);
v7 = cocos2d::CCTransitionFade::create_1(v6, 0.5);
return cocos2d::CCDirector::replaceScene(v5, v7);
}