//
// sub_10056DCE0 from 0x10056dce0 to 0x10056de8b (427 bytes)
//
// 1 xrefs:
// > sub_10056E740 @ 0x10056e87a
//
// 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_10056DCE0(unsigned __int8 *a1)
{
unsigned int v2; // eax
size_t v3; // rdx
unsigned int v4; // ecx
char *v5; // rdi
_QWORD *v6; // r14
__int64 v7; // r12
pthread_mutex_t *v8; // r15
__int64 *v9; // r12
_QWORD *v10; // rax
__int64 v11; // rcx
char v12; // r15
_QWORD *v13; // rax
_QWORD *v14; // r14
unsigned __int8 *v15; // rax
__int64 v16; // r12
pthread_mutex_t *v17; // r15
__int64 *v18; // r12
_QWORD *v19; // rax
__int64 v20; // rcx
void *v21; // rdi
v2 = a1[104];
if ( (v2 & 1) != 0 )
{
v3 = *((_QWORD *)a1 + 14);
v4 = a1[32];
if ( (v4 & 1) == 0 )
goto LABEL_3;
LABEL_6:
if ( v3 != *((_QWORD *)a1 + 5) )
goto LABEL_13;
goto LABEL_7;
}
v3 = v2 >> 1;
v4 = a1[32];
if ( (v4 & 1) != 0 )
goto LABEL_6;
LABEL_3:
if ( v3 != v4 >> 1 )
goto LABEL_13;
LABEL_7:
if ( (v2 & 1) != 0 )
{
v5 = *((char **)a1 + 15);
if ( (v4 & 1) == 0 )
goto LABEL_9;
}
else
{
v5 = (char *)(a1 + 105);
if ( (v4 & 1) == 0 )
{
LABEL_9:
if ( !memcmp(v5, a1 + 33, v3) )
goto LABEL_15;
goto LABEL_13;
}
}
if ( !memcmp(v5, *((const void **)a1 + 6), v3) )
{
LABEL_15:
v12 = sub_10056E200(a1);
v13 = operator new(0x10u);
v14 = v13;
if ( v12 )
{
*(_DWORD *)v13 = 0;
v15 = a1;
}
else
{
v13[1] = 0;
*(_DWORD *)v13 = 3;
v15 = (unsigned __int8 *)operator new(0x10u);
*(_OWORD *)v15 = 0;
*(_DWORD *)v15 = 3;
*((_QWORD *)v15 + 1) = a1;
}
v14[1] = v15;
v16 = *((_QWORD *)a1 + 17);
v17 = (pthread_mutex_t *)(v16 + 64);
pthread_mutex_lock((pthread_mutex_t *)(v16 + 64));
v18 = *(__int64 **)(v16 + 56);
v19 = operator new(0x18u);
v19[2] = v14;
v19[1] = v18;
v20 = *v18;
*v19 = *v18;
*(_QWORD *)(v20 + 8) = v19;
*v18 = (__int64)v19;
++v18[2];
pthread_mutex_unlock(v17);
goto LABEL_19;
}
LABEL_13:
if ( (unsigned __int8)sub_10056DE90(a1) )
{
v6 = operator new(0x10u);
*(_DWORD *)v6 = 1;
v6[1] = a1;
v7 = *((_QWORD *)a1 + 17);
v8 = (pthread_mutex_t *)(v7 + 64);
pthread_mutex_lock((pthread_mutex_t *)(v7 + 64));
v9 = *(__int64 **)(v7 + 56);
v10 = operator new(0x18u);
v10[2] = v6;
v10[1] = v9;
v11 = *v9;
*v10 = *v9;
*(_QWORD *)(v11 + 8) = v10;
*v9 = (__int64)v10;
++v9[2];
pthread_mutex_unlock(v8);
goto LABEL_15;
}
LABEL_19:
v21 = *((void **)a1 + 18);
if ( v21 )
{
operator delete(v21);
*((_QWORD *)a1 + 18) = 0;
}
return nullptr;
}