//
// SpriteAnimationManager::executeAnimation from 0x140073f60 to 0x14007444a (1258 bytes)
//
// 2 xrefs:
// > SpriteAnimationManager::runAnimation @ 0x140073f0a
// > ??> @ 0x1406c6330
//
// 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=5
void __fastcall SpriteAnimationManager::executeAnimation(__int64 a1, void **a2, __int64 a3, float a4)
{
void **v6; // rbx
void *v7; // rdx
const char *v8; // rbx
cocos2d::CCString *v9; // rsi
size_t v10; // r15
const char *v11; // rdx
cocos2d::CCString *v12; // rax
const char *CString; // rax
size_t v14; // r8
cocos2d::CCString *v15; // rax
float v16; // xmm6_4
void *v17; // rcx
const char *v18; // rax
size_t v19; // r8
_DWORD *v20; // r12
int v21; // esi
cocos2d::CCString *v22; // rax
spriteMode v23; // edi
__int64 v24; // rbx
unsigned __int64 v25; // rbx
char v26; // si
const void *v27; // rcx
unsigned __int64 v28; // rdi
size_t v29; // r8
char v30; // di
void *v31; // rcx
const char *v32; // rdx
cocos2d::CCString *v33; // rax
const char *v34; // rax
__int64 v35; // rbx
void *v36; // rcx
cocos2d::ccColor3B *v37; // r8
cocos2d::CCString *v38; // rax
spriteMode v39; // edi
__int64 v40; // rbx
__int64 v41; // [rsp+20h] [rbp-49h]
__int64 v42; // [rsp+20h] [rbp-49h]
_BYTE v43[32]; // [rsp+30h] [rbp-39h] BYREF
void **v44; // [rsp+50h] [rbp-19h]
void *Block[2]; // [rsp+58h] [rbp-11h] BYREF
__m128i si128; // [rsp+68h] [rbp-1h]
v44 = a2;
v6 = (void **)(a1 + 408);
if ( !sub_14003A760((_QWORD *)(a1 + 408), a2) )
goto LABEL_51;
cocos2d::CCNode::stopAllActions(*(cocos2d::CCNode **)(*(_QWORD *)(a1 + 320) + 672LL));
if ( v6 != a2 )
{
v7 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v7 = *a2;
sub_14003CCE0(v6, v7, (size_t)a2[2]);
}
v8 = (const char *)sub_14003BDB0((__int64)v43, (__int64)a2);
v9 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 344), v8);
v10 = -1;
if ( v9 )
{
v11 = v8;
if ( *((_QWORD *)v8 + 3) > 0xFu )
v11 = *(const char **)v8;
v12 = cocos2d::CCString::createWithFormat("%s%s", v11, (const char *)&dword_140537268);
CString = cocos2d::CCString::getCString(v12);
*(_OWORD *)Block = 0;
si128 = 0;
v14 = -1;
do
++v14;
while ( CString[v14] );
sub_14003A930(Block, CString, v14);
v15 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 344), Block);
v16 = cocos2d::CCString::floatValue(v15);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v17 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v17 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v17 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v17);
}
if ( v16 == 0.0 )
{
v18 = cocos2d::CCString::getCString(v9);
*(_OWORD *)Block = 0;
si128 = 0u;
v19 = -1;
do
++v19;
while ( v18[v19] );
sub_14003A930(Block, v18, v19);
sub_14003A830((__int64)Block);
}
}
sub_14003A830((__int64)v8);
v20 = (_DWORD *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 400), a2);
if ( v20[7] )
{
v42 = sub_14003BDB0((__int64)v43, (__int64)a2);
v38 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(a1 + 336), v42);
v39 = cocos2d::CCString::intValue(v38);
sub_14003A830(v42);
v40 = *(_QWORD *)(a1 + 320);
cocos2d::CCNode::stopActionByTag((cocos2d::CCNode *)v40, 1);
sub_14003CCE0((void **)(v40 + 632), byte_140518980, 0);
CCAnimatedSprite::switchToMode(*(CCAnimatedSprite **)(a1 + 320), v39);
(*(void (__fastcall **)(_QWORD, _DWORD *))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 672LL) + 992LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 320) + 672LL),
v20);
goto LABEL_51;
}
v21 = *(_DWORD *)(*(_QWORD *)(a1 + 320) + 696LL);
v41 = sub_14003BDB0((__int64)v43, (__int64)a2);
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(a1 + 336), v41);
v23 = cocos2d::CCString::intValue(v22);
sub_14003A830(v41);
v24 = *(_QWORD *)(a1 + 320);
cocos2d::CCNode::stopActionByTag((cocos2d::CCNode *)v24, 1);
sub_14003CCE0((void **)(v24 + 632), byte_140518980, 0);
CCAnimatedSprite::switchToMode(*(CCAnimatedSprite **)(a1 + 320), v23);
if ( v21 == *(_DWORD *)(*(_QWORD *)(a1 + 320) + 696LL) )
{
*(_OWORD *)Block = 0;
si128.m128i_i64[0] = 5;
v25 = 15;
si128.m128i_i64[1] = 15;
strcpy((char *)Block, "spawn");
v26 = 1;
v27 = a2;
if ( (unsigned __int64)a2[3] > 0xF )
v27 = *a2;
v28 = (unsigned __int64)a2[2];
v29 = v28;
if ( v28 > 5 )
v29 = 5;
if ( memcmp(v27, Block, v29) || v28 != 5 )
{
v30 = 0;
goto LABEL_31;
}
}
else
{
v25 = si128.m128i_u64[1];
v26 = 0;
}
v30 = 1;
LABEL_31:
if ( (v26 & 1) != 0 && v25 > 0xF )
{
v31 = Block[0];
if ( v25 + 1 >= 0x1000 )
{
v31 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v31 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v31);
}
if ( v30 )
{
v32 = (const char *)a2;
if ( (unsigned __int64)a2[3] > 0xF )
v32 = (const char *)*a2;
v33 = cocos2d::CCString::createWithFormat("%s_first", v32);
v34 = cocos2d::CCString::getCString(v33);
*(_OWORD *)Block = 0;
si128 = 0;
do
++v10;
while ( v34[v10] );
sub_14003A930(Block, v34, v10);
v35 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 400), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v36 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v36 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v36 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v36);
}
si128 = _mm_load_si128((const __m128i *)&xmmword_140623F30);
LOBYTE(Block[0]) = 0;
if ( (unsigned int)(*(_DWORD *)(v35 + 28) - 1) <= 1 )
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 672LL) + 992LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 320) + 672LL),
v35);
}
(*(void (__fastcall **)(_DWORD *, __int64))(*(_QWORD *)v20 + 64LL))(v20, 1);
cocos2d::CCNode::runAction(
*(CCLightFlash **)(*(_QWORD *)(a1 + 320) + 672LL),
(cocos2d::CCPoint)v20,
v37,
a4,
*(float *)&v41);
LABEL_51:
sub_14003A830((__int64)a2);
}