//
// sub_100427E9C from 0x100427e9c to 0x100427fd0 (308 bytes)
//
// 1 xrefs:
// > sub_100427620 @ 0x100427678
//
// 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_100427E9C(__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; // w13
_DWORD *v13; // x12
int *v14; // x13
int v15; // w14
__int64 v16; // x13
int v17; // 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_100427BA8((__int64 *)(a1 + 16), a2), !(_DWORD)result) )
{
v8 = *(_DWORD *)(a1 + 12);
if ( v8 < 0 )
v8 = -v8;
if ( v8 >= a2 || (result = sub_100427CB4((_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 = (_DWORD *)(v11 + 16 * v10);
v14 = (int *)(*(_QWORD *)a1 + 4LL * ((v12 - 1) & (v13[1] ^ *v13)));
v15 = *v14;
if ( *v14 != -1 )
{
do
{
v16 = v11 + 16LL * v15;
v17 = *(_DWORD *)(v16 + 8);
v14 = (int *)(v16 + 8);
v15 = v17;
}
while ( v17 != -1 );
}
result = 0;
*v14 = v10;
v13[2] = -1;
if ( ++v10 == v9 )
return result;
}
return 28;
}
}
return result;
}