//
// sub_1000303E8 from 0x1000303e8 to 0x10003047c (148 bytes)
//
// 1 xrefs:
// > sub_10002FB2C @ 0x100030190
//
// 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_1000303E8(__int64 result, _QWORD *a2, __int64 (__fastcall **a3)(__int64, __int64))
{
_QWORD *v4; // x21
_QWORD *i; // x8
__int64 v7; // x0
__int64 v8; // x1
__int64 v9; // x22
_QWORD *v10; // x23
_QWORD *v11; // x8
__int64 v12; // t1
if ( (_QWORD *)result != a2 )
{
v4 = (_QWORD *)result;
for ( i = (_QWORD *)(result + 8); v4 + 1 != a2; i = v4 + 1 )
{
v8 = *v4;
v7 = v4[1];
v4 = i;
result = (*a3)(v7, v8);
if ( (_DWORD)result )
{
v9 = *v4;
v10 = v4;
do
{
v11 = v10;
v12 = *--v10;
*v11 = v12;
result = (*a3)(v9, *(v11 - 2));
}
while ( (result & 1) != 0 );
*v10 = v9;
}
}
}
return result;
}