//
// __acrt_WideCharToMultiByte from 0x180137058 to 0x180137105 (173 bytes)
//
// 19 xrefs:
// > _wcstombs_l_helper @ 0x18012b5f6
// > _wcstombs_l_helper @ 0x18012b63d
// > _wcstombs_l_helper @ 0x18012b6b3
// > _wcstombs_l_helper @ 0x18012b794
// > initialize_environment_by_cloning_nolock @ 0x180132200
// > initialize_environment_by_cloning_nolock @ 0x180132241
// > __acrt_wcs_to_mbs_cp<__crt_win32_buffer_no_resizing> @ 0x180134a9c
// > __acrt_wcs_to_mbs_cp<__crt_win32_buffer_no_resizing> @ 0x180134af3
// > _wctomb_s_l @ 0x18013756a
// > __acrt_wcs_to_mbs_cp<__crt_win32_buffer_internal_dynamic_resizing> @ 0x180139977
// > __acrt_wcs_to_mbs_cp<__crt_win32_buffer_internal_dynamic_resizing> @ 0x180139a0a
// > __dcrt_get_narrow_environment_from_os @ 0x18013ac7f
// > __dcrt_get_narrow_environment_from_os @ 0x18013acb8
// > tzset_env_copy_to_tzname @ 0x18013cd00
// > tzset_os_copy_to_tzname @ 0x18013d2a8
// > write_double_translated_ansi_nolock @ 0x18013fce6
// > write_text_utf8_nolock @ 0x1801401d5
// > __acrt_LCMapStringA_stat @ 0x180140eab
// > ??> @ 0x1802035a8
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 10:55:00 +0000
//
int __fastcall _acrt_WideCharToMultiByte(
UINT a1,
int a2,
const WCHAR *a3,
int a4,
CHAR *a5,
int a6,
const CHAR *a7,
BOOL *a8)
{
int v10; // r8d
bool v11; // zf
DWORD v12; // edx
BOOL *v14; // r8
if ( a1 <= 0xC435 )
{
if ( a1 - 50220 <= 9 )
{
v10 = 679;
if ( _bittest(&v10, a1 - 50220) )
goto LABEL_12;
}
v11 = a1 == 42;
goto LABEL_10;
}
if ( a1 == 54936 )
goto LABEL_12;
if ( a1 > 0xDEA9 )
{
if ( a1 <= 0xDEB3 || a1 == 65000 )
goto LABEL_12;
v11 = a1 == 65001;
LABEL_10:
if ( !v11 )
goto LABEL_11;
LABEL_12:
v12 = 0;
goto LABEL_13;
}
LABEL_11:
v12 = a2 & 0xFFFFFF7F;
LABEL_13:
v14 = a8;
if ( a1 - 65000 <= 1 )
{
v14 = nullptr;
a7 = nullptr;
if ( a8 )
*a8 = 0;
}
return WideCharToMultiByte(a1, v12, a3, a4, a5, a6, a7, v14);
}