//
// sub_1004A5C90 from 0x1004a5c90 to 0x1004a5d50 (192 bytes)
//
// 1 xrefs:
// > sub_1004A52A0 @ 0x1004a5352
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:30:54 +0000
//
void *__fastcall sub_1004A5C90(char *a1)
{
std::__thread_specific_ptr *v1; // rax
const void *v2; // rsi
_BYTE *v3; // r14
std::__thread_struct *v4; // r14
__int128 v6; // [rsp+10h] [rbp-30h] BYREF
void *__p; // [rsp+20h] [rbp-20h]
v1 = std::__thread_local_data();
v2 = *(const void **)a1;
*(_QWORD *)a1 = 0;
pthread_setspecific(v1->__key_, v2);
__p = *((void **)a1 + 5);
v6 = *(_OWORD *)(a1 + 24);
*(_OWORD *)(a1 + 24) = 0;
*((_QWORD *)a1 + 5) = 0;
sub_1004A5450((__int64)(a1 + 8), (__int64)&v6);
v3 = a1 + 24;
if ( (v6 & 1) == 0 )
{
if ( (*v3 & 1) == 0 )
goto LABEL_3;
LABEL_7:
operator delete(*((void **)a1 + 5));
v4 = *(std::__thread_struct **)a1;
*(_QWORD *)a1 = 0;
if ( !v4 )
goto LABEL_5;
goto LABEL_4;
}
operator delete(__p);
if ( (*v3 & 1) != 0 )
goto LABEL_7;
LABEL_3:
v4 = *(std::__thread_struct **)a1;
*(_QWORD *)a1 = 0;
if ( v4 )
{
LABEL_4:
std::__thread_struct::~__thread_struct(v4);
operator delete(v4);
}
LABEL_5:
operator delete(a1);
return nullptr;
}