//
// sub_1006027B8 from 0x1006027b8 to 0x1006028a4 (236 bytes)
//
// 1 xrefs:
// > sub_100609ED8 @ 0x100609f7c
//
// 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_1006027B8(__int64 a1, int a2)
{
int v4; // w0
__int64 v5; // x20
unsigned int *v6; // x21
int v7; // w22
int v8; // w23
__int64 v10; // x0
if ( !a1 )
return 0;
v4 = sub_1005DEA4C(*(unsigned int **)a1);
v5 = 0;
if ( (a2 & 0x80000000) == 0 && v4 > a2 )
{
v6 = *(unsigned int **)a1;
v5 = sub_1005DE6B0(*(int **)a1, a2);
v7 = sub_1005DEA4C(v6);
*(_DWORD *)(a1 + 8) = 1;
if ( v7 != a2 )
{
if ( a2 )
v8 = *(_DWORD *)(sub_1005DEA60((__int64)v6, a2 - 1) + 16);
else
v8 = *(_DWORD *)(v5 + 16) - 1;
if ( v8 + 1 < *(_DWORD *)(sub_1005DEA60((__int64)v6, a2) + 16) && v7 > a2 )
{
do
{
v10 = sub_1005DEA60((__int64)v6, a2);
--*(_DWORD *)(v10 + 16);
++a2;
}
while ( v7 != a2 );
}
}
}
return v5;
}