//
// sub_100030C00 from 0x100030c00 to 0x100030ca8 (168 bytes)
//
// 1 xrefs:
// > sub_100030998 @ 0x100030a74
//
// 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
//
_QWORD *__fastcall sub_100030C00(_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;
}