//
// sub_775C88 from 0x775c88 to 0x775d30 (168 bytes)
//
// 12 xrefs:
// > sub_75D698 @ 0x75d6f6
// > sub_75D698 @ 0x75d71c
// > sub_75D698 @ 0x75d756
// > sub_75DFB0 @ 0x75e00e
// > sub_75DFB0 @ 0x75e034
// > sub_75DFB0 @ 0x75e06e
// > sub_75E5A0 @ 0x75e5fe
// > sub_75E5A0 @ 0x75e624
// > sub_75E5A0 @ 0x75e65e
// > sub_75EC84 @ 0x75ece2
// > sub_75EC84 @ 0x75ed08
// > sub_75EC84 @ 0x75ed42
//
// 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
//
char **__fastcall sub_775C88(char **a1, char **a2)
{
char *v3; // r4
char *v4; // r3
int v5; // r2
int *v6; // r0
char *v7; // r0
char *v9; // r0
unsigned int *v10; // r3
int v11; // r2
unsigned int *v12; // r3
unsigned int v13; // r2
char v14[8]; // [sp+4h] [bp-8h] BYREF
v3 = *a2;
v4 = *a1;
if ( *a1 != *a2 )
{
v5 = *((_DWORD *)v3 - 1);
v6 = (int *)(v3 - 12);
if ( v5 < 0 )
{
v9 = sub_775B70((int)v6, (int)v14, 0);
v4 = *a1;
v3 = v9;
}
else if ( v6 != &dword_ACDD9C )
{
if ( &pthread_create )
{
v12 = (unsigned int *)(v3 - 4);
__dmb(0xFu);
do
v13 = __ldrex(v12);
while ( __strex(v13 + 1, v12) );
__dmb(0xFu);
v4 = *a1;
}
else
{
*((_DWORD *)v3 - 1) = v5 + 1;
}
}
v7 = v4 - 12;
if ( v4 - 12 != (char *)&dword_ACDD9C )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v4 - 4);
__dmb(0xFu);
do
v11 = __ldrex(v10);
while ( __strex(v11 - 1, v10) );
__dmb(0xFu);
}
else
{
v11 = *((_DWORD *)v4 - 1);
*((_DWORD *)v4 - 1) = v11 - 1;
}
if ( v11 <= 0 )
operator delete(v7);
}
*a1 = v3;
}
return a1;
}