//
// sub_100097E44 from 0x100097e44 to 0x1000980d4 (656 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x1000930e4
//
// 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 10:58:27 +0000
//
__int64 __fastcall sub_100097E44(__int64 a1, __int64 a2, __int64 *a3)
{
__int64 *v6; // x19
__int64 v7; // x23
__int64 v8; // x0
int v9; // w22
__int64 v10; // x0
int v11; // w23
int v12; // w25
_BOOL4 v13; // w0
_BOOL4 v14; // w24
__int64 result; // x0
__int64 v16; // x21
unsigned int *v17; // x8
__int64 v18; // x9
unsigned __int64 v19; // x8
unsigned __int64 v20; // x9
int (__cdecl *v21)(const void *, const void *); // x3
unsigned int *v22; // x8
__int64 v23; // x9
unsigned __int64 v24; // x8
unsigned __int64 v25; // x9
int v26; // w10
void *v27[2]; // [xsp+8h] [xbp-88h] BYREF
char v28; // [xsp+1Fh] [xbp-71h]
void *__dst[2]; // [xsp+20h] [xbp-70h] BYREF
__int64 v30; // [xsp+30h] [xbp-60h]
void *__p[2]; // [xsp+38h] [xbp-58h] BYREF
char v32; // [xsp+4Fh] [xbp-41h]
v6 = a3;
if ( *((char *)a3 + 23) < 0 )
v6 = (__int64 *)*a3;
sub_1000ADC9C(a1, v6);
v7 = sub_1000A72B8(a3, "_");
if ( (unsigned int)sub_1002E757C(v7) == 3 )
{
v8 = cocos2d::CCArray::stringAtIndex(v7, 1);
v9 = cocos2d::CCString::intValue(v8);
}
else
{
v9 = 0;
}
if ( (unsigned int)sub_1002E757C(v7) == 3 )
{
v10 = cocos2d::CCArray::stringAtIndex(v7, 2);
v11 = cocos2d::CCString::intValue(v10);
}
else
{
v11 = 0;
}
if ( v9 == 3 )
v12 = 0;
else
v12 = v11;
sub_100009900(__p, "-1");
v13 = sub_1000045BC((_QWORD *)a2, __p);
v14 = v13;
if ( v32 < 0 )
{
operator delete(__p[0]);
if ( v14 )
{
LABEL_14:
result = *(_QWORD *)(a1 + 1296);
if ( result )
return (*(__int64 (__fastcall **)(__int64, __int64 *))(*(_QWORD *)result + 24LL))(result, v6);
return result;
}
}
else if ( v13 )
{
goto LABEL_14;
}
if ( *(char *)(a2 + 23) < 0 )
{
sub_1000097D0(__dst, *(void **)a2, *(_QWORD *)(a2 + 8));
}
else
{
*(_OWORD *)__dst = *(_OWORD *)a2;
v30 = *(_QWORD *)(a2 + 16);
}
v16 = sub_1000AA0A0(a1, __dst, v9 == 3);
if ( SHIBYTE(v30) < 0 )
operator delete(__dst[0]);
if ( (unsigned int)sub_1002E757C(v16) )
{
if ( v12 )
{
if ( v16 )
{
v17 = *(unsigned int **)(v16 + 56);
v18 = *v17;
if ( (_DWORD)v18 )
{
v19 = *((_QWORD *)v17 + 2);
v20 = v19 + 8 * v18 - 8;
do
{
if ( !*(_QWORD *)v19 )
break;
*(_DWORD *)(*(_QWORD *)v19 + 840LL) = v12;
v19 += 8LL;
}
while ( v19 <= v20 );
}
}
}
}
if ( (unsigned int)sub_1002E757C(v16) && v9 == 4 )
{
v21 = (unsigned int)(v11 - 1) > 2
? (int (__cdecl *)(const void *, const void *))scoreCompare
: (int (__cdecl *)(const void *, const void *))off_1008CF1A8[v11 - 1];
qsort(*(void **)(*(_QWORD *)(v16 + 56) + 16LL), **(unsigned int **)(v16 + 56), 8u, v21);
v22 = *(unsigned int **)(v16 + 56);
v23 = *v22;
if ( (_DWORD)v23 )
{
v24 = *((_QWORD *)v22 + 2);
v25 = v24 + 8 * v23 - 8;
v26 = 1;
do
{
if ( !*(_QWORD *)v24 )
break;
*(_DWORD *)(*(_QWORD *)v24 + 396LL) = v26++;
v24 += 8LL;
}
while ( v24 <= v25 );
}
}
sub_100009900(v27, " ");
sub_1000AD7B0(a1, v16, v27, v6);
if ( v28 < 0 )
operator delete(v27[0]);
result = *(_QWORD *)(a1 + 1296);
if ( result )
return (*(__int64 (__fastcall **)(__int64, __int64, __int64 *))(*(_QWORD *)result + 16LL))(result, v16, v6);
return result;
}