//
// DS_Dictionary::split from 0xb47024 to 0xb472a8 (644 bytes)
//
// 2 xrefs:
// > DS_Dictionary::splitWithForm @ 0xb4745c
// > ??> @ 0x75b28
//
// 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
//
void DS_Dictionary::split(DS_Dictionary *a1, std::string *const a2, const char *a3, std::vector *a4)
{
int v5; // w19
int v8; // w27
stl::StringData::Internal *m_data; // x0
unsigned __int64 v10; // x5
std::string *m_finish; // x0
char *v12; // x1
char *v13; // x0
unsigned __int64 v14; // x4
std::string *v15; // x0
char *v16; // x1
char *v17; // x0
unsigned int *v18; // x1
int v19; // w2
unsigned int *v20; // x1
int v21; // w2
char *v22; // [xsp+80h] [xbp+80h] BYREF
v5 = 0;
strlen(a3);
while ( 1 )
{
v8 = sub_D1641C((int)a2, (void *)a3);
m_data = a2->m_data.m_data;
if ( v8 == -1 )
break;
v10 = *((_QWORD *)m_data - 3);
if ( v5 > v10 )
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v5, v10);
sub_D14F84(&v22, a2, v5, v8 - v5);
m_finish = a4->m_finish;
if ( m_finish == a4->m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)a4, &v22);
v12 = v22;
}
else
{
v12 = v22;
if ( m_finish )
{
m_finish->m_data.m_data = (stl::StringData::Internal *)v22;
v12 = &byte_124B6C8;
v22 = &byte_124B6C8;
}
a4->m_finish = m_finish + 1;
}
v13 = v12 - 24;
if ( v12 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v12 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *((_DWORD *)v12 - 2);
*((_DWORD *)v12 - 2) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
v5 = strlen(a3) + v8;
}
v14 = *((_QWORD *)m_data - 3);
if ( v14 < v5 )
sub_D13C5C("%s: __pos (which is %zu) > this->size() (which is %zu)", "basic_string::substr", v5, v14);
sub_D14F84(&v22, a2, v5, v14 - v5);
v15 = a4->m_finish;
if ( v15 == a4->m_reserveEnd )
{
std::vector::_M_emplace_back_aux((__int64)a4, &v22);
v16 = v22;
}
else
{
v16 = v22;
if ( v15 )
{
v15->m_data.m_data = (stl::StringData::Internal *)v22;
v16 = &byte_124B6C8;
v22 = &byte_124B6C8;
}
a4->m_finish = v15 + 1;
}
v17 = v16 - 24;
if ( v16 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v20 = (unsigned int *)(v16 - 8);
do
v21 = __ldaxr(v20);
while ( __stlxr(v21 - 1, v20) );
}
else
{
v21 = *((_DWORD *)v16 - 2);
*((_DWORD *)v16 - 2) = v21 - 1;
}
if ( v21 <= 0 )
operator delete(v17);
}
}