+ return find_nested_options(ctx->user_arg, ctx->user_opt, arg);
+}
+
+isl_ctx *isl_ctx_alloc_with_options(struct isl_arg *arg, void *user_opt)
+{
+ struct isl_ctx *ctx = NULL;
+ struct isl_options *opt = NULL;
+ int opt_allocated = 0;
+
+ if (!user_opt)
+ return NULL;
+
+ opt = find_nested_isl_options(arg, user_opt);
+ if (!opt) {
+ opt = isl_options_new_with_defaults();
+ if (!opt)
+ goto error;
+ opt_allocated = 1;
+ }
+
+ ctx = isl_calloc_type(NULL, struct isl_ctx);
+ if (!ctx)
+ goto error;
+
+ if (isl_hash_table_init(ctx, &ctx->name_hash, 0))
+ goto error;
+
+ ctx->stats = isl_calloc_type(ctx, struct isl_stats);
+ if (!ctx->stats)
+ goto error;
+
+ ctx->user_arg = arg;
+ ctx->user_opt = user_opt;
+ ctx->opt_allocated = opt_allocated;
+ ctx->opt = opt;
+ ctx->ref = 0;
+
+ isl_int_init(ctx->zero);
+ isl_int_set_si(ctx->zero, 0);