//
// lws_plat_service from 0xe3896c to 0xe38aec (384 bytes)
//
// 2 xrefs:
// > lws_service @ 0xe32f2c
// > ??> @ 0xa1b48
//
// 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:59 +0000
//
__int64 __fastcall lws_plat_service(__int64 a1, int a2)
{
int v4; // w3
nfds_t v5; // x1
struct pollfd *v6; // x0
int v7; // w0
int v8; // w4
int v9; // w19
int v10; // w0
__int64 v11; // x1
int v12; // w3
char buf; // [xsp+3Fh] [xbp+3Fh] BYREF
if ( !a1 )
return 1;
v4 = (*(__int64 (__fastcall **)(_QWORD, __int64, _QWORD, _QWORD, _QWORD))(*(_QWORD *)(a1 + 4584) + 8LL))(
0,
31,
0,
0,
0);
v5 = *(unsigned int *)(a1 + 16);
v6 = *(struct pollfd **)a1;
*(_DWORD *)(a1 + 4560) = v4;
v7 = poll(v6, v5, a2);
*(_DWORD *)(a1 + 4560) = 0;
if ( !v7 )
{
lws_service_fd(a1, 0);
return 0;
}
if ( v7 >= 0 )
{
v8 = *(_DWORD *)(a1 + 16);
v9 = 0;
if ( v8 <= 0 )
return 0;
while ( 1 )
{
v11 = *(_QWORD *)a1 + 8LL * v9;
if ( !*(_WORD *)(v11 + 6) )
goto LABEL_9;
v12 = *(_DWORD *)(*(_QWORD *)a1 + 8LL * v9);
if ( v12 == *(_DWORD *)(a1 + 4564) )
{
if ( read(v12, &buf, 1u) != 1 )
lws_log(1, "Cannot read from dummy pipe.");
v8 = *(_DWORD *)(a1 + 16);
if ( ++v9 >= v8 )
return 0;
}
else
{
v10 = lws_service_fd(a1, v11);
if ( v10 < 0 )
return 0xFFFFFFFFLL;
v8 = *(_DWORD *)(a1 + 16);
if ( v10 )
--v9;
LABEL_9:
if ( ++v9 >= v8 )
return 0;
}
}
}
if ( *(_DWORD *)__errno() == 4 )
return 0;
else
return 0xFFFFFFFFLL;
}