//
// sub_10057CCF8 from 0x10057ccf8 to 0x10057ce5c (356 bytes)
//
// 1 xrefs:
// > sub_1005505B0 @ 0x100550678
//
// 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_10057CCF8(size_t *a1, int a2, _BYTE *a3)
{
size_t *v5; // x21
size_t *v6; // x22
int *v7; // x19
unsigned __int8 v8; // w8
_BYTE *v9; // x23
int v10; // t1
int v12; // t1
__int64 result; // x0
int v14; // w8
v5 = a1 + 126;
v6 = a1 + 122;
if ( a2 )
v7 = (int *)(a1 + 126);
else
v7 = (int *)(a1 + 122);
if ( !sub_10057405C("NTLM", a3, 4) )
return 0;
v10 = (unsigned __int8)a3[4];
v9 = a3 + 4;
v8 = v10;
if ( !v10 )
goto LABEL_16;
while ( (char)v8 < 0 ? __maskrune(v8, 0x4000u) : _DefaultRuneLocale.__runetype[v8] & 0x4000 )
{
v12 = (unsigned __int8)*++v9;
v8 = v12;
if ( !v12 )
goto LABEL_16;
}
if ( !*v9 )
{
LABEL_16:
v14 = *v7;
if ( *v7 )
{
if ( v14 == 3 )
{
sub_1005524A4(*a1, "NTLM handshake rejected\n");
sub_10057FDA8(v6);
sub_10057FDA8(v5);
sub_10057D080(a1);
*v7 = 0;
return 9;
}
if ( v14 != 4 )
{
sub_1005524A4(*a1, "NTLM handshake failure (internal error)\n");
return 9;
}
sub_1005524A4(*a1, "NTLM auth restarted\n");
sub_10057FDA8(v6);
sub_10057FDA8(v5);
sub_10057D080(a1);
}
*v7 = 1;
return 0;
}
result = sub_10057E194(*a1, v9, v7);
if ( !(_DWORD)result )
{
*v7 = 2;
return 0;
}
return result;
}