//
// SetupItemCompareTriggerPopup::updateFormulaLabel from 0x10040e840 to 0x10040eebc (1660 bytes)
//
// 4 xrefs:
// > SetupItemCompareTriggerPopup::init @ 0x10040e474
// > SetupItemCompareTriggerPopup::onOpButton @ 0x10040e720
// > SetupItemCompareTriggerPopup::onCustomToggleTriggerValue @ 0x10040f0a0
// > SetupItemCompareTriggerPopup::valueDidChange @ 0x10040f0d0
//
// 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 __fastcall SetupItemCompareTriggerPopup::updateFormulaLabel(SetupItemCompareTriggerPopup *a1)
{
__int64 v2; // x23
__int64 v3; // x22
int v4; // w25
int v5; // w24
int v6; // w20
int v7; // w26
float v8; // s11
unsigned int v9; // w21
unsigned int v10; // w20
float v11; // s13
float v12; // s9
float v13; // s14
float v14; // s10
int v15; // w0
_BOOL4 v16; // w23
float v17; // s12
float v18; // s8
int v19; // w27
const char *v20; // x8
char *v21; // x1
const std::string::value_type *p_p; // x1
std::string::size_type v23; // x2
const std::string::value_type *v24; // x1
std::string::size_type v25; // x2
std::string *v26; // x1
std::string::size_type size; // x2
const std::string::value_type *v28; // x1
std::string::size_type v29; // x2
cocos2d::CCString *v30; // x0
const char *CString; // x0
const std::string::value_type *v32; // x1
std::string::size_type v33; // x2
int v34; // w22
const char *v35; // x8
char *v36; // x1
const std::string::value_type *v37; // x1
std::string::size_type v38; // x2
const std::string::value_type *v39; // x1
std::string::size_type v40; // x2
std::string *v41; // x1
std::string::size_type v42; // x2
const std::string::value_type *v43; // x1
std::string::size_type v44; // x2
cocos2d::CCString *v45; // x0
const char *v46; // x0
std::string *v47; // x1
void *__p; // [xsp+8h] [xbp-F8h] BYREF
std::string::size_type v49; // [xsp+10h] [xbp-F0h]
unsigned __int8 v50; // [xsp+1Fh] [xbp-E1h]
std::string v51; // [xsp+20h] [xbp-E0h] BYREF
std::string v52; // [xsp+38h] [xbp-C8h] BYREF
std::string v53; // [xsp+50h] [xbp-B0h] BYREF
v2 = (unsigned int)(int)((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 80);
v3 = (unsigned int)(int)((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 95);
v4 = (int)((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 476);
v5 = (int)((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 477);
v6 = (int)((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 480);
v7 = (int)((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 481);
v8 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 482);
if ( v6 >= 1 )
v9 = v6;
else
v9 = 3;
if ( v7 >= 1 )
v10 = v7;
else
v10 = 3;
v11 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 485);
v12 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 486);
v13 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 578);
v14 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 579);
if ( v4 <= 1 )
v15 = 1;
else
v15 = v4;
sub_10040D2E8(v15, v2, &v53);
sub_10040D2E8(v5, v3, &v52);
if ( v5 )
v16 = (int)v3 > 0 || (unsigned int)(v5 - 3) < 3;
else
v16 = 0;
v17 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 479);
v18 = ((float (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 483);
sub_100009900(&v51, "");
v19 = (int)v13;
if ( (int)v13 >= 1 )
{
if ( v19 == 1 )
v20 = "abs";
else
v20 = "?";
if ( v19 == 2 )
v21 = "neg";
else
v21 = (char *)v20;
sub_100009900(&__p, v21);
if ( (v50 & 0x80u) == 0 )
p_p = (const std::string::value_type *)&__p;
else
p_p = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v23 = v50;
else
v23 = v49;
std::string::append(&v51, p_p, v23);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, "(");
}
if ( (int)v11 >= 1 )
{
sub_10040D2AC((int)v11, 0, &__p);
if ( (v50 & 0x80u) == 0 )
v24 = (const std::string::value_type *)&__p;
else
v24 = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v25 = v50;
else
v25 = v49;
std::string::append(&v51, v24, v25);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, "(");
}
if ( (v53.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v26 = &v53;
else
v26 = (std::string *)v53.__r_.__value_.__r.__words[0];
if ( (v53.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
size = HIBYTE(v53.__r_.__value_.__r.__words[2]);
else
size = v53.__r_.__value_.__l.__size_;
std::string::append(&v51, (const std::string::value_type *)v26, size);
if ( (v9 - 3 > 1 || v17 != 1.0) && (v9 - 3 < 0xFFFFFFFE || v17 != 0.0) )
{
std::string::append(&v51, " ");
sub_10040D254(v9, &__p);
if ( (v50 & 0x80u) == 0 )
v28 = (const std::string::value_type *)&__p;
else
v28 = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v29 = v50;
else
v29 = v49;
std::string::append(&v51, v28, v29);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, " ");
v30 = (cocos2d::CCString *)sub_100268F4C("%.03f", v17);
CString = cocos2d::CCString::getCString(v30);
std::string::append(&v51, CString);
}
if ( (int)v11 >= 1 )
std::string::append(&v51, ")");
if ( v19 >= 1 )
std::string::append(&v51, ")");
std::string::append(&v51, " ");
sub_10040D280((int)v8, &__p);
if ( (v50 & 0x80u) == 0 )
v32 = (const std::string::value_type *)&__p;
else
v32 = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v33 = v50;
else
v33 = v49;
std::string::append(&v51, v32, v33);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, " ");
v34 = (int)v14;
if ( (int)v14 >= 1 )
{
if ( v34 == 1 )
v35 = "abs";
else
v35 = "?";
if ( v34 == 2 )
v36 = "neg";
else
v36 = (char *)v35;
sub_100009900(&__p, v36);
if ( (v50 & 0x80u) == 0 )
v37 = (const std::string::value_type *)&__p;
else
v37 = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v38 = v50;
else
v38 = v49;
std::string::append(&v51, v37, v38);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, "(");
}
if ( (int)v12 >= 1 )
{
sub_10040D2AC((int)v12, 0, &__p);
if ( (v50 & 0x80u) == 0 )
v39 = (const std::string::value_type *)&__p;
else
v39 = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v40 = v50;
else
v40 = v49;
std::string::append(&v51, v39, v40);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, "(");
}
if ( !v16 )
goto LABEL_118;
if ( (v52.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v41 = &v52;
else
v41 = (std::string *)v52.__r_.__value_.__r.__words[0];
if ( (v52.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v42 = HIBYTE(v52.__r_.__value_.__r.__words[2]);
else
v42 = v52.__r_.__value_.__l.__size_;
std::string::append(&v51, (const std::string::value_type *)v41, v42);
if ( (v10 - 3 > 1 || v18 != 1.0) && (v10 - 3 < 0xFFFFFFFE || v18 != 0.0) )
{
std::string::append(&v51, " ");
sub_10040D254(v10, &__p);
if ( (v50 & 0x80u) == 0 )
v43 = (const std::string::value_type *)&__p;
else
v43 = (const std::string::value_type *)__p;
if ( (v50 & 0x80u) == 0 )
v44 = v50;
else
v44 = v49;
std::string::append(&v51, v43, v44);
if ( (char)v50 < 0 )
operator delete(__p);
std::string::append(&v51, " ");
LABEL_118:
v45 = (cocos2d::CCString *)sub_100268F4C("%.03f", v18);
v46 = cocos2d::CCString::getCString(v45);
std::string::append(&v51, v46);
}
if ( (int)v12 >= 1 )
std::string::append(&v51, ")");
if ( v34 >= 1 )
std::string::append(&v51, ")");
if ( (v51.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v47 = &v51;
else
v47 = (std::string *)v51.__r_.__value_.__r.__words[0];
((void (__fastcall *)(cocos2d::CCLabelBMFont *, std::string *))a1->m_formulaLabel->setString)(a1->m_formulaLabel, v47);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_formulaLabel, 230.0, 0.7, 0.0);
if ( SHIBYTE(v51.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v51.__r_.__value_.__l.__data_);
if ( SHIBYTE(v52.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v52.__r_.__value_.__l.__data_);
if ( SHIBYTE(v53.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v53.__r_.__value_.__l.__data_);
}