//
// sub_D1DD50 from 0xd1dd50 to 0xd1de40 (240 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
//
__int64 *__fastcall sub_D1DD50(__int64 *a1, _QWORD *a2)
{
__int64 v2; // x2
_QWORD *v4; // x19
int v5; // w3
__int64 *v6; // x0
void *v7; // x0
unsigned int *v9; // x2
int v10; // w1
unsigned int *v11; // x0
unsigned int v12; // w2
char v13; // [xsp+28h] [xbp+28h] BYREF
v2 = *a1;
v4 = (_QWORD *)*a2;
if ( *a1 != *a2 )
{
v5 = *((_DWORD *)v4 - 2);
v6 = v4 - 3;
if ( v5 < 0 )
{
v4 = sub_D1DB18((__int64)v6, (__int64)&v13, 0);
v2 = *a1;
}
else if ( v6 != &qword_124B6D0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v4 - 1);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 + 1, v11) );
v2 = *a1;
}
else
{
*((_DWORD *)v4 - 2) = v5 + 1;
}
}
v7 = (void *)(v2 - 24);
if ( (__int64 *)(v2 - 24) != &qword_124B6D0 )
{
if ( &pthread_create )
{
v9 = (unsigned int *)(v2 - 8);
do
v10 = __ldaxr(v9);
while ( __stlxr(v10 - 1, v9) );
}
else
{
v10 = *(_DWORD *)(v2 - 8);
*(_DWORD *)(v2 - 8) = v10 - 1;
}
if ( v10 <= 0 )
operator delete(v7);
}
*a1 = (__int64)v4;
}
return a1;
}