//
// sub_E3433C from 0xe3433c to 0xe34f7c (3136 bytes)
//
// 3 xrefs:
// > sub_E3433C @ 0xe34dd8
// > sub_E36B64 @ 0xe36d44
// > sub_E395A4 @ 0xe3961c
//
// 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:57 +0000
//
__int64 __fastcall sub_E3433C(__int64 a1, unsigned __int8 a2)
{
int v2; // w20
unsigned int v4; // w1
unsigned __int8 *v5; // x21
__int64 v6; // x23
unsigned __int8 *v7; // x22
_BOOL4 v8; // w23
_BOOL4 v9; // w0
int v10; // w1
unsigned int v11; // w2
unsigned int v12; // w0
__int64 v13; // x0
int v15; // w0
int v16; // w20
unsigned __int8 v17; // w0
unsigned int v18; // w1
int v19; // w3
unsigned __int8 *v20; // x2
unsigned int v21; // w2
int v22; // w0
int v23; // w2
__int64 v24; // x1
__int16 v25; // w0
__int64 v26; // x3
int v27; // w5
unsigned __int8 *v28; // x2
unsigned __int8 *v29; // x0
__int64 v30; // x2
unsigned __int8 *v31; // x0
unsigned int v32; // w1
unsigned __int8 *v33; // x0
int v34; // w0
unsigned int v35; // w2
char v36; // w3
unsigned int v37; // w0
int v38; // w3
unsigned __int8 *v39; // x1
__int16 v40; // w2
unsigned __int8 *v41; // x0
char v42; // w1
int v43; // w0
int v44; // w0
unsigned __int8 *v45; // x1
int v46; // w2
unsigned int v47; // w3
unsigned int v48; // w0
unsigned __int8 *v49; // x1
int v50; // w0
unsigned int v51; // w3
unsigned int v52; // w2
__int64 v53; // x0
__int64 v54; // x2
unsigned __int8 *v55; // x0
__int16 v56; // w1
unsigned __int16 v57; // w0
unsigned __int8 *v58; // x21
__int64 v59; // x2
const char *v60; // x0
__int64 v61; // x0
unsigned __int8 *v62; // x21
int v63; // w1
unsigned int v64; // w2
unsigned int v65; // w0
__int64 v66; // x4
unsigned int v67; // w5
__int16 v68; // w1
unsigned __int16 v69; // w0
__int16 v70; // w5
int i; // w2
int v72; // w1
unsigned int v73; // w2
unsigned int v74; // w0
__int64 v75; // x1
int v76; // w0
unsigned int v77; // w2
unsigned int v78; // w1
v2 = a2;
v4 = *(unsigned __int8 *)(a1 + 164);
v5 = *(unsigned __int8 **)(a1 + 152);
v6 = *(_QWORD *)a1;
v7 = v5;
switch ( *(_BYTE *)(a1 + 164) )
{
case 'S':
v15 = v2;
v16 = *(__int16 *)(a1 + 160);
v17 = tolower(v15);
v18 = byte_154A400[v16];
if ( (v18 & 0x80) != 0 )
goto LABEL_35;
if ( v18 == 8 )
goto LABEL_57;
if ( v18 <= 7 )
goto LABEL_37;
v19 = v16 + 3;
v20 = &byte_154A400[v16 + 3];
if ( v17 == v18 )
goto LABEL_114;
while ( 2 )
{
v18 = *v20;
v16 = v19;
if ( (v18 & 0x80) != 0 )
{
LABEL_35:
if ( (v18 & 0x7F) == v17 && byte_154A400[++v16] != 8 )
break;
LABEL_57:
*(_WORD *)(a1 + 160) = -1;
goto LABEL_58;
}
if ( v18 == 8 )
goto LABEL_57;
if ( v18 > 7 )
{
v20 += 3;
if ( v17 != v18 )
{
v19 += 3;
continue;
}
LABEL_114:
LOWORD(v16) = v16 + byte_154A400[v16 + 1] + (byte_154A400[v16 + 2] << 8);
}
break;
}
LABEL_37:
*(_WORD *)(a1 + 160) = v16;
if ( (__int16)v16 < 0 )
{
LABEL_58:
if ( !*(_BYTE *)(a1 + 72) && !v5[4] && !v5[5] && !v5[6] && !v5[78] && !v5[77] && !v5[79] )
return 0xFFFFFFFFLL;
goto LABEL_22;
}
v21 = byte_154A400[(__int16)v16];
if ( v21 > 7 )
return 0;
v22 = byte_154A400[(__int16)v16 + 1] | (v21 << 8);
switch ( v22 )
{
case 0:
if ( !v5[4] )
goto LABEL_46;
goto LABEL_91;
case 1:
if ( !v5[5] )
goto LABEL_46;
LABEL_91:
lws_log(2, "Duplicated method\n");
return 0xFFFFFFFFLL;
case 2:
if ( !v5[6] )
goto LABEL_46;
goto LABEL_91;
case 74:
if ( !v5[78] )
goto LABEL_46;
goto LABEL_91;
case 73:
if ( !v5[77] )
goto LABEL_46;
goto LABEL_91;
case 75:
if ( !v5[79] )
goto LABEL_46;
goto LABEL_91;
}
if ( v22 != 34 )
{
LABEL_46:
v23 = byte_154A400[(__int16)v16 + 1];
*(_BYTE *)(a1 + 164) = v22;
v24 = *(_QWORD *)(v6 + 4608);
if ( !v24 )
{
v25 = 1024;
LABEL_49:
*(_WORD *)(a1 + 162) = v25;
if ( v23 == 8 )
goto LABEL_88;
goto LABEL_50;
}
v22 = (unsigned __int8)v22;
LABEL_48:
v25 = *(_WORD *)(v24 + 2LL * v22);
goto LABEL_49;
}
*(_BYTE *)(a1 + 164) = 6;
v24 = *(_QWORD *)(v6 + 4608);
if ( v24 )
{
v22 = 6;
v23 = 6;
goto LABEL_48;
}
*(_WORD *)(a1 + 162) = 1024;
LABEL_50:
LODWORD(v26) = (unsigned __int8)(*v5 + 1);
*v5 = v26;
LABEL_51:
if ( (_DWORD)v26 != 164 )
{
v27 = *((unsigned __int16 *)v7 + 1);
v28 = &v7[6 * (int)v26];
*(_DWORD *)(v28 + 86) = (unsigned __int16)v27;
v28[90] = 0;
v29 = &v7[*(unsigned __int8 *)(a1 + 164)];
v30 = v29[4];
if ( !v29[4] )
{
v29[4] = v26;
return 0;
}
v31 = &v7[6 * v30];
v32 = v31[90];
if ( v31[90] )
{
do
{
v30 = v32;
v33 = &v7[6 * v32];
v32 = v33[90];
}
while ( v33[90] );
}
v7[6 * v30 + 90] = v26;
if ( v27 != 1024 )
{
*((_WORD *)v7 + 1) = v27 + 1;
v7[v27 + 1070] = 32;
++*(_WORD *)&v7[6 * (int)v26 + 88];
return 0;
}
goto LABEL_182;
}
lws_log(2, "More hdr frags than we can deal with\n");
return 0xFFFFFFFFLL;
case 'T':
if ( v2 != 13 )
return 0;
*(_BYTE *)(a1 + 164) = 85;
return 0;
case 'U':
if ( v2 != 10 )
goto LABEL_22;
*(_WORD *)(a1 + 160) = 0;
*(_BYTE *)(a1 + 164) = 83;
return 0;
case 'V':
return 0;
default:
v8 = v2 == 32;
if ( v2 == 32 && !*(_WORD *)&v5[6 * v5[*(unsigned __int8 *)(a1 + 164) + 4] + 88] )
return 0;
if ( v4 > 2 && v4 != 74 && v4 != 73 && v4 != 75 )
{
LABEL_8:
v9 = v2 == 13 && v4 != 8;
LABEL_9:
if ( v9 )
{
v2 = 0;
*(_BYTE *)(a1 + 164) = 85;
}
LABEL_11:
v10 = *((unsigned __int16 *)v5 + 1);
if ( v10 != 1024 )
{
v11 = *(unsigned __int16 *)(a1 + 162);
v12 = *(unsigned __int16 *)&v5[6 * *v5 + 88];
if ( v12 >= v11 )
{
if ( v12 == v11 )
{
*((_WORD *)v5 + 1) = v10 + 1;
v5[v10 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
}
LABEL_22:
*(_BYTE *)(a1 + 164) = 84;
return 0;
}
*((_WORD *)v5 + 1) = v10 + 1;
v5[v10 + 1070] = v2;
if ( v2 )
{
v13 = *(_QWORD *)(a1 + 152) + 6LL * **(unsigned __int8 **)(a1 + 152);
++*(_WORD *)(v13 + 88);
}
LABEL_15:
v4 = *(unsigned __int8 *)(a1 + 164);
LABEL_87:
if ( v4 != 8 )
return 0;
LABEL_88:
if ( (unsigned int)lws_hdr_total_length(a1, 5u) && (unsigned int)lws_hdr_total_length(a1, 0x21u) )
{
v59 = *(_QWORD *)(a1 + 152);
v60 = nullptr;
if ( *(_BYTE *)(v59 + 37) )
v60 = (const char *)(v59 + *(unsigned __int16 *)(v59 + 6LL * *(unsigned __int8 *)(v59 + 37) + 86) + 1070);
*(_BYTE *)(a1 + 66) = atoi(v60);
}
v42 = *(_BYTE *)(a1 + 76);
*(_BYTE *)(a1 + 164) = 86;
*(_BYTE *)(a1 + 76) = v42 | 1;
return 0;
}
goto LABEL_182;
}
if ( v2 == 32 )
{
if ( *(_WORD *)&v5[6 * *v5 + 88] )
{
v45 = *(unsigned __int8 **)(a1 + 152);
}
else
{
v44 = *((unsigned __int16 *)v5 + 1);
if ( v44 == 1024 )
goto LABEL_182;
if ( *(_WORD *)(a1 + 162) )
{
*((_WORD *)v5 + 1) = v44 + 1;
v5[v44 + 1070] = 47;
v61 = *(_QWORD *)(a1 + 152) + 6LL * **(unsigned __int8 **)(a1 + 152);
++*(_WORD *)(v61 + 88);
}
else
{
*((_WORD *)v5 + 1) = v44 + 1;
v5[v44 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
}
v45 = *(unsigned __int8 **)(a1 + 152);
}
v46 = *((unsigned __int16 *)v45 + 1);
if ( v46 != 1024 )
{
v47 = *(unsigned __int16 *)(a1 + 162);
v48 = *(unsigned __int16 *)&v45[6 * *v45 + 88];
if ( v48 >= v47 )
{
if ( v48 == v47 )
{
*((_WORD *)v45 + 1) = v46 + 1;
v45[v46 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
}
}
else
{
*((_WORD *)v45 + 1) = v46 + 1;
v45[v46 + 1070] = 0;
}
*(_BYTE *)(a1 + 164) = 15;
goto LABEL_50;
}
LABEL_182:
lws_log(2, "excessive header content\n");
return 0xFFFFFFFFLL;
}
v34 = *(_DWORD *)(a1 + 172);
if ( v34 == 1 )
{
if ( (unsigned __int8)(v2 - 48) <= 9u || (unsigned __int8)((v2 & 0xDF) - 65) <= 5u )
{
*(_BYTE *)(a1 + 176) = v2;
*(_DWORD *)(a1 + 172) = 2;
goto LABEL_87;
}
v76 = *((unsigned __int16 *)v5 + 1);
if ( v76 == 1024 )
goto LABEL_182;
v77 = *(unsigned __int16 *)(a1 + 162);
v78 = *(unsigned __int16 *)&v5[6 * *v5 + 88];
if ( v78 >= v77 )
{
if ( v78 == v77 )
{
*((_WORD *)v5 + 1) = v76 + 1;
v5[(unsigned __int16)v76 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
*(_DWORD *)(a1 + 172) = 0;
goto LABEL_125;
}
}
else
{
*((_WORD *)v5 + 1) = v76 + 1;
v5[v76 + 1070] = 37;
++*(_WORD *)(*(_QWORD *)(a1 + 152) + 6LL * **(unsigned __int8 **)(a1 + 152) + 88);
}
*(_DWORD *)(a1 + 172) = 0;
goto LABEL_125;
}
if ( !v34 )
{
if ( v2 == 37 )
{
*(_DWORD *)(a1 + 172) = 1;
goto LABEL_87;
}
goto LABEL_125;
}
if ( v34 != 2 )
goto LABEL_125;
v35 = (unsigned __int8)(v2 - 48);
if ( v35 > 9 )
{
if ( (unsigned __int8)(v2 - 97) > 5u )
{
if ( (unsigned __int8)(v2 - 65) <= 5u )
{
LOBYTE(v35) = v2 - 55;
goto LABEL_74;
}
v72 = *((unsigned __int16 *)v5 + 1);
if ( v72 == 1024 )
{
lws_log(2, "excessive header content\n");
}
else
{
v73 = *(unsigned __int16 *)(a1 + 162);
v74 = *(unsigned __int16 *)&v5[6 * *v5 + 88];
if ( v74 >= v73 )
{
if ( v74 == v73 )
{
*((_WORD *)v5 + 1) = v72 + 1;
v5[(unsigned __int16)v72 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
}
}
else
{
*((_WORD *)v5 + 1) = v72 + 1;
v5[v72 + 1070] = 37;
++*(_WORD *)(*(_QWORD *)(a1 + 152) + 6LL * **(unsigned __int8 **)(a1 + 152) + 88);
}
}
v75 = *(unsigned __int8 *)(a1 + 176);
*(_DWORD *)(a1 + 172) = 0;
if ( (sub_E3433C(a1, v75) & 0x80000000) != 0 )
return 0xFFFFFFFFLL;
LABEL_125:
switch ( *(_DWORD *)(a1 + 168) )
{
case 0:
v8 = 1;
if ( v2 != 38 )
{
LABEL_111:
if ( v2 != 47 )
goto LABEL_82;
v43 = v5[80];
v5 = *(unsigned __int8 **)(a1 + 152);
if ( !v43 )
*(_DWORD *)(a1 + 168) = 1;
goto LABEL_11;
}
v49 = *(unsigned __int8 **)(a1 + 152);
v50 = *((unsigned __int16 *)v49 + 1);
if ( v50 == 1024 )
{
lws_log(2, "excessive header content\n");
}
else
{
v51 = *(unsigned __int16 *)(a1 + 162);
v52 = *(unsigned __int16 *)&v49[6 * *v49 + 88];
if ( v52 >= v51 )
{
if ( v52 == v51 )
{
*((_WORD *)v49 + 1) = v50 + 1;
v49[(unsigned __int16)v50 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
}
}
else
{
*((_WORD *)v49 + 1) = v50 + 1;
v49[v50 + 1070] = 38;
v53 = *(_QWORD *)(a1 + 152) + 6LL * **(unsigned __int8 **)(a1 + 152);
++*(_WORD *)(v53 + 88);
}
}
v54 = *v5;
v55 = &v5[6 * v54];
v26 = (unsigned __int8)(v54 + 1);
v56 = *((_WORD *)v55 + 44);
v55[90] = v26;
*((_WORD *)v55 + 44) = v56 - 1;
*v5 = v26;
if ( (unsigned int)v26 <= 0xA3 )
{
v57 = *((_WORD *)v5 + 1);
v58 = &v5[6 * v26];
*(_DWORD *)(v58 + 86) = v57;
v58[90] = 0;
v4 = *(unsigned __int8 *)(a1 + 164);
goto LABEL_87;
}
goto LABEL_51;
case 1:
v8 = 1;
LABEL_105:
if ( v2 == 47 )
goto LABEL_15;
if ( v2 != 46 )
{
*(_DWORD *)(a1 + 168) = 0;
goto LABEL_82;
}
v4 = *(unsigned __int8 *)(a1 + 164);
*(_DWORD *)(a1 + 168) = 2;
goto LABEL_87;
case 2:
v8 = 1;
LABEL_101:
if ( v2 == 46 )
{
v66 = *v5;
v67 = *(unsigned __int16 *)&v5[6 * v66 + 88];
if ( v67 > 2 )
{
v68 = *((_WORD *)v5 + 1);
v69 = v67 - 2;
*((_WORD *)v5 + 1) = v68 - 1;
*(_WORD *)&v5[6 * v66 + 88] = v67 - 1;
v70 = v68 - v67;
for ( i = v69; i != 1 && v5[(unsigned __int16)(i + v70) + 1070] != 47; i = (unsigned __int16)(i - 1) )
;
*((_WORD *)v5 + 1) = i + v70;
*(_WORD *)&v5[6 * v66 + 88] = i;
}
v4 = *(unsigned __int8 *)(a1 + 164);
*(_DWORD *)(a1 + 168) = 3;
goto LABEL_87;
}
if ( v2 == 47 )
{
v4 = *(unsigned __int8 *)(a1 + 164);
*(_DWORD *)(a1 + 168) = 1;
goto LABEL_87;
}
v62 = *(unsigned __int8 **)(a1 + 152);
*(_DWORD *)(a1 + 168) = 0;
v63 = *((unsigned __int16 *)v62 + 1);
if ( v63 == 1024 )
goto LABEL_182;
v64 = *(unsigned __int16 *)(a1 + 162);
v65 = *(unsigned __int16 *)&v62[6 * *v62 + 88];
if ( v65 >= v64 )
{
if ( v65 == v64 )
{
*((_WORD *)v62 + 1) = v63 + 1;
v62[(unsigned __int16)v63 + 1070] = 0;
lws_log(2, "header %i exceeds limit\n", *(unsigned __int8 *)(a1 + 164));
}
}
else
{
*((_WORD *)v62 + 1) = v63 + 1;
v62[v63 + 1070] = 46;
++*(_WORD *)(*(_QWORD *)(a1 + 152) + 6LL * **(unsigned __int8 **)(a1 + 152) + 88);
}
LABEL_82:
if ( v2 != 63 || !v8 )
{
v5 = *(unsigned __int8 **)(a1 + 152);
v9 = v2 == 13 && *(_BYTE *)(a1 + 164) != 8;
goto LABEL_9;
}
if ( v7[80] )
{
v5 = *(unsigned __int8 **)(a1 + 152);
v2 = 63;
goto LABEL_11;
}
v39 = &v7[*((unsigned __int16 *)v7 + 1)];
v40 = *((_WORD *)v7 + 1) + 1;
*((_WORD *)v7 + 1) = v40;
v39[1070] = 0;
LODWORD(v26) = (unsigned __int8)(*v7 + 1);
*v7 = v26;
if ( (unsigned int)v26 > 0xA3 )
goto LABEL_51;
v41 = &v7[6 * (int)v26];
*((_WORD *)v41 + 43) = v40;
*((_WORD *)v41 + 44) = 0;
v41[90] = 0;
v7[80] = v26;
*(_DWORD *)(a1 + 168) = 0;
v4 = *(unsigned __int8 *)(a1 + 164);
break;
case 3:
v8 = 1;
LABEL_109:
if ( (unsigned __int8)(v2 - 46) <= 1u )
goto LABEL_15;
*(_DWORD *)(a1 + 168) = 1;
goto LABEL_82;
default:
v8 = 1;
goto LABEL_82;
}
goto LABEL_87;
}
LOBYTE(v35) = v2 - 87;
}
LABEL_74:
v36 = *(_BYTE *)(a1 + 176);
v37 = (unsigned __int8)(v36 - 48);
if ( v37 > 9 )
{
if ( (unsigned __int8)(v36 - 97) <= 5u )
{
LOBYTE(v37) = v36 - 87;
}
else if ( (unsigned __int8)(v36 - 65) > 5u )
{
LOBYTE(v37) = -1;
}
else
{
LOBYTE(v37) = v36 - 55;
}
}
v38 = *(_DWORD *)(a1 + 168);
*(_DWORD *)(a1 + 172) = 0;
v2 = (unsigned __int8)(v35 | (16 * v37));
switch ( v38 )
{
case 0:
goto LABEL_111;
case 1:
goto LABEL_105;
case 2:
goto LABEL_101;
case 3:
goto LABEL_109;
default:
goto LABEL_8;
}
}
}