//
// sub_10064EC40 from 0x10064ec40 to 0x10064ee0d (461 bytes)
//
// 1 xrefs:
// > sub_10064CF70 @ 0x10064d0a1
//
// 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_10064EC40(__int64 a1)
{
__int64 v2; // rdi
int v3; // eax
_QWORD *v4; // r14
__int64 v5; // rax
__int64 v6; // rsi
_QWORD *v7; // r15
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // r14
_QWORD *v12; // rax
unsigned int v13; // eax
int v14; // ecx
_QWORD *v15; // rax
_QWORD *v16; // rax
_QWORD *v17; // rax
v2 = a1 + 8;
v3 = *(_DWORD *)(a1 + 40);
if ( v3 == 17 )
{
sub_10064C690(v2);
v7 = *(_QWORD **)a1;
v8 = *(_QWORD *)(*(_QWORD *)a1 + 8LL);
v9 = v8 + 40;
if ( (unsigned __int64)(v8 + 40) > 0x1000 )
{
v15 = (_QWORD *)off_10099E670();
if ( !v15 )
goto LABEL_22;
*v15 = *v7;
*v7 = v15;
v7[1] = 40;
v10 = (__int64)(v15 + 1);
v7 = *(_QWORD **)a1;
v9 = *(_QWORD *)(*(_QWORD *)a1 + 8LL);
}
else
{
v10 = *v7 + v8 + 8;
v7[1] = v9;
}
*(_DWORD *)v10 = 314;
*(_OWORD *)(v10 + 8) = 0;
*(_QWORD *)(v10 + 24) = 0;
if ( (unsigned __int64)(v9 + 40) > 0x1000 )
{
v16 = (_QWORD *)off_10099E670();
if ( !v16 )
goto LABEL_22;
*v16 = *v7;
*v7 = v16;
v7[1] = 40;
v6 = (__int64)(v16 + 1);
}
else
{
v6 = *v7 + v9 + 8;
v7[1] = v9 + 40;
}
*(_DWORD *)v6 = 33882425;
*(_QWORD *)(v6 + 8) = v10;
*(_OWORD *)(v6 + 16) = 0;
*(_QWORD *)(v6 + 32) = 0;
return sub_10064EF90(a1, v6);
}
if ( v3 != 16 )
return sub_10064EF90(a1, 0);
sub_10064C690(v2);
v4 = *(_QWORD **)a1;
v5 = *(_QWORD *)(*(_QWORD *)a1 + 8LL);
if ( (unsigned __int64)(v5 + 40) > 0x1000 )
{
v12 = (_QWORD *)off_10099E670();
if ( v12 )
{
*v12 = *v4;
*v4 = v12;
v4[1] = 40;
v6 = (__int64)(v12 + 1);
goto LABEL_10;
}
LABEL_22:
v17 = *(_QWORD **)(a1 + 64);
*v17 = "Out of memory";
v17[1] = *(_QWORD *)(a1 + 16) - *(_QWORD *)(a1 + 48);
longjmp((int *)(a1 + 104), 1);
}
v6 = *v4 + v5 + 8;
v4[1] = v5 + 40;
LABEL_10:
*(_DWORD *)v6 = 314;
*(_OWORD *)(v6 + 8) = 0;
*(_QWORD *)(v6 + 24) = 0;
v13 = *(_DWORD *)(a1 + 40);
if ( v13 > 0x18 )
return v6;
v14 = 30409216;
if ( !_bittest(&v14, v13) )
return v6;
return sub_10064EF90(a1, v6);
}