//
// GJBaseGameLayer::removeObjectFromSection from 0x592f60 to 0x5930d0 (368 bytes)
//
// 10 xrefs:
// > PlayLayer::removeCheckpoint @ 0x401eea
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x46217a
// > LevelEditorLayer::removePlayerCollisionBlock @ 0x46218a
// > LevelEditorLayer::removeObject @ 0x46440e
// > LevelEditorLayer::handleAction @ 0x46ef7e
// > LevelEditorLayer::handleAction @ 0x46efd8
// > GJBaseGameLayer::reorderObjectSection @ 0x5930d6
// > GJBaseGameLayer::updateExtendedCollision @ 0x593758
// > GJBaseGameLayer::addUIObject @ 0x5aadde
// > SetupObjectOptionsPopup::onDisableObject @ 0x639898
//
// 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:07 +0000
//
_DWORD *__fastcall GJBaseGameLayer::removeObjectFromSection(_DWORD *this, GameObject *a2)
{
int v2; // r3
int v3; // r4
int v4; // r7
int v5; // r5
int *v6; // r2
int v7; // r6
int v8; // r3
int v9; // r5
int v10; // r4
int v11; // r3
int v12; // r3
_DWORD *v13; // r2
int v14; // r3
int v15; // r2
int v16; // r4
int v17; // r0
_DWORD *v18; // r2
_DWORD *v19; // r6
int v20; // r3
int v21; // r5
int v22; // r4
int v23; // r3
int v24; // r3
int v25; // r4
int v26; // r6
int *v27; // r2
int v28; // r7
int v29; // r3
unsigned int v30; // r2
int v31; // r3
int v32; // r1
v2 = *((_DWORD *)a2 + 132);
if ( v2 >= 0 )
{
v3 = *((_DWORD *)a2 + 133);
v4 = *((_DWORD *)a2 + 130);
v5 = **(_DWORD **)(*(this + 2844) + 4 * v2);
v6 = *(int **)(**(_DWORD **)(*(this + 2823) + 4 * v2) + 4 * v3);
v7 = *v6;
v8 = *(_DWORD *)(v5 + 4 * v3) - 1;
*(_DWORD *)(v5 + 4 * v3) = v8;
*(_DWORD *)(v7 + 4 * v4) = *(_DWORD *)(*v6 + 4 * v8);
*(_DWORD *)(*(_DWORD *)(*v6 + 4 * *((_DWORD *)a2 + 130)) + 520) = *((_DWORD *)a2 + 130);
if ( *((_DWORD *)a2 + 223) == 1816 )
{
v9 = *((_DWORD *)a2 + 131);
if ( *((_BYTE *)a2 + 536) )
{
v10 = *(this + 2836);
v11 = *(this + 2839) - 1;
*(this + 2839) = v11;
*(_DWORD *)(v10 + 4 * v9) = *(_DWORD *)(v10 + 4 * v11);
v12 = *((_DWORD *)a2 + 131);
v13 = (_DWORD *)*(this + 2836);
LABEL_10:
*(_DWORD *)(v13[v12] + 524) = v12;
return this;
}
v14 = *((_DWORD *)a2 + 132);
v15 = *(this + 2829);
v16 = *((_DWORD *)a2 + 133);
v17 = **(_DWORD **)(*(this + 2850) + 4 * v14);
v18 = *(_DWORD **)(**(_DWORD **)(v15 + 4 * v14) + 4 * v16);
v19 = (_DWORD *)*v18;
v20 = *(_DWORD *)(v17 + 4 * v16) - 1;
*(_DWORD *)(v17 + 4 * v16) = v20;
this = (_DWORD *)*v18;
v19[v9] = *(_DWORD *)(*v18 + 4 * v20);
LABEL_9:
v12 = *((_DWORD *)a2 + 131);
v13 = (_DWORD *)*v18;
goto LABEL_10;
}
if ( *((_DWORD *)a2 + 196) == 7 )
return this;
v21 = *((_DWORD *)a2 + 131);
if ( *((_BYTE *)a2 + 536) )
{
v18 = this + 2832;
v22 = *(this + 2832);
v23 = *(this + 2835) - 1;
*(this + 2835) = v23;
*(_DWORD *)(v22 + 4 * v21) = *(_DWORD *)(v22 + 4 * v23);
goto LABEL_9;
}
v24 = *((_DWORD *)a2 + 132);
v25 = *((_DWORD *)a2 + 133);
v26 = **(_DWORD **)(*(this + 2847) + 4 * v24);
v27 = *(int **)(**(_DWORD **)(*(this + 2826) + 4 * v24) + 4 * v25);
v28 = *v27;
v29 = *(_DWORD *)(v26 + 4 * v25) - 1;
*(_DWORD *)(v26 + 4 * v25) = v29;
*(_DWORD *)(v28 + 4 * v21) = *(_DWORD *)(*v27 + 4 * v29);
*(_DWORD *)(*(_DWORD *)(*v27 + 4 * *((_DWORD *)a2 + 131)) + 524) = *((_DWORD *)a2 + 131);
v30 = *((_DWORD *)a2 + 133);
v31 = *(this + 2853);
v32 = **(_DWORD **)(v31 + 4 * *((_DWORD *)a2 + 132));
*(_DWORD *)(v32 + 4 * (v30 >> 5)) |= 1 << (v30 & 0x1F);
return (_DWORD *)(v30 >> 5);
}
return this;
}