//
// GameLevelManager::purgeFriendRequestSearchCache from 0x1402583d0 to 0x1402586be (750 bytes)
//
// 3 xrefs:
// > GameLevelManager::friendRequestWasRemoved @ 0x14025838c
// > GameLevelManager::invalidateRequests @ 0x140258845
// > ??> @ 0x14091c670
//
// 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=2
void __fastcall GameLevelManager::purgeFriendRequestSearchCache(__int64 a1, unsigned __int8 a2, int a3)
{
cocos2d::CCString *v5; // rax
const char *CString; // rax
size_t v7; // r8
struct cocos2d::CCArray *v8; // rax
unsigned int *v9; // rax
__int64 v10; // rcx
cocos2d::CCString **v11; // r14
cocos2d::CCString **i; // r12
const char *v13; // rax
char *v14; // rsi
const char *v15; // rdx
size_t v16; // r8
void *v17; // rcx
cocos2d::CCArray *StoredOnlineLevels; // rax
cocos2d::CCArray *v19; // rdi
unsigned int v20; // ebx
void (__fastcall ***v21)(_QWORD, cocos2d::CCArray *, char *); // rcx
size_t v22; // r8
__int128 v23; // [rsp+30h] [rbp-78h] BYREF
__int128 v24; // [rsp+40h] [rbp-68h]
char *Str2[2]; // [rsp+50h] [rbp-58h] BYREF
size_t MaxCount[2]; // [rsp+60h] [rbp-48h]
v5 = cocos2d::CCString::createWithFormat("fReqS_%i_", a2);
CString = cocos2d::CCString::getCString(v5);
*(_OWORD *)Str2 = 0;
*(_OWORD *)MaxCount = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003D230(Str2, CString, v7);
v8 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(a1 + 1152));
if ( v8 )
{
v9 = *((unsigned int **)v8 + 7);
v10 = *v9;
if ( (_DWORD)v10 )
{
v11 = *((cocos2d::CCString ***)v9 + 2);
for ( i = &v11[v10 - 1]; v11 <= i; ++v11 )
{
if ( !*v11 )
break;
v13 = cocos2d::CCString::getCString(*v11);
v14 = (char *)v13;
v15 = (const char *)Str2;
if ( MaxCount[1] > 0xF )
v15 = Str2[0];
if ( !strncmp(v13, v15, MaxCount[0]) )
{
if ( a3 > 0 )
{
StoredOnlineLevels = (cocos2d::CCArray *)GameLevelManager::getStoredOnlineLevels(a1, v14);
v19 = StoredOnlineLevels;
if ( !StoredOnlineLevels )
continue;
v20 = 0;
if ( !cocos2d::CCArray::count(StoredOnlineLevels) )
continue;
while ( *((_DWORD *)cocos2d::CCArray::objectAtIndex(v19, v20) + 98) != a3 )
{
if ( ++v20 >= cocos2d::CCArray::count(v19) )
goto LABEL_31;
}
cocos2d::CCArray::removeObjectAtIndex(v19, v20, 1);
v21 = *(void (__fastcall ****)(_QWORD, cocos2d::CCArray *, char *))(a1 + 1504);
if ( v21 )
(**v21)(v21, v19, v14);
if ( cocos2d::CCArray::count(v19) )
continue;
v23 = 0;
v24 = 0;
v22 = -1;
do
++v22;
while ( v14[v22] );
sub_14003D230(&v23, v14, v22);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 1152), &v23);
if ( *((_QWORD *)&v24 + 1) <= 0xFu )
continue;
v17 = (void *)v23;
if ( (unsigned __int64)(*((_QWORD *)&v24 + 1) + 1LL) >= 0x1000 )
{
v17 = *(void **)(v23 - 8);
if ( (unsigned __int64)(v23 - (_QWORD)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
}
else
{
v23 = 0;
v24 = 0;
v16 = -1;
do
++v16;
while ( v14[v16] );
sub_14003D230(&v23, v14, v16);
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 1152), &v23);
if ( *((_QWORD *)&v24 + 1) <= 0xFu )
continue;
v17 = (void *)v23;
if ( (unsigned __int64)(*((_QWORD *)&v24 + 1) + 1LL) >= 0x1000 )
{
v17 = *(void **)(v23 - 8);
if ( (unsigned __int64)(v23 - (_QWORD)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
}
j_j_free(v17);
}
LABEL_31:
;
}
}
}
sub_14003D310((__int64)Str2);
}