//
// sub_B76CB8 from 0xb76cb8 to 0xb76e68 (432 bytes)
//
// 2 xrefs:
// > sub_B77278 @ 0xb77488
// > sub_B7A0E0 @ 0xb7b4cc
//
// 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_B76CB8(__int64 *a1)
{
__int64 v1; // x20
__int64 v2; // x2
int v3; // w1
int v4; // w22
signed __int64 v6; // x21
int v7; // w3
signed __int64 v8; // x0
bool v10; // zf
__int64 v11; // x1
__int64 v12; // x2
__int64 v13; // x3
const char *v14; // x0
v1 = *a1;
v2 = *(_QWORD *)(*a1 + 536);
if ( !v2 )
return 0;
v3 = *(_DWORD *)(v1 + 1072);
if ( v3 == 1 || v3 == 5 )
return 0;
v4 = *((unsigned __int8 *)a1 + 970);
v6 = *(_QWORD *)(v2 + 48);
if ( *((_BYTE *)a1 + 970) )
{
v7 = 0;
v8 = 0;
goto LABEL_6;
}
v7 = *((unsigned __int8 *)a1 + 967);
if ( *((_BYTE *)a1 + 967) )
{
if ( v3 == 3 )
{
v8 = *(_QWORD *)(v2 + 8);
v7 = v8 == -1;
}
else if ( v3 == 4 )
{
v11 = v1 + 0x8000;
v7 = *((unsigned __int8 *)a1 + 970);
v8 = *(_QWORD *)(v1 + 36088);
if ( v8 == -1 )
goto LABEL_14;
}
else
{
v10 = v3 == 2;
v11 = v1 + 0x8000;
if ( !v10 )
{
LABEL_14:
*((_BYTE *)a1 + 971) = 0;
v8 = -1;
goto LABEL_16;
}
v8 = *(_QWORD *)(v1 + 36088);
v7 = v4;
if ( v8 == -1 )
{
v14 = *(const char **)(v1 + 656);
if ( !v14 )
goto LABEL_14;
v8 = strlen(v14);
v7 = v8 == -1;
}
}
}
else
{
v8 = 0;
}
LABEL_6:
*((_BYTE *)a1 + 971) = 0;
if ( v8 <= v6 && !v7 )
{
if ( !v6 )
return 0;
return sub_B9274C(a1);
}
v11 = v1 + 0x8000;
LABEL_16:
v12 = *(_QWORD *)(v11 + 3104);
if ( v12 == 8 || (v13 = *(_QWORD *)(v11 + 3072), v13 == 8 || v12 == 32) || v13 == 32 )
{
if ( v8 - v6 <= 1999 || *((_DWORD *)a1 + 300) || *((_DWORD *)a1 + 308) )
{
if ( !v4 )
{
*((_BYTE *)a1 + 971) = 1;
sub_B7B528(v1, "Rewind stream after send\n");
}
return 0;
}
if ( *((_BYTE *)a1 + 953) )
return 0;
sub_B7B528(v1, "NTLM send, close instead of sending %ld bytes\n", v8 - v6);
}
sub_B99314(a1, 2);
*(_QWORD *)(v1 + 120) = 0;
if ( !v6 )
return 0;
return sub_B9274C(a1);
}