//
// sub_1006D17B0 from 0x1006d17b0 to 0x1006d184c (156 bytes)
//
// 2 xrefs:
// > sub_1006F3514 @ 0x1006f3bc4
// > sub_1006F3FE4 @ 0x1006f4504
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:12:26 +0000
//
__int64 __fastcall sub_1006D17B0(__int64 a1, int a2)
{
int v2; // w9
int v3; // w8
unsigned int v4; // w9
__int64 v5; // x10
_QWORD *v7; // x9
bool v8; // vf
if ( a2 < 0 )
return 0;
if ( a2 >= 0 )
v2 = a2;
else
v2 = a2 + 63;
v3 = v2 >> 6;
if ( v2 >> 6 >= *(_DWORD *)(a1 + 8) )
return 0;
v4 = a2 - (v2 & 0xFFFFFFC0);
if ( v4 )
{
v5 = 8LL * v3++;
*(_DWORD *)(a1 + 8) = v3;
*(_QWORD *)(*(_QWORD *)a1 + v5) &= ~(-1LL << v4);
}
else
{
*(_DWORD *)(a1 + 8) = v3;
}
if ( v3 >= 1 )
{
v7 = (_QWORD *)(*(_QWORD *)a1 + 8LL * (v3 - 1));
do
{
if ( *v7 )
break;
--v7;
v8 = __OFSUB__(v3--, 1);
}
while ( !((v3 < 0) ^ v8 | (v3 == 0)) );
*(_DWORD *)(a1 + 8) = v3;
}
return 1;
}