//
// sub_84DE64 from 0x84de64 to 0x84dfa0 (316 bytes)
//
// 3 xrefs:
// > X509v3_addr_add_inherit @ 0x84e3e4
// > X509v3_addr_add_prefix @ 0x84e478
// > X509v3_addr_add_range @ 0x84e608
//
// 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 sub_84DE64(int *a1, unsigned int a2, unsigned int *a3)
{
unsigned int v3; // r3
size_t v4; // r8
signed int i; // r4
int v7; // r0
_DWORD *v8; // r3
int *v9; // r5
const void *v10; // r0
int *v12; // r0
int v13; // r0
void *v14; // r0
_BYTE v15[8]; // [sp+4h] [bp-8h] BYREF
v3 = a2 >> 8;
v15[0] = BYTE1(a2);
if ( a3 )
{
v4 = 3;
v3 = *a3;
}
else
{
v4 = 2;
}
v15[1] = a2;
if ( a3 )
v15[2] = v3;
for ( i = 0; i < OPENSSL_sk_num((int)a1); ++i )
{
v7 = OPENSSL_sk_value(a1, i);
v8 = *(_DWORD **)v7;
v9 = (int *)v7;
v10 = *(const void **)(*(_DWORD *)v7 + 8);
if ( !v10 )
OPENSSL_die("assertion failed: f->addressFamily->data != NULL", "crypto/x509v3/v3_addr.c", 499);
if ( *v8 == v4 && !memcmp(v10, v15, v4) )
return v9;
}
v12 = (int *)IPAddressFamily_new();
v9 = v12;
if ( v12 )
{
if ( v12[1] || (v14 = IPAddressChoice_new(), (v9[1] = (int)v14) != 0) )
{
v13 = *v9;
if ( *v9 || (v13 = ASN1_OCTET_STRING_new(), (*v9 = v13) != 0) )
{
if ( ASN1_OCTET_STRING_set(v13, v15, v4) && OPENSSL_sk_push(a1, (int)v9) )
return v9;
}
}
}
IPAddressFamily_free(v9);
return nullptr;
}