//
// LevelSearchLayer::toggleTime from 0x6d0adc to 0x6d0c74 (408 bytes)
//
// 3 xrefs:
// > ??> @ 0x941b8
// > LevelSearchLayer::init @ 0x6d2a00
// > ??> @ 0x122d110
//
// 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 LevelSearchLayer::toggleTime(LevelSearchLayer *a1, cocos2d::CCObject *a2)
{
int v3; // w21
_BOOL4 v4; // w19
cocos2d::CCDictionary *m_difficultyDict; // x25
cocos2d::CCObject *v6; // x24
char *TimeKey; // x0
void *v8; // x0
__int64 v9; // x0
char v10; // w2
void (__fastcall *v11)(__int64, __int64 *); // x3
GameLevelManager *v12; // x0
unsigned int *v13; // x2
int v14; // w1
__int64 v15; // [xsp+60h] [xbp+60h] BYREF
v3 = a2->getTag(a2);
v4 = !LevelSearchLayer::checkTime(a1, v3);
m_difficultyDict = a1->m_difficultyDict;
v6 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v4);
TimeKey = (char *)LevelSearchLayer::getTimeKey(a1, v3);
sub_D153B8((int)&v15, TimeKey);
cocos2d::CCDictionary::setObject((int)m_difficultyDict, v6);
v8 = (void *)(v15 - 24);
if ( (__int64 *)(v15 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v13 = (unsigned int *)(v15 - 8);
do
v14 = __ldaxr(v13);
while ( __stlxr(v14 - 1, v13) );
}
else
{
v14 = *(_DWORD *)(v15 - 8);
*(_DWORD *)(v15 - 8) = v14 - 1;
}
if ( v14 <= 0 )
operator delete(v8);
}
v9 = cocos2d::CCArray::objectAtIndex(a1->m_lengthSprites, v3);
v10 = -1;
if ( !v4 )
v10 = 125;
v11 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v9 + 1056LL);
LOBYTE(v15) = v10;
BYTE1(v15) = v10;
BYTE2(v15) = v10;
v11(v9, &v15);
v12 = GameLevelManager::sharedState();
GameLevelManager::setLenVal(v12, v3, v4);
}