//
// level_add_node from 0x8c39f8 to 0x8c3af8 (256 bytes)
//
// 8 xrefs:
// > X509_policy_check @ 0x84bef8
// > X509_policy_check @ 0x84bf3c
// > X509_policy_check @ 0x84c00c
// > X509_policy_check @ 0x84c050
// > X509_policy_check @ 0x84c2e8
// > X509_policy_check @ 0x84c4a8
// > X509_policy_check @ 0x84c6a8
// > ??> @ 0x685dc
//
// 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
//
void *__fastcall level_add_node(int a1, int a2, int a3, int a4)
{
_DWORD *v8; // r0
void *v9; // r4
int *v10; // r0
int *v11; // r0
v8 = CRYPTO_zalloc(&byte_9[3], (int)"crypto/x509v3/pcy_node.c", 68);
v9 = v8;
if ( v8 )
{
*v8 = a2;
v8[1] = a3;
if ( a1 )
{
if ( OBJ_obj2nid(*(_DWORD *)(a2 + 4)) == (char *)&stru_2DC.st_shndx )
{
if ( *(_DWORD *)(a1 + 8) )
goto LABEL_12;
*(_DWORD *)(a1 + 8) = v9;
}
else
{
v10 = *(int **)(a1 + 4);
if ( !v10 )
{
v10 = policy_node_cmp_new();
*(_DWORD *)(a1 + 4) = v10;
if ( !v10 )
goto LABEL_12;
}
if ( !OPENSSL_sk_push(v10, (int)v9) )
goto LABEL_12;
}
}
if ( !a4
|| ((v11 = *(int **)(a4 + 8)) != nullptr || (v11 = OPENSSL_sk_new_null(), (*(_DWORD *)(a4 + 8) = v11) != 0))
&& OPENSSL_sk_push(v11, a2) )
{
if ( a3 )
{
++*(_DWORD *)(a3 + 8);
return v9;
}
return v9;
}
LABEL_12:
policy_node_free(v9);
return nullptr;
}
return v9;
}