//
// sub_100165880 from 0x100165880 to 0x10016594f (207 bytes)
//
// 6 xrefs:
// > sub_1001106B0 @ 0x100110c43
// > sub_1001106B0 @ 0x100110d1c
// > GJBaseGameLayer::resetActiveEnterEffects @ 0x10011e074
// > GJBaseGameLayer::resetActiveEnterEffects @ 0x10011e089
// > GJBaseGameLayer::resetLevelVariables @ 0x1001592f9
// > GJBaseGameLayer::resetLevelVariables @ 0x100159305
//
// 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_100165880(_QWORD *a1)
{
_QWORD *v2; // r14
__int64 v3; // rsi
void *v4; // rdi
_QWORD *v5; // r12
__int64 v6; // r13
__int64 v7; // r15
_QWORD *v8; // rsi
void *v9; // rdi
if ( a1[3] )
{
v2 = (_QWORD *)a1[2];
if ( v2 )
{
do
{
v5 = (_QWORD *)*v2;
v6 = v2[3];
if ( v6 )
{
v7 = v2[4];
v4 = (void *)v2[3];
if ( v7 != v6 )
{
do
{
v9 = *(void **)(v7 - 32);
if ( v9 )
{
*(_QWORD *)(v7 - 24) = v9;
operator delete(v9);
}
v8 = *(_QWORD **)(v7 - 232);
v7 -= 240;
sub_100054D90(v7, v8);
}
while ( v7 != v6 );
v4 = (void *)v2[3];
}
v2[4] = v6;
operator delete(v4);
}
operator delete(v2);
v2 = v5;
}
while ( v5 );
}
a1[2] = 0;
v3 = a1[1];
if ( v3 )
__bzero(*a1, 8 * v3);
a1[3] = 0;
}
}