//
// sub_10064F638 from 0x10064f638 to 0x10064f7d0 (408 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009e3770
//
// 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:49 +0000
//
__int64 __fastcall sub_10064F638(_QWORD *a1, int a2)
{
_QWORD *v4; // x22
__int64 v5; // x19
__int64 v6; // x0
unsigned __int64 v7; // x24
__int64 v8; // x0
__int64 v9; // x23
int v10; // w25
__int64 result; // x0
__int64 v12; // x0
__int64 v13; // x3
if ( a2 )
{
v4 = (_QWORD *)a1[29];
v5 = a1[16] + 344LL;
if ( !v4 )
goto LABEL_6;
}
else
{
v4 = (_QWORD *)a1[26];
v5 = a1[16] + 288LL;
if ( !v4 )
{
LABEL_6:
v4 = nullptr;
v6 = 0;
goto LABEL_7;
}
}
v6 = sub_1007113D8(v4);
LABEL_7:
if ( !v6 || !v4 || !a1[38] )
{
memmove(*(void **)(v5 + 16), *(const void **)(v5 + 24), *(unsigned int *)(v5 + 4));
*(_QWORD *)(v5 + 24) = *(_QWORD *)(v5 + 16);
return 1;
}
v7 = *(unsigned int *)(v5 + 4);
v8 = sub_1007113B4(*v4);
v9 = v8;
if ( a2 && (_DWORD)v8 != 1 )
{
v10 = v8 - (int)v7 % (int)v8;
v7 += v10;
bzero((void *)(*(_QWORD *)(v5 + 24) + *(unsigned int *)(v5 + 4)), v10);
*(_DWORD *)(v5 + 4) += v10;
*(_BYTE *)(v7 + *(_QWORD *)(v5 + 24) - 1) = v10 - 1;
}
if ( !a2 )
{
if ( !v7 )
return 0;
if ( v7 % (int)v9 )
return 0;
}
if ( (int)sub_1007113C8(v4, *(_QWORD *)(v5 + 16), *(_QWORD *)(v5 + 24), v7) < 1 )
return 0xFFFFFFFFLL;
if ( sub_100711450(a1[27]) )
{
v12 = sub_100711450(a1[27]);
v13 = sub_100711410(v12);
}
else
{
v13 = 0;
}
result = 1;
if ( !a2 && (_DWORD)v9 != 1 )
return sub_100653308(a1, v5, v9, v13);
return result;
}