//
// __cxa_thread_atexit from 0x742c94 to 0x742d20 (140 bytes)
//
// 1 xrefs:
// > sub_5AB7E4 @ 0x5ab818
//
// 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 *); // r8
void (**v6)(void *); // r0
int v8; // r4
void (**v9)(void *); // r3
if ( &pthread_create )
{
pthread_once(&dword_ACC6DC, (void (*)(void))sub_742C1C);
v5 = (void (*)(void *))pthread_getspecific(dword_ACC6E4);
v6 = (void (**)(void *))operator new(0xCu, (const std::nothrow_t *)&std::nothrow);
if ( v6 )
{
*v6 = lpfunc;
v6[1] = (void (*)(void *))obj;
v6[2] = v5;
pthread_setspecific(dword_ACC6E4, v6);
return 0;
}
}
else
{
if ( !byte_ACC6D4 )
{
byte_ACC6D4 = 1;
sub_2BDAA8(sub_742BD4);
}
v8 = dword_ACC6D0;
v9 = (void (**)(void *))operator new(0xCu, (const std::nothrow_t *)&std::nothrow);
if ( v9 )
{
*v9 = lpfunc;
v9[1] = (void (*)(void *))obj;
v9[2] = (void (*)(void *))v8;
dword_ACC6D0 = (int)v9;
return 0;
}
}
return -1;
}