//
// cocos2d::CCDictionary::randomObject from 0xd43b24 to 0xd43c54 (304 bytes)
//
// 1 xrefs:
// > ??> @ 0xb1d60
//
// This function is hookable on this platform (idp: arm, 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 13:07:32 +0000
//
__int64 __fastcall cocos2d::CCDictionary::randomObject(cocos2d::CCDictionary *this)
{
cocos2d::CCArray *v2; // x0
int *v3; // x0
int v4; // w1
const char *CString; // x24
size_t v6; // x0
size_t v7; // x21
char *v8; // x3
__int64 v9; // x20
unsigned __int64 v11; // x0
__int64 v12; // [xsp+40h] [xbp+40h] BYREF
size_t v13; // [xsp+48h] [xbp+48h]
void *v14; // [xsp+50h] [xbp+50h]
if ( !*((_DWORD *)this + 16) )
return 0;
v2 = cocos2d::CCDictionary::allKeys(this);
v3 = (int *)cocos2d::CCArray::randomObject(v2);
v4 = *((_DWORD *)this + 16);
if ( v4 == 2 )
return cocos2d::CCDictionary::objectForKey(this, v3[14]);
if ( v4 != 1 )
return 0;
v12 = 0;
CString = (const char *)cocos2d::CCString::getCString((cocos2d::CCString *)v3);
v13 = 0;
v14 = nullptr;
v6 = strlen(CString);
v7 = v6;
if ( v6 > 0x16 )
{
v11 = (v6 + 16) & 0xFFFFFFFFFFFFFFF0LL;
v12 = v11 | 1;
v8 = (char *)operator new(v11);
v14 = v8;
v13 = v7;
}
else
{
LOBYTE(v12) = 2 * v6;
v8 = (char *)&v12 + 1;
if ( !v6 )
goto LABEL_6;
}
v8 = (char *)memcpy(v8, CString, v7);
LABEL_6:
v8[v7] = 0;
v9 = cocos2d::CCDictionary::objectForKey((__int64)this, (__int64)&v12);
if ( (v12 & 1) != 0 )
operator delete(v14);
return v9;
}