//
// sub_E8BCCC from 0xe8bccc to 0xe8bd8c (192 bytes)
//
// 2 xrefs:
// > sub_E8BD8C @ 0xe8bdd8
// > sub_E8BD8C @ 0xe8be20
//
// 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_E8BCCC(
__int64 result,
__int64 (__fastcall *a2)(__int64, _QWORD, _QWORD),
__int64 a3,
int a4,
int a5)
{
__int64 v5; // x24
int i; // w19
int v10; // w0
__int64 v11; // x21
__int64 v12; // x0
int v13; // [xsp+58h] [xbp+58h]
v5 = result;
for ( i = 2 * a4 + 1; i < a5; i = result + 1 )
{
if ( i + 1 < a5 )
{
v13 = a4;
v10 = a2(v5, *(_QWORD *)(a3 + 8LL * i), *(_QWORD *)(a3 + 8LL * i + 8));
a4 = v13;
if ( v10 < 0 )
++i;
}
v11 = 8LL * a4;
result = a2(v5, *(_QWORD *)(a3 + v11), *(_QWORD *)(a3 + 8LL * i));
if ( (result & 0x80000000) == 0 )
break;
a4 = i;
v12 = *(_QWORD *)(a3 + v11);
*(_QWORD *)(a3 + v11) = *(_QWORD *)(a3 + 8LL * i);
*(_QWORD *)(a3 + 8LL * i) = v12;
result = (unsigned int)(2 * i);
}
return result;
}