//
// PlayerObject::addToTouchedRings from 0x769ae8 to 0x769d20 (568 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::playerTouchedRing @ 0x9c917c
// > ??> @ 0x8ec48
//
// 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:53:09 +0000
//
cocos2d::CCArray *__fastcall PlayerObject::addToTouchedRings(cocos2d::CCArray **this, RingObject *a2)
{
int v4; // w27
unsigned __int64 v5; // x26
unsigned __int64 v6; // x24
__int64 v7; // x23
unsigned __int64 v8; // x3
__int64 v9; // x25
__int64 ***v10; // x0
__int64 **v11; // x1
__int64 *v12; // x0
unsigned __int64 i; // x0
char *v14; // x22
__int64 v15; // x0
cocos2d::CCArray *v16; // x19
float v17; // s2
float v18; // s0
bool v19; // cc
__int64 v20; // x26
cocos2d::CCArray *result; // x0
__int64 v22; // x0
unsigned __int64 v23; // x26
unsigned __int64 v24; // x1
cocos2d::CCArray **v25; // x0
unsigned __int64 v26; // x0
unsigned __int64 v27; // x24
_BOOL8 v28; // x2
if ( !(unsigned __int8)cocos2d::CCArray::containsObject(*(this + 318), a2) )
cocos2d::CCArray::addObject(*(this + 318), a2);
v4 = *((_DWORD *)a2 + 229);
v5 = (unsigned __int64)*(this + 320);
if ( v5 )
{
v6 = v5 - 1;
v7 = (v5 - 1) & v5;
v8 = (v5 - 1) & v4;
if ( v7 )
v8 = v4 % v5;
v9 = 8 * v8;
v10 = *((__int64 ****)*(this + 319) + v8);
if ( v10 )
{
v11 = *v10;
if ( *v10 )
{
v12 = v11[1];
if ( v7 )
goto LABEL_18;
LABEL_9:
for ( i = v6 & (unsigned __int64)v12; v8 == i; i = (unsigned __int64)v12 % v5 )
{
result = (cocos2d::CCArray *)*((unsigned int *)v11 + 4);
if ( v4 == (_DWORD)result )
return result;
v11 = (__int64 **)*v11;
if ( !v11 )
break;
v12 = v11[1];
if ( !v7 )
goto LABEL_9;
LABEL_18:
;
}
}
}
v14 = (char *)(this + 321);
v15 = operator new(0x18u);
*(_DWORD *)(v15 + 16) = v4;
*(_QWORD *)(v15 + 8) = v4;
v16 = (cocos2d::CCArray *)v15;
*(_QWORD *)v15 = 0;
v17 = *((float *)this + 646);
v18 = (float)((unsigned __int64)*(this + 322) + 1);
if ( (float)((float)v5 * v17) >= v18 )
goto LABEL_24;
v19 = v5 > 2;
v20 = 2 * v5;
v28 = !v19 || v7 != 0;
}
else
{
v14 = (char *)(this + 321);
v20 = 0;
v22 = operator new(0x18u);
*(_DWORD *)(v22 + 16) = v4;
*(_QWORD *)(v22 + 8) = v4;
v28 = 1;
*(_QWORD *)v22 = 0;
v16 = (cocos2d::CCArray *)v22;
v17 = *((float *)this + 646);
v18 = (float)((unsigned __int64)*(this + 322) + 1);
}
v23 = v28 + v20;
v24 = vcvtps_u32_f32(v18 / v17);
if ( v24 < v23 )
v24 = v23;
std::__hash_table,std::equal_to,std::allocator>::rehash(
(unsigned __int64)(this + 319),
v24);
v5 = (unsigned __int64)*(this + 320);
v6 = v5 - 1;
if ( ((v5 - 1) & v5) == 0 )
{
v9 = 8 * (v6 & v4);
v25 = *(cocos2d::CCArray ***)((char *)*(this + 319) + v9);
if ( v25 )
goto LABEL_25;
LABEL_29:
*(_QWORD *)v16 = *(this + 321);
*(this + 321) = v16;
*(_QWORD *)((char *)*(this + 319) + v9) = v14;
if ( *(_QWORD *)v16 )
{
v26 = *(_QWORD *)(*(_QWORD *)v16 + 8LL);
if ( (v6 & v5) != 0 )
v27 = v26 % v5;
else
v27 = v6 & v26;
*((_QWORD *)*(this + 319) + v27) = v16;
}
goto LABEL_26;
}
v9 = 8 * (v4 % v5);
LABEL_24:
v25 = *(cocos2d::CCArray ***)((char *)*(this + 319) + v9);
if ( !v25 )
goto LABEL_29;
LABEL_25:
*(_QWORD *)v16 = *v25;
*v25 = v16;
LABEL_26:
result = (cocos2d::CCArray *)((char *)*(this + 322) + 1);
*(this + 322) = result;
return result;
}