//
// RateDemonLayer::selectRating from 0x14055d5e0 to 0x14055d75d (381 bytes)
//
// 5 xrefs:
// > RateDemonLayer::init @ 0x14055d5a8
// > RateDemonLayer::init @ 0x14055d250
// > ??> @ 0x1408dacb4
// > ??> @ 0x1408dacec
// > ??> @ 0x14092c180
//
// 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:34:13 +0000
//
__int64 __fastcall RateDemonLayer::selectRating(__int64 a1, __int64 a2)
{
int v3; // eax
unsigned int v4; // esi
struct cocos2d::CCObject *v5; // rdi
__int64 v6; // rbx
int v7; // eax
__int16 *v8; // rdx
__int64 v9; // rcx
char v10; // al
__int64 result; // rax
_QWORD *v12; // rbx
__int64 v13; // rcx
__int64 v14; // rcx
__int64 v15; // rcx
__int16 v16; // [rsp+30h] [rbp+8h] BYREF
char v17; // [rsp+32h] [rbp+Ah]
if ( a2 )
v3 = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)a2 + 56LL))(a2);
else
v3 = -1;
v4 = 0;
for ( *(_DWORD *)(a1 + 716) = v3; v4 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(a1 + 696)); ++v4 )
{
v5 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(a1 + 696), v4);
v6 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v5 + 952LL))(v5);
v7 = (*(__int64 (__fastcall **)(struct cocos2d::CCObject *))(*(_QWORD *)v5 + 56LL))(v5);
v8 = &word_1407045F4;
if ( *(_DWORD *)(a1 + 716) == v7 )
v8 = &word_1407045F8;
(**(void (__fastcall ***)(__int64, __int16 *))(v6 + 320))(v6 + 320, v8);
}
v9 = *(_QWORD *)(a1 + 688);
if ( *(_DWORD *)(a1 + 716) == -1 )
{
v16 = -22874;
v10 = -90;
}
else
{
v16 = -1;
v10 = -1;
}
v17 = v10;
result = (*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v9 + 952LL))(v9);
v12 = (_QWORD *)result;
v13 = *(_QWORD *)(result + 632);
if ( v13 )
result = (**(__int64 (__fastcall ***)(__int64, __int16 *))(v13 + 368))(v13 + 368, &v16);
v14 = v12[80];
if ( v14 )
result = (**(__int64 (__fastcall ***)(__int64, __int16 *))(v14 + 320))(v14 + 320, &v16);
v15 = v12[82];
if ( v15 )
return (**(__int64 (__fastcall ***)(__int64, __int16 *))(v15 + 320))(v15 + 320, &v16);
v15 = v12[81];
if ( v15 )
return (**(__int64 (__fastcall ***)(__int64, __int16 *))(v15 + 320))(v15 + 320, &v16);
return result;
}