//
// GameLevelManager::onRemoveFriendCompleted from 0x140256310 to 0x140256613 (771 bytes)
//
// 2 xrefs:
// > GameLevelManager::handleIt @ 0x14021a15d
// > ??> @ 0x14091c5d4
//
// This function is hookable on this platform (idp: pc, 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 11:28:44 +0000
//
// Hidden C++ exception states: #wind=6
void __fastcall GameLevelManager::onRemoveFriendCompleted(__int64 a1, const void **a2, void **a3)
{
_BYTE *v6; // rbx
size_t v7; // r8
__int64 v8; // rcx
void *v9; // rcx
__int64 SplitIntFromKey; // r14
const void *v11; // rcx
unsigned __int64 v12; // rbx
size_t v13; // r8
void (__fastcall ***v14)(_QWORD, _QWORD, __int64); // rcx
struct cocos2d::CCObject *v15; // rax
__int64 v16; // r9
cocos2d::CCArray *StoredUserList; // rax
cocos2d::CCArray *v18; // rdi
unsigned int v19; // ebx
__int64 v20; // rcx
void *v21; // rcx
__int64 v22; // rcx
void *Block[2]; // [rsp+40h] [rbp-58h] BYREF
__m128i si128; // [rsp+50h] [rbp-48h]
v6 = a3;
if ( (unsigned __int64)a3[3] > 0xF )
v6 = *a3;
*(_OWORD *)Block = 0;
si128 = 0;
v7 = -1;
do
++v7;
while ( v6[v7] );
sub_14003D230(Block, v6, v7);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 1200), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v9 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v9);
}
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(v8, v6, 1u);
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 2;
si128.m128i_i64[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 )
{
v22 = *(_QWORD *)(a1 + 1488);
if ( v22 )
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v22 + 8LL))(v22, (unsigned int)SplitIntFromKey, 39);
}
else
{
v14 = *(void (__fastcall ****)(_QWORD, _QWORD, __int64))(a1 + 1488);
if ( v14 )
(**v14)(v14, (unsigned int)SplitIntFromKey, 39);
v15 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 1232), SplitIntFromKey);
if ( v15 )
{
*((_DWORD *)v15 + 190) = 0;
v16 = *(_QWORD *)(a1 + 1480);
if ( v16 )
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCObject *))(*(_QWORD *)v16 + 16LL))(
*(_QWORD *)(a1 + 1480),
v15);
}
StoredUserList = (cocos2d::CCArray *)GameLevelManager::getStoredUserList(a1, 0);
v18 = StoredUserList;
if ( StoredUserList )
{
v19 = 0;
if ( cocos2d::CCArray::count(StoredUserList) )
{
while ( *((_DWORD *)cocos2d::CCArray::objectAtIndex(v18, v19) + 98) != (_DWORD)SplitIntFromKey )
{
if ( ++v19 >= cocos2d::CCArray::count(v18) )
goto LABEL_28;
}
cocos2d::CCArray::removeObjectAtIndex(v18, v19, 1);
v20 = *(_QWORD *)(a1 + 1496);
if ( v20 )
(*(void (__fastcall **)(__int64, cocos2d::CCArray *, _QWORD))(*(_QWORD *)v20 + 16LL))(v20, v18, 0);
}
}
LABEL_28:
Block[1] = (void *)100;
si128 = _mm_load_si128((const __m128i *)&xmmword_1408365A0);
Block[0] = (void *)0x6574756D5F746567LL;
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 1152), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v21 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v21 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v21 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v21);
}
}
sub_14003D310((__int64)a2);
sub_14003D310((__int64)a3);
}