//
// sub_BA7D5C from 0xba7d5c to 0xba7e80 (292 bytes)
//
// 2 xrefs:
// > sub_BA80C0 @ 0xba82e8
// > sub_BA80C0 @ 0xba836c
//
// 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_BA7D5C(__int64 a1)
{
__int64 v1; // x21
int v3; // w1
int v4; // w0
__int64 result; // x0
const char *v6; // x2
int v7; // [xsp+3Ch] [xbp+3Ch] BYREF
v1 = a1 + 1696;
v7 = 0;
if ( !(unsigned __int8)sub_BAE9D0(a1 + 1696, a1) )
{
LABEL_8:
*(_DWORD *)(a1 + 1672) = 0;
return 0;
}
if ( (*(_DWORD *)(a1 + 1728) & *(_DWORD *)(a1 + 1732) & 4) != 0 )
{
result = sub_BAE9F0(v1, a1, 0, &v7);
if ( (_DWORD)result )
return result;
v3 = v7;
if ( v7 == 1 )
{
*(_DWORD *)(a1 + 1672) = 5;
return result;
}
}
else
{
v3 = v7;
}
if ( v3 )
return 0;
v4 = *(_DWORD *)(a1 + 1732) & *(_DWORD *)(a1 + 1728);
if ( (v4 & 2) != 0 )
{
if ( *(_BYTE *)(a1 + 960) )
return sub_BA774C(a1);
goto LABEL_8;
}
if ( (v4 & 1) == 0 )
{
sub_B7B528(*(_QWORD *)a1, "No known authentication mechanisms supported!\n");
return 67;
}
if ( !*(_BYTE *)(a1 + 960) )
goto LABEL_8;
v6 = *(const char **)(a1 + 536);
if ( !v6 )
v6 = &byte_F288A0;
result = sub_BAA4B0(a1 + 1560, "USER %s", v6);
if ( !(_DWORD)result )
*(_DWORD *)(a1 + 1672) = 7;
return result;
}