//
// sub_10066EF00 from 0x10066ef00 to 0x10066f01c (284 bytes)
//
// 1 xrefs:
// > ??> @ 0x1009b0f38
//
// 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:11:06 +0000
//
__int64 __fastcall sub_10066EF00(_QWORD *a1, _BYTE *a2)
{
__int64 v4; // x21
__int64 v5; // x24
const char **v6; // x23
char *v7; // x0
const char *v8; // x22
int v10; // w0
__int64 v12; // x19
int v13; // w0
size_t __n[2]; // [xsp+Ch] [xbp-34h] BYREF
v4 = *a1;
v5 = *(_QWORD *)(*a1 + 536LL);
v6 = (const char **)(*a1 + 35584LL);
v7 = (char *)sub_100687348(*a1, *v6, 0, __n);
v8 = v7;
if ( !v7 )
return 27;
if ( memchr(v7, 0, SLODWORD(__n[0])) )
return 3;
v10 = open(v8, 0);
*(_QWORD *)v5 = v8;
*(_QWORD *)(v5 + 8) = v8;
*(_DWORD *)(v5 + 16) = v10;
if ( v10 == -1 && *(_BYTE *)(v4 + 1313) == 0 )
{
sub_10067889C(v4, "Couldn't open file %s", *v6);
v12 = *(_QWORD *)(*a1 + 536LL);
if ( v12 )
{
off_1009E5FD8(*(void **)(v12 + 8));
*(_QWORD *)v12 = 0;
*(_QWORD *)(v12 + 8) = 0;
v13 = *(_DWORD *)(v12 + 16);
if ( v13 != -1 )
close(v13);
*(_DWORD *)(v12 + 16) = -1;
return 37;
}
else
{
return 37;
}
}
else
{
*a2 = 1;
return 0;
}
}