//
// SpriteAnimationManager::executeAnimation from 0x1008029d0 to 0x100802d8f (959 bytes)
//
// 2 xrefs:
// > SpriteAnimationManager::runAnimation @ 0x100802768
// > SpriteAnimationManager::runQueuedAnimation @ 0x100802f9f
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 12:36:38 +0000
//
int __fastcall SpriteAnimationManager::executeAnimation(__int64 a1, std::string *a2, __m128 a3)
{
unsigned int v5; // r14d
unsigned int v6; // r13d
size_t v7; // r13
const void *v8; // rdi
char *data; // r12
size_t size; // r14
std::string::pointer v11; // rsi
size_t v12; // rdx
int result; // eax
_DWORD *v14; // r14
bool v15; // zf
void *v16; // rax
int v17; // r15d
void *v18; // rax
int v19; // r13d
unsigned int v20; // r13d
unsigned __int64 v21; // rax
std::string::pointer v22; // rdi
size_t v23; // rdx
int v24; // eax
__int64 v25; // r13
__int64 v26; // rax
char *CString; // r15
size_t v28; // rax
size_t v29; // r12
char *v30; // r15
size_t v31; // r13
__int64 v32; // r15
char v33; // [rsp+0h] [rbp-B0h]
__int64 v34; // [rsp+8h] [rbp-A8h]
__int128 v35; // [rsp+10h] [rbp-A0h] BYREF
void *__p; // [rsp+20h] [rbp-90h]
__int128 v37; // [rsp+30h] [rbp-80h] BYREF
void *v38; // [rsp+40h] [rbp-70h]
__int128 v39; // [rsp+50h] [rbp-60h] BYREF
void *v40; // [rsp+60h] [rbp-50h]
_QWORD __s2[2]; // [rsp+68h] [rbp-48h] BYREF
void *v42; // [rsp+78h] [rbp-38h]
void *__src; // [rsp+80h] [rbp-30h]
v5 = (unsigned int)a2->__r_.__value_.__l.0;
v6 = *(unsigned __int8 *)(a1 + 400);
if ( (v6 & 1) != 0 )
{
v7 = *(_QWORD *)(a1 + 408);
v8 = *(const void **)(a1 + 416);
data = a2->__r_.__value_.__s.__data_;
if ( (v5 & 1) == 0 )
{
LABEL_3:
size = v5 >> 1;
v11 = data;
goto LABEL_6;
}
}
else
{
v7 = v6 >> 1;
v8 = (const void *)(a1 + 401);
data = a2->__r_.__value_.__s.__data_;
if ( (v5 & 1) == 0 )
goto LABEL_3;
}
size = a2->__r_.__value_.__l.__size_;
v11 = a2->__r_.__value_.__l.__data_;
LABEL_6:
v12 = v7;
if ( size < v7 )
v12 = size;
result = memcmp(v8, v11, v12);
if ( result || size != v7 )
{
cocos2d::CCNode::stopAllActions(*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL));
std::string::operator=((std::string *)(a1 + 400), a2);
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(&v35, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
}
else
{
__p = a2->__r_.__value_.__l.__data_;
a3 = *(__m128 *)&a2->__r_.__value_.__l.0;
v35 = *(_OWORD *)&a2->__r_.__value_.__l.0;
}
SpriteAnimationManager::playSoundForAnimation(a1, (char *)&v35, *(double *)a3.i64);
if ( (v35 & 1) != 0 )
operator delete(__p);
v14 = (_DWORD *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 392), (char *)a2);
if ( v14[7] )
{
if ( (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) != 0 )
{
sub_10001AD30(&v39, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
}
else
{
v40 = a2->__r_.__value_.__l.__data_;
v39 = *(_OWORD *)&a2->__r_.__value_.__l.0;
}
v16 = cocos2d::CCDictionary::valueForKey(*(_QWORD *)(a1 + 336), (__int64)&v39);
v17 = cocos2d::CCString::intValue(v16);
if ( (v39 & 1) != 0 )
operator delete(v40);
CCAnimatedSprite::willPlayAnimation(*(std::string **)(a1 + 320));
CCAnimatedSprite::switchToMode(*(_QWORD *)(a1 + 320), v17);
return (*(__int64 (__fastcall **)(_QWORD, _DWORD *))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 656LL) + 1160LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL),
v14);
}
v15 = (*(_BYTE *)&a2->__r_.__value_.__s.0 & 1) == 0;
LODWORD(__src) = *(_DWORD *)(*(_QWORD *)(a1 + 320) + 680LL);
if ( v15 )
{
v38 = a2->__r_.__value_.__l.__data_;
v37 = *(_OWORD *)&a2->__r_.__value_.__l.0;
}
else
{
sub_10001AD30(&v37, a2->__r_.__value_.__l.__data_, a2->__r_.__value_.__l.__size_);
}
v18 = cocos2d::CCDictionary::valueForKey(*(_QWORD *)(a1 + 336), (__int64)&v37);
v19 = cocos2d::CCString::intValue(v18);
if ( (v37 & 1) != 0 )
operator delete(v38);
CCAnimatedSprite::willPlayAnimation(*(std::string **)(a1 + 320));
CCAnimatedSprite::switchToMode(*(_QWORD *)(a1 + 320), v19);
v20 = (unsigned int)a2->__r_.__value_.__l.0;
if ( (_DWORD)__src == *(_DWORD *)(*(_QWORD *)(a1 + 320) + 680LL) )
{
*(_DWORD *)((char *)__s2 + 1) = 2002874483;
*(_WORD *)((char *)__s2 + 5) = 110;
v21 = v20 >> 1;
v22 = a2->__r_.__value_.__l.__data_;
if ( (v20 & 1) != 0 )
v21 = a2->__r_.__value_.__l.__size_;
else
v22 = data;
v23 = 5;
if ( v21 < 5 )
v23 = v21;
LOBYTE(__src) = v21 != 5;
v24 = memcmp(v22, (char *)__s2 + 1, v23);
if ( (unsigned __int8)__src | (v24 != 0) )
{
LABEL_46:
(*(void (__fastcall **)(_DWORD *, __int64))(*(_QWORD *)v14 + 72LL))(v14, 1);
return cocos2d::CCNode::runAction(*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL), (__int64)v14);
}
}
v25 = *(_QWORD *)(a1 + 392);
v26 = sub_10088E820("%s_first", v33);
CString = (char *)cocos2d::CCString::getCString(v26);
v28 = strlen(CString);
if ( v28 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100003630();
v29 = v28;
__src = CString;
if ( v28 >= 0x17 )
{
v34 = v25;
v31 = 26;
if ( (v28 | 7) != 0x17 )
v31 = (v28 | 7) + 1;
v30 = (char *)operator new(v31);
v42 = v30;
__s2[0] = v31 + 1;
v25 = v34;
__s2[1] = v29;
}
else
{
LOBYTE(__s2[0]) = 2 * v28;
v30 = (char *)__s2 + 1;
if ( !v28 )
goto LABEL_42;
}
memmove(v30, __src, v29);
LABEL_42:
v30[v29] = 0;
v32 = cocos2d::CCDictionary::objectForKey(v25, (char *)__s2);
if ( (__s2[0] & 1) != 0 )
operator delete(v42);
if ( (unsigned int)(*(_DWORD *)(v32 + 28) - 1) <= 1 )
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)(*(_QWORD *)(a1 + 320) + 656LL) + 1160LL))(
*(_QWORD *)(*(_QWORD *)(a1 + 320) + 656LL),
v32);
goto LABEL_46;
}
return result;
}