//
// asn1_utctime_to_tm from 0xd67c20 to 0xd67e98 (632 bytes)
//
// 5 xrefs:
// > ASN1_TIME_diff @ 0xd67b60
// > ASN1_TIME_diff @ 0xd67ba8
// > ASN1_UTCTIME_check @ 0xd67ea0
// > ASN1_UTCTIME_cmp_time_t @ 0xd68108
// > ??> @ 0x38358
//
// 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
//
bool __fastcall asn1_utctime_to_tm(int *a1, __int64 a2)
{
int v3; // w20
__int64 v4; // x11
__int64 v5; // x2
unsigned __int8 *v6; // x3
int v7; // w7
int v8; // w19
int v9; // w6
int v10; // w1
int v11; // w6
int v12; // w1
int v13; // w4
int v14; // w2
int v15; // w4
int v16; // w2
int v17; // w5
int v18; // w1
int v19; // w1
int v20; // w5
int v21; // w3
if ( *(_DWORD *)(a2 + 4) != 23 )
return 0;
v3 = *(_DWORD *)a2;
v4 = *(_QWORD *)(a2 + 8);
if ( *(int *)a2 <= 10 )
return 0;
v5 = 0;
v6 = *(unsigned __int8 **)(a2 + 8);
v7 = 1;
v8 = 0;
while ( 1 )
{
if ( v5 == 5 )
{
v13 = *v6;
if ( (((_BYTE)v13 - 43) & 0xFD) == 0 || v13 == 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_F66E80[v5] || v11 > dword_F66E80[v5 + 8] )
return 0;
if ( a1 )
{
switch ( (int)v5 )
{
case 1:
a1[4] = v10 - 49;
goto LABEL_18;
case 2:
a1[3] = v11;
goto LABEL_18;
case 3:
a1[2] = v11;
goto LABEL_18;
case 4:
a1[1] = v11;
goto LABEL_18;
case 5:
*a1 = v11;
goto LABEL_28;
default:
v12 = v10 + 52;
if ( v11 > 49 )
v12 = v11;
a1[5] = v12;
break;
}
}
if ( v7 == 6 )
goto LABEL_28;
LABEL_18:
++v5;
++v7;
v6 += 2;
}
if ( a1 )
*a1 = 0;
LABEL_28:
v14 = *(unsigned __int8 *)(v4 + v8);
if ( v14 != 90 )
{
if ( (((_BYTE)v14 - 43) & 0xFD) != 0 )
return v3 == v8;
v15 = v8 + 4;
v16 = v14 == 45 ? -1 : 1;
if ( v3 > v15 && (unsigned __int8)(*(_BYTE *)(v4 + v8 + 1) - 48) <= 9u )
{
v17 = *(unsigned __int8 *)(v4 + v8 + 2);
if ( (unsigned __int8)(v17 - 48) <= 9u )
{
v18 = v17 + 10 * (*(unsigned __int8 *)(v4 + v8 + 1) - 48) - 48;
if ( v18 <= 12 )
{
v19 = a1 ? 3600 * v18 : 0;
if ( (unsigned __int8)(*(_BYTE *)(v4 + v8 + 3) - 48) <= 9u )
{
v20 = *(unsigned __int8 *)(v4 + v15);
if ( (unsigned __int8)(v20 - 48) <= 9u )
{
v21 = v20 + 10 * (*(unsigned __int8 *)(v4 + v8 + 3) - 48) - 48;
if ( v21 <= 59 )
{
if ( a1 )
v19 += 60 * v21;
v8 += 5;
if ( !v19 || (unsigned int)OPENSSL_gmtime_adj(a1, 0, v16 * v19) )
return v3 == v8;
}
}
}
}
}
}
return 0;
}
return v3 == ++v8;
}