//
// cocos2d::CCBMFontConfiguration::parseCharacterDefinition from 0xae3848 to 0xae3f7c (1844 bytes)
//
// 2 xrefs:
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0xae52dc
// > ??> @ 0x5a1b0
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
__int64 __fastcall cocos2d::CCBMFontConfiguration::parseCharacterDefinition(int a1, _QWORD *a2, __int64 a3)
{
int v5; // w21
long double v6; // q0
__int64 v7; // x3
int v8; // w21
long double v9; // q0
__int64 v10; // x3
void *v11; // x0
int v12; // w25
__int64 v13; // x26
long double v14; // q0
__int64 v15; // x3
unsigned __int64 v16; // x4
void *v17; // x0
int v18; // w25
long double v19; // q0
__int64 v20; // x3
void *v21; // x0
int v22; // w25
long double v23; // q0
__int64 v24; // x3
void *v25; // x0
int v26; // w25
long double v27; // q0
__int64 v28; // x3
void *v29; // x0
int v30; // w25
long double v31; // q0
__int64 v32; // x3
void *v33; // x0
int v34; // w25
long double v35; // q0
__int64 v36; // x3
void *v37; // x0
char *v38; // x0
unsigned int *v40; // x1
int v41; // w2
unsigned int *v42; // x1
int v43; // w2
unsigned int *v44; // x1
int v45; // w2
unsigned int *v46; // x1
int v47; // w2
unsigned int *v48; // x1
int v49; // w2
unsigned int *v50; // x1
int v51; // w2
unsigned int *v52; // x1
int v53; // w2
unsigned int *v54; // x1
int v55; // w2
char *s; // [xsp+58h] [xbp+58h] BYREF
__int64 v57; // [xsp+60h] [xbp+60h] BYREF
v5 = sub_D1641C((int)a2, "id=");
v7 = (int)(sub_D16674(a2, 32, v5, v6) - v5);
if ( (unsigned __int64)v5 > *(_QWORD *)(*a2 - 24LL) )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v5,
*(_QWORD *)(*a2 - 24LL));
sub_D14F84(&s, a2, v5, v7);
sscanf(s, "id=%u", a3);
v8 = sub_D1641C((int)a2, "x=");
v10 = (int)(sub_D16674(a2, 32, v8, v9) - v8);
if ( (unsigned __int64)v8 > *(_QWORD *)(*a2 - 24LL) )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v8,
*(_QWORD *)(*a2 - 24LL));
sub_D14F84(&v57, a2, v8, v10);
sub_D163D4(&s, &v57);
v11 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v40 = (unsigned int *)(v57 - 8);
do
v41 = __ldaxr(v40);
while ( __stlxr(v41 - 1, v40) );
}
else
{
v41 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v41 - 1;
}
if ( v41 <= 0 )
operator delete(v11);
}
sscanf(s, "x=%f", a3 + 4);
v12 = sub_D1641C((int)a2, "y=");
v13 = v12;
v15 = (int)(sub_D16674(a2, 32, v12, v14) - v12);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v12 > v16 )
goto LABEL_66;
sub_D14F84(&v57, a2, v12, v15);
sub_D163D4(&s, &v57);
v17 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v42 = (unsigned int *)(v57 - 8);
do
v43 = __ldaxr(v42);
while ( __stlxr(v43 - 1, v42) );
}
else
{
v43 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v43 - 1;
}
if ( v43 <= 0 )
operator delete(v17);
}
sscanf(s, "y=%f", a3 + 8);
v18 = sub_D1641C((int)a2, "width=");
v13 = v18;
v20 = (int)(sub_D16674(a2, 32, v18, v19) - v18);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v18 > v16 )
goto LABEL_66;
sub_D14F84(&v57, a2, v18, v20);
sub_D163D4(&s, &v57);
v21 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v48 = (unsigned int *)(v57 - 8);
do
v49 = __ldaxr(v48);
while ( __stlxr(v49 - 1, v48) );
}
else
{
v49 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v49 - 1;
}
if ( v49 <= 0 )
operator delete(v21);
}
sscanf(s, "width=%f", a3 + 12);
v22 = sub_D1641C((int)a2, "height=");
v13 = v22;
v24 = (int)(sub_D16674(a2, 32, v22, v23) - v22);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v22 > v16 )
goto LABEL_66;
sub_D14F84(&v57, a2, v22, v24);
sub_D163D4(&s, &v57);
v25 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v44 = (unsigned int *)(v57 - 8);
do
v45 = __ldaxr(v44);
while ( __stlxr(v45 - 1, v44) );
}
else
{
v45 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v45 - 1;
}
if ( v45 <= 0 )
operator delete(v25);
}
sscanf(s, "height=%f", a3 + 16);
v26 = sub_D1641C((int)a2, "xoffset=");
v13 = v26;
v28 = (int)(sub_D16674(a2, 32, v26, v27) - v26);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v26 > v16 )
goto LABEL_66;
sub_D14F84(&v57, a2, v26, v28);
sub_D163D4(&s, &v57);
v29 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v46 = (unsigned int *)(v57 - 8);
do
v47 = __ldaxr(v46);
while ( __stlxr(v47 - 1, v46) );
}
else
{
v47 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v47 - 1;
}
if ( v47 <= 0 )
operator delete(v29);
}
sscanf(s, "xoffset=%hd", a3 + 20);
v30 = sub_D1641C((int)a2, "yoffset=");
v13 = v30;
v32 = (int)(sub_D16674(a2, 32, v30, v31) - v30);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v30 > v16 )
goto LABEL_66;
sub_D14F84(&v57, a2, v30, v32);
sub_D163D4(&s, &v57);
v33 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v54 = (unsigned int *)(v57 - 8);
do
v55 = __ldaxr(v54);
while ( __stlxr(v55 - 1, v54) );
}
else
{
v55 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v55 - 1;
}
if ( v55 <= 0 )
operator delete(v33);
}
sscanf(s, "yoffset=%hd", a3 + 22);
v34 = sub_D1641C((int)a2, "xadvance=");
v13 = v34;
v36 = (int)(sub_D16674(a2, 32, v34, v35) - v34);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v34 > v16 )
LABEL_66:
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v13, v16);
sub_D14F84(&v57, a2, v34, v36);
sub_D163D4(&s, &v57);
v37 = (void *)(v57 - 24);
if ( (__int64 *)(v57 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v50 = (unsigned int *)(v57 - 8);
do
v51 = __ldaxr(v50);
while ( __stlxr(v51 - 1, v50) );
}
else
{
v51 = *(_DWORD *)(v57 - 8);
*(_DWORD *)(v57 - 8) = v51 - 1;
}
if ( v51 <= 0 )
operator delete(v37);
}
sscanf(s, "xadvance=%hd", a3 + 24);
v38 = s - 24;
if ( s - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v52 = (unsigned int *)(s - 8);
do
v53 = __ldaxr(v52);
while ( __stlxr(v53 - 1, v52) );
}
else
{
v53 = *((_DWORD *)s - 2);
*((_DWORD *)s - 2) = v53 - 1;
}
if ( v53 <= 0 )
operator delete(v38);
}
return _stack_chk_guard;
}