//
// sub_1004E8260 from 0x1004e8260 to 0x1004e8358 (248 bytes)
//
// 1 xrefs:
// > sub_1004E7BFC @ 0x1004e7d64
//
// 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_1004E8260(__int64 a1)
{
__int64 v2; // x8
__int64 result; // x0
int *v4; // x9
int v5; // w8
__int64 v6; // x8
void *v7; // x0
__int64 v8; // x8
unsigned int (__fastcall *v9)(__int64, _QWORD, _QWORD); // x10
v2 = *(_QWORD *)(a1 + 8);
*(_QWORD *)(v2 + 464) = 0;
*(_DWORD *)(v2 + 4104) = 0;
result = sub_10042AA08(*(_QWORD *)(v2 + 120));
v4 = *(int **)a1;
if ( (_DWORD)result )
v5 = 2;
else
v5 = 8;
*v4 = v5;
if ( !(_DWORD)result )
return result;
v6 = *(_QWORD *)(a1 + 8);
if ( !*(_DWORD *)(v6 + 4108) )
{
if ( *(FILE **)(v6 + 112) != __stdinp )
{
v9 = *(unsigned int (__fastcall **)(__int64, _QWORD, _QWORD))(v6 + 8);
if ( !v9 )
goto LABEL_7;
if ( v9(a1, 0, *(_QWORD *)(v6 + 104)) != 1 )
{
v4 = *(int **)a1;
v6 = *(_QWORD *)(a1 + 8);
goto LABEL_7;
}
}
return 0;
}
*(_DWORD *)(v6 + 4108) = 0;
LABEL_7:
*v4 = 0;
*(_DWORD *)(v6 + 472) = 0;
if ( *(_DWORD *)(v6 + 476) )
{
v7 = *(void **)(v6 + 680);
if ( v7 )
{
free(v7);
*(_QWORD *)(*(_QWORD *)(a1 + 8) + 680LL) = 0;
v4 = *(int **)a1;
v6 = *(_QWORD *)(a1 + 8);
*(_DWORD *)(v6 + 476) = 0;
}
}
*(_DWORD *)(v6 + 4104) = v4[6];
*(_QWORD *)(v6 + 456) = 0;
sub_1004E2E24(v6 + 4120);
v8 = *(_QWORD *)(a1 + 8);
*(_QWORD *)(v8 + 6848) = 0;
*(_DWORD *)(v8 + 6864) = 0;
return 1;
}