//
// sub_180016430 from 0x180016430 to 0x180016544 (276 bytes)
//
// 3 xrefs:
// > sub_18001B8F0 @ 0x18001b900
// > sub_18001C0E0 @ 0x18001c1a8
// > ??> @ 0x1801b85fc
//
// 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 11:21:24 +0000
//
// write access to const memory has been detected, the output may be wrong!
// Hidden C++ exception states: #wind=2
__int64 __fastcall sub_180016430(__int64 a1)
{
__int64 v2; // rcx
__int64 v3; // rdi
__int64 v4; // rbx
struct std::locale::_Locimp *v5; // rax
__int64 v6; // rbx
__int64 v8; // [rsp+40h] [rbp+8h] BYREF
char v9; // [rsp+48h] [rbp+10h] BYREF
__int64 v10; // [rsp+50h] [rbp+18h] BYREF
std::_Lockit::_Lockit((std::_Lockit *)&v9, 0);
v10 = qword_1801B2380;
if ( !std::codecvt::id )
{
std::_Lockit::_Lockit((std::_Lockit *)&v8, 0);
std::codecvt::id = ++std::locale::id::_Id_cnt;
std::_Lockit::~_Lockit((std::_Lockit *)&v8);
}
v2 = *(_QWORD *)(a1 + 8);
v3 = 8LL * std::codecvt::id;
if ( std::codecvt::id >= *(_QWORD *)(v2 + 24) )
{
v4 = 0;
}
else
{
v4 = *(_QWORD *)(v3 + *(_QWORD *)(v2 + 16));
if ( v4 )
goto LABEL_14;
}
if ( !*(_BYTE *)(v2 + 36) )
goto LABEL_10;
v5 = std::locale::_Getgloballocale();
if ( std::codecvt::id < *((_QWORD *)v5 + 3) )
{
v4 = *(_QWORD *)(v3 + *((_QWORD *)v5 + 2));
LABEL_10:
if ( v4 )
goto LABEL_14;
}
v4 = v10;
if ( !v10 )
{
if ( std::codecvt::_Getcat(&v10, a1) == -1 )
Concurrency::cancel_current_task();
v6 = v10;
v8 = v10;
sub_1800E4948(v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 8LL))(v6);
v4 = v10;
qword_1801B2380 = v10;
}
LABEL_14:
std::_Lockit::~_Lockit((std::_Lockit *)&v9);
return v4;
}