//
// sub_18001F2A0 from 0x18001f2a0 to 0x18001f33a (154 bytes)
//
// 2 xrefs:
// > sub_180001140 @ 0x180001172
// > ??> @ 0x18004d0dc
//
// 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
//
__int64 __fastcall sub_18001F2A0(__int64 a1)
{
__int64 v2; // rdi
_QWORD *v3; // rbx
int v4; // eax
v2 = *((_QWORD *)NtCurrentTeb()->ThreadLocalStoragePointer + (unsigned int)TlsIndex);
v3 = *(_QWORD **)(v2 + 32);
if ( !v3 )
{
v3 = (_QWORD *)(v2 + 48);
LABEL_7:
v4 = 0;
*(_QWORD *)(v2 + 32) = v3;
*(_DWORD *)v3 = 0;
goto LABEL_8;
}
v4 = *(_DWORD *)v3;
if ( *(_DWORD *)v3 == 30 )
{
v3 = malloc(0x100u);
free(nullptr);
if ( !v3 )
return 0xFFFFFFFFLL;
v3[1] = *(_QWORD *)(v2 + 32);
goto LABEL_7;
}
LABEL_8:
v3[v4 + 2] = a1;
++*(_DWORD *)v3;
return 0;
}