//
// sub_D1CE6C from 0xd1ce6c to 0xd1cf48 (220 bytes)
//
// 0 xrefs:
//
// 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
//
wchar_t *__fastcall sub_D1CE6C(wchar_t *result, const wchar_t *a2, __int64 a3)
{
__int64 v3; // x20
const wchar_t *v5; // x1
_QWORD *v6; // x24
wchar_t *v7; // x0
wchar_t *v8; // x22
_QWORD *v9; // x21
v3 = 4 * a3;
v5 = &a2[a3];
v6 = result;
if ( a2 == v5 )
{
*(_QWORD *)result = &unk_124B6E8;
}
else
{
if ( v5 && !a2 )
sub_D138D8("basic_string::_S_construct null not valid");
v7 = (wchar_t *)sub_D1B424(v3 >> 2, 0);
v8 = v7;
v9 = v7 + 6;
if ( v3 >> 2 == 1 )
{
result = (wchar_t *)*(unsigned int *)a2;
v8[6] = (int)result;
}
else
{
result = wmemcpy(v7 + 6, a2, v3 >> 2);
}
if ( v8 != (wchar_t *)&qword_124B6D0 )
{
v8[4] = 0;
*(_QWORD *)v8 = v3 >> 2;
v8[(unsigned __int64)v3 / 4 + 6] = 0;
}
*v6 = v9;
}
return result;
}