//
// sub_1004F5FD8 from 0x1004f5fd8 to 0x1004f6088 (176 bytes)
//
// 4 xrefs:
// > sub_10044D590 @ 0x10044d5dc
// > sub_10044D590 @ 0x10044d718
// > sub_1004B414C @ 0x1004b4190
// > sub_1004B414C @ 0x1004b41e8
//
// 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_1004F5FD8(int a1, char *a2, int a3, _DWORD *a4)
{
int v5; // w20
ssize_t v8; // x0
*a4 = 0;
if ( !a3 )
return 0;
v5 = a3;
while ( 1 )
{
v8 = recv(a1, a2, v5, 0);
if ( !v8 )
return 16;
if ( v8 == -1 )
break;
*a4 += v8;
a2 += v8;
v5 -= v8;
if ( !v5 )
return 0;
}
if ( *__error() == 35 )
return 45;
if ( *__error() == 54 )
return 16;
return 43;
}