//
// __cxa_thread_atexit from 0xccbb30 to 0xccbc2c (252 bytes)
//
// 2 xrefs:
// > sub_AAAF54 @ 0xaaafc0
// > ??> @ 0xc7d10
//
// 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
//
int _cxa_thread_atexit(void (*lpfunc)(void *), void *obj, void *lpdso_handle)
{
void (*v5)(void *); // x22
void (**v6)(void *); // x2
pthread_key_t v7; // w0
__int64 v9; // x22
void (**v10)(void *); // x0
__int64 v11; // x1
if ( &pthread_create )
{
pthread_once(dword_12490A0, (void (*)(void))sub_CCBA98);
v5 = (void (*)(void *))pthread_getspecific(dword_12490B0);
v6 = (void (**)(void *))operator new(0x18u, (const std::nothrow_t *)&std::nothrow);
if ( v6 )
{
v7 = dword_12490B0;
*v6 = lpfunc;
v6[1] = (void (*)(void *))obj;
v6[2] = v5;
pthread_setspecific(v7, v6);
return 0;
}
}
else
{
if ( !byte_1249090 )
{
byte_1249090 = 1;
sub_4EB7A4(sub_CCBA38);
}
v9 = qword_1249088;
v10 = (void (**)(void *))operator new(0x18u, (const std::nothrow_t *)&std::nothrow);
v11 = (__int64)v10;
if ( v10 )
{
*v10 = lpfunc;
*(_QWORD *)(v11 + 8) = obj;
*(_QWORD *)(v11 + 16) = v9;
qword_1249088 = v11;
return 0;
}
}
return -1;
}