//
// sub_140376270 from 0x140376270 to 0x140376452 (482 bytes)
//
// 2 xrefs:
// > GJEffectManager::saveToState @ 0x14036eb3f
// > ??> @ 0x140922130
//
// 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 11:31:01 +0000
//
// Hidden C++ exception states: #wind=2
void __fastcall sub_140376270(void ****a1, _QWORD *a2, _QWORD *a3)
{
void **v6; // r14
void **v7; // rsi
__int64 v8; // r15
void ***v9; // r14
__int64 v10; // rcx
void ***v11; // r12
_QWORD *i; // rbx
void **v13; // rsi
__int64 v14; // rcx
void ***v15; // rax
__int64 v16; // rbp
void **v17; // rbx
void **v18; // rcx
void **v19; // rax
v6 = (void **)*a1;
v7 = **a1;
if ( v7 == (void **)*a1 )
{
LABEL_4:
v8 = 0;
if ( a2 == a3 )
{
v9 = nullptr;
v11 = nullptr;
}
else
{
v9 = (void ***)operator new(0x70u);
sub_1403792C0(v10, v9 + 2, a2 + 2);
v11 = v9;
v8 = 1;
for ( i = (_QWORD *)*a2; i != a3; i = (_QWORD *)*i )
{
v13 = (void **)operator new(0x70u);
sub_1403792C0(v14, v13 + 2, i + 2);
*v11 = v13;
v13[1] = v11;
v11 = (void ***)v13;
++v8;
}
}
v18 = (void **)*a1;
if ( v8 )
{
v19 = (void **)v18[1];
v9[1] = v19;
*v19 = v9;
*v11 = v18;
v18[1] = v11;
a1[1] = (void ***)((char *)a1[1] + v8);
}
}
else
{
while ( a2 != a3 )
{
*((_DWORD *)v7 + 4) = *((_DWORD *)a2 + 4);
sub_14036D630((__int64)(v7 + 3), (__int64)(a2 + 3));
v7 = (void **)*v7;
a2 = (_QWORD *)*a2;
if ( v7 == v6 )
goto LABEL_4;
}
if ( v7 != v6 )
{
v15 = (void ***)v7[1];
*v15 = v6;
v6[1] = v15;
v16 = 0;
do
{
v17 = (void **)*v7;
sub_140069730((__int64)(v7 + 10));
j_j_free(v7);
v7 = v17;
++v16;
}
while ( v17 != v6 );
a1[1] = (void ***)((char *)a1[1] - v16);
}
}
}