//
// sub_85BFE0 from 0x85bfe0 to 0x85c10c (300 bytes)
//
// 5 xrefs:
// > sub_85C3A0 @ 0x85c624
// > sub_85C3A0 @ 0x85c6c4
// > sub_85C3A0 @ 0x85c57c
// > sub_85C3A0 @ 0x85c584
// > ??> @ 0x85c714
//
// 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
//
int __fastcall sub_85BFE0(_BYTE *a1, unsigned int a2, unsigned __int8 *a3, unsigned int a4, __int16 a5)
{
unsigned __int8 *v6; // lr
int v7; // r12
int v8; // t1
int v11; // r3
int v12; // r12
unsigned __int8 *v13; // r1
unsigned __int8 *v14; // r0
int v15; // t1
int v16; // t1
unsigned int v17; // r4
if ( a5 < 0 )
{
if ( a4 >= a2 )
{
if ( a4 != a2 )
return 0;
}
else
{
if ( *a1 )
{
if ( *a1 != 46 || (a5 & 0x10) == 0 )
{
v6 = a1 + 1;
do
{
--a2;
a1 = v6;
if ( a4 >= a2 )
break;
v8 = *v6++;
v7 = v8;
if ( !v8 )
break;
}
while ( v7 != 46 || (a5 & 0x10) == 0 );
}
}
if ( a4 != a2 )
return 0;
}
a2 = a4;
}
else if ( a4 != a2 )
{
return 0;
}
if ( a2 )
{
v11 = (unsigned __int8)*a1;
v12 = *a3;
if ( *a1 )
{
v13 = &a1[a2];
v14 = a1 + 1;
while ( v11 == v12 )
{
LABEL_25:
if ( v14 == v13 )
return 1;
v15 = *v14++;
v11 = v15;
v16 = *++a3;
v12 = v16;
if ( !v11 )
return 0;
}
v17 = v12 - 65;
if ( (unsigned int)(v11 - 65) > 0x19 )
{
if ( v17 > 0x19 )
return 0;
}
else
{
v11 = (unsigned __int8)(v11 + 32);
if ( v17 > 0x19 )
{
LABEL_24:
if ( v11 != v12 )
return 0;
goto LABEL_25;
}
}
v12 = (unsigned __int8)(v12 + 32);
goto LABEL_24;
}
return 0;
}
return 1;
}