//
// sub_1003F58FC from 0x1003f58fc to 0x1003f59b8 (188 bytes)
//
// 1 xrefs:
// > sub_1003F44F4 @ 0x1003f4540
//
// 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 11:04:32 +0000
//
__int64 __fastcall sub_1003F58FC(__int64 a1)
{
__int64 v2; // x0
__int64 v3; // x20
int v4; // w8
unsigned int v5; // w21
float v6; // s8
__int64 result; // x0
__int64 v8; // x0
__n128 v9; // q0
__int64 v10; // x0
v2 = cocos2d::CCDictionary::allKeys(*(_QWORD *)(a1 + 480));
v3 = v2;
v4 = *(_DWORD *)(a1 + 432);
if ( v4 < 0 )
{
v6 = (float)((unsigned int)sub_1002E757C(v2) - 1);
v5 = llroundf(vcvts_n_f32_s32(rand(), 0x1Fu) * v6);
}
else
{
v5 = v4 + 1;
}
*(_DWORD *)(a1 + 432) = v5;
if ( v5 >= (unsigned int)sub_1002E757C(v3) )
*(_DWORD *)(a1 + 432) = 0;
result = cocos2d::CCDictionary::count(*(_QWORD *)(a1 + 480));
if ( (_DWORD)result )
{
v8 = sub_1002E75A0(v3, *(_DWORD *)(a1 + 432));
v9 = cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 480), *(int *)(v8 + 56));
result = (*(__int64 (__fastcall **)(__int64, __n128))(*(_QWORD *)v10 + 64LL))(v10, v9);
*(_DWORD *)(a1 + 440) = result;
}
*(_DWORD *)(a1 + 444) = 0;
return result;
}