//
// sub_140374A20 from 0x140374a20 to 0x140374cdf (703 bytes)
//
// 2 xrefs:
// > GJEffectManager::prepareMoveActions @ 0x14036a7bd
// > ??> @ 0x140922040
//
// 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:00 +0000
//
// Hidden C++ exception states: #wind=1
_QWORD *__fastcall sub_140374A20(_QWORD *a1, _QWORD *a2, _QWORD *a3)
{
_QWORD *v4; // rdi
__int64 v6; // rsi
__int64 v7; // rdx
__int64 v8; // rbx
unsigned __int64 v9; // r12
unsigned __int64 v10; // rdx
unsigned __int64 v11; // rcx
_QWORD *v12; // rbp
_QWORD *v13; // r14
_QWORD *v14; // rsi
_QWORD *v15; // rbx
_QWORD *v16; // rdi
_QWORD *v17; // rsi
_QWORD *i; // rbx
_QWORD *v19; // r8
__int64 v21; // [rsp+A0h] [rbp+8h]
_QWORD *v22; // [rsp+A8h] [rbp+10h]
v4 = a2;
v6 = ((__int64)a2 - *a1) / 24;
v7 = (a1[1] - *a1) / 24LL;
v8 = 0xAAAAAAAAAAAAAAALL;
if ( v7 == 0xAAAAAAAAAAAAAAALL )
sub_14005A170();
v9 = v7 + 1;
v10 = (a1[2] - *a1) / 24LL;
if ( v10 <= 0xAAAAAAAAAAAAAAALL - (v10 >> 1) )
{
v11 = v9;
if ( (v10 >> 1) + v10 >= v9 )
v11 = (v10 >> 1) + v10;
if ( v11 > 0xAAAAAAAAAAAAAAALL )
sub_140009CF0(v11, v10, 0x2AAAAAAAAAAAAAABLL);
v8 = v11;
}
v21 = 3 * v8;
v12 = sub_14003D460(24 * v8);
v22 = &v12[3 * v6];
v13 = v22 + 3;
*v22 = *a3;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v22 + 1), (const struct cocos2d::CCPoint *)(a3 + 1));
v22[2] = a3[2];
v14 = (_QWORD *)a1[1];
v15 = (_QWORD *)*a1;
if ( v4 == v14 )
{
if ( v15 != v14 )
{
v16 = v12 + 2;
do
{
*(v16 - 2) = *v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v16 - 1), (const struct cocos2d::CCPoint *)(v15 + 1));
*v16 = v15[2];
v16 += 3;
v15 += 3;
}
while ( v15 != v14 );
}
}
else
{
if ( v15 != v4 )
{
v17 = v12 + 2;
do
{
*(v17 - 2) = *v15;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v17 - 1), (const struct cocos2d::CCPoint *)(v15 + 1));
*v17 = v15[2];
v17 += 3;
v15 += 3;
}
while ( v15 != v4 );
}
for ( i = (_QWORD *)a1[1]; v4 != i; v4 += 3 )
{
*v13 = *v4;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v13 + 1), (const struct cocos2d::CCPoint *)(v4 + 1));
v13[2] = v4[2];
v13 += 3;
}
}
v19 = (_QWORD *)*a1;
if ( *a1 )
{
if ( (unsigned __int64)(24 * ((a1[2] - (_QWORD)v19) / 24LL)) >= 0x1000 )
{
if ( (unsigned __int64)v19 - *(v19 - 1) - 8 > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v19 = (_QWORD *)*(v19 - 1);
}
j_j_free(v19);
}
*a1 = v12;
a1[1] = &v12[3 * v9];
a1[2] = &v12[v21];
return v22;
}