static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx)\n{\n    int r = 0;\n    BIGNUM *a1, *a2, *a3, *b1, *b2, *b3;\n    BN_CTX *ctx_new = NULL;\n    if (EC_METHOD_get_field_type(EC_GROUP_method_of(a)) !=\n        EC_METHOD_get_field_type(EC_GROUP_method_of(b)))\n        return 1;\n    if (EC_GROUP_get_curve_name(a) && EC_GROUP_get_curve_name(b) &&\n        EC_GROUP_get_curve_name(a) != EC_GROUP_get_curve_name(b))\n        return 1;\n    if (a->meth->flags & EC_FLAGS_CUSTOM_CURVE)\n        return 0;\n    if (ctx == NULL)\n        ctx_new = ctx = BN_CTX_new();\n    if (ctx == NULL)\n        return -1;\n    BN_CTX_start(ctx);\n    a1 = BN_CTX_get(ctx);\n    a2 = BN_CTX_get(ctx);\n    a3 = BN_CTX_get(ctx);\n    b1 = BN_CTX_get(ctx);\n    b2 = BN_CTX_get(ctx);\n    b3 = BN_CTX_get(ctx);\n    if (b3 == NULL) {\n        BN_CTX_end(ctx);\n        BN_CTX_free(ctx_new);\n        return -1;\n    }\n    if (!a->meth->group_get_curve(a, a1, a2, a3, ctx) ||\n        !b->meth->group_get_curve(b, b1, b2, b3, ctx))\n        r = 1;\n    if (r || BN_cmp(a1, b1) || BN_cmp(a2, b2) || BN_cmp(a3, b3))\n        r = 1;\n    if (r || EC_POINT_cmp(a, EC_GROUP_get0_generator(a),\n                          EC_GROUP_get0_generator(b), ctx))\n        r = 1;\n    if (!r) {\n        const BIGNUM *ao, *bo, *ac, *bc;\n        ao = EC_GROUP_get0_order(a);\n        bo = EC_GROUP_get0_order(b);\n        ac = EC_GROUP_get0_cofactor(a);\n        bc = EC_GROUP_get0_cofactor(b);\n        if (ao == NULL || bo == NULL) {\n            BN_CTX_end(ctx);\n            BN_CTX_free(ctx_new);\n            return -1;\n        }\n        if (BN_cmp(ao, bo) || BN_cmp(ac, bc))\n            r = 1;\n    }\n    BN_CTX_end(ctx);\n    BN_CTX_free(ctx_new);\n    return r;\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG("ENTER BN_CTX_start()", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        ctx->err_stack++;\n    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {\n        BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        ctx->err_stack++;\n    }\n    CTXDBG("LEAVE BN_CTX_start()", ctx);\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    CTXDBG("ENTER BN_CTX_end()", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG("LEAVE BN_CTX_end()", ctx);\n}', 'static unsigned int BN_STACK_pop(BN_STACK *st)\n{\n    return st->indexes[--(st->depth)];\n}']