//
// sub_7747CC from 0x7747cc to 0x774832 (102 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
//
unsigned int __fastcall sub_7747CC(int *a1, char *a2, unsigned int a3, unsigned int a4)
{
int v4; // r6
unsigned int v5; // r0
unsigned int v7; // r7
unsigned __int8 *v8; // r6
char *v9; // r8
int v10; // r10
unsigned int v11; // r4
size_t v12; // r9
int v13; // t1
unsigned int v14; // r3
int v15; // r0
v4 = *a1;
v5 = *(_DWORD *)(*a1 - 12);
if ( a4 )
{
if ( a4 > v5 )
return -1;
v7 = v5 - a4;
if ( a3 > v5 - a4 )
{
return -1;
}
else
{
v8 = (unsigned __int8 *)(v4 + a3);
v9 = a2 + 1;
v10 = (unsigned __int8)*a2;
v11 = a3 + 1;
v12 = a4 - 1;
while ( 1 )
{
v13 = *v8++;
v14 = v11;
if ( v13 == v10 )
{
v15 = memcmp(v8, v9, v12);
v14 = v11;
if ( !v15 )
break;
}
++v11;
if ( v14 > v7 )
return -1;
}
return v11 - 1;
}
}
else if ( a3 > v5 )
{
return -1;
}
else
{
return a3;
}
}