//
// cocos2d::CCShuffleTiles::startWithTarget from 0x18003b430 to 0x18003b6c6 (662 bytes)
//
// 3 xrefs:
// > ??> @ 0x1800ea3a0
// > ??> @ 0x1801438a8
// > ??> @ 0x1801b0f0c
//
// 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
//
// Hidden C++ exception states: #wind=1
void __fastcall cocos2d::CCShuffleTiles::startWithTarget(cocos2d::CCShuffleTiles *this, struct cocos2d::CCNode *a2)
{
unsigned int v3; // ecx
float v4; // xmm0_4
size_t v5; // rax
__int64 v6; // rdx
unsigned int v7; // ebx
__int64 v8; // r14
__int64 i; // rsi
int v10; // eax
__int64 v11; // rdx
int v12; // r8d
unsigned __int64 v13; // rsi
char *v14; // rax
_DWORD *v15; // rbp
cocos2d::CCSize *v16; // rbx
int v17; // esi
float v18; // xmm6_4
int v19; // r14d
float v20; // xmm8_4
float *v21; // rax
float *v22; // rax
float *v23; // rbx
float v24; // xmm3_4
__int64 v25; // r10
__int64 v26; // r9
unsigned int v27; // r8d
float v28; // [rsp+20h] [rbp-68h] BYREF
float v29; // [rsp+28h] [rbp-60h] BYREF
unsigned __int64 v30; // [rsp+90h] [rbp+8h] BYREF
char *v31; // [rsp+A0h] [rbp+18h] BYREF
float v32; // [rsp+A8h] [rbp+20h] BYREF
cocos2d::CCGridAction::startWithTarget(this, a2);
v3 = *((_DWORD *)this + 26);
if ( v3 != -1 )
srand(v3);
v4 = *((float *)this + 24) * *((float *)this + 25);
*((_DWORD *)this + 27) = (int)v4;
v5 = 4LL * (unsigned int)(int)v4;
if ( !is_mul_ok((unsigned int)(int)v4, 4u) )
v5 = -1;
*((_QWORD *)this + 14) = operator new(v5);
v6 = 0;
v7 = *((_DWORD *)this + 27);
if ( v7 )
{
do
{
*(_DWORD *)(*((_QWORD *)this + 14) + 4 * v6) = v6;
v6 = (unsigned int)(v6 + 1);
v7 = *((_DWORD *)this + 27);
}
while ( (unsigned int)v6 < v7 );
}
v8 = *((_QWORD *)this + 14);
for ( i = (int)(v7 - 1); i >= 0; --i )
{
v10 = rand();
v11 = (unsigned int)(v10 >> 31);
LODWORD(v11) = v10 % (int)v7;
v12 = *(_DWORD *)(v8 + 4 * i);
*(_DWORD *)(v8 + 4 * i) = *(_DWORD *)(v8 + 4 * v11);
*(_DWORD *)(v8 + 4 * v11) = v12;
--v7;
}
v13 = *((unsigned int *)this + 27);
v30 = v13;
v14 = (char *)operator new(saturated_mul(v13, 0x18u));
v15 = v14;
v31 = v14;
if ( v14 )
{
if ( v13 )
{
v16 = (cocos2d::CCSize *)(v14 + 16);
do
{
cocos2d::CCSize::CCSize(v16 - 2);
cocos2d::CCSize::CCSize(v16 - 1);
cocos2d::CCSize::CCSize(v16);
v16 += 3;
--v13;
}
while ( v13 );
}
}
else
{
v15 = nullptr;
}
*((_QWORD *)this + 15) = v15;
v17 = 0;
if ( *((float *)this + 24) > 0.0 )
{
v18 = 0.0;
do
{
v19 = 0;
if ( *((float *)this + 25) > 0.0 )
{
v20 = 0.0;
do
{
v21 = kmVec2Fill(&v32, v18, v20);
cocos2d::CCSize::operator=(v15, v21);
v22 = kmVec2Fill(&v28, v18, v20);
cocos2d::CCSize::operator=(v15 + 2, v22);
v23 = kmVec2Fill(&v29, v18, v20);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)&v30);
v24 = *v23;
v25 = (unsigned int)(int)(float)((float)(*v23 * *((float *)this + 25)) + v23[1]);
v26 = *((_QWORD *)this + 14);
v27 = (int)*((float *)this + 25);
*(float *)&v30 = (float)(int)(*(_DWORD *)(v26 + 4 * v25) / v27);
*((float *)&v30 + 1) = (float)(int)(*(_DWORD *)(v26 + 4 * v25) % v27);
kmVec2Fill(
(float *)&v31,
(float)(int)(float)(*(float *)&v30 - v24),
(float)(int)(float)(*((float *)&v30 + 1) - v23[1]));
cocos2d::CCSize::operator=(v15 + 4, &v31);
v15 += 6;
v20 = (float)++v19;
}
while ( *((float *)this + 25) > (float)v19 );
}
v18 = (float)++v17;
}
while ( *((float *)this + 24) > (float)v17 );
}
}