//
// DS_Dictionary::rectFromString from 0xb48704 to 0xb48c08 (1284 bytes)
//
// 4 xrefs:
// > DS_Dictionary::getRectForKey @ 0xb48d3c
// > DS_Dictionary::getRectArrayForKey @ 0xb48e9c
// > DS_Dictionary::getRectArrayForKey @ 0xb48f90
// > ??> @ 0x3f768
//
// 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
//
bool __fastcall DS_Dictionary::rectFromString(DS_Dictionary *a1, __int64 a2, cocos2d::CCRect *a3)
{
int v5; // w24
int v6; // w0
int v7; // w0
int v8; // w0
unsigned __int64 v9; // x2
unsigned __int64 v10; // x4
std::string *v11; // x0
int v12; // w2
int v13; // w0
int v14; // w25
__int64 v15; // x27
bool v16; // w0
_BOOL4 v17; // w26
std::string *v18; // x19
std::string *v19; // x22
stl::StringData::Internal *v20; // x1
__int64 *v21; // x0
unsigned int *v22; // x1
int v23; // w2
unsigned __int8 *v24; // x0
unsigned int *v26; // x1
int m_data; // w2
char *v28; // x0
char *v29; // x0
unsigned int *v30; // x1
int v31; // w2
unsigned int *v32; // x19
int v33; // w1
bool v34; // w0
std::string *m_start; // x19
std::string *m_finish; // x22
stl::StringData::Internal *v37; // x1
__int64 *v38; // x0
unsigned int *v39; // x1
int v40; // w2
unsigned int *v41; // x1
int v42; // w2
double v43; // d10
double v44; // d9
double v45; // d8
float v46; // s3
float v47; // s0
float v48; // s1
float v49; // s2
unsigned __int8 *v50; // [xsp+80h] [xbp+80h] BYREF
std::string v51; // [xsp+88h] [xbp+88h] BYREF
std::string v52; // [xsp+90h] [xbp+90h] BYREF
cocos2d::CCRect v53; // [xsp+98h] [xbp+98h] BYREF
std::vector v54; // [xsp+A8h] [xbp+A8h] BYREF
std::vector v55; // [xsp+C0h] [xbp+C0h] BYREF
DS_Dictionary::cleanStringWhiteSpace(&v50);
v5 = sub_D16674(&v50, 123, 0);
v6 = sub_D16674(&v50, 125, 0);
if ( v6 == -1 )
goto LABEL_20;
v7 = sub_D16674(&v50, 125, v6 + 1);
if ( v7 == -1 )
goto LABEL_20;
v8 = sub_D16674(&v50, 125, v7 + 1);
if ( v8 == -1 || v5 == -1 )
goto LABEL_20;
v9 = v5 + 1;
v10 = *((_QWORD *)v50 - 3);
if ( v9 > v10 )
goto LABEL_68;
sub_D14F84(&v55, &v50, v9, v8 - v5 - 1);
sub_D163D4(&v50, &v55);
v11 = v55.m_start - 3;
if ( (__int64 *)&v55.m_start[-3] != &qword_124B6B0 )
{
if ( &pthread_create )
{
v26 = (unsigned int *)&v55.m_start[-1];
do
m_data = __ldaxr(v26);
while ( __stlxr(m_data - 1, v26) );
}
else
{
m_data = (int)v55.m_start[-1].m_data.m_data;
LODWORD(v55.m_start[-1].m_data.m_data) = m_data - 1;
}
if ( m_data <= 0 )
operator delete(v11);
}
v12 = sub_D16674(&v50, 125, 0);
if ( v12 == -1 || (v13 = sub_D16674(&v50, 44, v12), v14 = v13, v13 == -1) )
{
LABEL_20:
v17 = 0;
goto LABEL_21;
}
v15 = v13;
sub_D14F84(&v51, &v50, 0, v13);
v9 = v14 + 1;
v10 = *((_QWORD *)v50 - 3);
if ( v9 > v10 )
LABEL_68:
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v9, v10);
sub_D14F84(&v52, &v50, v9, v10 - v15);
memset(&v54, 0, sizeof(v54));
v16 = DS_Dictionary::splitWithForm(a1, &v51, &v54);
v17 = v16;
if ( v16 )
{
memset(&v55, 0, sizeof(v55));
v34 = DS_Dictionary::splitWithForm(a1, &v52, &v55);
v17 = v34;
if ( v34 )
{
v43 = atof((const char *)v54.m_start->m_data.m_data);
v44 = atof((const char *)v54.m_start[1].m_data.m_data);
v45 = atof((const char *)v55.m_start->m_data.m_data);
v46 = atof(*(const char **)((char *)&v55.m_start->m_data.m_data + (unsigned __int64)byte_8));
v47 = v43;
v48 = v44;
v49 = v45;
cocos2d::CCRect::CCRect(&v53, v47, v48, v49, v46);
cocos2d::CCRect::operator=(a3, (float *)&v53.origin);
}
m_start = v55.m_start;
m_finish = v55.m_finish;
if ( v55.m_start != v55.m_finish )
{
do
{
v37 = m_start->m_data.m_data;
v38 = (__int64 *)((char *)m_start->m_data.m_data - 24);
if ( v38 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v39 = (unsigned int *)((char *)v37 - 8);
do
v40 = __ldaxr(v39);
while ( __stlxr(v40 - 1, v39) );
}
else
{
v40 = *((_DWORD *)v37 - 2);
*((_DWORD *)v37 - 2) = v40 - 1;
}
if ( v40 <= 0 )
operator delete(v38);
}
++m_start;
}
while ( m_finish != m_start );
m_finish = v55.m_start;
}
if ( m_finish )
operator delete(m_finish);
}
v18 = v54.m_start;
v19 = v54.m_finish;
if ( v54.m_start != v54.m_finish )
{
do
{
v20 = v18->m_data.m_data;
v21 = (__int64 *)((char *)v18->m_data.m_data - 24);
if ( v21 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v22 = (unsigned int *)((char *)v20 - 8);
do
v23 = __ldaxr(v22);
while ( __stlxr(v23 - 1, v22) );
}
else
{
v23 = *((_DWORD *)v20 - 2);
*((_DWORD *)v20 - 2) = v23 - 1;
}
if ( v23 <= 0 )
operator delete(v21);
}
++v18;
}
while ( v19 != v18 );
v19 = v54.m_start;
}
if ( v19 )
operator delete(v19);
v28 = (char *)v52.m_data.m_data - 24;
if ( (__int64 *)v52.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)((char *)v52.m_data.m_data - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
}
else
{
v42 = *((_DWORD *)v52.m_data.m_data - 2);
*((_DWORD *)v52.m_data.m_data - 2) = v42 - 1;
}
if ( v42 <= 0 )
operator delete(v28);
}
v29 = (char *)v51.m_data.m_data - 24;
if ( (__int64 *)v51.m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v30 = (unsigned int *)((char *)v51.m_data.m_data - 8);
do
v31 = __ldaxr(v30);
while ( __stlxr(v31 - 1, v30) );
}
else
{
v31 = *((_DWORD *)v51.m_data.m_data - 2);
*((_DWORD *)v51.m_data.m_data - 2) = v31 - 1;
}
if ( v31 <= 0 )
operator delete(v29);
}
LABEL_21:
v24 = v50 - 24;
if ( v50 - 24 != (unsigned __int8 *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v32 = (unsigned int *)(v50 - 8);
do
v33 = __ldaxr(v32);
while ( __stlxr(v33 - 1, v32) );
}
else
{
v33 = *((_DWORD *)v50 - 2);
*((_DWORD *)v50 - 2) = v33 - 1;
}
if ( v33 <= 0 )
operator delete(v24);
}
return v17;
}