//
// SetupItemCompareTriggerPopup::updateOpButton from 0xa4bcec to 0xa4c034 (840 bytes)
//
// 3 xrefs:
// > SetupItemCompareTriggerPopup::init @ 0xa4d7e0
// > SetupItemCompareTriggerPopup::onOpButton @ 0xa4e4c0
// > ??> @ 0x71f28
//
// 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 SetupItemCompareTriggerPopup::updateOpButton(
SetupItemCompareTriggerPopup *a1,
CCMenuItemSpriteExtra *a2,
int a3,
int a4)
{
cocos2d::CCComponentContainer *m_pComponentContainer; // x21
void *v5; // x0
char *v6; // x0
__int64 v7; // x1
unsigned int *v8; // x1
int v9; // w2
unsigned int *v10; // x1
int v11; // w2
unsigned int *v12; // x1
unsigned int *v13; // x1
unsigned int *v14; // x1
int v15; // w2
char *v18; // [xsp+50h] [xbp+50h] BYREF
__int64 v19; // [xsp+58h] [xbp+58h] BYREF
__int64 v20; // [xsp+60h] [xbp+60h] BYREF
__int64 v21; // [xsp+68h] [xbp+68h] BYREF
__int64 v22; // [xsp+70h] [xbp+70h] BYREF
m_pComponentContainer = a2->getNormalImage(a2)[1].m_pComponentContainer;
v18 = &byte_124B6C8;
if ( a4 == 482 )
{
compKeyToString(a3, (__int64)&v19);
sub_D163D4(&v18, &v19);
v7 = v19;
v5 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) == &qword_124B6B0 )
goto LABEL_5;
if ( !&pthread_create )
goto LABEL_35;
v12 = (unsigned int *)(v19 - 8);
do
v9 = __ldaxr(v12);
while ( __stlxr(v9 - 1, v12) );
LABEL_11:
if ( v9 > 0 )
goto LABEL_5;
goto LABEL_12;
}
if ( (unsigned int)(a4 - 485) <= 1 )
{
roundKeyToString(a3, 0, (__int64)&v20);
sub_D163D4(&v18, &v20);
v7 = v20;
v5 = (void *)(v20 - 24);
if ( (__int64 *)(v20 - 24) == &qword_124B6B0 )
goto LABEL_5;
if ( !&pthread_create )
goto LABEL_35;
v13 = (unsigned int *)(v20 - 8);
do
v9 = __ldaxr(v13);
while ( __stlxr(v9 - 1, v13) );
goto LABEL_11;
}
if ( (unsigned int)(a4 - 578) <= 1 )
{
signKeyToString(a3, 1, (__int64)&v21);
sub_D163D4(&v18, &v21);
v7 = v21;
v5 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) == &qword_124B6B0 )
goto LABEL_5;
if ( &pthread_create )
{
v8 = (unsigned int *)(v21 - 8);
do
v9 = __ldaxr(v8);
while ( __stlxr(v9 - 1, v8) );
goto LABEL_11;
}
LABEL_35:
v9 = *(_DWORD *)(v7 - 8);
*(_DWORD *)(v7 - 8) = v9 - 1;
goto LABEL_11;
}
opKeyToString(a3, (__int64)&v22);
sub_D163D4(&v18, &v22);
v5 = (void *)(v22 - 24);
if ( (__int64 *)(v22 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v22 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v22 - 8);
*(_DWORD *)(v22 - 8) = v11 - 1;
}
if ( v11 <= 0 )
LABEL_12:
operator delete(v5);
}
LABEL_5:
m_pComponentContainer->__vftable[14].get(m_pComponentContainer, (const unsigned __int8 *)v18);
v6 = v18 - 24;
if ( v18 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v18 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v6);
}
}