//
// GameLevelManager::replaceFollowedUsers from 0x140251b10 to 0x140251de3 (723 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetFollowingCompleted @ 0x140251941
// > ??> @ 0x14091c4cc
//
// 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:28:42 +0000
//
// Hidden C++ exception states: #wind=3
void __fastcall GameLevelManager::replaceFollowedUsers(__int64 a1, _QWORD *a2)
{
cocos2d::CCObject *v4; // rsi
size_t v5; // r8
cocos2d::CCArray *v6; // rdi
void *v7; // r8
__m128i si128; // xmm6
unsigned int v9; // ebx
__m128i v10; // xmm7
cocos2d::CCString *v11; // rax
int v12; // eax
cocos2d::CCString *v13; // rax
const char *CString; // rax
size_t v15; // r8
__int64 v16; // rax
void *v17; // rcx
void *v18; // rcx
cocos2d::CCObject *v19; // rcx
__int128 v20; // [rsp+30h] [rbp-A8h] BYREF
__m128i v21; // [rsp+40h] [rbp-98h]
void *Block[2]; // [rsp+50h] [rbp-88h] BYREF
__m128i v23; // [rsp+60h] [rbp-78h]
__int128 v24; // [rsp+70h] [rbp-68h] BYREF
__int128 v25; // [rsp+80h] [rbp-58h]
v4 = (cocos2d::CCObject *)cocos2d::CCDictionary::create();
if ( a2[3] > 0xFu )
a2 = (_QWORD *)*a2;
*(_OWORD *)Block = 0;
v23 = 0;
v5 = -1;
do
++v5;
while ( *((_BYTE *)a2 + v5) );
sub_14003D230(Block, a2, v5);
v6 = sub_1400D2840((__int64 *)Block, byte_14070ECF8);
if ( v23.m128i_i64[1] > 0xFuLL )
{
v7 = Block[0];
if ( (unsigned __int64)(v23.m128i_i64[1] + 1) >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
si128 = _mm_load_si128((const __m128i *)&Size);
v23 = si128;
LOBYTE(Block[0]) = 0;
v9 = 0;
if ( v6 )
{
v10 = _mm_load_si128((const __m128i *)&xmmword_140836520);
while ( v9 < cocos2d::CCArray::count(v6) )
{
v11 = cocos2d::CCArray::stringAtIndex(v6, v9);
v12 = cocos2d::CCString::intValue(v11);
if ( v12 > 0 )
{
v13 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v12);
CString = cocos2d::CCString::getCString(v13);
v24 = 0;
v25 = 0;
v15 = -1;
do
++v15;
while ( CString[v15] );
sub_14003D230(&v24, CString, v15);
v20 = 0;
v21 = v10;
LOWORD(v20) = 49;
v16 = cocos2d::CCString::create(&v20);
cocos2d::CCDictionary::setObject(v4, v16, &v24);
if ( v21.m128i_i64[1] > 0xFuLL )
{
v17 = (void *)v20;
if ( (unsigned __int64)(v21.m128i_i64[1] + 1) >= 0x1000 )
{
v17 = *(void **)(v20 - 8);
if ( (unsigned __int64)(v20 - (_QWORD)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
v21 = si128;
LOBYTE(v20) = 0;
if ( *((_QWORD *)&v25 + 1) > 0xFu )
{
v18 = (void *)v24;
if ( (unsigned __int64)(*((_QWORD *)&v25 + 1) + 1LL) >= 0x1000 )
{
v18 = *(void **)(v24 - 8);
if ( (unsigned __int64)(v24 - (_QWORD)v18 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v18);
}
}
++v9;
}
}
if ( *(cocos2d::CCObject **)(a1 + 872) != v4 )
{
if ( v4 )
cocos2d::CCObject::retain(v4);
v19 = *(cocos2d::CCObject **)(a1 + 872);
if ( v19 )
cocos2d::CCObject::release(v19);
*(_QWORD *)(a1 + 872) = v4;
}
}