//
// sub_CF2F8C from 0xcf2f8c to 0xcf3034 (168 bytes)
//
// 8 xrefs:
// > sub_CF3EAC @ 0xcf3f24
// > sub_CF3EAC @ 0xcf3f6c
// > sub_CF4C2C @ 0xcf4ca4
// > sub_CF4C2C @ 0xcf4cec
// > sub_CF5504 @ 0xcf557c
// > sub_CF5504 @ 0xcf55c4
// > sub_CF5F4C @ 0xcf5fc4
// > sub_CF5F4C @ 0xcf600c
//
// 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
//
void *__fastcall sub_CF2F8C(_BYTE *a1, __int64 a2, __int64 a3)
{
size_t v3; // x20
__int64 v5; // x0
__int64 v6; // x19
void *v7; // x3
v3 = a2 - (_QWORD)a1;
v5 = sub_D17420(a2 - (_QWORD)a1, 0, a3);
v6 = v5;
v7 = (void *)(v5 + 24);
if ( v3 == 1 )
{
*(_BYTE *)(v5 + 24) = *a1;
if ( (__int64 *)v5 == &qword_124B6B0 )
return v7;
}
else
{
v7 = memcpy((void *)(v5 + 24), a1, v3);
if ( (__int64 *)v6 == &qword_124B6B0 )
return v7;
}
*(_DWORD *)(v6 + 16) = 0;
*(_QWORD *)v6 = v3;
*(_BYTE *)(v6 + v3 + 24) = 0;
return v7;
}