//
// MessagesProfilePage::selectedCount from 0x140476400 to 0x1404764ac (172 bytes)
//
// 3 xrefs:
// > MessagesProfilePage::onToggleAllObjects @ 0x140476382
// > MessagesProfilePage::updateSelectUI @ 0x1404764be
// > ??> @ 0x14092837c
//
// 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:32:40 +0000
//
__int64 __fastcall MessagesProfilePage::selectedCount(__int64 a1)
{
unsigned int v1; // ebx
_BYTE *v2; // rdi
__int64 v3; // rcx
__int64 StoredOnlineLevels; // rax
unsigned int *v5; // rcx
__int64 v6; // rax
unsigned __int64 v7; // rcx
unsigned __int64 i; // r8
unsigned int v9; // edx
void *v11; // [rsp+30h] [rbp+8h]
v1 = 0;
v2 = (_BYTE *)(a1 + 704);
if ( *(_QWORD *)(a1 + 728) > 0xFu )
v2 = *(_BYTE **)v2;
v3 = *(_QWORD *)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v11 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v11);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v3 = *(_QWORD *)&qword_14090BFB0;
}
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v3, v2);
if ( StoredOnlineLevels )
{
v5 = *(unsigned int **)(StoredOnlineLevels + 56);
v6 = *v5;
if ( (_DWORD)v6 )
{
v7 = *((_QWORD *)v5 + 2);
for ( i = v7 + 8 * (v6 - 1); v7 <= i; v7 += 8LL )
{
v9 = v1;
if ( !*(_QWORD *)v7 )
break;
++v1;
if ( !*(_BYTE *)(*(_QWORD *)v7 + 466LL) )
v1 = v9;
}
}
}
return v1;
}