//
// GJBaseGameLayer::updateSpecialLabels from 0x87a890 to 0x87acdc (1100 bytes)
//
// 3 xrefs:
// > GJBaseGameLayer::resetLevelVariables @ 0x88aaa0
// > GJBaseGameLayer::update @ 0x89e854
// > ??> @ 0x85920
//
// 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::updateSpecialLabels(GJBaseGameLayer *a1)
{
char **p_m_labelObjects; // x25
GameToolbox *m_points; // x0
void *v4; // x0
char *v5; // x0
__int64 *v6; // x22
__int64 *v7; // x19
__int64 v8; // x20
void *v9; // x0
unsigned int *v10; // x1
int v11; // w2
void *v12; // x20
char *v13; // x0
__int64 *v14; // x19
__int64 *v15; // x22
__int64 v16; // x20
void *v17; // x0
unsigned int *v18; // x1
int v19; // w2
void *v20; // x0
unsigned int *v21; // x2
int v22; // w1
unsigned int *v23; // x19
int v24; // w0
unsigned int *v25; // x1
int v26; // w2
__int64 v27; // [xsp+78h] [xbp+78h] BYREF
__int64 v28; // [xsp+80h] [xbp+80h] BYREF
p_m_labelObjects = (char **)&a1->m_labelObjects;
GJBaseGameLayer::updatePlatformerTime(a1);
if ( sub_856164(p_m_labelObjects, -2) )
{
m_points = (GameToolbox *)(unsigned int)a1->m_gameState.m_points;
if ( (_DWORD)m_points != a1->m_points )
{
a1->m_points = (int)m_points;
GameToolbox::pointsToString(m_points, &v28);
sub_D163D4(&a1->m_pointsString, &v28);
v4 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v25 = (unsigned int *)(v28 - 8);
do
v26 = __ldaxr(v25);
while ( __stlxr(v26 - 1, v25) );
}
else
{
v26 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v26 - 1;
}
if ( v26 <= 0 )
operator delete(v4);
}
}
sub_D18D28(&v27);
LODWORD(v28) = -2;
v5 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
p_m_labelObjects,
(int *)&v28);
v6 = *((__int64 **)v5 + 1);
v7 = *(__int64 **)v5;
if ( *(__int64 **)v5 != v6 )
{
do
{
while ( 1 )
{
v8 = *v7;
if ( *(_BYTE *)(*v7 + 773) )
{
sub_D18D28(&v28);
LabelGameObject::updateLabel(v8, &v28);
v9 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v10 = (unsigned int *)(v28 - 8);
do
v11 = __ldaxr(v10);
while ( __stlxr(v11 - 1, v10) );
}
else
{
v11 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v11 - 1;
}
if ( v11 <= 0 )
break;
}
}
if ( v6 == ++v7 )
goto LABEL_14;
}
++v7;
operator delete(v9);
}
while ( v6 != v7 );
}
LABEL_14:
v12 = (void *)(v27 - 24);
if ( (__int64 *)(v27 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v23 = (unsigned int *)(v27 - 8);
do
v24 = __ldaxr(v23);
while ( __stlxr(v24 - 1, v23) );
}
else
{
v24 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v24 - 1;
}
if ( v24 <= 0 )
operator delete(v12);
}
}
if ( sub_856164(p_m_labelObjects, -3) )
{
GameToolbox::intToString(&v27, (GameToolbox *)(unsigned int)a1->m_attempts);
LODWORD(v28) = -3;
v13 = std::__detail::_Map_base>,std::allocator>>,std::__detail::_Select1st,std::equal_to,std::hash,std::__detail::_Mod_range_hashing,std::__detail::_Default_ranged_hash,std::__detail::_Prime_rehash_policy,std::__detail::_Hashtable_traits,true>::operator[](
p_m_labelObjects,
(int *)&v28);
v14 = *(__int64 **)v13;
v15 = *((__int64 **)v13 + 1);
if ( *(__int64 **)v13 != v15 )
{
do
{
v16 = *v14;
if ( *(_BYTE *)(*v14 + 773) )
{
sub_D18D28(&v28);
LabelGameObject::updateLabel(v16, &v28);
v17 = (void *)(v28 - 24);
if ( (__int64 *)(v28 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v28 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v28 - 8);
*(_DWORD *)(v28 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v17);
}
}
++v14;
}
while ( v15 != v14 );
}
v20 = (void *)(v27 - 24);
if ( (__int64 *)(v27 - 24) != &qword_124B6B0 )
{
v21 = (unsigned int *)(v27 - 8);
if ( &pthread_create )
{
do
v22 = __ldaxr(v21);
while ( __stlxr(v22 - 1, v21) );
}
else
{
v22 = *(_DWORD *)(v27 - 8);
*(_DWORD *)(v27 - 8) = v22 - 1;
}
if ( v22 <= 0 )
operator delete(v20);
}
}
}