//
// sub_E09CE0 from 0xe09ce0 to 0xe0a458 (1912 bytes)
//
// 3 xrefs:
// > sub_E1251C @ 0xe136ac
// > sub_E1251C @ 0xe13754
// > sub_E1251C @ 0xe137b4
//
// 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 13:09:35 +0000
//
__int64 __fastcall sub_E09CE0(__int64 a1, char *s, int a3)
{
const char *v6; // x0
char *v7; // x25
char *v8; // x0
int v9; // w19
bool v10; // zf
const char *v11; // x0
const char *v12; // x27
char *v13; // x0
char *v14; // x0
char *v15; // x0
char *v16; // x20
int v17; // w3
char *v18; // x0
int v19; // w1
__int64 v20; // x21
int v21; // t1
size_t v22; // x19
char *v23; // x0
const char *v24; // x28
int v25; // w3
char *v26; // x19
int v27; // w21
__int64 v28; // x7
__int64 v29; // x6
__int64 v30; // x5
__int64 v31; // x4
int v32; // t1
int v33; // t1
__int64 v34; // x19
int v35; // w0
char *v37; // x0
__int64 v38; // x2
__int64 v39; // x1
int v40; // w0
char *v41; // x0
int v42; // w1
size_t v43; // x0
char *v44; // x2
int v45; // w3
__int64 v46; // x0
int v47; // t1
const char *v48; // x0
int v49; // w3
char *v50; // x19
char *v51; // x20
int v52; // w21
__int64 v53; // x6
__int64 v54; // x5
__int64 v55; // x4
int v56; // t1
int v57; // w0
int v58; // w19
int v59; // t1
char *v60; // x0
int v61; // w0
const char *v62; // x2
int v63; // t1
char *v64; // x0
char *v65; // x20
char *v66; // x0
char *v67; // x0
__int64 v68; // [xsp+60h] [xbp+60h]
__int64 v69; // [xsp+68h] [xbp+68h]
__int64 v70; // [xsp+68h] [xbp+68h]
__int64 v71; // [xsp+70h] [xbp+70h]
__int64 v72; // [xsp+70h] [xbp+70h]
__int64 v73; // [xsp+78h] [xbp+78h]
__int64 v74; // [xsp+78h] [xbp+78h]
char v75; // [xsp+87h] [xbp+87h] BYREF
char v76; // [xsp+88h] [xbp+88h] BYREF
if ( a3 != 3 )
goto LABEL_2;
v38 = *(_QWORD *)(a1 + 640);
v39 = *(_QWORD *)(a1 + 632);
if ( v38 != -1 && v38 <= v39 )
{
sub_DF1848(a1, "Maximum (%ld) redirects followed", v38);
return 47;
}
v40 = *(unsigned __int8 *)(a1 + 1567);
*(_BYTE *)(a1 + 35608) = 1;
*(_QWORD *)(a1 + 632) = v39 + 1;
if ( v40 )
{
if ( *(_BYTE *)(a1 + 2336) )
{
off_154A3C8(*(void **)(a1 + 2328));
*(_QWORD *)(a1 + 2328) = 0;
*(_BYTE *)(a1 + 2336) = 0;
}
v41 = off_154A3D8(*(const char **)(a1 + 2312));
*(_QWORD *)(a1 + 2328) = v41;
if ( !v41 )
return 27;
*(_BYTE *)(a1 + 2336) = 1;
if ( sscanf(s, "%15[^?&/:]://%c", &v76, &v75) == 2 )
goto LABEL_63;
}
else
{
LABEL_2:
if ( sscanf(s, "%15[^?&/:]://%c", &v76, &v75) == 2 )
{
LABEL_63:
v42 = (unsigned __int8)*s;
v43 = 1;
if ( *s )
{
v44 = s;
v45 = 1;
v46 = 0;
do
{
if ( v42 == 32 )
{
if ( v45 )
v46 += 3;
else
++v46;
}
else
{
if ( v42 == 63 )
{
v45 = 0;
}
else if ( (v42 & 0x80u) != 0 )
{
v46 += 2;
}
++v46;
}
v47 = (unsigned __int8)*++v44;
v42 = v47;
}
while ( v47 );
v43 = v46 + 1;
}
v48 = (const char *)off_154A3C0(v43);
v24 = v48;
if ( v48 )
{
v49 = (unsigned __int8)*s;
if ( *s )
{
v50 = (char *)v48;
v51 = s;
v52 = 1;
v53 = 43;
v54 = 37;
v55 = 50;
while ( 1 )
{
while ( v49 != 32 )
{
if ( v49 == 63 )
{
v52 = 0;
}
else if ( (v49 & 0x80) != 0 )
{
v64 = v50;
v70 = v55;
v72 = v54;
v50 += 3;
v74 = v53;
sub_E02430(v64, 4, "%%%02x", v49);
v53 = v74;
v54 = v72;
v55 = v70;
goto LABEL_77;
}
*v50++ = v49;
LABEL_77:
v56 = (unsigned __int8)*++v51;
v49 = v56;
if ( !v56 )
goto LABEL_111;
}
if ( !v52 )
{
*v50++ = v53;
goto LABEL_77;
}
*v50 = v54;
v50 += 3;
*(v50 - 2) = v55;
*(v50 - 1) = 48;
v63 = (unsigned __int8)*++v51;
v49 = v63;
if ( !v63 )
goto LABEL_111;
}
}
v50 = (char *)v48;
LABEL_111:
*v50 = 0;
off_154A3C8(s);
if ( a3 != 1 )
{
v34 = a1 + 0x8000;
*(_BYTE *)(a1 + 35696) = 0;
LABEL_40:
if ( *(_BYTE *)(a1 + 2320) )
off_154A3C8(*(void **)(a1 + 2312));
*(_BYTE *)(a1 + 2320) = 1;
*(_QWORD *)(a1 + 2312) = v24;
sub_DF16E0(a1, "Issue another request to this URL: '%s'\n", v24);
v35 = *(_DWORD *)(v34 + 3432);
if ( v35 == 302 )
{
if ( (unsigned int)(*(_DWORD *)(a1 + 1072) - 2) > 1 || (*(_DWORD *)(a1 + 648) & 2) != 0 )
goto LABEL_45;
}
else
{
if ( v35 == 303 )
{
if ( *(_DWORD *)(a1 + 1072) != 1 && (*(_DWORD *)(a1 + 648) & 4) == 0 )
{
v61 = *(unsigned __int8 *)(a1 + 1568);
*(_DWORD *)(a1 + 1072) = 1;
if ( v61 )
v62 = "HEAD";
else
v62 = "GET";
sub_DF16E0(a1, "Disables POST, goes with %s\n", v62);
}
goto LABEL_45;
}
if ( v35 != 301 || (unsigned int)(*(_DWORD *)(a1 + 1072) - 2) > 1 || (*(_DWORD *)(a1 + 648) & 1) != 0 )
{
LABEL_45:
sub_DE82A4(a1, 10);
sub_DE8278(a1);
return 0;
}
}
sub_DF16E0(a1, "Switch from POST to GET\n");
*(_DWORD *)(a1 + 1072) = 1;
goto LABEL_45;
}
goto LABEL_121;
}
return 27;
}
}
v6 = off_154A3D8(*(const char **)(a1 + 2312));
v7 = (char *)v6;
if ( !v6 )
return 27;
v8 = strstr(v6, "//");
v9 = (unsigned __int8)*s;
v10 = v8 == nullptr;
v11 = v8 + 2;
if ( v10 )
v12 = v7;
else
v12 = v11;
if ( v9 == 47 )
{
if ( s[1] == 47 )
{
*v12 = 0;
v16 = s + 2;
v17 = (unsigned __int8)s[2];
}
else
{
v65 = strchr(v12, 47);
if ( v65 )
{
v66 = strchr(v12, 63);
if ( v65 <= v66 || !v66 )
v66 = v65;
*v66 = 0;
v16 = s;
v17 = (unsigned __int8)*s;
}
else
{
v67 = strchr(v12, 63);
if ( !v67 )
{
v16 = s;
v17 = 47;
goto LABEL_18;
}
*v67 = 0;
v16 = s;
v17 = (unsigned __int8)*s;
}
}
goto LABEL_17;
}
v13 = strchr(v12, 63);
if ( v13 )
{
*v13 = 0;
v9 = (unsigned __int8)*s;
}
if ( v9 == 63 )
{
v15 = strchr(v12, 47);
if ( v15 )
goto LABEL_14;
LABEL_107:
v16 = s;
LABEL_108:
v17 = (unsigned __int8)*v16;
v12 = nullptr;
goto LABEL_17;
}
v14 = strrchr(v12, 47);
if ( v14 )
{
*v14 = 0;
v9 = (unsigned __int8)*s;
}
v15 = strchr(v12, 47);
if ( !v15 )
{
v12 = nullptr;
if ( v9 == 46 )
goto LABEL_87;
goto LABEL_107;
}
LABEL_14:
v12 = v15 + 1;
v16 = s;
if ( v9 != 46 )
goto LABEL_15;
LABEL_87:
v57 = (unsigned __int8)s[1];
v16 = s;
if ( v57 == 47 )
{
v16 = s + 2;
if ( s[2] != 46 )
goto LABEL_15;
v57 = (unsigned __int8)s[3];
}
if ( v57 != 46 || v16[2] != 47 )
{
LABEL_15:
if ( v12 )
{
LABEL_16:
v17 = (unsigned __int8)*v16;
goto LABEL_17;
}
goto LABEL_108;
}
v58 = 0;
do
{
v59 = (unsigned __int8)v16[3];
v16 += 3;
++v58;
}
while ( v59 == 46 && v16[1] == 46 && v16[2] == 47 );
if ( !v12 )
goto LABEL_108;
while ( 1 )
{
v60 = strrchr(v12, 47);
if ( !v60 )
break;
*v60 = 0;
if ( !--v58 )
goto LABEL_16;
}
*v12 = 0;
v17 = (unsigned __int8)*v16;
LABEL_17:
if ( !v17 )
{
v20 = 0;
goto LABEL_25;
}
LABEL_18:
v18 = v16;
v19 = 1;
v20 = 0;
do
{
if ( v17 == 32 )
{
if ( v19 )
v20 += 3;
else
++v20;
}
else
{
if ( v17 == 63 )
{
v19 = 0;
}
else if ( (v17 & 0x80u) != 0 )
{
v20 += 2;
}
++v20;
}
v21 = (unsigned __int8)*++v18;
v17 = v21;
}
while ( v21 );
LABEL_25:
v22 = strlen(v7);
v23 = (char *)off_154A3C0(v20 + v22 + 2);
v24 = v23;
if ( !v23 )
{
off_154A3C8(v7);
return 27;
}
memcpy(v23, v7, v22);
v25 = (unsigned __int8)*v16;
if ( v25 == 47 )
goto LABEL_48;
if ( !v12 || *v12 )
{
if ( v25 != 63 )
{
v24[v22++] = 47;
v25 = (unsigned __int8)*v16;
goto LABEL_29;
}
LABEL_48:
v26 = (char *)&v24[v22];
goto LABEL_30;
}
LABEL_29:
v26 = (char *)&v24[v22];
if ( v25 )
{
LABEL_30:
v27 = 1;
v28 = 43;
v29 = 37;
v30 = 50;
v31 = 48;
do
{
while ( v25 != 32 )
{
if ( v25 == 63 )
{
v27 = 0;
}
else if ( (v25 & 0x80) != 0 )
{
v37 = v26;
v68 = v31;
v69 = v30;
v26 += 3;
v71 = v29;
v73 = v28;
sub_E02430(v37, 4, "%%%02x", v25);
v28 = v73;
v29 = v71;
v30 = v69;
v31 = v68;
goto LABEL_34;
}
*v26++ = v25;
LABEL_34:
v32 = (unsigned __int8)*++v16;
v25 = v32;
if ( !v32 )
goto LABEL_38;
}
if ( !v27 )
{
*v26++ = v28;
goto LABEL_34;
}
*v26 = v29;
v26 += 3;
*(v26 - 2) = v30;
*(v26 - 1) = v31;
v33 = (unsigned __int8)*++v16;
v25 = v33;
}
while ( v33 );
}
LABEL_38:
*v26 = 0;
off_154A3C8(v7);
off_154A3C8(s);
if ( a3 != 1 )
{
v34 = a1 + 0x8000;
goto LABEL_40;
}
LABEL_121:
*(_QWORD *)(a1 + 36280) = v24;
return 0;
}