//
// DeathHistogram::setProgression from 0x140114220 to 0x14011494b (1835 bytes)
//
// 2 xrefs:
// > DeathTrackerPopup::init @ 0x140105dc1
// > ??> @ 0x140915e78
//
// 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:51 +0000
//
// Hidden C++ exception states: #wind=1
void __fastcall DeathHistogram::setProgression(__int64 a1, __int64 *a2, _QWORD *a3, __time64_t a4)
{
__int64 *v4; // rdi
__int64 v5; // r12
__int64 v6; // rsi
__int64 v7; // rdx
unsigned __int64 v8; // r14
__int64 v9; // rax
struct cocos2d::CCLabelBMFont *v10; // rdi
void (__fastcall *v11)(struct cocos2d::CCLabelBMFont *, __int64); // rbx
__int64 v12; // rax
__int64 v13; // rbx
__int64 v14; // rcx
__int64 v15; // rcx
float v16; // xmm8_4
int v17; // r8d
unsigned __int64 v18; // rcx
__m128i v19; // xmm1
__m128i v20; // xmm2
__m128i v21; // xmm1
__m128i v22; // xmm1
int v23; // eax
unsigned __int64 v24; // rax
int v25; // ebx
int v26; // r13d
__int64 v27; // rsi
float v28; // xmm14_4
__int64 v29; // r12
_QWORD *v30; // r14
int v31; // ebx
bool v32; // cc
float v33; // xmm2_4
float v34; // xmm6_4
float v35; // xmm7_4
_BYTE *v36; // rax
__int64 v37; // r9
cocos2d::CCString *v38; // rax
const char *CString; // rax
struct cocos2d::CCLabelBMFont *v40; // rdi
void (__fastcall *v41)(struct cocos2d::CCLabelBMFont *, __int64); // rbx
__int64 v42; // rax
struct tm *v43; // rax
size_t v44; // r8
__int64 v45; // rdx
cocos2d::CCString *v46; // rax
char *v47; // rax
size_t v48; // r8
const char *v49; // rcx
struct cocos2d::CCLabelBMFont *v50; // rdi
void (__fastcall *v51)(struct cocos2d::CCLabelBMFont *, __int64); // rbx
__int64 v52; // rax
float v53; // xmm6_4
float v54; // xmm0_4
__int64 v55; // rbx
__int64 v56; // rcx
__int64 v57; // rcx
__int16 v58; // [rsp+30h] [rbp-D0h] BYREF
char v59; // [rsp+32h] [rbp-CEh]
__int16 v60; // [rsp+40h] [rbp-C0h] BYREF
char v61; // [rsp+42h] [rbp-BEh]
__int64 v62; // [rsp+50h] [rbp-B0h] BYREF
float v63; // [rsp+58h] [rbp-A8h] BYREF
__time64_t Time; // [rsp+60h] [rbp-A0h] BYREF
unsigned __int64 v65; // [rsp+68h] [rbp-98h] BYREF
__int64 v66; // [rsp+70h] [rbp-90h] BYREF
_QWORD *v67; // [rsp+78h] [rbp-88h]
__int64 v68; // [rsp+80h] [rbp-80h]
__int64 *v69; // [rsp+88h] [rbp-78h]
char v70[8]; // [rsp+90h] [rbp-70h] BYREF
__int128 v71; // [rsp+98h] [rbp-68h] BYREF
__int64 v72; // [rsp+A8h] [rbp-58h]
unsigned __int64 v73; // [rsp+B0h] [rbp-50h]
char Buffer[16]; // [rsp+B8h] [rbp-48h] BYREF
Time = a4;
v67 = a3;
v4 = a2;
v69 = a2;
v5 = a1;
v62 = a1;
v6 = *(_QWORD *)(*(_QWORD *)(a1 + 328) + 416LL);
v66 = v6;
(*(void (__fastcall **)(__int64))(*(_QWORD *)v6 + 568LL))(v6);
v7 = *v4;
v8 = (v4[1] - *v4) >> 2;
v65 = v8;
if ( !(_DWORD)v8 )
{
cocos2d::CCDrawNode::clear(*(cocos2d::CCDrawNode **)(v5 + 336));
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)(v5 + 344) + 568LL))(*(_QWORD *)(v5 + 344));
v9 = cocos2d::CCRect::operator=(v5 + 372, &unk_14090A1F0);
cocos2d::CCRect::operator=(v5 + 356, v9);
v10 = cocos2d::CCLabelBMFont::create("No sessions yet.", "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v10 + 160LL))(v10);
v58 = -26986;
v59 = -106;
(**((void (__fastcall ***)(__int64, __int16 *))v10 + 46))((__int64)v10 + 368, &v58);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v63, (const struct cocos2d::CCSize *)(*(_QWORD *)(v5 + 328) + 424LL));
v11 = *(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v10 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v62, v63 * 0.5, *(float *)(v5 + 324) * 0.5);
v11(v10, v12);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v6 + 464LL))(v6, v10);
v13 = *(_QWORD *)(v5 + 328);
*(_DWORD *)(v13 + 432) = *(_DWORD *)(v5 + 320);
ScrollableContentLayer::clampOffset(v13);
ScrollableContentLayer::ensureScrollThumb(v14);
ScrollableContentLayer::applyContentPosition(v13);
v15 = *(_QWORD *)(v5 + 328);
*(_DWORD *)(v15 + 436) = 0;
goto LABEL_46;
}
v16 = fmaxf(10.0, (float)(*(float *)(v5 + 324) - 32.0) - 36.0);
v17 = 0;
v18 = 0;
if ( !v8 )
goto LABEL_13;
if ( v8 < 8 )
goto LABEL_49;
if ( dword_1408FE018 < 2 )
goto LABEL_49;
v19 = 0;
v20 = 0;
do
{
v19 = _mm_max_epi32(v19, _mm_loadu_si128((const __m128i *)(v7 + 4 * v18)));
v20 = _mm_max_epi32(v20, _mm_loadu_si128((const __m128i *)(v7 + 4 * v18 + 16)));
v18 += 8LL;
}
while ( v18 < v8 - (v8 & 7) );
v21 = _mm_max_epi32(v19, v20);
v22 = _mm_max_epi32(v21, _mm_srli_si128(v21, 8));
v17 = _mm_cvtsi128_si32(_mm_max_epi32(v22, _mm_srli_si128(v22, 4)));
if ( v18 < v8 )
{
LABEL_49:
do
{
v23 = *(_DWORD *)(v7 + 4 * v18);
if ( v23 <= v17 )
v23 = v17;
v17 = v23;
++v18;
}
while ( v18 < v8 );
}
if ( v17 >= 100 )
{
LABEL_16:
v25 = 100;
}
else
{
LABEL_13:
v24 = 0;
while ( 1 )
{
v25 = *(_DWORD *)((char *)&unk_14072FB30 + v24);
if ( v25 >= v17 + (v17 + 3) / 4 )
break;
v24 += 4LL;
if ( v24 >= 0x28 )
goto LABEL_16;
}
}
DeathHistogram::rebuildAxis(v5, "BEST %", v25, 32.0, v16, "SESSIONS");
v26 = 0;
v68 = (int)v8;
if ( (int)v8 <= 0 )
goto LABEL_42;
v27 = 0;
v28 = (float)v25;
v29 = v66;
v30 = (_QWORD *)Time;
do
{
v31 = *(_DWORD *)(*v4 + 4 * v27);
v32 = v31 <= 100;
if ( v31 <= 100 )
{
if ( v31 < 0 )
{
v31 = 0;
goto LABEL_25;
}
v32 = v31 <= 100;
}
if ( !v32 )
v31 = 100;
LABEL_25:
v33 = (float)v31 / v28;
v34 = fmaxf(3.0, (float)(v33 * v16) - 4.0);
v35 = (float)((float)v26 * 31.0) + 15.5;
v36 = sub_1401107E0(&v63, 1.0 - v33);
v60 = *(_WORD *)v36;
v61 = v36[2];
sub_1401108B0(v29, v35, 35.0, v37, v34, (__int64)&v60);
v38 = cocos2d::CCString::createWithFormat("%i%%", v31);
CString = cocos2d::CCString::getCString(v38);
v40 = cocos2d::CCLabelBMFont::create(CString, (const char *)&qword_140704F78);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v40 + 160LL))(v40);
v41 = *(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v40 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, v35, (float)(v34 + 35.0) + 8.0);
v41(v40, v42);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v29 + 464LL))(v29, v40);
v71 = 0;
v72 = 0;
v73 = 15;
LOBYTE(v71) = 0;
if ( v26 >= (int)((__int64)(v67[1] - *v67) >> 2) || *(int *)(*v67 + 4 * v27) <= 0 )
goto LABEL_32;
Time = *(int *)(*v67 + 4 * v27);
v43 = localtime64(&Time);
*(_OWORD *)Buffer = 0;
if ( v43 )
strftime(Buffer, 0x10u, "%m/%d", v43);
v44 = -1;
do
++v44;
while ( Buffer[v44] );
sub_1400405A0((void **)&v71, Buffer, v44);
if ( !v72 )
{
LABEL_32:
if ( v26 >= (int)((__int64)(v30[1] - *v30) >> 2) )
v45 = (unsigned int)(v26 + 1);
else
v45 = *(unsigned int *)(*v30 + 4 * v27);
v46 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, v45);
v47 = (char *)cocos2d::CCString::getCString(v46);
v48 = -1;
do
++v48;
while ( v47[v48] );
sub_1400405A0((void **)&v71, v47, v48);
}
v49 = (const char *)&v71;
if ( v73 > 0xF )
v49 = (const char *)v71;
v50 = cocos2d::CCLabelBMFont::create(v49, "chatFont.fnt");
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v50 + 160LL))(v50);
v58 = -14081;
v59 = 120;
(**((void (__fastcall ***)(__int64, __int16 *))v50 + 46))((__int64)v50 + 368, &v58);
v51 = *(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(*(_QWORD *)v50 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v70, v35, 24.0);
v51(v50, v52);
(*(void (__fastcall **)(__int64, struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v29 + 464LL))(v29, v50);
sub_14003D310((__int64)&v71);
++v26;
++v27;
v4 = v69;
}
while ( v27 < v68 );
LODWORD(v8) = v65;
v5 = v62;
LABEL_42:
v53 = (float)((float)(int)v8 * 31.0) + 10.0;
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v62, (const struct cocos2d::CCSize *)(*(_QWORD *)(v5 + 328) + 424LL));
if ( v53 <= *(float *)&v62 )
{
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v65, (const struct cocos2d::CCSize *)(*(_QWORD *)(v5 + 328) + 424LL));
v54 = *(float *)&v65;
}
else
{
v54 = (float)((float)(int)v8 * 31.0) + 10.0;
}
v55 = *(_QWORD *)(v5 + 328);
*(float *)(v55 + 432) = v54;
ScrollableContentLayer::clampOffset(v55);
ScrollableContentLayer::ensureScrollThumb(v56);
ScrollableContentLayer::applyContentPosition(v55);
v15 = *(_QWORD *)(v5 + 328);
*(float *)(v15 + 436) = v53;
LABEL_46:
*(_DWORD *)(v15 + 476) = 0;
ScrollableContentLayer::clampOffset(v15);
ScrollableContentLayer::applyContentPosition(v57);
}