//
// sub_1006131F0 from 0x1006131f0 to 0x1006132f4 (260 bytes)
//
// 1 xrefs:
// > sub_100613434 @ 0x100613448
//
// 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
//
void __fastcall sub_1006131F0(int a1)
{
int v2; // w8
unsigned int *v3; // x0
int v4; // w19
__int64 v5; // x20
bool v6; // cc
__int64 v7; // x0
__int64 v8; // x20
sub_1006132F4();
v2 = sub_1005DEA4C((unsigned int *)qword_100884EB8);
v3 = (unsigned int *)qword_100884EB8;
v4 = v2 - 1;
if ( v2 >= 1 )
{
if ( a1 )
{
do
{
v5 = sub_1005DEA60((__int64)v3, v4);
sub_1005DE6B0((int *)qword_100884EB8, v4);
if ( *(_QWORD *)v5 )
sub_1005D5EB4(*(__int64 **)v5);
sub_100588C44(*(void **)(v5 + 8));
sub_100588C44((void *)v5);
v3 = (unsigned int *)qword_100884EB8;
v6 = v4-- <= 0;
}
while ( !v6 );
}
else
{
do
{
v7 = sub_1005DEA60((__int64)v3, v4);
v8 = v7;
if ( *(int *)(v7 + 32) <= 0 && *(_QWORD *)v7 )
{
sub_1005DE6B0((int *)qword_100884EB8, v4);
if ( *(_QWORD *)v8 )
sub_1005D5EB4(*(__int64 **)v8);
sub_100588C44(*(void **)(v8 + 8));
sub_100588C44((void *)v8);
}
v3 = (unsigned int *)qword_100884EB8;
v6 = v4-- <= 0;
}
while ( !v6 );
}
}
if ( !(unsigned int)sub_1005DEA4C(v3) )
{
sub_1005DE314((_QWORD *)qword_100884EB8);
qword_100884EB8 = 0;
}
}