//
// sub_61D00 from 0x61d00 to 0x61d9c (156 bytes)
//
// 3 xrefs:
// > sub_834C0 @ 0x83500
// > sub_834C0 @ 0x835b0
// > sub_E3964 @ 0xe39a8
//
// 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_61D00(int fd, char *buf, int a3, _DWORD *a4)
{
int v5; // w20
ssize_t v8; // x0
int v10; // w8
unsigned int v11; // w9
v5 = a3;
*a4 = 0;
if ( !a3 )
return 0;
while ( 1 )
{
v8 = recv(fd, buf, v5, 0);
if ( !v8 )
return 16;
if ( v8 == -1 )
break;
v5 -= v8;
buf += v8;
*a4 += v8;
if ( !v5 )
return 0;
}
v10 = *(_DWORD *)__errno();
if ( v10 == 104 )
v11 = 16;
else
v11 = 43;
if ( v10 == 11 )
return 45;
else
return v11;
}