//
// sub_10063695C from 0x10063695c to 0x100636a90 (308 bytes)
//
// 2 xrefs:
// > sub_100635F68 @ 0x100635f88
// > sub_100635FD8 @ 0x100636024
//
// 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:10:31 +0000
//
__int64 __fastcall sub_10063695C(__int64 a1, __int64 a2)
{
int v2; // w8
__int64 result; // x0
int v5; // w21
__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 >= (int)a2 || *(_DWORD *)(a1 + 24) != v2 || *(_DWORD *)(a1 + 32) != -1 )
return 28;
v5 = a2;
v6 = (__int64 *)(a1 + 16);
v7 = *(_DWORD *)(a1 + 28);
if ( v7 < 0 )
v7 = -v7;
if ( v7 >= (int)a2 || (result = sub_100636A90(a1 + 16, a2), !(_DWORD)result) )
{
v8 = *(_DWORD *)(a1 + 12);
if ( v8 < 0 )
v8 = -v8;
if ( v8 >= v5 || (result = sub_10054DE1C((_QWORD *)a1, v5), !(_DWORD)result) )
{
*(_DWORD *)(a1 + 8) = v5;
if ( v5 >= 1 )
memset(*(void **)a1, 255, 4LL * (unsigned int)v5);
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;
}