//
// sub_1005DE6B0 from 0x1005de6b0 to 0x1005de730 (128 bytes)
//
// 5 xrefs:
// > sub_1006027B8 @ 0x1006027fc
// > sub_1006102F4 @ 0x1006108e4
// > sub_1006102F4 @ 0x100610940
// > sub_1006131F0 @ 0x10061323c
// > sub_1006131F0 @ 0x10061329c
//
// 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_1005DE6B0(int *a1, int a2)
{
__int64 v2; // x8
int v3; // w10
__int64 v4; // x11
int v5; // w9
int v6; // w10
__int64 v7; // x11
v2 = 0;
if ( !a1 || a2 < 0 )
return v2;
v3 = *a1;
if ( *a1 > a2 )
{
v4 = *((_QWORD *)a1 + 1);
v2 = *(_QWORD *)(v4 + 8LL * a2);
v5 = v3 - 1;
if ( v3 - 1 > a2 )
{
*(_QWORD *)(v4 + 8LL * a2) = *(_QWORD *)(v4 + 8LL * a2 + 8);
v6 = v3 - 2 - a2;
if ( v6 )
{
v7 = 8LL * a2;
do
{
*(_QWORD *)(*((_QWORD *)a1 + 1) + v7 + 8) = *(_QWORD *)(*((_QWORD *)a1 + 1) + v7 + 16);
v7 += 8;
--v6;
}
while ( v6 );
}
}
*a1 = v5;
return v2;
}
return 0;
}