//
// sub_10053F330 from 0x10053f330 to 0x10053f45c (300 bytes)
//
// 3 xrefs:
// > sub_10052259C @ 0x100522804
// > sub_10052EC84 @ 0x10052efe4
// > sub_10052EC84 @ 0x10052f0f4
//
// 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_10053F330(__int64 a1, __int64 a2, __int64 a3, int (*a4)(void))
{
_QWORD *v8; // x26
int v9; // w25
int v10; // w0
int v11; // w8
__int64 v12; // x24
__int64 v13; // x22
_QWORD *v14; // x0
v8 = *(_QWORD **)(a1 + 256);
v9 = *(_DWORD *)(a1 + 676);
sub_1005312E0(a1);
if ( !a2 )
return 0;
if ( !a4 )
a4 = *(int (**)(void))(*(_QWORD *)(a1 + 8) + 152LL);
v10 = sub_1005DEA4C(a2);
v11 = a3;
if ( v10 >= 1 )
{
v12 = 0;
v13 = a3;
do
{
v14 = (_QWORD *)sub_1005DEA60(a2, v12);
if ( (v8[6] & v14[7]) == 0 && (v8[2] & v14[3]) == 0 && (v8[3] & v14[4]) == 0 )
v13 += a4();
v12 = (unsigned int)(v12 + 1);
}
while ( (int)v12 < (int)sub_1005DEA4C(a2) );
v11 = a3;
if ( v13 != a3 )
{
if ( !v9 )
v13 += ((int (__fastcall *)(void *, __int64))a4)(&unk_10085BA60, v13);
if ( (*(_BYTE *)(a1 + 432) & 0x80) != 0 )
v11 = v13 + ((__int64 (__fastcall *)(void *, __int64))a4)(&unk_10085BAB8, v13);
else
v11 = v13;
}
}
return (unsigned int)(v11 - a3);
}