//
// OPENSSL_gmtime_diff from 0xdc0c50 to 0xdc0f10 (704 bytes)
//
// 3 xrefs:
// > ASN1_TIME_diff @ 0xd67b38
// > ASN1_UTCTIME_cmp_time_t @ 0xd68134
// > ??> @ 0x9a2c0
//
// 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
//
__int64 __fastcall OPENSSL_gmtime_diff(_DWORD *a1, int *a2, _DWORD *a3, _DWORD *a4)
{
int v4; // w10
__int64 v5; // x14
int v6; // w9
int v7; // w7
int v8; // w13
unsigned __int64 v9; // x9
__int64 v10; // x2
int v11; // w5
__int64 v12; // x16
int v13; // w9
__int64 v14; // x3
__int64 v15; // x2
int v16; // w10
v4 = 60 * a3[1] + 3600 * a3[2] + *a3;
if ( v4 <= 86399 )
{
v5 = 0;
if ( v4 < 0 )
{
v5 = -1;
v4 += 86400;
}
}
else
{
v5 = 1;
v4 -= 86400;
}
v6 = a3[4];
v7 = (v6 - 13) >> 31;
v8 = v6 - 1;
v9 = (unsigned __int64)(715827883LL * (v6 - 13)) >> 32;
v10 = v5
+ 367 * (v8 + 12 * (v7 - ((int)v9 >> 1))) / 12
+ 1461 * (a3[5] + 6700 + ((int)v9 >> 1) - v7) / 4
- 3 * ((((int)v9 >> 1) - v7 + a3[5] + 6800) / 100) / 4
+ a3[3]
- 32075;
if ( v10 < 0 )
return 0;
v11 = 60 * a4[1] + 3600 * a4[2] + *a4;
if ( v11 > 86399 )
{
v12 = 1;
v11 -= 86400;
}
else
{
v12 = 0;
if ( v11 < 0 )
{
v12 = -1;
v11 += 86400;
}
}
v13 = a4[4];
v14 = v12
+ 367 * (v13 - 1 + 12 * ((v13 - 13) / -12)) / 12
+ 1461 * (a4[5] + 6700 + (v13 - 13) / 12) / 4
- 3 * (((v13 - 13) / 12 + a4[5] + 6800) / 100) / 4
+ a4[3]
- 32075;
if ( v14 < 0 )
return 0;
v15 = v14 - v10;
v16 = v11 - v4;
if ( v15 > 0 && v16 < 0 )
{
LODWORD(v15) = v15 - 1;
v16 += 86400;
}
else if ( v15 < 0 && v16 > 0 )
{
LODWORD(v15) = v15 + 1;
v16 -= 86400;
}
if ( a1 )
*a1 = v15;
if ( a2 )
*a2 = v16;
return 1;
}