//
// sub_100676448 from 0x100676448 to 0x100676718 (720 bytes)
//
// 2 xrefs:
// > sub_1006762F4 @ 0x100676398
// > sub_1006762F4 @ 0x100676408
//
// 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:12 +0000
//
__int64 __fastcall sub_100676448(const char **a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
int v5; // w22
const char *v8; // x20
__int64 v9; // x8
_QWORD *v10; // x8
__int64 result; // x0
const char *v12; // x8
_QWORD *v13; // x24
__int64 v14; // x23
const char **v15; // x8
const char **v16; // x9
const char *v17; // x9
const char *v18; // x10
v5 = a5;
v8 = *a1;
v9 = *(_QWORD *)(a2 + 8);
if ( v9 <= 7 )
{
if ( v9 == 1 )
{
if ( (_DWORD)a5 )
{
if ( *((_BYTE *)a1 + 742) )
{
if ( *((_BYTE *)a1 + 739) && v8[976] )
v10 = v8 + 960;
else
v10 = v8 + 952;
v13 = (_QWORD *)*v10;
if ( *v10 )
{
while ( !(unsigned int)sub_10069A1C4(*v13, "Proxy-authorization:", 20) )
{
v13 = (_QWORD *)v13[1];
if ( !v13 )
goto LABEL_30;
}
goto LABEL_27;
}
goto LABEL_30;
}
}
else if ( *((_BYTE *)a1 + 741) )
{
v13 = *((_QWORD **)*a1 + 119);
if ( v13 )
{
while ( !(unsigned int)sub_10069A1C4(*v13, "Authorization:", 14) )
{
v13 = (_QWORD *)v13[1];
if ( !v13 )
goto LABEL_30;
}
LABEL_27:
if ( *v13 )
goto LABEL_28;
}
LABEL_30:
v14 = (__int64)*a1;
if ( v5 )
v15 = a1 + 50;
else
v15 = a1 + 46;
if ( v5 )
v16 = a1 + 51;
else
v16 = a1 + 47;
sub_1006889EC(v14 + 2384, 16385, "%s:%s", *v15, *v16);
strlen((const char *)(v14 + 2384));
result = sub_10066F410(v14, (char *)(v14 + 2384));
if ( !(_DWORD)result )
return 9;
return result;
}
LABEL_28:
*(_BYTE *)(a2 + 24) = 1;
goto LABEL_29;
}
if ( v9 == 2 )
{
result = sub_100695F5C(a1, a5);
if ( (_DWORD)result )
return result;
v12 = "Digest";
goto LABEL_38;
}
LABEL_29:
*(_BYTE *)(a2 + 25) = 0;
return 0;
}
if ( v9 != 32 )
{
if ( v9 == 8 )
{
result = sub_1006A2FF4(a1, a5);
if ( (_DWORD)result )
return result;
v12 = "NTLM";
goto LABEL_38;
}
goto LABEL_29;
}
result = sub_1006A3310(a1, a5);
if ( (_DWORD)result )
return result;
v12 = "NTLM_WB";
LABEL_38:
v17 = "Server";
if ( v5 )
{
v17 = "Proxy";
v18 = a1[50];
}
else
{
v18 = a1[46];
}
if ( !v18 )
v18 = "";
sub_10067860C(v8, "%s auth using %s with user '%s'\n", v17, v12, v18);
*(_BYTE *)(a2 + 25) = *(_BYTE *)(a2 + 24) ^ 1;
return 0;
}