//
// sub_CCB380 from 0xccb380 to 0xccb43c (188 bytes)
//
// 3 xrefs:
// > sub_CCB5F8 @ 0xccb62c
// > sub_CCB5F8 @ 0xccb658
// > sub_CCB6A4 @ 0xccb778
//
// 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_CCB380(const char *a1, __int64 a2, __int64 a3)
{
int v5; // w20
int v6; // w19
void *v7; // x1
int v8; // w0
size_t v9; // x2
int v10; // w0
v5 = open(a1, 0);
if ( v5 < 0 )
return 0xFFFFFFFFLL;
v6 = 0;
while ( 1 )
{
v7 = (void *)(a2 + v6);
v8 = v5;
v9 = a3 - v6;
if ( v6 >= (int)a3 )
break;
while ( 1 )
{
v10 = read(v8, v7, v9);
if ( v10 < 0 )
break;
if ( v10 )
{
v6 += v10;
v8 = v5;
v7 = (void *)(a2 + v6);
v9 = a3 - v6;
if ( v6 < (int)a3 )
continue;
}
goto LABEL_7;
}
if ( *(_DWORD *)__errno() != 4 )
{
if ( !v6 )
v6 = -1;
break;
}
}
LABEL_7:
close(v5);
return (unsigned int)v6;
}