//
// DS_Dictionary::splitWithForm from 0x100159500 to 0x10015971b (539 bytes)
//
// 3 xrefs:
// > DS_Dictionary::rectFromString @ 0x100159ace
// > DS_Dictionary::rectFromString @ 0x100159b01
// > DS_Dictionary::vec2FromString @ 0x100159d93
//
// This function is hookable on this platform (idp: pc, 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 12:25:05 +0000
//
__int64 __fastcall DS_Dictionary::splitWithForm(__int64 a1, const std::string *a2, _QWORD *a3)
{
unsigned int v4; // eax
unsigned int v5; // r15d
int v6; // r12d
int v7; // eax
int v8; // ecx
__int64 v9; // rbx
unsigned int v10; // r15d
unsigned __int64 size; // r15
std::string::pointer data; // r14
std::string::size_type v13; // rax
std::string::size_type v14; // r15
char *v15; // r12
unsigned int v16; // eax
size_t v17; // r13
int v18; // r12d
int v19; // eax
unsigned __int8 *v20; // rax
unsigned int v21; // ecx
unsigned int v23; // ecx
__int64 v24; // rcx
_QWORD *v26; // [rsp+8h] [rbp-48h]
std::string __dst[2]; // [rsp+10h] [rbp-40h] BYREF
v4 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v4 & 1) != 0 )
{
v5 = 0;
if ( !a2->__r_.__value_.__l.__size_ )
return v5;
}
else
{
v5 = 0;
if ( !(v4 >> 1) )
return v5;
}
v6 = std::string::find(a2, 123, 0);
v7 = std::string::find(a2, 125, 0);
if ( v6 == -1 || v7 == -1 || v6 > v7 )
return v5;
v8 = v6 + 1;
v9 = v6 + 1;
v10 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (v10 & 1) == 0 )
{
size = v10 >> 1;
if ( v8 <= size )
{
data = a2->__r_.__value_.__s.__data_;
goto LABEL_11;
}
LABEL_40:
sub_100056810();
}
size = a2->__r_.__value_.__l.__size_;
if ( size < v8 )
goto LABEL_40;
data = a2->__r_.__value_.__l.__data_;
LABEL_11:
v13 = ~v6 + v7;
v14 = size - v8;
if ( v14 >= v13 )
v14 = v13;
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v14 >= 0x17 )
{
v26 = a3;
v17 = 26;
if ( (v14 | 7) != 0x17 )
v17 = (v14 | 7) + 1;
v15 = (char *)operator new(v17);
__dst[0].__r_.__value_.__r.__words[2] = (std::string::size_type)v15;
__dst[0].__r_.__value_.__r.__words[0] = v17 + 1;
a3 = v26;
__dst[0].__r_.__value_.__l.__size_ = v14;
}
else
{
__dst[0].__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v14);
v15 = __dst[0].__r_.__value_.__s.__data_;
if ( !v14 )
{
__dst[0].__r_.__value_.__s.__data_[0] = 0;
v16 = (unsigned int)__dst[0].__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_17;
goto LABEL_23;
}
}
memmove(v15, &data[v9], v14);
v15[v14] = 0;
v16 = (unsigned int)__dst[0].__r_.__value_.__l.0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_17:
v5 = 0;
if ( !__dst[0].__r_.__value_.__l.__size_ )
goto LABEL_34;
goto LABEL_24;
}
LABEL_23:
v5 = 0;
if ( !(v16 >> 1) )
goto LABEL_34;
LABEL_24:
v18 = std::string::find(__dst, 123, 0);
v19 = std::string::find(__dst, 125, 0);
if ( v18 == -1 && v19 == -1 )
{
DS_Dictionary::split((__int64)__dst, (unsigned __int8 *)__dst, ",", (__int64)a3);
v20 = (unsigned __int8 *)*a3;
if ( a3[1] - *a3 == 48 )
{
v21 = *v20;
if ( (v21 & 1) != 0 ? *((_QWORD *)v20 + 1) : v21 >> 1 )
{
v23 = v20[24];
if ( (v23 & 1) != 0 )
v24 = *((_QWORD *)v20 + 4);
else
v24 = v23 >> 1;
LOBYTE(v5) = v24 != 0;
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
goto LABEL_35;
return v5;
}
}
v5 = 0;
}
LABEL_34:
if ( (*(_BYTE *)&__dst[0].__r_.__value_.__s.0 & 1) != 0 )
LABEL_35:
operator delete(__dst[0].__r_.__value_.__l.__data_);
return v5;
}