bool preparet::doit()
{
  options.set_option("bounds-check", !cmdline.isset("no-bounds-check"));
  options.set_option("div-by-zero-check", !cmdline.isset("no-div-by-zero-check"));
  options.set_option("pointer-check", !cmdline.isset("no-pointer-check"));
  options.set_option("assertions", !cmdline.isset("no-assertions"));
  options.set_option("simplify", !cmdline.isset("no-simplify"));
  options.set_option("overflow-check", cmdline.isset("overflow-check"));

  //
  // parsing
  //

  if(parse()) return true;

  //
  // type checking
  //

  if(typecheck()) return true;

  //
  // final adjustments
  //

  if(final()) return true;

  // get "main" function
  if(make_sequent(get_main_symbol(), sequent)) return true;

  // we no longer need any parse trees or language files
  clear_parse();

  try
  {
	// get extra transition systems
	get_modules();

	status("Generating GOTO Program");

	goto_functionst goto_functions;
	goto_convert(sequent, context, goto_functions, std::cerr);

	if(cmdline.isset("show-goto-functions"))
	{
	  goto_functions.output(ns, std::cout);
	  return true;
	}

	// inline functions
	goto_inline(goto_functions, ns, concrete_model.goto_program, std::cerr);

	// apply replace_map to goto program
	replace(concrete_model.replace_map, concrete_model.goto_program);

	// show it?

	if(cmdline.isset("show-pointer-goto-program"))
	{
	  concrete_model.goto_program.output(ns, std::cout);
	  return true;
	}

	#if 0
	// Seperate into basic blocks
	basic_blocks(concrete_model.goto_program, MAX_BLOCK_SIZE);

	// show it?

	if(cmdline.isset("show-basic-blocks"))
	{
	  concrete_model.goto_program.output(ns, std::cout);
	  return true;
	}
	#endif

	// do value propagation
	if(!cmdline.isset("no-value-sets"))
	{
	  status("Pointer Analysis");
	  concrete_model.value_propagation.
		compute(concrete_model.goto_program, ns);
	}
	else
	{
	  concrete_model.value_propagation.make_all_any(
		concrete_model.goto_program);
	}

	if(cmdline.isset("show-value-sets"))
	{
	  concrete_model.value_propagation.output(
		ns, concrete_model.goto_program, std::cout);
	  return true;
	}

	// add pointer checks
	pointer_checks(
	  concrete_model.goto_program, ns,
	  options, concrete_model.value_propagation);

	// add checks
	goto_check(ns, options, concrete_model.goto_program);

	concrete_model.value_propagation.update(concrete_model.goto_program, ns);

	// show it?

	if(cmdline.isset("show-goto-program"))
	{
	  concrete_model.goto_program.output(ns, std::cout);
	  return true;
	}

	// do invariant propagation

	invariant_propagationt invariant_propagation;

	if(!cmdline.isset("no-invariant-sets"))
	{
	  invariant_propagation.compute(concrete_model.goto_program,
									concrete_model.value_propagation);
	}
	else
	{
	  invariant_propagation.make_all_true(concrete_model.goto_program);
	}

	if(cmdline.isset("show-invariant-sets"))
	{
	  show_invariant_sets(invariant_propagation);
	  return true;
	}

	if(cmdline.isset("show-claims"))
	{
	  show_claims();
	  return true;
	}

	if(cmdline.isset("claim"))
	  set_claim(atoi(cmdline.getval("claim")));

	// get the user provided predicates

	if(cmdline.isset("predicates"))
	  get_predicates();

	if(cmdline.isset("initial-state"))
	  get_initial_state();
  }

  catch(const char *e)
  {
	error(e);
	return true;
  }

  catch(const std::string e)
  {
	error(e);
	return true;
  }

  catch(int)
  {
	return true;
  }

  return false;
}
