//
// sub_1008EB110 from 0x1008eb110 to 0x1008eb2d5 (453 bytes)
//
// 6 xrefs:
// > EditorSFXManager::deserializeAll @ 0x1008e16b3
// > EditorSFXManager::deserializeAll @ 0x1008e170a
// > EditorSFXManager::deserializeAll @ 0x1008e1ac6
// > sub_1008EB390 @ 0x1008eb5ac
// > sub_1008EB390 @ 0x1008eb5e2
// > sub_1008EB390 @ 0x1008eb820
//
// 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:37:53 +0000
//
bool __fastcall sub_1008EB110(std::string::size_type **a1, _BYTE *a2)
{
std::string::size_type *v3; // rax
const std::string *v4; // rdi
std::string::size_type v5; // r12
unsigned int v6; // r14d
std::string::size_type size; // r14
std::string::size_type v8; // rax
std::string::size_type *v9; // r13
unsigned int v10; // ecx
std::string::size_type v11; // rsi
size_t v12; // rdx
unsigned __int64 v13; // r15
unsigned __int8 *v14; // r13
size_t v15; // r15
char *v16; // rbx
_BYTE *v17; // rbx
size_t v19; // r12
std::string::size_type **v21; // [rsp+8h] [rbp-58h]
std::string::size_type v22; // [rsp+10h] [rbp-50h]
std::string::size_type v23; // [rsp+18h] [rbp-48h]
__int128 __dst; // [rsp+20h] [rbp-40h] BYREF
char *v25; // [rsp+30h] [rbp-30h]
v3 = *a1;
v4 = (const std::string *)a1[1];
v5 = *v3;
v6 = (unsigned int)v4->__r_.__value_.__l.0;
if ( (v6 & 1) == 0 )
{
size = v6 >> 1;
if ( v5 >= size )
return v5 < size;
LABEL_5:
v8 = std::string::find(v4, 59, *v3);
v9 = a1[1];
v10 = *(unsigned __int8 *)v9;
if ( v8 == -1 )
{
if ( (v10 & 1) == 0 )
{
v8 = v10 >> 1;
v11 = **a1;
v12 = v8 - v11;
v13 = (unsigned __int8)v10 >> 1;
if ( v11 > v13 )
goto LABEL_29;
LABEL_11:
v14 = (unsigned __int8 *)v9 + 1;
goto LABEL_15;
}
v8 = v9[1];
v11 = **a1;
v12 = v8 - v11;
}
else
{
v11 = **a1;
v12 = v8 - v11;
if ( (v10 & 1) == 0 )
{
v13 = (unsigned __int8)v10 >> 1;
if ( v11 > v13 )
LABEL_29:
sub_100056810();
goto LABEL_11;
}
}
v13 = v9[1];
if ( v13 < v11 )
goto LABEL_29;
v14 = (unsigned __int8 *)v9[2];
LABEL_15:
v15 = v13 - v11;
if ( v15 >= v12 )
v15 = v12;
if ( v15 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v22 = v8;
v21 = a1;
if ( v15 >= 0x17 )
{
v23 = v5;
v19 = 26;
if ( (v15 | 7) != 0x17 )
v19 = (v15 | 7) + 1;
v16 = (char *)operator new(v19);
v25 = v16;
*(_QWORD *)&__dst = v19 + 1;
v5 = v23;
*((_QWORD *)&__dst + 1) = v15;
}
else
{
LOBYTE(__dst) = 2 * v15;
v16 = (char *)&__dst + 1;
if ( !v15 )
{
BYTE1(__dst) = 0;
v17 = a2;
if ( (*a2 & 1) == 0 )
{
LABEL_22:
*((_QWORD *)v17 + 2) = v25;
*(_OWORD *)v17 = __dst;
**v21 = v22 + 1;
return v5 < size;
}
LABEL_21:
operator delete(*((void **)v17 + 2));
goto LABEL_22;
}
}
memmove(v16, &v14[v11], v15);
v16[v15] = 0;
v17 = a2;
if ( (*a2 & 1) == 0 )
goto LABEL_22;
goto LABEL_21;
}
size = v4->__r_.__value_.__l.__size_;
if ( v5 < size )
goto LABEL_5;
return v5 < size;
}