//
// sub_10065FC1C from 0x10065fc1c to 0x10065fcf4 (216 bytes)
//
// 3 xrefs:
// > sub_10065FA54 @ 0x10065faa8
// > sub_10065FCF4 @ 0x10065fd0c
// > sub_10065FEFC @ 0x10065ff0c
//
// This function is hookable on this platform (idp: arm, 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:10:57 +0000
//
_QWORD *__fastcall sub_10065FC1C(__int64 a1, _QWORD *a2)
{
__int64 v4; // x8
__int64 v5; // x9
__darwin_time_t v6; // x10
__darwin_time_t tv_sec; // x8
__darwin_suseconds_t tv_usec; // w10
__darwin_time_t v9; // x9
int v10; // w8
timeval v12; // [xsp+0h] [xbp-20h] BYREF
v4 = *(_QWORD *)(a1 + 136);
if ( !*(_QWORD *)(v4 + 848) && !*(_DWORD *)(v4 + 856) )
return nullptr;
gettimeofday(&v12, nullptr);
v5 = *(_QWORD *)(a1 + 136);
v6 = *(_QWORD *)(v5 + 848);
tv_sec = v12.tv_sec;
if ( v6 < v12.tv_sec )
goto LABEL_11;
if ( v6 == v12.tv_sec )
{
tv_usec = v12.tv_usec;
if ( *(_DWORD *)(v5 + 856) <= v12.tv_usec )
{
LABEL_11:
a2[1] = 0;
*a2 = 0;
return a2;
}
}
else
{
tv_usec = v12.tv_usec;
}
*(_OWORD *)a2 = *(_OWORD *)(v5 + 848);
v9 = *a2 - tv_sec;
*a2 = v9;
v10 = *((_DWORD *)a2 + 2) - tv_usec;
*((_DWORD *)a2 + 2) = v10;
if ( v10 < 0 )
{
*a2 = --v9;
v10 += 1000000;
*((_DWORD *)a2 + 2) = v10;
}
if ( !v9 && v10 <= 14999 )
goto LABEL_11;
return a2;
}