//
// sub_85C728 from 0x85c728 to 0x85c874 (332 bytes)
//
// 5 xrefs:
// > sub_85C3A0 @ 0x85c624
// > sub_85C3A0 @ 0x85c6c4
// > sub_85C3A0 @ 0x85c53c
// > sub_85C3A0 @ 0x85c544
// > ??> @ 0x85c710
//
// 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
//
bool __fastcall sub_85C728(unsigned __int8 *a1, size_t a2, char *a3, int a4)
{
size_t v5; // r5
int v6; // r4
unsigned __int8 *v7; // r6
char *v8; // lr
unsigned __int8 *v9; // r12
unsigned __int8 *v10; // r3
int v11; // r7
size_t v12; // r7
int v13; // r3
unsigned __int8 *v14; // r7
unsigned __int8 *v15; // r6
unsigned int v16; // r8
int v17; // t1
int v18; // t1
if ( a2 != a4 )
return 0;
if ( !a2 )
{
LABEL_10:
v5 = a2;
return memcmp(a1, a3, v5) == 0;
}
v5 = a2 - 1;
v6 = a1[a2 - 1];
v7 = &a1[a2 - 1];
if ( v6 == 64 )
{
LABEL_26:
v12 = a2 - v5;
if ( a2 != v5 )
{
v8 = &a3[v5];
v13 = (unsigned __int8)a3[v5];
v6 = 64;
goto LABEL_15;
}
LABEL_28:
if ( !v5 )
v5 = a2;
return memcmp(a1, a3, v5) == 0;
}
v8 = &a3[v5];
if ( a3[v5] != 64 )
{
v9 = (unsigned __int8 *)&a3[a2 - 2];
v10 = &a1[a2 - 2];
do
{
v8 = (char *)v9;
v7 = v10;
if ( !v5 )
goto LABEL_10;
v6 = *v10;
--v5;
--v10;
if ( v6 == 64 )
goto LABEL_26;
v11 = *v9--;
}
while ( v11 != 64 );
}
v12 = a2 - v5;
if ( a2 == v5 )
goto LABEL_28;
if ( v6 )
{
v13 = 64;
LABEL_15:
v14 = &v7[v12];
v15 = v7 + 1;
do
{
if ( v6 == v13 )
goto LABEL_23;
v16 = v13 - 65;
if ( (unsigned __int8)(v6 - 65) <= 0x19u )
{
v6 = (unsigned __int8)(v6 + 32);
if ( v16 > 0x19 )
goto LABEL_22;
}
else if ( v16 > 0x19 )
{
return 0;
}
v13 = (unsigned __int8)(v13 + 32);
LABEL_22:
if ( v6 != v13 )
return 0;
LABEL_23:
if ( v15 == v14 )
goto LABEL_28;
v17 = *v15++;
v6 = v17;
v18 = (unsigned __int8)*++v8;
v13 = v18;
}
while ( v6 );
}
return v6;
}