//
// sub_1000346A4 from 0x1000346a4 to 0x10003474c (168 bytes)
//
// 1 xrefs:
// > sub_10003443C @ 0x100034518
//
// 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 10:57:32 +0000
//
_QWORD *__fastcall sub_1000346A4(_QWORD *a1, unsigned int (__fastcall **a2)(_QWORD, __int64), __int64 a3)
{
__int64 v6; // x8
__int64 v7; // x23
_QWORD *v8; // x25
_QWORD *v9; // x22
__int64 v10; // x24
__int64 v11; // x26
_QWORD *v12; // x25
__int64 v13; // t1
v6 = 0;
v7 = (a3 - 2) / 2;
do
{
v8 = &a1[v6];
v9 = v8 + 1;
v10 = (2 * v6) | 1;
v11 = 2 * v6 + 2;
if ( v11 >= a3 )
{
v6 = (2 * v6) | 1;
}
else
{
v13 = v8[2];
v12 = v8 + 2;
if ( (*a2)(*(v12 - 1), v13) )
{
v9 = v12;
v6 = v11;
}
else
{
v6 = v10;
}
}
*a1 = *v9;
a1 = v9;
}
while ( v6 <= v7 );
return v9;
}