//
// SecretRewardsLayer::updateUnlockedGoldLabel from 0x1403d7aa0 to 0x1403d7c14 (372 bytes)
//
// 3 xrefs:
// > SecretRewardsLayer::init @ 0x1403d3ffe
// > SecretRewardsLayer::onGoldChest @ 0x1403d76f1
// > ??> @ 0x1406d7dcc
//
// 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=2
void SecretRewardsLayer::updateUnlockedGoldLabel(SecretRewardsLayer *a1)
{
__int64 v2; // r8
int v3; // edi
int v4; // esi
__int64 v5; // rax
__int64 v6; // rax
__int64 i; // rdx
int v8; // ecx
__int64 v9; // rax
__int64 v10; // rax
__int64 j; // rdx
int v12; // ecx
void (__fastcall **v13)(unsigned int *, const char *); // rbx
cocos2d::CCString *v14; // rax
const char *CString; // rax
cocos2d::CCSpriteBatchNode **p_m_pobBatchNode; // rcx
void *v17; // [rsp+30h] [rbp+8h] BYREF
v2 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v17 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v2 = qword_1406C2EE8;
}
v3 = 0;
v4 = 0;
v5 = *(_QWORD *)(v2 + 856);
if ( v5 )
{
v6 = *(_QWORD *)(v5 + 56);
if ( v6 )
{
for ( i = *(_QWORD *)(v6 + 288); ; i = *(_QWORD *)(i + 288) )
{
v8 = v4++;
if ( *(_DWORD *)(*(_QWORD *)(v6 + 264) + 64LL) != 9 )
v4 = v8;
v6 = i;
if ( !i )
break;
}
}
}
v9 = *(_QWORD *)(v2 + 352);
if ( v9 )
{
v10 = *(_QWORD *)(v9 + 56);
if ( v10 )
{
for ( j = *(_QWORD *)(v10 + 288); ; j = *(_QWORD *)(j + 288) )
{
v12 = v3++;
if ( *(_DWORD *)(*(_QWORD *)(v10 + 264) + 64LL) != 9 )
v3 = v12;
v10 = j;
if ( !j )
break;
}
}
}
v13 = *(void (__fastcall ***)(unsigned int *, const char *))&a1->m_goldPriceSprite->m_uAtlasIndex;
v14 = cocos2d::CCString::createWithFormat("%i / %i", v4, v3);
CString = cocos2d::CCString::getCString(v14);
(*v13)(&a1->m_goldPriceSprite->m_uAtlasIndex, CString);
p_m_pobBatchNode = &a1->m_goldPriceSprite->m_pobBatchNode;
if ( v4 < v3 )
{
qmemcpy(&v17, "dWp", 3);
}
else
{
LOWORD(v17) = -206;
BYTE2(v17) = 50;
}
((void (__fastcall *)(cocos2d::CCSpriteBatchNode **, void **))(*p_m_pobBatchNode)->cocos2d::CCNode::cocos2d::CCObject::cocos2d::CCCopying::__vftable)(
p_m_pobBatchNode,
&v17);
}