//
// sub_CF84F8 from 0xcf84f8 to 0xcf8584 (140 bytes)
//
// 8 xrefs:
// > fmt::SystemError::init @ 0xb7013c
// > sub_D14934 @ 0xd14940
// > sub_D14944 @ 0xd14960
// > sub_D19938 @ 0xd19944
// > sub_D19948 @ 0xd19964
// > sub_D13DB0 @ 0xd13e14
// > ??> @ 0x111e870
// > ??> @ 0x122bde0
//
// 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
//
void __fastcall sub_CF84F8(std::exception *this)
{
__int64 v2; // x2
void *v3; // x0
unsigned int *v4; // x2
int v5; // w1
*(_QWORD *)this = off_111E870;
v2 = *((_QWORD *)this + 1);
v3 = (void *)(v2 - 24);
if ( (__int64 *)(v2 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v4 = (unsigned int *)(v2 - 8);
do
v5 = __ldaxr(v4);
while ( __stlxr(v5 - 1, v4) );
}
else
{
v5 = *(_DWORD *)(v2 - 8);
*(_DWORD *)(v2 - 8) = v5 - 1;
}
if ( v5 <= 0 )
operator delete(v3);
}
std::exception::~exception(this);
}