//
// GJBaseGameLayer::refreshCounterLabels from 0x890200 to 0x8904a8 (680 bytes)
//
// 2 xrefs:
// > PlayLayer::resetLevel @ 0x5e56c8
// > ??> @ 0x5b560
//
// 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 GJBaseGameLayer::refreshCounterLabels(GJBaseGameLayer *a1)
{
std::__detail::_Hash_node_base *i; // x27
int M_nxt; // w1
GJEffectManager *m_effectManager; // x0
size_t v4; // x19
size_t v5; // x0
__int64 *v6; // x24
__int64 *j; // x19
__int64 v8; // x21
void *v9; // x0
unsigned int *v10; // x1
int v11; // w2
char *v12; // x0
unsigned int *v13; // x1
int v14; // w2
const char *v16; // [xsp+70h] [xbp+70h]
unsigned int v17; // [xsp+90h] [xbp+90h]
char *v18; // [xsp+98h] [xbp+98h] BYREF
__int64 v19; // [xsp+A0h] [xbp+A0h] BYREF
size_t v20; // [xsp+A8h] [xbp+A8h] BYREF
unsigned __int64 v21; // [xsp+B0h] [xbp+B0h]
char *v22; // [xsp+B8h] [xbp+B8h]
_BYTE v23[504]; // [xsp+C0h] [xbp+C0h] BYREF
for ( i = a1->m_labelObjects._M_h._M_before_begin._M_nxt; i; i = i->_M_nxt )
{
M_nxt = (int)i[1]._M_nxt;
v18 = &byte_124B6C8;
m_effectManager = a1->m_effectManager;
v20 = 0;
v21 = 500;
v22 = v23;
v17 = GJEffectManager::countForItem(m_effectManager, M_nxt);
fmt::BasicWriter::FormatInt,char>>(&v20, v17);
v4 = v20;
if ( v20 + 1 > v21 )
fmt::internal::Array::grow(&v20, v20 + 1);
v22[v4] = 0;
v16 = v22;
v5 = strlen(v22);
sub_D1798C(&v18, v16, v5);
v6 = (__int64 *)i[3]._M_nxt;
for ( j = (__int64 *)i[2]._M_nxt; v6 != j; ++j )
{
while ( 1 )
{
v8 = *j;
sub_D153B8((int)&v19, v18);
LabelGameObject::updateLabel(v8, &v19);
v9 = (void *)(v19 - 24);
if ( (__int64 *)(v19 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v19 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v19 - 8);
*(_DWORD *)(v19 - 8) = v11 - 1;
}
if ( v11 <= 0 )
break;
}
if ( v6 == ++j )
goto LABEL_13;
}
operator delete(v9);
}
LABEL_13:
if ( v22 != v23 && v22 )
operator delete[](v22);
v12 = v18 - 24;
if ( v18 - 24 != (char *)&qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v18 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *((_DWORD *)v18 - 2);
*((_DWORD *)v18 - 2) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v12);
}
}
}