//
// LevelSearchLayer::toggleDifficultyNum from 0x6ceebc to 0x6cf034 (376 bytes)
//
// 10 xrefs:
// > LevelSearchLayer::toggleDifficulty @ 0x6cf154
// > LevelSearchLayer::toggleDifficulty @ 0x6cf23c
// > LevelSearchLayer::toggleDifficulty @ 0x6cf254
// > LevelSearchLayer::toggleDifficulty @ 0x6cf280
// > LevelSearchLayer::toggleDifficulty @ 0x6cf2a8
// > LevelSearchLayer::toggleDifficulty @ 0x6cf2c8
// > LevelSearchLayer::toggleDifficulty @ 0x6cf2d8
// > LevelSearchLayer::clearFilters @ 0x6d0e38
// > LevelSearchLayer::init @ 0x6d2bd0
// > ??> @ 0x7d640
//
// 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::toggleDifficultyNum(LevelSearchLayer *a1, int a2, bool a3)
{
_BOOL4 v3; // w20
cocos2d::CCDictionary *m_difficultyDict; // x25
cocos2d::CCObject *v7; // x24
char *DiffKey; // x0
void *v9; // x0
__int64 v10; // x0
char v11; // w2
void (__fastcall *v12)(__int64, __int64 *); // x3
GameLevelManager *v13; // x0
unsigned int *v14; // x2
int v15; // w1
__int64 v16; // [xsp+60h] [xbp+60h] BYREF
v3 = a3;
m_difficultyDict = a1->m_difficultyDict;
v7 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)a3);
DiffKey = (char *)LevelSearchLayer::getDiffKey(a1, a2);
sub_D153B8((int)&v16, DiffKey);
cocos2d::CCDictionary::setObject((int)m_difficultyDict, v7);
v9 = (void *)(v16 - 24);
if ( (__int64 *)(v16 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v14 = (unsigned int *)(v16 - 8);
do
v15 = __ldaxr(v14);
while ( __stlxr(v15 - 1, v14) );
}
else
{
v15 = *(_DWORD *)(v16 - 8);
*(_DWORD *)(v16 - 8) = v15 - 1;
}
if ( v15 <= 0 )
operator delete(v9);
}
v10 = cocos2d::CCArray::objectAtIndex(a1->m_difficultySprites, a2);
v11 = -1;
if ( !v3 )
v11 = 125;
v12 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v10 + 944LL);
LOBYTE(v16) = v11;
BYTE1(v16) = v11;
BYTE2(v16) = v11;
v12(v10, &v16);
v13 = GameLevelManager::sharedState();
GameLevelManager::setDiffVal(v13, a2, v3);
}