//
// SetupItemCompareTriggerPopup::updateFormulaLabel from 0x1005ae950 to 0x1005af1a3 (2131 bytes)
//
// 4 xrefs:
// > SetupItemCompareTriggerPopup::init @ 0x1005ae42d
// > SetupItemCompareTriggerPopup::onOpButton @ 0x1005ae6e8
// > SetupItemCompareTriggerPopup::onCustomToggleTriggerValue @ 0x1005af442
// > SetupItemCompareTriggerPopup::valueDidChange @ 0x1005af479
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:32:38 +0000
//
void __fastcall SetupItemCompareTriggerPopup::updateFormulaLabel(_QWORD *a1)
{
int v2; // r13d
int v3; // r15d
__int64 v4; // r14
int v5; // r12d
int v6; // r14d
int v7; // esi
std::string *v8; // rax
int v9; // r13d
_BYTE *v10; // r15
int v11; // r14d
std::string::size_type v12; // rdx
_BYTE *v13; // rax
int v14; // r12d
_BYTE *v15; // rax
std::string::size_type v16; // rdx
const std::string::value_type *data; // rsi
std::string::size_type size; // rdx
_BYTE *v19; // rax
std::string::size_type v20; // rdx
__int64 v21; // rax
const std::string::value_type *CString; // rax
_BYTE *v23; // rax
std::string::size_type v24; // rdx
int v25; // r12d
std::string::size_type v26; // rdx
int v27; // r15d
_BYTE *v28; // rax
std::string::size_type v29; // rdx
const std::string::value_type *v30; // rsi
std::string::size_type v31; // rdx
_BYTE *v32; // rax
std::string::size_type v33; // rdx
__int64 v34; // rax
const std::string::value_type *v35; // rax
__int64 v36; // rdi
std::string::pointer v37; // rsi
std::string v38; // [rsp+0h] [rbp-B0h] BYREF
std::string v39; // [rsp+18h] [rbp-98h] BYREF
__int64 v40; // [rsp+30h] [rbp-80h]
float v41; // [rsp+38h] [rbp-78h]
float v42; // [rsp+3Ch] [rbp-74h]
float v43; // [rsp+40h] [rbp-70h]
float v44; // [rsp+44h] [rbp-6Ch]
float v45; // [rsp+48h] [rbp-68h]
int v46; // [rsp+4Ch] [rbp-64h]
std::string v47; // [rsp+50h] [rbp-60h] BYREF
int v48; // [rsp+68h] [rbp-48h]
float v49; // [rsp+6Ch] [rbp-44h]
int __s; // [rsp+70h] [rbp-40h] BYREF
_BYTE v51[12]; // [rsp+74h] [rbp-3Ch] BYREF
void *__p; // [rsp+80h] [rbp-30h]
v48 = (int)(*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 80);
LODWORD(v49) = (int)(*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 95);
v2 = (int)(*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 476);
v3 = (int)(*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 477);
v4 = (unsigned int)(int)(*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 480);
v5 = (int)(*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 481);
v43 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 482);
if ( (int)v4 <= 0 )
v4 = 3;
v40 = v4;
v6 = LODWORD(v49);
if ( v5 <= 0 )
v5 = 3;
v42 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 485);
v45 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 486);
v41 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 578);
v44 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 579);
v7 = 1;
if ( v2 >= 2 )
v7 = v2;
sub_1005ACEB0(&v38, v7, v48);
v8 = sub_1005ACEB0(&v39, v3, v6);
if ( v3 )
{
LOBYTE(v8) = 1;
v46 = (int)v8;
v9 = v5;
if ( v6 <= 0 )
{
LOBYTE(v8) = (unsigned int)(v3 - 3) < 3;
v46 = (int)v8;
}
}
else
{
v46 = 0;
v9 = v5;
}
*(float *)&v48 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 479);
v49 = (*(float (__fastcall **)(_QWORD *, __int64))(*a1 + 1464LL))(a1, 483);
v10 = v51;
v11 = (int)v41;
*(_WORD *)&v47.__r_.__value_.__l.0 = 0;
if ( (int)v41 <= 0 )
goto LABEL_21;
if ( v11 == 2 )
{
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "neg", 3);
}
else
{
if ( v11 != 1 )
{
v13 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v12 = 1;
goto LABEL_18;
}
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "abs", 3);
}
v12 = 3;
v13 = v51;
LABEL_18:
*v13 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v12);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, "(");
LABEL_21:
v14 = (int)v42;
if ( (int)v42 > 0 )
{
v15 = v51;
switch ( v14 )
{
case 3:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "cei", 3);
v16 = 3;
break;
case 2:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "flr", 3);
v16 = 3;
break;
case 1:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "rnd", 3);
v16 = 3;
break;
default:
v15 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v16 = 1;
break;
}
*v15 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v16);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, "(");
}
if ( (*(_BYTE *)&v38.__r_.__value_.__s.0 & 1) != 0 )
{
data = v38.__r_.__value_.__l.__data_;
size = v38.__r_.__value_.__l.__size_;
}
else
{
size = *(_BYTE *)&v38.__r_.__value_.__l.0 >> 1;
data = v38.__r_.__value_.__s.__data_;
}
std::string::append(&v47, data, size);
if ( ((unsigned int)(v40 - 3) > 1 || *(float *)&v48 != 1.0)
&& ((unsigned int)(v40 - 3) < 0xFFFFFFFE || *(float *)&v48 != 0.0) )
{
std::string::append(&v47, " ");
v19 = (char *)&__s + 2;
switch ( (int)v40 )
{
case 0:
LOWORD(__s) = 15618;
v20 = 1;
break;
case 1:
LOWORD(__s) = 11010;
v20 = 1;
break;
case 2:
LOWORD(__s) = 11522;
v20 = 1;
break;
case 3:
v19 = v51;
__s = -1568611834;
v20 = 3;
break;
case 4:
LOWORD(__s) = 12034;
v20 = 1;
break;
default:
v19 = (char *)&__s + 3;
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 16718;
v20 = 2;
break;
}
*v19 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v20);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, " ");
v21 = sub_10088E820("%.03f", *(_BYTE *)&v38.__r_.__value_.__l.0);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v21);
std::string::append(&v47, CString);
}
if ( v14 > 0 )
std::string::append(&v47, ")");
if ( v11 > 0 )
std::string::append(&v47, ")");
std::string::append(&v47, " ");
v23 = (char *)&__s + 3;
switch ( (int)v43 )
{
case 0:
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 15677;
v24 = 2;
goto LABEL_62;
case 1:
LOWORD(__s) = 15874;
goto LABEL_61;
case 2:
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 15678;
v24 = 2;
goto LABEL_62;
case 3:
LOWORD(__s) = 15362;
goto LABEL_61;
case 4:
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 15676;
v24 = 2;
goto LABEL_62;
case 5:
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 15649;
v24 = 2;
goto LABEL_62;
default:
LOWORD(__s) = 16130;
LABEL_61:
v24 = 1;
v23 = (char *)&__s + 2;
LABEL_62:
*v23 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v24);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, " ");
v25 = (int)v44;
if ( (int)v44 > 0 )
{
if ( v25 == 2 )
{
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "neg", 3);
v26 = 3;
}
else if ( v25 == 1 )
{
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "abs", 3);
v26 = 3;
}
else
{
v10 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v26 = 1;
}
*v10 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v26);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, "(");
}
v27 = (int)v45;
if ( (int)v45 > 0 )
{
v28 = v51;
switch ( v27 )
{
case 3:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "cei", 3);
v29 = 3;
break;
case 2:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "flr", 3);
v29 = 3;
break;
case 1:
LOBYTE(__s) = 6;
qmemcpy((char *)&__s + 1, "rnd", 3);
v29 = 3;
break;
default:
v28 = (char *)&__s + 2;
LOWORD(__s) = 16130;
v29 = 1;
break;
}
*v28 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v29);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, "(");
}
if ( !(_BYTE)v46 )
goto LABEL_101;
if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) != 0 )
{
v30 = v39.__r_.__value_.__l.__data_;
v31 = v39.__r_.__value_.__l.__size_;
}
else
{
v31 = *(_BYTE *)&v39.__r_.__value_.__l.0 >> 1;
v30 = v39.__r_.__value_.__s.__data_;
}
std::string::append(&v47, v30, v31);
if ( ((unsigned int)(v9 - 3) > 1 || v49 != 1.0) && ((unsigned int)(v9 - 3) < 0xFFFFFFFE || v49 != 0.0) )
{
std::string::append(&v47, " ");
v32 = (char *)&__s + 2;
switch ( v9 )
{
case 1:
LOWORD(__s) = 11010;
v33 = 1;
break;
case 2:
LOWORD(__s) = 11522;
v33 = 1;
break;
case 3:
v32 = v51;
__s = -1568611834;
v33 = 3;
break;
case 4:
LOWORD(__s) = 12034;
v33 = 1;
break;
default:
v32 = (char *)&__s + 3;
LOBYTE(__s) = 4;
*(_WORD *)((char *)&__s + 1) = 16718;
v33 = 2;
break;
}
*v32 = 0;
std::string::append(&v47, (const std::string::value_type *)&__s + 1, v33);
if ( (__s & 1) != 0 )
operator delete(__p);
std::string::append(&v47, " ");
LABEL_101:
v34 = sub_10088E820("%.03f", *(_BYTE *)&v38.__r_.__value_.__l.0);
v35 = (const std::string::value_type *)cocos2d::CCString::getCString(v34);
std::string::append(&v47, v35);
}
if ( v27 > 0 )
std::string::append(&v47, ")");
if ( v25 > 0 )
std::string::append(&v47, ")");
v36 = a1[127];
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) != 0 )
v37 = v47.__r_.__value_.__l.__data_;
else
v37 = v47.__r_.__value_.__s.__data_;
(*(void (__fastcall **)(__int64, std::string::pointer))(*(_QWORD *)v36 + 928LL))(v36, v37);
cocos2d::CCLabelBMFont::limitLabelWidth(a1[127], 230.0, 0.69999999, 0.0);
if ( (*(_BYTE *)&v47.__r_.__value_.__s.0 & 1) != 0 )
{
operator delete(v47.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_111:
if ( (*(_BYTE *)&v38.__r_.__value_.__s.0 & 1) == 0 )
return;
goto LABEL_112;
}
}
else if ( (*(_BYTE *)&v39.__r_.__value_.__s.0 & 1) == 0 )
{
goto LABEL_111;
}
operator delete(v39.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&v38.__r_.__value_.__s.0 & 1) != 0 )
LABEL_112:
operator delete(v38.__r_.__value_.__l.__data_);
return;
}
}