static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['static int dh_builtin_genparams(DH *ret, int prime_len, int generator,\n                                BN_GENCB *cb)\n{\n    BIGNUM *t1, *t2;\n    int g, ok = -1;\n    BN_CTX *ctx = NULL;\n    ctx = BN_CTX_new();\n    if (ctx == NULL)\n        goto err;\n    BN_CTX_start(ctx);\n    t1 = BN_CTX_get(ctx);\n    t2 = BN_CTX_get(ctx);\n    if (t2 == NULL)\n        goto err;\n    if (!ret->p && ((ret->p = BN_new()) == NULL))\n        goto err;\n    if (!ret->g && ((ret->g = BN_new()) == NULL))\n        goto err;\n    if (generator <= 1) {\n        DHerr(DH_F_DH_BUILTIN_GENPARAMS, DH_R_BAD_GENERATOR);\n        goto err;\n    }\n    if (generator == DH_GENERATOR_2) {\n        if (!BN_set_word(t1, 24))\n            goto err;\n        if (!BN_set_word(t2, 11))\n            goto err;\n        g = 2;\n    } else if (generator == DH_GENERATOR_5) {\n        if (!BN_set_word(t1, 10))\n            goto err;\n        if (!BN_set_word(t2, 3))\n            goto err;\n        g = 5;\n    } else {\n        if (!BN_set_word(t1, 2))\n            goto err;\n        if (!BN_set_word(t2, 1))\n            goto err;\n        g = generator;\n    }\n    if (!BN_generate_prime_ex(ret->p, prime_len, 1, t1, t2, cb))\n        goto err;\n    if (!BN_GENCB_call(cb, 3, 0))\n        goto err;\n    if (!BN_set_word(ret->g, g))\n        goto err;\n    ok = 1;\n err:\n    if (ok == -1) {\n        DHerr(DH_F_DH_BUILTIN_GENPARAMS, ERR_R_BN_LIB);\n        ok = 0;\n    }\n    if (ctx != NULL) {\n        BN_CTX_end(ctx);\n        BN_CTX_free(ctx);\n    }\n    return ok;\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}']