//
// sub_18007E350 from 0x18007e350 to 0x18007e462 (274 bytes)
//
// 2 xrefs:
// > sub_1800E3BA0 @ 0x1800e3c21
// > ??> @ 0x1801b4ed8
//
// 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
//
// Hidden C++ exception states: #wind=1
WCHAR *__fastcall sub_18007E350(__int64 a1, __int64 a2)
{
__int64 v3; // rbp
WCHAR *v4; // rax
WCHAR *lpWideCharStr; // rdi
const CHAR *v6; // r8
unsigned __int64 v7; // rdx
_QWORD *v8; // rcx
v3 = *(int *)(a2 + 16);
v4 = (WCHAR *)operator new(saturated_mul(v3 + 1, 2u));
lpWideCharStr = v4;
if ( v4 )
{
memset(v4, 0, v3 + 1);
v6 = (const CHAR *)a2;
if ( *(_QWORD *)(a2 + 24) > 0xFu )
v6 = *(const CHAR **)a2;
lpWideCharStr[MultiByteToWideChar(0xFDE9u, 0, v6, v3, lpWideCharStr, v3 + 1)] = 0;
}
v7 = *(_QWORD *)(a2 + 24);
if ( v7 > 0xF )
{
v8 = *(_QWORD **)a2;
if ( v7 + 1 >= 0x1000 )
{
if ( (unsigned __int64)v8 - *(v8 - 1) - 8 > 0x1F )
invalid_parameter_noinfo_noreturn();
v8 = (_QWORD *)*(v8 - 1);
}
j_j_free_0(v8);
}
*(_QWORD *)(a2 + 16) = 0;
*(_QWORD *)(a2 + 24) = 15;
*(_BYTE *)a2 = 0;
return lpWideCharStr;
}