//
// sub_1006D1670 from 0x1006d1670 to 0x1006d175c (236 bytes)
//
// 10 xrefs:
// > sub_1006D9224 @ 0x1006d9334
// > sub_1006D9990 @ 0x1006d9a50
// > sub_1006D9990 @ 0x1006d9b54
// > sub_1006DB74C @ 0x1006db79c
// > sub_1006E3A3C @ 0x1006e3d90
// > sub_1006E3A3C @ 0x1006e3da0
// > sub_1006E3A3C @ 0x1006e3db0
// > sub_1006E3A3C @ 0x1006e3e84
// > sub_1006E3A3C @ 0x1006e3e94
// > sub_1006E3A3C @ 0x1006e3ea4
//
// 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_1006D1670(__int64 a1, int a2)
{
char v2; // w20
int v4; // w24
int v5; // w23
int v6; // w8
int v7; // w21
int v8; // w9
_BYTE *v10; // x22
v2 = a2;
if ( a2 < 0 )
return 0;
if ( a2 >= 0 )
v4 = a2;
else
v4 = a2 + 63;
v5 = v4 >> 6;
v6 = *(_DWORD *)(a1 + 8);
if ( v6 > v4 >> 6 )
goto LABEL_18;
v7 = v5 + 1;
v8 = *(_DWORD *)(a1 + 12);
if ( v5 < v8 || v8 >= v7 )
{
LABEL_15:
if ( v6 < v7 )
bzero((void *)(*(_QWORD *)a1 + 8LL * v6), 8LL * (unsigned int)(v5 - v6) + 8);
*(_DWORD *)(a1 + 8) = v7;
LABEL_18:
*(_QWORD *)(*(_QWORD *)a1 + 8LL * v5) |= 1LL << (v2 - (v4 & 0xC0u));
return 1;
}
v10 = sub_1006D0EF8(a1, v5 + 1);
if ( v10 )
{
if ( *(_QWORD *)a1 )
sub_1006AEDAC(*(void **)a1);
*(_QWORD *)a1 = v10;
*(_DWORD *)(a1 + 12) = v7;
v6 = *(_DWORD *)(a1 + 8);
goto LABEL_15;
}
return 0;
}