//
// sub_B7D654 from 0xb7d654 to 0xb7d7d0 (380 bytes)
//
// 2 xrefs:
// > sub_B7F490 @ 0xb7f97c
// > sub_B7F490 @ 0xb805ac
//
// 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_B7D654(__int64 a1, int a2)
{
__int64 v3; // x0
const char *v4; // x3
__int64 result; // x0
const char *v6; // x2
int v7; // w0
__int64 v8; // x19
const char *v9; // x2
__int64 v10; // x19
v3 = *(_QWORD *)a1;
if ( a2 == 331 )
{
if ( *(_DWORD *)(a1 + 1736) != 3 )
goto LABEL_4;
v6 = *(const char **)(*(_QWORD *)(v3 + 536) + 16LL);
if ( !v6 )
v6 = &byte_F288A0;
result = sub_BAA4B0(a1 + 1560, "PASS %s", v6);
if ( !(_DWORD)result )
*(_DWORD *)(a1 + 1736) = 4;
}
else if ( (unsigned int)(a2 - 200) <= 0x63 )
{
v7 = *(unsigned __int8 *)(a1 + 664);
v8 = a1 + 1560;
if ( v7 )
{
result = sub_BAA4B0(v8, "PBSZ %d", 0);
if ( !(_DWORD)result )
*(_DWORD *)(v8 + 176) = 6;
}
else
{
result = sub_BAA4B0(v8, "%s", "PWD");
if ( !(_DWORD)result )
*(_DWORD *)(v8 + 176) = 9;
}
}
else
{
if ( a2 != 332 )
{
LABEL_4:
v4 = *(const char **)(v3 + 1736);
if ( v4 && !*(_BYTE *)(v3 + 36000) )
{
result = sub_BAA4B0(a1 + 1560, "%s", v4);
if ( !(_DWORD)result )
{
*(_BYTE *)(*(_QWORD *)a1 + 36000LL) = 1;
*(_DWORD *)(a1 + 1736) = 3;
}
}
else
{
sub_B7B690(v3, "Access denied: %03d", a2);
return 67;
}
return result;
}
v9 = *(const char **)(v3 + 1728);
if ( v9 )
{
v10 = a1 + 1560;
result = sub_BAA4B0(v10, "ACCT %s", v9);
if ( !(_DWORD)result )
*(_DWORD *)(v10 + 176) = 5;
}
else
{
sub_B7B690(v3, "ACCT requested but none available");
return 67;
}
}
return result;
}