//
// sub_1002FC570 from 0x1002fc570 to 0x1002fc648 (216 bytes)
//
// 2 xrefs:
// > sub_1002FC2D0 @ 0x1002fc4d7
// > sub_1002FC2D0 @ 0x1002fc4f7
//
// 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_1002FC570(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v4; // rbx
__int64 v5; // r15
__int64 v6; // rbx
const void *v7; // r12
signed __int64 v8; // r13
char *v9; // rax
char *v10; // r14
v4 = a4;
if ( a2 != a3 )
{
v5 = a2;
v6 = a4 + 48;
do
{
*(_DWORD *)(v6 - 32) = *(_DWORD *)(v5 + 16);
*(_OWORD *)(v6 - 48) = *(_OWORD *)v5;
*(_OWORD *)(v6 - 24) = 0;
*(_QWORD *)(v6 - 8) = 0;
v7 = *(const void **)(v5 + 24);
v8 = *(_QWORD *)(v5 + 32) - (_QWORD)v7;
if ( v8 )
{
if ( v8 < 0 )
sub_1000C40D0();
v9 = (char *)operator new(v8);
*(_QWORD *)(v6 - 24) = v9;
*(_QWORD *)(v6 - 16) = v9;
v10 = &v9[v8];
*(_QWORD *)(v6 - 8) = &v9[v8];
memcpy(v9, v7, v8);
*(_QWORD *)(v6 - 16) = v10;
}
v5 += 48;
v6 += 48;
}
while ( v5 != a3 );
return v6 - 48;
}
return v4;
}