//
// GJBaseGameLayer::resetGroupCounters from 0x8659b0 to 0x865c14 (612 bytes)
//
// 4 xrefs:
// > LevelEditorLayer::onStopPlaytest @ 0x662a88
// > LevelEditorLayer::onPlaytest @ 0x66433c
// > LevelEditorLayer::init @ 0x67cad8
// > ??> @ 0xb1fc0
//
// 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::resetGroupCounters(GJBaseGameLayer *a1, bool a2)
{
std::__detail::_Hash_node_base *M_nxt; // x26
_BOOL4 i; // w20
__int64 *v4; // x22
__int64 *j; // x19
void *v6; // x0
__int64 v7; // x28
LabelGameObject *v8; // x0
std::__detail::_Hash_node_base *k; // x26
__int64 *v10; // x22
__int64 *m; // x19
char *v12; // x1
void *v13; // x0
__int64 v14; // x28
LabelGameObject *v15; // x0
unsigned int *v16; // x1
int v17; // w2
unsigned int *v18; // x1
int v19; // w2
__int64 v21; // [xsp+80h] [xbp+80h] BYREF
M_nxt = a1->m_labelObjects._M_h._M_before_begin._M_nxt;
for ( i = a2; M_nxt; M_nxt = M_nxt->_M_nxt )
{
v4 = (__int64 *)M_nxt[3]._M_nxt;
for ( j = (__int64 *)M_nxt[2]._M_nxt; v4 != j; ++j )
{
while ( 1 )
{
v7 = *j;
if ( i )
break;
v8 = (LabelGameObject *)*j++;
LabelGameObject::updatePreviewLabel(v8);
if ( v4 == j )
goto LABEL_8;
}
sub_D153B8((int)&v21, "0");
LabelGameObject::updateLabel(v7, &v21);
v6 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v16 = (unsigned int *)(v21 - 8);
do
v17 = __ldaxr(v16);
while ( __stlxr(v17 - 1, v16) );
}
else
{
v17 = *(_DWORD *)(v21 - 8);
*(_DWORD *)(v21 - 8) = v17 - 1;
}
if ( v17 <= 0 )
operator delete(v6);
}
}
LABEL_8:
;
}
for ( k = a1->m_timeLabelObjects._M_h._M_before_begin._M_nxt; k; k = k->_M_nxt )
{
v10 = (__int64 *)k[3]._M_nxt;
for ( m = (__int64 *)k[2]._M_nxt; v10 != m; ++m )
{
while ( 1 )
{
v14 = *m;
if ( i )
break;
v15 = (LabelGameObject *)*m++;
LabelGameObject::updatePreviewLabel(v15);
if ( v10 == m )
goto LABEL_18;
}
v12 = "0";
if ( !*(_BYTE *)(v14 + 1856) )
v12 = "0.00";
sub_D153B8((int)&v21, v12);
LabelGameObject::updateLabel(v14, &v21);
v13 = (void *)(v21 - 24);
if ( (__int64 *)(v21 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v18 = (unsigned int *)(v21 - 8);
do
v19 = __ldaxr(v18);
while ( __stlxr(v19 - 1, v18) );
}
else
{
v19 = *(_DWORD *)(v21 - 8);
*(_DWORD *)(v21 - 8) = v19 - 1;
}
if ( v19 <= 0 )
operator delete(v13);
}
}
LABEL_18:
;
}
}