//
// sub_100705F14 from 0x100705f14 to 0x1007060b4 (416 bytes)
//
// 2 xrefs:
// > sub_1006AC468 @ 0x1006ac4d4
// > sub_1006AC468 @ 0x1006ac54c
//
// 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 11:12:51 +0000
//
__int64 __fastcall sub_100705F14(char *a1, __int64 a2)
{
FILE *v4; // x0
FILE *v5; // x19
__int64 v6; // x20
__int64 v7; // x22
int v8; // w0
__n128 v9; // q0
int v10; // w24
int v11; // w0
__n128 v12; // q0
int v13; // w21
stat v15; // [xsp+8h] [xbp-4D8h] BYREF
char __ptr[1024]; // [xsp+98h] [xbp-448h] BYREF
if ( !a1 )
return 0;
if ( stat(a1, &v15) < 0 )
return 0;
sub_100706288(&v15, 144, (__n128)0);
if ( !a2 )
return 0;
v4 = fopen(a1, "rb");
v5 = v4;
if ( !v4 )
return 0;
if ( (v15.st_mode & 0x6000) != 0 )
{
setvbuf(v4, nullptr, 2, 0);
v6 = 0;
if ( a2 == -1 )
a2 = 2048;
}
else
{
v6 = 0;
}
while ( 1 )
{
v7 = a2 >= 1024 ? 1024LL : (unsigned int)a2;
if ( a2 <= 0 )
break;
v8 = fread(__ptr, 1u, (int)v7, v5);
v10 = v8;
if ( v8 >= 1 )
{
v9.n128_f64[0] = (double)v8;
sub_100706288(__ptr, v7, v9);
v6 = (unsigned int)(v10 + v6);
a2 -= (int)v7;
if ( a2 > 0 )
continue;
}
goto LABEL_23;
}
while ( 1 )
{
v11 = fread(__ptr, 1u, 0x400u, v5);
v13 = v11;
if ( v11 < 1 )
break;
v12.n128_f64[0] = (double)v11;
sub_100706288(__ptr, 1024, v12);
v6 = (unsigned int)(v13 + v6);
}
LABEL_23:
fclose(v5);
sub_1006B0510(__ptr, 0x400u);
return v6;
}