//
// sub_1004F5E24 from 0x1004f5e24 to 0x1004f5f00 (220 bytes)
//
// 1 xrefs:
// > sub_100428538 @ 0x100428580
//
// 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_1004F5E24(int a1, int a2, _QWORD *a3)
{
int v5; // w0
int v6; // w20
int v7; // w0
int v8; // w9
int v10; // [xsp+Ch] [xbp-24h] BYREF
v5 = accept(a1, nullptr, nullptr);
if ( v5 == -1 )
{
if ( *__error() == 35 )
return 45;
else
return 43;
}
else
{
v6 = v5;
v7 = fcntl(v5, 3);
if ( v7 == -1 )
return 43;
v8 = a2 ? 4 : 0;
if ( fcntl(v6, 4, v7 & 0xFFFFFFFB | v8) == -1 )
return 43;
v10 = 1;
if ( setsockopt(v6, 0xFFFF, 4130, &v10, 4u) == -1 )
{
return 43;
}
else
{
*a3 = v6;
return 0;
}
}
}