//
// GJSmartBlockPreview::addChance from 0x1004161a0 to 0x10041633e (414 bytes)
//
// 2 xrefs:
// > BrowseSmartKeyLayer::init @ 0x1004e5cf6
// > BrowseSmartKeyLayer::updateChanceValues @ 0x1004e6aa4
//
// 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:30:11 +0000
//
void __fastcall GJSmartBlockPreview::addChance(_QWORD *a1, int a2, int a3)
{
__int64 v5; // r12
double v6; // xmm0_8
__int64 v7; // rax
const std::string::value_type *CString; // rax
__int64 v9; // rax
__int64 v10; // rdi
std::string::pointer data; // rsi
std::string v12; // [rsp+0h] [rbp-40h] BYREF
if ( !a1[43] )
{
v9 = cocos2d::CCLabelBMFont::create_3(" ", "bigFont.fnt");
a1[43] = v9;
(*(void (__fastcall **)(_QWORD *, __int64))(*a1 + 456LL))(a1, v9);
v5 = a1[43];
if ( a3 )
goto LABEL_3;
LABEL_6:
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v5 + 344LL))(v5, 0);
return;
}
v5 = a1[43];
if ( !a3 )
goto LABEL_6;
LABEL_3:
sub_100278250((float *)&v12, 45.0, -15.0);
(*(void (__fastcall **)(__int64, std::string *))(*(_QWORD *)v5 + 184LL))(v5, &v12);
v6 = 0.0;
memset(&v12, 0, sizeof(v12));
if ( a2 )
{
v6 = (float)((float)((float)a2 / (float)a3) * 100.0);
v7 = sub_10088E820("%i (%.1f%%)", *(_BYTE *)&v12.__r_.__value_.__l.0);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v7);
std::string::assign(&v12, CString);
}
else
{
std::string::assign(&v12, "0");
}
v10 = a1[43];
if ( (*(_BYTE *)&v12.__r_.__value_.__s.0 & 1) != 0 )
data = v12.__r_.__value_.__l.__data_;
else
data = v12.__r_.__value_.__s.__data_;
(*(void (__fastcall **)(__int64, std::string::pointer, double))(*(_QWORD *)v10 + 928LL))(v10, data, v6);
cocos2d::CCLabelBMFont::limitLabelWidth(a1[43], 100.0, 0.80000001, 0.0);
(*(void (__fastcall **)(_QWORD, __int64))(*(_QWORD *)a1[43] + 344LL))(a1[43], 1);
if ( (*(_BYTE *)&v12.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v12.__r_.__value_.__l.__data_);
}