//
// OPENSSL_gmtime_adj from 0x81b170 to 0x81b3e4 (628 bytes)
//
// 6 xrefs:
// > ASN1_TIME_adj @ 0x7c10a8
// > asn1_utctime_to_tm @ 0x7c161c
// > ASN1_UTCTIME_adj @ 0x7c1828
// > asn1_generalizedtime_to_tm @ 0x860e1c
// > ASN1_GENERALIZEDTIME_adj @ 0x8610a4
// > ??> @ 0x5e41c
//
// 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 __fastcall OPENSSL_gmtime_adj(int *a1, int a2, int a3)
{
int v3; // r3
int v4; // r2
int v5; // r1
int v6; // r6
int v7; // r1
int v8; // lr
int v9; // kr04_4
int v10; // r3
int v11; // r1
int v12; // r1
int v13; // r3
int v14; // r7
int v15; // r5
unsigned int v16; // r3
v3 = a3 / 86400;
v4 = a3 % 86400 + 60 * a1[1] + 3600 * a1[2] + *a1;
v5 = a2 + v3;
if ( v4 <= 86399 )
{
if ( v4 < 0 )
{
v4 += 86400;
--v5;
}
}
else
{
v4 -= 86400;
++v5;
}
v6 = a1[4];
v7 = v5
+ 367 * (v6 - 1 + 12 * ((v6 - 13) / -12)) / 12
+ 1461 * (a1[5] + 6700 + (v6 - 13) / 12) / 4
- 3 * (((v6 - 13) / 12 + a1[5] + 6800) / 100) / 4
+ a1[3]
- 32075;
if ( v7 < 0 )
return 0;
v8 = v7 + 68569;
v9 = 4 * (v7 + 68569);
v10 = 146097 * (v9 / 146097);
v11 = v10 + 3;
if ( v10 + 3 < 0 )
v11 = v10 + 6;
v12 = v8 - (v11 >> 2);
v13 = (4000 * v12 + 4000) / 1461001;
v14 = v12 - 1461 * v13 / 4 + 31;
v15 = 80 * v14 / 2447;
v16 = v15 / 11 + v13 + 100 * (v9 / 146097 - 49) - 1900;
if ( v16 > 0x1FA3 )
return 0;
a1[4] = v15 - 12 * (v15 / 11) + 1;
a1[5] = v16;
*a1 = v4 % 60;
a1[1] = v4 / 60 % 60;
a1[2] = v4 / 3600;
a1[3] = v14 + 2447 * v15 / -80;
return 1;
}