//
// sub_180016880 from 0x180016880 to 0x180016960 (224 bytes)
//
// 3 xrefs:
// > sub_18001B9D0 @ 0x18001b9e0
// > sub_18001C230 @ 0x18001c2f8
// > ??> @ 0x1801ae59c
//
// 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=2
struct std::_Facet_base *__fastcall sub_180016880(__int64 a1)
{
unsigned __int64 v2; // rsi
__int64 v3; // rdx
__int64 v4; // rdi
struct std::_Facet_base *v5; // rbx
struct std::locale::_Locimp *v6; // rax
struct std::_Facet_base *v7; // rbx
char v9; // [rsp+40h] [rbp+8h] BYREF
struct std::_Facet_base *v10; // [rsp+48h] [rbp+10h] BYREF
struct std::_Facet_base *v11; // [rsp+50h] [rbp+18h]
std::_Lockit::_Lockit((std::_Lockit *)&v9, 0);
v10 = (struct std::_Facet_base *)qword_1801A8368;
v2 = std::locale::id::operator unsigned __int64(std::codecvt::id);
v3 = *(_QWORD *)(a1 + 8);
v4 = 8 * v2;
if ( v2 >= *(_QWORD *)(v3 + 24) )
{
v5 = nullptr;
}
else
{
v5 = *(struct std::_Facet_base **)(v4 + *(_QWORD *)(v3 + 16));
if ( v5 )
goto LABEL_12;
}
if ( !*(_BYTE *)(v3 + 36) )
goto LABEL_8;
v6 = std::locale::_Getgloballocale();
if ( v2 < *((_QWORD *)v6 + 3) )
{
v5 = *(struct std::_Facet_base **)(v4 + *((_QWORD *)v6 + 2));
LABEL_8:
if ( v5 )
goto LABEL_12;
}
v5 = v10;
if ( !v10 )
{
if ( std::codecvt::_Getcat(&v10, a1) == -1 )
Concurrency::cancel_current_task();
v7 = v10;
v11 = v10;
std::_Facet_Register(v10);
(*(void (__fastcall **)(struct std::_Facet_base *))(*(_QWORD *)v7 + 8LL))(v7);
v5 = v10;
qword_1801A8368 = (__int64)v10;
}
LABEL_12:
std::_Lockit::~_Lockit((std::_Lockit *)&v9);
return v5;
}