//
// cocos2d::CCBMFontConfiguration::parseCommonArguments from 0xae3480 to 0xae3848 (968 bytes)
//
// 2 xrefs:
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0xae5134
// > ??> @ 0x643f8
//
// 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::parseCommonArguments(__int64 a1, _QWORD *a2)
{
int v4; // w20
long double v5; // q0
__int64 v6; // x3
int v7; // w21
long double v8; // q0
__int64 v9; // x3
void *v10; // x0
cocos2d::CCConfiguration *v11; // x0
int v12; // w21
__int64 v13; // x25
long double v14; // q0
__int64 v15; // x3
unsigned __int64 v16; // x4
void *v17; // x0
cocos2d::CCConfiguration *v18; // x0
int v19; // w21
long double v20; // q0
__int64 v21; // x3
void *v22; // x0
char *v23; // x0
unsigned int *v25; // x1
int v26; // w2
unsigned int *v27; // x1
int v28; // w2
unsigned int *v29; // x1
int v30; // w2
unsigned int *v31; // x1
int v32; // w2
char *s; // [xsp+58h] [xbp+58h] BYREF
__int64 v34; // [xsp+60h] [xbp+60h] BYREF
v4 = sub_D1641C((int)a2, "lineHeight=");
v6 = (int)(sub_D16674(a2, 32, v4, v5) - v4);
if ( (unsigned __int64)v4 > *(_QWORD *)(*a2 - 24LL) )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v4,
*(_QWORD *)(*a2 - 24LL));
sub_D14F84(&s, a2, v4, v6);
sscanf(s, "lineHeight=%d", a1 + 64);
v7 = sub_D1641C((int)a2, "scaleW=") + 7;
v9 = (int)(sub_D16674(a2, 32, v7, v8) - v7);
if ( (unsigned __int64)v7 > *(_QWORD *)(*a2 - 24LL) )
sub_D13C5C(
"%s: __pos (which is %zu) > this->size() (which is %zu)",
"basic_string::substr",
v7,
*(_QWORD *)(*a2 - 24LL));
sub_D14F84(&v34, a2, v7, v9);
sub_D163D4(&s, &v34);
v10 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v34 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(v34 - 8);
*(_DWORD *)(v34 - 8) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v10);
}
v11 = cocos2d::CCConfiguration::sharedConfiguration();
cocos2d::CCConfiguration::getMaxTextureSize(v11);
v12 = sub_D1641C((int)a2, "scaleH=") + 7;
v13 = v12;
v15 = (int)(sub_D16674(a2, 32, v12, v14) - v12);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v12 > v16 )
goto LABEL_34;
sub_D14F84(&v34, a2, v12, v15);
sub_D163D4(&s, &v34);
v17 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v27 = (unsigned int *)(v34 - 8);
do
v28 = __ldaxr(v27);
while ( __stlxr(v28 - 1, v27) );
}
else
{
v28 = *(_DWORD *)(v34 - 8);
*(_DWORD *)(v34 - 8) = v28 - 1;
}
if ( v28 <= 0 )
operator delete(v17);
}
v18 = cocos2d::CCConfiguration::sharedConfiguration();
cocos2d::CCConfiguration::getMaxTextureSize(v18);
v19 = sub_D1641C((int)a2, "pages=") + 6;
v13 = v19;
v21 = (int)(sub_D16674(a2, 32, v19, v20) - v19);
v16 = *(_QWORD *)(*a2 - 24LL);
if ( v19 > v16 )
LABEL_34:
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v13, v16);
sub_D14F84(&v34, a2, v19, v21);
sub_D163D4(&s, &v34);
v22 = (void *)(v34 - 24);
if ( (__int64 *)(v34 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v31 = (unsigned int *)(v34 - 8);
do
v32 = __ldaxr(v31);
while ( __stlxr(v32 - 1, v31) );
}
else
{
v32 = *(_DWORD *)(v34 - 8);
*(_DWORD *)(v34 - 8) = v32 - 1;
}
if ( v32 <= 0 )
operator delete(v22);
}
v23 = s - 24;
if ( s - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v29 = (unsigned int *)(s - 8);
do
v30 = __ldaxr(v29);
while ( __stlxr(v30 - 1, v29) );
}
else
{
v30 = *((_DWORD *)s - 2);
*((_DWORD *)s - 2) = v30 - 1;
}
if ( v30 <= 0 )
operator delete(v23);
}
return _stack_chk_guard;
}