static unsigned int BN_STACK_pop(BN_STACK *st)
{
    return st->indexes[--(st->depth)];
}
['size_t ec_GFp_simple_point2oct(const EC_GROUP *group, const EC_POINT *point,\n                               point_conversion_form_t form,\n                               unsigned char *buf, size_t len, BN_CTX *ctx)\n{\n    size_t ret;\n    BN_CTX *new_ctx = NULL;\n    int used_ctx = 0;\n    BIGNUM *x, *y;\n    size_t field_len, i, skip;\n    if ((form != POINT_CONVERSION_COMPRESSED)\n        && (form != POINT_CONVERSION_UNCOMPRESSED)\n        && (form != POINT_CONVERSION_HYBRID)) {\n        ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_INVALID_FORM);\n        goto err;\n    }\n    if (EC_POINT_is_at_infinity(group, point)) {\n        if (buf != NULL) {\n            if (len < 1) {\n                ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);\n                return 0;\n            }\n            buf[0] = 0;\n        }\n        return 1;\n    }\n    field_len = BN_num_bytes(group->field);\n    ret =\n        (form ==\n         POINT_CONVERSION_COMPRESSED) ? 1 + field_len : 1 + 2 * field_len;\n    if (buf != NULL) {\n        if (len < ret) {\n            ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, EC_R_BUFFER_TOO_SMALL);\n            goto err;\n        }\n        if (ctx == NULL) {\n            ctx = new_ctx = BN_CTX_new();\n            if (ctx == NULL)\n                return 0;\n        }\n        BN_CTX_start(ctx);\n        used_ctx = 1;\n        x = BN_CTX_get(ctx);\n        y = BN_CTX_get(ctx);\n        if (y == NULL)\n            goto err;\n        if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx))\n            goto err;\n        if ((form == POINT_CONVERSION_COMPRESSED\n             || form == POINT_CONVERSION_HYBRID) && BN_is_odd(y))\n            buf[0] = form + 1;\n        else\n            buf[0] = form;\n        i = 1;\n        skip = field_len - BN_num_bytes(x);\n        if (skip > field_len) {\n            ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n        while (skip > 0) {\n            buf[i++] = 0;\n            skip--;\n        }\n        skip = BN_bn2bin(x, buf + i);\n        i += skip;\n        if (i != 1 + field_len) {\n            ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n        if (form == POINT_CONVERSION_UNCOMPRESSED\n            || form == POINT_CONVERSION_HYBRID) {\n            skip = field_len - BN_num_bytes(y);\n            if (skip > field_len) {\n                ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n                goto err;\n            }\n            while (skip > 0) {\n                buf[i++] = 0;\n                skip--;\n            }\n            skip = BN_bn2bin(y, buf + i);\n            i += skip;\n        }\n        if (i != ret) {\n            ECerr(EC_F_EC_GFP_SIMPLE_POINT2OCT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n    }\n    if (used_ctx)\n        BN_CTX_end(ctx);\n    BN_CTX_free(new_ctx);\n    return ret;\n err:\n    if (used_ctx)\n        BN_CTX_end(ctx);\n    BN_CTX_free(new_ctx);\n    return 0;\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}']