//
// __acrt_getptd_head from 0x18013538c to 0x180135433 (167 bytes)
//
// 3 xrefs:
// > __acrt_initialize_multibyte @ 0x18013a84b
// > ??> @ 0x18020335c
// > ??> @ 0x180203368
//
// 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
//
struct __acrt_ptd *_acrt_getptd_head()
{
DWORD v0; // ecx
__int64 Value; // rax
struct __acrt_ptd *v2; // rbx
struct __acrt_ptd *v3; // rax
struct __acrt_ptd *v4; // rcx
v0 = dword_1801B1870;
if ( dword_1801B1870 == -1 )
{
LABEL_6:
if ( !(unsigned int)_acrt_FlsSetValue(v0, (LPVOID)0xFFFFFFFFFFFFFFFFLL) )
goto LABEL_15;
v3 = (struct __acrt_ptd *)calloc_base(1u, 0x3C8u);
v2 = v3;
if ( v3 )
{
if ( (unsigned int)_acrt_FlsSetValue(dword_1801B1870, v3) )
{
construct_ptd_array(v2);
free_base(nullptr);
goto LABEL_13;
}
_acrt_FlsSetValue(dword_1801B1870, nullptr);
v4 = v2;
}
else
{
_acrt_FlsSetValue(dword_1801B1870, nullptr);
v4 = nullptr;
}
free_base(v4);
goto LABEL_15;
}
Value = _acrt_FlsGetValue();
v2 = (struct __acrt_ptd *)Value;
if ( !Value )
{
v0 = dword_1801B1870;
goto LABEL_6;
}
if ( Value == -1 )
goto LABEL_15;
LABEL_13:
if ( !v2 )
LABEL_15:
abort();
return v2;
}