//
// cocos2d::CCBMFontConfiguration::parseCommonArguments from 0x180049bc0 to 0x18004a286 (1734 bytes)
//
// 4 xrefs:
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x18004a943
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x18004a9e6
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b198c
//
// 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
//
// Hidden C++ exception states: #wind=2
void __fastcall cocos2d::CCBMFontConfiguration::parseCommonArguments(__int64 a1, unsigned __int64 *a2)
{
char *v3; // r14
unsigned __int64 v4; // r12
unsigned __int64 v5; // rsi
char *v6; // rdi
int v7; // edi
char *v8; // r15
void *v9; // rax
int v10; // eax
size_t v11; // r8
unsigned __int64 v12; // rsi
char *v13; // rax
char *v14; // rcx
char *v15; // rsi
unsigned __int64 v16; // rax
char *v17; // r14
char *v18; // rdi
int v19; // edi
int v20; // r15d
char *v21; // r14
unsigned __int64 v22; // r12
unsigned __int64 v23; // rdi
void *v24; // rax
int v25; // eax
size_t v26; // r8
unsigned __int64 v27; // rdi
char *v28; // rax
void *v29; // rcx
const char *v30; // rcx
cocos2d::CCInteger *v31; // rax
char *v32; // rsi
unsigned __int64 v33; // rax
char *v34; // r14
char *v35; // rdi
int v36; // edi
int v37; // r15d
char *v38; // r14
unsigned __int64 v39; // r12
unsigned __int64 v40; // rdi
void *v41; // rax
int v42; // eax
size_t v43; // r8
unsigned __int64 v44; // rdi
char *v45; // rax
void *v46; // rcx
const char *v47; // rcx
cocos2d::CCInteger *v48; // rax
char *v49; // rdi
unsigned __int64 v50; // rax
char *v51; // rsi
char *v52; // r9
__int64 v53; // rcx
unsigned __int8 v54; // al
int v55; // eax
int v56; // r9d
int v57; // r15d
char *v58; // r14
unsigned __int64 v59; // r12
unsigned __int64 v60; // rdi
void *v61; // rax
int v62; // eax
size_t v63; // r8
unsigned __int64 v64; // rdi
char *v65; // rax
void *v66; // rcx
const char *v67; // rcx
void *v68; // rcx
unsigned __int64 v69; // rdx
char *v70; // rcx
void *Block[2]; // [rsp+30h] [rbp-50h] BYREF
__m128i si128; // [rsp+40h] [rbp-40h]
char *String[2]; // [rsp+50h] [rbp-30h] BYREF
__m128i v74; // [rsp+60h] [rbp-20h]
v3 = (char *)a2;
v4 = a2[3];
if ( v4 > 0xF )
v3 = (char *)*a2;
v5 = a2[2];
if ( v5 >= 0xB && (v6 = (char *)memchr(v3, 108, v5 - 10)) != nullptr )
{
while ( memcmp(v6, "lineHeight=", 0xBu) )
{
v6 = (char *)memchr(v6 + 1, 108, &v3[v5 - 10] - (v6 + 1));
if ( !v6 )
goto LABEL_7;
}
v7 = (_DWORD)v6 - (_DWORD)v3;
}
else
{
LABEL_7:
v7 = -1;
}
v8 = (char *)a2;
if ( v4 > 0xF )
v8 = (char *)*a2;
if ( v7 < v5 && (v9 = memchr(&v8[v7], 32, v5 - v7)) != nullptr )
v10 = (_DWORD)v9 - (_DWORD)v8;
else
v10 = -1;
*(_OWORD *)Block = 0;
si128 = 0;
if ( v5 < v7 )
std::vector::_Xlen();
v11 = v10 - v7;
v12 = v5 - v7;
if ( v12 < v11 )
v11 = v12;
v13 = (char *)a2;
if ( v4 > 0xF )
v13 = (char *)*a2;
sub_18000CE60(Block, &v13[v7], v11);
v14 = (char *)Block;
if ( si128.m128i_i64[1] > 0xFuLL )
v14 = (char *)Block[0];
sub_18004D5D0(v14, "lineHeight=%d");
v15 = (char *)a2;
if ( a2[3] > 0xF )
v15 = (char *)*a2;
v16 = a2[2];
if ( v16 >= 7 && (v17 = &v15[v16], (v18 = (char *)memchr(v15, 115, v16 - 6)) != nullptr) )
{
while ( memcmp(v18, "scaleW=", 7u) )
{
v18 = (char *)memchr(v18 + 1, 115, v17 - 6 - (v18 + 1));
if ( !v18 )
goto LABEL_28;
}
v19 = (_DWORD)v18 - (_DWORD)v15;
}
else
{
LABEL_28:
v19 = -1;
}
v20 = v19 + 7;
v21 = (char *)a2;
v22 = a2[3];
if ( v22 > 0xF )
v21 = (char *)*a2;
v23 = a2[2];
if ( v20 < v23 && (v24 = memchr(&v21[v20], 32, v23 - v20)) != nullptr )
v25 = (_DWORD)v24 - (_DWORD)v21;
else
v25 = -1;
*(_OWORD *)String = 0;
v74 = 0;
if ( v23 < v20 )
goto LABEL_116;
v26 = v25 - v20;
v27 = v23 - v20;
if ( v27 < v26 )
v26 = v27;
v28 = (char *)a2;
if ( v22 > 0xF )
v28 = (char *)*a2;
sub_18000CE60(String, &v28[v20], v26);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v29 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v29 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v29 - 8) > 0x1F )
goto LABEL_99;
}
j_j_free_0(v29);
}
*(_OWORD *)Block = *(_OWORD *)String;
si128 = v74;
v30 = (const char *)Block;
if ( _mm_srli_si128(v74, 8).m128i_u64[0] > 0xF )
v30 = String[0];
atoi(v30);
v31 = (cocos2d::CCInteger *)cocos2d::CCConfiguration::sharedConfiguration();
cocos2d::CCInteger::getValue(v31);
v32 = (char *)a2;
if ( a2[3] > 0xF )
v32 = (char *)*a2;
v33 = a2[2];
if ( v33 >= 7 && (v34 = &v32[v33], (v35 = (char *)memchr(v32, 115, v33 - 6)) != nullptr) )
{
while ( memcmp(v35, "scaleH=", 7u) )
{
v35 = (char *)memchr(v35 + 1, 115, v34 - 6 - (v35 + 1));
if ( !v35 )
goto LABEL_53;
}
v36 = (_DWORD)v35 - (_DWORD)v32;
}
else
{
LABEL_53:
v36 = -1;
}
v37 = v36 + 7;
v38 = (char *)a2;
v39 = a2[3];
if ( v39 > 0xF )
v38 = (char *)*a2;
v40 = a2[2];
if ( v37 < v40 && (v41 = memchr(&v38[v37], 32, v40 - v37)) != nullptr )
v42 = (_DWORD)v41 - (_DWORD)v38;
else
v42 = -1;
*(_OWORD *)String = 0;
v74 = 0;
if ( v40 < v37 )
LABEL_116:
std::vector::_Xlen();
v43 = v42 - v37;
v44 = v40 - v37;
if ( v44 < v43 )
v43 = v44;
v45 = (char *)a2;
if ( v39 > 0xF )
v45 = (char *)*a2;
sub_18000CE60(String, &v45[v37], v43);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v46 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) < 0x1000
|| (v46 = *((void **)Block[0] - 1), (unsigned __int64)((char *)Block[0] - (char *)v46 - 8) <= 0x1F) )
{
j_j_free_0(v46);
goto LABEL_70;
}
LABEL_99:
invalid_parameter_noinfo_noreturn();
}
LABEL_70:
*(_OWORD *)Block = *(_OWORD *)String;
si128 = v74;
v47 = (const char *)Block;
if ( _mm_srli_si128(v74, 8).m128i_u64[0] > 0xF )
v47 = String[0];
atoi(v47);
v48 = (cocos2d::CCInteger *)cocos2d::CCConfiguration::sharedConfiguration();
cocos2d::CCInteger::getValue(v48);
v49 = (char *)a2;
if ( a2[3] > 0xF )
v49 = (char *)*a2;
v50 = a2[2];
if ( v50 >= 6 && (v51 = &v49[v50], (v52 = (char *)memchr(v49, 112, v50 - 5)) != nullptr) )
{
while ( 1 )
{
v53 = 0;
while ( 1 )
{
v54 = v52[v53++];
if ( v54 != aPages[v53 - 1] )
break;
if ( v53 == 6 )
{
v55 = 0;
goto LABEL_81;
}
}
v55 = v54 < (unsigned __int8)aPages[v53 - 1] ? -1 : 1;
LABEL_81:
if ( !v55 )
break;
v52 = (char *)memchr(v52 + 1, 112, v51 - 5 - (v52 + 1));
if ( !v52 )
goto LABEL_83;
}
v56 = (_DWORD)v52 - (_DWORD)v49;
}
else
{
LABEL_83:
v56 = -1;
}
v57 = v56 + 6;
v58 = (char *)a2;
v59 = a2[3];
if ( v59 > 0xF )
v58 = (char *)*a2;
v60 = a2[2];
if ( v57 < v60 && (v61 = memchr(&v58[v57], 32, v60 - v57)) != nullptr )
v62 = (_DWORD)v61 - (_DWORD)v58;
else
v62 = -1;
*(_OWORD *)String = 0;
v74 = 0;
if ( v60 < v57 )
goto LABEL_116;
v63 = v62 - v57;
v64 = v60 - v57;
if ( v64 < v63 )
v63 = v64;
v65 = (char *)a2;
if ( v59 > 0xF )
v65 = (char *)*a2;
sub_18000CE60(String, &v65[v57], v63);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v66 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v66 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v66 - 8) > 0x1F )
goto LABEL_99;
}
j_j_free_0(v66);
}
*(_OWORD *)Block = *(_OWORD *)String;
si128 = v74;
v67 = (const char *)Block;
if ( _mm_srli_si128(v74, 8).m128i_u64[0] > 0xF )
v67 = String[0];
atoi(v67);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v68 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v68 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v68 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v68);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_1800E7160);
LOBYTE(Block[0]) = 0;
v69 = a2[3];
if ( v69 > 0xF )
{
v70 = (char *)*a2;
if ( v69 + 1 >= 0x1000 )
{
if ( (unsigned __int64)&v70[-*((_QWORD *)v70 - 1) - 8] > 0x1F )
invalid_parameter_noinfo_noreturn();
v70 = *((char **)v70 - 1);
}
j_j_free_0(v70);
}
a2[2] = 0;
a2[3] = 15;
*(_BYTE *)a2 = 0;
}