//
// DeathHistogram::setSurvival from 0x1401126a0 to 0x140112eb0 (2064 bytes)
//
// 2 xrefs:
// > DeathTrackerPopup::refreshGlobal @ 0x140109599
// > ??> @ 0x140915e60
//
// 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 11:26:50 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall DeathHistogram::setSurvival(__int64 a1, _QWORD *a2, char a3, char a4, int a5)
{
__int64 v8; // rax
__int64 v9; // r14
float v10; // xmm9_4
__int64 v11; // r9
__int64 v12; // r9
float v13; // xmm7_4
int v14; // r15d
float v15; // xmm10_4
__int64 v16; // r13
int i; // esi
float v18; // xmm6_4
int v19; // ebx
float v20; // xmm2_4
float v21; // xmm8_4
char v22; // cl
float v23; // xmm8_4
cocos2d::CCString *v24; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v26; // rdi
__int64 v27; // rbx
__int64 v28; // rax
__m128d v29; // xmm1
__int64 v30; // rdx
cocos2d::CCString *v31; // rax
const char *v32; // rax
struct cocos2d::CCLabelBMFont *v33; // rdi
__int64 v34; // rbx
__int64 v35; // rax
float v36; // xmm6_4
__int64 v37; // rdi
__int64 v38; // rbx
__int64 v39; // rcx
__int64 v40; // rcx
__int64 v41; // rcx
__int128 *v42; // rcx
int v43; // esi
__int64 v44; // r15
int v45; // ebx
float v46; // xmm6_4
float v47; // xmm2_4
float v48; // xmm7_4
char v49; // cl
cocos2d::CCString *v50; // rax
const char *v51; // rax
struct cocos2d::CCLabelBMFont *v52; // rdi
__int64 v53; // rbx
__int64 v54; // rax
int v55; // edi
float v56; // xmm6_4
__int64 v57; // rbx
__int64 v58; // rcx
float *v59; // rcx
float v60; // xmm6_4
__int64 v61; // rcx
__int16 v62; // [rsp+30h] [rbp-D0h] BYREF
char v63; // [rsp+32h] [rbp-CEh]
int v64; // [rsp+40h] [rbp-C0h] BYREF
float v65[3]; // [rsp+44h] [rbp-BCh] BYREF
__int128 v66; // [rsp+50h] [rbp-B0h] BYREF
__int128 v67; // [rsp+60h] [rbp-A0h] BYREF
__int64 v68; // [rsp+70h] [rbp-90h]
__int128 v69; // [rsp+78h] [rbp-88h] BYREF
__int64 v70; // [rsp+88h] [rbp-78h]
float v71[4]; // [rsp+90h] [rbp-70h] BYREF
_BYTE v72[24]; // [rsp+A0h] [rbp-60h] BYREF
char v73[168]; // [rsp+B8h] [rbp-48h] BYREF
__int64 v74; // [rsp+1A0h] [rbp+A0h] BYREF
__int16 v75; // [rsp+1B0h] [rbp+B0h] BYREF
char v76; // [rsp+1B2h] [rbp+B2h]
char v77; // [rsp+1B8h] [rbp+B8h]
v77 = a4;
v74 = a1;
v8 = *(_QWORD *)(a1 + 328);
v64 = *(_DWORD *)(v8 + 436);
v9 = *(_QWORD *)(v8 + 416);
(*(void (__fastcall **)(__int64))(*(_QWORD *)v9 + 568LL))(v9);
v10 = fmaxf(10.0, (float)(*(float *)(a1 + 324) - 32.0) - 36.0);
DeathHistogram::rebuildAxis(a1, "REACHED %", 100, 32.0, v10, "PROGRESS (%)");
if ( a3 )
{
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v65, (const struct cocos2d::CCSize *)(*(_QWORD *)(a1 + 328) + 424LL));
v13 = (float)(v65[0] - 6.0) / 11.0;
v67 = 0;
v68 = 0;
v14 = 0;
v15 = v13 * 0.5;
v16 = 0;
for ( i = 0; i < 110; i += 10 )
{
v18 = (float)((float)v14 * v13) + v15;
if ( i >= (int)((__int64)(a2[1] - *a2) >> 2) || (v19 = *(_DWORD *)(*a2 + v16), v19 <= 0) )
{
sub_140110C50(v9, v18, i);
}
else
{
v20 = (float)v19 / 100.0;
v21 = fmaxf(3.0, (float)(v20 * v10) - 4.0);
if ( (unsigned int)i < 0x64 )
{
sub_1401107E0(&v75, 1.0 - v20);
v22 = v76;
}
else
{
v75 = -5351;
v22 = 45;
v76 = 45;
}
v62 = v75;
v63 = v22;
sub_1401108B0(v9, v18, 35.0, v12, v21, (__int64)&v62);
v23 = (float)(v21 + 35.0) + 8.0;
v24 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v19);
CString = cocos2d::CCString::getCString(v24);
v26 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v26 + 160LL))(v26);
v27 = *(_QWORD *)v26;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v73, v18, v23);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v27 + 184))(v26, v28);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v9 + 456LL))(v9, v26, 1);
*(_QWORD *)v72 = v26;
v29 = *(__m128d *)sub_140110F30(v71, (__int64)v26, v18, v23, 0.31999999);
*(__m128d *)&v72[8] = v29;
v30 = *((_QWORD *)&v67 + 1);
if ( *((_QWORD *)&v67 + 1) == v68 )
{
sub_1400807C0(&v67, *((_BYTE **)&v67 + 1), (__int64)v72);
}
else
{
**((_OWORD **)&v67 + 1) = *(_OWORD *)v72;
*(double *)(v30 + 16) = _mm_unpackhi_pd(v29, v29).m128d_f64[0];
*((_QWORD *)&v67 + 1) += 24LL;
}
v31 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)i);
v32 = cocos2d::CCString::getCString(v31);
v33 = cocos2d::CCLabelBMFont::create(v32, "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v33 + 160LL))(v33);
LOWORD(v64) = -14081;
BYTE2(v64) = 120;
(**((void (__fastcall ***)(__int64, int *))v33 + 46))((__int64)v33 + 368, &v64);
v34 = *(_QWORD *)v33;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, v18, 25.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v34 + 184))(v33, v35);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v9 + 464LL))(v9, v33);
}
++v14;
v16 += 40;
}
if ( a5 > 0 )
{
v36 = (float)((float)((float)a5 / 10.0) * v13) + v15;
v66 = *(_OWORD *)sub_140112430(v71, v9, v36, 35.0, v10 + 35.0);
sub_1401112C0((__int64 *)&v67, v36, (float *)&v66, 3.0);
}
v37 = v74;
v38 = *(_QWORD *)(v74 + 328);
*(float *)(v38 + 432) = v65[0];
ScrollableContentLayer::clampOffset(v38);
ScrollableContentLayer::ensureScrollThumb(v39);
ScrollableContentLayer::applyContentPosition(v38);
v40 = *(_QWORD *)(v37 + 328);
*(_DWORD *)(v40 + 436) = 0;
*(_DWORD *)(v40 + 476) = 0;
ScrollableContentLayer::clampOffset(v40);
ScrollableContentLayer::applyContentPosition(v41);
v42 = &v67;
}
else
{
v69 = 0;
v70 = 0;
v43 = 0;
v44 = 0;
do
{
if ( v43 >= (int)((__int64)(a2[1] - *a2) >> 2) )
break;
v45 = *(_DWORD *)(v44 + *a2);
v46 = (float)((float)((float)v43 * 18.0) + 3.0) + 9.0;
if ( v45 > 0 )
{
v47 = (float)v45 / 100.0;
v48 = fmaxf(3.0, (float)(v47 * v10) - 4.0);
if ( (unsigned int)v43 < 0x64 )
{
sub_1401107E0(&v75, 1.0 - v47);
v49 = v76;
}
else
{
v75 = -5351;
v49 = 45;
v76 = 45;
}
v62 = v75;
v63 = v49;
sub_1401108B0(v9, v46, 35.0, v11, v48, (__int64)&v62);
sub_140111000(&v69, v9, v45, v46, (float)(v48 + 35.0) + 8.0);
v50 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v43);
v51 = cocos2d::CCString::getCString(v50);
v52 = cocos2d::CCLabelBMFont::create(v51, "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v52 + 160LL))(v52);
LOWORD(v74) = -14081;
BYTE2(v74) = 120;
(**((void (__fastcall ***)(__int64, __int64 *))v52 + 46))((__int64)v52 + 368, &v74);
v53 = *(_QWORD *)v52;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, v46, 25.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v53 + 184))(v52, v54);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v9 + 464LL))(v9, v52);
}
else
{
sub_140110C50(v9, v46, v43);
}
++v43;
v44 += 4;
}
while ( v43 <= 100 );
v55 = a5;
v56 = (float)((float)((float)a5 + 0.5) * 18.0) + 3.0;
if ( a5 > 0 )
{
v66 = *(_OWORD *)sub_140112430(v71, v9, v56, 35.0, v10 + 35.0);
sub_1401112C0((__int64 *)&v69, v56, (float *)&v66, 3.0);
}
v57 = *(_QWORD *)(a1 + 328);
*(_DWORD *)(v57 + 432) = 1155850240;
ScrollableContentLayer::clampOffset(v57);
ScrollableContentLayer::ensureScrollThumb(v58);
ScrollableContentLayer::applyContentPosition(v57);
v59 = *(float **)(a1 + 328);
if ( v77 )
{
*((_DWORD *)v59 + 109) = v64;
}
else
{
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v74, (const struct cocos2d::CCSize *)(v59 + 106));
if ( v55 <= 0 || v56 <= (float)(*(float *)&v74 - 30.0) )
v60 = 0.0;
else
v60 = v56 - (float)(*(float *)&v74 * 0.5);
v59 = *(float **)(a1 + 328);
v59[109] = v60;
}
v59[119] = 0.0;
ScrollableContentLayer::clampOffset((__int64)v59);
ScrollableContentLayer::applyContentPosition(v61);
v42 = &v69;
}
sub_140059CE0((__int64)v42);
}