//
// sub_D1DBD0 from 0xd1dbd0 to 0xd1dc60 (144 bytes)
//
// 1 xrefs:
// > sub_CEC1D8 @ 0xcec1ec
//
// 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
//
unsigned int *__fastcall sub_D1DBD0(unsigned int **a1, unsigned int **a2)
{
unsigned int *v2; // x1
unsigned int *result; // x0
int v5; // w3
unsigned int v6; // w2
char v7; // [xsp+28h] [xbp+28h] BYREF
v2 = *a2;
result = v2 - 6;
v5 = *(v2 - 2);
if ( v5 < 0 )
{
result = (unsigned int *)sub_D1DB18((__int64)result, (__int64)&v7, 0);
*a1 = result;
}
else
{
if ( result != (unsigned int *)&qword_124B6D0 )
{
result = (unsigned int *)&pthread_create;
if ( &pthread_create )
{
result = v2 - 2;
do
v6 = __ldaxr(result);
while ( __stlxr(v6 + 1, result) );
}
else
{
*(v2 - 2) = v5 + 1;
}
}
*a1 = v2;
}
return result;
}