//
// sub_BFB14 from 0xbfb14 to 0xbfb88 (116 bytes)
//
// 1 xrefs:
// > ??> @ 0xbfb12
//
// 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_BFB14(int a1, char *filename, int *a3, int a4)
{
FILE *v6; // r0
FILE *v7; // r6
FILE *v9; // r0
int v10; // r4
int v11; // r0
if ( a4 == 1 )
{
v9 = fopen(filename, "wb");
if ( !v9 )
return 18;
v7 = v9;
LABEL_9:
v10 = 0;
LABEL_10:
*(_DWORD *)(a1 + 4) = v7;
*a3 = v10;
return 0;
}
if ( a4 )
{
v7 = nullptr;
goto LABEL_9;
}
v6 = fopen(filename, "rb");
if ( v6 )
{
v7 = v6;
if ( fseek(v6, 0, 2) )
return 13;
v11 = ftell(v7);
if ( v11 < 0 )
return 13;
v10 = v11;
if ( fseek(v7, 0, 0) )
return 13;
goto LABEL_10;
}
return 18;
}