//
// sub_E327AC from 0xe327ac to 0xe329c0 (532 bytes)
//
// 1 xrefs:
// > lws_service_fd @ 0xe32d50
//
// 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:56 +0000
//
__int64 __fastcall sub_E327AC(__int64 a1, __int64 a2)
{
unsigned int v2; // w2
int v5; // w0
int v6; // w0
_BOOL4 v7; // w20
unsigned int v8; // w0
int v9; // w0
unsigned int v10; // w1
int v11; // w0
unsigned int v12; // w2
__int64 v14; // x3
int v15; // w1
__int64 v16; // [xsp+30h] [xbp+30h] BYREF
int v17; // [xsp+38h] [xbp+38h]
v2 = *(_DWORD *)(a1 + 136);
if ( v2 )
return (unsigned int)((int)sub_E33648(a1, *(_QWORD *)(a1 + 120) + *(unsigned int *)(a1 + 132), v2) >> 31);
v5 = *(unsigned __int8 *)(a1 + 73);
switch ( v5 )
{
case 9:
return (unsigned int)-1;
case 5:
if ( !*(_BYTE *)(a1 + 208) )
{
LABEL_5:
sub_E3A630(a1, 20, 0, 0);
if ( (*(_BYTE *)(a1 + 65) & 1) != 0 )
{
while ( 1 )
{
v16 = 0;
v17 = 0;
v6 = sub_E3A630(a1, 12, &v16, 0);
v7 = v6 != 0;
if ( v6 < 0 )
break;
if ( v17 )
{
v8 = sub_E33648(a1, v16, v17);
if ( (v8 & 0x80000000) != 0 )
return (unsigned int)-1;
if ( v17 != v8 )
{
lws_log(1, "Unable to spill ext %d vs %s\n", v17, (const char *)v8);
return (unsigned int)-1;
}
if ( !v7 )
{
LABEL_13:
*(_BYTE *)(a1 + 65) &= ~1u;
goto LABEL_14;
}
if ( (unsigned int)lws_send_pipe_choked(a1) )
return 0;
}
else if ( !v6 )
{
goto LABEL_13;
}
}
lws_log(1, "ext reports fatal error\n");
return (unsigned int)-1;
}
goto LABEL_14;
}
v14 = (*(_BYTE *)(a1 + 190) & 8) != 0 ? 4LL : 6LL;
break;
case 7:
if ( (*(_BYTE *)(a1 + 190) & 8) == 0 )
{
LABEL_14:
if ( !a2 || (v9 = sub_E331C0(a1, 4, 0), v10 = 1, !v9) )
{
v11 = *(unsigned __int8 *)(a1 + 72);
if ( v11 == 3 )
{
v12 = 11;
}
else if ( v11 == 4 )
{
v12 = 10;
}
else
{
v12 = 16;
}
return (unsigned int)sub_E31DE0(
*(__int64 (__fastcall **)(__int64, _QWORD, __int64, __int64, __int64))(*(_QWORD *)(a1 + 8) + 8LL),
a1,
v12,
*(_QWORD *)(a1 + 144),
0,
0);
}
return v10;
}
v14 = 4;
break;
default:
goto LABEL_5;
}
if ( (lws_write(a1, *(_QWORD *)(a1 + 192) + 24LL, *(unsigned int *)(a1 + 204), v14) & 0x80000000) != 0 )
return (unsigned int)-1;
v15 = *(unsigned __int8 *)(a1 + 190);
*(_BYTE *)(a1 + 208) = 0;
return (unsigned int)(v15 << 28 >> 31);
}