//
// sub_1006A38A4 from 0x1006a38a4 to 0x1006a3acc (552 bytes)
//
// 2 xrefs:
// > sub_1006A3310 @ 0x1006a33d4
// > sub_1006A3310 @ 0x1006a36d4
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:11:41 +0000
//
__int64 __fastcall sub_1006A38A4(__int64 a1, const char *a2, int a3)
{
_BYTE *v6; // x22
size_t v7; // x0
size_t v8; // x23
ssize_t v9; // x0
unsigned __int64 v10; // x23
_BYTE *v12; // x20
char *v13; // x22
ssize_t v14; // x0
int v15; // w8
v6 = off_1009E5FD0(0x400u);
v7 = strlen(a2);
v8 = v7;
if ( !v6 )
return 27;
if ( v7 )
{
do
{
while ( 1 )
{
v9 = send(*(_DWORD *)(a1 + 1040), a2, v8, 0);
if ( v9 != -1 )
break;
if ( *__error() != 4 )
goto LABEL_35;
}
a2 += v9;
v8 -= v9;
}
while ( v8 );
v10 = 0;
}
else
{
v10 = 0;
}
while ( 2 )
{
v12 = v6;
v13 = &v6[v10];
while ( 1 )
{
v14 = recv(*(_DWORD *)(a1 + 1040), v13, 0x400u, 0);
if ( !v14 )
goto LABEL_34;
if ( v14 != -1 )
break;
if ( *__error() != 4 )
goto LABEL_34;
}
v10 += v14;
if ( v12[v10 - 1] != 10 )
{
v6 = off_1009E5FE0(v12, v10 + 1024);
if ( v6 )
continue;
off_1009E5FD8(v12);
return 27;
}
break;
}
v12[v10 - 1] = 0;
if ( (a3 != 1 || v10 != 3 || *v12 != 80) && v10 >= 4 )
{
if ( a3 == 1 )
{
if ( *v12 != 89 || v12[1] != 82 )
goto LABEL_34;
goto LABEL_32;
}
if ( a3 != 2 )
goto LABEL_33;
v15 = (unsigned __int8)*v12;
if ( v15 == 65 )
{
if ( v12[1] != 70 )
goto LABEL_34;
goto LABEL_32;
}
if ( v15 == 75 && v12[1] == 75 )
{
LABEL_32:
if ( v12[2] != 32 )
goto LABEL_34;
LABEL_33:
*(_QWORD *)(a1 + 1056) = sub_100688A44("NTLM %.*s", (int)v10 - 4, v12 + 3);
off_1009E5FD8(v12);
return 0;
}
}
LABEL_34:
v6 = v12;
LABEL_35:
off_1009E5FD8(v6);
return 9;
}