//
// sub_10020D4A4 from 0x10020d4a4 to 0x10020d588 (228 bytes)
//
// 1 xrefs:
// > sub_10020CA70 @ 0x10020d23c
//
// 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_10020D4A4(__int64 result, __int64 *a2, __int64 (__fastcall **a3)(_QWORD *, __int64 *))
{
__int64 v3; // x29
__int64 v4; // x30
_QWORD *v6; // x21
__int64 *v7; // x8
__int64 v9; // x22
__int64 *v10; // x23
__int64 v11; // x9
__int64 (__fastcall *v12)(_QWORD *, __int64 *); // x8
__int64 v13; // x24
__int64 v14; // x25
__int64 (__fastcall *v15)(_QWORD *, __int64 *); // x9
_QWORD *v16; // x8
__int64 v17; // [xsp+0h] [xbp-60h] BYREF
_QWORD v18[11]; // [xsp+8h] [xbp-58h] BYREF
if ( (__int64 *)result != a2 )
{
v18[9] = v3;
v18[10] = v4;
v6 = (_QWORD *)result;
v7 = (__int64 *)(result + 8);
if ( (__int64 *)(result + 8) != a2 )
{
v9 = 0;
v10 = (__int64 *)result;
do
{
v18[0] = v10[1];
v11 = *v10;
v10 = v7;
v12 = *a3;
v17 = v11;
result = v12(v18, &v17);
if ( (_DWORD)result )
{
v13 = *v10;
v14 = v9;
while ( 1 )
{
*(_QWORD *)((char *)v6 + v14 + 8) = *(_QWORD *)((char *)v6 + v14);
if ( !v14 )
break;
v15 = *a3;
v17 = *(_QWORD *)((char *)v6 + v14 - 8);
v18[0] = v13;
result = v15(v18, &v17);
v14 -= 8;
if ( (result & 1) == 0 )
{
v16 = (_QWORD *)((char *)v6 + v14 + 8);
goto LABEL_10;
}
}
v16 = v6;
LABEL_10:
*v16 = v13;
}
v7 = v10 + 1;
v9 += 8;
}
while ( v10 + 1 != a2 );
}
}
return result;
}