//
// sub_1008DC120 from 0x1008dc120 to 0x1008dc419 (761 bytes)
//
// 1 xrefs:
// > Dropdown::init @ 0x1008d9bb9
//
// 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:44 +0000
//
_QWORD *__fastcall sub_1008DC120(
std::string::__raw **a1,
const std::string *a2,
const std::string *a3,
unsigned __int64 a4)
{
const std::string *v4; // r15
std::string::__raw **v5; // r14
std::string *v6; // r12
__int64 v7; // rax
std::string *v9; // r14
std::string *v10; // rdi
std::string *v11; // r14
signed __int64 v12; // r13
const std::string *v13; // rbx
std::string *v14; // rbx
_QWORD *result; // rax
unsigned __int64 v16; // rax
const std::string *v17; // rbx
__int64 v18; // r13
std::string::__raw *v19; // r12
std::string::__raw *v20; // rdi
std::string::__raw *v21; // rdi
const std::string *v22; // [rsp+30h] [rbp-40h]
const std::string *v23; // [rsp+30h] [rbp-40h]
std::string::__raw *v24; // [rsp+38h] [rbp-38h] BYREF
_QWORD *v25; // [rsp+40h] [rbp-30h]
v4 = a2;
v5 = a1;
v6 = (std::string *)*a1;
v7 = (__int64)a1[2];
if ( 0xAAAAAAAAAAAAAAABLL * ((v7 - (__int64)*a1) >> 3) >= a4 )
{
v23 = a3;
v25 = a1;
v11 = (std::string *)a1[1];
v12 = (char *)v11 - (char *)v6;
if ( 0xAAAAAAAAAAAAAAABLL * (((char *)v11 - (char *)v6) >> 3) >= a4 )
{
v14 = v6;
if ( a2 != a3 )
{
do
{
std::string::operator=(v6++, v4++);
++v14;
}
while ( v4 != v23 );
v11 = (std::string *)v25[1];
}
while ( v11 != v6 )
{
if ( (*(_BYTE *)&v11[-1].__r_.__value_.__s.0 & 1) != 0 )
operator delete(v11[-1].__r_.__value_.__l.__data_);
--v11;
}
result = v25;
v25[1] = v14;
}
else
{
v13 = (const std::string *)((char *)a2 + v12);
if ( v11 != v6 )
{
do
{
std::string::operator=(v6++, v4++);
v12 -= 24LL;
}
while ( v12 );
v11 = (std::string *)v25[1];
}
v24 = (std::string::__raw *)v11;
v21 = (std::string::__raw *)v11;
if ( v13 != v23 )
{
v21 = (std::string::__raw *)v11;
do
{
if ( (*(_BYTE *)&v13->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(v21, v13->__r_.__value_.__l.__data_, v13->__r_.__value_.__l.__size_);
v21 = v24;
}
else
{
v21->__words[2] = v13->__r_.__value_.__r.__words[2];
*(_OWORD *)v21->__words = *(_OWORD *)&v13->__r_.__value_.__l.0;
}
++v13;
v24 = ++v21;
}
while ( v13 != v23 );
}
result = v25;
v25[1] = v21;
}
}
else
{
if ( v6 )
{
v22 = a3;
v25 = (_QWORD *)a4;
v9 = (std::string *)a1[1];
v10 = v6;
if ( v9 != v6 )
{
do
{
if ( (*(_BYTE *)&v9[-1].__r_.__value_.__s.0 & 1) != 0 )
operator delete(v9[-1].__r_.__value_.__l.__data_);
--v9;
}
while ( v9 != v6 );
v10 = (std::string *)*a1;
}
a1[1] = (std::string::__raw *)v6;
operator delete(v10);
*(_OWORD *)a1 = 0;
a1[2] = nullptr;
v7 = 0;
a4 = (unsigned __int64)v25;
v5 = a1;
a3 = v22;
}
if ( a4 > 0xAAAAAAAAAAAAAAALL )
goto LABEL_43;
v16 = 0xAAAAAAAAAAAAAAABLL * (v7 >> 3);
if ( 2 * v16 > a4 )
a4 = 2 * v16;
if ( v16 >= 0x555555555555555LL )
a4 = 0xAAAAAAAAAAAAAAALL;
if ( a4 > 0xAAAAAAAAAAAAAAALL )
LABEL_43:
sub_100056A70();
v17 = a3;
v18 = a4;
v19 = (std::string::__raw *)operator new(24 * a4);
*v5 = v19;
v5[1] = v19;
v5[2] = &v19[v18];
v24 = v19;
result = &v24;
if ( a2 == v17 )
{
v20 = v19;
}
else
{
v20 = v19;
do
{
if ( (*(_BYTE *)&v4->__r_.__value_.__s.0 & 1) != 0 )
{
result = sub_10001AD30(v20, v4->__r_.__value_.__l.__data_, v4->__r_.__value_.__l.__size_);
v20 = v24;
}
else
{
result = v4->__r_.__value_.__l.__data_;
v20->__words[2] = (std::string::size_type)result;
*(_OWORD *)v20->__words = *(_OWORD *)&v4->__r_.__value_.__l.0;
}
++v4;
v24 = ++v20;
}
while ( v4 != v17 );
}
v5[1] = v20;
}
return result;
}