//
// cocos2d::CCBMFontConfiguration::parseKerningEntry from 0x100397354 to 0x10039791c (1480 bytes)
//
// 1 xrefs:
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0x10039611c
//
// 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:41 +0000
//
void __fastcall cocos2d::CCBMFontConfiguration::parseKerningEntry(__int64 a1, const std::string *__s)
{
__int64 size; // x8
const std::string *v5; // x21
char *v6; // x22
std::string *v7; // x0
char *v8; // x0
int v10; // w8
std::string::size_type v11; // x21
int v12; // w0
std::string *v13; // x0
__int64 v14; // x8
const std::string *v15; // x21
char *v16; // x22
std::string *v17; // x0
char *v18; // x0
int v20; // w8
std::string::size_type v21; // x21
int v22; // w0
std::string *v23; // x0
__int64 v24; // x8
const std::string *v25; // x21
char *v26; // x22
std::string *v27; // x0
char *v28; // x0
int v30; // w8
std::string::size_type v31; // x21
int v32; // w0
std::string *v33; // x0
_DWORD *v34; // x0
_DWORD *v35; // x20
int v36; // w8
int32x2_t **v37; // x21
_DWORD *v38; // x8
_QWORD *v39; // x19
__int64 v40; // x9
_QWORD *v41; // x0
void *v42; // x0
unsigned int v43; // w23
int v44; // w9
unsigned int v45; // w10
unsigned int v46; // w11
int v47; // w9
unsigned int v48; // w10
unsigned int v49; // w11
int v50; // w9
unsigned int v51; // w9
__int64 v52; // x9
unsigned int v53; // w8
__int64 v54; // x10
__int64 v55; // x22
int v56; // w24
char *v57; // x0
char *v58; // x20
unsigned int v59; // w9
_QWORD *v60; // x0
int v61; // w10
__int64 i; // x11
__int64 v63; // x12
__int64 v64; // x13
char *v65; // x14
unsigned int v66; // w15
__int64 v67; // x15
int32x2_t *v68; // x8
int32x2_t v69; // d0
int32x2_t v70; // d1
unsigned int v71; // w9
std::allocator v72[4]; // [xsp+Ch] [xbp-74h] BYREF
std::string __a; // [xsp+10h] [xbp-70h] BYREF
unsigned __int16 v74; // [xsp+2Ch] [xbp-54h] BYREF
std::string v75; // [xsp+30h] [xbp-50h] BYREF
int v76; // [xsp+48h] [xbp-38h] BYREF
std::allocator v77; // [xsp+4Fh] [xbp-31h] BYREF
size = SHIBYTE(__s->__r_.__value_.__r.__words[2]);
if ( size < 0 )
{
v5 = (const std::string *)__s->__r_.__value_.__r.__words[0];
size = __s->__r_.__value_.__l.__size_;
}
else
{
v5 = __s;
}
v6 = (char *)v5 + size;
if ( size >= 6 )
{
v7 = (std::string *)v5;
do
{
v8 = (char *)memchr(v7, 102, size - 5);
if ( !v8 )
break;
if ( *(_DWORD *)v8 == 1936877926 && *((_WORD *)v8 + 2) == 15732 )
goto LABEL_13;
v7 = (std::string *)(v8 + 1);
size = v6 - (char *)v7;
}
while ( v6 - (char *)v7 > 5 );
}
v8 = v6;
LABEL_13:
v10 = (_DWORD)v8 - (_DWORD)v5;
if ( v8 == v6 )
v10 = -1;
v11 = v10;
v12 = std::string::find(__s, 32, v10);
std::string::basic_string(&v75, __s, v11, v12 - (int)v11, (std::allocator *)&__a);
if ( (v75.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v13 = &v75;
else
v13 = (std::string *)v75.__r_.__value_.__r.__words[0];
sscanf((const char *)v13, "first=%d", &v76);
v14 = SHIBYTE(__s->__r_.__value_.__r.__words[2]);
if ( v14 < 0 )
{
v15 = (const std::string *)__s->__r_.__value_.__r.__words[0];
v14 = __s->__r_.__value_.__l.__size_;
}
else
{
v15 = __s;
}
v16 = (char *)v15 + v14;
if ( v14 >= 7 )
{
v17 = (std::string *)v15;
do
{
v18 = (char *)memchr(v17, 115, v14 - 6);
if ( !v18 )
break;
if ( *(_DWORD *)v18 == 1868785011 && *(_DWORD *)(v18 + 3) == 1029992047 )
goto LABEL_30;
v17 = (std::string *)(v18 + 1);
v14 = v16 - (char *)v17;
}
while ( v16 - (char *)v17 > 6 );
}
v18 = v16;
LABEL_30:
v20 = (_DWORD)v18 - (_DWORD)v15;
if ( v18 == v16 )
v20 = -1;
v21 = v20;
v22 = std::string::find(__s, 32, v20);
std::string::basic_string(&__a, __s, v21, v22 - (int)v21, v72);
if ( SHIBYTE(v75.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v75.__r_.__value_.__l.__data_);
v75 = __a;
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v23 = &v75;
else
v23 = (std::string *)__a.__r_.__value_.__r.__words[0];
sscanf((const char *)v23, "second=%d", &v74);
v24 = SHIBYTE(__s->__r_.__value_.__r.__words[2]);
if ( v24 < 0 )
{
v25 = (const std::string *)__s->__r_.__value_.__r.__words[0];
v24 = __s->__r_.__value_.__l.__size_;
}
else
{
v25 = __s;
}
v26 = (char *)v25 + v24;
if ( v24 >= 7 )
{
v27 = (std::string *)v25;
do
{
v28 = (char *)memchr(v27, 97, v24 - 6);
if ( !v28 )
break;
if ( *(_DWORD *)v28 == 1970236769 && *(_DWORD *)(v28 + 3) == 1031040629 )
goto LABEL_49;
v27 = (std::string *)(v28 + 1);
v24 = v26 - (char *)v27;
}
while ( v26 - (char *)v27 > 6 );
}
v28 = v26;
LABEL_49:
v30 = (_DWORD)v28 - (_DWORD)v25;
if ( v28 == v26 )
v30 = -1;
v31 = v30;
v32 = std::string::find(__s, 32, v30);
std::string::basic_string(&__a, __s, v31, v32 - (int)v31, &v77);
if ( SHIBYTE(v75.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v75.__r_.__value_.__l.__data_);
v75 = __a;
if ( (__a.__r_.__value_.__r.__words[2] & 0x8000000000000000LL) == 0LL )
v33 = &v75;
else
v33 = (std::string *)__a.__r_.__value_.__r.__words[0];
sscanf((const char *)v33, "amount=%d", v72);
v34 = calloc(0x40u, 1u);
v35 = v34;
v36 = *(_DWORD *)&v72[0].std::__non_trivial_if;
*v34 = v74 | (v76 << 16);
v34[1] = v36;
v37 = (int32x2_t **)(v34 + 2);
*((_QWORD *)v34 + 3) = 0;
*((_QWORD *)v34 + 6) = v34;
v34[14] = 4;
v38 = *(_DWORD **)(a1 + 112);
if ( v38 )
{
v39 = *((_QWORD **)v38 + 1);
v40 = v39[3];
*(_QWORD *)(v40 + 16) = v34;
*((_QWORD *)v34 + 2) = v40 - v39[4];
v39[3] = v37;
}
else
{
*(_QWORD *)(a1 + 112) = v34;
*((_QWORD *)v34 + 2) = 0;
v41 = calloc(1u, 0x40u);
*((_QWORD *)v35 + 1) = v41;
if ( !v41
|| (v39 = v41, v41[1] = 0x500000020LL, v41[3] = v37, v41[4] = 8, v42 = calloc(1u, 0x200u), (*v39 = v42) == 0) )
{
exit(-1);
}
*((_DWORD *)v39 + 14) = -1609490463;
v38 = v35;
}
v43 = *((_DWORD *)v39 + 4) + 1;
*((_DWORD *)v39 + 4) = v43;
*((_QWORD *)v35 + 1) = v39;
v44 = (*v35 + 17973517) ^ 0x7F76D;
v45 = (-1622558010 - v44) ^ (v44 << 8);
v46 = (-17973517 - v44 - v45) ^ (v45 >> 13);
v47 = (v44 - v45 - v46) ^ (v46 >> 12);
v48 = (v45 - v46 - v47) ^ (v47 << 16);
v49 = (v46 - v47 - v48) ^ (v48 >> 5);
v50 = (v47 - v48 - v49) ^ (v49 >> 3);
v51 = (v49 - v50 - ((v48 - v49 - v50) ^ (v50 << 10))) ^ (((v48 - v49 - v50) ^ (v50 << 10)) >> 15);
v35[15] = v51;
v52 = **((_QWORD **)v38 + 1) + 16LL * (v51 & (*(_DWORD *)(*((_QWORD *)v38 + 1) + 8LL) - 1));
v53 = *(_DWORD *)(v52 + 8) + 1;
*(_DWORD *)(v52 + 8) = v53;
v54 = *(_QWORD *)v52;
*((_QWORD *)v35 + 4) = 0;
*((_QWORD *)v35 + 5) = v54;
if ( v54 )
*(_QWORD *)(v54 + 24) = v37;
*(_QWORD *)v52 = v37;
if ( v53 >= 10 * *(_DWORD *)(v52 + 12) + 10 && *((_DWORD *)v39 + 13) != 1 )
{
v55 = *((unsigned int *)v39 + 2);
v56 = 2 * v55;
v57 = (char *)calloc(1u, 16LL * (unsigned int)(2 * v55));
if ( !v57 )
exit(-1);
v58 = v57;
v59 = v43 >> (*((_DWORD *)v39 + 3) + 1);
if ( ((v56 - 1) & v43) != 0 )
++v59;
*((_DWORD *)v39 + 10) = v59;
*((_DWORD *)v39 + 11) = 0;
v60 = (_QWORD *)*v39;
if ( (_DWORD)v55 )
{
v61 = 0;
for ( i = 0; i != v55; ++i )
{
v63 = v60[2 * i];
if ( v63 )
{
do
{
v64 = *(_QWORD *)(v63 + 32);
v65 = &v58[16 * (*(_DWORD *)(v63 + 52) & (v56 - 1))];
v66 = *((_DWORD *)v65 + 2) + 1;
*((_DWORD *)v65 + 2) = v66;
if ( v66 > v59 )
{
*((_DWORD *)v39 + 11) = ++v61;
*((_DWORD *)v65 + 3) = v66 / v59;
}
*(_QWORD *)(v63 + 24) = 0;
v67 = *(_QWORD *)v65;
*(_QWORD *)(v63 + 32) = *(_QWORD *)v65;
if ( v67 )
*(_QWORD *)(v67 + 24) = v63;
*(_QWORD *)v65 = v63;
v63 = v64;
}
while ( v64 );
}
}
}
free(v60);
v68 = *v37;
v69 = (*v37)[1];
v70.i32[0] = vadd_s32(v69, v69).u32[0];
v70.i32[1] = vadd_s32(v69, (int32x2_t)0x100000001LL).i32[1];
v68[1] = v70;
*v68 = (int32x2_t)v58;
if ( v68[5].i32[1] <= (unsigned __int32)v68[2].i32[0] >> 1 )
{
v68[6].i32[0] = 0;
}
else
{
v71 = v68[6].i32[0] + 1;
v68[6].i32[0] = v71;
if ( v71 >= 2 )
v68[6].i32[1] = 1;
}
}
if ( SHIBYTE(v75.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v75.__r_.__value_.__l.__data_);
}