//
// sub_10020D588 from 0x10020d588 to 0x10020d640 (184 bytes)
//
// 1 xrefs:
// > sub_10020CA70 @ 0x10020d2c4
//
// 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_10020D588(__int64 result, _QWORD *a2, __int64 (__fastcall **a3)(_QWORD *, __int64 *))
{
__int64 v3; // x29
__int64 v4; // x30
_QWORD *v6; // x21
_QWORD *i; // x8
__int64 v9; // x9
__int64 (__fastcall *v10)(_QWORD *, __int64 *); // x8
__int64 v11; // x22
_QWORD *v12; // x23
_QWORD *v13; // x8
__int64 v14; // t1
__int64 (__fastcall *v15)(_QWORD *, __int64 *); // x9
__int64 v16; // [xsp+0h] [xbp-50h] BYREF
_QWORD v17[9]; // [xsp+8h] [xbp-48h] BYREF
if ( (_QWORD *)result != a2 )
{
v17[7] = v3;
v17[8] = v4;
v6 = (_QWORD *)result;
for ( i = (_QWORD *)(result + 8); v6 + 1 != a2; i = v6 + 1 )
{
v17[0] = v6[1];
v9 = *v6;
v6 = i;
v10 = *a3;
v16 = v9;
result = v10(v17, &v16);
if ( (_DWORD)result )
{
v11 = *v6;
v12 = v6;
do
{
v13 = v12;
v14 = *--v12;
*v13 = v14;
v15 = *a3;
v16 = *(v13 - 2);
v17[0] = v11;
result = v15(v17, &v16);
}
while ( (result & 1) != 0 );
*v12 = v11;
}
}
}
return result;
}