// // __crt_mbstring::__mbrtoc32_utf8 from 0x180141250 to 0x180141425 (469 bytes) // // 4 xrefs: // > __crt_mbstring::__mbrtowc_utf8 @ 0x18013da7e // > __crt_mbstring::__mbsrtowcs_utf8 @ 0x18013db1f // > __crt_mbstring::__mbsrtowcs_utf8 @ 0x18013dc01 // > @ 0x180203c98 // // 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 __int64 __fastcall __crt_mbstring::__mbrtoc32_utf8( unsigned __int64 this, char32_t *a2, const char *a3, void *a4) { __int64 v4; // r10 void *v5; // r11 const char *v6; // rdi unsigned __int64 v8; // r14 _DWORD *v9; // rsi int v11; // r9d unsigned __int8 v12; // r8 unsigned __int8 v13; // bl unsigned int v14; // edx unsigned __int64 v15; // r9 char v16; // cl _DWORD v17[6]; // [rsp+18h] [rbp-50h] v4 = 0; v5 = &unk_1801F5730; v6 = &byte_18014572F; if ( a4 ) v5 = a4; if ( a2 ) v6 = (const char *)a2; v8 = 1; if ( a2 ) v8 = (unsigned __int64)a3; v9 = (_DWORD *)(this & -(__int64)(a2 != nullptr)); if ( !v8 ) return -2; if ( !*((_WORD *)v5 + 3) ) { v11 = *(unsigned __int8 *)v6++; if ( (v11 & 0x80u) == 0 ) { if ( v9 ) *v9 = v11; LOBYTE(v4) = (_BYTE)v11 != 0; return v4; } if ( (v11 & 0xE0) == 0xC0 ) { v12 = 2; LABEL_20: v13 = v12; v14 = v11 & ((1 << (7 - v12)) - 1); goto LABEL_24; } if ( (v11 & 0xF0) == 0xE0 ) { v12 = 3; goto LABEL_20; } if ( (v11 & 0xF8) == 0xF0 ) { v12 = 4; goto LABEL_20; } LABEL_38: *(_QWORD *)v5 = 0; *errno() = 42; return -1; } v12 = *((_BYTE *)v5 + 4); v14 = *(_DWORD *)v5; v13 = *((_BYTE *)v5 + 6); if ( (unsigned __int8)(v12 - 2) > 2u || !v13 || v13 >= v12 ) goto LABEL_38; LABEL_24: v15 = v13; if ( v13 >= v8 ) v15 = v8; while ( v6 - (const char *)a2 < v15 ) { v16 = *v6++; if ( (v16 & 0xC0) != 0x80 ) goto LABEL_38; v14 = (v14 << 6) | v16 & 0x3F; } if ( v15 < v13 ) { *((_WORD *)v5 + 2) = v12; *((_WORD *)v5 + 3) = (unsigned __int8)(v13 - v15); *(_DWORD *)v5 = v14; return -2; } if ( v14 - 55296 <= 0x7FF ) goto LABEL_38; if ( v14 >= 0x110000 ) goto LABEL_38; v17[2] = 128; v17[3] = 2048; v17[4] = 0x10000; if ( v14 < v17[v12] ) goto LABEL_38; if ( v9 ) *v9 = v14; *(_QWORD *)v5 = 0; return v13 & (unsigned __int64)-(__int64)(v14 != 0); }