//
// cocos2d::CCBMFontConfiguration::parseImageFileName from 0xae3120 to 0xae3338 (536 bytes)
//
// 2 xrefs:
// > cocos2d::CCBMFontConfiguration::parseConfigFile @ 0xae51e8
// > ??> @ 0xba798
//
// 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::parseImageFileName(
__int64 a1,
_QWORD *a2,
__int64 a3,
long double a4)
{
int v7; // w20
__int64 v8; // x25
long double v9; // q0
__int64 v10; // x3
unsigned __int64 v11; // x4
long double v12; // q0
int v13; // w20
long double v14; // q0
__int64 v15; // x3
void *v16; // x0
cocos2d::CCFileUtils *v17; // x0
size_t v18; // x0
void *v19; // x0
unsigned int *v21; // x1
int v22; // w2
unsigned int *v23; // x1
int v24; // w2
const char *v25; // [xsp+58h] [xbp+58h]
__int64 v26; // [xsp+68h] [xbp+68h] BYREF
__int64 v27; // [xsp+70h] [xbp+70h] BYREF
v7 = sub_D16674(a2, 61, 0, a4) + 1;
v8 = v7;
v10 = (int)(sub_D16674(a2, 32, v7, v9) - v7);
v11 = *(_QWORD *)(*a2 - 24LL);
if ( v7 > v11
|| (sub_D14F84(&v26, a2, v7, v10),
v13 = sub_D16674(a2, 34, 0, v12) + 1,
v8 = v13,
v15 = (int)(sub_D16674(a2, 34, v13, v14) - v13),
v11 = *(_QWORD *)(*a2 - 24LL),
v13 > v11) )
{
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v8, v11);
}
sub_D14F84(&v27, a2, v13, v15);
sub_D163D4(&v26, &v27);
v16 = (void *)(v27 - 24);
if ( (__int64 *)(v27 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v21 = (unsigned int *)(v27 - 8);
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v16);
}
v17 = cocos2d::CCFileUtils::sharedFileUtils();
v25 = (const char *)((__int64 (__fastcall *)(cocos2d::CCFileUtils *, __int64, __int64))v17->getFileData)(v17, v26, a3);
v18 = strlen(v25);
sub_D1798C(a1 + 88, v25, v18);
v19 = (void *)(v26 - 24);
if ( (__int64 *)(v26 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v26 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v26 - 8);
*(_DWORD *)(v26 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v19);
}
return _stack_chk_guard;
}