//
// cocos2d::CCLabelBMFont::updateLabel from 0x100398d9c to 0x1003993c8 (1580 bytes)
//
// 2 xrefs:
// > ??> @ 0x1008b9108
// > ??> @ 0x100941fb0
//
// This function is hookable on this platform (idp: arm, 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:03:42 +0000
//
void __fastcall cocos2d::CCLabelBMFont::updateLabel(_DWORD *a1)
{
__int64 v2; // x22
__int64 v3; // x20
unsigned int v4; // w23
int v5; // w24
bool v6; // w26
bool v7; // w25
__int64 v8; // x27
float v9; // s10
float v10; // s9
__int64 v11; // x28
__int64 v12; // x0
__int64 v13; // x21
int v14; // w0
float v15; // s10
float v16; // s11
float v17; // s12
float v18; // s11
float v19; // s12
float v20; // s13
float *v21; // x0
float v22; // s0
void *v23; // x2
__int16 *v24; // x21
unsigned __int64 v25; // x22
const mach_header_64 *v26; // x8
size_t v27; // x0
char *v28; // x0
char *v29; // x20
__int64 v30; // x9
char *v31; // x10
__int16 v32; // t1
int v33; // w0
__int64 v34; // x23
int v35; // w24
int v36; // w21
__int64 v37; // x25
__int16 *v38; // x1
int v39; // w8
unsigned __int64 v41; // x27
int v42; // w26
__int64 v43; // x0
__int64 v44; // x20
float v45; // s8
float v46; // s8
int v47; // w8
float v48; // s8
__int64 v49; // x20
__int64 v50; // x0
__int64 v51; // x21
float32x2_t *v52; // x22
double v53; // d0
__int16 v54; // [xsp+4h] [xbp-CCh] BYREF
unsigned __int16 v55; // [xsp+6h] [xbp-CAh] BYREF
void *__p; // [xsp+8h] [xbp-C8h] BYREF
void *v57; // [xsp+10h] [xbp-C0h]
__int64 v58; // [xsp+18h] [xbp-B8h]
void *v59; // [xsp+20h] [xbp-B0h] BYREF
void *__dst; // [xsp+28h] [xbp-A8h]
__int64 v61; // [xsp+30h] [xbp-A0h]
void *v62; // [xsp+38h] [xbp-98h] BYREF
_BYTE *v63; // [xsp+40h] [xbp-90h]
__int64 v64; // [xsp+48h] [xbp-88h]
(*(void (__fastcall **)(_DWORD *, _QWORD, _QWORD))(*(_QWORD *)a1 + 1104LL))(a1, *((_QWORD *)a1 + 51), 0);
if ( *((float *)a1 + 111) <= 0.0 )
goto LABEL_45;
cocos2d::cc_utf16_vec_from_utf16_str(*((_WORD **)a1 + 47), &v62);
v2 = (v63 - (_BYTE *)v62) >> 1;
v59 = nullptr;
__dst = nullptr;
v61 = 0;
sub_100399460(&v59, (unsigned int)v2);
__p = nullptr;
v57 = nullptr;
v58 = 0;
sub_100399460(&__p, (unsigned int)v2);
v3 = (*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 488LL))(a1);
v4 = 0;
v5 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = -1.0;
v10 = -1.0;
while ( 1 )
{
v11 = v8;
if ( v4 >= (unsigned int)sub_1002E757C(v3) )
{
LABEL_32:
v23 = __p;
goto LABEL_33;
}
while ( 1 )
{
v12 = (*(__int64 (__fastcall **)(_DWORD *, _QWORD))(*(_QWORD *)a1 + 480LL))(a1, v4 + v5);
v13 = v12;
if ( v12 )
break;
v11 = (unsigned int)(v11 + 1);
++v5;
}
if ( !(*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v12 + 352LL))(v12) )
goto LABEL_31;
if ( (unsigned int)v8 >= (unsigned int)v2 )
goto LABEL_32;
v14 = *((unsigned __int16 *)v62 + (unsigned int)v8);
v55 = *((_WORD *)v62 + (unsigned int)v8);
if ( !v6 )
{
v15 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 328LL))(v13);
v16 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
v17 = *((float *)a1 + 16);
v9 = (float)((float)-(float)(v15 * v17)
* *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 304LL))(v13))
+ (float)(v16 * v17);
v14 = v55;
}
if ( !v7 )
v10 = v9;
v7 = v14 != 10;
if ( v14 == 10 )
break;
LABEL_15:
if ( cocos2d::isspace_unicode(v14) )
{
sub_100242098((__int64)&__p, (__int16 *)&v55);
sub_100399950((int)&v59, __dst, __p);
v6 = 0;
v57 = __p;
v9 = -1.0;
LABEL_30:
v8 = (unsigned int)(v8 + 1);
goto LABEL_31;
}
v18 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 328LL))(v13);
v19 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 192LL))(v13);
v20 = *((float *)a1 + 16);
v21 = (float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v13 + 304LL))(v13);
if ( v18 > 0.0 )
v22 = v18;
else
v22 = 0.0;
if ( (float)((float)((float)((float)(v22 * v20) * *v21) + (float)(v19 * v20)) - v10) <= *((float *)a1 + 111) )
{
sub_100242098((__int64)&__p, (__int16 *)&v55);
v6 = v7;
goto LABEL_30;
}
if ( (a1[114] & 1) == 0 )
{
sub_100242098((__int64)&__p, (__int16 *)&v55);
if ( (unsigned int)cocos2d::cc_utf8_find_last_not_char((__int64 *)&v59, 32) == -1 )
{
__dst = v59;
v10 = -1.0;
}
else
{
cocos2d::cc_utf8_trim_ws(&v59);
v10 = -1.0;
if ( __dst != v59 )
{
v54 = 10;
sub_100242098((__int64)&v59, &v54);
}
}
v6 = v7;
v7 = 0;
goto LABEL_30;
}
cocos2d::cc_utf8_trim_ws(&__p);
v54 = 10;
sub_100242098((__int64)&__p, &v54);
sub_100399950((int)&v59, __dst, __p);
v57 = __p;
if ( (unsigned int)v8 >= (unsigned int)v2 )
goto LABEL_32;
v7 = 0;
v6 = 0;
--v4;
v10 = -1.0;
v9 = -1.0;
LABEL_31:
++v4;
}
cocos2d::cc_utf8_trim_ws(&__p);
v54 = 10;
sub_100242098((__int64)&__p, &v54);
sub_100399950((int)&v59, __dst, __p);
v57 = __p;
if ( (unsigned int)v11 < (unsigned int)v2 )
{
v14 = *((unsigned __int16 *)v62 + (unsigned int)v11);
v55 = *((_WORD *)v62 + (unsigned int)v11);
v9 = -1.0;
v10 = -1.0;
v8 = v11;
goto LABEL_15;
}
v23 = __p;
LABEL_33:
sub_100399950((int)&v59, __dst, v23);
v24 = (__int16 *)v59;
v25 = (_BYTE *)__dst - (_BYTE *)v59;
v26 = &_mh_execute_header + 0x4000000 * ((_BYTE *)__dst - (_BYTE *)v59);
if ( (__int64)v26 < 0 )
v27 = -1;
else
v27 = (__int64)v26 >> 31;
v28 = (char *)operator new[](v27);
v29 = v28;
if ( (int)(v25 >> 1) >= 1 )
{
v30 = (unsigned int)v25 >> 1;
v31 = v28;
do
{
v32 = *v24++;
*(_WORD *)v31 = v32;
v31 += 2;
--v30;
}
while ( v30 );
}
*(_WORD *)&v28[(__int64)(v25 << 31) >> 31] = 0;
(*(void (__fastcall **)(_DWORD *, char *, _QWORD))(*(_QWORD *)a1 + 1104LL))(a1, v28, 0);
operator delete[](v29);
if ( __p )
{
v57 = __p;
operator delete(__p);
}
if ( v59 )
{
__dst = v59;
operator delete(v59);
}
if ( v62 )
{
v63 = v62;
operator delete(v62);
}
LABEL_45:
if ( a1[110] )
{
v33 = cocos2d::cc_wcslen(*((_WORD **)a1 + 47));
v62 = nullptr;
v63 = nullptr;
v64 = 0;
if ( (v33 & 0x80000000) == 0 )
{
v34 = 0;
v35 = 0;
v36 = 0;
v37 = (unsigned int)(v33 + 1);
while ( 1 )
{
v38 = (__int16 *)(*((_QWORD *)a1 + 47) + 2 * v34);
v39 = (unsigned __int16)*v38;
if ( v39 == 10 || v39 == 0 )
{
v41 = (unsigned __int64)(v63 - (_BYTE *)v62) >> 1;
if ( (_DWORD)v41 )
{
v42 = v36 + v41;
if ( v35 + v36 + (int)v41 - 1 < 0 )
goto LABEL_68;
v43 = (*(__int64 (__fastcall **)(_DWORD *, _QWORD))(*(_QWORD *)a1 + 480LL))(
a1,
(unsigned int)(v35 + v36 + v41 - 1));
v44 = v43;
if ( !v43 )
goto LABEL_68;
v45 = *(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v43 + 192LL))(v43);
v46 = v45 + (float)(*(float *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v44 + 328LL))(v44) * 0.5);
v47 = a1[110];
if ( v47 != 2 )
{
if ( v47 == 1 )
{
v48 = (float)(*(float *)(*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 328LL))(a1) * 0.5)
- (float)(v46 * 0.5);
LABEL_61:
if ( v48 != 0.0 )
{
v49 = (unsigned int)(v35 + v36);
do
{
if ( (v49 & 0x80000000) == 0 )
{
v50 = (*(__int64 (__fastcall **)(_DWORD *, __int64))(*(_QWORD *)a1 + 480LL))(a1, v49);
v51 = v50;
if ( v50 )
{
v52 = (float32x2_t *)(*(__int64 (__fastcall **)(__int64))(*(_QWORD *)v50 + 192LL))(v50);
sub_1000262BC((float *)&__p, v48, 0.0);
*(float32x2_t *)&v53 = sub_100026318(v52, (float32x2_t *)&__p, (float32x2_t *)&v59);
(*(void (__fastcall **)(__int64, void **, double))(*(_QWORD *)v51 + 184LL))(v51, &v59, v53);
}
}
v49 = (unsigned int)(v49 + 1);
LODWORD(v41) = v41 - 1;
}
while ( (_DWORD)v41 );
}
}
++v35;
v63 = v62;
v36 = v42;
goto LABEL_68;
}
v48 = *(float *)(*(__int64 (__fastcall **)(_DWORD *))(*(_QWORD *)a1 + 328LL))(a1) - v46;
goto LABEL_61;
}
++v35;
}
else
{
sub_100242098((__int64)&v62, v38);
}
LABEL_68:
if ( ++v34 == v37 )
{
if ( v62 )
{
v63 = v62;
operator delete(v62);
}
return;
}
}
}
}
}