//
// sub_82524C from 0x82524c to 0x825432 (486 bytes)
//
// 3 xrefs:
// > sub_825538 @ 0x82659a
// > sub_84ACE0 @ 0x84b162
// > sub_84BB58 @ 0x84bd1a
//
// 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:01:54 +0000
//
int __fastcall sub_82524C(int *a1, int a2, char **a3)
{
int v4; // r5
int v5; // r11
int i; // r8
const char **j; // r7
const char *v8; // r6
char *v9; // r0
int v10; // r3
char *v11; // r0
int v12; // t1
int v13; // r1
int result; // r0
char *v15; // r0
char *v16; // r2
int v17; // t1
int v18; // r1
int v19; // r3
_DWORD v21[3]; // [sp+20h] [bp-Ch]
v4 = *a1;
if ( a2 )
{
if ( *(_BYTE *)(v4 + 588) )
{
v5 = 1;
v21[0] = *(_DWORD *)(v4 + 580);
goto LABEL_4;
}
}
else if ( *((_BYTE *)a1 + 618) && !*((_BYTE *)a1 + 629) )
{
v5 = 1;
v19 = *(unsigned __int8 *)(v4 + 588);
v21[0] = *(_DWORD *)(v4 + 576);
if ( v19 )
{
v5 = 2;
v21[1] = *(_DWORD *)(v4 + 580);
}
goto LABEL_4;
}
v5 = 1;
v21[0] = *(_DWORD *)(v4 + 576);
LABEL_4:
for ( i = 0; i != v5; ++i )
{
for ( j = (const char **)v21[i]; j; j = (const char **)j[1] )
{
while ( 1 )
{
while ( 1 )
{
v8 = *j;
v9 = strchr(*j, 58);
if ( v9 )
break;
v15 = strchr(v8, 59);
if ( !v15 )
goto LABEL_12;
v16 = v15 + 1;
if ( v15[1] )
{
if ( (*(_BYTE *)((unsigned __int8)v15[1] + ctype_ + 1) & 8) == 0 )
goto LABEL_12;
while ( 1 )
{
v17 = (unsigned __int8)*++v16;
v18 = ctype_ + v17;
if ( !v17 )
break;
if ( (*(_BYTE *)(v18 + 1) & 8) == 0 )
goto LABEL_12;
}
}
if ( *(v16 - 1) != 59 )
goto LABEL_12;
*(v16 - 1) = 58;
result = sub_824FEC(a3, (int)"%s\r\n", *j);
if ( result )
return result;
j = (const char **)j[1];
if ( !j )
goto LABEL_13;
}
v10 = (unsigned __int8)v9[1];
v11 = v9 + 1;
if ( v10 )
break;
LABEL_12:
j = (const char **)j[1];
if ( !j )
goto LABEL_13;
}
if ( (*(_BYTE *)(v10 + ctype_ + 1) & 8) != 0 )
{
do
{
v12 = (unsigned __int8)*++v11;
v13 = ctype_ + v12;
if ( !v12 )
goto LABEL_12;
}
while ( (*(_BYTE *)(v13 + 1) & 8) != 0 );
}
if ( a1[177] )
{
if ( sub_83ACFC("Host:", v8, 5) )
goto LABEL_12;
v8 = *j;
}
if ( *(_DWORD *)(v4 + 636) == 3 )
{
if ( sub_83ACFC("Content-Type:", v8, 13) )
goto LABEL_12;
v8 = *j;
}
if ( *((_BYTE *)a1 + 630) )
{
if ( sub_83ACFC("Content-Length", v8, 14) )
goto LABEL_12;
v8 = *j;
}
if ( a1[180] )
{
if ( sub_83ACFC("Connection", v8, 10) )
goto LABEL_12;
v8 = *j;
}
if ( a1[98] == 20 )
{
if ( !sub_83ACFC("Transfer-Encoding:", v8, 18) )
{
v8 = *j;
goto LABEL_25;
}
goto LABEL_12;
}
LABEL_25:
result = sub_824FEC(a3, (int)"%s\r\n", v8);
if ( result )
return result;
}
LABEL_13:
;
}
return 0;
}