//
// sub_100034584 from 0x100034584 to 0x1000346a4 (288 bytes)
//
// 2 xrefs:
// > sub_10003443C @ 0x100034498
// > sub_10003443C @ 0x1000344ec
//
// 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
//
__int64 __fastcall sub_100034584(
__int64 result,
unsigned int (__fastcall **a2)(_QWORD, _QWORD),
__int64 a3,
_QWORD *a4)
{
unsigned __int64 v4; // x9
_QWORD *v5; // x22
__int64 v6; // x21
signed __int64 v7; // x24
__int64 v10; // x8
__int64 v11; // x26
_QWORD *v12; // x25
__int64 v13; // x23
__int64 v14; // x23
_QWORD *v15; // x27
__int64 v16; // x28
v4 = a3 - 2;
if ( a3 >= 2 )
{
v5 = a4;
v6 = result;
v7 = v4 >> 1;
if ( (__int64)(v4 >> 1) >= ((__int64)a4 - result) >> 3 )
{
v10 = ((__int64)a4 - result) >> 2;
v11 = v10 + 1;
v12 = (_QWORD *)(result + 8 * (v10 + 1));
v13 = v10 + 2;
if ( v10 + 2 < a3 && (*a2)(*v12, v12[1]) )
{
++v12;
v11 = v13;
}
result = ((__int64 (__fastcall *)(_QWORD, _QWORD))*a2)(*v12, *v5);
if ( (result & 1) == 0 )
{
v14 = *v5;
do
{
v15 = v12;
*v5 = *v12;
if ( v7 < v11 )
break;
v16 = (2 * v11) | 1;
v12 = (_QWORD *)(v6 + 8 * v16);
if ( 2 * v11 + 2 < a3 )
{
if ( (*a2)(*v12, v12[1]) )
{
++v12;
v16 = 2 * v11 + 2;
}
}
result = ((__int64 (__fastcall *)(_QWORD, __int64))*a2)(*v12, v14);
v5 = v15;
v11 = v16;
}
while ( !(_DWORD)result );
*v15 = v14;
}
}
}
return result;
}