//
// sub_1004067E4 from 0x1004067e4 to 0x100406930 (332 bytes)
//
// 2 xrefs:
// > sub_100406930 @ 0x100406adc
// > sub_100407958 @ 0x100407b50
//
// 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:04:41 +0000
//
__int64 __fastcall sub_1004067E4(int *a1, _QWORD *a2)
{
int v4; // w8
int *v5; // x1
__int64 result; // x0
char v7; // [xsp+Eh] [xbp-22h] BYREF
char v8; // [xsp+Fh] [xbp-21h] BYREF
v4 = a1[257];
if ( v4 > 2067 )
{
if ( v4 == 2068 || v4 == 3607 )
{
sub_10042FDA8(a1, a2);
goto LABEL_22;
}
if ( v4 != 3620 )
goto LABEL_19;
LABEL_15:
if ( a1[366] >= 1 )
sub_10000D038((__int64)a2, a1 + 366);
if ( a1[367] >= 1 )
{
v5 = a1 + 367;
goto LABEL_21;
}
goto LABEL_22;
}
if ( v4 == 1912 )
goto LABEL_15;
if ( v4 != 2063 )
{
LABEL_19:
if ( a1[366] < 1 )
goto LABEL_22;
v5 = a1 + 366;
goto LABEL_21;
}
if ( a1[366] >= 1 )
sub_10000D038((__int64)a2, a1 + 366);
if ( a1[461] >= 1 )
sub_10000D038((__int64)a2, a1 + 461);
if ( a1[462] >= 1 )
{
v5 = a1 + 462;
LABEL_21:
sub_10000D038((__int64)a2, v5);
}
LABEL_22:
std::__sort &,int *>(*a2, a2[1], &v7);
result = sub_100412C74(*a2, a2[1], &v8);
if ( result != a2[1] )
a2[1] = result;
return result;
}