//
// GJBaseGameLayer::findStartPosWinnerInArray from 0x58ebe4 to 0x58ec6a (134 bytes)
//
// 2 xrefs:
// > LevelEditorLayer::findStartPosObject @ 0x4622c2
// > rankStartPosObjectsByRepeatedWinner @ 0x58ec88
//
// 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:04 +0000
//
_DWORD *__fastcall GJBaseGameLayer::findStartPosWinnerInArray(int a1)
{
_DWORD *v1; // r3
_DWORD *v2; // r4
_DWORD *v3; // r7
char *v4; // r3
float v5; // s16
int v6; // r6
_DWORD *v7; // r8
_DWORD *v8; // r5
_DWORD *v9; // t1
float *v10; // r0
int v11; // r1
int v12; // r2
float v13; // s15
if ( !a1 )
return nullptr;
v1 = *(_DWORD **)(a1 + 52);
v2 = (_DWORD *)*v1;
if ( *v1 )
{
v3 = (_DWORD *)v1[3];
v4 = (char *)v2 + 0x3FFFFFFF;
v5 = 0.0;
v6 = -1;
v2 = nullptr;
v7 = &v3[(_DWORD)v4];
while ( 1 )
{
if ( v3 > v7 )
return v2;
v9 = (_DWORD *)*v3++;
v8 = v9;
if ( !v9 )
return v2;
v10 = (float *)(*(int (__fastcall **)(_DWORD *))(*v8 + 96))(v8);
v11 = v8[412];
v12 = *(_DWORD *)(v11 + 312);
v13 = *v10;
if ( v12 > v6 )
{
LABEL_15:
v6 = *(_DWORD *)(v11 + 312);
v5 = *v10;
v2 = v8;
}
else if ( *(_BYTE *)(v11 + 310) )
{
if ( v12 >= v6 && v13 < v5 )
goto LABEL_15;
}
else if ( v12 >= v6 && v13 > v5 )
{
goto LABEL_15;
}
}
}
return v2;
}