//
// GJAccountSettingsLayer::closeAccInputNodes from 0x8dc514 to 0x8dc7d4 (704 bytes)
//
// 3 xrefs:
// > GJAccountSettingsLayer::onClose @ 0x8dc7e8
// > GJAccountSettingsLayer::onUpdate @ 0x8dc870
// > ??> @ 0x3afb0
//
// 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::closeAccInputNodes(GJAccountSettingsLayer *a1, cocos2d::CCArray *a2)
{
cocos2d::ccArray *data; // x1
CCTextInputNode **arr; // x19
CCTextInputNode *v5; // x28
std::_rb_tree_base *p_m_header; // x21
CCTextInputNode_vtbl *v7; // x2
std::_rb_tree_base *v8; // x27
int v9; // w24
std::_rb_tree_base *m_parent; // x0
std::_rb_tree_base **p_m_parent; // x22
__int64 v12; // x27
__int64 insert_hint_unique_pos; // x0
__int64 v14; // x1
__int64 v15; // x6
_BOOL8 v16; // x0
void *v17; // x0
unsigned int *v18; // x1
int v19; // w2
__int64 v20; // x2
unsigned int *v21; // x3
int v22; // w1
CCTextInputNode **v23; // [xsp+70h] [xbp+70h]
__int64 v24; // [xsp+78h] [xbp+78h]
__int64 v25; // [xsp+78h] [xbp+78h]
__int64 v26; // [xsp+90h] [xbp+90h] BYREF
if ( a2 )
{
data = a2->data;
if ( data->num )
{
arr = (CCTextInputNode **)data->arr;
v23 = &arr[data->num - 1];
if ( arr <= v23 )
{
v5 = *arr;
if ( *arr )
{
p_m_header = &a1->m_links.m_header;
do
{
v7 = v5->cocos2d::CCLayer::cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable;
v5->m_delegate = nullptr;
v8 = &a1->m_links.m_header;
v7->onClickTrackNode(v5, 0);
v9 = v5->getTag(v5);
m_parent = a1->m_links.m_header.m_parent;
if ( !m_parent )
goto LABEL_11;
do
{
while ( v9 <= *(_DWORD *)&m_parent[1].m_isblack )
{
v8 = m_parent;
m_parent = m_parent->m_left;
if ( !m_parent )
goto LABEL_9;
}
m_parent = m_parent->m_right;
}
while ( m_parent );
LABEL_9:
if ( p_m_header == v8 || (p_m_parent = &v8[1].m_parent, v9 < *(_DWORD *)&v8[1].m_isblack) )
{
LABEL_11:
v24 = (__int64)v8;
v12 = operator new(0x30u);
p_m_parent = (std::_rb_tree_base **)(v12 + 40);
*(_DWORD *)(v12 + 32) = v9;
*(_QWORD *)(v12 + 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,
v24,
(int *)(v12 + 32));
v15 = insert_hint_unique_pos;
if ( v14 )
{
v16 = insert_hint_unique_pos
|| p_m_header == (std::_rb_tree_base *)v14
|| *(_DWORD *)(v12 + 32) < *(_DWORD *)(v14 + 32);
sub_CFAD74(v16, v12, v14, &a1->m_links.m_header);
++a1->m_links.m_nodecount;
}
else
{
v20 = *(_QWORD *)(v12 + 40);
if ( (__int64 *)(v20 - 24) != &qword_124B6B0 )
{
v21 = (unsigned int *)(v20 - 8);
if ( &pthread_create )
{
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v20 - 8);
*(_DWORD *)(v20 - 8) = v22 - 1;
}
if ( v22 <= 0 )
{
v25 = insert_hint_unique_pos;
operator delete((void *)(v20 - 24));
v15 = v25;
}
}
p_m_parent = (std::_rb_tree_base **)(v15 + 40);
operator delete((void *)v12);
}
}
CCTextInputNode::getString(v5, (__int64)&v26);
sub_D163D4(p_m_parent, &v26);
v17 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v26 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v17);
}
if ( v23 < ++arr )
break;
v5 = *arr;
}
while ( *arr );
}
}
}
}
}