//
// ProfilePage::loadPage from 0x1008a68f0 to 0x1008a6b59 (617 bytes)
//
// 7 xrefs:
// > ProfilePage::onPrevPage @ 0x1008a573d
// > ProfilePage::onNextPage @ 0x1008a575d
// > ProfilePage::getUserInfoFinished @ 0x1008a689d
// > sub_1008A6B80 @ 0x1008a6bd2
// > ProfilePage::commentUploadFinished @ 0x1008a7616
// > sub_1008A7620 @ 0x1008a765d
// > ProfilePage::commentDeleteFailed @ 0x1008a7886
//
// 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 12:37:16 +0000
//
void __fastcall ProfilePage::loadPage(std::string *a1, int a2)
{
int v2; // r15d
const std::string::value_type *AccountCommentKey; // rax
__int64 v5; // rax
const char *data; // rsi
__int64 StoredOnlineLevels; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
const char *v11; // rsi
__int64 v12; // rax
const char *PageInfo; // rbx
size_t v14; // rax
size_t v15; // r13
char *v16; // r12
std::string *v17; // rbx
std::string::pointer v18; // rdx
size_t v19; // r15
std::string::pointer v20; // rdx
std::string *v21; // [rsp+8h] [rbp-58h]
__int64 v22; // [rsp+10h] [rbp-50h]
_QWORD __dst[2]; // [rsp+18h] [rbp-48h] BYREF
void *__p; // [rsp+28h] [rbp-38h]
int v25; // [rsp+34h] [rbp-2Ch]
v2 = a2;
GameLevelManager::sharedState();
AccountCommentKey = (const std::string::value_type *)GameLevelManager::getAccountCommentKey();
std::string::assign(a1 + 31, AccountCommentKey);
(*(void (__fastcall **)(std::string::size_type, __int64))(*(_QWORD *)a1[36].__r_.__value_.__r.__words[0] + 344LL))(
a1[36].__r_.__value_.__r.__words[0],
1);
(*(void (__fastcall **)(std::string::size_type, _QWORD))(*(_QWORD *)a1[36].__r_.__value_.__l.__data_ + 344LL))(
a1[36].__r_.__value_.__r.__words[2],
0);
(*(void (__fastcall **)(std::string::size_type, bool))(*(_QWORD *)a1[33].__r_.__value_.__l.__size_ + 344LL))(
a1[33].__r_.__value_.__l.__size_,
a2 > 0);
v5 = GameLevelManager::sharedState();
if ( (*(_BYTE *)&a1[31].__r_.__value_.__s.0 & 1) != 0 )
data = a1[31].__r_.__value_.__l.__data_;
else
data = a1[31].__r_.__value_.__s.__data_;
StoredOnlineLevels = GameLevelManager::getStoredOnlineLevels(v5, data);
(*(void (__fastcall **)(std::string::size_type, bool))(*(_QWORD *)a1[33].__r_.__value_.__r.__words[0] + 344LL))(
a1[33].__r_.__value_.__r.__words[0],
StoredOnlineLevels != 0);
v8 = GameLevelManager::sharedState();
if ( (*(_BYTE *)&a1[31].__r_.__value_.__s.0 & 1) == 0 )
{
v9 = GameLevelManager::getStoredOnlineLevels(v8, a1[31].__r_.__value_.__s.__data_);
if ( v9 )
goto LABEL_6;
LABEL_9:
ProfilePage::setupCommentsBrowser((__int64)a1, 0);
*(_QWORD *)(GameLevelManager::sharedState() + 1240) = a1 + 28;
v12 = GameLevelManager::sharedState();
GameLevelManager::getAccountComments(v12);
goto LABEL_27;
}
v9 = GameLevelManager::getStoredOnlineLevels(v8, a1[31].__r_.__value_.__l.__data_);
if ( !v9 )
goto LABEL_9;
LABEL_6:
v22 = v9;
v10 = GameLevelManager::sharedState();
if ( (*(_BYTE *)&a1[31].__r_.__value_.__s.0 & 1) != 0 )
v11 = a1[31].__r_.__value_.__l.__data_;
else
v11 = a1[31].__r_.__value_.__s.__data_;
PageInfo = GameLevelManager::getPageInfo(v10, v11);
v14 = strlen(PageInfo);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v15 = v14;
v21 = a1 + 31;
if ( v14 >= 0x17 )
{
v25 = v2;
v19 = 26;
if ( (v14 | 7) != 0x17 )
v19 = (v14 | 7) + 1;
v16 = (char *)operator new(v19);
__p = v16;
__dst[0] = v19 + 1;
v2 = v25;
__dst[1] = v15;
LABEL_19:
memmove(v16, PageInfo, v15);
v16[v15] = 0;
v17 = a1 + 31;
if ( (*(_BYTE *)&v21->__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_15;
LABEL_20:
v18 = a1[31].__r_.__value_.__l.__data_;
goto LABEL_21;
}
LOBYTE(__dst[0]) = 2 * v14;
v16 = (char *)__dst + 1;
if ( v14 )
goto LABEL_19;
BYTE1(__dst[0]) = 0;
v17 = a1 + 31;
if ( (*(_BYTE *)&v21->__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_20;
LABEL_15:
v18 = a1[31].__r_.__value_.__s.__data_;
LABEL_21:
(*(void (__fastcall **)(std::string *, _QWORD *, std::string::pointer))(a1->__r_.__value_.__r.__words[0] + 1424))(
a1,
__dst,
v18);
if ( (__dst[0] & 1) != 0 )
operator delete(__p);
if ( (*(_BYTE *)&v17->__r_.__value_.__s.0 & 1) != 0 )
v20 = a1[31].__r_.__value_.__l.__data_;
else
v20 = a1[31].__r_.__value_.__s.__data_;
(*(void (__fastcall **)(std::string *, __int64, std::string::pointer))(a1->__r_.__value_.__r.__words[0] + 1408))(
a1,
v22,
v20);
LABEL_27:
HIDWORD(a1[35].__r_.__value_.__r.__words[2]) = v2;
}