//
// X509v3_asid_add_id_or_range from 0x8527a8 to 0x8528e4 (316 bytes)
//
// 2 xrefs:
// > sub_852A80 @ 0x852bbc
// > ??> @ 0x68adc
//
// 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 X509v3_asid_add_id_or_range(int a1, int a2, int a3, int a4)
{
_DWORD *v4; // r1
int v5; // r5
_DWORD *v8; // r0
_DWORD *v9; // r4
int *v10; // r0
_DWORD *v11; // r3
_DWORD *v13; // r0
if ( !a1 )
return 0;
if ( a2 )
{
if ( a2 != 1 )
return 0;
v4 = *(_DWORD **)(a1 + 4);
v5 = a1 + 4;
}
else
{
v5 = a1;
v4 = *(_DWORD **)a1;
}
if ( v4 )
{
if ( *v4 )
goto LABEL_7;
return 0;
}
v13 = ASIdentifierChoice_new();
*(_DWORD *)v5 = v13;
if ( !v13 )
return 0;
if ( v13[1] )
OPENSSL_die("assertion failed: (*choice)->u.asIdsOrRanges == NULL", "crypto/x509v3/v3_asid.c", 203);
v13[1] = OPENSSL_sk_new((int)sub_8519FC);
if ( !*(_DWORD *)(*(_DWORD *)v5 + 4) )
return 0;
**(_DWORD **)v5 = 1;
LABEL_7:
v8 = ASIdOrRange_new();
v9 = v8;
if ( !v8 )
return 0;
if ( a4 )
{
*v8 = 1;
v10 = (int *)ASRange_new();
v9[1] = v10;
if ( !v10 )
{
LABEL_13:
ASIdOrRange_free(v9);
return 0;
}
ASN1_INTEGER_free(*v10);
v11 = (_DWORD *)v9[1];
*v11 = a3;
ASN1_INTEGER_free(v11[1]);
*(_DWORD *)(v9[1] + 4) = a4;
}
else
{
*v8 = 0;
v8[1] = a3;
}
if ( !OPENSSL_sk_push(*(int **)(*(_DWORD *)v5 + 4), (int)v9) )
goto LABEL_13;
return 1;
}