//
// sub_10045A588 from 0x10045a588 to 0x10045a6d0 (328 bytes)
//
// 3 xrefs:
// > sub_100442E2C @ 0x100442f0c
// > sub_100443390 @ 0x1004433c8
// > sub_10045A750 @ 0x10045a7d4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall sub_10045A588(__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_1005086F0(a1, a2, a3, 0);
if ( !(_DWORD)result )
{
if ( (*(_BYTE *)(a1 + 512) & 0x10) == 0 || (result = sub_1005074CC(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_1004A79E0(v16, 8, v8);
}
v7 = (unsigned int)(v7 + 1);
if ( (int)v7 >= v17 )
goto LABEL_15;
}
}
}
}
}
return result;
}