//
// _mbsdec_l from 0x180140b80 to 0x180140c14 (148 bytes)
//
// 2 xrefs:
// > _mbsdec @ 0x180140b7b
// > ??> @ 0x180203c44
//
// 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
//
unsigned __int8 *__cdecl mbsdec_l(const unsigned __int8 *Start, const unsigned __int8 *Pos, _locale_t Locale)
{
unsigned __int8 *v6; // rdx
__int64 v7; // [rsp+20h] [rbp-28h] BYREF
__int64 v8; // [rsp+30h] [rbp-18h]
char v9; // [rsp+38h] [rbp-10h]
if ( !Start || !Pos )
{
*errno() = 22;
invalid_parameter_noinfo();
return nullptr;
}
if ( Start >= Pos )
return nullptr;
_LocaleUpdate::_LocaleUpdate((_LocaleUpdate *)&v7, Locale);
v6 = (unsigned __int8 *)(Pos - 1);
if ( *(_DWORD *)(v8 + 8) )
{
do
--v6;
while ( Start <= v6 && (*(_BYTE *)(*v6 + v8 + 25) & 4) != 0 );
v6 = (unsigned __int8 *)&Pos[-(((_BYTE)Pos - (_BYTE)v6) & 1) - 1];
}
if ( v9 )
*(_DWORD *)(v7 + 936) &= ~2u;
return v6;
}