//
// sub_14035BC80 from 0x14035bc80 to 0x14035bf49 (713 bytes)
//
// 2 xrefs:
// > GJBaseGameLayer::recordHitboxTrailState @ 0x140317822
// > ??> @ 0x140920e4c
//
// 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:30:51 +0000
//
// Hidden C++ exception states: #wind=1
cocos2d::CCPoint *__fastcall sub_14035BC80(_QWORD *a1, _QWORD *a2, __int64 a3)
{
__int64 v6; // rdi
__int64 v7; // rdx
__int64 v8; // rbx
unsigned __int64 v9; // r13
unsigned __int64 v10; // rdx
unsigned __int64 v11; // rcx
_QWORD *v12; // r15
cocos2d::CCPoint *v13; // rdi
char *v14; // rsi
_QWORD *v15; // r12
_QWORD *v16; // rbx
char *v17; // rdi
char *v18; // rdi
_QWORD *v19; // rdi
__int64 v20; // rbx
_QWORD *v21; // r8
cocos2d::CCPoint *v23; // [rsp+A0h] [rbp+8h]
__int64 v24; // [rsp+A8h] [rbp+10h]
v6 = ((__int64)a2 - *a1) / 20;
v7 = (a1[1] - *a1) / 20LL;
v8 = 0xCCCCCCCCCCCCCCCLL;
if ( v7 == 0xCCCCCCCCCCCCCCCLL )
sub_14005A170();
v9 = v7 + 1;
v10 = (a1[2] - *a1) / 20LL;
if ( v10 <= 0xCCCCCCCCCCCCCCCLL - (v10 >> 1) )
{
v11 = v9;
if ( (v10 >> 1) + v10 >= v9 )
v11 = (v10 >> 1) + v10;
if ( v11 > 0xCCCCCCCCCCCCCCCLL )
sub_140009CF0(v11, v10, 0x6666666666666667LL);
v8 = v11;
}
v24 = 20 * v8;
v12 = sub_14003D460(20 * v8);
v13 = (cocos2d::CCPoint *)((char *)v12 + 20 * v6);
v23 = v13;
v14 = (char *)v13 + 20;
cocos2d::CCPoint::CCPoint(v13, (const struct cocos2d::CCPoint *)a3);
*((_DWORD *)v13 + 2) = *(_DWORD *)(a3 + 8);
*((_DWORD *)v13 + 3) = *(_DWORD *)(a3 + 12);
*((_BYTE *)v13 + 16) = *(_BYTE *)(a3 + 16);
v15 = (_QWORD *)a1[1];
v16 = (_QWORD *)*a1;
if ( a2 == v15 )
{
if ( v16 == v15 )
goto LABEL_19;
v17 = (char *)v12 + 12;
do
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v17 - 12), (const struct cocos2d::CCPoint *)v16);
*((_DWORD *)v17 - 1) = *((_DWORD *)v16 + 2);
*(_DWORD *)v17 = *((_DWORD *)v16 + 3);
v17[4] = *((_BYTE *)v16 + 16);
v17 += 20;
v16 = (_QWORD *)((char *)v16 + 20);
}
while ( v16 != v15 );
}
else
{
if ( v16 != a2 )
{
v18 = (char *)v12 + 12;
do
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v18 - 12), (const struct cocos2d::CCPoint *)v16);
*((_DWORD *)v18 - 1) = *((_DWORD *)v16 + 2);
*(_DWORD *)v18 = *((_DWORD *)v16 + 3);
v18[4] = *((_BYTE *)v16 + 16);
v18 += 20;
v16 = (_QWORD *)((char *)v16 + 20);
}
while ( v16 != a2 );
}
v19 = (_QWORD *)a1[1];
if ( a2 != v19 )
{
v20 = (__int64)a2 + 12;
do
{
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v14, (const struct cocos2d::CCPoint *)(v20 - 12));
*((_DWORD *)v14 + 2) = *(_DWORD *)(v20 - 4);
*((_DWORD *)v14 + 3) = *(_DWORD *)v20;
v14[16] = *(_BYTE *)(v20 + 4);
v14 += 20;
v20 += 20;
}
while ( (_QWORD *)(v20 - 12) != v19 );
}
}
v13 = v23;
LABEL_19:
v21 = (_QWORD *)*a1;
if ( *a1 )
{
if ( (unsigned __int64)(20 * ((a1[2] - (_QWORD)v21) / 20LL)) >= 0x1000 )
{
if ( (unsigned __int64)v21 - *(v21 - 1) - 8 > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
v21 = (_QWORD *)*(v21 - 1);
}
j_j_free(v21);
}
*a1 = v12;
a1[1] = (char *)v12 + 20 * v9;
a1[2] = (char *)v12 + v24;
return v13;
}