//
// TlsCallback_1 from 0x18001f1f8 to 0x18001f29d (165 bytes)
//
// 3 xrefs:
// > ??> @ 0x180023290
// > ??> @ 0x180025818
// > ??> @ 0x18004d0d0
//
// 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:15:45 +0000
//
void __fastcall TlsCallback_1(__int64 a1, int a2)
{
__int64 v2; // r14
_QWORD *v3; // rdi
int v4; // ebx
void (**v5)(void); // rsi
_QWORD *v6; // rbx
if ( a2 == 3 || !a2 )
{
v2 = *((_QWORD *)NtCurrentTeb()->ThreadLocalStoragePointer + (unsigned int)TlsIndex);
v3 = *(_QWORD **)(v2 + 32);
if ( v3 )
{
while ( 1 )
{
v4 = *(_DWORD *)v3 - 1;
if ( v4 >= 0 )
{
v5 = (void (**)(void))&v3[v4 + 2];
do
{
if ( *v5 )
(*v5)();
--v5;
--v4;
}
while ( v4 >= 0 );
}
v6 = (_QWORD *)v3[1];
if ( !v6 )
break;
free(v3);
*(_QWORD *)(v2 + 32) = v6;
v3 = v6;
}
*(_QWORD *)(v2 + 32) = 0;
}
}
}