//
// sub_D39C0 from 0xd39c0 to 0xd3a26 (102 bytes)
//
// 2 xrefs:
// > sub_D3478 @ 0xd34ec
// > sub_D3B70 @ 0xd3b88
//
// 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
//
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;
}