//
// cocos2d::CCParticleSystemQuad::initIndices from 0x1006024e0 to 0x1006027c6 (742 bytes)
//
// 0 xrefs:
//
// 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::CCParticleSystemQuad::initIndices(cocos2d::CCParticleSystemQuad *a1)
{
__int64 m_uTotalParticles; // rcx
GLushort *m_pIndices; // rsi
__int64 v3; // rdx
int v4; // eax
int v5; // edi
__int64 v6; // rcx
__int64 v7; // rax
__m128i v8; // xmm0
__int64 v9; // rdi
__m128i v10; // xmm3
__m128i v11; // xmm4
__m128i v12; // xmm5
__m128i v13; // xmm9
__m128i v14; // xmm6
__m128i v15; // xmm7
__m128i v16; // xmm11
__m128i v17; // xmm10
__m128i v18; // xmm5
__m128i v19; // xmm2
__int64 v20; // r8
m_uTotalParticles = a1->m_uTotalParticles;
if ( a1->m_uTotalParticles )
{
m_pIndices = a1->m_pIndices;
if ( (unsigned int)m_uTotalParticles <= 0x1F )
{
v3 = 0;
LABEL_4:
v4 = 4 * v3;
v5 = 6 * v3;
v6 = m_uTotalParticles - v3;
do
{
m_pIndices[v5] = v4;
m_pIndices[v5 + 1] = v4 + 1;
m_pIndices[v5 + 2] = v4 + 2;
m_pIndices[v5 + 5] = v4 + 1;
m_pIndices[v5 + 4] = v4 + 2;
m_pIndices[v5 + 3] = v4 + 3;
v4 += 4;
v5 += 6;
--v6;
}
while ( v6 );
return;
}
v3 = 0;
if ( (unsigned int)(6 * (m_uTotalParticles - 1)) > 0xFFFFFFFB )
goto LABEL_4;
if ( !is_mul_ok(6u, m_uTotalParticles - 1) )
goto LABEL_4;
v7 = 3 * (4 * m_uTotalParticles - 4);
if ( (GLushort *)((char *)m_pIndices + v7 + 8) < m_pIndices + 4 )
goto LABEL_4;
if ( (GLushort *)((char *)m_pIndices + v7 + 6) < m_pIndices + 3 )
goto LABEL_4;
if ( (GLushort *)((char *)m_pIndices + v7 + 10) < m_pIndices + 5 )
goto LABEL_4;
if ( (GLushort *)((char *)m_pIndices + v7 + 4) < m_pIndices + 2 )
goto LABEL_4;
if ( (GLushort *)((char *)m_pIndices + v7 + 2) < m_pIndices + 1 )
goto LABEL_4;
if ( (GLushort *)((char *)m_pIndices + v7) < m_pIndices )
goto LABEL_4;
v3 = (unsigned int)m_uTotalParticles & 0xFFFFFFF8;
v8 = _mm_cvtepi8_epi16((__m64)0x706050403020100LL);
v9 = 0;
v10 = _mm_cvtepi8_epi16((__m64)0x303030303030303LL);
v11 = _mm_cvtepi8_epi16((__m64)0x808080808080808LL);
do
{
v12 = _mm_slli_epi16(v8, 2u);
v13 = _mm_or_si128(v12, (__m128i)xmmword_10081D520);
v14 = _mm_or_si128(v12, (__m128i)xmmword_10081D530);
v15 = _mm_or_si128(v12, v10);
v16 = _mm_unpacklo_epi16(v14, v15);
v17 = _mm_unpacklo_epi16(v12, v13);
v18 = _mm_unpackhi_epi16(v12, v13);
v19 = _mm_unpackhi_epi16(v14, v15);
v20 = (unsigned int)v9 & 0xFFFFFFF0;
*(__m128i *)&m_pIndices[v20 + 40] = _mm_blend_epi16(
_mm_shuffle_epi32(_mm_shufflehi_epi16(v13, 232), 230),
_mm_blend_epi16(
_mm_shuffle_epi32(_mm_shufflehi_epi16(v14, 246), 230),
_mm_unpackhi_epi64(v18, _mm_shuffle_epi32(v19, 250)),
60),
125);
*(__m128i *)&m_pIndices[v20 + 32] = _mm_blend_epi16(
_mm_shuffle_epi32(v13, 250),
_mm_blend_epi16(
_mm_srli_si128(v14, 6),
_mm_blend_epi16(_mm_shuffle_epi32(v19, 165), v18, 48),
243),
247);
*(__m128i *)&m_pIndices[v20 + 24] = _mm_blend_epi16(
_mm_slli_epi32(v13, 0x10u),
_mm_blend_epi16(
_mm_blend_epi16(
_mm_shuffle_epi32(v18, 68),
_mm_shuffle_epi32(v19, 80),
12),
v14,
48),
223);
*(__m128i *)&m_pIndices[v20 + 16] = _mm_blend_epi16(
_mm_shuffle_epi32(_mm_shufflelo_epi16(v13, 232), 100),
_mm_blend_epi16(
_mm_shuffle_epi32(_mm_shufflelo_epi16(v14, 246), 100),
_mm_unpackhi_epi64(v17, _mm_shuffle_epi32(v16, 250)),
60),
125);
*(__m128i *)&m_pIndices[v20 + 8] = _mm_blend_epi16(
_mm_shuffle_epi32(v13, 80),
_mm_blend_epi16(
_mm_cvtepu16_epi32(v14),
_mm_blend_epi16(_mm_shuffle_epi32(v16, 165), v17, 48),
243),
247);
*(__m128i *)&m_pIndices[v20] = _mm_blend_epi16(
_mm_slli_si128(v13, 10),
_mm_blend_epi16(
_mm_shuffle_epi32(v14, 68),
_mm_blend_epi16(_mm_shuffle_epi32(v17, 68), _mm_shuffle_epi32(v16, 80), 12),
207),
223);
v8 = _mm_add_epi16(v8, v11);
v9 += 48;
}
while ( 48LL * ((unsigned int)m_uTotalParticles >> 3) != v9 );
if ( (_DWORD)v3 != (_DWORD)m_uTotalParticles )
goto LABEL_4;
}
}