//
// GameLevelManager::getTimeLeft from 0x100538ba0 to 0x100538cd7 (311 bytes)
//
// 10 xrefs:
// > AccountLayer::onBackup @ 0x1000cc567
// > AccountLayer::onSync @ 0x1000cc829
// > MessagesProfilePage::onUpdate @ 0x10022e8a0
// > LevelLeaderboard::onUpdate @ 0x1003db463
// > FriendsProfilePage::onUpdate @ 0x100658440
// > FRequestProfilePage::onUpdate @ 0x100790d50
// > InfoLayer::onComment @ 0x1007b0972
// > InfoLayer::onRefreshComments @ 0x1007b1df0
// > ProfilePage::onUpdate @ 0x1007b9779
// > ProfilePage::onComment @ 0x1007be7f8
//
// 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
//
// local variable allocation has failed, the output may be wrong!
int __fastcall GameLevelManager::getTimeLeft(GameLevelManager *a1, const char *a2, float a3)
{
cocos2d::CCDictionary *m_timerDict; // rbx
size_t v4; // rax
size_t v5; // r15
char *v6; // r12
size_t v7; // r13
cocos2d::CCString *v8; // rbx
__m128d v9; // xmm0
__m128d v10; // xmm1
double v12; // [rsp+0h] [rbp-50h]
timeb __dst; // [rsp+10h] [rbp-40h] BYREF
void *__p; // [rsp+20h] [rbp-30h]
m_timerDict = a1->m_timerDict;
v4 = strlen(a2);
if ( v4 >= 0xFFFFFFFFFFFFFFF8LL )
sub_100006BF0(*(double *)&a3);
v5 = v4;
if ( v4 >= 0x17 )
{
v7 = 26;
if ( (v4 | 7) != 0x17 )
v7 = (v4 | 7) + 1;
v6 = (char *)operator new(v7);
__p = v6;
__dst.time = v7 + 1;
*(_QWORD *)&__dst.millitm = v5;
goto LABEL_8;
}
LOBYTE(__dst.time) = 2 * v4;
v6 = (char *)&__dst.time + 1;
if ( v4 )
LABEL_8:
memcpy(v6, a2, v5);
v6[v5] = 0;
v8 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey_1((__int64)m_timerDict, (char *)&__dst);
if ( (__dst.time & 1) != 0 )
operator delete(__p);
if ( !v8 )
return 0;
v12 = cocos2d::CCString::doubleValue(v8);
ftime(&__dst);
v9 = 0;
v9.f64[0] = (double)(__dst.millitm + 1000 * (__dst.time & 0xFFFFF)) / 1000.0 - v12;
v10 = (__m128d)LODWORD(a3);
v10.f64[0] = a3;
*(_QWORD *)&v9.f64[0] = ~(unsigned __int64)_mm_cmpgt_sd(v9, v10) & COERCE_UNSIGNED_INT64(a3 - v9.f64[0]);
return (int)COERCE_DOUBLE(~(unsigned __int64)_mm_cmplt_sd(v10, v9) & *(_QWORD *)&v9.f64[0]);
}