//
// GJGameState::getGameObjectPhysics from 0x5bb5f8 to 0x5bb886 (654 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x5bb970
// > GJBaseGameLayer::processAdvancedFollowAction @ 0x5bc5ba
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:53:42 +0000
//
_DWORD *__fastcall GJGameState::getGameObjectPhysics(GJGameState *this, GameObject *a2)
{
int v2; // r7
char *v4; // r9
_DWORD *v6; // r0
_DWORD *result; // r0
unsigned int v8; // r5
unsigned int v9; // r8
unsigned int v10; // r11
_DWORD **v11; // r2
_DWORD *i; // r4
unsigned int v13; // r0
int v14; // r1
_DWORD *v15; // r0
int v16; // r3
float v17; // s13
float v18; // s15
bool v19; // r11
unsigned int prime; // r5
unsigned int v21; // r0
unsigned int v22; // r7
int v23; // r0
unsigned int v24; // r1
unsigned int v25; // s15
float v26; // s14
unsigned int v27; // r0
_DWORD *v28; // r3
int v29; // r3
unsigned int v30; // r0
int v31; // r1
float v32; // r0
unsigned int v33; // [sp+10h] [bp-34h] BYREF
int v34; // [sp+14h] [bp-30h]
_BYTE v35[8]; // [sp+18h] [bp-2Ch] BYREF
_BYTE v36[8]; // [sp+20h] [bp-24h] BYREF
int v37; // [sp+28h] [bp-1Ch]
int v38; // [sp+2Ch] [bp-18h]
int v39; // [sp+30h] [bp-14h]
int v40; // [sp+34h] [bp-10h]
int v41; // [sp+38h] [bp-Ch]
v4 = (char *)this + 580;
v33 = *((_DWORD *)a2 + 195);
v6 = std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::find(
(_DWORD *)this + 145,
&v33);
if ( v6 )
{
result = v6 + 3;
goto LABEL_46;
}
v34 = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v35);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v36);
v39 = 0;
v40 = 0;
v41 = 0;
v8 = *((_DWORD *)this + 146);
v37 = 0;
v38 = 0;
v9 = v33;
if ( v8 )
{
v10 = v8 - 1;
v2 = ((v8 - 1) & v8) != 0 ? v33 % v8 : v10 & v33;
v11 = *(_DWORD ***)(*((_DWORD *)this + 145) + 4 * v2);
if ( v11 )
{
for ( i = *v11; i; i = (_DWORD *)*i )
{
v13 = i[1];
v14 = ((v8 - 1) & v8) != 0 ? v13 % v8 : v10 & v13;
if ( v14 != v2 )
break;
if ( i[2] == v33 )
goto LABEL_45;
}
}
}
v15 = (_DWORD *)operator new(0x34u);
v15[2] = v33;
i = v15;
v15 += 4;
*(v15 - 1) = v34;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v15, (const cocos2d::CCPoint *)v35);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(i + 6), (const cocos2d::CCPoint *)v36);
i[8] = v37;
i[9] = v38;
i[10] = v39;
i[11] = v40;
v16 = v41;
i[1] = v9;
i[12] = v16;
*i = 0;
v17 = *((float *)this + 149);
v18 = (float)(unsigned int)(*((_DWORD *)this + 148) + 1);
if ( v18 > (float)((float)v8 * v17) )
{
v19 = v8 > 2 && ((v8 - 1) & v8) == 0;
}
else
{
if ( v8 )
goto LABEL_37;
v19 = 0;
}
prime = 2 * v8 + !v19;
v21 = (unsigned int)ceilf(v18 / v17);
if ( prime < v21 )
prime = v21;
if ( prime == 1 )
{
prime = 2;
}
else if ( ((prime - 1) & prime) != 0 )
{
prime = std::__next_prime(prime);
}
v22 = *((_DWORD *)this + 146);
if ( prime <= v22 )
{
if ( prime >= v22 )
goto LABEL_26;
v25 = *((_DWORD *)this + 148);
v26 = *((float *)this + 149);
if ( v22 <= 2 || ((v22 - 1) & v22) != 0 )
{
v32 = ceilf((float)v25 / v26);
v27 = std::__next_prime((unsigned int)v32);
}
else
{
v27 = 1 << (32 - __clz((unsigned int)ceilf((float)v25 / v26) - 1));
}
v24 = v27;
if ( v27 < prime )
v24 = prime;
if ( v24 >= v22 )
goto LABEL_26;
v23 = (int)v4;
}
else
{
v23 = (int)v4;
v24 = prime;
}
std::__hash_table,std::__unordered_map_hasher,std::hash,true>,std::__unordered_map_equal,std::equal_to,true>,std::allocator>>::__rehash(
v23,
v24);
LABEL_26:
v8 = *((_DWORD *)this + 146);
if ( ((v8 - 1) & v8) != 0 )
v2 = v9 % v8;
else
v2 = (v8 - 1) & v9;
LABEL_37:
v28 = *(_DWORD **)(*((_DWORD *)this + 145) + 4 * v2);
if ( v28 )
{
*i = *v28;
*v28 = i;
}
else
{
*i = *((_DWORD *)this + 147);
v29 = *((_DWORD *)this + 145);
*((_DWORD *)this + 147) = i;
*(_DWORD *)(v29 + 4 * v2) = (char *)this + 588;
if ( *i )
{
v30 = *(_DWORD *)(*i + 4);
if ( ((v8 - 1) & v8) != 0 )
v31 = v30 % v8;
else
v31 = (v8 - 1) & v30;
*(_DWORD *)(*((_DWORD *)this + 145) + 4 * v31) = i;
}
}
++*((_DWORD *)this + 148);
LABEL_45:
result = i + 3;
i[3] = a2;
LABEL_46:
result[7] = *((_DWORD *)this + 120);
return result;
}