//
// asn1_generalizedtime_to_tm from 0x1086ee4 to 0x10871d0 (748 bytes)
//
// 4 xrefs:
// > ASN1_TIME_diff @ 0xfe5e50
// > ASN1_TIME_diff @ 0xfe5e80
// > ASN1_GENERALIZEDTIME_check @ 0x10871d8
// > ??> @ 0x7e598
//
// 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 13:17:13 +0000
//
bool __fastcall asn1_generalizedtime_to_tm(int *a1, __int64 a2)
{
int v3; // w20
__int64 v4; // x11
__int64 v5; // x2
unsigned __int8 *v6; // x3
int v7; // w6
int v8; // w19
int v9; // w7
int v10; // w1
int v11; // w4
int v12; // w4
int v13; // w1
int v14; // w4
int v15; // w2
int v16; // w5
int v17; // w1
int v18; // w1
int v19; // w5
int v20; // w3
int v21; // w4
_BYTE *v22; // x3
int v23; // t1
if ( *(_DWORD *)(a2 + 4) != 24 )
return 0;
v3 = *(_DWORD *)a2;
v4 = *(_QWORD *)(a2 + 8);
if ( *(int *)a2 <= 12 )
return 0;
v5 = 0;
v6 = *(unsigned __int8 **)(a2 + 8);
v7 = 1;
v8 = 0;
while ( 1 )
{
if ( v5 == 6 )
{
v12 = *v6;
if ( (((_BYTE)v12 - 43) & 0xFD) == 0 || v12 == 90 )
break;
}
if ( (unsigned __int8)(*v6 - 48) > 9u )
return 0;
if ( v3 < v8 + 1 )
return 0;
v9 = v6[1];
if ( (unsigned __int8)(v9 - 48) > 9u )
return 0;
v8 += 2;
v10 = v9 + 10 * (*v6 - 48);
v11 = v10 - 48;
if ( v3 < v8 || v11 < dword_1214890[v5] || v11 > dword_1214890[v5 + 12] )
return 0;
if ( a1 )
{
switch ( (int)v5 )
{
case 1:
a1[5] += v11;
goto LABEL_16;
case 2:
a1[4] = v10 - 49;
goto LABEL_16;
case 3:
a1[3] = v11;
goto LABEL_16;
case 4:
a1[2] = v11;
goto LABEL_16;
case 5:
a1[1] = v11;
goto LABEL_16;
case 6:
*a1 = v11;
goto LABEL_27;
default:
a1[5] = 100 * v11 - 1900;
break;
}
}
if ( v7 == 7 )
goto LABEL_27;
LABEL_16:
++v5;
++v7;
v6 += 2;
}
if ( a1 )
*a1 = 0;
LABEL_27:
v13 = *(unsigned __int8 *)(v4 + v8);
if ( v13 == 46 )
{
v21 = v8 + 1;
if ( v3 < v8 + 1 )
return 0;
v22 = (_BYTE *)(v4 + v21);
if ( (unsigned __int8)(*v22 - 48) > 9u )
return 0;
++v8;
do
{
v23 = (unsigned __int8)*++v22;
v13 = v23;
++v8;
}
while ( (unsigned __int8)(v23 - 48) <= 9u && v3 >= v8 );
if ( v21 == v8 )
return 0;
}
if ( v13 == 90 )
{
++v8;
}
else if ( (((_BYTE)v13 - 43) & 0xFD) != 0 )
{
if ( v13 )
return 0;
}
else
{
v14 = v8 + 4;
if ( v13 == 45 )
v15 = -1;
else
v15 = 1;
if ( v3 <= v14 )
return 0;
if ( (unsigned __int8)(*(_BYTE *)(v4 + v8 + 1) - 48) > 9u )
return 0;
v16 = *(unsigned __int8 *)(v4 + v8 + 2);
if ( (unsigned __int8)(v16 - 48) > 9u )
return 0;
v17 = v16 + 10 * (*(unsigned __int8 *)(v4 + v8 + 1) - 48) - 48;
if ( v17 > 12 )
return 0;
v18 = a1 ? 3600 * v17 : 0;
if ( (unsigned __int8)(*(_BYTE *)(v4 + v8 + 3) - 48) > 9u )
return 0;
v19 = *(unsigned __int8 *)(v4 + v14);
if ( (unsigned __int8)(v19 - 48) > 9u )
return 0;
v20 = v19 + 10 * (*(unsigned __int8 *)(v4 + v8 + 3) - 48) - 48;
if ( v20 > 59 )
return 0;
if ( a1 )
v18 += 60 * v20;
v8 += 5;
if ( v18 )
{
if ( !(unsigned int)OPENSSL_gmtime_adj(a1, 0, v15 * v18) )
return 0;
}
}
return v3 == v8;
}