//
// sub_100575D28 from 0x100575d28 to 0x100575e5c (308 bytes)
//
// 1 xrefs:
// > sub_100574E5C @ 0x100574ea8
//
// 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:20 +0000
//
__int64 __fastcall sub_100575D28(__int64 a1, int a2)
{
int v2; // w8
__int64 result; // x0
__int64 *v6; // x20
int v7; // w8
int v8; // w8
__int64 v9; // x8
__int64 v10; // x9
__int64 v11; // x10
int v12; // w12
int *v13; // x12
int v14; // w13
__int64 v15; // x12
int v16; // t1
v2 = *(_DWORD *)(a1 + 8);
if ( v2 >= a2 || *(_DWORD *)(a1 + 24) != v2 || *(_DWORD *)(a1 + 32) != -1 )
return 28;
v6 = (__int64 *)(a1 + 16);
v7 = *(_DWORD *)(a1 + 28);
if ( v7 < 0 )
v7 = -v7;
if ( v7 >= a2 || (result = sub_100575C34((_QWORD *)(a1 + 16), a2), !(_DWORD)result) )
{
v8 = *(_DWORD *)(a1 + 12);
if ( v8 < 0 )
v8 = -v8;
if ( v8 >= a2 || (result = sub_10054DE1C((_QWORD *)a1, a2), !(_DWORD)result) )
{
*(_DWORD *)(a1 + 8) = a2;
if ( a2 >= 1 )
memset(*(void **)a1, 255, 4LL * (unsigned int)a2);
v9 = *(unsigned int *)(a1 + 24);
if ( (int)v9 < 1 )
return 0;
v10 = 0;
v11 = *v6;
while ( 1 )
{
v12 = *(_DWORD *)(a1 + 8);
if ( !v12 )
break;
v13 = (int *)(*(_QWORD *)a1 + 4LL * (*(_DWORD *)(v11 + 16 * v10) & (v12 - 1)));
v14 = *v13;
if ( *v13 != -1 )
{
do
{
v15 = v11 + 16LL * v14;
v16 = *(_DWORD *)(v15 + 4);
v13 = (int *)(v15 + 4);
v14 = v16;
}
while ( v16 != -1 );
}
result = 0;
*v13 = v10;
*(_DWORD *)(v11 + 16 * v10++ + 4) = -1;
if ( v10 == v9 )
return result;
}
return 28;
}
}
return result;
}