//
// cocos2d::CCDirector::popToSceneInStack from 0x1800bece0 to 0x1800bed49 (105 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b9234
//
// 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::popToSceneInStack(cocos2d::CCDirector *this, struct cocos2d::CCScene *a2)
{
cocos2d::CCArray *m_pobScenesStack; // rax
char v3; // r10
int v5; // edx
cocos2d::ccArray *data; // rax
__int64 num; // r8
struct cocos2d::CCScene **arr; // rax
struct cocos2d::CCScene **v9; // r8
m_pobScenesStack = this->m_pobScenesStack;
v3 = 0;
v5 = 0;
if ( m_pobScenesStack )
{
data = m_pobScenesStack->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (struct cocos2d::CCScene **)data->arr;
v9 = &arr[num - 1];
if ( arr <= v9 )
{
while ( *arr )
{
++v5;
if ( *arr == a2 )
{
v3 = 1;
break;
}
if ( ++arr > v9 )
return;
}
}
}
}
if ( !v3 )
v5 = 0;
if ( v5 > 0 )
cocos2d::CCDirector::popToSceneStackLevel(this, v5);
}