//
// DS_Dictionary::splitWithForm from 0x10017a150 to 0x10017a36b (539 bytes)
//
// 3 xrefs:
// > DS_Dictionary::rectFromString @ 0x10017a71e
// > DS_Dictionary::rectFromString @ 0x10017a751
// > DS_Dictionary::vec2FromString @ 0x10017a9e3
//
// 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::splitWithForm(DS_Dictionary *a1, std::string *const a2, std::vector *a3)
{
double v3; // xmm0_8
unsigned int sizex2; // eax
bool v6; // r15
int v7; // r12d
int v8; // eax
int v9; // ecx
__int64 v10; // rbx
unsigned int v11; // r15d
std::size_t size; // r15
std::array *p_shortStorage; // r14
std::size_t v14; // rax
std::size_t v15; // r15
char *elems; // r12
unsigned int v17; // eax
size_t v18; // r13
int v19; // r12d
int v20; // eax
std::__vector_base::pointer begin; // rax
unsigned int v22; // ecx
unsigned int v24; // ecx
std::size_t v25; // rcx
std::vector *v27; // [rsp+8h] [rbp-48h]
std::string __dst[2]; // [rsp+10h] [rbp-40h] BYREF
sizex2 = a2->m_data.m_short.sizex2;
if ( (sizex2 & 1) != 0 )
{
v6 = 0;
if ( !a2->m_data.m_long.size )
return v6;
}
else
{
v6 = 0;
if ( !(sizex2 >> 1) )
return v6;
}
v7 = std::string::find((const std::string *)a2, 123, 0);
v8 = std::string::find((const std::string *)a2, 125, 0);
if ( v7 == -1 || v8 == -1 || v7 > v8 )
return v6;
v9 = v7 + 1;
v10 = v7 + 1;
v11 = a2->m_data.m_short.sizex2;
if ( (v11 & 1) == 0 )
{
size = v11 >> 1;
if ( v9 <= size )
{
p_shortStorage = &a2->m_data.m_short.shortStorage;
goto LABEL_11;
}
LABEL_40:
sub_1000547C0();
}
size = a2->m_data.m_long.size;
if ( size < v9 )
goto LABEL_40;
p_shortStorage = (std::array *)a2->m_data.m_long.longStorage;
LABEL_11:
v14 = ~v7 + v8;
v15 = size - v9;
if ( v15 >= v14 )
v15 = v14;
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(v3);
if ( v15 >= 0x17 )
{
v27 = a3;
v18 = 26;
if ( (v15 | 7) != 0x17 )
v18 = (v15 | 7) + 1;
elems = (char *)operator new(v18);
__dst[0].m_data.m_long.longStorage = elems;
__dst[0].m_data.m_long.capacitym1 = v18 + 1;
a3 = v27;
__dst[0].m_data.m_long.size = v15;
}
else
{
__dst[0].m_data.m_short.sizex2 = 2 * v15;
elems = __dst[0].m_data.m_short.shortStorage.__elems_;
if ( !v15 )
{
__dst[0].m_data.m_short.shortStorage.__elems_[0] = 0;
v17 = __dst[0].m_data.m_short.sizex2;
if ( (__dst[0].m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_17;
goto LABEL_23;
}
}
memmove(elems, &p_shortStorage->__elems_[v10], v15);
elems[v15] = 0;
v17 = __dst[0].m_data.m_short.sizex2;
if ( (__dst[0].m_data.m_short.sizex2 & 1) != 0 )
{
LABEL_17:
v6 = 0;
if ( !__dst[0].m_data.m_long.size )
goto LABEL_34;
goto LABEL_24;
}
LABEL_23:
v6 = 0;
if ( !(v17 >> 1) )
goto LABEL_34;
LABEL_24:
v19 = std::string::find((const std::string *)__dst, 123, 0);
v20 = std::string::find((const std::string *)__dst, 125, 0);
if ( v19 == -1 && v20 == -1 )
{
DS_Dictionary::split((DS_Dictionary *)__dst, __dst, ",", a3);
begin = a3->__begin_;
if ( (std::__vector_base::pointer)((char *)a3->__end_ - (char *)a3->__begin_) == (std::__vector_base::pointer)48 )
{
v22 = begin->m_data.m_short.sizex2;
if ( (v22 & 1) != 0 ? begin->m_data.m_long.size : v22 >> 1 )
{
v24 = begin[1].m_data.m_short.sizex2;
if ( (v24 & 1) != 0 )
v25 = begin[1].m_data.m_long.size;
else
v25 = v24 >> 1;
v6 = v25 != 0;
if ( (__dst[0].m_data.m_short.sizex2 & 1) != 0 )
goto LABEL_35;
return v6;
}
}
v6 = 0;
}
LABEL_34:
if ( (__dst[0].m_data.m_short.sizex2 & 1) != 0 )
LABEL_35:
operator delete(__dst[0].m_data.m_long.longStorage);
return v6;
}