//
// sub_D39C0 from 0xd39c0 to 0xd3a26 (102 bytes)
//
// 2 xrefs:
// > sub_D3478 @ 0xd34ec
// > sub_D3B70 @ 0xd3b88
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:42:00 +0000
//
int __fastcall sub_D39C0(const char *a1, int a2, int a3)
{
int v5; // r0
int v6; // r9
int v7; // r4
ssize_t v8; // r0
int v9; // r1
v5 = open(a1, 0);
if ( v5 < 0 )
return -1;
v6 = v5;
v7 = 0;
while ( v7 < a3 )
{
v8 = read(v6, (void *)(a2 + v7), a3 - v7);
if ( v8 > -1 )
{
v7 += v8;
if ( !v8 )
break;
}
else if ( *(_DWORD *)_errno(v8, v9) != 4 )
{
if ( !v7 )
v7 = -1;
break;
}
}
close(v6);
return v7;
}