//
// SetupItemEditTriggerPopup::updateFormulaLabel from 0xa4962c to 0xa4a248 (3100 bytes)
//
// 7 xrefs:
// > SetupItemEditTriggerPopup::onCustomToggleTriggerValue @ 0xa4a348
// > SetupItemEditTriggerPopup::onCustomToggleTriggerValue @ 0xa4a404
// > SetupItemEditTriggerPopup::onCustomToggleTriggerValue @ 0xa4a46c
// > SetupItemEditTriggerPopup::valueDidChange @ 0xa4a4d0
// > SetupItemEditTriggerPopup::init @ 0xa4b2dc
// > SetupItemEditTriggerPopup::onOpButton @ 0xa4bcd0
// > ??> @ 0x5a3a8
//
// 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 SetupItemEditTriggerPopup::updateFormulaLabel(SetupItemEditTriggerPopup *a1)
{
float v2; // w28
float v3; // s14
signed int v4; // w27
float v5; // s15
float v6; // s13
int v7; // w25
float v8; // s10
int v9; // w24
int v10; // w23
float v11; // s11
float v12; // s8
float v13; // s12
float v14; // s9
long double v15; // q0
void *v16; // x0
unsigned int v17; // w27
bool v18; // w25
void *v19; // x0
int v20; // w28
void *v21; // x0
float v22; // s8
unsigned __int8 v23; // w0
const char *v24; // x1
int v25; // w25
void *v26; // x0
void *v27; // x0
void *v28; // x0
unsigned int *v29; // x1
int v30; // w2
void *v31; // x0
cocos2d::CCString *v32; // x0
size_t v33; // x0
void *v34; // x0
void *v35; // x0
void *v36; // x0
void *v37; // x0
unsigned int *v38; // x19
int v39; // w1
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
unsigned int *v56; // x1
int v57; // w2
int v58; // [xsp+B8h] [xbp+B8h]
int v59; // [xsp+C0h] [xbp+C0h]
int v60; // [xsp+C4h] [xbp+C4h]
int v61; // [xsp+C4h] [xbp+C4h]
int v62; // [xsp+C8h] [xbp+C8h]
const char *CString; // [xsp+C8h] [xbp+C8h]
__int64 v64; // [xsp+E0h] [xbp+E0h] BYREF
__int64 v65; // [xsp+E8h] [xbp+E8h] BYREF
__int64 v66; // [xsp+F0h] [xbp+F0h] BYREF
__int64 v67; // [xsp+F8h] [xbp+F8h] BYREF
__int64 v68; // [xsp+100h] [xbp+100h] BYREF
__int64 v69; // [xsp+108h] [xbp+108h] BYREF
__int64 v70; // [xsp+110h] [xbp+110h] BYREF
__int64 v71; // [xsp+118h] [xbp+118h] BYREF
__int64 v72; // [xsp+120h] [xbp+120h] BYREF
__int64 v73; // [xsp+128h] [xbp+128h] BYREF
__int64 v74; // [xsp+130h] [xbp+130h] BYREF
sub_D153B8((int)&v64, &byte_F288A0);
v2 = a1->getValue(a1, 80);
v3 = a1->getValue(a1, 95);
v4 = (int)a1->getValue(a1, 51);
v5 = a1->getValue(a1, 476);
v6 = a1->getValue(a1, 477);
v7 = (int)a1->getValue(a1, 478);
v8 = a1->getValue(a1, 480);
v9 = (int)a1->getValue(a1, 481);
if ( v9 <= 0 )
v9 = 1;
v10 = (int)a1->getValue(a1, 482);
if ( v10 <= 2 )
v10 = 3;
v11 = a1->getValue(a1, 485);
v12 = a1->getValue(a1, 486);
v13 = a1->getValue(a1, 578);
v14 = a1->getValue(a1, 579);
if ( v7 <= 0 )
{
v7 = 1;
}
else if ( v7 == 3 )
{
goto LABEL_11;
}
if ( v4 <= 0 )
{
*(__n128 *)&v15 = sub_D1798C(&v64, "Select a target", 15);
goto LABEL_9;
}
LABEL_11:
getItemVarName((int)v5, (int)v2, (__int64)&v65);
v60 = (int)v6;
getItemVarName((int)v6, (int)v3, (__int64)&v66);
getItemVarName(v7, v4, (__int64)&v67);
if ( (int)v5 )
{
v17 = 1;
if ( (int)v2 <= 0 )
v17 = isSpecialItemType((int)v5);
}
else
{
v17 = 0;
}
if ( v60 && ((int)v3 > 0 || isSpecialItemType(v60)) )
{
if ( v17 )
{
v17 = 1;
v62 = 1;
}
else
{
sub_D18EA8(&v65, &v66);
v62 = 0;
v17 = 1;
}
}
else
{
v62 = 0;
}
sub_D18EA8(&v64, &v67);
sub_D15FD4(&v64, " ", 1);
sub_D15FD4(&v64, "= ", 2);
v18 = (int)v8 != 0;
v59 = v18 && (int)v14 > 0;
if ( v18 && (int)v14 > 0 )
{
signKeyToString((int)v14, 0, (__int64)&v68);
sub_D15E14(&v64, &v68);
v37 = (void *)(v68 - 24);
if ( (__int64 *)(v68 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(v68 - 8);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(v68 - 8);
*(_DWORD *)(v68 - 8) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v37);
}
sub_D15FD4(&v64, "(", 1);
}
v58 = v18 && (int)v12 > 0;
if ( v18 && (int)v12 > 0 )
{
roundKeyToString((int)v12, 0, (__int64)&v69);
sub_D15E14(&v64, &v69);
v35 = (void *)(v69 - 24);
if ( (__int64 *)(v69 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(v69 - 8);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *(_DWORD *)(v69 - 8);
*(_DWORD *)(v69 - 8) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v35);
}
sub_D15FD4(&v64, "(", 1);
}
else if ( !(int)v8 )
{
goto LABEL_20;
}
sub_D15E14(&v64, &v67);
sub_D15FD4(&v64, " ", 1);
opKeyToString((int)v8, (__int64)&v70);
sub_D15E14(&v64, &v70);
v36 = (void *)(v70 - 24);
if ( (__int64 *)(v70 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v70 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(v70 - 8);
*(_DWORD *)(v70 - 8) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v36);
}
sub_D15FD4(&v64, " ", 1);
LABEL_20:
v61 = (int)v13;
if ( (int)v13 > 0 )
{
signKeyToString(v61, 0, (__int64)&v71);
sub_D15E14(&v64, &v71);
v19 = (void *)(v71 - 24);
if ( (__int64 *)(v71 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v71 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(v71 - 8);
*(_DWORD *)(v71 - 8) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v19);
}
sub_D15FD4(&v64, "(", 1);
}
v20 = (int)v11;
if ( (int)v11 > 0 )
{
roundKeyToString(v20, 0, (__int64)&v72);
sub_D15E14(&v64, &v72);
v21 = (void *)(v72 - 24);
if ( (__int64 *)(v72 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v72 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(v72 - 8);
*(_DWORD *)(v72 - 8) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v21);
}
sub_D15FD4(&v64, "(", 1);
}
v22 = a1->getValue(a1, 479);
v23 = isOpValid(v10, v22);
v25 = v23;
if ( v23 && v62 )
{
sub_D15FD4(&v64, "(", 1);
if ( !v17 )
{
LABEL_29:
if ( !v62 )
goto LABEL_30;
goto LABEL_56;
}
}
else if ( !v17 )
{
goto LABEL_29;
}
sub_D15E14(&v64, &v65);
if ( !v62 )
goto LABEL_30;
LABEL_56:
sub_D15FD4(&v64, " ", 1);
opKeyToString(v9, (__int64)&v73);
sub_D15E14(&v64, &v73);
v34 = (void *)(v73 - 24);
if ( (__int64 *)(v73 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v73 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(v73 - 8);
*(_DWORD *)(v73 - 8) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v34);
}
sub_D15FD4(&v64, " ", 1);
sub_D15E14(&v64, &v66);
if ( !v25 )
goto LABEL_32;
sub_D15FD4(&v64, ")", 1);
LABEL_30:
if ( v17 >= (v62 ^ 1u) )
{
if ( !v25 )
goto LABEL_32;
sub_D15FD4(&v64, " ", 1);
opKeyToString(v10, (__int64)&v74);
sub_D15E14(&v64, &v74);
v31 = (void *)(v74 - 24);
if ( (__int64 *)(v74 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v56 = (unsigned int *)(v74 - 8);
do
v57 = __ldaxr(v56);
while ( __stlxr(v57 - 1, v56) );
}
else
{
v57 = *(_DWORD *)(v74 - 8);
*(_DWORD *)(v74 - 8) = v57 - 1;
}
if ( v57 <= 0 )
operator delete(v31);
}
sub_D15FD4(&v64, " ", 1);
}
v32 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%.03f", v24, v22);
CString = cocos2d::CCString::getCString(v32);
v33 = strlen(CString);
sub_D15FD4(&v64, CString, v33);
LABEL_32:
if ( v20 > 0 )
sub_D15FD4(&v64, ")", 1);
if ( v61 > 0 )
sub_D15FD4(&v64, ")", 1);
if ( v58 )
{
sub_D15FD4(&v64, ")", 1);
if ( !v59 )
goto LABEL_38;
}
else if ( !v59 )
{
goto LABEL_38;
}
sub_D15FD4(&v64, ")", 1);
LABEL_38:
v26 = (void *)(v67 - 24);
if ( (__int64 *)(v67 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v67 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(v67 - 8);
*(_DWORD *)(v67 - 8) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v26);
}
v27 = (void *)(v66 - 24);
if ( (__int64 *)(v66 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v66 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(v66 - 8);
*(_DWORD *)(v66 - 8) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v27);
}
v28 = (void *)(v65 - 24);
if ( (__int64 *)(v65 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(v65 - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *(_DWORD *)(v65 - 8);
*(_DWORD *)(v65 - 8) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v28);
}
LABEL_9:
((void (__fastcall *)(cocos2d::CCLabelBMFont *, __int64, long double))a1->m_formulaLabel->setString)(
a1->m_formulaLabel,
v64,
v15);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_formulaLabel, 400.0, 0.8, 0.0);
v16 = (void *)(v64 - 24);
if ( (__int64 *)(v64 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v38 = (unsigned int *)(v64 - 8);
do
v39 = __ldaxr(v38);
while ( __stlxr(v39 - 1, v38) );
}
else
{
v39 = *(_DWORD *)(v64 - 8);
*(_DWORD *)(v64 - 8) = v39 - 1;
}
if ( v39 <= 0 )
operator delete(v16);
}
}