//
// sub_D18A78 from 0xd18a78 to 0xd18b54 (220 bytes)
//
// 0 xrefs:
//
// 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
//
void *__fastcall sub_D18A78(__int64 a1)
{
int v1; // w19
void *result; // x0
unsigned int *v3; // x1
unsigned int v4; // w2
__int64 *v6; // x20
size_t v7; // x2
v1 = *(_DWORD *)(a1 + 16);
if ( v1 < 0 )
{
v6 = sub_D17420(*(_QWORD *)a1, *(_QWORD *)(a1 + 8));
v7 = *(_QWORD *)a1;
result = v6 + 3;
if ( *(_QWORD *)a1 )
{
if ( v7 == 1 )
{
result = v6 + 3;
*((_BYTE *)v6 + 24) = *(_BYTE *)(a1 + 24);
}
else
{
result = memcpy(v6 + 3, (const void *)(a1 + 24), v7);
}
v7 = *(_QWORD *)a1;
}
if ( v6 != &qword_124B6B0 )
{
*((_DWORD *)v6 + 4) = 0;
*v6 = v7;
*((_BYTE *)v6 + v7 + 24) = 0;
}
}
else
{
if ( (__int64 *)a1 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v3 = (unsigned int *)(a1 + 16);
do
v4 = __ldaxr(v3);
while ( __stlxr(v4 + 1, v3) );
}
else
{
*(_DWORD *)(a1 + 16) = v1 + 1;
}
}
return (void *)(a1 + 24);
}
return result;
}