//
// GameLevelManager::onRemoveFriendCompleted from 0x1005236e0 to 0x10052392e (590 bytes)
//
// 1 xrefs:
// > GameLevelManager::handleIt @ 0x10051d184
//
// 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 GameLevelManager::onRemoveFriendCompleted(__int64 a1, unsigned __int8 *a2, __int64 a3, double a4)
{
__int64 v4; // r12
const char *v5; // r14
size_t v6; // rax
size_t v7; // r13
char *v8; // rbx
size_t v9; // r12
GameLevelManager *v10; // rdi
unsigned int SplitIntFromKey; // r14d
const void *v12; // rdi
unsigned __int64 v13; // rcx
size_t v14; // rdx
bool v15; // bl
int v16; // eax
__int64 v17; // rdi
cocos2d::CCObject *v18; // rax
__int64 v19; // rdi
__int64 v20; // rdi
__int64 v21; // r15
unsigned int v22; // ebx
__int64 v23; // rdi
__int64 v24; // [rsp+0h] [rbp-50h]
__int128 __dst; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
v4 = a1;
if ( (*(_BYTE *)a3 & 1) != 0 )
v5 = *(const char **)(a3 + 16);
else
v5 = (const char *)(a3 + 1);
v6 = strlen(v5);
if ( v6 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v7 = v6;
v24 = *(_QWORD *)(a1 + 608);
if ( v6 >= 0x17 )
{
v9 = 26;
if ( (v6 | 7) != 0x17 )
v9 = (v6 | 7) + 1;
v8 = (char *)operator new(v9);
__p = v8;
*(_QWORD *)&__dst = v9 + 1;
v4 = a1;
*((_QWORD *)&__dst + 1) = v7;
goto LABEL_11;
}
v8 = (char *)&__dst + 1;
LOBYTE(__dst) = 2 * v6;
if ( v6 )
LABEL_11:
memmove(v8, v5, v7);
v8[v7] = 0;
v10 = (GameLevelManager *)v24;
cocos2d::CCDictionary::removeObjectForKey_1(v24, (char *)&__dst);
if ( (__dst & 1) != 0 )
{
v10 = (GameLevelManager *)__p;
operator delete(__p);
}
SplitIntFromKey = GameLevelManager::getSplitIntFromKey(v10, v5, 1);
*(_WORD *)((char *)&__dst + 1) = 12589;
BYTE3(__dst) = 0;
v12 = a2 + 1;
v13 = *a2 >> 1;
if ( (*a2 & 1) != 0 )
{
v12 = *((const void **)a2 + 2);
v13 = *((_QWORD *)a2 + 1);
}
v14 = 2;
if ( v13 < 2 )
v14 = v13;
v15 = v13 != 2;
v16 = memcmp(v12, (char *)&__dst + 1, v14);
v17 = *(_QWORD *)(v4 + 808);
if ( v15 || v16 != 0 )
{
if ( v17 )
(**(void (__fastcall ***)(__int64, _QWORD, __int64))v17)(v17, SplitIntFromKey, 33);
v18 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v4 + 616), (int)SplitIntFromKey);
if ( v18 )
{
LODWORD(v18[12].__vftable) = 0;
v19 = *(_QWORD *)(v4 + 800);
if ( v19 )
(*(void (__fastcall **)(__int64, cocos2d::CCObject *))(*(_QWORD *)v19 + 16LL))(v19, v18);
}
v20 = *(_QWORD *)(v4 + 560);
LOBYTE(__dst) = 22;
strcpy((char *)&__dst + 1, "get_friends");
v21 = cocos2d::CCDictionary::objectForKey_1(v20, (char *)&__dst);
if ( (__dst & 1) != 0 )
operator delete(__p);
if ( v21 && (unsigned int)sub_100720070(v21) )
{
v22 = 0;
while ( *(_DWORD *)(sub_1007200C0(v21, v22) + 376) != SplitIntFromKey )
{
if ( ++v22 >= (unsigned int)sub_100720070(v21) )
return;
}
sub_100720230(v21, v22, 1);
v23 = *(_QWORD *)(v4 + 816);
if ( v23 )
(*(void (__fastcall **)(__int64, __int64, _QWORD))(*(_QWORD *)v23 + 16LL))(v23, v21, 0);
}
}
else if ( v17 )
{
(*(void (__fastcall **)(__int64, _QWORD, __int64))(*(_QWORD *)v17 + 8LL))(v17, SplitIntFromKey, 33);
}
}