//
// ASN1_STRING_TABLE_add from 0x8644ec to 0x864638 (332 bytes)
//
// 2 xrefs:
// > sub_8663F4 @ 0x866678
// > ??> @ 0x6996c
//
// 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 ASN1_STRING_TABLE_add(int a1, int a2, int a3, int a4, int a5)
{
int v9; // r6
int v10; // r0
_DWORD *v11; // r5
_DWORD *v12; // r0
_DWORD *v13; // r4
int v14; // r0
int v15; // r1
int v16; // r2
int v17; // r3
int result; // r0
v9 = a5;
if ( !dword_AD485C )
{
dword_AD485C = (int)OPENSSL_sk_new((int)sub_864234);
if ( !dword_AD485C )
goto LABEL_22;
}
v10 = ASN1_STRING_TABLE_get(a1);
v11 = (_DWORD *)v10;
if ( !v10 || (*(_DWORD *)(v10 + 16) & 1) == 0 )
{
v12 = CRYPTO_zalloc(&dword_14, (int)"crypto/asn1/a_strnid.c", 202);
v13 = v12;
if ( v12 )
{
if ( OPENSSL_sk_push((int *)dword_AD485C, (int)v12) )
{
if ( v11 )
{
v14 = v11[1];
v15 = v11[2];
v16 = v11[3];
v17 = v11[4] | 1;
*v13 = *v11;
v13[1] = v14;
v13[2] = v15;
v13[3] = v16;
v13[4] = v17;
}
else
{
v13[1] = -1;
v13[2] = -1;
v13[4] = 1;
}
goto LABEL_8;
}
CRYPTO_free(v13, (int)"crypto/asn1/a_strnid.c", 206);
}
LABEL_22:
ERR_put_error(13, 129, 65, (int)"crypto/asn1/a_strnid.c", 230);
return 0;
}
v13 = (_DWORD *)v10;
LABEL_8:
if ( a2 >= 0 )
v13[1] = a2;
if ( a3 >= 0 )
v13[2] = a3;
if ( a4 )
v13[3] = a4;
if ( a5 )
v9 = a5 | 1;
result = 1;
if ( a5 )
v13[4] = v9;
return result;
}