//
// cocos2d::ccVertexLineToPolygon from 0x1003fefa8 to 0x1003ff28c (740 bytes)
//
// 2 xrefs:
// > cocos2d::CCMotionStreak::update @ 0x1001773c8
// > cocos2d::CCMotionStreak::update @ 0x1001773f4
//
// 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
//
void __fastcall cocos2d::ccVertexLineToPolygon(
cocos2d::CCPoint *a1,
float a2,
cocos2d::ccVertex2F *a3,
unsigned int a4,
unsigned int a5)
{
float32x2_t v5; // x29
float32x2_t v6; // x30
float32x2_t v7; // d8
float32x2_t v8; // d9
float32x2_t v9; // d10
float32x2_t v10; // d11
float32x2_t v11; // d12
float32x2_t v12; // d13
__int64 v13; // x8
__int64 v16; // x23
float v18; // s8
cocos2d::CCPoint *v19; // x22
__int64 v20; // x25
__int64 v21; // x26
unsigned int v22; // w27
__int64 v23; // x28
float v24; // s0
int32x2_t v25; // d0
float32x2_t *v26; // x0
float32x2_t *v27; // x1
__n128 v28; // q0
__n128 v29; // q1
int32x2_t v30; // d0
float32x2_t v31; // d0
float32x2_t v32; // d1
unsigned int v33; // w8
unsigned int v34; // w20
__int64 v35; // x21
cocos2d::ccVertex2F *v36; // x22
float x; // s8
float y; // s9
cocos2d::ccVertex2F *v39; // x23
float v40; // s10
float v41; // s11
bool v42; // cc
unsigned int v43; // [xsp+4h] [xbp-DCh]
float32x2_t v44; // [xsp+8h] [xbp-D8h] BYREF
float32x2_t v45; // [xsp+10h] [xbp-D0h] BYREF
float32x2_t v46; // [xsp+18h] [xbp-C8h] BYREF
float32x2_t v47; // [xsp+20h] [xbp-C0h] BYREF
float32x2_t v48; // [xsp+28h] [xbp-B8h] BYREF
float32x2_t v49; // [xsp+30h] [xbp-B0h] BYREF
float32x2_t v50; // [xsp+38h] [xbp-A8h] BYREF
float32x2_t v51; // [xsp+40h] [xbp-A0h] BYREF
float32x2_t v52[19]; // [xsp+48h] [xbp-98h] BYREF
v13 = a5 + a4;
if ( (unsigned int)v13 >= 2 )
{
v52[1] = v12;
v52[2] = v11;
v52[3] = v10;
v52[4] = v9;
v52[5] = v8;
v52[6] = v7;
v52[17] = v5;
v52[18] = v6;
v16 = (unsigned int)(v13 - 1);
v43 = 2 * a4;
if ( (unsigned int)v13 > a4 )
{
v18 = a2 * 0.5;
v19 = &a1[(unsigned int)v16 - 1];
v20 = a4;
v21 = v16 - a4;
v22 = 2 * a4;
v23 = v13 - a4;
while ( 1 )
{
sub_1000229B8((__int64 *)&v51, (__int64 *)&a1[v20]);
sub_1000229B0(&v50);
if ( !(v20 * 8) )
break;
if ( !v21 )
{
v27 = &v51;
v26 = (float32x2_t *)v19;
goto LABEL_10;
}
sub_1000229B8((__int64 *)&v49, (__int64 *)&a1[v20 + 1]);
sub_1000229B8((__int64 *)&v48, (__int64 *)&a1[v20 - 1]);
sub_1000229F0(&v49, &v51, v52);
cocos2d::ccpNormalize((const cocos2d::CCPoint *)v52);
sub_1000229F0(&v48, &v51, v52);
cocos2d::ccpNormalize((const cocos2d::CCPoint *)v52);
v24 = acosf((float)(v47.f32[1] * v46.f32[1]) + (float)(v47.f32[0] * v46.f32[0]));
if ( v24 < 1.2217 )
{
*(float *)&v25.i32[1] = sub_1000229DC(&v47, &v46, v52).f32[1];
v25.i32[0] = 2.0;
sub_100022A24(v52, &v44, v25);
goto LABEL_14;
}
if ( v24 >= 2.9671 )
{
sub_1000229F0(&v49, &v48, &v44);
LABEL_14:
cocos2d::ccpNormalize((const cocos2d::CCPoint *)&v44);
v28.n128_u32[0] = v45.u32[1];
v29.n128_u32[0] = v45.i32[0];
LABEL_15:
v28.n128_f32[0] = -v28.n128_f32[0];
sub_100022980(v28, v29, v52);
goto LABEL_16;
}
*(float *)&v30.i32[1] = sub_1000229DC(&v47, &v46, v52).f32[1];
v30.i32[0] = 2.0;
sub_100022A24(v52, &v45, v30);
cocos2d::ccpNormalize((const cocos2d::CCPoint *)&v45);
LABEL_16:
sub_1000229D0(&v50, (double *)v52);
sub_100022A14(&v50, v52, v18);
sub_1000229D0(&v50, (double *)v52);
v32 = v50;
v31 = v51;
a3[v22] = (cocos2d::ccVertex2F)vadd_f32(v51, v50);
a3[v22 + 1] = (cocos2d::ccVertex2F)vsub_f32(v31, v32);
++v20;
--v21;
v22 += 2;
if ( !--v23 )
goto LABEL_17;
}
v26 = &v51;
v27 = (float32x2_t *)&a1[1];
LABEL_10:
sub_1000229F0(v26, v27, &v48);
cocos2d::ccpNormalize((const cocos2d::CCPoint *)&v48);
v28.n128_u32[0] = v49.u32[1];
v29.n128_u32[0] = v49.i32[0];
goto LABEL_15;
}
LABEL_17:
v33 = a4 - 1;
if ( !a4 )
v33 = 0;
if ( v33 < (unsigned int)v16 )
{
v34 = v43 - 2 * (a4 != 0);
v35 = v16 - v33;
do
{
v36 = &a3[v34 + 2];
x = v36->x;
y = v36->y;
v39 = &a3[v34 + 3];
v40 = v39->x;
v41 = v39->y;
if ( !cocos2d::ccVertexLineIntersect(
a3[v34].x,
a3[v34].y,
v39->x,
v41,
a3[v34 + 1].x,
a3[v34 + 1].y,
v36->x,
y,
(float *)v52)
|| (v52[0].f32[0] >= 0.0 ? (v42 = v52[0].f32[0] <= 1.0) : (v42 = 0), !v42) )
{
v36->x = v40;
v36->y = v41;
v39->x = x;
v39->y = y;
}
v34 += 2;
--v35;
}
while ( v35 );
}
}
}