//
// PlayLayer::optimizeOpacityGroups from 0x704ea8 to 0x705044 (412 bytes)
//
// 2 xrefs:
// > PlayLayer::setupHasCompleted @ 0x7078cc
// > ??> @ 0xdbaa8
//
// This function is hookable on this platform (idp: arm, 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:52:04 +0000
//
__int64 __fastcall PlayLayer::optimizeOpacityGroups(cocos2d::CCArray **this)
{
unsigned int v2; // w19
__int64 v3; // x3
__int64 *i; // x22
int v5; // w21
cocos2d::CCArray *Group; // x20
unsigned int j; // w19
GameObject *v8; // x0
void *v9; // x19
int v11; // [xsp+5Ch] [xbp+5Ch] BYREF
__int64 *v12; // [xsp+60h] [xbp+60h] BYREF
_QWORD v13[2]; // [xsp+68h] [xbp+68h] BYREF
v13[0] = 0;
v2 = 0;
v13[1] = 0;
v12 = v13;
while ( v2 < (unsigned int)cocos2d::CCArray::count(*(this + 410)) )
{
v3 = cocos2d::CCArray::objectAtIndex(*(this + 410), v2);
if ( *(_DWORD *)(v3 + 1028) == 1007 )
{
v11 = *(_DWORD *)(v3 + 1464);
std::__tree::__emplace_unique_key_args(&v12, &v11, &v11);
}
++v2;
}
GJBaseGameLayer::addRemapTargets(this, &v12);
for ( i = v12; i != v13; i = std::__tree_next *>(i) )
{
v5 = *((_DWORD *)i + 7);
Group = (cocos2d::CCArray *)GJBaseGameLayer::getGroup((GJBaseGameLayer *)this, v5);
for ( j = 0; j < (unsigned int)cocos2d::CCArray::count(Group); ++j )
{
v8 = (GameObject *)cocos2d::CCArray::objectAtIndex(Group, j);
GameObject::addToOpacityGroup(v8, v5);
}
}
v9 = (void *)v13[0];
if ( v13[0] )
{
std::__tree::destroy((__int64)&v12, *(_QWORD **)v13[0]);
std::__tree::destroy((__int64)&v12, *(_QWORD **)&byte_8[(_QWORD)v9]);
operator delete(v9);
}
return _stack_chk_guard;
}