//
// EditorUI::copyObjects from 0x140112e00 to 0x14011318b (907 bytes)
//
// 6 xrefs:
// > EditorUI::onNewCustomItem @ 0x1400e43d2
// > EditorUI::onDuplicate @ 0x140112d81
// > EditorUI::doCopyObjects @ 0x140113246
// > KeyframeGameObject::updateShadowObjects @ 0x1404b5588
// > ??> @ 0x1406c9078
// > ??> @ 0x1406c9084
//
// 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=4
_QWORD *__fastcall EditorUI::copyObjects(__int64 a1, _QWORD *a2, __int64 a3, char a4, char a5)
{
_QWORD *v7; // r12
unsigned int *v9; // rdi
__int64 v10; // rax
__int64 *v11; // rdi
__int64 *i; // rsi
__int64 v13; // rbx
int v14; // eax
void **v15; // rdx
int *v16; // rax
int v17; // ecx
int v18; // eax
int *v19; // rax
int v20; // ecx
int v21; // eax
char v22; // si
_DWORD *v23; // r15
_DWORD *v24; // rbx
unsigned int v25; // edi
ColorAction *ColorAction; // r14
_BYTE *v27; // rax
size_t v28; // r8
int v30; // [rsp+20h] [rbp-E0h] BYREF
int v31; // [rsp+24h] [rbp-DCh]
__int128 v32; // [rsp+30h] [rbp-D0h] BYREF
__int128 v33; // [rsp+40h] [rbp-C0h] BYREF
_QWORD *v34; // [rsp+50h] [rbp-B0h]
_QWORD *v35; // [rsp+58h] [rbp-A8h]
char v36[8]; // [rsp+60h] [rbp-A0h] BYREF
void *v37[2]; // [rsp+68h] [rbp-98h] BYREF
char v38[40]; // [rsp+78h] [rbp-88h] BYREF
void *v39[4]; // [rsp+A0h] [rbp-60h] BYREF
_BYTE v40[528]; // [rsp+C0h] [rbp-40h] BYREF
v7 = a2;
v34 = a2;
v35 = a2;
v31 = 0;
if ( !a5 )
qsort(
*(void **)(*(_QWORD *)(a3 + 56) + 16LL),
**(unsigned int **)(a3 + 56),
8u,
(_CoreCrtNonSecureSearchSortCompareFunction)sub_1400DF370);
v30 = 0;
sub_14005E660((__int64)v36, &v30, a3);
*(_OWORD *)v7 = 0;
v7[2] = 0;
v7[3] = 15;
*(_BYTE *)v7 = 0;
v31 = 1;
if ( a3 )
{
v9 = *(unsigned int **)(a3 + 56);
v10 = *v9;
if ( (_DWORD)v10 )
{
v11 = *((__int64 **)v9 + 2);
for ( i = &v11[v10 - 1]; v11 <= i; ++v11 )
{
v13 = *v11;
if ( !*v11 )
break;
v14 = *(_DWORD *)(v13 + 1036);
if ( v14 != 749 )
{
if ( v14 == 3032 )
++*(_DWORD *)(v13 + 1876);
(*(void (__fastcall **)(__int64, void **, _QWORD))(*(_QWORD *)v13 + 1224LL))(v13, v39, *(_QWORD *)(a1 + 1280));
v15 = v39;
if ( v39[3] > (void *)0xF )
v15 = (void **)v39[0];
sub_140041270(v7, v15, (size_t)v39[2]);
sub_140041270(v7, ";", 1u);
if ( *(_DWORD *)(v13 + 1036) == 3032 )
--*(_DWORD *)(v13 + 1876);
if ( a4 )
{
v16 = *(int **)(v13 + 1104);
if ( v16 )
{
v17 = v16[1];
v18 = *v16;
if ( v17 == v18 || !v18 )
v18 = v17;
v30 = v18;
if ( (unsigned int)(v18 - 1) <= 0x3E6 )
sub_140060D70((__int64)v36, (__int64)&v33, (unsigned __int8 *)&v30);
}
else
{
v30 = 0;
}
v19 = *(int **)(v13 + 1112);
if ( v19 )
{
v20 = v19[1];
v21 = *v19;
if ( v20 == v21 || !v21 )
v21 = v20;
v30 = v21;
if ( (unsigned int)(v21 - 1) <= 0x3E6 )
sub_140060D70((__int64)v36, (__int64)&v32, (unsigned __int8 *)&v30);
}
else
{
v30 = 0;
}
}
sub_14003A830((__int64)v39);
}
}
}
}
if ( a4 && v37[1] )
{
fmt::BasicWriter::BasicWriter(v40);
v22 = 1;
v23 = v37[0];
v24 = *(_DWORD **)v37[0];
if ( *(void **)v37[0] != v37[0] )
{
*(_QWORD *)&v32 = ",";
*((_QWORD *)&v32 + 1) = 0;
do
{
v25 = v24[4];
ColorAction = GJEffectManager::getColorAction(
*(GJEffectManager **)(*(_QWORD *)(*(_QWORD *)(a1 + 1280) + 3504LL) + 320LL),
v25);
if ( !v22 )
{
v32 = (unsigned __int64)"|";
v33 = (unsigned __int64)"|";
fmt::BasicWriter::operator<<(v40, &v33);
}
v22 = 0;
fmt::BasicWriter::operator<<(v40, v25);
v33 = (unsigned __int64)",";
fmt::BasicWriter::operator<<(v40, &v33);
sub_140259130(ColorAction, v40);
v24 = *(_DWORD **)v24;
}
while ( v24 != v23 );
v7 = v34;
}
sub_140041270(v7, "#", 1u);
v27 = (_BYTE *)fmt::BasicWriter::c_str(v40);
v28 = -1;
do
++v28;
while ( v27[v28] );
sub_140041270(v7, v27, v28);
fmt::BasicWriter::~BasicWriter(v40);
}
sub_14005D100((__int64)v38);
sub_14005D870(v37);
return v7;
}