//
// sub_100578A6C from 0x100578a6c to 0x100578b84 (280 bytes)
//
// 2 xrefs:
// > sub_100578294 @ 0x1005786dc
// > sub_100578294 @ 0x1005786f4
//
// 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_100578A6C(__int64 a1)
{
__int64 v2; // x20
__int64 result; // x0
int v4; // w8
bool v5; // zf
int v6; // w8
const char *v7; // x8
int v8; // [xsp+Ch] [xbp-14h] BYREF
v8 = 0;
v2 = a1 + 1472;
if ( (sub_10058010C(a1 + 1472, a1) & 1) == 0 )
goto LABEL_20;
if ( (*(_DWORD *)(a1 + 1504) & *(_DWORD *)(a1 + 1508) & 4) != 0 )
{
result = sub_10058012C(v2, a1, 0, &v8);
v4 = v8;
if ( (_DWORD)result )
v5 = 0;
else
v5 = v8 == 1;
if ( v5 )
{
result = 0;
*(_DWORD *)(a1 + 1448) = 5;
v4 = 1;
}
}
else
{
v4 = 0;
result = 0;
}
if ( !(v4 | (unsigned int)result) )
{
v6 = *(_DWORD *)(a1 + 1508) & *(_DWORD *)(a1 + 1504);
if ( (v6 & 2) != 0 )
return sub_100578B84(a1);
if ( (v6 & 1) == 0 )
{
sub_1005524A4(*(_QWORD *)a1, "No known authentication mechanisms supported!\n");
return 67;
}
if ( *(_BYTE *)(a1 + 741) )
{
v7 = *(const char **)(a1 + 368);
if ( !v7 )
v7 = "";
result = sub_10057A8EC(a1 + 1336, "USER %s", v7);
if ( !(_DWORD)result )
{
*(_DWORD *)(a1 + 1448) = 7;
return 0;
}
return result;
}
LABEL_20:
*(_DWORD *)(a1 + 1448) = 0;
return 0;
}
return result;
}