//
// GameLevelManager::onSuggestLevelStarsCompleted from 0x1401550b0 to 0x140155348 (664 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x140143ad3
// > ??> @ 0x1406ca92c
//
// 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
//
// Hidden C++ exception states: #wind=4
void __fastcall GameLevelManager::onSuggestLevelStarsCompleted(__int64 a1, const void **a2, _QWORD *a3)
{
_BYTE *v6; // rbx
size_t v7; // r8
GameLevelManager *v8; // rcx
void *v9; // rcx
unsigned int SplitIntFromKey; // r12d
const void *v11; // rcx
unsigned __int64 v12; // r15
size_t v13; // r8
int v14; // ebx
const void *v15; // rcx
unsigned __int64 v16; // r15
size_t v17; // r8
int v18; // ebx
_DWORD *v19; // rbx
float v20; // xmm0_4
__int64 v21; // rcx
void (__fastcall ***v22)(_QWORD, _QWORD, __int64); // rcx
void *v23; // [rsp+28h] [rbp-48h]
void *Block[2]; // [rsp+40h] [rbp-30h] BYREF
__int64 v25; // [rsp+50h] [rbp-20h]
unsigned __int64 v26; // [rsp+58h] [rbp-18h]
v6 = a3;
if ( a3[3] > 0xFu )
v6 = (_BYTE *)*a3;
*(_OWORD *)Block = 0;
v25 = 0;
v26 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003A930(Block, v6, v7);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 592), Block);
if ( v26 > 0xF )
{
v9 = Block[0];
if ( v26 + 1 >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(v8, v6, 1);
*(_OWORD *)Block = 0;
v25 = 2;
v26 = 15;
strcpy((char *)Block, "-1");
v11 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v11 = *a2;
v12 = (unsigned __int64)a2[2];
v13 = v12;
if ( v12 > 2 )
v13 = 2;
v14 = memcmp(v11, Block, v13);
if ( !v14 )
{
if ( v12 >= 2 )
v14 = v12 > 2;
else
v14 = -1;
}
if ( !v14 )
goto LABEL_31;
*(_OWORD *)Block = 0;
v25 = 2;
v26 = 15;
strcpy((char *)Block, "-2");
v15 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v15 = *a2;
v16 = (unsigned __int64)a2[2];
v17 = v16;
if ( v16 > 2 )
v17 = 2;
v18 = memcmp(v15, Block, v17);
if ( !v18 )
{
if ( v16 >= 2 )
v18 = v16 > 2;
else
v18 = -1;
}
if ( !v18 )
{
v19 = (_DWORD *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v23 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v19 = (_DWORD *)qword_1406C2ED8;
}
v19[255] = 0;
v20 = (float)((float)rand() / 32767.0) * 1000.0;
v19[254] = (int)v20;
v19[253] = (int)v20;
LABEL_31:
v21 = *(_QWORD *)(a1 + 808);
if ( v21 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v21 + 8LL))(v21, SplitIntFromKey, 45);
goto LABEL_35;
}
v22 = *(void (__fastcall ****)(_QWORD, _QWORD, __int64))(a1 + 808);
if ( v22 )
(**v22)(v22, SplitIntFromKey, 45);
LABEL_35:
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}