//
// sub_84C5BC from 0x84c5bc to 0x84c706 (330 bytes)
//
// 2 xrefs:
// > sub_8247F0 @ 0x8248fc
// > sub_8247F0 @ 0x824a0c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:02:28 +0000
//
int __fastcall sub_84C5BC(_DWORD *a1, int a2)
{
int v3; // r4
char *v4; // r1
int v5; // r4
char *v6; // r2
void **v7; // r7
int *v8; // r6
int v9; // r5
int result; // r0
const char *v11; // r1
const char *v12; // r1
void *p; // [sp+8h] [bp-Ch] BYREF
_DWORD v14[2]; // [sp+Ch] [bp-8h] BYREF
p = nullptr;
v14[0] = 0;
v3 = *a1;
if ( a2 )
{
v4 = (char *)a1[63];
v5 = v3 + 34584;
v6 = (char *)a1[64];
v7 = (void **)(a1 + 171);
v8 = a1 + 195;
*(_BYTE *)(v5 + 12) = 0;
if ( v4 )
goto LABEL_3;
}
else
{
v4 = (char *)a1[94];
v5 = v3 + 34568;
v6 = (char *)a1[95];
v7 = (void **)(a1 + 174);
v8 = a1 + 189;
*(_BYTE *)(v5 + 12) = 0;
if ( v4 )
{
LABEL_3:
if ( v6 )
goto LABEL_4;
goto LABEL_15;
}
}
v4 = &byte_BF4ECA;
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_BF4ECA;
if ( *v8 == 3 )
goto LABEL_16;
LABEL_5:
if ( v9 == 4 )
{
LABEL_17:
off_D200B0(*v7);
result = 0;
*v7 = nullptr;
*(_BYTE *)(v5 + 12) = 1;
return result;
}
if ( v9 == 2 )
{
result = sub_851270(*a1, v4, v6, v8, &p, v14);
if ( !result )
{
if ( !p )
return 0;
off_D200B0(*v7);
if ( a2 )
v12 = "Proxy-";
else
v12 = &byte_BF4ECA;
*v7 = sub_837044("%sAuthorization: NTLM %s\r\n", v12, (const char *)p);
off_D200B0(p);
if ( *v7 )
{
*v8 = 3;
*(_BYTE *)(v5 + 12) = 1;
return 0;
}
return 27;
}
}
else
{
result = sub_8511D4(v4, v6, v8, &p, v14);
if ( !result )
{
if ( !p )
return 0;
off_D200B0(*v7);
v11 = a2 ? "Proxy-" : &byte_BF4ECA;
*v7 = sub_837044("%sAuthorization: NTLM %s\r\n", v11, (const char *)p);
off_D200B0(p);
if ( *v7 )
return 0;
return 27;
}
}
return result;
}