//
// level_add_node from 0x10ed740 to 0x10ed844 (260 bytes)
//
// 8 xrefs:
// > X509_policy_check @ 0x1071bc0
// > X509_policy_check @ 0x1071bf0
// > X509_policy_check @ 0x1071c84
// > X509_policy_check @ 0x1071e84
// > X509_policy_check @ 0x1071fac
// > X509_policy_check @ 0x10720dc
// > X509_policy_check @ 0x107221c
// > ??> @ 0xff880
//
// This function is hookable on this platform (idp: arm, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 13:18:05 +0000
//
void *__fastcall level_add_node(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
_QWORD *v8; // x0
void *v9; // x19
int *v10; // x0
int *v11; // x0
void *result; // x0
v8 = CRYPTO_zalloc(&off_18, (__int64)"crypto/x509v3/pcy_node.c", 68);
v9 = v8;
if ( !v8 )
return v9;
*v8 = a2;
v8[1] = a3;
if ( a1 )
{
if ( (unsigned int)OBJ_obj2nid(*(_QWORD *)(a2 + 8)) == 746 )
{
if ( *(_QWORD *)(a1 + 16) )
{
LABEL_13:
policy_node_free(v9);
return nullptr;
}
*(_QWORD *)(a1 + 16) = v9;
}
else
{
v10 = *(int **)(a1 + 8);
if ( !v10 )
{
v10 = (int *)policy_node_cmp_new();
*(_QWORD *)(a1 + 8) = v10;
if ( !v10 )
goto LABEL_13;
}
if ( !(unsigned int)OPENSSL_sk_push(v10, (__int64)v9) )
goto LABEL_13;
}
}
if ( a4 )
{
v11 = *(int **)(a4 + 16);
if ( !v11 )
{
v11 = (int *)OPENSSL_sk_new_null();
*(_QWORD *)(a4 + 16) = v11;
if ( !v11 )
goto LABEL_13;
}
if ( !(unsigned int)OPENSSL_sk_push(v11, a2) )
goto LABEL_13;
}
if ( !a3 )
return v9;
result = v9;
++*(_DWORD *)(a3 + 16);
return result;
}