//
// GJAccountSettingsLayer::onUpdate from 0x8dc830 to 0x8dd58c (3420 bytes)
//
// 3 xrefs:
// > ??> @ 0x5c5b0
// > GJAccountSettingsLayer::init @ 0x8dfb10
// > ??> @ 0x122afc8
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
void GJAccountSettingsLayer::onUpdate(GJAccountSettingsLayer *a1, cocos2d::CCObject *a2)
{
std::_rb_tree_base *p_m_header; // x20
std::_rb_tree_base *v4; // x23
std::_rb_tree_base *m_parent; // x0
std::_rb_tree_base *v6; // x24
std::_rb_tree_base *v7; // x0
std::_rb_tree_base *v8; // x0
std::_rb_tree_base *v9; // x25
std::_rb_tree_base *v10; // x0
std::_rb_tree_base *v11; // x27
std::_rb_tree_base *v12; // x0
std::_rb_tree_base *v13; // x27
std::_rb_tree_base *v14; // x0
std::_rb_tree_base *v15; // x5
std::_rb_tree_base *v16; // x0
std::_rb_tree_base *v17; // x5
__int64 v18; // x19
void *v19; // x0
void *v20; // x0
void *v21; // x0
void *v22; // x0
void *v23; // x0
void *v24; // x0
void *v25; // x0
__int64 v26; // x0
__int64 v27; // x1
__int64 v28; // x0
__int64 v29; // x1
void *v30; // x5
_BOOL8 v31; // x0
__int64 v32; // x27
__int64 v33; // x0
__int64 v34; // x1
_BOOL8 v35; // x0
__int64 v36; // x27
__int64 v37; // x0
__int64 v38; // x1
void *v39; // x5
_BOOL8 v40; // x0
__int64 v41; // x25
__int64 v42; // x27
__int64 v43; // x0
__int64 v44; // x1
_BOOL8 v45; // x0
__int64 v46; // x23
__int64 v47; // x24
__int64 v48; // x0
__int64 v49; // x1
_BOOL8 v50; // x0
__int64 v51; // x24
__int64 v52; // x25
__int64 v53; // x0
__int64 v54; // x1
_BOOL8 v55; // x0
__int64 v56; // x23
__int64 insert_hint_unique_pos; // x0
__int64 v58; // x1
_BOOL8 v59; // x0
unsigned int *v60; // x1
int v61; // w2
unsigned int *v62; // x1
int v63; // w2
unsigned int *v64; // x1
int v65; // w2
unsigned int *v66; // x1
int v67; // w2
unsigned int *v68; // x1
int v69; // w2
unsigned int *v70; // x1
int v71; // w2
unsigned int *v72; // x1
int v73; // w2
__int64 v74; // x2
__int64 v75; // x2
__int64 v76; // x2
__int64 v77; // x2
__int64 v78; // x2
unsigned int *v79; // x3
int v80; // w1
__int64 v81; // x2
__int64 v82; // x2
unsigned int *v83; // x3
int v84; // w1
unsigned int *v85; // x3
int v86; // w1
unsigned int *v87; // x4
int v88; // w1
unsigned int *v89; // x3
int v90; // w1
unsigned int *v91; // x3
int v92; // w1
unsigned int *v93; // x4
int v94; // w1
std::_rb_tree_base *pb; // [xsp+90h] [xbp+70h]
void *p; // [xsp+90h] [xbp+70h]
_DWORD *pa; // [xsp+90h] [xbp+70h]
__int64 v98; // [xsp+98h] [xbp+78h]
__int64 v99; // [xsp+98h] [xbp+78h]
unsigned int m_commentHistoryStatus; // [xsp+A4h] [xbp+84h]
unsigned int m_friendStatus; // [xsp+A8h] [xbp+88h]
unsigned int m_messageStatus; // [xsp+ACh] [xbp+8Ch]
__int64 v103; // [xsp+C0h] [xbp+A0h] BYREF
__int64 v104; // [xsp+C8h] [xbp+A8h] BYREF
__int64 v105; // [xsp+D0h] [xbp+B0h] BYREF
__int64 v106; // [xsp+D8h] [xbp+B8h] BYREF
__int64 v107; // [xsp+E0h] [xbp+C0h] BYREF
__int64 v108; // [xsp+E8h] [xbp+C8h] BYREF
__int64 v109; // [xsp+F0h] [xbp+D0h] BYREF
p_m_header = &a1->m_links.m_header;
v4 = &a1->m_links.m_header;
GJAccountSettingsLayer::closeAccInputNodes(a1, a1->m_inputs);
m_messageStatus = a1->m_messageStatus;
m_friendStatus = a1->m_friendStatus;
m_parent = a1->m_links.m_header.m_parent;
m_commentHistoryStatus = a1->m_commentHistoryStatus;
if ( !m_parent )
goto LABEL_74;
do
{
while ( (*(_DWORD *)&m_parent[1].m_isblack & 0x80000000) == 0 )
{
v4 = m_parent;
m_parent = m_parent->m_left;
if ( !m_parent )
goto LABEL_4;
}
m_parent = m_parent->m_right;
}
while ( m_parent );
LABEL_4:
if ( p_m_header == v4 || *(int *)&v4[1].m_isblack > 0 )
{
LABEL_74:
v99 = (__int64)v4;
v56 = operator new(0x30u);
*(_DWORD *)(v56 + 32) = 0;
*(_QWORD *)(v56 + 40) = &byte_124B6C8;
insert_hint_unique_pos = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v99,
(int *)(v56 + 32));
if ( v58 )
{
v59 = insert_hint_unique_pos
|| p_m_header == (std::_rb_tree_base *)v58
|| *(_DWORD *)(v56 + 32) < *(_DWORD *)(v58 + 32);
sub_CFAD74(v59, v56, v58, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v75 = *(_QWORD *)(v56 + 40);
if ( (__int64 *)(v75 - 24) != &qword_124B6B0 )
{
v85 = (unsigned int *)(v75 - 8);
if ( &pthread_create )
{
do
v86 = __ldaxr(v85);
while ( __stlxr(v86 - 1, v85) );
}
else
{
v86 = *(_DWORD *)(v75 - 8);
*(_DWORD *)(v75 - 8) = v86 - 1;
}
if ( v86 <= 0 )
operator delete((void *)(v75 - 24));
}
operator delete((void *)v56);
}
}
v6 = p_m_header;
sub_D18D28(&v103);
v7 = a1->m_links.m_header.m_parent;
if ( !v7 )
goto LABEL_64;
do
{
while ( *(int *)&v7[1].m_isblack > 0 )
{
v6 = v7;
v7 = v7->m_left;
if ( !v7 )
goto LABEL_9;
}
v7 = v7->m_right;
}
while ( v7 );
LABEL_9:
if ( p_m_header == v6 || *(int *)&v6[1].m_isblack > 1 )
{
LABEL_64:
v46 = (__int64)v6;
v47 = operator new(0x30u);
*(_DWORD *)(v47 + 32) = 1;
*(_QWORD *)(v47 + 40) = &byte_124B6C8;
v48 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v46,
(int *)(v47 + 32));
if ( v49 )
{
v50 = v48 || p_m_header == (std::_rb_tree_base *)v49 || *(_DWORD *)(v47 + 32) < *(_DWORD *)(v49 + 32);
sub_CFAD74(v50, v47, v49, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v82 = *(_QWORD *)(v47 + 40);
if ( (__int64 *)(v82 - 24) != &qword_124B6B0 )
{
v91 = (unsigned int *)(v82 - 8);
if ( &pthread_create )
{
do
v92 = __ldaxr(v91);
while ( __stlxr(v92 - 1, v91) );
}
else
{
v92 = *(_DWORD *)(v82 - 8);
*(_DWORD *)(v82 - 8) = v92 - 1;
}
if ( v92 <= 0 )
operator delete((void *)(v82 - 24));
}
operator delete((void *)v47);
}
}
sub_D18D28(&v104);
v8 = a1->m_links.m_header.m_parent;
v9 = p_m_header;
if ( !v8 )
goto LABEL_69;
do
{
while ( *(int *)&v8[1].m_isblack > 1 )
{
v9 = v8;
v8 = v8->m_left;
if ( !v8 )
goto LABEL_14;
}
v8 = v8->m_right;
}
while ( v8 );
LABEL_14:
if ( p_m_header == v9 || *(int *)&v9[1].m_isblack > 2 )
{
LABEL_69:
v51 = (__int64)v9;
v52 = operator new(0x30u);
*(_DWORD *)(v52 + 32) = 2;
*(_QWORD *)(v52 + 40) = &byte_124B6C8;
v53 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v51,
(int *)(v52 + 32));
if ( v54 )
{
v55 = v53 || p_m_header == (std::_rb_tree_base *)v54 || *(_DWORD *)(v52 + 32) < *(_DWORD *)(v54 + 32);
sub_CFAD74(v55, v52, v54, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v76 = *(_QWORD *)(v52 + 40);
if ( (__int64 *)(v76 - 24) != &qword_124B6B0 )
{
v87 = (unsigned int *)(v76 - 8);
if ( &pthread_create )
{
do
v88 = __ldaxr(v87);
while ( __stlxr(v88 - 1, v87) );
}
else
{
v88 = *(_DWORD *)(v76 - 8);
*(_DWORD *)(v76 - 8) = v88 - 1;
}
if ( v88 <= 0 )
operator delete((void *)(v76 - 24));
}
operator delete((void *)v52);
}
}
sub_D18D28(&v105);
v10 = a1->m_links.m_header.m_parent;
v11 = p_m_header;
if ( !v10 )
goto LABEL_59;
do
{
while ( *(int *)&v10[1].m_isblack > 2 )
{
v11 = v10;
v10 = v10->m_left;
if ( !v10 )
goto LABEL_19;
}
v10 = v10->m_right;
}
while ( v10 );
LABEL_19:
if ( p_m_header == v11 || *(int *)&v11[1].m_isblack > 3 )
{
LABEL_59:
v41 = (__int64)v11;
v42 = operator new(0x30u);
*(_DWORD *)(v42 + 32) = 3;
*(_QWORD *)(v42 + 40) = &byte_124B6C8;
v43 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v41,
(int *)(v42 + 32));
if ( v44 )
{
v45 = v43 || p_m_header == (std::_rb_tree_base *)v44 || *(_DWORD *)(v42 + 32) < *(_DWORD *)(v44 + 32);
sub_CFAD74(v45, v42, v44, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v81 = *(_QWORD *)(v42 + 40);
if ( (__int64 *)(v81 - 24) != &qword_124B6B0 )
{
v93 = (unsigned int *)(v81 - 8);
if ( &pthread_create )
{
do
v94 = __ldaxr(v93);
while ( __stlxr(v94 - 1, v93) );
}
else
{
v94 = *(_DWORD *)(v81 - 8);
*(_DWORD *)(v81 - 8) = v94 - 1;
}
if ( v94 <= 0 )
operator delete((void *)(v81 - 24));
}
operator delete((void *)v42);
}
}
sub_D18D28(&v106);
v12 = a1->m_links.m_header.m_parent;
v13 = p_m_header;
if ( !v12 )
goto LABEL_49;
do
{
while ( *(int *)&v12[1].m_isblack > 3 )
{
v13 = v12;
v12 = v12->m_left;
if ( !v12 )
goto LABEL_24;
}
v12 = v12->m_right;
}
while ( v12 );
LABEL_24:
if ( p_m_header == v13 || *(int *)&v13[1].m_isblack > 4 )
{
LABEL_49:
v98 = (__int64)v13;
v32 = operator new(0x30u);
*(_DWORD *)(v32 + 32) = 4;
*(_QWORD *)(v32 + 40) = &byte_124B6C8;
v33 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v98,
(int *)(v32 + 32));
if ( v34 )
{
v35 = v33 || p_m_header == (std::_rb_tree_base *)v34 || *(_DWORD *)(v32 + 32) < *(_DWORD *)(v34 + 32);
sub_CFAD74(v35, v32, v34, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v77 = *(_QWORD *)(v32 + 40);
if ( (__int64 *)(v77 - 24) != &qword_124B6B0 )
{
v89 = (unsigned int *)(v77 - 8);
if ( &pthread_create )
{
do
v90 = __ldaxr(v89);
while ( __stlxr(v90 - 1, v89) );
}
else
{
v90 = *(_DWORD *)(v77 - 8);
*(_DWORD *)(v77 - 8) = v90 - 1;
}
if ( v90 <= 0 )
operator delete((void *)(v77 - 24));
}
operator delete((void *)v32);
}
}
sub_D18D28(&v107);
v14 = a1->m_links.m_header.m_parent;
v15 = p_m_header;
if ( !v14 )
goto LABEL_54;
do
{
while ( *(int *)&v14[1].m_isblack > 4 )
{
v15 = v14;
v14 = v14->m_left;
if ( !v14 )
goto LABEL_29;
}
v14 = v14->m_right;
}
while ( v14 );
LABEL_29:
if ( p_m_header == v15 || *(int *)&v15[1].m_isblack > 5 )
{
LABEL_54:
v36 = (__int64)v15;
pa = (_DWORD *)operator new(0x30u);
pa[8] = 5;
*((_QWORD *)pa + 5) = &byte_124B6C8;
v37 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v36,
pa + 8);
v39 = pa;
if ( v38 )
{
v40 = v37 || p_m_header == (std::_rb_tree_base *)v38 || pa[8] < *(_DWORD *)(v38 + 32);
sub_CFAD74(v40, pa, v38, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v74 = *((_QWORD *)pa + 5);
if ( (__int64 *)(v74 - 24) != &qword_124B6B0 )
{
v83 = (unsigned int *)(v74 - 8);
if ( &pthread_create )
{
do
v84 = __ldaxr(v83);
while ( __stlxr(v84 - 1, v83) );
}
else
{
v84 = *(_DWORD *)(v74 - 8);
*(_DWORD *)(v74 - 8) = v84 - 1;
}
if ( v84 <= 0 )
{
operator delete((void *)(v74 - 24));
v39 = pa;
}
}
operator delete(v39);
}
}
sub_D18D28(&v108);
v16 = a1->m_links.m_header.m_parent;
v17 = p_m_header;
if ( !v16 )
goto LABEL_44;
do
{
while ( *(int *)&v16[1].m_isblack > 5 )
{
v17 = v16;
v16 = v16->m_left;
if ( !v16 )
goto LABEL_34;
}
v16 = v16->m_right;
}
while ( v16 );
LABEL_34:
if ( p_m_header == v17 || *(int *)&v17[1].m_isblack > 6 )
{
LABEL_44:
pb = v17;
v26 = operator new(0x30u);
v27 = (__int64)pb;
p = (void *)v26;
*(_DWORD *)(v26 + 32) = 6;
*(_QWORD *)(v26 + 40) = &byte_124B6C8;
v28 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::_M_get_insert_hint_unique_pos(
&a1->m_links.compare.pad,
v27,
(int *)(v26 + 32));
v30 = p;
if ( v29 )
{
v31 = v28 || p_m_header == (std::_rb_tree_base *)v29 || *((_DWORD *)p + 8) < *(_DWORD *)(v29 + 32);
sub_CFAD74(v31, p, v29, p_m_header);
++a1->m_links.m_nodecount;
}
else
{
v78 = *((_QWORD *)p + 5);
if ( (__int64 *)(v78 - 24) != &qword_124B6B0 )
{
v79 = (unsigned int *)(v78 - 8);
if ( &pthread_create )
{
do
v80 = __ldaxr(v79);
while ( __stlxr(v80 - 1, v79) );
}
else
{
v80 = *(_DWORD *)(v78 - 8);
*(_DWORD *)(v78 - 8) = v80 - 1;
}
if ( v80 <= 0 )
{
operator delete((void *)(v78 - 24));
v30 = p;
}
}
operator delete(v30);
}
}
sub_D18D28(&v109);
v18 = UpdateAccountSettingsPopup::create((__int64)a1, m_messageStatus, m_friendStatus, m_commentHistoryStatus);
v19 = (void *)(v109 - 24);
if ( (__int64 *)(v109 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v72 = (unsigned int *)(v109 - 8);
do
v73 = __ldaxr(v72);
while ( __stlxr(v73 - 1, v72) );
}
else
{
v73 = *(_DWORD *)(v109 - 8);
*(_DWORD *)(v109 - 8) = v73 - 1;
}
if ( v73 <= 0 )
operator delete(v19);
}
v20 = (void *)(v108 - 24);
if ( (__int64 *)(v108 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v70 = (unsigned int *)(v108 - 8);
do
v71 = __ldaxr(v70);
while ( __stlxr(v71 - 1, v70) );
}
else
{
v71 = *(_DWORD *)(v108 - 8);
*(_DWORD *)(v108 - 8) = v71 - 1;
}
if ( v71 <= 0 )
operator delete(v20);
}
v21 = (void *)(v107 - 24);
if ( (__int64 *)(v107 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v68 = (unsigned int *)(v107 - 8);
do
v69 = __ldaxr(v68);
while ( __stlxr(v69 - 1, v68) );
}
else
{
v69 = *(_DWORD *)(v107 - 8);
*(_DWORD *)(v107 - 8) = v69 - 1;
}
if ( v69 <= 0 )
operator delete(v21);
}
v22 = (void *)(v106 - 24);
if ( (__int64 *)(v106 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v66 = (unsigned int *)(v106 - 8);
do
v67 = __ldaxr(v66);
while ( __stlxr(v67 - 1, v66) );
}
else
{
v67 = *(_DWORD *)(v106 - 8);
*(_DWORD *)(v106 - 8) = v67 - 1;
}
if ( v67 <= 0 )
operator delete(v22);
}
v23 = (void *)(v105 - 24);
if ( (__int64 *)(v105 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v64 = (unsigned int *)(v105 - 8);
do
v65 = __ldaxr(v64);
while ( __stlxr(v65 - 1, v64) );
}
else
{
v65 = *(_DWORD *)(v105 - 8);
*(_DWORD *)(v105 - 8) = v65 - 1;
}
if ( v65 <= 0 )
operator delete(v23);
}
v24 = (void *)(v104 - 24);
if ( (__int64 *)(v104 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v62 = (unsigned int *)(v104 - 8);
do
v63 = __ldaxr(v62);
while ( __stlxr(v63 - 1, v62) );
}
else
{
v63 = *(_DWORD *)(v104 - 8);
*(_DWORD *)(v104 - 8) = v63 - 1;
}
if ( v63 <= 0 )
operator delete(v24);
}
v25 = (void *)(v103 - 24);
if ( (__int64 *)(v103 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v60 = (unsigned int *)(v103 - 8);
do
v61 = __ldaxr(v60);
while ( __stlxr(v61 - 1, v60) );
}
else
{
v61 = *(_DWORD *)(v103 - 8);
*(_DWORD *)(v103 - 8) = v61 - 1;
}
if ( v61 <= 0 )
operator delete(v25);
}
(*(void (__fastcall **)(__int64))(*(_QWORD *)v18 + 1288LL))(v18);
}