//
// SetColorIDPopup::colorSelectClosed from 0x8c4cdc to 0x8c4eb0 (468 bytes)
//
// 3 xrefs:
// > `non-virtual thunk to'SetColorIDPopup::colorSelectClosed @ 0x8c4eb4
// > ??> @ 0x8c4a8
// > ??> @ 0x119b138
//
// 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 SetColorIDPopup::colorSelectClosed(SetColorIDPopup *a1, GJSpecialColorSelect *a2, int a3)
{
CCTextInputNode *m_inputNode; // x22
void *v6; // x0
int v7; // w0
CCTextInputNode *v8; // x21
char *v9; // x0
void *v10; // x0
unsigned int *v11; // x1
int v12; // w2
unsigned int *v13; // x21
int v14; // w1
int v15[2]; // [xsp+50h] [xbp+50h] BYREF
if ( a3 > 999 )
{
a1->m_disableDelegate = 1;
a1->m_value = a3;
m_inputNode = a1->m_inputNode;
sub_D153B8((int)v15, "0");
CCTextInputNode::setString(m_inputNode, (const unsigned __int8 **)v15);
v6 = (void *)(*(_QWORD *)v15 - 24LL);
if ( (__int64 *)(*(_QWORD *)v15 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(*(_QWORD *)v15 - 8LL);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(*(_QWORD *)v15 - 8LL);
*(_DWORD *)(*(_QWORD *)v15 - 8LL) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v6);
}
v7 = a3;
v8 = a1->m_inputNode;
v9 = (char *)GJSpecialColorSelect::textForColorIdx(v7);
sub_D153B8((int)v15, v9);
CCTextInputNode::updateLabel(v8, (const void **)v15);
v10 = (void *)(*(_QWORD *)v15 - 24LL);
if ( (__int64 *)(*(_QWORD *)v15 - 24LL) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(*(_QWORD *)v15 - 8LL);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(*(_QWORD *)v15 - 8LL);
*(_DWORD *)(*(_QWORD *)v15 - 8LL) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v10);
}
a1->valueChanged(a1);
a1->m_disableDelegate = 0;
}
}