//
// __acrt_getptd_head from 0x18013538c to 0x180135433 (167 bytes)
//
// 3 xrefs:
// > __acrt_initialize_multibyte @ 0x18013a84b
// > ??> @ 0x18020335c
// > ??> @ 0x180203368
//
// 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 10:55:00 +0000
//
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;
}