//
// sub_BAE6FC from 0xbae6fc to 0xbae84c (336 bytes)
//
// 3 xrefs:
// > sub_BA67C0 @ 0xba6de0
// > sub_BA80C0 @ 0xba84f8
// > sub_BA92E0 @ 0xba9b30
//
// 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
//
__int64 __fastcall sub_BAE6FC(unsigned __int8 *a1, size_t a2, size_t *a3)
{
const char *v6; // x1
size_t *v7; // x19
__int64 v8; // x21
size_t v9; // x20
int v10; // w20
size_t v12; // x20
int v13; // w20
v6 = "LOGIN";
v7 = (size_t *)&unk_111CDF8;
v8 = 0;
if ( a3 )
{
while ( 1 )
{
v9 = *v7;
v7 += 3;
if ( v9 <= a2 && !memcmp(a1, v6, v9) )
{
*a3 = v9;
if ( v9 == a2 )
break;
v10 = a1[v9];
if ( !isupper(v10) && (unsigned int)(v10 - 48) > 9 && v10 != 45 && v10 != 95 )
break;
}
v6 = (const char *)*(v7 - 1);
v8 = (unsigned int)(v8 + 1);
if ( !v6 )
return (unsigned int)v6;
}
}
else
{
v8 = 0;
while ( 1 )
{
v12 = *v7;
v7 += 3;
if ( a2 >= v12 && !memcmp(a1, v6, v12) )
{
if ( v12 == a2 )
break;
v13 = a1[v12];
if ( !isupper(v13) && (unsigned int)(v13 - 48) > 9 && v13 != 45 && v13 != 95 )
break;
}
v6 = (const char *)*(v7 - 1);
v8 = (unsigned int)(v8 + 1);
if ( !v6 )
return (unsigned int)v6;
}
}
return LODWORD((&off_111CDF0)[3 * v8 + 2]);
}