//
// GameLevelManager::onSetLevelStarsCompleted from 0x140155ad0 to 0x140155c57 (391 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x14014328e
// > ??> @ 0x1406ca950
//
// 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=3
void __fastcall GameLevelManager::onSetLevelStarsCompleted(__int64 a1, const void **a2, _QWORD *a3)
{
_BYTE *v6; // rbx
size_t v7; // r8
GameLevelManager *v8; // rcx
void *v9; // rcx
unsigned int SplitIntFromKey; // ebp
const void *v11; // rcx
unsigned __int64 v12; // rbx
size_t v13; // r8
void (__fastcall ***v14)(_QWORD, _QWORD, __int64); // rcx
__int64 v15; // rcx
void *Block[2]; // [rsp+30h] [rbp-58h] BYREF
__int128 v17; // [rsp+40h] [rbp-48h]
v6 = a3;
if ( a3[3] > 0xFu )
v6 = (_BYTE *)*a3;
*(_OWORD *)Block = 0;
v17 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003A930(Block, v6, v7);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 592), Block);
if ( *((_QWORD *)&v17 + 1) > 0xFu )
{
v9 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v17 + 1) + 1LL) >= 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;
*(_QWORD *)&v17 = 2;
*((_QWORD *)&v17 + 1) = 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;
if ( !memcmp(v11, Block, v13) && v12 == 2 )
{
v15 = *(_QWORD *)(a1 + 808);
if ( v15 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v15 + 8LL))(v15, SplitIntFromKey, 8);
}
else
{
v14 = *(void (__fastcall ****)(_QWORD, _QWORD, __int64))(a1 + 808);
if ( v14 )
(**v14)(v14, SplitIntFromKey, 8);
}
sub_14003A830((__int64)a2);
sub_14003A830((__int64)a3);
}