//
// AnimatedShopKeeper::animationFinished from 0x92b60c to 0x92bf40 (2356 bytes)
//
// 2 xrefs:
// > ??> @ 0x74340
// > ??> @ 0x11b0548
//
// 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 AnimatedShopKeeper::animationFinished(AnimatedShopKeeper *a1, const char *a2)
{
int m_idleInt1; // w4
void *v4; // x3
_DWORD *v6; // x27
unsigned __int64 v7; // x19
size_t v8; // x2
int v9; // w26
__int64 v10; // x19
__int64 *v11; // x0
char *v12; // x0
unsigned __int64 v13; // x27
size_t v14; // x2
int v15; // w0
_DWORD *v16; // x5
int v17; // w0
_BOOL4 v18; // w27
char *v19; // x0
char *v20; // x0
_DWORD *v21; // x1
char *v22; // x0
size_t v23; // x2
int v24; // w0
_DWORD *v25; // x6
char *v26; // x0
_DWORD *v27; // x28
unsigned __int64 v28; // x24
unsigned __int64 v29; // x25
size_t v30; // x2
unsigned __int64 v31; // x24
char *v32; // x0
char *v33; // x0
char *v34; // x0
unsigned int *v35; // x3
int v36; // w1
unsigned int *v37; // x27
int v38; // w1
_DWORD *v39; // x1
char *v40; // x0
unsigned int *v41; // x1
int v42; // w2
unsigned int *v43; // x3
int v44; // w1
unsigned int *v45; // x5
int v46; // w1
unsigned int *v47; // x1
int v48; // w2
unsigned int *v49; // x4
int v50; // w1
unsigned int *v51; // x6
int v52; // w1
unsigned int *v53; // x1
int v54; // w0
unsigned int *v55; // x28
int v56; // w1
unsigned int *v57; // x1
int v58; // w3
unsigned int *v59; // x1
int v60; // w2
unsigned int *v61; // x1
unsigned __int64 v62; // [xsp+70h] [xbp+70h]
unsigned __int64 v63; // [xsp+78h] [xbp+78h]
__int64 v64; // [xsp+78h] [xbp+78h]
unsigned __int64 v65; // [xsp+80h] [xbp+80h]
char *v66; // [xsp+80h] [xbp+80h]
_DWORD *v67; // [xsp+80h] [xbp+80h]
_DWORD *v68; // [xsp+88h] [xbp+88h]
_DWORD *v69; // [xsp+88h] [xbp+88h]
_DWORD *v70; // [xsp+88h] [xbp+88h]
void *v71; // [xsp+A8h] [xbp+A8h] BYREF
void *v72[2]; // [xsp+B0h] [xbp+B0h] BYREF
m_idleInt1 = a1->m_idleInt1;
--a1->m_idleInt2;
v4 = (void *)_stack_chk_guard;
a1->m_idleInt1 = m_idleInt1 - 1;
v72[1] = v4;
sub_D153B8((int)&v71, (char *)a2);
sub_D153B8((int)v72, "react01");
v6 = v71;
v68 = v72[0];
v7 = *((_QWORD *)v71 - 3);
v65 = *((_QWORD *)v72[0] - 3);
if ( v65 > v7 )
v8 = *((_QWORD *)v71 - 3);
else
v8 = *((_QWORD *)v72[0] - 3);
v9 = memcmp(v71, v72[0], v8);
if ( v9 || (v9 = 0x7FFFFFFF, v10 = v7 - v65, v10 > 0x7FFFFFFF) )
{
v11 = (__int64 *)(v68 - 6);
if ( v68 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_7;
}
else
{
v11 = (__int64 *)(v68 - 6);
if ( v10 >= (__int64)0xFFFFFFFF80000000LL )
v9 = v10;
else
v9 = 0x80000000;
if ( v11 == &qword_124B6B0 )
{
LABEL_7:
v12 = (char *)(v6 - 6);
if ( v6 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_8;
goto LABEL_55;
}
}
if ( &pthread_create )
{
v35 = v68 - 2;
do
v36 = __ldaxr(v35);
while ( __stlxr(v36 - 1, v35) );
}
else
{
v36 = *(v68 - 2);
*(v68 - 2) = v36 - 1;
}
if ( v36 <= 0 )
operator delete(v11);
v6 = v71;
v12 = (char *)v71 - 24;
if ( (char *)v71 - 24 != (char *)&qword_124B6B0 )
{
LABEL_55:
if ( &pthread_create )
{
v37 = v6 - 2;
do
v38 = __ldaxr(v37);
while ( __stlxr(v38 - 1, v37) );
}
else
{
v38 = *(v6 - 2);
*(v6 - 2) = v38 - 1;
}
if ( v38 <= 0 )
operator delete(v12);
}
LABEL_8:
if ( !v9 )
a1->m_reacting = 0;
sub_D153B8((int)&v71, (char *)a2);
sub_D153B8((int)v72, "idle03");
v66 = (char *)v71;
v13 = *((_QWORD *)v71 - 3);
v69 = v72[0];
v63 = *((_QWORD *)v72[0] - 3);
if ( v63 > v13 )
v14 = *((_QWORD *)v71 - 3);
else
v14 = *((_QWORD *)v72[0] - 3);
v15 = memcmp(v71, v72[0], v14);
v16 = v66;
if ( !v15 )
{
v17 = v13 - v63;
if ( v13 - v63 + 0x80000000 <= 0xFFFFFFFF )
{
v18 = 0;
if ( !v17 )
{
v19 = (char *)(v69 - 6);
if ( v69 - 6 != (_DWORD *)&qword_124B6B0 )
goto LABEL_70;
LABEL_18:
v20 = v66 - 24;
if ( v66 - 24 == (char *)&qword_124B6B0 )
goto LABEL_19;
goto LABEL_76;
}
}
}
v18 = 0;
if ( a1->m_idleInt2 <= 0 )
v18 = a1->m_type != Diamond;
v19 = (char *)(v69 - 6);
if ( v69 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_18;
LABEL_70:
if ( &pthread_create )
{
v43 = v69 - 2;
do
v44 = __ldaxr(v43);
while ( __stlxr(v44 - 1, v43) );
}
else
{
v44 = *(v69 - 2);
*(v69 - 2) = v44 - 1;
}
if ( v44 <= 0 )
operator delete(v19);
v16 = v71;
v20 = (char *)v71 - 24;
if ( (char *)v71 - 24 != (char *)&qword_124B6B0 )
{
LABEL_76:
if ( &pthread_create )
{
v45 = v16 - 2;
do
v46 = __ldaxr(v45);
while ( __stlxr(v46 - 1, v45) );
}
else
{
v46 = *(v16 - 2);
*(v16 - 2) = v46 - 1;
}
if ( v46 <= 0 )
operator delete(v20);
}
LABEL_19:
if ( v18 )
{
a1->m_looking = 0;
a1->m_idleInt2 = (int)(float)((float)((float)((float)rand() * 4.6566e-10) * 5.0) + 10.0);
sub_D153B8((int)v72, "idle03");
CCAnimatedSprite::runAnimationForced((__int64)a1, (__int64)v72);
v21 = v72[0];
v22 = (char *)v72[0] - 24;
if ( (char *)v72[0] - 24 == (char *)&qword_124B6B0 )
return;
if ( &pthread_create )
{
v53 = (unsigned int *)((char *)v72[0] - 8);
do
v48 = __ldaxr(v53);
while ( __stlxr(v48 - 1, v53) );
goto LABEL_103;
}
LABEL_105:
v48 = *(v21 - 2);
*(v21 - 2) = v48 - 1;
LABEL_103:
if ( v48 <= 0 )
operator delete(v22);
return;
}
sub_D153B8((int)&v71, (char *)a2);
sub_D153B8((int)v72, "idle00");
v67 = v71;
v70 = v72[0];
v62 = *((_QWORD *)v71 - 3);
if ( *((_QWORD *)v72[0] - 3) > v62 )
v23 = *((_QWORD *)v71 - 3);
else
v23 = *((_QWORD *)v72[0] - 3);
v64 = *((_QWORD *)v72[0] - 3);
v24 = memcmp(v71, v72[0], v23);
v25 = v67;
if ( !v24 && v62 - v64 + 0x80000000 <= 0xFFFFFFFF && (_DWORD)v62 == (_DWORD)v64 )
v18 = a1->m_idleInt1 <= 0;
if ( v70 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v49 = v70 - 2;
do
v50 = __ldaxr(v49);
while ( __stlxr(v50 - 1, v49) );
}
else
{
v50 = *(v70 - 2);
*(v70 - 2) = v50 - 1;
}
if ( v50 <= 0 )
operator delete(v70 - 6);
v25 = v71;
}
v26 = (char *)(v25 - 6);
if ( v25 - 6 == (_DWORD *)&qword_124B6B0 )
goto LABEL_31;
if ( &pthread_create )
{
v51 = v25 - 2;
do
v52 = __ldaxr(v51);
while ( __stlxr(v52 - 1, v51) );
}
else
{
v52 = *(v25 - 2);
*(v25 - 2) = v52 - 1;
}
if ( v52 > 0 )
{
LABEL_31:
if ( v18 )
{
LABEL_60:
if ( (float)((float)rand() * 4.6566e-10) <= 0.9 || a1->m_type == Diamond )
{
sub_D153B8((int)v72, "idle02");
CCAnimatedSprite::runAnimationForced((__int64)a1, (__int64)v72);
v39 = v72[0];
v40 = (char *)v72[0] - 24;
if ( (char *)v72[0] - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v61 = (unsigned int *)((char *)v72[0] - 8);
do
v42 = __ldaxr(v61);
while ( __stlxr(v42 - 1, v61) );
LABEL_66:
if ( v42 <= 0 )
operator delete(v40);
goto LABEL_82;
}
LABEL_131:
v42 = *(v39 - 2);
*(v39 - 2) = v42 - 1;
goto LABEL_66;
}
}
else
{
sub_D153B8((int)v72, "idle01");
CCAnimatedSprite::runAnimationForced((__int64)a1, (__int64)v72);
v39 = v72[0];
v40 = (char *)v72[0] - 24;
if ( (char *)v72[0] - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v41 = (unsigned int *)((char *)v72[0] - 8);
do
v42 = __ldaxr(v41);
while ( __stlxr(v42 - 1, v41) );
goto LABEL_66;
}
goto LABEL_131;
}
}
LABEL_82:
a1->m_idleInt1 = (int)(float)((float)((float)((float)rand() * 4.6566e-10) * 3.0) + 2.0);
return;
}
}
else
{
operator delete(v26);
if ( v18 )
goto LABEL_60;
}
sub_D153B8((int)&v71, (char *)a2);
sub_D153B8((int)v72, "idle03");
v27 = v72[0];
v28 = *((_QWORD *)v71 - 3);
v29 = *((_QWORD *)v72[0] - 3);
if ( v29 > v28 )
v30 = *((_QWORD *)v71 - 3);
else
v30 = *((_QWORD *)v72[0] - 3);
if ( !memcmp(v71, v72[0], v30) )
{
v31 = v28 - v29;
if ( v31 + 0x80000000 <= 0xFFFFFFFF && !(_DWORD)v31 && !a1->m_looking )
{
v54 = rand();
v27 = v72[0];
v18 = (float)((float)v54 * 4.6566e-10) > 0.6;
}
}
v32 = (char *)(v27 - 6);
if ( v27 - 6 != (_DWORD *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v55 = v27 - 2;
do
v56 = __ldaxr(v55);
while ( __stlxr(v56 - 1, v55) );
}
else
{
v56 = *(v27 - 2);
*(v27 - 2) = v56 - 1;
}
if ( v56 <= 0 )
operator delete(v32);
}
v33 = (char *)v71 - 24;
if ( (char *)v71 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v57 = (unsigned int *)((char *)v71 - 8);
do
v58 = __ldaxr(v57);
while ( __stlxr(v58 - 1, v57) );
}
else
{
v58 = *((_DWORD *)v71 - 2);
*((_DWORD *)v71 - 2) = v58 - 1;
}
if ( v58 <= 0 )
operator delete(v33);
}
if ( !v18 )
{
sub_D153B8((int)v72, "idle00");
CCAnimatedSprite::runAnimationForced((__int64)a1, (__int64)v72);
v21 = v72[0];
v22 = (char *)v72[0] - 24;
if ( (char *)v72[0] - 24 == (char *)&qword_124B6B0 )
return;
if ( &pthread_create )
{
v47 = (unsigned int *)((char *)v72[0] - 8);
do
v48 = __ldaxr(v47);
while ( __stlxr(v48 - 1, v47) );
goto LABEL_103;
}
goto LABEL_105;
}
sub_D153B8((int)v72, "idle03");
CCAnimatedSprite::runAnimationForced((__int64)a1, (__int64)v72);
v34 = (char *)v72[0] - 24;
if ( (char *)v72[0] - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v59 = (unsigned int *)((char *)v72[0] - 8);
do
v60 = __ldaxr(v59);
while ( __stlxr(v60 - 1, v59) );
}
else
{
v60 = *((_DWORD *)v72[0] - 2);
*((_DWORD *)v72[0] - 2) = v60 - 1;
}
if ( v60 <= 0 )
operator delete(v34);
}
a1->m_looking = 1;
}