//
// sub_1005806F0 from 0x1005806f0 to 0x100580838 (328 bytes)
//
// 3 xrefs:
// > sub_100568F94 @ 0x100569074
// > sub_1005694F8 @ 0x100569530
// > sub_1005808B8 @ 0x10058093c
//
// 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 11:08:29 +0000
//
__int64 __fastcall sub_1005806F0(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // x0
__int64 v7; // x20
float v8; // s0
__int64 v9; // x8
int v10; // w8
unsigned __int64 v11; // x9
unsigned __int8 *v12; // x10
__int64 v13; // x12
unsigned __int64 v14; // x11
int v15; // t1
__int64 v16; // [xsp+0h] [xbp-30h] BYREF
int v17; // [xsp+Ch] [xbp-24h] BYREF
result = sub_10062E858(a1, a2, a3, 0);
if ( !(_DWORD)result )
{
if ( (*(_BYTE *)(a1 + 512) & 0x10) == 0 || (result = sub_10062D634(a1, a2, a3), !(_DWORD)result) )
{
result = (*(__int64 (__fastcall **)(__int64, int *))(*(_QWORD *)a1 + 296LL))(a1, &v17);
if ( !(_DWORD)result )
{
if ( v17 < 1 )
{
LABEL_15:
v10 = *(_DWORD *)(a1 + 72);
if ( (v10 & 4) != 0 )
goto LABEL_22;
v11 = *(unsigned int *)(*(_QWORD *)(a1 + 8) + 69104LL);
if ( (int)v11 < 1 )
return 0;
if ( *(_BYTE *)(*(_QWORD *)(a1 + 8) + 68316LL) )
goto LABEL_22;
v12 = (unsigned __int8 *)(*(_QWORD *)(a1 + 8) + 68428LL);
v13 = 1;
do
{
v14 = v13;
if ( v11 == v13 )
break;
v15 = *v12;
v12 += 112;
++v13;
}
while ( !v15 );
if ( v14 < v11 )
{
LABEL_22:
*(_DWORD *)(a1 + 72) = v10 & 0xFFFFFFFB;
return 0;
}
else
{
return 0;
}
}
else
{
v7 = 0;
while ( 1 )
{
result = (*(__int64 (__fastcall **)(__int64, __int64, __int64 *))(*(_QWORD *)a1 + 288LL))(a1, v7, &v16);
if ( (_DWORD)result )
break;
if ( v16 && *(_DWORD *)(v16 + 256) == 35 )
{
v9 = *(_QWORD *)(a1 + 32);
if ( v9 )
v8 = *(float *)(v9 + 488);
else
v8 = 1.0;
sub_1005CDB48(v16, 8, v8);
}
v7 = (unsigned int)(v7 + 1);
if ( (int)v7 >= v17 )
goto LABEL_15;
}
}
}
}
}
return result;
}