//
// cocos2d::CCParticleSystem::getParticleDrawCost from 0x1007cad10 to 0x1007cae38 (296 bytes)
//
// 1 xrefs:
// > CreateParticlePopup::update @ 0x100476575
//
// 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
//
int __fastcall cocos2d::CCParticleSystem::getParticleDrawCost(cocos2d::CCParticleSystem *a1)
{
int result; // eax
unsigned int m_uParticleCount; // ecx
cocos2d::tCCParticle *m_pParticles; // rax
__m128 v4; // xmm0
__int64 v5; // rdx
__m128 v6; // xmm1
float *p_y; // rdi
result = 0;
if ( a1->m_bIsActive )
{
m_uParticleCount = a1->m_uParticleCount;
if ( !m_uParticleCount )
{
v4 = 0;
LABEL_9:
v4.f32[0] = v4.f32[0] / 10.0;
v6 = _mm_or_ps(_mm_and_ps((__m128)xmmword_1008150B0, v4), (__m128)xmmword_1008150C0);
v6.f32[0] = v6.f32[0] + v4.f32[0];
return (int)_mm_round_ss((__m128)0LL, v6, 11).f32[0];
}
m_pParticles = a1->m_pParticles;
if ( m_uParticleCount == 1 )
{
v4 = 0;
v5 = 0;
LABEL_5:
if ( (m_uParticleCount & 1) != 0 && *(&m_pParticles->timeToLive + 37 * v5) > 0.0 )
v4.f32[0] = v4.f32[0]
+ (float)((float)((float)(*(&m_pParticles->size + 37 * v5) * 0.5)
* (float)(*(&m_pParticles->size + 37 * v5) * 0.5))
* 3.1415927);
goto LABEL_9;
}
p_y = &m_pParticles[2].pos.y;
v5 = 0;
v4 = 0;
while ( 1 )
{
if ( *(p_y - 37) > 0.0 )
{
v4.f32[0] = v4.f32[0] + (float)((float)((float)(*(p_y - 41) * 0.5) * (float)(*(p_y - 41) * 0.5)) * 3.1415927);
if ( *p_y > 0.0 )
LABEL_17:
v4.f32[0] = v4.f32[0] + (float)((float)((float)(*(p_y - 4) * 0.5) * (float)(*(p_y - 4) * 0.5)) * 3.1415927);
}
else if ( *p_y > 0.0 )
{
goto LABEL_17;
}
v5 += 2;
p_y += 74;
if ( (m_uParticleCount & 0xFFFFFFFE) == v5 )
goto LABEL_5;
}
}
return result;
}