//
// GameLevelManager::getTimeLeft from 0x6f2e18 to 0x6f2f88 (368 bytes)
//
// 11 xrefs:
// > InfoLayer::onComment @ 0x7e2090
// > InfoLayer::onRefreshComments @ 0x7e3690
// > AccountLayer::onSync @ 0x84a890
// > AccountLayer::onBackup @ 0x84ab58
// > MessagesProfilePage::onUpdate @ 0x8f1f78
// > FRequestProfilePage::onUpdate @ 0x8f4490
// > FriendsProfilePage::onUpdate @ 0x8f6a10
// > ProfilePage::onComment @ 0x8f8214
// > ProfilePage::onUpdate @ 0x8fdb78
// > LevelLeaderboard::onUpdate @ 0x932228
// > ??> @ 0xac848
//
// 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
//
int GameLevelManager::getTimeLeft(GameLevelManager *a1, const char *a2, float a3)
{
cocos2d::CCDictionary *m_timerDict; // x21
cocos2d::CCString *v5; // x21
char *v6; // x0
double v7; // d3
double v8; // d0
double v9; // d0
int result; // w0
unsigned int *v11; // x2
int v12; // w1
double v13; // [xsp+30h] [xbp+30h]
std::string v14[2]; // [xsp+58h] [xbp+58h] BYREF
m_timerDict = a1->m_timerDict;
sub_D153B8((int)v14, (char *)a2);
v5 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(m_timerDict, v14);
v6 = (char *)v14[0].m_data.m_data - 24;
if ( (__int64 *)v14[0].m_data.m_data - 3 != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)((char *)v14[0].m_data.m_data - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *((_DWORD *)v14[0].m_data.m_data - 2);
*((_DWORD *)v14[0].m_data.m_data - 2) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v6);
}
if ( !v5 )
return 0;
v13 = cocos2d::CCString::doubleValue(v5);
clock_gettime(0, (struct timespec *)v14);
v7 = a3;
v8 = (double)(__int64)v14[0].m_data.m_data + (double)(__int64)v14[1].m_data.m_data / 1000000000.0 - v13;
if ( v8 <= a3 )
v9 = v7 - v8;
else
v9 = 0.0;
result = 0;
if ( v9 <= v7 )
return (int)v9;
return result;
}