//
// sub_BAE84C from 0xbae84c to 0xbae98c (320 bytes)
//
// 3 xrefs:
// > sub_BA5740 @ 0xba58b4
// > sub_BA7AFC @ 0xba7c94
// > sub_BA9C48 @ 0xba9d9c
//
// 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_BAE84C(__int64 a1, char *a2, size_t a3)
{
__int64 result; // x0
const char *v7; // x1
size_t *v8; // x19
__int64 v9; // x23
size_t v10; // x20
int v11; // w20
int v12; // w1
if ( !a3 )
return 3;
if ( *(_BYTE *)(a1 + 24) )
{
*(_BYTE *)(a1 + 24) = 0;
*(_DWORD *)(a1 + 16) = 0;
if ( !strncmp(a2, "*", a3) )
goto LABEL_5;
}
else if ( !strncmp(a2, "*", a3) )
{
LABEL_5:
*(_DWORD *)(a1 + 16) = -33;
return 0;
}
v7 = "LOGIN";
v8 = (size_t *)&unk_111CDF8;
v9 = 0;
while ( 1 )
{
v10 = *v8;
v8 += 3;
if ( a3 < v10 )
goto LABEL_15;
result = memcmp(a2, v7, v10);
if ( (_DWORD)result )
goto LABEL_15;
if ( a3 == v10 )
break;
v11 = (unsigned __int8)a2[v10];
if ( !isupper(v11) && (unsigned int)(v11 - 48) > 9 && v11 != 45 && v11 != 95 )
return 3;
LABEL_15:
v7 = (const char *)*(v8 - 1);
v9 = (unsigned int)(v9 + 1);
if ( !v7 )
return 3;
}
v12 = (int)(&off_111CDF0)[3 * v9 + 2];
if ( !v12 )
return 3;
*(_DWORD *)(a1 + 16) |= v12;
return result;
}