//
// OPENSSL_gmtime_diff from 0xa30020 to 0xa302bc (668 bytes)
//
// 3 xrefs:
// > ASN1_TIME_diff @ 0x9d5f30
// > ASN1_UTCTIME_cmp_time_t @ 0x9d64d8
// > ??> @ 0x77f7c
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 12:08:04 +0000
//
int __fastcall OPENSSL_gmtime_diff(int *a1, int *a2, _DWORD *a3, _DWORD *a4)
{
int v4; // r6
int v5; // r7
int v6; // r5
int v7; // r2
int v8; // r5
bool v9; // cc
int v10; // r12
int v11; // r4
int v12; // r3
int v13; // r6
int v14; // r2
unsigned int v15; // r3
int v17; // [sp+4h] [bp-8h]
v4 = 60 * a3[1] + 3600 * a3[2] + *a3;
if ( v4 <= 86399 )
{
if ( v4 >= 0 )
{
v5 = 0;
}
else
{
v4 += 86400;
v5 = -1;
}
}
else
{
v4 -= 86400;
v5 = 1;
}
v6 = a3[4];
v7 = v5
+ 367 * (v6 - 1 + 12 * ((v6 - 13) / -12)) / 12
+ 1461 * (a3[5] + 6700 + (v6 - 13) / 12) / 4
- 3 * (((v6 - 13) / 12 + a3[5] + 6800) / 100) / 4
+ a3[3]
- 32075;
if ( v7 < 0 )
return 0;
v8 = 60 * a4[1] + 3600 * a4[2] + *a4;
if ( v8 > 86399 )
{
v8 -= 86400;
v17 = 1;
}
else
{
v9 = v8 < 0;
if ( v8 >= 0 )
{
v10 = 0;
}
else
{
v8 += 86016;
v10 = -1;
}
if ( v9 )
v8 += 384;
v17 = v10;
}
v11 = a4[4];
v12 = v17
+ 367 * (v11 - 1 + 12 * ((v11 - 13) / -12)) / 12
+ 1461 * (a4[5] + 6700 + (v11 - 13) / 12) / 4
- 3 * (((v11 - 13) / 12 + a4[5] + 6800) / 100) / 4
+ a4[3]
- 32075;
if ( v12 < 0 )
return 0;
v13 = v8 - v4;
v14 = v12 - v7;
if ( v14 > 0 )
v15 = (unsigned int)v13 >> 31;
else
v15 = 0;
if ( v15 )
{
v13 += 86400;
--v14;
}
else if ( ((v13 > 0) & ((unsigned int)v14 >> 31)) != 0 )
{
v13 -= 86400;
++v14;
}
if ( a1 )
*a1 = v14;
if ( a2 )
*a2 = v13;
return 1;
}