//
// sub_FFB58 from 0xffb58 to 0xffbfc (164 bytes)
//
// 2 xrefs:
// > sub_FF918 @ 0xff9c4
// > sub_FFBFC @ 0xffc30
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:15:11 +0000
//
__int64 __fastcall sub_FFB58(const char *a1, __int64 a2, __int64 a3)
{
int v5; // w0
int v6; // w20
int v7; // w19
int v8; // w0
v5 = open(a1, 0);
if ( v5 < 0 )
{
return (unsigned int)-1;
}
else
{
v6 = v5;
v7 = 0;
while ( v7 < (int)a3 )
{
v8 = read(v6, (void *)(a2 + v7), a3 - v7);
if ( v8 < 0 )
{
if ( *(_DWORD *)__errno() != 4 )
{
if ( !v7 )
v7 = -1;
break;
}
}
else
{
v7 += v8;
if ( !v8 )
break;
}
}
close(v6);
}
return (unsigned int)v7;
}