//
// GameLevelManager::getTimeLeft from 0x140221e90 to 0x140221fee (350 bytes)
//
// 17 xrefs:
// > AccountLayer::onBackup @ 0x14009384e
// > AccountLayer::onSync @ 0x140093ad3
// > MessageThreadsPage::onRefresh @ 0x1400d81cd
// > ThreadViewPopup::onRefresh @ 0x1400db5fa
// > ThreadViewPopup::onLoadEarlier @ 0x1400db7d1
// > LevelPickerPopup::doPageRequest @ 0x1400ea1f6
// > ThreadSearchPopup::onSearch @ 0x1400fc349
// > FRequestProfilePage::onUpdate @ 0x140210f25
// > FriendsProfilePage::onUpdate @ 0x140216eda
// > InfoLayer::onRefreshComments @ 0x1403d038f
// > InfoLayer::onComment @ 0x1403d0a94
// > LevelLeaderboard::onUpdate @ 0x14042a473
// > MessagesProfilePage::onUpdate @ 0x1404765c6
// > NotificationsPage::onUpdate @ 0x140478676
// > ProfilePage::onUpdate @ 0x140551ce3
// > ProfilePage::onComment @ 0x140556cbe
// > ??> @ 0x14091bc14
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:28:25 +0000
//
// Hidden C++ exception states: #wind=1
__int64 __fastcall GameLevelManager::getTimeLeft(__int64 a1, _BYTE *a2, float a3)
{
size_t v5; // r8
cocos2d::CCString *v6; // rbx
void *v7; // r8
double v9; // xmm0_8
double v10; // xmm2_8
double v11; // xmm0_8
double v12; // xmm1_8
void *Block[2]; // [rsp+30h] [rbp-58h] BYREF
__m128i si128; // [rsp+40h] [rbp-48h]
*(_OWORD *)Block = 0;
si128 = 0;
v5 = -1;
do
++v5;
while ( a2[v5] );
sub_14003D230(Block, a2, v5);
v6 = (cocos2d::CCString *)cocos2d::CCDictionary::objectForKey(*(_QWORD *)(a1 + 1056), Block);
if ( si128.m128i_i64[1] > 0xFuLL )
{
v7 = Block[0];
if ( (unsigned __int64)(si128.m128i_i64[1] + 1) >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v7);
}
si128 = _mm_load_si128((const __m128i *)&Size);
LOBYTE(Block[0]) = 0;
if ( !v6 )
return 0;
v9 = cocos2d::CCString::doubleValue(v6);
ftime64((struct __timeb64 *)Block);
v10 = (double)LOWORD(Block[1]) / 1000.0 + (double)SLODWORD(Block[0]) - v9;
v11 = 0.0;
v12 = a3;
if ( a3 >= v10 )
v11 = v12 - v10;
if ( v11 > v12 )
v11 = 0.0;
return (unsigned int)(int)v11;
}