//
// DS_Dictionary::splitWithForm from 0x180020f80 to 0x1800211e1 (609 bytes)
//
// 5 xrefs:
// > DS_Dictionary::rectFromString @ 0x18001cbad
// > DS_Dictionary::rectFromString @ 0x18001cbdd
// > DS_Dictionary::vec2FromString @ 0x180021b82
// > ??> @ 0x1801438a8
// > ??> @ 0x1801aedac
//
// 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
//
// Hidden C++ exception states: #wind=1
char __fastcall DS_Dictionary::splitWithForm(__int64 a1, __int64 a2, __int64 *a3)
{
const void **v4; // rbx
size_t v6; // rsi
const void *v7; // rbp
unsigned __int64 v8; // r14
void *v9; // rax
int v10; // edi
const void *v11; // rbp
void *v12; // rax
int v13; // ecx
int v14; // eax
size_t v15; // r8
size_t v16; // rsi
size_t v17; // rbp
void **v18; // r14
void **v19; // rbx
unsigned __int64 v20; // rdi
void *v21; // rax
int v22; // esi
void **v23; // r14
void *v24; // rax
int v25; // eax
__int64 v26; // rcx
char v27; // si
void **v28; // rax
void *Buf[2]; // [rsp+28h] [rbp-50h] BYREF
size_t MaxCount; // [rsp+38h] [rbp-40h]
unsigned __int64 v32; // [rsp+40h] [rbp-38h]
v4 = (const void **)a2;
v6 = *(_QWORD *)(a2 + 16);
if ( !v6 )
return 0;
v7 = (const void *)a2;
v8 = *(_QWORD *)(a2 + 24);
if ( v8 > 0xF )
v7 = *(const void **)a2;
v9 = memchr(v7, 123, *(_QWORD *)(a2 + 16));
if ( v9 )
v10 = (_DWORD)v9 - (_DWORD)v7;
else
v10 = -1;
v11 = v4;
if ( v8 > 0xF )
v11 = *v4;
v12 = memchr(v11, 125, v6);
v13 = v12 ? (_DWORD)v12 - (_DWORD)v11 : -1;
if ( v10 == -1 || v13 == -1 || v10 > v13 )
return 0;
v14 = v10 + 1;
*(_OWORD *)Buf = 0;
MaxCount = 0;
v32 = 0;
if ( v6 < v10 + 1 )
std::vector::_Xlen();
v15 = v13 - v10 - 1;
v16 = v6 - v14;
if ( v16 < v15 )
v15 = v16;
if ( v8 > 0xF )
v4 = (const void **)*v4;
sub_18000CE60(Buf, (char *)v4 + v14, v15);
v17 = MaxCount;
if ( !MaxCount )
goto LABEL_38;
v18 = Buf;
v19 = (void **)Buf[0];
v20 = v32;
if ( v32 > 0xF )
v18 = (void **)Buf[0];
v21 = memchr(v18, 123, MaxCount);
if ( v21 )
v22 = (_DWORD)v21 - (_DWORD)v18;
else
v22 = -1;
v23 = Buf;
if ( v20 > 0xF )
v23 = v19;
if ( v17 && (v24 = memchr(v23, 125, v17)) != nullptr )
v25 = (_DWORD)v24 - (_DWORD)v23;
else
v25 = -1;
if ( v22 != -1 || v25 != -1 )
goto LABEL_39;
DS_Dictionary::split(a1, (__int64 *)Buf, ",", a3);
v26 = *a3;
if ( (a3[1] - *a3) >> 5 != 2 || !*(_QWORD *)(v26 + 16) || !*(_QWORD *)(v26 + 48) )
{
LABEL_38:
v20 = v32;
v19 = (void **)Buf[0];
LABEL_39:
v27 = 0;
goto LABEL_40;
}
v27 = 1;
v20 = v32;
v19 = (void **)Buf[0];
LABEL_40:
if ( v20 > 0xF )
{
v28 = v19;
if ( v20 + 1 >= 0x1000 )
{
v19 = (void **)*(v19 - 1);
if ( (unsigned __int64)((char *)v28 - (char *)v19 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free_0(v19);
}
return v27;
}