//
// fmt::internal::UTF16ToUTF8::UTF16ToUTF8 from 0x1800409d0 to 0x180040a87 (183 bytes)
//
// 2 xrefs:
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b13b0
//
// 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
__int64 __fastcall fmt::internal::UTF16ToUTF8::UTF16ToUTF8(__int64 a1, LPCWCH *a2)
{
const WCHAR *v3; // rsi
int v4; // eax
int cbMultiByte; // edi
*(_QWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 500;
*(_QWORD *)(a1 + 16) = a1 + 24;
v3 = *a2;
v4 = WideCharToMultiByte(0xFDE9u, 0, *a2, -1, nullptr, 0, nullptr, nullptr);
cbMultiByte = v4;
if ( !v4
|| (sub_1800447F0(a1, v4),
!WideCharToMultiByte(0xFDE9u, 0, v3, -1, *(LPSTR *)(a1 + 16), cbMultiByte, nullptr, nullptr)) )
{
GetLastError();
}
return a1;
}