//
// sub_7787CC from 0x7787cc to 0x778854 (136 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
//
_DWORD *__fastcall sub_7787CC(int a1)
{
int v1; // r4
_DWORD *result; // r0
size_t *v4; // r0
size_t v5; // r2
size_t *v6; // r6
unsigned int *v7; // r3
unsigned int v8; // r2
v1 = *(_DWORD *)(a1 + 8);
if ( v1 < 0 )
{
v4 = sub_777768(*(_DWORD *)a1, *(_DWORD *)(a1 + 4));
v5 = *(_DWORD *)a1;
v6 = v4;
result = v4 + 3;
if ( *(_DWORD *)a1 )
{
if ( v5 == 1 )
{
result = v6 + 3;
v6[3] = *(_DWORD *)(a1 + 12);
v5 = *(_DWORD *)a1;
}
else
{
wmemcpy((wchar_t *)v6 + 3, (const wchar_t *)(a1 + 12), v5);
v5 = *(_DWORD *)a1;
result = v6 + 3;
}
}
if ( v6 != (size_t *)&unk_ACDDAC )
{
*v6 = v5;
v6[2] = 0;
v6[v5 + 3] = 0;
}
}
else
{
if ( (_UNKNOWN *)a1 != &unk_ACDDAC )
{
if ( &pthread_create )
{
v7 = (unsigned int *)(a1 + 8);
__dmb(0xFu);
do
v8 = __ldrex(v7);
while ( __strex(v8 + 1, v7) );
__dmb(0xFu);
}
else
{
*(_DWORD *)(a1 + 8) = v1 + 1;
}
}
return (_DWORD *)(a1 + 12);
}
return result;
}