//
// GJRateLevelLayer::setupRateInfo from 0x14041a490 to 0x14041b05c (3020 bytes)
//
// 2 xrefs:
// > GJRateLevelLayer::rateInfoFinished @ 0x14041b7e4
// > ??> @ 0x140926648
//
// 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:32:06 +0000
//
// Hidden C++ exception states: #wind=6
void __fastcall GJRateLevelLayer::setupRateInfo(__int64 a1, __int64 *a2)
{
__int64 v2; // r14
cocos2d::CCString *v3; // rax
const char *CString; // rax
size_t v5; // rsi
size_t v6; // r8
cocos2d::CCArray *v7; // r12
void *v8; // rcx
float v9; // xmm7_4
int v10; // ebx
unsigned int i; // edi
cocos2d::CCString *v12; // rax
const char *v13; // rax
int v14; // eax
unsigned int v15; // ebx
__int64 v16; // r14
cocos2d::CCString *v17; // rax
const char *v18; // rax
int v19; // edi
__int64 v20; // rax
float v21; // xmm6_4
_BYTE *v22; // rax
size_t v23; // r8
__int64 v24; // rcx
char v25; // r14
void **v26; // rax
void **v27; // r15
char *v28; // rsi
unsigned __int64 v29; // r13
unsigned __int64 v30; // rdi
unsigned __int64 v31; // rbx
__int64 v32; // rax
char *v33; // rax
struct cocos2d::CCSprite *v34; // rdi
__int64 v35; // rbx
__int64 v36; // rdx
__int64 v37; // r12
__int64 v38; // rax
cocos2d::CCString *v39; // rax
const char *v40; // rax
size_t v41; // r8
cocos2d::CCArray *v42; // r15
float v43; // xmm7_4
int v44; // ebx
unsigned int k; // edi
cocos2d::CCString *v46; // rax
const char *v47; // rax
int v48; // eax
unsigned int v49; // r14d
cocos2d::CCArray *v50; // rbx
cocos2d::CCString *v51; // rax
const char *v52; // rax
int v53; // r12d
__int64 v54; // rax
float v55; // xmm6_4
char v56; // r13
__int64 v57; // rbx
char v58; // si
__int64 v59; // rax
unsigned int v60; // eax
__int64 v61; // r14
_DWORD *v62; // rax
float v63; // xmm9_4
float v64; // xmm8_4
float v65; // xmm6_4
float v66; // xmm7_4
cocos2d::CCString *v67; // rax
char *v68; // rax
const char *v69; // rcx
struct cocos2d::CCLabelBMFont *v70; // rdi
__int64 v71; // rbx
__int64 v72; // rax
__int64 v73; // rdx
__int64 v74; // rax
__int16 v75; // [rsp+58h] [rbp-B0h]
__int16 v76; // [rsp+58h] [rbp-B0h]
__int16 v77; // [rsp+5Ch] [rbp-ACh] BYREF
char v78; // [rsp+5Eh] [rbp-AAh]
__int16 v79; // [rsp+60h] [rbp-A8h]
__int16 v80; // [rsp+68h] [rbp-A0h] BYREF
char v81; // [rsp+6Ah] [rbp-9Eh]
__int16 v82; // [rsp+78h] [rbp-90h] BYREF
char v83; // [rsp+7Ah] [rbp-8Eh]
_BYTE v84[4]; // [rsp+88h] [rbp-80h] BYREF
float v85; // [rsp+8Ch] [rbp-7Ch]
int v86; // [rsp+90h] [rbp-78h]
cocos2d::CCArray *v87; // [rsp+98h] [rbp-70h] BYREF
__int128 v88; // [rsp+A0h] [rbp-68h] BYREF
unsigned __int64 v89; // [rsp+B0h] [rbp-58h]
__int64 v90; // [rsp+B8h] [rbp-50h]
__int64 v91; // [rsp+C0h] [rbp-48h]
__int64 v92; // [rsp+C8h] [rbp-40h]
char v93[8]; // [rsp+D0h] [rbp-38h] BYREF
__int64 j; // [rsp+D8h] [rbp-30h] BYREF
__int64 *v95; // [rsp+E0h] [rbp-28h]
char v96[8]; // [rsp+E8h] [rbp-20h] BYREF
__int128 *v97; // [rsp+F0h] [rbp-18h]
__int64 *v98; // [rsp+F8h] [rbp-10h]
void *Src[2]; // [rsp+100h] [rbp-8h] BYREF
unsigned __int64 v100; // [rsp+110h] [rbp+8h]
unsigned __int64 v101; // [rsp+118h] [rbp+10h]
void *Block[2]; // [rsp+120h] [rbp+18h] BYREF
__m128i si128; // [rsp+130h] [rbp+28h]
__int128 v104; // [rsp+140h] [rbp+38h] BYREF
__m128i v105; // [rsp+150h] [rbp+48h]
_BYTE v106[528]; // [rsp+168h] [rbp+60h] BYREF
v95 = a2;
v2 = a1;
v92 = a1;
v98 = a2;
v87 = sub_1400D2840(a2, ":");
v3 = cocos2d::CCArray::stringAtIndex(v87, 0);
CString = cocos2d::CCString::getCString(v3);
*(_OWORD *)Block = 0;
si128 = 0;
v5 = -1;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003D230(Block, CString, v6);
v7 = sub_1400D2840((__int64 *)Block, byte_14070ECF8);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v8 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v8 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v8 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v8);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
v9 = 10.0;
v10 = 0;
for ( i = 0; i < cocos2d::CCArray::count(v7); ++i )
{
v12 = cocos2d::CCArray::stringAtIndex(v7, i);
v13 = cocos2d::CCString::getCString(v12);
v14 = atoi(v13);
if ( v14 > v10 )
v10 = v14;
}
if ( (float)((float)v10 * 10.0) > 100.0 )
v9 = 100.0 / (float)v10;
v15 = 0;
if ( cocos2d::CCArray::count(v7) )
{
v16 = v2 + 1112;
for ( j = v16; ; v16 = j )
{
v17 = cocos2d::CCArray::stringAtIndex(v7, v15);
v18 = cocos2d::CCString::getCString(v17);
v19 = atoi(v18);
v86 = v19;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, (float)(int)(15 * (v15 - 8)), -42.0);
cocos2d::CCPoint::operator+(v16, v84, v20);
v21 = v9;
v77 = 0;
LOBYTE(v79) = 0;
fmt::BasicWriter::BasicWriter(v106);
LODWORD(v91) = v15 + 1;
fmt::BasicWriter::operator<<(v106, v15 + 1);
v22 = (_BYTE *)fmt::BasicWriter::c_str(v106);
*(_OWORD *)Src = 0;
v100 = 0;
v101 = 0;
v23 = -1;
do
++v23;
while ( v22[v23] );
sub_14003D230(Src, v22, v23);
fmt::BasicWriter::~BasicWriter(v106);
if ( v19 <= 0 )
{
v86 = 1;
v75 = 12371;
v25 = 23;
v77 = 8247;
LOBYTE(v79) = 16;
v26 = Src;
if ( v101 > 0xF )
v26 = (void **)Src[0];
v100 = 0;
*(_BYTE *)v26 = 0;
if ( v9 >= 10.0 )
{
v21 = v9 * 0.5;
v85 = v85 - (float)((float)(v9 * 0.5) * 0.5);
}
}
else
{
switch ( v15 )
{
case 0u:
v75 = -11517;
v25 = -1;
break;
case 1u:
v75 = -27904;
v25 = -1;
break;
case 2u:
v75 = -1536;
v25 = 60;
break;
case 3u:
v75 = -10146;
v25 = 0;
break;
case 4u:
v75 = -4610;
v25 = 20;
break;
case 5u:
v75 = -18433;
v25 = 0;
break;
case 6u:
v75 = 30975;
v25 = 0;
break;
case 7u:
v75 = 30207;
v25 = -21;
break;
case 8u:
v75 = 11775;
v25 = -20;
break;
case 9u:
v75 = 11775;
v25 = 0;
break;
default:
v75 = -26986;
v25 = -106;
break;
}
}
v97 = &v88;
v88 = 0;
v89 = 0;
v90 = 0;
v27 = Src;
v28 = (char *)Src[0];
v29 = v101;
if ( v101 > 0xF )
v27 = (void **)Src[0];
v30 = v100;
if ( v100 > 0x7FFFFFFFFFFFFFFFLL )
sub_140009D90(v24);
if ( v100 > 0xF )
{
v31 = v100 | 0xF;
if ( (v100 | 0xF) <= 0x7FFFFFFFFFFFFFFFLL )
{
if ( v31 < 0x16 )
v31 = 22;
}
else
{
v31 = 0x7FFFFFFFFFFFFFFFLL;
}
*(_QWORD *)&v88 = sub_14003D460(v31 + 1);
v89 = v30;
v90 = v31;
memcpy((void *)v88, v27, v30 + 1);
}
else
{
v89 = v100;
v90 = 15;
v88 = *(_OWORD *)v27;
}
v80 = v77;
v81 = v79;
v82 = v75;
v83 = v25;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93, (const struct cocos2d::CCPoint *)v84);
v2 = v92;
GJRateLevelLayer::createStatPillar(v92, 10, (int)v21, v86, (__int64)&v82, (__int64)&v80, v32, (__int64)&v88);
if ( v29 > 0xF )
{
v33 = v28;
if ( v29 + 1 >= 0x1000 )
{
v28 = *((char **)v28 - 1);
if ( (unsigned __int64)(v33 - v28 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v28);
}
v15 = v91;
v5 = -1;
if ( v15 >= cocos2d::CCArray::count(v7) )
break;
}
}
v34 = cocos2d::CCSprite::createWithSpriteFrameName("whiteSquare60_001.png");
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v34 + 120LL))(v34);
v35 = *(_QWORD *)v34;
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(*(_QWORD *)v34 + 320LL))(v34);
(*(void (__fastcall **)(struct cocos2d::CCSprite *))(v35 + 136))(v34);
v77 = 11086;
v78 = 24;
(**((void (__fastcall ***)(__int64, __int16 *))v34 + 40))((__int64)v34 + 320, &v77);
LOBYTE(v36) = -56;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v34 + 40) + 40LL))((__int64)v34 + 320, v36);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCSprite *, __int64))(**(_QWORD **)(v2 + 584) + 456LL))(
*(_QWORD *)(v2 + 584),
v34,
3);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93, 38.0, 0.0);
v37 = v2 + 1112;
v91 = v2 + 1112;
cocos2d::CCPoint::operator+(v2 + 1112, &j, v38);
(*(void (__fastcall **)(struct cocos2d::CCSprite *, __int64 *))(*(_QWORD *)v34 + 184LL))(v34, &j);
v39 = cocos2d::CCArray::stringAtIndex(v87, 1u);
v40 = cocos2d::CCString::getCString(v39);
*(_OWORD *)Block = 0;
si128 = 0;
v41 = -1;
do
++v41;
while ( v40[v41] );
sub_14003D230(Block, v40, v41);
v42 = sub_1400D2840((__int64 *)Block, byte_14070ECF8);
sub_14003D310((__int64)Block);
v43 = 10.0;
v44 = 0;
for ( k = 0; k < cocos2d::CCArray::count(v42); ++k )
{
v46 = cocos2d::CCArray::stringAtIndex(v42, k);
v47 = cocos2d::CCString::getCString(v46);
v48 = atoi(v47);
if ( v48 > v44 )
v44 = v48;
}
if ( (float)((float)v44 * 10.0) > 100.0 )
v43 = 100.0 / (float)v44;
v49 = 0;
if ( cocos2d::CCArray::count(v42) )
{
v50 = (cocos2d::CCArray *)(v92 + 1112);
v87 = (cocos2d::CCArray *)(v92 + 1112);
do
{
v51 = cocos2d::CCArray::stringAtIndex(v42, v49);
v52 = cocos2d::CCString::getCString(v51);
v53 = atoi(v52);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93, (float)(int)(15 * (v49 + 4)), -42.0);
cocos2d::CCPoint::operator+(v50, v84, v54);
v55 = v43;
v77 = 0;
v56 = 0;
*(_OWORD *)Src = 0;
v101 = 15;
if ( v53 <= 0 )
{
v53 = 1;
v76 = 12371;
v58 = 23;
v77 = 8247;
v56 = 16;
v57 = 0;
v100 = 0;
LOBYTE(Src[0]) = 0;
if ( v43 >= 10.0 )
{
v55 = v43 * 0.5;
v85 = v85 - (float)((float)(v43 * 0.5) * 0.5);
}
}
else
{
v57 = 1;
v100 = 1;
switch ( v49 )
{
case 1u:
v76 = -1;
v58 = 0;
LOWORD(Src[0]) = 70;
break;
case 2u:
v76 = 32255;
v58 = 0;
LOWORD(Src[0]) = 69;
break;
case 3u:
v76 = 255;
v58 = -1;
LOWORD(Src[0]) = 76;
break;
case 4u:
v76 = -256;
v58 = -1;
LOWORD(Src[0]) = 77;
break;
default:
v76 = -26986;
v58 = -106;
LOWORD(Src[0]) = 82;
break;
}
}
v97 = &v88;
v89 = v57;
v90 = 15;
v88 = *(_OWORD *)Src;
v82 = v77;
v83 = v56;
v80 = v76;
v81 = v58;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v96, (const struct cocos2d::CCPoint *)v84);
GJRateLevelLayer::createStatPillar(v92, 10, (int)v55, v53, (__int64)&v80, (__int64)&v82, v59, (__int64)&v88);
++v49;
v60 = cocos2d::CCArray::count(v42);
v50 = v87;
}
while ( v49 < v60 );
v5 = -1;
v37 = v91;
}
v104 = 0;
v105 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(v104) = 0;
v61 = v92;
v62 = *(_DWORD **)(v92 + 1032);
v63 = (float)(int)v62[281];
if ( v63 <= 0.0 )
{
v67 = cocos2d::CCString::createWithFormat("Req: %i", v62[279]);
}
else
{
v64 = (float)(int)v62[282];
v65 = (float)(int)v62[283];
v66 = (float)(int)v62[284];
v67 = cocos2d::CCString::createWithFormat(
"R: %i (%i- / %i+)\n%.1f | +%.1f | -%.1f | +-%.1f\nReq: %i",
(int)v63,
(int)v66,
(int)v65,
(float)(v64 / v63),
(float)((float)(v64 - v66) / (float)(v63 - v66)),
(float)((float)(v64 - (float)(v65 * 10.0)) / (float)(v63 - v65)),
(float)((float)((float)(v64 - (float)(v65 * 10.0)) - v66) / (float)((float)(v63 - v65) - v66)),
v62[279]);
}
v68 = (char *)cocos2d::CCString::getCString(v67);
do
++v5;
while ( v68[v5] );
sub_1400405A0((void **)&v104, v68, v5);
v69 = (const char *)&v104;
if ( v105.m128i_i64[1] > 0xFuLL )
v69 = (const char *)v104;
v70 = cocos2d::CCLabelBMFont::create(v69, "chatFont.fnt");
v71 = *(_QWORD *)v70;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93, 0.0, 1.0);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, __int64))(v71 + 288))(v70, v72);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *))(*(_QWORD *)v70 + 160LL))(v70);
(**((void (__fastcall ***)(__int64, void *))v70 + 46))((__int64)v70 + 368, &unk_140703B94);
LOBYTE(v73) = -31;
(*(void (__fastcall **)(__int64, __int64))(*((_QWORD *)v70 + 46) + 40LL))((__int64)v70 + 368, v73);
(*(void (__fastcall **)(_QWORD, struct cocos2d::CCLabelBMFont *, __int64))(**(_QWORD **)(v61 + 584) + 456LL))(
*(_QWORD *)(v61 + 584),
v70,
2);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v93, -130.0, 48.0);
cocos2d::CCPoint::operator+(v37, &v87, v74);
(*(void (__fastcall **)(struct cocos2d::CCLabelBMFont *, cocos2d::CCArray **))(*(_QWORD *)v70 + 184LL))(v70, &v87);
sub_14003D310((__int64)&v104);
sub_14003D310((__int64)v95);
}