//
// LevelSearchLayer::toggleTime from 0x140312530 to 0x1403126dd (429 bytes)
//
// 2 xrefs:
// > LevelSearchLayer::init @ 0x14030d9dd
// > ??> @ 0x1406d4874
//
// 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
//
// Hidden C++ exception states: #wind=2
void LevelSearchLayer::toggleTime(LevelSearchLayer *a1, cocos2d::CCObject *a2)
{
int v3; // edi
_BOOL8 v4; // rbx
cocos2d::CCString *v5; // rax
const char *CString; // rax
size_t v7; // r8
struct cocos2d::CCString *v8; // rax
void *v9; // rcx
int *p_m_uIndexInArray; // rcx
void (__fastcall *v11)(int *, __int16 *); // r8
__int16 *v12; // rdx
GameLevelManager *v13; // rcx
__int16 v14; // [rsp+20h] [rbp-48h] BYREF
char v15; // [rsp+22h] [rbp-46h]
_WORD v16[2]; // [rsp+24h] [rbp-44h] BYREF
void *v17; // [rsp+28h] [rbp-40h]
void *Block[2]; // [rsp+30h] [rbp-38h] BYREF
__int64 v19; // [rsp+40h] [rbp-28h]
unsigned __int64 v20; // [rsp+48h] [rbp-20h]
v3 = a2->getTag(a2);
v4 = !LevelSearchLayer::checkTime(a1, v3);
v5 = cocos2d::CCString::createWithFormat("T%i", v3);
CString = cocos2d::CCString::getCString(v5);
*(_OWORD *)Block = 0;
v19 = 0;
v20 = 0;
v7 = -1;
do
++v7;
while ( CString[v7] );
sub_14003A930(Block, CString, v7);
v8 = cocos2d::CCString::createWithFormat("%i", v4);
cocos2d::CCDictionary::setObject(a1->m_difficultyDict, v8, Block);
if ( v20 > 0xF )
{
v9 = Block[0];
if ( v20 + 1 >= 0x1000 )
{
v9 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v9 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v9);
}
p_m_uIndexInArray = &cocos2d::CCArray::objectAtIndex(a1->m_lengthSprites, v3)[6].m_uIndexInArray;
v11 = **(void (__fastcall ***)(int *, __int16 *))p_m_uIndexInArray;
if ( v4 )
{
v14 = -1;
v15 = -1;
v12 = &v14;
}
else
{
v14 = 32125;
memset(v16, 125, 3);
v12 = v16;
}
v11(p_m_uIndexInArray, v12);
v13 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v17 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v13 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::setLenVal(v13, v3, v4);
}