//
// sub_BACD74 from 0xbacd74 to 0xbacf80 (524 bytes)
//
// 2 xrefs:
// > sub_B7756C @ 0xb776f0
// > sub_B7756C @ 0xb77888
//
// 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_BACD74(_QWORD *a1, unsigned __int8 a2)
{
int v2; // w22
__int64 v3; // x2
char *v4; // x1
__int64 v5; // x19
char *v6; // x5
void **v7; // x21
int *v8; // x20
int v9; // w4
__int64 result; // x0
const char *v11; // x1
const char *v12; // x1
void *p; // [xsp+40h] [xbp+40h] BYREF
__int64 v14; // [xsp+48h] [xbp+48h] BYREF
v2 = a2;
p = nullptr;
v14 = 0;
v3 = *a1;
if ( a2 )
{
v4 = (char *)a1[49];
v5 = v3 + 35864;
v6 = (char *)a1[50];
v7 = (void **)(a1 + 132);
v8 = (int *)(a1 + 154);
*(_BYTE *)(v3 + 35888) = 0;
if ( v4 )
goto LABEL_3;
}
else
{
v4 = (char *)a1[67];
v5 = v3 + 35832;
v6 = (char *)a1[68];
v7 = (void **)(a1 + 135);
v8 = (int *)(a1 + 150);
*(_BYTE *)(v3 + 35856) = 0;
if ( v4 )
{
LABEL_3:
if ( v6 )
goto LABEL_4;
goto LABEL_15;
}
}
v4 = &byte_F288A0;
if ( v6 )
{
LABEL_4:
v9 = *v8;
if ( *v8 != 3 )
goto LABEL_5;
LABEL_16:
*v8 = 4;
goto LABEL_17;
}
LABEL_15:
v9 = *v8;
v6 = &byte_F288A0;
if ( *v8 == 3 )
goto LABEL_16;
LABEL_5:
if ( v9 == 4 )
{
LABEL_17:
off_1231008(*v7);
*v7 = nullptr;
result = 0;
*(_BYTE *)(v5 + 24) = 1;
return result;
}
if ( v9 == 2 )
{
result = sub_BB3E44(v3, v4, v6, v8, &p, &v14);
if ( (_DWORD)result )
return result;
if ( p )
{
off_1231008(*v7);
if ( v2 )
v12 = "Proxy-";
else
v12 = &byte_F288A0;
*v7 = sub_B8F880("%sAuthorization: NTLM %s\r\n", v12, (const char *)p);
off_1231008(p);
if ( !*v7 )
return 27;
*v8 = 3;
*(_BYTE *)(v5 + 24) = 1;
return 0;
}
return 0;
}
result = sub_BB3D18(v4, v6, v8, &p, &v14);
if ( (_DWORD)result )
return result;
if ( !p )
return 0;
off_1231008(*v7);
if ( v2 )
v11 = "Proxy-";
else
v11 = &byte_F288A0;
*v7 = sub_B8F880("%sAuthorization: NTLM %s\r\n", v11, (const char *)p);
off_1231008(p);
result = 0;
if ( !*v7 )
return 27;
return result;
}