//
// sub_D1D2E0 from 0xd1d2e0 to 0xd1d3a0 (192 bytes)
//
// 6 xrefs:
// > sub_D004F0 @ 0xd00998
// > sub_D00C0C @ 0xd010b4
// > sub_D1D3A0 @ 0xd1d3a0
// > sub_D1DE40 @ 0xd1dea0
// > sub_D1DEE0 @ 0xd1df34
// > sub_D1DF74 @ 0xd1dfb4
//
// 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
//
const wchar_t **__fastcall sub_D1D2E0(const wchar_t **a1, const wchar_t **a2)
{
const wchar_t *v3; // x1
size_t v5; // x20
const wchar_t *v6; // x3
__int64 v7; // x2
size_t v8; // x22
v3 = *a2;
v5 = *((_QWORD *)v3 - 3);
if ( v5 )
{
v6 = *a1;
v7 = *((_QWORD *)*a1 - 3);
v8 = v7 + v5;
if ( v7 + v5 > *((_QWORD *)*a1 - 2) || *(v6 - 2) > 0 )
{
sub_D1D184(a1, v7 + v5);
v6 = *a1;
v3 = *a2;
v7 = *((_QWORD *)*a1 - 3);
}
if ( v5 == 1 )
{
v6[v7] = *v3;
}
else
{
wmemcpy((wchar_t *)&v6[v7], v3, v5);
v6 = *a1;
}
if ( v6 - 6 != (const wchar_t *)&qword_124B6D0 )
{
*((_DWORD *)v6 - 2) = 0;
*((_QWORD *)v6 - 3) = v8;
v6[v8] = 0;
}
}
return a1;
}