//
// GJBaseGameLayer::findStartPosWinnerInArray from 0x99d89c to 0x99d9a0 (260 bytes)
//
// 3 xrefs:
// > LevelEditorLayer::findStartPosObject @ 0x78d278
// > rankStartPosObjectsByRepeatedWinner @ 0x99d9e8
// > ??> @ 0xb4ef8
//
// 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:58:05 +0000
//
_QWORD *__fastcall GJBaseGameLayer::findStartPosWinnerInArray(__int64 a1)
{
unsigned int *v1; // x1
_QWORD **v2; // x20
_QWORD *v3; // x19
_QWORD **v4; // x22
float v5; // s8
int v6; // w21
_QWORD *v7; // x23
float *v8; // x0
__int64 v9; // x1
float v10; // s0
int v11; // w0
unsigned int v12; // w1
if ( !a1 )
return nullptr;
v1 = *(unsigned int **)(a1 + 56);
if ( !*v1 )
return nullptr;
v2 = *((_QWORD ***)v1 + 2);
v3 = nullptr;
v4 = &v2[*v1 - 1];
if ( v2 <= v4 )
{
v3 = *v2;
if ( *v2 )
{
v5 = 0.0;
v6 = -1;
v7 = nullptr;
while ( 1 )
{
v8 = (float *)(*(__int64 (__fastcall **)(_QWORD *))(*v3 + 192LL))(v3);
v9 = v3[230];
v10 = *v8;
v11 = *(_DWORD *)(v9 + 372);
v12 = *(unsigned __int8 *)(v9 + 370);
if ( v11 <= v6 && (v12 >= (v6 <= v11) || v5 >= v10) && (((unsigned __int8)v12 & (v5 > v10)) == 0 || v6 > v11) )
{
v10 = v5;
v3 = v7;
v11 = v6;
}
++v2;
v7 = v3;
v6 = v11;
v5 = v10;
if ( v4 < v2 || !*v2 )
break;
v3 = *v2;
}
}
}
return v3;
}