//
// sub_1000F66F0 from 0x1000f66f0 to 0x1000f6796 (166 bytes)
//
// 5 xrefs:
// > sub_1000F5470 @ 0x1000f5a86
// > sub_1000F5470 @ 0x1000f6267
// > sub_1000F5470 @ 0x1000f62d7
// > sub_1000F78E0 @ 0x1000f83ee
// > sub_1000F78E0 @ 0x1000f8529
//
// 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_1000F66F0(__int64 a1, __int64 *a2, __int64 a3)
{
unsigned __int64 v3; // r14
__int64 result; // rax
__int64 v5; // r12
signed __int64 v6; // r13
char *v7; // rax
__int64 v8; // r14
__int64 v9; // [rsp+10h] [rbp-30h]
v3 = *(_QWORD *)(a1 + 8);
if ( v3 >= *(_QWORD *)(a1 + 16) )
{
result = sub_100109B30(a1);
v8 = result;
}
else
{
*(_OWORD *)v3 = 0;
*(_QWORD *)(v3 + 16) = 0;
result = *a2;
v5 = a2[1];
v9 = *a2;
v6 = v5 - *a2;
if ( v6 )
{
if ( v6 < 0 )
sub_100108EE0(a1, a2, a3);
v7 = (char *)operator new(v6);
*(_QWORD *)v3 = v7;
*(_QWORD *)(v3 + 8) = v7;
*(_QWORD *)(v3 + 16) = &v7[v6];
result = sub_100108FB0(v3, v9, v5, v7);
*(_QWORD *)(v3 + 8) = result;
}
v8 = v3 + 24;
*(_QWORD *)(a1 + 8) = v8;
}
*(_QWORD *)(a1 + 8) = v8;
return result;
}