//
// sub_10063E420 from 0x10063e420 to 0x10063e65b (571 bytes)
//
// 0 xrefs:
//
// 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
//
std::string *__fastcall sub_10063E420(std::string *a1, __int64 *a2, int a3, double a4)
{
__int64 v5; // rbx
const char *v6; // r15
size_t v7; // rax
size_t v8; // r12
_BYTE *data; // r13
std::string *v10; // r14
size_t v11; // r14
__int64 v12; // rbx
const char *v13; // r12
size_t v14; // rax
std::string::size_type v15; // r13
char *v16; // r15
size_t v17; // r14
unsigned int v18; // edx
const std::string::value_type *v19; // rsi
std::string::size_type size; // rdx
std::string::value_type *__s; // [rsp+18h] [rbp-58h]
std::string __dst; // [rsp+20h] [rbp-50h] BYREF
std::string *v24; // [rsp+38h] [rbp-38h]
std::string::value_type __c[44]; // [rsp+44h] [rbp-2Ch]
std::string v26; // 0:^0.24
v5 = *a2;
if ( !*a2 )
{
v6 = "";
v7 = strlen("");
if ( v7 < 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_5;
LABEL_33:
sub_100006BF0(a4);
}
v6 = "";
if ( *(_QWORD *)(v5 + 16) )
v6 = *(const char **)(v5 + 16);
v7 = strlen(v6);
if ( v7 >= 0xFFFFFFFFFFFFFFF8LL )
goto LABEL_33;
LABEL_5:
v8 = v7;
v24 = a1;
*(_DWORD *)__c = a3;
if ( v7 >= 0x17 )
{
v11 = 26;
if ( (v7 | 7) != 0x17 )
v11 = (v7 | 7) + 1;
data = operator new(v11);
a1->__r_.__value_.__r.__words[2] = (std::string::size_type)data;
a1->__r_.__value_.__r.__words[0] = v11 + 1;
a1->__r_.__value_.__l.__size_ = v8;
LABEL_12:
memmove(data, v6, v8);
data[v8] = 0;
v10 = v24;
if ( !v5 )
return v10;
goto LABEL_13;
}
a1->__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v7);
data = a1->__r_.__value_.__s.__data_;
if ( v7 )
goto LABEL_12;
*data = 0;
v10 = v24;
if ( !v5 )
return v10;
LABEL_13:
v12 = *(_QWORD *)(v5 + 8);
if ( v12 )
{
__s = v10->__r_.__value_.__s.__data_;
*(_DWORD *)__c = __c[0];
do
{
v13 = *(const char **)(v12 + 16);
if ( !v13 )
v13 = "";
v14 = strlen(v13);
if ( v14 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(a4);
v15 = v14;
if ( v14 >= 0x17 )
{
v17 = (v14 | 7) + 1;
if ( (v14 | 7) == 0x17 )
v17 = 26;
v16 = (char *)operator new(v17);
__dst.__r_.__value_.__r.__words[2] = (std::string::size_type)v16;
__dst.__r_.__value_.__r.__words[0] = v17 | 1;
__dst.__r_.__value_.__l.__size_ = v15;
}
else
{
__dst.__r_.__value_.__s.0 = (std::string::__short::$7162EEB0FEF29CC674EFA33D0008C7E0)(2 * v14);
v16 = __dst.__r_.__value_.__s.__data_;
if ( !v14 )
goto LABEL_26;
}
memmove(v16, v13, v15);
LABEL_26:
v16[v15] = 0;
v10 = v24;
std::string::push_back(&__dst, __c[0]);
v18 = (unsigned int)v10->__r_.__value_.__l.0;
if ( (v18 & 1) != 0 )
{
v19 = v10->__r_.__value_.__l.__data_;
size = v10->__r_.__value_.__l.__size_;
}
else
{
size = v18 >> 1;
v19 = __s;
}
std::string::append(&__dst, v19, size);
v26 = *v10;
*v10 = __dst;
__dst = v26;
a4 = *(double *)v26.__r_.__value_.__r.__words;
if ( (*(_BYTE *)&v26.__r_.__value_.__s.0 & 1) != 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
v12 = *(_QWORD *)(v12 + 8);
}
while ( v12 );
}
return v10;
}