//
// lws_send_pipe_choked from 0x64be98 to 0x64bed6 (62 bytes)
//
// 3 xrefs:
// > sub_6470B0 @ 0x6471fc
// > lws_serve_http_file_fragment @ 0x64805c
// > sub_64C778 @ 0x64c808
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
unsigned int __fastcall lws_send_pipe_choked(int a1)
{
unsigned int result; // r0
int v2; // r4
int v3; // r0
bool v4; // zf
struct pollfd v5; // [sp+0h] [bp-10h] BYREF
if ( *(_DWORD *)(a1 + 256) )
return 1;
v2 = *(_DWORD *)(a1 + 228);
v5.revents = 0;
v5.fd = v2;
v5.events = 4;
v3 = poll(&v5, 1u, 0);
v4 = v3 == 1;
if ( v3 == 1 )
result = (unsigned __int16)v5.revents;
else
result = 1;
if ( v4 )
return ((result ^ 4) >> 2) & 1;
return result;
}