//
// SetupItemCompareTriggerPopup::updateFormulaLabel from 0x14046ec40 to 0x14046f54b (2315 bytes)
//
// 5 xrefs:
// > SetupItemCompareTriggerPopup::init @ 0x14046e5f6
// > SetupItemCompareTriggerPopup::onOpButton @ 0x14046e740
// > SetupItemCompareTriggerPopup::onCustomToggleTriggerValue @ 0x14046ec2c
// > SetupItemCompareTriggerPopup::valueDidChange @ 0x14046f567
// > ??> @ 0x1406db270
//
// 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
//
// Hidden C++ exception states: #wind=4
void SetupItemCompareTriggerPopup::updateFormulaLabel(SetupItemCompareTriggerPopup *a1)
{
unsigned int v2; // edi
int v3; // ebx
int v4; // r13d
int v5; // r15d
size_t v6; // rsi
int v7; // r15d
int v8; // r12d
double v9; // xmm0_8
float v10; // xmm6_4
double v11; // xmm0_8
size_t v12; // r8
unsigned __int8 v13; // al
void *v14; // rcx
size_t v15; // r8
unsigned __int8 v16; // al
void *v17; // rcx
void **v18; // rdx
size_t v19; // rbx
__int64 v20; // rax
void *v21; // rdx
cocos2d::CCString *v22; // rax
char *CString; // rax
size_t v24; // r8
__int64 v25; // rax
void *v26; // rdx
size_t v27; // r8
unsigned __int8 v28; // al
void *v29; // rcx
unsigned __int8 v30; // al
void *v31; // rcx
void **v32; // rdx
__int64 v33; // rax
void *v34; // rdx
cocos2d::CCString *v35; // rax
char *v36; // rax
cocos2d::CCString *v37; // rax
void **v38; // rdx
void *v39; // rcx
bool v40; // [rsp+28h] [rbp-A9h]
int v41; // [rsp+2Ch] [rbp-A5h]
int v42; // [rsp+30h] [rbp-A1h]
signed int v43; // [rsp+34h] [rbp-9Dh]
int v44; // [rsp+38h] [rbp-99h]
int v45; // [rsp+3Ch] [rbp-95h]
_QWORD Block[3]; // [rsp+40h] [rbp-91h] BYREF
__int64 v47; // [rsp+58h] [rbp-79h]
unsigned __int64 v48; // [rsp+60h] [rbp-71h]
void *Src[2]; // [rsp+68h] [rbp-69h] BYREF
__int64 v50; // [rsp+78h] [rbp-59h]
unsigned __int64 v51; // [rsp+80h] [rbp-51h]
void *v52[4]; // [rsp+88h] [rbp-49h] BYREF
void *v53[4]; // [rsp+A8h] [rbp-29h] BYREF
v2 = (int)a1->getValue(a1, 80);
v43 = (int)a1->getValue(a1, 95);
v3 = (int)a1->getValue(a1, 476);
v44 = (int)a1->getValue(a1, 477);
v4 = (int)a1->getValue(a1, 480);
v5 = (int)a1->getValue(a1, 481);
v45 = (int)a1->getValue(a1, 482);
v6 = 3;
if ( v4 <= 0 )
v4 = 3;
if ( v5 <= 0 )
v5 = 3;
v41 = v5;
v7 = (int)a1->getValue(a1, 485);
v42 = (int)a1->getValue(a1, 486);
v8 = (int)a1->getValue(a1, 578);
LODWORD(Block[0]) = (int)a1->getValue(a1, 579);
if ( v3 <= 0 )
v3 = 1;
sub_14046C070(v53, v3, v2);
sub_14046C070(v52, v44, v43);
v40 = v44 && (v43 > 0 || (unsigned int)(v44 - 3) <= 2);
v9 = ((double (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 479);
v10 = *(float *)&v9;
v11 = ((double (__fastcall *)(SetupItemCompareTriggerPopup *, __int64))a1->getValue)(a1, 483);
*(_OWORD *)Src = 0;
v50 = 0;
v51 = 15;
LOBYTE(Src[0]) = 0;
if ( v8 <= 0 )
goto LABEL_24;
v48 = 15;
*(_OWORD *)&Block[1] = 0;
if ( v8 == 1 )
{
LOWORD(Block[1]) = 25185;
v13 = 115;
goto LABEL_18;
}
if ( v8 == 2 )
{
LOWORD(Block[1]) = 25966;
v13 = 103;
LABEL_18:
WORD1(Block[1]) = v13;
v47 = 3;
v12 = 3;
goto LABEL_19;
}
v12 = 1;
v47 = 1;
strcpy((char *)&Block[1], "?");
LABEL_19:
sub_140041270(Src, &Block[1], v12);
if ( v48 > 0xF )
{
v14 = (void *)Block[1];
if ( v48 + 1 >= 0x1000 )
{
v14 = *(void **)(Block[1] - 8LL);
if ( (unsigned __int64)(Block[1] - (_QWORD)v14 - 8LL) > 0x1F )
goto LABEL_79;
}
j_j_free(v14);
}
sub_140041270(Src, "(", 1u);
LABEL_24:
if ( v7 <= 0 )
goto LABEL_38;
v48 = 15;
*(_OWORD *)&Block[1] = 0;
switch ( v7 )
{
case 1:
LOWORD(Block[1]) = 28274;
v16 = 100;
goto LABEL_32;
case 2:
LOWORD(Block[1]) = 27750;
v16 = 114;
goto LABEL_32;
case 3:
LOWORD(Block[1]) = 25955;
v16 = 105;
LABEL_32:
v15 = 3;
v47 = 3;
WORD1(Block[1]) = v16;
goto LABEL_33;
}
v15 = 1;
v47 = 1;
strcpy((char *)&Block[1], "?");
LABEL_33:
sub_140041270(Src, &Block[1], v15);
if ( v48 > 0xF )
{
v17 = (void *)Block[1];
if ( v48 + 1 >= 0x1000 )
{
v17 = *(void **)(Block[1] - 8LL);
if ( (unsigned __int64)(Block[1] - (_QWORD)v17 - 8LL) > 0x1F )
goto LABEL_79;
}
j_j_free(v17);
}
sub_140041270(Src, "(", 1u);
LABEL_38:
v18 = v53;
if ( v53[3] > (void *)0xF )
v18 = (void **)v53[0];
sub_140041270(Src, v18, (size_t)v53[2]);
v19 = -1;
if ( (v10 != 1.0 || (unsigned int)(v4 - 3) > 1) && (v10 != 0.0 || (unsigned int)(v4 - 1) > 1) )
{
sub_140041270(Src, " ", 1u);
v20 = sub_14046BE30((__int64)&Block[1], v4);
v21 = (void *)v20;
if ( *(_QWORD *)(v20 + 24) > 0xFu )
v21 = *(void **)v20;
sub_140041270(Src, v21, *(_QWORD *)(v20 + 16));
sub_14003A830((__int64)&Block[1]);
sub_140041270(Src, " ", 1u);
v22 = cocos2d::CCString::createWithFormat("%.03f", v10);
CString = (char *)cocos2d::CCString::getCString(v22);
v24 = -1;
do
++v24;
while ( CString[v24] );
sub_140041270(Src, CString, v24);
}
if ( v7 > 0 )
sub_140041270(Src, ")", 1u);
if ( v8 > 0 )
sub_140041270(Src, ")", 1u);
sub_140041270(Src, " ", 1u);
v25 = sub_14046BF20((__int64)&Block[1], v45);
v26 = (void *)v25;
if ( *(_QWORD *)(v25 + 24) > 0xFu )
v26 = *(void **)v25;
sub_140041270(Src, v26, *(_QWORD *)(v25 + 16));
sub_14003A830((__int64)&Block[1]);
sub_140041270(Src, " ", 1u);
if ( SLODWORD(Block[0]) > 0 )
{
v48 = 15;
*(_OWORD *)&Block[1] = 0;
if ( LODWORD(Block[0]) == 1 )
{
LOWORD(Block[1]) = 25185;
v28 = 115;
}
else
{
if ( LODWORD(Block[0]) != 2 )
{
v27 = 1;
v47 = 1;
strcpy((char *)&Block[1], "?");
LABEL_62:
sub_140041270(Src, &Block[1], v27);
if ( v48 <= 0xF )
{
LABEL_66:
sub_140041270(Src, "(", 1u);
goto LABEL_67;
}
v29 = (void *)Block[1];
if ( v48 + 1 < 0x1000
|| (v29 = *(void **)(Block[1] - 8LL), (unsigned __int64)(Block[1] - (_QWORD)v29 - 8LL) <= 0x1F) )
{
j_j_free(v29);
goto LABEL_66;
}
LABEL_79:
invalid_parameter_noinfo_noreturn();
}
LOWORD(Block[1]) = 25966;
v28 = 103;
}
WORD1(Block[1]) = v28;
v47 = 3;
v27 = 3;
goto LABEL_62;
}
LABEL_67:
if ( v42 <= 0 )
goto LABEL_82;
v48 = 15;
*(_OWORD *)&Block[1] = 0;
switch ( v42 )
{
case 1:
LOWORD(Block[1]) = 28274;
v30 = 100;
goto LABEL_75;
case 2:
LOWORD(Block[1]) = 27750;
v30 = 114;
goto LABEL_75;
case 3:
LOWORD(Block[1]) = 25955;
v30 = 105;
LABEL_75:
WORD1(Block[1]) = v30;
v47 = 3;
goto LABEL_76;
}
v6 = 1;
v47 = 1;
strcpy((char *)&Block[1], "?");
LABEL_76:
sub_140041270(Src, &Block[1], v6);
if ( v48 > 0xF )
{
v31 = (void *)Block[1];
if ( v48 + 1 >= 0x1000 )
{
v31 = *(void **)(Block[1] - 8LL);
if ( (unsigned __int64)(Block[1] - (_QWORD)v31 - 8LL) > 0x1F )
goto LABEL_79;
}
j_j_free(v31);
}
sub_140041270(Src, "(", 1u);
LABEL_82:
if ( !v40 )
{
v37 = cocos2d::CCString::createWithFormat("%.03f", *(float *)&v11);
v36 = (char *)cocos2d::CCString::getCString(v37);
do
++v19;
while ( v36[v19] );
LABEL_96:
sub_140041270(Src, v36, v19);
goto LABEL_97;
}
v32 = v52;
if ( v52[3] > (void *)0xF )
v32 = (void **)v52[0];
sub_140041270(Src, v32, (size_t)v52[2]);
if ( (*(float *)&v11 != 1.0 || (unsigned int)(v41 - 3) > 1) && (*(float *)&v11 != 0.0 || (unsigned int)(v41 - 1) > 1) )
{
sub_140041270(Src, " ", 1u);
v33 = sub_14046BE30((__int64)&Block[1], v41);
v34 = (void *)v33;
if ( *(_QWORD *)(v33 + 24) > 0xFu )
v34 = *(void **)v33;
sub_140041270(Src, v34, *(_QWORD *)(v33 + 16));
sub_14003A830((__int64)&Block[1]);
sub_140041270(Src, " ", 1u);
v35 = cocos2d::CCString::createWithFormat("%.03f", *(float *)&v11);
v36 = (char *)cocos2d::CCString::getCString(v35);
do
++v19;
while ( v36[v19] );
goto LABEL_96;
}
LABEL_97:
if ( v42 > 0 )
sub_140041270(Src, ")", 1u);
if ( SLODWORD(Block[0]) > 0 )
sub_140041270(Src, ")", 1u);
v38 = Src;
if ( v51 > 0xF )
v38 = (void **)Src[0];
a1->m_formulaLabel->setString(&a1->m_formulaLabel->cocos2d::CCLabelProtocol, (const char *)v38);
cocos2d::CCLabelBMFont::limitLabelWidth(a1->m_formulaLabel, 230.0, 0.69999999, 0.0);
if ( v51 > 0xF )
{
v39 = Src[0];
if ( v51 + 1 >= 0x1000 )
{
v39 = *((void **)Src[0] - 1);
if ( (unsigned __int64)((char *)Src[0] - (char *)v39 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v39);
}
v50 = 0;
v51 = 15;
LOBYTE(Src[0]) = 0;
sub_14003A830((__int64)v52);
sub_14003A830((__int64)v53);
}