//
// sub_CEAD18 from 0xcead18 to 0xceada4 (140 bytes)
//
// 0 xrefs:
//
// 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
//
_DWORD *__fastcall sub_CEAD18(_DWORD *a1, __int64 a2, __int64 *a3)
{
__int64 v3; // x3
unsigned int v4; // w3
unsigned __int64 v5; // x3
_DWORD *v6; // x3
v3 = *a3;
if ( !*a3 )
{
if ( &pthread_create )
{
do
v4 = __ldaxr((unsigned int *)&dword_124A1C8);
while ( __stlxr(v4 + 1, (unsigned int *)&dword_124A1C8) );
LODWORD(v3) = v4 + 1;
}
else
{
LODWORD(v3) = ++dword_124A1C8;
}
v3 = (int)v3;
*a3 = (int)v3;
}
v5 = v3 - 1;
if ( *(_QWORD *)(a2 + 16) - 1LL < v5 || (v6 = *(_DWORD **)(*(_QWORD *)(a2 + 8) + 8 * v5)) == nullptr )
sub_D13DB0("locale::_Impl::_M_replace_facet");
return sub_CEA9C4(a1, a3, v6);
}