//
// cocos2d::CCDirector::popToSceneStackLevel from 0x100484530 to 0x100484624 (244 bytes)
//
// 2 xrefs:
// > cocos2d::CCDirector::popToRootScene @ 0x10048452a
// > cocos2d::CCDirector::popToSceneInStack @ 0x1004846ed
//
// 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
//
void __fastcall cocos2d::CCDirector::popToSceneStackLevel(cocos2d::CCDirector *a1, int a2)
{
int v2; // eax
int v3; // r15d
__int64 v4; // r12
char v5; // al
__int64 v6; // rcx
v2 = sub_100720070(a1->m_pobScenesStack);
if ( !a2 )
{
v5 = 1;
v6 = 176;
LABEL_12:
*((_BYTE *)&a1->cocos2d::CCObject::cocos2d::CCCopying::__vftable + v6) = v5;
return;
}
v3 = v2;
if ( v2 > a2 )
{
do
{
v4 = sub_1007200E0(a1->m_pobScenesStack);
if ( (*(unsigned __int8 (__fastcall **)(__int64))(*(_QWORD *)v4 + 664LL))(v4) )
{
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 712LL))(v4);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 704LL))(v4);
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v4 + 720LL))(v4);
if ( a1->m_pSceneReference )
{
if ( a1->m_pSceneReference == (cocos2d::CCScene *)sub_1007200E0(a1->m_pobScenesStack) )
a1->m_pSceneReference = nullptr;
}
sub_100720200(a1->m_pobScenesStack, 1);
--v3;
}
while ( v3 > a2 );
a1->m_pNextScene = (cocos2d::CCScene *)sub_1007200E0(a1->m_pobScenesStack);
v6 = 280;
v5 = 0;
goto LABEL_12;
}
}