//
// sub_B9FEF0 from 0xb9fef0 to 0xb9ffc8 (216 bytes)
//
// 2 xrefs:
// > sub_B94C64 @ 0xb94e0c
// > sub_BAD638 @ 0xbad728
//
// 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
//
__int64 __fastcall sub_B9FEF0(int a1)
{
__int64 result; // x0
__time_t v3; // x20
__int64 v4; // x1
__int64 v5; // x21
int v6; // w2
int v7; // w1
__time_t v8; // x0
__int64 v9; // x1
int v10; // w0
result = 0;
if ( a1 )
{
if ( a1 < 0 )
{
*(_DWORD *)__errno() = 22;
return 0xFFFFFFFFLL;
}
else
{
v3 = sub_B70B94();
v5 = v4;
v6 = a1;
while ( 1 )
{
v10 = poll(nullptr, 0, v6);
if ( v10 != -1 )
break;
v7 = *(_DWORD *)__errno();
if ( v7 && (v7 != 4 || dword_1247840) )
return 0xFFFFFFFFLL;
v8 = sub_B70B94();
v6 = a1 - sub_B70BFC(v8, v9, v3, v5);
if ( v6 <= 0 )
return 0;
}
if ( v10 )
return 0xFFFFFFFFLL;
else
return 0;
}
}
return result;
}