static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
{
    const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);
    int embed = tt->flags & ASN1_TFLG_EMBED;
    ASN1_VALUE *tval;
    int ret;
    if (embed) {
        tval = (ASN1_VALUE *)pval;
        pval = &tval;
    }
    if (tt->flags & ASN1_TFLG_OPTIONAL) {
        asn1_template_clear(pval, tt);
        return 1;
    }
    if (tt->flags & ASN1_TFLG_ADB_MASK) {
        *pval = NULL;
        return 1;
    }
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
    OPENSSL_mem_debug_push(tt->field_name
            ? tt->field_name : "asn1_template_new");
#endif
    if (tt->flags & ASN1_TFLG_SK_MASK) {
        STACK_OF(ASN1_VALUE) *skval;
        skval = sk_ASN1_VALUE_new_null();
        if (!skval) {
            ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);
            ret = 0;
            goto done;
        }
        *pval = (ASN1_VALUE *)skval;
        ret = 1;
        goto done;
    }
    ret = asn1_item_embed_new(pval, it, embed);
 done:
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
    OPENSSL_mem_debug_pop();
#endif
    return ret;
}
['static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)\n{\n    const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item);\n    int embed = tt->flags & ASN1_TFLG_EMBED;\n    ASN1_VALUE *tval;\n    int ret;\n    if (embed) {\n        tval = (ASN1_VALUE *)pval;\n        pval = &tval;\n    }\n    if (tt->flags & ASN1_TFLG_OPTIONAL) {\n        asn1_template_clear(pval, tt);\n        return 1;\n    }\n    if (tt->flags & ASN1_TFLG_ADB_MASK) {\n        *pval = NULL;\n        return 1;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    OPENSSL_mem_debug_push(tt->field_name\n            ? tt->field_name : "asn1_template_new");\n#endif\n    if (tt->flags & ASN1_TFLG_SK_MASK) {\n        STACK_OF(ASN1_VALUE) *skval;\n        skval = sk_ASN1_VALUE_new_null();\n        if (!skval) {\n            ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE);\n            ret = 0;\n            goto done;\n        }\n        *pval = (ASN1_VALUE *)skval;\n        ret = 1;\n        goto done;\n    }\n    ret = asn1_item_embed_new(pval, it, embed);\n done:\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    OPENSSL_mem_debug_pop();\n#endif\n    return ret;\n}', 'DEFINE_STACK_OF(ASN1_VALUE)', '_STACK *sk_new_null(void)\n{\n    return sk_new((int (*)(const void *, const void *))0);\n}', '_STACK *sk_new(int (*c) (const void *, const void *))\n{\n    _STACK *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)\n        goto err;\n    if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)\n        goto err;\n    ret->comp = c;\n    ret->num_alloc = MIN_NODES;\n    return (ret);\n err:\n    OPENSSL_free(ret);\n    return (NULL);\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']