//
// DS_Dictionary::rectFromString from 0x100159740 to 0x100159ccb (1419 bytes)
//
// 2 xrefs:
// > DS_Dictionary::getRectForKey @ 0x10015d53e
// > DS_Dictionary::getRectArrayForKey @ 0x10015da10
//
// 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::rectFromString(
double a1,
double a2,
double a3,
double a4,
__int64 a5,
__int64 a6,
__int64 a7)
{
unsigned int v8; // r14d
std::string::size_type v9; // r13
int v10; // eax
std::string::size_type v12; // rax
bool v13; // cl
std::string::size_type v14; // r15
std::string::size_type size; // r14
std::string::pointer data; // r12
std::string::size_type v17; // rax
std::string::size_type v18; // r14
char *v19; // rbx
int v20; // eax
std::string *v21; // rdi
std::string::size_type v22; // r14
size_t v23; // r13
std::string::pointer v24; // rsi
unsigned __int64 v25; // r12
std::string *v26; // r13
size_t v27; // r15
std::string::size_type v28; // r14
std::string::size_type v29; // r12
__int64 v30; // rbx
std::string::size_type v31; // rax
std::string::size_type v32; // r12
std::string *v33; // r13
double v34; // rsi
size_t v35; // r15
__int64 v36; // rbx
char *v37; // r15
const char *v38; // rdi
const char *v39; // r15
double v40; // xmm0_8
char *v41; // r15
const char *v42; // rdi
float v43; // xmm1_4
float v44; // xmm0_4
float v45; // xmm0_4
const char *v46; // r15
void **v47; // rbx
void **v48; // r15
void *v49; // rdi
void **v50; // rbx
void **v51; // r15
void *v52; // rdi
_BYTE v53[16]; // [rsp+8h] [rbp-D8h] BYREF
__int64 v54; // [rsp+18h] [rbp-C8h]
void *v55[2]; // [rsp+20h] [rbp-C0h] BYREF
__int64 v56; // [rsp+30h] [rbp-B0h]
void *__p[2]; // [rsp+40h] [rbp-A0h] BYREF
__int64 v58; // [rsp+50h] [rbp-90h]
std::string v59; // [rsp+58h] [rbp-88h] BYREF
float v60; // [rsp+74h] [rbp-6Ch]
__int64 v61; // [rsp+78h] [rbp-68h]
std::string __dst; // [rsp+80h] [rbp-60h] BYREF
double v63; // [rsp+98h] [rbp-48h]
std::string v64; // [rsp+A0h] [rbp-40h] BYREF
DS_Dictionary::cleanStringWhiteSpace(&v64, a6, a6);
v8 = 0;
v9 = std::string::find(&v64, 123, 0);
v10 = std::string::find(&v64, 125, 0);
if ( v10 != -1 )
{
v12 = std::string::find(&v64, 125, v10 + 1);
v13 = (_DWORD)v12 == -1;
if ( (_DWORD)v12 != -1 )
{
LODWORD(v12) = std::string::find(&v64, 125, (__int64)((__int64)&_mh_execute_header + (v12 << 32)) >> 32);
v13 = (_DWORD)v12 == -1;
}
v8 = 0;
if ( (_DWORD)v9 != -1 && !v13 )
{
v14 = (__int64)((__int64)&_mh_execute_header + (v9 << 32)) >> 32;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
{
size = v64.__r_.__value_.__l.__size_;
if ( v64.__r_.__value_.__l.__size_ >= v14 )
{
data = v64.__r_.__value_.__l.__data_;
LABEL_14:
v17 = ~(_DWORD)v9 + (int)v12;
v18 = size - v14;
if ( v18 >= v17 )
v18 = v17;
if ( v18 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v54 = a7;
if ( v18 >= 0x17 )
{
v23 = 26;
if ( (v18 | 7) != 0x17 )
v23 = (v18 | 7) + 1;
v19 = (char *)operator new(v23);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v19;
__dst.__r_.__value_.__r.__words[0] = v23 | 1;
__dst.__r_.__value_.__l.__size_ = v18;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v18);
v19 = __dst.__r_.__value_.__s.__data_;
if ( !v18 )
{
__dst.__r_.__value_.__s.__data_[0] = 0;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) == 0 )
goto LABEL_21;
goto LABEL_20;
}
}
memmove(v19, &data[v14], v18);
v19[v18] = 0;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) == 0 )
{
LABEL_21:
v64 = __dst;
v8 = 0;
v20 = std::string::find(&v64, 125, 0);
if ( v20 == -1 )
goto LABEL_2;
v21 = &v64;
v22 = std::string::find(&v64, 44, v20);
if ( (_DWORD)v22 == -1 )
{
v8 = 0;
goto LABEL_2;
}
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
{
v24 = v64.__r_.__value_.__l.__data_;
v25 = v64.__r_.__value_.__l.__size_;
}
else
{
v25 = *(_BYTE *)&v64.__r_.__value_.__l.0 >> 1;
v24 = v64.__r_.__value_.__s.__data_;
}
if ( v25 >= (int)v22 )
v25 = (int)v22;
if ( v25 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v61 = (int)v22;
v63 = COERCE_DOUBLE((std::string *)((char *)&v64.__r_.__value_.__l.0 + 1));
if ( v25 >= 0x17 )
{
v27 = 26;
if ( (v25 | 7) != 0x17 )
v27 = (v25 | 7) + 1;
v26 = (std::string *)operator new(v27);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v26;
__dst.__r_.__value_.__r.__words[0] = v27 | 1;
__dst.__r_.__value_.__l.__size_ = v25;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v25);
v26 = (std::string *)((char *)&__dst.__r_.__value_.__l.0 + 1);
if ( !v25 )
{
LABEL_42:
*((_BYTE *)&v26->__r_.__value_.__s.0 + v25) = 0;
v28 = (__int64)((__int64)&_mh_execute_header + (v22 << 32)) >> 32;
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
{
v29 = v64.__r_.__value_.__l.__size_;
v30 = v61;
if ( v64.__r_.__value_.__l.__size_ < v28 )
goto LABEL_96;
v63 = *(double *)&v64.__r_.__value_.__l.__data_;
}
else
{
v29 = *(_BYTE *)&v64.__r_.__value_.__l.0 >> 1;
v30 = v61;
if ( v28 > v29 )
LABEL_96:
sub_100056810();
}
v31 = v29 - v30;
v32 = v29 - v28;
if ( v32 >= v31 )
v32 = v31;
if ( v32 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
if ( v32 >= 0x17 )
{
v35 = 26;
if ( (v32 | 7) != 0x17 )
v35 = (v32 | 7) + 1;
v33 = (std::string *)operator new(v35);
v59.__r_.__value_.__r.__words[2] = (std::string::size_type)v33;
v59.__r_.__value_.__r.__words[0] = v35 | 1;
v59.__r_.__value_.__l.__size_ = v32;
v34 = v63;
}
else
{
v59.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v32);
v33 = (std::string *)((char *)&v59.__r_.__value_.__l.0 + 1);
v34 = v63;
if ( !v32 )
goto LABEL_57;
}
v21 = v33;
memmove(v33, (const void *)(v28 + *(_QWORD *)&v34), v32);
LABEL_57:
*((_BYTE *)&v33->__r_.__value_.__s.0 + v32) = 0;
*(_OWORD *)v55 = 0;
v56 = 0;
v36 = v54;
if ( (unsigned __int8)DS_Dictionary::splitWithForm((__int64)v21, &__dst, v55) )
{
*(_OWORD *)__p = 0;
v58 = 0;
v8 = DS_Dictionary::splitWithForm((__int64)v21, &v59, __p);
if ( (_BYTE)v8 )
{
v37 = (char *)v55[0];
if ( (*(_BYTE *)v55[0] & 1) != 0 )
v38 = *((const char **)v55[0] + 2);
else
v38 = (char *)v55[0] + 1;
v63 = atof(v38);
if ( (v37[24] & 1) != 0 )
v39 = *((const char **)v37 + 5);
else
v39 = v37 + 25;
v40 = atof(v39);
v41 = (char *)__p[0];
if ( (*(_BYTE *)__p[0] & 1) != 0 )
v42 = *((const char **)__p[0] + 2);
else
v42 = (char *)__p[0] + 1;
v43 = v63;
*(float *)&v63 = v43;
v44 = v40;
*(float *)&v61 = v44;
v45 = atof(v42);
v60 = v45;
if ( (v41[24] & 1) != 0 )
v46 = *((const char **)v41 + 5);
else
v46 = v41 + 25;
*(float *)&a4 = atof(v46);
sub_100278270(
v53,
COERCE_DOUBLE((unsigned __int64)LODWORD(v63)),
COERCE_DOUBLE((unsigned __int64)(unsigned int)v61),
COERCE_DOUBLE((unsigned __int64)LODWORD(v60)),
a4);
sub_100278810(v36, v53);
}
v47 = (void **)__p[0];
if ( __p[0] )
{
v48 = (void **)__p[1];
v49 = __p[0];
if ( __p[1] != __p[0] )
{
do
{
if ( (*(_BYTE *)(v48 - 3) & 1) != 0 )
operator delete(*(v48 - 1));
v48 -= 3;
}
while ( v48 != v47 );
v49 = __p[0];
}
__p[1] = v47;
operator delete(v49);
}
}
else
{
v8 = 0;
}
v50 = (void **)v55[0];
if ( v55[0] )
{
v51 = (void **)v55[1];
v52 = v55[0];
if ( v55[1] != v55[0] )
{
do
{
if ( (*(_BYTE *)(v51 - 3) & 1) != 0 )
operator delete(*(v51 - 1));
v51 -= 3;
}
while ( v51 != v50 );
v52 = v55[0];
}
v55[1] = v50;
operator delete(v52);
}
if ( (*(_BYTE *)&v59.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v59.__r_.__value_.__l.__data_);
if ( (*(_BYTE *)&__dst.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
goto LABEL_2;
}
}
v21 = v26;
memmove(v26, v24, v25);
goto LABEL_42;
}
LABEL_20:
operator delete(v64.__r_.__value_.__l.__data_);
goto LABEL_21;
}
}
else
{
size = *(_BYTE *)&v64.__r_.__value_.__l.0 >> 1;
if ( v14 <= size )
{
data = v64.__r_.__value_.__s.__data_;
goto LABEL_14;
}
}
sub_100056810();
}
}
LABEL_2:
if ( (*(_BYTE *)&v64.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v64.__r_.__value_.__l.__data_);
return v8;
}