//
// cocos2d::extension::CCControl::removeTargetWithActionForControlEvents from 0x1800046e0 to 0x1800047fe (286 bytes)
//
// 12 xrefs:
// > ??> @ 0x180023b30
// > ??> @ 0x180024130
// > ??> @ 0x1800246a0
// > ??> @ 0x180024da8
// > ??> @ 0x180025358
// > ??> @ 0x180025940
// > ??> @ 0x180025ef0
// > ??> @ 0x1800264c0
// > ??> @ 0x180026ae8
// > ??> @ 0x180027f78
// > ??> @ 0x18002fdf8
// > ??> @ 0x180049414
//
// 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
//
__int64 __fastcall cocos2d::extension::CCControl::removeTargetWithActionForControlEvents(
__int64 a1,
__int64 a2,
__int64 a3,
unsigned int a4)
{
int v4; // r14d
__int64 result; // rax
__int64 v9; // r12
struct cocos2d::CCObject *v10; // rsi
unsigned int *v11; // rbx
__int64 v12; // rax
struct cocos2d::CCObject **v13; // rbx
struct cocos2d::CCObject **v14; // r15
struct cocos2d::CCObject *v15; // rdx
bool v16; // al
v4 = 1;
result = a4;
v9 = 9;
do
{
if ( (v4 & (unsigned int)result) == 0 )
goto LABEL_22;
v10 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 448), v4);
if ( !v10 )
{
v10 = cocos2d::CCArray::createWithCapacity(1u);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 448), v10, (unsigned int)v4);
}
if ( a2 || a3 )
{
if ( !v10 )
goto LABEL_21;
v11 = *((unsigned int **)v10 + 7);
v12 = *v11;
if ( !(_DWORD)v12 )
goto LABEL_21;
v13 = *((struct cocos2d::CCObject ***)v11 + 2);
v14 = &v13[v12 - 1];
if ( v13 > v14 )
goto LABEL_21;
while ( 1 )
{
v15 = *v13;
if ( !*v13 )
goto LABEL_21;
v16 = 1;
if ( a2 )
v16 = a2 == *((_QWORD *)v15 + 8);
if ( a3 )
break;
if ( v16 )
goto LABEL_19;
LABEL_20:
if ( ++v13 > v14 )
goto LABEL_21;
}
if ( !v16 || a3 != *((_QWORD *)v15 + 7) )
goto LABEL_20;
LABEL_19:
cocos2d::CCArray::removeObject(v10, v15, 1);
goto LABEL_20;
}
cocos2d::CCArray::removeAllObjects(v10);
LABEL_21:
result = a4;
LABEL_22:
v4 = __ROL4__(v4, 1);
--v9;
}
while ( v9 );
return result;
}