/*
** Automatically generated from `mode_errors.m'
** by the Mercury compiler,
** version rotd-2026-05-29
** configured for x86_64-pc-linux-gnu.
** Do not edit.
**
** The autoconfigured grade settings governing
** the generation of this C file were
**
** TAG_BITS=2
** UNBOXED_FLOAT=no
** UNBOXED_INT64S=no
** PREGENERATED_DIST=yes
** HIGHLEVEL_CODE=yes
**
** END_OF_C_GRADE_INFO
*/


// :- module check_hlds.mode_errors.
// :- implementation.

/*
INIT mercury__check_hlds__mode_errors__init
ENDINIT
*/

#include "check_hlds.mode_errors.mih"


#include "analysis.mih"
#include "array.mih"
#include "assoc_list.mih"
#include "bag.mih"
#include "bimap.mih"
#include "bitmap.mih"
#include "bool.mih"
#include "builtin.mih"
#include "char.mih"
#include "check_hlds.mih"
#include "construct.mih"
#include "cord.mih"
#include "counter.mih"
#include "deconstruct.mih"
#include "digraph.mih"
#include "edit_seq.mih"
#include "enum.mih"
#include "getopt.mih"
#include "hlds.mih"
#include "int.mih"
#include "integer.mih"
#include "io.mih"
#include "libs.mih"
#include "list.mih"
#include "map.mih"
#include "maybe.mih"
#include "mdbcomp.mih"
#include "mode_robdd.mih"
#include "multi_map.mih"
#include "one_or_more.mih"
#include "one_or_more_map.mih"
#include "ops.mih"
#include "pair.mih"
#include "parse_tree.mih"
#include "pretty_printer.mih"
#include "private_builtin.mih"
#include "queue.mih"
#include "recompilation.mih"
#include "require.mih"
#include "robdd.mih"
#include "set.mih"
#include "set_ordlist.mih"
#include "set_tree234.mih"
#include "sparse_bitset.mih"
#include "stack.mih"
#include "stream.mih"
#include "string.mih"
#include "term.mih"
#include "term_context.mih"
#include "time.mih"
#include "transform_hlds.mih"
#include "tree234.mih"
#include "type_desc.mih"
#include "unit.mih"
#include "univ.mih"
#include "varset.mih"
#include "analysis.framework.mih"
#include "analysis.operations.mih"
#include "check_hlds.delay_info.mih"
#include "check_hlds.mode_constraint_robdd.mih"
#include "check_hlds.mode_info.mih"
#include "check_hlds.modecheck_util.mih"
#include "check_hlds.proc_requests.mih"
#include "hlds.const_struct.mih"
#include "hlds.error_msg_inst.mih"
#include "hlds.goal_mode.mih"
#include "hlds.hlds_class.mih"
#include "hlds.hlds_clauses.mih"
#include "hlds.hlds_cons.mih"
#include "hlds.hlds_data.mih"
#include "hlds.hlds_dependency_graph.mih"
#include "hlds.hlds_error_util.mih"
#include "hlds.hlds_goal.mih"
#include "hlds.hlds_inst_mode.mih"
#include "hlds.hlds_llds.mih"
#include "hlds.hlds_markers.mih"
#include "hlds.hlds_module.mih"
#include "hlds.hlds_out.mih"
#include "hlds.hlds_pred.mih"
#include "hlds.hlds_proc_util.mih"
#include "hlds.hlds_promise.mih"
#include "hlds.hlds_rtti.mih"
#include "hlds.inst_graph.mih"
#include "hlds.inst_match.mih"
#include "hlds.inst_test.mih"
#include "hlds.instmap.mih"
#include "hlds.mode_util.mih"
#include "hlds.pred_name.mih"
#include "hlds.pred_table.mih"
#include "hlds.special_pred.mih"
#include "hlds.status.mih"
#include "libs.dependency_graph.mih"
#include "libs.file_util.mih"
#include "libs.globals.mih"
#include "libs.indent.mih"
#include "libs.maybe_util.mih"
#include "libs.op_mode.mih"
#include "libs.optdb_help.mih"
#include "libs.optimization_options.mih"
#include "libs.option_categories.mih"
#include "libs.options.mih"
#include "libs.polyhedron.mih"
#include "libs.trace_params.mih"
#include "mdbcomp.feedback.mih"
#include "mdbcomp.goal_path.mih"
#include "mdbcomp.prim_data.mih"
#include "mdbcomp.program_representation.mih"
#include "mdbcomp.sym_name.mih"
#include "mode_robdd.tfeirn.mih"
#include "parse_tree.d_file_deps.mih"
#include "parse_tree.error_spec.mih"
#include "parse_tree.error_util.mih"
#include "parse_tree.module_qual.mih"
#include "parse_tree.parse_tree_out_cons_id.mih"
#include "parse_tree.parse_tree_out_info.mih"
#include "parse_tree.parse_tree_out_pred_decl.mih"
#include "parse_tree.parse_tree_out_sym_name.mih"
#include "parse_tree.parse_tree_out_term.mih"
#include "parse_tree.parse_tree_out_type.mih"
#include "parse_tree.parse_tree_output.mih"
#include "parse_tree.prog_data.mih"
#include "parse_tree.prog_data_event.mih"
#include "parse_tree.prog_data_foreign.mih"
#include "parse_tree.prog_data_pragma.mih"
#include "parse_tree.prog_data_used_modules.mih"
#include "parse_tree.prog_foreign.mih"
#include "parse_tree.prog_item.mih"
#include "parse_tree.prog_mode.mih"
#include "parse_tree.prog_parse_tree.mih"
#include "parse_tree.prog_rename.mih"
#include "parse_tree.prog_type.mih"
#include "parse_tree.prog_util.mih"
#include "parse_tree.set_of_var.mih"
#include "parse_tree.var_db.mih"
#include "parse_tree.var_table.mih"
#include "parse_tree.vartypes.mih"
#include "recompilation.record_uses.mih"
#include "string.builder.mih"
#include "transform_hlds.term_constr_errors.mih"
#include "transform_hlds.term_constr_main_types.mih"
#include "transform_hlds.term_errors.mih"
#include "transform_hlds.term_util.mih"
#include "hlds.hlds_out.hlds_out_goal.mih"
#include "hlds.hlds_out.hlds_out_util.mih"
#include "mdbcomp.feedback.feedback_info.mih"
#include "parse_tree.module_qual.mq_info.mih"




static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_prog_var_type_0;

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__varset__pti_varset_1__plain_parse_tree__prog_data__type_ctor_info_inst_var_type_0;

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_inst_var_type_0;

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__list__pti_list_1__plain_builtin__type_ctor_info_int_0;

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_error_msg_0;

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_format_piece_0;

static const MR_VA_PseudoTypeInfo_Struct3 check_hlds__mode_errors____vpti_tuple_3__plain_parse_tree__prog_data__type_ctor_info_cons_id_0__plain_builtin__type_ctor_info_int_0__plain_builtin__type_ctor_info_int_0;

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__maybe__pti_maybe_1__plain_parse_tree__error_spec__type_ctor_info_color_name_0;

static const MR_FA_PseudoTypeInfo_Struct2 check_hlds__mode_errors__pair__pti_pair_2__plain_term_context__type_ctor_info_term_context_0__plain_parse_tree__prog_data__type_ctor_info_mer_inst_0;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1builtin__type_ctor_info_int_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_arg_ok_or_not_0_0[2];

static const MR_ConstString check_hlds__mode_errors__check_hlds__mode_errors__field_names_arg_ok_or_not_0_0[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_arg_ok_or_not_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_arg_ok_or_not_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_arg_ok_or_not_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_arg_ok_or_not_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_arg_ok_or_not_0[1];

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_argnum_var_type_inst_0_0[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_argnum_var_type_inst_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_argnum_var_type_inst_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_argnum_var_type_inst_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_argnum_var_type_inst_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_argnum_var_type_inst_0[1];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_0[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_1[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_1;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_2[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_2;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_bound_functor_cons_id_error_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_bound_functor_cons_id_error_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_bound_functor_cons_id_error_0[3];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_1;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_cannot_create_reason_0[2];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_cannot_create_reason_0[2];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_cannot_create_reason_0[2];

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_0_0[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_0[1];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_0[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_0;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_1[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_1;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_2[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_2;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_reason_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_reason_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_reason_0[3];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_term_path_step_0_0[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_term_path_step_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_term_path_step_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_term_path_step_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_term_path_step_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_term_path_step_0[1];

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__sparse_bitset__ti_sparse_bitset_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_delayed_goal_0_0[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_delayed_goal_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_delayed_goal_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_delayed_goal_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_delayed_goal_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_delayed_goal_0[1];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_1;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_exact_or_not_0[2];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_exact_or_not_0[2];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_exact_or_not_0[2];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_1;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_2;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_final_inst_error_0[3];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_final_inst_error_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_final_inst_error_0[3];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_1;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_ground_or_nonground_0[2];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_ground_or_nonground_0[2];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_ground_or_nonground_0[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_0;

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_1;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_higher_order_mismatch_info_0_2[1];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_higher_order_mismatch_info_0_2[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_2;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_higher_order_mismatch_info_0_3[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_3;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_0[2];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_higher_order_mismatch_info_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_higher_order_mismatch_info_0[4];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_higher_order_mismatch_info_0[4];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_match_what_0_0[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_match_what_0_1[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_1;

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_2;

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_3;

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_4;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_match_what_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_match_what_0[5];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_match_what_0[5];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_1;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_maybe_is_disjunctive_0[2];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_maybe_is_disjunctive_0[2];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_maybe_is_disjunctive_0[2];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_1;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_maybe_some_extra_arg_is_bad_0[2];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_maybe_some_extra_arg_is_bad_0[2];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_maybe_some_extra_arg_is_bad_0[2];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_1;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_2;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_merge_context_0[3];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_merge_context_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_merge_context_0[3];

static const MR_FA_TypeInfo_Struct2 check_hlds__mode_errors__pair__ti_pair_2term_context__type_ctor_info_term_context_0parse_tree__prog_data__type_ctor_info_mer_inst_0;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1pair__ti_pair_2term_context__type_ctor_info_term_context_0parse_tree__prog_data__type_ctor_info_mer_inst_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_merge_error_0_0[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_merge_error_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_merge_error_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_merge_error_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_merge_error_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_merge_error_0[1];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_0[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_1[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_1;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_mer_inst_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_2[5];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_2;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_3[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_3;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_4[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_4;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_5[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_5;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_6[4];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_6[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_6;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__maybe__ti_maybe_1check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_7[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_7;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_8[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_8;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_9[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_9;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_mode_mismatch_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_10[5];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_10;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_11[5];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_11[5];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_11;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_delayed_goal_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_12[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_12;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_merge_error_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_13[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_13;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_14[2];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_14[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_14;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_coerce_error_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_15[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_15;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_16[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_16;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_17[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_17;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_18[5];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_18[5];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_18;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_mode_error_info_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_19[5];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_19;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_20[4];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_20[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_20;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_21[2];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_21[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_21;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__one_or_more__ti_one_or_more_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_22[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_22;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_2[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_3[20];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_0[4];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_0[23];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_0[23];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_info_0_0[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_info_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_info_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_info_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_info_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_info_0[1];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_0[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_1[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_1;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_from_to_insts_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_2[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_2;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_unify_rhs_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_unify_rhs_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_unify_rhs_0[3];

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_inst_var_type_0;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1term__ti_var_1parse_tree__prog_data__type_ctor_info_inst_var_type_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_mismatch_0_0[3];

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_mismatch_0_0[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_mismatch_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_mismatch_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_mismatch_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_mismatch_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_mismatch_0[1];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_0[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_1[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_1;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_2[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_2;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_warning_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_warning_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_warning_0[3];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_info_0_0[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_info_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_info_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_warning_info_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_warning_info_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_warning_info_0[1];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_1;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_negated_context_desc_0[2];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_negated_context_desc_0[2];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_negated_context_desc_0[2];

static const MR_FA_TypeInfo_Struct2 check_hlds__mode_errors__tree234__ti_tree234_2builtin__type_ctor_info_int_0check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_pred_id_var_multimode_error_0_0[2];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_pred_id_var_multimode_error_0_0;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_pred_id_var_multimode_error_0_0[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_pred_id_var_multimode_error_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_pred_id_var_multimode_error_0[1];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_pred_id_var_multimode_error_0[1];

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_0;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_1;

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_2;

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_report_inst_how_0[3];

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_report_inst_how_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_report_inst_how_0[3];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_schedule_culprit_0_1[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_1;

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_2;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_schedule_culprit_0_0[2];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_schedule_culprit_0_1[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_schedule_culprit_0[2];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_schedule_culprit_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_schedule_culprit_0[3];

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_0[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_0;

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1builtin__type_ctor_info_int_0;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_1[4];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_1;

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_2[1];

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_2;

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_0[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_1[1];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_2[1];

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_var_multimode_error_0[3];

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_var_multimode_error_0[3];

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_var_multimode_error_0[3];

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__mode_error_coerce_error_to_spec__1915__1_1_f_0(
  MR_Word LambdaHeadVar__1_176);

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__mode_error_coerce_error_to_spec__1875__1_1_f_0(
  MR_Word LambdaHeadVar__1_117);

static void MR_CALL 
check_hlds__mode_errors__IntroducedFrom__pred__report_bound_inst_vars__1476__1_3_p_0(
  MR_Word InstVarSet_1,
  MR_Word HeadVar__2_59,
  MR_String * HeadVar__3_60);

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__named_and_unnamed_vars_to_pieces__843__1_1_f_0(
  MR_String LambdaHeadVar__1_26);

static MR_bool MR_CALL 
check_hlds__mode_errors__IntroducedFrom__pred__named_and_unnamed_vars_to_pieces__832__1_3_p_0(
  MR_Word VarTable_5,
  MR_Word LambdaHeadVar__1_23,
  MR_String * LambdaHeadVar__2_24);

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__mode_error_unify_var_multimode_pf_to_spec__804__1_1_f_0(
  MR_Integer LambdaHeadVar__1_105);

static void MR_CALL 
check_hlds__mode_errors____Compare____report_inst_how_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____report_inst_how_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____ok_or_not_map_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ok_or_not_map_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_some_extra_arg_is_bad_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_some_extra_arg_is_bad_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_is_disjunctive_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_is_disjunctive_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____ground_or_nonground_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ground_or_nonground_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____argnum_var_type_inst_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____argnum_var_type_inst_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____arg_ok_or_not_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____arg_ok_or_not_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2);

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_context_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word ReportIsGround_9,
  MR_Word MaybeColor_10,
  MR_Word VarNamePiece_11,
  MR_Word Type_12,
  MR_Word HeadVar__6_6);

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_branch_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word MaybeColor_8,
  MR_Word VarNamePiece_9,
  MR_Word MaybeGroundOrNonGround_10,
  MR_Word Inst_11);

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_branch_detail_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word IntroPieces_7,
  MR_Word MaybeColor_8,
  MR_Word Inst_9);

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(
  MR_Word MaybeColor_5,
  MR_Word VarNamePiece_6,
  MR_String FreeOrGround_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0_3(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Box MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Box MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word MainContext_7,
  MR_Word IsDisjunctive_8,
  MR_Word MergeError_9);

static void MR_CALL 
check_hlds__mode_errors__count_ground_insts_7_p_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3,
  MR_Integer STATE_VARIABLE_NumGroundInsts_0_4,
  MR_Integer * STATE_VARIABLE_NumGroundInsts_5,
  MR_Integer STATE_VARIABLE_NumAllInsts_0_6,
  MR_Integer * STATE_VARIABLE_NumAllInsts_7);

static MR_Word MR_CALL 
check_hlds__mode_errors__report_bad_arity_pieces_1_f_0(
  MR_Tuple HeadVar__1_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__make_term_path_piece_1_f_0(
  MR_Word Step_3);

static MR_bool MR_CALL 
check_hlds__mode_errors__is_error_important_1_p_0(
  MR_Word Error_2);

static MR_Word MR_CALL 
check_hlds__mode_errors__prefix_with_blank_line_2_f_0(
  MR_Word Context_4,
  MR_Word Msgs_5);

static void MR_CALL 
check_hlds__mode_errors__acc_not_ok_in_any_proc_args_4_p_0(
  MR_Integer ArgNum_5,
  MR_Word ArgOkOrNot_6,
  MR_Word STATE_VARIABLE_NeverOkArgNums_0_10,
  MR_Word * STATE_VARIABLE_NeverOkArgNums_11);

static void MR_CALL 
check_hlds__mode_errors__is_any_extra_arg_bad_5_p_0(
  MR_Integer NumExtra_6,
  MR_Integer ArgNum_7,
  MR_Word ArgOkOrNot_8,
  MR_Word STATE_VARIABLE_SomeExtraIsBad_0_10,
  MR_Word * STATE_VARIABLE_SomeExtraIsBad_11);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_warning_cannot_succeed_var_functor_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word X_7,
  MR_Word InstX_8,
  MR_Word ConsId_9);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_warning_cannot_succeed_var_var_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word X_8,
  MR_Word Y_9,
  MR_Word InstX_10,
  MR_Word InstY_11);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_to_spec_2_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word ModeError_5);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_in_callee_to_spec_6_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_in_callee_to_spec_6_f_0(
  MR_Word STATE_VARIABLE_ModeInfo_0_57,
  MR_Word Vars_9,
  MR_Word Insts_10,
  MR_Word CalleePredId_11,
  MR_Integer CalleeProcId_12,
  MR_Word CalleeModeErrors_13);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_conjunct_to_msgs_3_f_0(
  MR_Word Context_5,
  MR_Word STATE_VARIABLE_ModeInfo_0_37,
  MR_Word DelayedGoal_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_3(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_bool MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word OoMErrors_6,
  MR_Word Culprit_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__purity_error_lambda_should_be_any_to_spec_2_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__purity_error_lambda_should_be_any_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word OoMVars_5);

static MR_Word MR_CALL 
check_hlds__mode_errors__purity_error_should_be_in_promise_purity_scope_to_spec_3_f_0(
  MR_Word NegCtxtDesc_5,
  MR_Word ModeInfo_6,
  MR_Word Var_7);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_cannot_create_implied_mode_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word Reason_8,
  MR_Word Var_9,
  MR_Word VarInst_10,
  MR_Word NonImpliedInitialInst_11);

static MR_Word MR_CALL 
check_hlds__mode_errors__inst_list_to_sep_lines_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word Inst1_6,
  MR_Word Insts2plus_7);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unexpected_final_inst_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Integer RawArgNum_9,
  MR_Word Var_10,
  MR_Word ActualInst_11,
  MR_Word ExpectedInst_12,
  MR_Word Reason_13);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_bind_locked_var_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word Reason_8,
  MR_Word Var_9,
  MR_Word VarInst_10,
  MR_Word Inst_11);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_nonground_trace_goal_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_nonground_trace_goal_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word HeadNGVar_6,
  MR_Word TailNGVars_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_4(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_3(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word Errors_5);

static void MR_CALL 
check_hlds__mode_errors__classify_bound_functor_cons_id_errors_7_p_0(
  MR_Word HeadVar__1_1,
  MR_Word STATE_VARIABLE_InputBadConsIds_0_2,
  MR_Word * STATE_VARIABLE_InputBadConsIds_3,
  MR_Word STATE_VARIABLE_InputBadInstArityConsIds_0_4,
  MR_Word * STATE_VARIABLE_InputBadInstArityConsIds_5,
  MR_Word STATE_VARIABLE_ResultBadConsIds_0_6,
  MR_Word * STATE_VARIABLE_ResultBadConsIds_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_merge_disj_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_merge_disj_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word MergeContext_6,
  MR_Word MergeErrors_7);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_bad_higher_order_inst_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word PredVar_9,
  MR_Word PredVarInst_10,
  MR_Word ExpectedPredOrFunc_11,
  MR_Word ExpectedUserArity_12,
  MR_Word Mismatch_13);

static void MR_CALL 
check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3,
  MR_Box * wrapper_arg_4);

static void MR_CALL 
check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3,
  MR_Box * wrapper_arg_4);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word MatchWhat_9,
  MR_Word InstMap_10,
  MR_Word Vars_11,
  MR_Word HeadMismatch_12,
  MR_Word TailMismatches_13);

static void MR_CALL 
check_hlds__mode_errors__report_bound_inst_vars_4_p_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box * wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors__report_bound_inst_vars_4_p_0(
  MR_Word InstVarSet_1,
  MR_Word HeadVar__2_2,
  MR_Integer ProcNum_3,
  MR_Word * HeadVar__4_4);

static MR_Box MR_CALL 
check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static void MR_CALL 
check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0(
  MR_Word ModeInfo_1,
  MR_Word OkOrNotMap_2,
  MR_Word NeverOkArgNums_3,
  MR_Word PredOrFunc_4,
  MR_Integer NumExtra_5,
  MR_Integer ArgNumMinus_6,
  MR_Word HeadVar__7_7,
  MR_Word * HeadVar__8_8,
  MR_Word * HeadVar__9_9,
  MR_Word * HeadVar__10_10);

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word ShortInstQF_9,
  MR_Word ShortInstSuffix_10,
  MR_Word LongInstPrefix_11,
  MR_Word LongInstSuffix_12,
  MR_Word Inst0_13);

static void MR_CALL 
check_hlds__mode_errors__find_satisfied_initial_insts_in_procs_6_p_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3,
  MR_Integer HeadVar__4_4,
  MR_Word STATE_VARIABLE_OkOrNotMap_0_5,
  MR_Word * STATE_VARIABLE_OkOrNotMap_6);

static void MR_CALL 
check_hlds__mode_errors__find_satisfied_initial_insts_in_proc_6_p_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3,
  MR_Integer HeadVar__4_4,
  MR_Word STATE_VARIABLE_OkOrNotMap_0_5,
  MR_Word * STATE_VARIABLE_OkOrNotMap_6);

static void MR_CALL 
check_hlds__mode_errors__construct_argnum_var_type_inst_tuples_5_p_0(
  MR_Word VarTable_1,
  MR_Word InstMap_2,
  MR_Integer ArgNum_3,
  MR_Word HeadVar__4_4,
  MR_Word * HeadVar__5_5);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_callee_pred_has_no_mode_decl_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word PredId_5);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_clobbered_var_is_live_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word Var_5);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_var_is_not_sufficiently_instantiated_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word Var_8,
  MR_Word VarInst_9,
  MR_Word ExpectedInst_10,
  MR_Word MaybeMultiModeError_11);

static MR_Word MR_CALL 
check_hlds__mode_errors__has_inst_expected_inst_was_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word ActualInst_6,
  MR_Word ExpectedInst_7);

static MR_bool MR_CALL 
check_hlds__mode_errors__inst_has_uniqueness_2_p_0(
  MR_Word Inst_3,
  MR_Word SearchUniq_4);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_higher_order_unify_to_spec_5_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_higher_order_unify_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word LHSVar_8,
  MR_Word RHS_9,
  MR_Word Type_10,
  MR_Word PredOrFunc_11);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_non_ground_non_local_lambda_var_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word Var_6,
  MR_Word VarInst_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word X_6,
  MR_Word PredMultiModeError_7);

static MR_Box MR_CALL 
check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1);

static MR_bool MR_CALL 
check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box * wrapper_arg_2);

static MR_Word MR_CALL 
check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0(
  MR_Word VarTable_5,
  MR_Word Color_6,
  MR_Word Vars_7);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_lambda_to_spec_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word X_7,
  MR_Word InstX_8,
  MR_Word InstY_9);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_functor_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word X_9,
  MR_Word ConsId_10,
  MR_Word ArgVars_11,
  MR_Word InstX_12,
  MR_Word ArgInsts_13);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_poly_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word Var_6,
  MR_Word VarInst_7);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_var_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word X_8,
  MR_Word Y_9,
  MR_Word InstX_10,
  MR_Word InstY_11);

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_info_context_preamble_1_f_0(
  MR_Word ModeInfo_3);

static MR_Word MR_CALL 
check_hlds__mode_errors__has_instantiatedness_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word MaybeColor_7,
  MR_Word Inst_8,
  MR_String Suffix_9);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____arg_ok_or_not_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____arg_ok_or_not_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____argnum_var_type_inst_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____argnum_var_type_inst_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____bound_functor_cons_id_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____bound_functor_cons_id_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____cannot_create_reason_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____cannot_create_reason_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_reason_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_reason_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_term_path_step_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_term_path_step_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____delayed_goal_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____delayed_goal_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____exact_or_not_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____exact_or_not_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____final_inst_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____final_inst_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ground_or_nonground_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____ground_or_nonground_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____higher_order_mismatch_info_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____higher_order_mismatch_info_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____match_what_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____match_what_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_is_disjunctive_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_is_disjunctive_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_some_extra_arg_is_bad_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_some_extra_arg_is_bad_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____merge_context_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____merge_context_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____merge_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____merge_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_info_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_info_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_unify_rhs_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_unify_rhs_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_mismatch_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_mismatch_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_warning_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_warning_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_warning_info_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_warning_info_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____negated_context_desc_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____negated_context_desc_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ok_or_not_map_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____ok_or_not_map_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____pred_id_var_multimode_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____pred_id_var_multimode_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____report_inst_how_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____report_inst_how_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____schedule_culprit_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____schedule_culprit_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____var_multimode_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2);

static void MR_CALL 
check_hlds__mode_errors____Compare____var_multimode_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3);


static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_1[580][2];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_2[8][5];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_3[12][3];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_4[12][1];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_5[4][6];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_6[2][8];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_7[3][7];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_8[1][4];

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_9[1][10];




static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_1[580][2] = {
  /* row   0 */
  {
    ((MR_Box) (&mercury__term__term__type_ctor_info_var_1)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_prog_var_type_0))
  },
  /* row   1 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0))
  },
  /* row   2 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
  /* row   3 */
  {
    ((MR_Box) (&mercury__term__term__type_ctor_info_var_1)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0))
  },
  /* row   4 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0))
  },
  /* row   5 */
  {
    ((MR_Box) (&mercury__set_ordlist__set_ordlist__type_ctor_info_set_ordlist_1)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0))
  },
  /* row   6 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0))
  },
  /* row   7 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0))
  },
  /* row   8 */
  {
    ((MR_Box) (&parse_tree__set_of_var__parse_tree__set_of_var__type_ctor_info_set_of_var_1)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_prog_var_type_0))
  },
  /* row   9 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_3[0]))
  },
  /* row  10 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_0))
  },
  /* row  11 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_1[0]))
  },
  /* row  12 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0))
  },
  /* row  13 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_info_0))
  },
  /* row  14 */
  {
    ((MR_Box) (&mercury__one_or_more__one_or_more__type_ctor_info_one_or_more_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0))
  },
  /* row  15 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_mismatch_0))
  },
  /* row  16 */
  {
    ((MR_Box) (&mercury__one_or_more__one_or_more__type_ctor_info_one_or_more_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0))
  },
  /* row  17 */
  {
    ((MR_Box) (&mercury__maybe__maybe__type_ctor_info_maybe_1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0))
  },
  /* row  18 */
  {
    ((MR_Box) (&mercury__one_or_more__one_or_more__type_ctor_info_one_or_more_1)),
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_1[0]))
  },
  /* row  19 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_from_to_insts_0))
  },
  /* row  20 */
  {
    ((MR_Box) (&mercury__set_ordlist__set_ordlist__type_ctor_info_set_ordlist_1)),
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_1[3]))
  },
  /* row  21 */
  {
    ((MR_Box) (&mercury__list__list__type_ctor_info_list_1)),
    ((MR_Box) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_proc_id_0))
  },
  /* row  22 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error in unification of"))
  },
  /* row  23 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and"))
  },
  /* row  24 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Variable"))
  },
  /* row  25 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[24]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  26 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[25])))
  },
  /* row  27 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) "."))
  },
  /* row  28 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[27]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[26])))
  },
  /* row  29 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "variable"))
  },
  /* row  30 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[29]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  31 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "ground"))
  },
  /* row  32 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[31]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  33 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "or"))
  },
  /* row  34 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[33]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  35 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[27]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  36 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "any"))
  },
  /* row  37 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[36]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])))
  },
  /* row  38 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error: variable"))
  },
  /* row  39 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[38]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  40 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[39])))
  },
  /* row  41 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in polymorphically-typed unification:"))
  },
  /* row  42 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[41]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[40])))
  },
  /* row  43 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "expected instantiatedness was"))
  },
  /* row  44 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[43]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  45 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  46 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "partially instantiated modes are not allowed."))
  },
  /* row  47 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[46]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  48 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Unifications of polymorphically-typed variables with"))
  },
  /* row  49 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[48]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[47])))
  },
  /* row  50 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) ")."))
  },
  /* row  51 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[50]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[49])))
  },
  /* row  52 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[36]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[51])))
  },
  /* row  53 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "be ground (or have inst"))
  },
  /* row  54 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[53]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[52])))
  },
  /* row  55 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "will not be known until runtime, the variables must both"))
  },
  /* row  56 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[55]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[54])))
  },
  /* row  57 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "When unifying two variables whose type"))
  },
  /* row  58 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[57]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[56])))
  },
  /* row  59 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "term"))
  },
  /* row  60 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[59]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  61 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and lambda expression."))
  },
  /* row  62 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[61]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[26])))
  },
  /* row  63 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "lambda expression"))
  },
  /* row  64 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[63]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  65 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and higher-order term based on multi-moded"))
  },
  /* row  66 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[27]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row  67 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "more than one"))
  },
  /* row  68 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[67]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  69 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "specifically the"))
  },
  /* row  70 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[69]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  71 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) ","))
  },
  /* row  72 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[71]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[70])))
  },
  /* row  73 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "not match any"))
  },
  /* row  74 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[73]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  75 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The"))
  },
  /* row  76 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "of the argument"))
  },
  /* row  77 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "of the called"))
  },
  /* row  78 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "modes"))
  },
  /* row  79 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[78]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  80 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) "\'s"))
  },
  /* row  81 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[80]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[79])))
  },
  /* row  82 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The higher order argument"))
  },
  /* row  83 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "should be ground,"))
  },
  /* row  84 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[83]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  85 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "but"))
  },
  /* row  86 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[85]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  87 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "are not."))
  },
  /* row  88 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[87]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  89 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "including"))
  },
  /* row  90 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "of lambda goals is"))
  },
  /* row  91 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[90]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  92 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "expected instantiatedness for non-local variables"))
  },
  /* row  93 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[92]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[91])))
  },
  /* row  94 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[31]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])))
  },
  /* row  95 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "In unification of"))
  },
  /* row  96 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[95]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  97 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "with"))
  },
  /* row  98 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[97]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row  99 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) ":"))
  },
  /* row 100 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[99]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 101 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error: you cannot unify two higher-order values."))
  },
  /* row 102 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "These two terms have type"))
  },
  /* row 103 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Your code is trying to test whether two"))
  },
  /* row 104 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "are equal, by unifying them."))
  },
  /* row 105 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "In the general case, testing equivalence of"))
  },
  /* row 106 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "PredA = PredB"))
  },
  /* row 107 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[106]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])))
  },
  /* row 108 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "instead of"))
  },
  /* row 109 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[108]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[107])))
  },
  /* row 110 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[71]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[109])))
  },
  /* row 111 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "all [X] call(PredA, X) <=> call(PredB, X)"))
  },
  /* row 112 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[111]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[110])))
  },
  /* row 113 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "writing an explicit universal quantification, e.g."))
  },
  /* row 114 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[113]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[112])))
  },
  /* row 115 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "In some cases, you can achieve the same effect by"))
  },
  /* row 116 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[115]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[114])))
  },
  /* row 117 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and so this is not allowed by the Mercury mode system."))
  },
  /* row 118 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[117]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[116])))
  },
  /* row 119 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "is an undecidable problem,"))
  },
  /* row 120 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[119]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[118])))
  },
  /* row 121 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "is usually caused by doing"))
  },
  /* row 122 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[121]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 123 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "This kind of uniqueness mismatch"))
  },
  /* row 124 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[123]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[122])))
  },
  /* row 125 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "input/output"))
  },
  /* row 126 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[125]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 127 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "destructive update"))
  },
  /* row 128 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[127]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 129 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "some other kind of"))
  },
  /* row 130 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[129]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[128])))
  },
  /* row 131 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "it can be backtracked over,"))
  },
  /* row 132 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[131]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 133 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in a context where"))
  },
  /* row 134 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[133]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[132])))
  },
  /* row 135 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "that is intended to be a"))
  },
  /* row 136 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[135]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 137 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Note that it is possible that the cause is code"))
  },
  /* row 138 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[137]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[136])))
  },
  /* row 139 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[138])))
  },
  /* row 140 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "such as the condition of an if-then-else."))
  },
  /* row 141 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[140]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[139])))
  },
  /* row 142 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "call"))
  },
  /* row 143 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[142]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 144 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has been accidentally turned into a"))
  },
  /* row 145 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[144]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 146 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "to the current predicate or function, but"))
  },
  /* row 147 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[146]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[145])))
  },
  /* row 148 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "clause"))
  },
  /* row 149 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[148]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 150 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "that replaces a comma by a period."))
  },
  /* row 151 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[150]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 152 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "for it by a typo at the end of the previous line"))
  },
  /* row 153 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[152]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[151])))
  },
  /* row 154 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the following error."))
  },
  /* row 155 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[154]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 156 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "This may have been caused by"))
  },
  /* row 157 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[156]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[155])))
  },
  /* row 158 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "would clobber its argument, but variable"))
  },
  /* row 159 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[158]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 160 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "unique-mode error: the called procedure"))
  },
  /* row 161 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[160]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[159])))
  },
  /* row 162 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "is"))
  },
  /* row 163 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[162]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 164 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "still live."))
  },
  /* row 165 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[164]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 166 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "error: there is"))
  },
  /* row 167 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[166]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 168 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "no mode declaration"))
  },
  /* row 169 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[168]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 170 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "for"))
  },
  /* row 171 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[170]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 172 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error:"))
  },
  /* row 173 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[172]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 174 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the"))
  },
  /* row 175 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "of"))
  },
  /* row 176 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "not match"))
  },
  /* row 177 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[176]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 178 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the input mode required for values being cast."))
  },
  /* row 179 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[178]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 180 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the input mode required for event arguments."))
  },
  /* row 181 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[180]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 182 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the mode of"))
  },
  /* row 183 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[182]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 184 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the only mode of"))
  },
  /* row 185 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "either of the two modes of"))
  },
  /* row 186 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "any of the"))
  },
  /* row 187 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the input mode required for unifications."))
  },
  /* row 188 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[187]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 189 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "its own mode declaration.)"))
  },
  /* row 190 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[189]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 191 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the caller loses the generality promised by"))
  },
  /* row 192 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[191]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[190])))
  },
  /* row 193 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "(If a call binds an inst variable, then"))
  },
  /* row 194 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[193]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[192])))
  },
  /* row 195 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 39U)),
    ((MR_Box) ((MR_Integer) 1))
  },
  /* row 196 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 197 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 39U)),
    ((MR_Box) ((MR_Integer) -1))
  },
  /* row 198 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[197]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 199 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[174]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 200 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "return value"))
  },
  /* row 201 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[200]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 202 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "argument,"))
  },
  /* row 203 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[202]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 204 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The inst of the compiler-generated"))
  },
  /* row 205 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[71]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 206 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The inst of the"))
  },
  /* row 207 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[206]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 208 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "which is"))
  },
  /* row 209 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[208]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 210 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[71]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])))
  },
  /* row 211 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "some of the modes of the callee, namely the"))
  },
  /* row 212 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[211]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 213 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the inst required by"))
  },
  /* row 214 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[213]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[212])))
  },
  /* row 215 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the required inst."))
  },
  /* row 216 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[215]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 217 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "any of the required insts."))
  },
  /* row 218 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[217]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 219 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "being different in the inst than in the type.)"))
  },
  /* row 220 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[219]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 221 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the arity of the predicate or function"))
  },
  /* row 222 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[221]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[220])))
  },
  /* row 223 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the mismatch is sometimes caused by"))
  },
  /* row 224 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[223]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[222])))
  },
  /* row 225 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "(For higher order insts like this,"))
  },
  /* row 226 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[225]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[224])))
  },
  /* row 227 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "does not match"))
  },
  /* row 228 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[227]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 229 */
  {
    ((MR_Box) ((MR_Unsigned) 16U)),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 230 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The mode"))
  },
  /* row 231 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[230]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 232 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode"))
  },
  /* row 233 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[232]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 234 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "because it binds the inst"))
  },
  /* row 235 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "free variable."))
  },
  /* row 236 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[235]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 237 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "is a"))
  },
  /* row 238 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[237]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 239 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and the type of"))
  },
  /* row 240 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[239]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 241 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "does match that expectation."))
  },
  /* row 242 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "However, to check the correctness of the call,"))
  },
  /* row 243 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the compiler also needs to know"))
  },
  /* row 244 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the modes of the arguments and the determinism"))
  },
  /* row 245 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "of the"))
  },
  /* row 246 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "that"))
  },
  /* row 247 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "should contain this information, but"))
  },
  /* row 248 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[247]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 249 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The insts of higher order values"))
  },
  /* row 250 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[249]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[248])))
  },
  /* row 251 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "represents."))
  },
  /* row 252 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[251]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[250])))
  },
  /* row 253 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "which is the inst of"))
  },
  /* row 254 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "at this point,"))
  },
  /* row 255 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[254]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 256 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "does not."))
  },
  /* row 257 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[256]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 258 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "(when returning a value of type callback_t as output)"))
  },
  /* row 259 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[258]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])))
  },
  /* row 260 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "out(callback_i)"))
  },
  /* row 261 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[260]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[259])))
  },
  /* row 262 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "or the mode"))
  },
  /* row 263 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[262]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[261])))
  },
  /* row 264 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "(when taking a value of type callback_t as input)"))
  },
  /* row 265 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[264]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[263])))
  },
  /* row 266 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "in(callback_i)"))
  },
  /* row 267 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[266]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[265])))
  },
  /* row 268 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "either the mode"))
  },
  /* row 269 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[268]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[267])))
  },
  /* row 270 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "by specifying"))
  },
  /* row 271 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[270]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[269])))
  },
  /* row 272 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "a value of type callback_t has inst callback_i"))
  },
  /* row 273 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[272]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[271])))
  },
  /* row 274 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "You can then tell the compiler that"))
  },
  /* row 275 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[274]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[273])))
  },
  /* row 276 */
  {
    ((MR_Box) ((MR_Unsigned) 16U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[275])))
  },
  /* row 277 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[276])))
  },
  /* row 278 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "for a corresponding example for functions."))
  },
  /* row 279 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[278]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[277])))
  },
  /* row 280 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "chapter for higher order programming"))
  },
  /* row 281 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[280]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[279])))
  },
  /* row 282 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in the Mercury language reference manual\'s"))
  },
  /* row 283 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[282]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[281])))
  },
  /* row 284 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Search for \140higher order inst\'"))
  },
  /* row 285 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[284]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[283])))
  },
  /* row 286 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and the determinism of a predicate."))
  },
  /* row 287 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[286]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[285])))
  },
  /* row 288 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the modes of the arguments"))
  },
  /* row 289 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[288]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[287])))
  },
  /* row 290 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "a higher order inst, specifies both"))
  },
  /* row 291 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[290]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[289])))
  },
  /* row 292 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "This inst, which is usually called"))
  },
  /* row 293 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[292]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[291])))
  },
  /* row 294 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[197]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[293])))
  },
  /* row 295 */
  {
    ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[5]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[294])))
  },
  /* row 296 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[295])))
  },
  /* row 297 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "you would define a corresponding inst, such as"))
  },
  /* row 298 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[297]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[296])))
  },
  /* row 299 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[197]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[298])))
  },
  /* row 300 */
  {
    ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[6]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[299])))
  },
  /* row 301 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[300])))
  },
  /* row 302 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "For example, given a higher order type such as"))
  },
  /* row 303 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[302]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[301])))
  },
  /* row 304 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The fix for this error is to add this information."))
  },
  /* row 305 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[304]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[303])))
  },
  /* row 306 */
  {
    ((MR_Box) ((MR_Unsigned) 16U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[305])))
  },
  /* row 307 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "but the type of"))
  },
  /* row 308 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[307]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 309 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "not a higher order type."))
  },
  /* row 310 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[309]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 311 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has"))
  },
  /* row 312 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[311]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 313 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "variable."))
  },
  /* row 314 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[313]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 315 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error: context requires a"))
  },
  /* row 316 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[315]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 317 */
  {
    (MR_Box) ((MR_Unsigned) 0U),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 318 */
  {
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[317]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 319 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error in conjunction. The next"))
  },
  /* row 320 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "indicate possible causes of this error."))
  },
  /* row 321 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[320]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 322 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "error messages"))
  },
  /* row 323 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[322]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[321])))
  },
  /* row 324 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "because it was impure."))
  },
  /* row 325 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[324]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 326 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The goal could not be reordered,"))
  },
  /* row 327 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[326]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[325])))
  },
  /* row 328 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "because it was followed by an impure goal."))
  },
  /* row 329 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[328]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 330 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[326]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[329])))
  },
  /* row 331 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "This is the location of the impure goal."))
  },
  /* row 332 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[331]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 333 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Floundered goal, waiting on {"))
  },
  /* row 334 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "}:"))
  },
  /* row 335 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[334]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 336 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "parallel conjunctions to fail.)"))
  },
  /* row 337 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[336]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 338 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "(The current implementation does not permit"))
  },
  /* row 339 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[338]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[337])))
  },
  /* row 340 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in parallel conjunction."))
  },
  /* row 341 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[340]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[339])))
  },
  /* row 342 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error: mutually exclusive bindings"))
  },
  /* row 343 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[342]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[341])))
  },
  /* row 344 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "error:"))
  },
  /* row 345 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[344]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 346 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode mismatch"))
  },
  /* row 347 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[346]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 348 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in"))
  },
  /* row 349 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "coerced term"))
  },
  /* row 350 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in the coerced term:"))
  },
  /* row 351 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[350]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 352 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "coerced subterm"))
  },
  /* row 353 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the following function"))
  },
  /* row 354 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "not part of the result type:"))
  },
  /* row 355 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[354]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 356 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in the input term\'s instantiatedness:"))
  },
  /* row 357 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[356]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])))
  },
  /* row 358 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "not part of the input type:"))
  },
  /* row 359 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[358]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 360 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "cannot convert"))
  },
  /* row 361 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[360]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 362 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "from type"))
  },
  /* row 363 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "to"))
  },
  /* row 364 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "because"))
  },
  /* row 365 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[364]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 366 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "because it has instantiatedness"))
  },
  /* row 367 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[366]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 368 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[23]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 369 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "is not a subtype of"))
  },
  /* row 370 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has instantiatedness"))
  },
  /* row 371 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[370]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 372 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "but it must have a"))
  },
  /* row 373 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[372]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 374 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "ground"))
  },
  /* row 375 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[374]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 376 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "inst."))
  },
  /* row 377 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[376]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 378 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in the argument"))
  },
  /* row 379 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[378]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 380 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in the"))
  },
  /* row 381 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "argument"))
  },
  /* row 382 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[381]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 383 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "of function symbol"))
  },
  /* row 384 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[99]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 385 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 7U)),
    ((MR_Box) ((MR_String) "("))
  },
  /* row 386 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[385]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 387 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "should be"))
  },
  /* row 388 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[387]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 389 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) ";"))
  },
  /* row 390 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[389]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[388])))
  },
  /* row 391 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 8U)),
    ((MR_Box) ((MR_String) ")"))
  },
  /* row 392 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[391]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 393 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "error: the"))
  },
  /* row 394 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "whose value the trace goal"))
  },
  /* row 395 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "expects to get from the surrounding code,"))
  },
  /* row 396 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "not ground"))
  },
  /* row 397 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[396]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 398 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "at entry to the trace goal."))
  },
  /* row 399 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[398]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 400 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "scope error:"))
  },
  /* row 401 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "An atomic goal"))
  },
  /* row 402 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[401]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 403 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "may not use"))
  },
  /* row 404 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[403]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 405 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the state variables"))
  },
  /* row 406 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[405]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 407 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "belonging to the outer scope."))
  },
  /* row 408 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[407]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 409 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "allowed to bind only variables which are"))
  },
  /* row 410 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[409]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 411 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The condition of an if-then-else is"))
  },
  /* row 412 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[411]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[410])))
  },
  /* row 413 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "local to the condition,"))
  },
  /* row 414 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[413]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 415 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "or which occur"))
  },
  /* row 416 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[415]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 417 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "part."))
  },
  /* row 418 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[417]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 419 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "then"))
  },
  /* row 420 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[419]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[418])))
  },
  /* row 421 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and the"))
  },
  /* row 422 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[421]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[420])))
  },
  /* row 423 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "only in the condition"))
  },
  /* row 424 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[423]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[422])))
  },
  /* row 425 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "A lambda goal is allowed to bind only"))
  },
  /* row 426 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[425]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 427 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "its arguments"))
  },
  /* row 428 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[427]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 429 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "lambda expression."))
  },
  /* row 430 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[429]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 431 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "variables local to the"))
  },
  /* row 432 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[431]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[430])))
  },
  /* row 433 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "which are"))
  },
  /* row 434 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[433]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 435 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "A negation is allowed to bind only variables"))
  },
  /* row 436 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[435]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[434])))
  },
  /* row 437 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "local to the negation,"))
  },
  /* row 438 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[437]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 439 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "inside the scope of the negation."))
  },
  /* row 440 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[439]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 441 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "implicitly existentially quantified"))
  },
  /* row 442 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[441]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[440])))
  },
  /* row 443 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "i.e. those which are"))
  },
  /* row 444 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[443]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[442])))
  },
  /* row 445 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "may not be bound in"))
  },
  /* row 446 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[445]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 447 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "A nonlocal variable of a parallel conjunction"))
  },
  /* row 448 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[447]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[446])))
  },
  /* row 449 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "two or more conjuncts."))
  },
  /* row 450 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[449]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 451 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "A trace goal is allowed to bind only"))
  },
  /* row 452 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[451]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 453 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "local to the trace goal."))
  },
  /* row 454 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[453]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 455 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "variables which are"))
  },
  /* row 456 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[455]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[454])))
  },
  /* row 457 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the function result"))
  },
  /* row 458 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[457]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 459 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "compiler-generated argument"))
  },
  /* row 460 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Final instantiatedness of"))
  },
  /* row 461 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[460]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 462 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[461])))
  },
  /* row 463 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "was"))
  },
  /* row 464 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[463]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 465 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[71]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 466 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "expected final instantiatedness was"))
  },
  /* row 467 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[466]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 468 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[27]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])))
  },
  /* row 469 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error: argument"))
  },
  /* row 470 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[469]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 471 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has the following inst:"))
  },
  /* row 472 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[471]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 473 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "mode error: arguments"))
  },
  /* row 474 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[473]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 475 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "have the following insts:"))
  },
  /* row 476 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[475]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 477 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "which does not match any of the valid modes for"))
  },
  /* row 478 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[477]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 479 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[197]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[478])))
  },
  /* row 480 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the callee"))
  },
  /* row 481 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[480]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[386])))
  },
  /* row 482 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "because of the following error."))
  },
  /* row 483 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[482]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 484 */
  {
    ((MR_Box) ((MR_Unsigned) 12U)),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[483])))
  },
  /* row 485 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[391]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[484])))
  },
  /* row 486 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "the callee, because of the following error."))
  },
  /* row 487 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[486]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 488 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "copying a partially instantiated term"))
  },
  /* row 489 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[488]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 490 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "initializing a solver variable"))
  },
  /* row 491 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[490]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 492 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "cannot implement implied modes that require"))
  },
  /* row 493 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[492]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 494 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "sorry, the compiler currently"))
  },
  /* row 495 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[494]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[493])))
  },
  /* row 496 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "a promise_purity scope, because non-local variable"))
  },
  /* row 497 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[496]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 498 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "purity error: if-then-else should be inside"))
  },
  /* row 499 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[498]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[497])))
  },
  /* row 500 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has inst"))
  },
  /* row 501 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[500]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 502 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[36]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 503 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and appears in the condition."))
  },
  /* row 504 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[503]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 505 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "purity error: negation should be inside"))
  },
  /* row 506 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[505]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[497])))
  },
  /* row 507 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "and appears in the body."))
  },
  /* row 508 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[507]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 509 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "whose inst contains"))
  },
  /* row 510 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[509]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 511 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[29]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[510])))
  },
  /* row 512 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "whose insts contain"))
  },
  /* row 513 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[512]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 514 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "variables"))
  },
  /* row 515 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[514]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[513])))
  },
  /* row 516 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "but contains the following non-local"))
  },
  /* row 517 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[516]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 518 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[31]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[517])))
  },
  /* row 519 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "purity error: lambda is"))
  },
  /* row 520 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[519]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[518])))
  },
  /* row 521 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[36]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[100])))
  },
  /* row 522 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "any_func(Args) = Result is det :- ..."))
  },
  /* row 523 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[522]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])))
  },
  /* row 524 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "can be written"))
  },
  /* row 525 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[524]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[523])))
  },
  /* row 526 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[36]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[525])))
  },
  /* row 527 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Function expressions with inst"))
  },
  /* row 528 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[527]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[526])))
  },
  /* row 529 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[27]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[528])))
  },
  /* row 530 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 0U)),
    ((MR_Box) ((MR_String) "any_pred(Args) is det :- ..."))
  },
  /* row 531 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[530]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[529])))
  },
  /* row 532 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[524]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[531])))
  },
  /* row 533 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[36]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[532])))
  },
  /* row 534 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "with inst"))
  },
  /* row 535 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[534]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[533])))
  },
  /* row 536 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "Predicate expressions"))
  },
  /* row 537 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[536]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[535])))
  },
  /* row 538 */
  {
    (MR_Box) ((MR_Unsigned) 1U),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[537])))
  },
  /* row 539 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "The variable"))
  },
  /* row 540 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[539]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 541 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "out of"))
  },
  /* row 542 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "branches."))
  },
  /* row 543 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[542]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 544 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "It has the following instantiation states."))
  },
  /* row 545 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[544]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 546 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "in the following branches."))
  },
  /* row 547 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[546]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 548 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "It has non-ground instantiation states"))
  },
  /* row 549 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[548]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[547])))
  },
  /* row 550 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "is ground in some branches but not others."))
  },
  /* row 551 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[550]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 552 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has the following instantiation states."))
  },
  /* row 553 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[552]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 554 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "In this branch,"))
  },
  /* row 555 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has the ground instantiatedness"))
  },
  /* row 556 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[555]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 557 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "has the non-ground instantiatedness"))
  },
  /* row 558 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[557]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 559 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 39U)),
    ((MR_Box) ((MR_Integer) -2))
  },
  /* row 560 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[559]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 561 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[27]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[560])))
  },
  /* row 562 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "warning: unification of"))
  },
  /* row 563 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[562]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 564 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "cannot succeed."))
  },
  /* row 565 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[564]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])))
  },
  /* row 566 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "cannot succeed, because"))
  },
  /* row 567 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[566]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 568 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "to a term containing itself."))
  },
  /* row 569 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[568]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 570 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "cannot be equal"))
  },
  /* row 571 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[570]))),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[569])))
  },
  /* row 572 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "type class method implementation for"))
  },
  /* row 573 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[572]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 574 */
  {
    ((MR_Box) (MR_Word) ((MR_Unsigned) 9U)),
    ((MR_Box) ((MR_String) "In clause for"))
  },
  /* row 575 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[574]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 576 */
  {
    ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[348]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 577 */
  {
    (MR_Box) ((MR_Unsigned) 1U),
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[58])))
  },
  /* row 578 */
  {
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[577]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
  /* row 579 */
  {
    ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[538]))),
    ((MR_Box) ((MR_Unsigned) 0U))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_2[8][5] = {
  /* row   0 */
  {
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_tuple_0)),
    ((MR_Box) ((MR_Integer) 3)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0))
  },
  /* row   1 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_string_0)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
  /* row   2 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
  /* row   3 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_from_to_insts_0)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_mode_0))
  },
  /* row   4 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_string_0))
  },
  /* row   5 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
  /* row   6 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
  /* row   7 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 2)),
    ((MR_Box) (&check_hlds__mode_errors____vpti_tuple_3__plain_parse_tree__prog_data__type_ctor_info_cons_id_0__plain_builtin__type_ctor_info_int_0__plain_builtin__type_ctor_info_int_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_3[12][3] = {
  /* row   0 */
  {
    ((MR_Box) (&mercury__pair__pair__type_ctor_info_pair_2)),
    ((MR_Box) (&mercury__term_context__term_context__type_ctor_info_term_context_0)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0))
  },
  /* row   1 */
  {
    ((MR_Box) (&mercury__tree234__tree234__type_ctor_info_tree234_2)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0))
  },
  /* row   2 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[1])),
    ((MR_Box) (check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0_2)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   3 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[2])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0_1)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   4 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[3])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_higher_order_unify_to_spec_5_f_0_1)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   5 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[4])),
    ((MR_Box) (check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0_1)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   6 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_7[0])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0_2)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   7 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[5])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_1)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   8 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[6])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_2)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row   9 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[7])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_3)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row  10 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_2[6])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_4)),
    ((MR_Box) ((MR_Integer) 0))
  },
  /* row  11 */
  {
    ((MR_Box) (&check_hlds__mode_errors_scalar_common_8[0])),
    ((MR_Box) (check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_1)),
    ((MR_Box) ((MR_Integer) 0))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_4[12][1] = {
  /* row   0 */
  { ((MR_Box) ((MR_Integer) 3)) },
  /* row   1 */
  { (MR_Box) ((MR_Unsigned) 0U) },
  /* row   2 */
  { ((MR_Box) ((MR_Integer) 2)) },
  /* row   3 */
  { ((MR_Box) ((MR_String) "FAKE_CONS_ID")) },
  /* row   4 */
  { ((MR_Box) ((MR_Integer) 0)) },
  /* row   5 */
  { ((MR_Box) ((MR_String) ":- inst callback_i == (pred(in, out, di, uo) is det).")) },
  /* row   6 */
  { ((MR_Box) ((MR_String) ":- type callback_t == (pred(world, world, io, io)).")) },
  /* row   7 */
  { (MR_Box) ((MR_Unsigned) 271U) },
  /* row   8 */
  { ((MR_Box) ((MR_Integer) 0)) },
  /* row   9 */
  { ((MR_Box) ((MR_Integer) 1)) },
  /* row  10 */
  { (MR_Box) ((MR_Unsigned) 1U) },
  /* row  11 */
  { (MR_Box) ((MR_Unsigned) 186U) },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_5[4][6] = {
  /* row   0 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 3)),
    ((MR_Box) (&parse_tree__var_table__parse_tree__var_table__type_ctor_info_var_table_0)),
    ((MR_Box) (&check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_prog_var_type_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_string_0))
  },
  /* row   1 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 3)),
    ((MR_Box) (&check_hlds__mode_errors__varset__pti_varset_1__plain_parse_tree__prog_data__type_ctor_info_inst_var_type_0)),
    ((MR_Box) (&check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_inst_var_type_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_string_0))
  },
  /* row   2 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 3)),
    ((MR_Box) (&parse_tree__var_table__parse_tree__var_table__type_ctor_info_var_table_0)),
    ((MR_Box) (&check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_prog_var_type_0)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0))
  },
  /* row   3 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 3)),
    ((MR_Box) (&mercury__term_context__term_context__type_ctor_info_term_context_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_error_msg_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_error_msg_0))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_6[2][8] = {
  /* row   0 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 5)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_some_extra_arg_is_bad_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_some_extra_arg_is_bad_0))
  },
  /* row   1 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 5)),
    ((MR_Box) (&check_hlds__mode_info__check_hlds__mode_info__type_ctor_info_mode_info_0)),
    ((MR_Box) (&mercury__term_context__term_context__type_ctor_info_term_context_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_is_disjunctive_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_error_msg_0))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_7[3][7] = {
  /* row   0 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 4)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_int_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_builtin__type_ctor_info_int_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_builtin__type_ctor_info_int_0))
  },
  /* row   1 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 4)),
    ((MR_Box) (&parse_tree__var_table__parse_tree__var_table__type_ctor_info_var_table_0)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_var_name_print_0)),
    ((MR_Box) (&check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_prog_var_type_0)),
    ((MR_Box) (&mercury__builtin__builtin__type_ctor_info_string_0))
  },
  /* row   2 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 4)),
    ((MR_Box) (&mercury__term_context__term_context__type_ctor_info_term_context_0)),
    ((MR_Box) (&check_hlds__mode_info__check_hlds__mode_info__type_ctor_info_mode_info_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0)),
    ((MR_Box) (&check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_error_msg_0))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_8[1][4] = {
  /* row   0 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 1)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0))
  },
};

static /* final */ const MR_Box check_hlds__mode_errors_scalar_common_9[1][10] = {
  /* row   0 */
  {
    NULL,
    ((MR_Box) (NULL)),
    ((MR_Box) ((MR_Integer) 7)),
    ((MR_Box) (&check_hlds__mode_info__check_hlds__mode_info__type_ctor_info_mode_info_0)),
    ((MR_Box) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_report_inst_how_0)),
    ((MR_Box) (&check_hlds__mode_errors__maybe__pti_maybe_1__plain_parse_tree__error_spec__type_ctor_info_color_name_0)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0)),
    ((MR_Box) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_type_0)),
    ((MR_Box) (&check_hlds__mode_errors__pair__pti_pair_2__plain_term_context__type_ctor_info_term_context_0__plain_parse_tree__prog_data__type_ctor_info_mer_inst_0)),
    ((MR_Box) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0))
  },
};



#include "array.mh"
#include "bitmap.mh"
#include "io.mh"
#include "string.mh"
#include "time.mh"
#include "io.stream_ops.mh"


static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_prog_var_type_0 = {
  &mercury__term__term__type_ctor_info_var_1,
  { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_prog_var_type_0) }
};

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__varset__pti_varset_1__plain_parse_tree__prog_data__type_ctor_info_inst_var_type_0 = {
  &mercury__varset__varset__type_ctor_info_varset_1,
  { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0) }
};

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__term__pti_var_1__plain_parse_tree__prog_data__type_ctor_info_inst_var_type_0 = {
  &mercury__term__term__type_ctor_info_var_1,
  { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0) }
};

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__list__pti_list_1__plain_builtin__type_ctor_info_int_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0) }
};

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_error_msg_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_PseudoTypeInfo) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0) }
};

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__list__pti_list_1__plain_parse_tree__error_spec__type_ctor_info_format_piece_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_PseudoTypeInfo) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0) }
};

static const MR_VA_PseudoTypeInfo_Struct3 check_hlds__mode_errors____vpti_tuple_3__plain_parse_tree__prog_data__type_ctor_info_cons_id_0__plain_builtin__type_ctor_info_int_0__plain_builtin__type_ctor_info_int_0 = {
  &mercury__builtin__builtin__type_ctor_info_tuple_0,
  (MR_Integer) 3,
  {
    (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0),
    (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
    (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0)
  }
};

static const MR_FA_PseudoTypeInfo_Struct1 check_hlds__mode_errors__maybe__pti_maybe_1__plain_parse_tree__error_spec__type_ctor_info_color_name_0 = {
  &mercury__maybe__maybe__type_ctor_info_maybe_1,
  { (MR_PseudoTypeInfo) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_color_name_0) }
};

static const MR_FA_PseudoTypeInfo_Struct2 check_hlds__mode_errors__pair__pti_pair_2__plain_term_context__type_ctor_info_term_context_0__plain_parse_tree__prog_data__type_ctor_info_mer_inst_0 = {
  &mercury__pair__pair__type_ctor_info_pair_2,
  {
    (MR_PseudoTypeInfo) (&mercury__term_context__term_context__type_ctor_info_term_context_0),
    (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
  }
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1builtin__type_ctor_info_int_0 = {
  &mercury__set_ordlist__set_ordlist__type_ctor_info_set_ordlist_1,
  { (MR_TypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_arg_ok_or_not_0_0[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1builtin__type_ctor_info_int_0)
};

static const MR_ConstString check_hlds__mode_errors__check_hlds__mode_errors__field_names_arg_ok_or_not_0_0[2] = {
  (MR_String) "ok_procs",
  (MR_String) "not_ok_procs"
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_arg_ok_or_not_0_0 = {
  (MR_String) "arg_ok_or_not",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_arg_ok_or_not_0_0,
  check_hlds__mode_errors__check_hlds__mode_errors__field_names_arg_ok_or_not_0_0,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_arg_ok_or_not_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_arg_ok_or_not_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_arg_ok_or_not_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_arg_ok_or_not_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_arg_ok_or_not_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_arg_ok_or_not_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_arg_ok_or_not_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____arg_ok_or_not_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____arg_ok_or_not_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "arg_ok_or_not",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_arg_ok_or_not_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_arg_ok_or_not_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_arg_ok_or_not_0,

};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0 = {
  &mercury__term__term__type_ctor_info_var_1,
  { (MR_TypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_prog_var_type_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_argnum_var_type_inst_0_0[4] = {
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_argnum_var_type_inst_0_0 = {
  (MR_String) "argnum_var_type_inst",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_argnum_var_type_inst_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_argnum_var_type_inst_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_argnum_var_type_inst_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_argnum_var_type_inst_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_argnum_var_type_inst_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_argnum_var_type_inst_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_argnum_var_type_inst_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_argnum_var_type_inst_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_argnum_var_type_inst_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____argnum_var_type_inst_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____argnum_var_type_inst_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "argnum_var_type_inst",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_argnum_var_type_inst_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_argnum_var_type_inst_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_argnum_var_type_inst_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_0[1] = { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_0 = {
  (MR_String) "bad_cons_id_input",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_1[3] = {
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0),
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_1 = {
  (MR_String) "bad_cons_id_input_inst_arity",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_2[1] = { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_2 = {
  (MR_String) "bad_cons_id_result",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_bound_functor_cons_id_error_0_2,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_1 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_2 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_bound_functor_cons_id_error_0[3] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_bound_functor_cons_id_error_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_bound_functor_cons_id_error_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_bound_functor_cons_id_error_0_2
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_bound_functor_cons_id_error_0[3] = {
  (MR_Integer) 0,
  (MR_Integer) 1,
  (MR_Integer) 2
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____bound_functor_cons_id_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____bound_functor_cons_id_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "bound_functor_cons_id_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_bound_functor_cons_id_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_bound_functor_cons_id_error_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_bound_functor_cons_id_error_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_0 = {
  (MR_String) "cannot_init_any",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_1 = {
  (MR_String) "cannot_deep_copy_partial_term",
  INT32_C(1)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_cannot_create_reason_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_1
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_cannot_create_reason_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_cannot_create_reason_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_cannot_create_reason_0[2] = {
  (MR_Integer) 1,
  (MR_Integer) 0
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_cannot_create_reason_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____cannot_create_reason_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____cannot_create_reason_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "cannot_create_reason",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_cannot_create_reason_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_cannot_create_reason_0 },
  (MR_Integer) 2,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_cannot_create_reason_0,

};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_0_0[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_reason_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_0_0 = {
  (MR_String) "coerce_error",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____coerce_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____coerce_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "coerce_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_0[1] = { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_0 = {
  (MR_String) "input_inst_not_ground",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_1[3] = {
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_1 = {
  (MR_String) "cons_id_errors",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_2[1] = { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_2 = {
  (MR_String) "has_inst_expect_upcast",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_reason_0_2,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_1 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_2 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_reason_0[3] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_reason_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_reason_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_reason_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_reason_0[3] = {
  (MR_Integer) 2,
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_reason_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____coerce_error_reason_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____coerce_error_reason_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "coerce_error_reason",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_reason_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_reason_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_reason_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_term_path_step_0_0[2] = {
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0),
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_term_path_step_0_0 = {
  (MR_String) "coerce_error_term_path_step",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_coerce_error_term_path_step_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_term_path_step_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_term_path_step_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_term_path_step_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_coerce_error_term_path_step_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_term_path_step_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_coerce_error_term_path_step_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_term_path_step_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____coerce_error_term_path_step_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____coerce_error_term_path_step_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "coerce_error_term_path_step",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_coerce_error_term_path_step_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_coerce_error_term_path_step_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_coerce_error_term_path_step_0,

};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__sparse_bitset__ti_sparse_bitset_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0 = {
  &mercury__sparse_bitset__sparse_bitset__type_ctor_info_sparse_bitset_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_delayed_goal_0_0[3] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__sparse_bitset__ti_sparse_bitset_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_info_0),
  (MR_PseudoTypeInfo) (&hlds__hlds_goal__hlds__hlds_goal__type_ctor_info_hlds_goal_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_delayed_goal_0_0 = {
  (MR_String) "delayed_goal",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_delayed_goal_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_delayed_goal_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_delayed_goal_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_delayed_goal_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_delayed_goal_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_delayed_goal_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_delayed_goal_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_delayed_goal_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____delayed_goal_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____delayed_goal_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "delayed_goal",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_delayed_goal_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_delayed_goal_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_delayed_goal_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_0 = {
  (MR_String) "eon_not_exact",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_1 = {
  (MR_String) "eon_exact",
  INT32_C(1)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_exact_or_not_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_1
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_exact_or_not_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_exact_or_not_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_exact_or_not_0[2] = {
  (MR_Integer) 1,
  (MR_Integer) 0
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_exact_or_not_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____exact_or_not_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____exact_or_not_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "exact_or_not",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_exact_or_not_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_exact_or_not_0 },
  (MR_Integer) 2,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_exact_or_not_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_0 = {
  (MR_String) "too_instantiated",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_1 = {
  (MR_String) "not_instantiated_enough",
  INT32_C(1)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_2 = {
  (MR_String) "wrongly_instantiated",
  INT32_C(2)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_final_inst_error_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_2
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_final_inst_error_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_final_inst_error_0_2
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_final_inst_error_0[3] = {
  (MR_Integer) 1,
  (MR_Integer) 0,
  (MR_Integer) 2
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_final_inst_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____final_inst_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____final_inst_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "final_inst_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_final_inst_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_final_inst_error_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_final_inst_error_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_0 = {
  (MR_String) "ground",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_1 = {
  (MR_String) "nonground",
  INT32_C(1)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_ground_or_nonground_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_1
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_ground_or_nonground_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_ground_or_nonground_0_1
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_ground_or_nonground_0[2] = {
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_ground_or_nonground_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____ground_or_nonground_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____ground_or_nonground_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "ground_or_nonground",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_ground_or_nonground_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_ground_or_nonground_0 },
  (MR_Integer) 2,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_ground_or_nonground_0,

};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_0 = {
  (MR_String) "ho_mismatch_not_higher_order_type",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 0,
  INT32_C(0),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_1 = {
  (MR_String) "ho_mismatch_no_higher_order_inst_info",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 1,
  INT32_C(1),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_higher_order_mismatch_info_0_2[1] = { (MR_PseudoTypeInfo) (&mdbcomp__prim_data__mdbcomp__prim_data__type_ctor_info_pred_or_func_0) };

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_higher_order_mismatch_info_0_2[1] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 1
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_2 = {
  (MR_String) "ho_mismatch_pred_vs_func",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_higher_order_mismatch_info_0_2,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_higher_order_mismatch_info_0_2,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_higher_order_mismatch_info_0_3[1] = { (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_user_arity_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_3 = {
  (MR_String) "ho_mismatch_on_arity",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(3),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_higher_order_mismatch_info_0_3,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_1
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_2 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_3 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_higher_order_mismatch_info_0[3] = {
  {
    UINT32_C(2),
    MR_SECTAG_LOCAL_REST_OF_WORD,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_higher_order_mismatch_info_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_higher_order_mismatch_info_0[4] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_3,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_higher_order_mismatch_info_0_2
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_higher_order_mismatch_info_0[4] = {
  (MR_Integer) 1,
  (MR_Integer) 0,
  (MR_Integer) 3,
  (MR_Integer) 2
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_higher_order_mismatch_info_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____higher_order_mismatch_info_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____higher_order_mismatch_info_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "higher_order_mismatch_info",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_higher_order_mismatch_info_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_higher_order_mismatch_info_0 },
  (MR_Integer) 4,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_higher_order_mismatch_info_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_match_what_0_0[1] = { (MR_PseudoTypeInfo) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_pred_id_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_0 = {
  (MR_String) "match_plain_call",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_match_what_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_match_what_0_1[1] = { (MR_PseudoTypeInfo) (&hlds__hlds_goal__hlds__hlds_goal__type_ctor_info_generic_call_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_1 = {
  (MR_String) "match_higher_order_call",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_match_what_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_2 = {
  (MR_String) "match_unify",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 0,
  INT32_C(2),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_3 = {
  (MR_String) "match_cast",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 1,
  INT32_C(3),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_4 = {
  (MR_String) "match_event",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 2,
  INT32_C(4),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_3,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_4
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_1 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_match_what_0[3] = {
  {
    UINT32_C(3),
    MR_SECTAG_LOCAL_REST_OF_WORD,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_match_what_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_match_what_0[5] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_3,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_4,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_match_what_0_2
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_match_what_0[5] = {
  (MR_Integer) 3,
  (MR_Integer) 2,
  (MR_Integer) 4,
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_match_what_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____match_what_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____match_what_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "match_what",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_match_what_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_match_what_0 },
  (MR_Integer) 5,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_match_what_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_0 = {
  (MR_String) "is_not_disjunctive",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_1 = {
  (MR_String) "is_disjunctive",
  INT32_C(1)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_maybe_is_disjunctive_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_1
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_maybe_is_disjunctive_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_is_disjunctive_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_maybe_is_disjunctive_0[2] = {
  (MR_Integer) 1,
  (MR_Integer) 0
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_is_disjunctive_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____maybe_is_disjunctive_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____maybe_is_disjunctive_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "maybe_is_disjunctive",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_maybe_is_disjunctive_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_maybe_is_disjunctive_0 },
  (MR_Integer) 2,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_maybe_is_disjunctive_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_0 = {
  (MR_String) "all_extra_args_good",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_1 = {
  (MR_String) "some_extra_arg_is_bad",
  INT32_C(1)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_maybe_some_extra_arg_is_bad_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_1
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_maybe_some_extra_arg_is_bad_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_maybe_some_extra_arg_is_bad_0_1
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_maybe_some_extra_arg_is_bad_0[2] = {
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_some_extra_arg_is_bad_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____maybe_some_extra_arg_is_bad_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____maybe_some_extra_arg_is_bad_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "maybe_some_extra_arg_is_bad",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_maybe_some_extra_arg_is_bad_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_maybe_some_extra_arg_is_bad_0 },
  (MR_Integer) 2,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_maybe_some_extra_arg_is_bad_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_0 = {
  (MR_String) "merge_disj",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_1 = {
  (MR_String) "merge_if_then_else",
  INT32_C(1)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_2 = {
  (MR_String) "merge_stm_atomic",
  INT32_C(2)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_merge_context_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_2
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_merge_context_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_merge_context_0_2
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_merge_context_0[3] = {
  (MR_Integer) 0,
  (MR_Integer) 1,
  (MR_Integer) 2
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_context_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____merge_context_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____merge_context_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "merge_context",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_merge_context_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_merge_context_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_merge_context_0,

};

static const MR_FA_TypeInfo_Struct2 check_hlds__mode_errors__pair__ti_pair_2term_context__type_ctor_info_term_context_0parse_tree__prog_data__type_ctor_info_mer_inst_0 = {
  &mercury__pair__pair__type_ctor_info_pair_2,
  {
    (MR_TypeInfo) (&mercury__term_context__term_context__type_ctor_info_term_context_0),
    (MR_TypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
  }
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1pair__ti_pair_2term_context__type_ctor_info_term_context_0parse_tree__prog_data__type_ctor_info_mer_inst_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__pair__ti_pair_2term_context__type_ctor_info_term_context_0parse_tree__prog_data__type_ctor_info_mer_inst_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_merge_error_0_0[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1pair__ti_pair_2term_context__type_ctor_info_term_context_0parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_merge_error_0_0 = {
  (MR_String) "merge_error",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_merge_error_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_merge_error_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_merge_error_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_merge_error_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_merge_error_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_merge_error_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_merge_error_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_merge_error_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____merge_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____merge_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "merge_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_merge_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_merge_error_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_merge_error_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_0[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_0 = {
  (MR_String) "mode_error_unify_var_var",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_1[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_1 = {
  (MR_String) "mode_error_unify_var_poly",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) }
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_mer_inst_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_2[5] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_2 = {
  (MR_String) "mode_error_unify_var_functor",
  INT16_C(5),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_2,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_3[3] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_3 = {
  (MR_String) "mode_error_unify_var_lambda",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 0,
  INT32_C(3),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_3,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_4[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_4 = {
  (MR_String) "mode_error_unify_var_multimode_pf",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 1,
  INT32_C(4),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_4,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_5[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_5 = {
  (MR_String) "mode_error_non_ground_non_local_lambda_var",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 2,
  INT32_C(5),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_5,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_6[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_unify_rhs_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_type_0),
  (MR_PseudoTypeInfo) (&mdbcomp__prim_data__mdbcomp__prim_data__type_ctor_info_pred_or_func_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_6[4] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 2,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 3,
    (MR_Integer) 0,
    (MR_Integer) 1
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_6 = {
  (MR_String) "mode_error_higher_order_unify",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 3,
  INT32_C(6),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_6,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_6,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__maybe__ti_maybe_1check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0 = {
  &mercury__maybe__maybe__type_ctor_info_maybe_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_7[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__maybe__ti_maybe_1check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_7 = {
  (MR_String) "mode_error_var_is_not_sufficiently_instantiated",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 4,
  INT32_C(7),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_7,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_8[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_8 = {
  (MR_String) "mode_error_clobbered_var_is_live",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 5,
  INT32_C(8),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_8,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_9[1] = { (MR_PseudoTypeInfo) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_pred_id_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_9 = {
  (MR_String) "mode_error_callee_pred_has_no_mode_decl",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 6,
  INT32_C(9),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_9,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_mode_mismatch_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_mismatch_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_10[5] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_match_what_0),
  (MR_PseudoTypeInfo) (&hlds__instmap__hlds__instmap__type_ctor_info_instmap_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_mismatch_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_mode_mismatch_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_10 = {
  (MR_String) "mode_error_no_matching_mode",
  INT16_C(5),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 7,
  INT32_C(10),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_10,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_11[5] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&mdbcomp__prim_data__mdbcomp__prim_data__type_ctor_info_pred_or_func_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_user_arity_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_higher_order_mismatch_info_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_11[5] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 2,
    (MR_Integer) 0,
    (MR_Integer) 1
  },
  {
    (MR_Integer) 3,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 4,
    (MR_Integer) 0,
    (MR_Integer) 0
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_11 = {
  (MR_String) "mode_error_bad_higher_order_inst",
  INT16_C(5),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 8,
  INT32_C(11),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_11,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_11,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_delayed_goal_0 = {
  &mercury__one_or_more__one_or_more__type_ctor_info_one_or_more_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_12[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_delayed_goal_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_schedule_culprit_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_12 = {
  (MR_String) "mode_error_unschedulable_conjuncts",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 9,
  INT32_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_12,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_merge_error_0 = {
  &mercury__one_or_more__one_or_more__type_ctor_info_one_or_more_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_13[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_merge_error_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_13 = {
  (MR_String) "mode_error_merge_par_conj",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 10,
  INT32_C(13),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_13,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_14[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_context_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__one_or_more__ti_one_or_more_1check_hlds__mode_errors__type_ctor_info_merge_error_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_14[2] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 2
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_14 = {
  (MR_String) "mode_error_merge_disj",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 11,
  INT32_C(14),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_14,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_14,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_coerce_error_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_15[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_coerce_error_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_15 = {
  (MR_String) "mode_error_coerce_error",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 12,
  INT32_C(15),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_15,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_16[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_16 = {
  (MR_String) "mode_error_nonground_trace_goal",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 13,
  INT32_C(16),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_16,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_17[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_info__check_hlds__mode_info__type_ctor_info_var_lock_reason_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_17 = {
  (MR_String) "mode_error_bind_locked_var",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 14,
  INT32_C(17),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_17,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_18[5] = {
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_final_inst_error_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_18[5] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 2,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 3,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 4,
    (MR_Integer) 0,
    (MR_Integer) 2
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_18 = {
  (MR_String) "mode_error_unexpected_final_inst",
  INT16_C(5),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 15,
  INT32_C(18),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_18,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_18,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_mode_error_info_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_info_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_19[5] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_pred_id_0),
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1check_hlds__mode_errors__type_ctor_info_mode_error_info_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_19 = {
  (MR_String) "mode_error_in_callee",
  INT16_C(5),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 16,
  INT32_C(19),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_19,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_20[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_cannot_create_reason_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_20[4] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 1
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 2,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 3,
    (MR_Integer) 0,
    (MR_Integer) 0
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_20 = {
  (MR_String) "mode_error_cannot_create_implied_mode",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 17,
  INT32_C(20),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_20,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_20,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_21[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_negated_context_desc_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_21[2] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 1
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_21 = {
  (MR_String) "purity_error_should_be_in_promise_purity_scope",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 18,
  INT32_C(21),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_21,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_error_0_21,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__one_or_more__ti_one_or_more_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0 = {
  &mercury__one_or_more__one_or_more__type_ctor_info_one_or_more_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_22[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__one_or_more__ti_one_or_more_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_22 = {
  (MR_String) "purity_error_lambda_should_be_any",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_REMOTE_FULL_WORD,
  UINT8_C(3),
  (MR_Integer) 19,
  INT32_C(22),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_0_22,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_1 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_2 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_3[20] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_3,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_4,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_5,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_6,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_7,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_8,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_9,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_10,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_11,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_12,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_13,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_14,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_15,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_16,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_17,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_18,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_19,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_20,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_21,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_22
};

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_0[4] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  },
  {
    UINT32_C(20),
    MR_SECTAG_REMOTE_FULL_WORD,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_0_3,
    INT8_C(-1),
    UINT8_C(3),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_0[23] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_11,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_17,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_9,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_20,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_8,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_15,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_6,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_19,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_14,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_13,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_10,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_5,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_16,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_18,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_3,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_4,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_12,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_7,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_22,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_0_21
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_0[23] = {
  (MR_Integer) 18,
  (MR_Integer) 17,
  (MR_Integer) 14,
  (MR_Integer) 15,
  (MR_Integer) 16,
  (MR_Integer) 11,
  (MR_Integer) 6,
  (MR_Integer) 20,
  (MR_Integer) 4,
  (MR_Integer) 2,
  (MR_Integer) 10,
  (MR_Integer) 0,
  (MR_Integer) 19,
  (MR_Integer) 9,
  (MR_Integer) 8,
  (MR_Integer) 5,
  (MR_Integer) 12,
  (MR_Integer) 1,
  (MR_Integer) 13,
  (MR_Integer) 7,
  (MR_Integer) 3,
  (MR_Integer) 22,
  (MR_Integer) 21
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(4),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____mode_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____mode_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "mode_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_0 },
  (MR_Integer) 23,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_info_0_0[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__sparse_bitset__ti_sparse_bitset_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_0),
  (MR_PseudoTypeInfo) (&mercury__term_context__term_context__type_ctor_info_term_context_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_info__check_hlds__mode_info__type_ctor_info_mode_context_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_info_0_0 = {
  (MR_String) "mode_error_info",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_info_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_info_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_info_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_info_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_info_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_info_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_info_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_info_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_info_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____mode_error_info_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____mode_error_info_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "mode_error_info",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_info_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_info_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_info_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_0[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_0 = {
  (MR_String) "error_at_var",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_1[2] = {
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_1 = {
  (MR_String) "error_at_functor",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_from_to_insts_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_from_to_insts_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_2[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_from_to_insts_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_2 = {
  (MR_String) "error_at_lambda",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_error_unify_rhs_0_2,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_1 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_2 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_unify_rhs_0[3] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_error_unify_rhs_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_unify_rhs_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_error_unify_rhs_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_unify_rhs_0[3] = {
  (MR_Integer) 2,
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_unify_rhs_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____mode_error_unify_rhs_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____mode_error_unify_rhs_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "mode_error_unify_rhs",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_error_unify_rhs_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_error_unify_rhs_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_error_unify_rhs_0,

};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_inst_var_type_0 = {
  &mercury__term__term__type_ctor_info_var_1,
  { (MR_TypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0) }
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1term__ti_var_1parse_tree__prog_data__type_ctor_info_inst_var_type_0 = {
  &mercury__set_ordlist__set_ordlist__type_ctor_info_set_ordlist_1,
  { (MR_TypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_inst_var_type_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_mismatch_0_0[3] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_exact_or_not_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__set_ordlist__ti_set_ordlist_1term__ti_var_1parse_tree__prog_data__type_ctor_info_inst_var_type_0)
};

static const MR_DuArgLocn check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_mismatch_0_0[3] = {
  {
    (MR_Integer) 0,
    (MR_Integer) 0,
    (MR_Integer) 1
  },
  {
    (MR_Integer) 1,
    (MR_Integer) 0,
    (MR_Integer) 0
  },
  {
    (MR_Integer) 2,
    (MR_Integer) 0,
    (MR_Integer) 0
  }
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_mismatch_0_0 = {
  (MR_String) "mode_mismatch",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_mismatch_0_0,
  NULL,
  check_hlds__mode_errors__check_hlds__mode_errors__field_locns_mode_mismatch_0_0,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_mismatch_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_mismatch_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_mismatch_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_mismatch_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_mismatch_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_mismatch_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_mismatch_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_mismatch_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____mode_mismatch_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____mode_mismatch_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "mode_mismatch",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_mismatch_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_mismatch_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_mismatch_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_0[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_0 = {
  (MR_String) "cannot_succeed_var_var",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_1[3] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_1 = {
  (MR_String) "cannot_succeed_var_functor",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_2[2] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_2 = {
  (MR_String) "cannot_succeed_ground_occur_check",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_0_2,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_1 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_2 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_warning_0[3] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_warning_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_warning_0[3] = {
  (MR_Integer) 2,
  (MR_Integer) 1,
  (MR_Integer) 0
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_warning_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____mode_warning_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____mode_warning_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "mode_warning",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_warning_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_warning_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_warning_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_info_0_0[3] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_warning_0),
  (MR_PseudoTypeInfo) (&mercury__term_context__term_context__type_ctor_info_term_context_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_info__check_hlds__mode_info__type_ctor_info_mode_context_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_info_0_0 = {
  (MR_String) "mode_warning_info",
  INT16_C(3),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_mode_warning_info_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_info_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_info_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_warning_info_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_mode_warning_info_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_warning_info_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_mode_warning_info_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_warning_info_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_warning_info_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____mode_warning_info_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____mode_warning_info_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "mode_warning_info",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_mode_warning_info_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_mode_warning_info_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_mode_warning_info_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_0 = {
  (MR_String) "if_then_else",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_1 = {
  (MR_String) "negation",
  INT32_C(1)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_negated_context_desc_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_1
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_negated_context_desc_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_negated_context_desc_0_1
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_negated_context_desc_0[2] = {
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_negated_context_desc_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____negated_context_desc_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____negated_context_desc_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "negated_context_desc",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_negated_context_desc_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_negated_context_desc_0 },
  (MR_Integer) 2,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_negated_context_desc_0,

};

static const MR_FA_TypeInfo_Struct2 check_hlds__mode_errors__tree234__ti_tree234_2builtin__type_ctor_info_int_0check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0 = {
  &mercury__tree234__tree234__type_ctor_info_tree234_2,
  {
    (MR_TypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
    (MR_TypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0)
  }
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_ok_or_not_map_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_EQUIV_GROUND,
  ((MR_Box) (check_hlds__mode_errors____Unify____ok_or_not_map_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____ok_or_not_map_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "ok_or_not_map",
  { NULL },
  { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__tree234__ti_tree234_2builtin__type_ctor_info_int_0check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0) },
  (MR_Integer) -1,
  UINT16_C(0),
  NULL,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_pred_id_var_multimode_error_0_0[2] = {
  (MR_PseudoTypeInfo) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_pred_id_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_var_multimode_error_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_pred_id_var_multimode_error_0_0 = {
  (MR_String) "pred_id_var_multimode_error",
  INT16_C(2),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_pred_id_var_multimode_error_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_pred_id_var_multimode_error_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_pred_id_var_multimode_error_0_0 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_pred_id_var_multimode_error_0[1] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_pred_id_var_multimode_error_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_pred_id_var_multimode_error_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_pred_id_var_multimode_error_0_0 };

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_pred_id_var_multimode_error_0[1] = { (MR_Integer) 0 };

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(1),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____pred_id_var_multimode_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____pred_id_var_multimode_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "pred_id_var_multimode_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_pred_id_var_multimode_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_pred_id_var_multimode_error_0 },
  (MR_Integer) 1,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_pred_id_var_multimode_error_0,

};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_0 = {
  (MR_String) "report_inst_only",
  INT32_C(0)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_1 = {
  (MR_String) "report_groundness_only",
  INT32_C(1)
};

static const MR_EnumFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_2 = {
  (MR_String) "report_inst_and_groundness",
  INT32_C(2)
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_report_inst_how_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_2
};

static const MR_EnumFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_report_inst_how_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__enum_functor_desc_report_inst_how_0_0
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_report_inst_how_0[3] = {
  (MR_Integer) 2,
  (MR_Integer) 0,
  (MR_Integer) 1
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_report_inst_how_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(-1),
  MR_TYPECTOR_REP_ENUM,
  ((MR_Box) (check_hlds__mode_errors____Unify____report_inst_how_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____report_inst_how_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "report_inst_how",
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_name_ordered_report_inst_how_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__enum_ordinal_ordered_report_inst_how_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_report_inst_how_0,

};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_0 = {
  (MR_String) "goal_itself_was_impure",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 0,
  INT32_C(0),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_schedule_culprit_0_1[1] = { (MR_PseudoTypeInfo) (&hlds__hlds_goal__hlds__hlds_goal__type_ctor_info_hlds_goal_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_1 = {
  (MR_String) "goals_followed_by_impure_goal",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_schedule_culprit_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_2 = {
  (MR_String) "conj_floundered",
  INT16_C(0),
  UINT16_C(0),
  MR_SECTAG_LOCAL_REST_OF_WORD,
  UINT8_C(0),
  (MR_Integer) 1,
  INT32_C(2),
  NULL,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_schedule_culprit_0_0[2] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_2
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_schedule_culprit_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_1 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_schedule_culprit_0[2] = {
  {
    UINT32_C(2),
    MR_SECTAG_LOCAL_REST_OF_WORD,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_schedule_culprit_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_schedule_culprit_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_schedule_culprit_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_2,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_schedule_culprit_0_1
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_schedule_culprit_0[3] = {
  (MR_Integer) 1,
  (MR_Integer) 2,
  (MR_Integer) 0
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_schedule_culprit_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(2),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____schedule_culprit_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____schedule_culprit_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "schedule_culprit",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_schedule_culprit_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_schedule_culprit_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_schedule_culprit_0,

};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_0[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_0 = {
  (MR_String) "no_matching_mode",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(0),
  (MR_Integer) -1,
  INT32_C(0),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_0,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_FA_TypeInfo_Struct1 check_hlds__mode_errors__list__ti_list_1builtin__type_ctor_info_int_0 = {
  &mercury__list__list__type_ctor_info_list_1,
  { (MR_TypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0) }
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_1[4] = {
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0),
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&mercury__builtin__builtin__type_ctor_info_int_0),
  (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1builtin__type_ctor_info_int_0)
};

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_1 = {
  (MR_String) "more_than_one_matching_mode",
  INT16_C(4),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(1),
  (MR_Integer) -1,
  INT32_C(1),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_1,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_PseudoTypeInfo check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_2[1] = { (MR_PseudoTypeInfo) (&check_hlds__mode_errors__list__ti_list_1term__ti_var_1parse_tree__prog_data__type_ctor_info_prog_var_type_0) };

static const MR_DuFunctorDesc check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_2 = {
  (MR_String) "some_ho_args_non_ground",
  INT16_C(1),
  UINT16_C(0),
  MR_SECTAG_NONE,
  UINT8_C(2),
  (MR_Integer) -1,
  INT32_C(2),
  check_hlds__mode_errors__check_hlds__mode_errors__field_types_var_multimode_error_0_2,
  NULL,
  NULL,
  NULL,
  MR_FUNCTOR_SUBTYPE_NONE,
  UINT8_C(0)
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_0[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_0 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_1[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_1 };

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_2[1] = { &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_2 };

static const MR_DuPtagLayout check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_var_multimode_error_0[3] = {
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_0,
    INT8_C(-1),
    UINT8_C(0),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_1,
    INT8_C(-1),
    UINT8_C(1),
    UINT8_C(1)
  },
  {
    UINT32_C(1),
    MR_SECTAG_NONE,
    check_hlds__mode_errors__check_hlds__mode_errors__du_stag_ordered_var_multimode_error_0_2,
    INT8_C(-1),
    UINT8_C(2),
    UINT8_C(1)
  }
};

static const MR_DuFunctorDescPtr check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_var_multimode_error_0[3] = {
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_1,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_0,
  &check_hlds__mode_errors__check_hlds__mode_errors__du_functor_desc_var_multimode_error_0_2
};

static const MR_Integer check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_var_multimode_error_0[3] = {
  (MR_Integer) 1,
  (MR_Integer) 0,
  (MR_Integer) 2
};

const MR_TypeCtorInfo_Struct check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_var_multimode_error_0 = {
  (MR_Integer) 0,
  UINT8_C(18),
  INT8_C(3),
  MR_TYPECTOR_REP_DU,
  ((MR_Box) (check_hlds__mode_errors____Unify____var_multimode_error_0_0_10001)),
  ((MR_Box) (check_hlds__mode_errors____Compare____var_multimode_error_0_0_10001)),
  (MR_String) "check_hlds.mode_errors",
  (MR_String) "var_multimode_error",
  { check_hlds__mode_errors__check_hlds__mode_errors__du_name_ordered_var_multimode_error_0 },
  { check_hlds__mode_errors__check_hlds__mode_errors__du_ptag_ordered_var_multimode_error_0 },
  (MR_Integer) 3,
  UINT16_C(12),
  check_hlds__mode_errors__check_hlds__mode_errors__functor_number_map_var_multimode_error_0,

};

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__mode_error_coerce_error_to_spec__1915__1_1_f_0(
  MR_Word LambdaHeadVar__1_176)
{
  MR_Word LambdaHeadVar__2_177;

  {
    LambdaHeadVar__2_177 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, LambdaHeadVar__2_177, 0) = ((MR_Box) ((MR_Unsigned) 28U));
    MR_hl_field(3, LambdaHeadVar__2_177, 1) = ((MR_Box) (LambdaHeadVar__1_176));
  }
  return LambdaHeadVar__2_177;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__mode_error_coerce_error_to_spec__1875__1_1_f_0(
  MR_Word LambdaHeadVar__1_117)
{
  MR_Word LambdaHeadVar__2_118;

  {
    LambdaHeadVar__2_118 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, LambdaHeadVar__2_118, 0) = ((MR_Box) ((MR_Unsigned) 28U));
    MR_hl_field(3, LambdaHeadVar__2_118, 1) = ((MR_Box) (LambdaHeadVar__1_117));
  }
  return LambdaHeadVar__2_118;
}

static void MR_CALL 
check_hlds__mode_errors__IntroducedFrom__pred__report_bound_inst_vars__1476__1_3_p_0(
  MR_Word InstVarSet_1,
  MR_Word HeadVar__2_59,
  MR_String * HeadVar__3_60)
{
  mercury__varset__lookup_name_3_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0), InstVarSet_1, HeadVar__2_59, HeadVar__3_60);
}

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__named_and_unnamed_vars_to_pieces__843__1_1_f_0(
  MR_String LambdaHeadVar__1_26)
{
  MR_Word LambdaHeadVar__2_27;

  {
    LambdaHeadVar__2_27 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, LambdaHeadVar__2_27, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, LambdaHeadVar__2_27, 1) = ((MR_Box) (LambdaHeadVar__1_26));
  }
  return LambdaHeadVar__2_27;
}

static MR_bool MR_CALL 
check_hlds__mode_errors__IntroducedFrom__pred__named_and_unnamed_vars_to_pieces__832__1_3_p_0(
  MR_Word VarTable_5,
  MR_Word LambdaHeadVar__1_23,
  MR_String * LambdaHeadVar__2_24)
{
  MR_bool succeeded;
  MR_Word E_11;

  parse_tree__var_table__lookup_var_entry_3_p_0(VarTable_5, LambdaHeadVar__1_23, &E_11);
  *LambdaHeadVar__2_24 = ((MR_String) ((MR_hl_field(0, E_11, 0))));
  succeeded = (strcmp(*LambdaHeadVar__2_24, (MR_String) "") == 0);
  succeeded = !(succeeded);
  return succeeded;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__IntroducedFrom__func__mode_error_unify_var_multimode_pf_to_spec__804__1_1_f_0(
  MR_Integer LambdaHeadVar__1_105)
{
  MR_Word LambdaHeadVar__2_106;
  MR_Integer ModeNum_35;
  MR_Integer Var_107;

  Var_107 = hlds__hlds_pred__proc_id_to_int_1_f_0(LambdaHeadVar__1_105);
  ModeNum_35 = (MR_Integer) ((MR_Unsigned) Var_107 + (MR_Unsigned) 1);
  {
    LambdaHeadVar__2_106 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, LambdaHeadVar__2_106, 0) = ((MR_Box) ((MR_Unsigned) 5U));
    MR_hl_field(3, LambdaHeadVar__2_106, 1) = ((MR_Box) (ModeNum_35));
  }
  return LambdaHeadVar__2_106;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____report_inst_how_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____report_inst_how_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____ok_or_not_map_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_Word Cast_HeadVar1_4 = HeadVar__2_2;
  MR_Word Cast_HeadVar2_5 = HeadVar__3_3;

  mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_3[1]), HeadVar__1_1, ((MR_Box) (Cast_HeadVar1_4)), ((MR_Box) (Cast_HeadVar2_5)));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ok_or_not_map_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Word Cast_HeadVar1_3 = HeadVar__1_1;
  MR_Word Cast_HeadVar2_4 = HeadVar__2_2;

  succeeded = mercury__builtin__unify_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_3[1]), ((MR_Box) (Cast_HeadVar1_3)), ((MR_Box) (Cast_HeadVar2_4)));
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____negated_context_desc_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____negated_context_desc_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____mode_warning_info_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_12 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_13 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_12 == CastY_13);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
    MR_Word SubResult1_6;

    check_hlds__mode_errors____Compare____mode_warning_0_0(&SubResult1_6, ArgX1_4, ArgY1_5);
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      MR_Word SubResult2_9;

      mercury__term_context____Compare____term_context_0_0(&SubResult2_9, ArgX2_7, ArgY2_8);
      succeeded = (SubResult2_9 != (MR_Integer) 0);
      if (succeeded)
        *HeadVar__1_1 = SubResult2_9;
      else
        check_hlds__mode_info____Compare____mode_context_0_0(HeadVar__1_1, ArgX3_10, ArgY3_11);
    }
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_warning_info_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
    MR_Word ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));

    succeeded = check_hlds__mode_errors____Unify____mode_warning_0_0(ArgX1_3, ArgY1_4);
    if (succeeded)
    {
      succeeded = mercury__term_context____Unify____term_context_0_0(ArgX2_5, ArgY2_6);
      if (succeeded)
        succeeded = check_hlds__mode_info____Unify____mode_context_0_0(ArgX3_7, ArgY3_8);
    }
  }
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____mode_warning_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_28 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_29 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_28 == CastY_29);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
              MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
              MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
              MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
              MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
              MR_Word ArgX4_13 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
              MR_Word ArgY4_14 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 3))));
              MR_Word SubResult1_6;

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult1_6, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
              succeeded = (SubResult1_6 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_6;
              else
              {
                MR_Word SubResult2_9;

                mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult2_9, ((MR_Box) (ArgX2_7)), ((MR_Box) (ArgY2_8)));
                succeeded = (SubResult2_9 != (MR_Integer) 0);
                if (succeeded)
                  *HeadVar__1_1 = SubResult2_9;
                else
                {
                  MR_Word SubResult3_12;

                  parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult3_12, ArgX3_10, ArgY3_11);
                  succeeded = (SubResult3_12 != (MR_Integer) 0);
                  if (succeeded)
                    *HeadVar__1_1 = SubResult3_12;
                  else
                    parse_tree__prog_data____Compare____mer_inst_0_0(HeadVar__1_1, ArgX4_13, ArgY4_14);
                }
              }
            }
            break;
          case (MR_Integer) 1:
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_15 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_16 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
              MR_Word ArgX2_18 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
              MR_Word ArgY2_19 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
              MR_Word ArgX3_21 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 2))));
              MR_Word ArgY3_22 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 2))));
              MR_Word SubResult1_17;

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult1_17, ((MR_Box) (ArgX1_15)), ((MR_Box) (ArgY1_16)));
              succeeded = (SubResult1_17 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_17;
              else
              {
                MR_Word SubResult2_20;

                parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult2_20, ArgX2_18, ArgY2_19);
                succeeded = (SubResult2_20 != (MR_Integer) 0);
                if (succeeded)
                  *HeadVar__1_1 = SubResult2_20;
                else
                  parse_tree__prog_data____Compare____cons_id_0_0(HeadVar__1_1, ArgX3_21, ArgY3_22);
              }
            }
            break;
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_23 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_24 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));
              MR_Word ArgX2_26 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 1))));
              MR_Word ArgY2_27 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 1))));
              MR_Word SubResult1_25;

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult1_25, ((MR_Box) (ArgX1_23)), ((MR_Box) (ArgY1_24)));
              succeeded = (SubResult1_25 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_25;
              else
                parse_tree__prog_data____Compare____cons_id_0_0(HeadVar__1_1, ArgX2_26, ArgY2_27);
            }
            break;
        }
        break;
    }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_warning_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_21 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_22 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_21 == CastY_22);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word TypeInfo_28_28;
          MR_Word TypeInfo_29_29;
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;
          MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
          MR_Word ArgY2_6;
          MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
          MR_Word ArgY3_8;
          MR_Word ArgX4_9 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 3))));
          MR_Word ArgY4_10;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 0);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
            ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
            ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
            ArgY4_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
            TypeInfo_28_28 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_28_28, ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
            if (succeeded)
            {
              TypeInfo_29_29 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
              succeeded = mercury__builtin__unify_2_p_0(TypeInfo_29_29, ((MR_Box) (ArgX2_5)), ((MR_Box) (ArgY2_6)));
              if (succeeded)
              {
                succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_7, ArgY3_8);
                if (succeeded)
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_9, ArgY4_10);
              }
            }
          }
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word TypeInfo_25_25;
          MR_Word ArgX1_11 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_12;
          MR_Word ArgX2_13 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 1))));
          MR_Word ArgY2_14;
          MR_Word ArgX3_15 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 2))));
          MR_Word ArgY3_16;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_12 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            ArgY2_14 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
            ArgY3_16 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 2))));
            TypeInfo_25_25 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_25_25, ((MR_Box) (ArgX1_11)), ((MR_Box) (ArgY1_12)));
            if (succeeded)
            {
              succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX2_13, ArgY2_14);
              if (succeeded)
                succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX3_15, ArgY3_16);
            }
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word TypeInfo_23_23;
          MR_Word ArgX1_17 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_18;
          MR_Word ArgX2_19 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 1))));
          MR_Word ArgY2_20;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_18 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            ArgY2_20 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 1))));
            TypeInfo_23_23 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_23_23, ((MR_Box) (ArgX1_17)), ((MR_Box) (ArgY1_18)));
            if (succeeded)
              succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX2_19, ArgY2_20);
          }
        }
        break;
    }
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____merge_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word SubResult1_6;

    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult1_6, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[9]), HeadVar__1_1, ((MR_Box) (ArgX2_7)), ((MR_Box) (ArgY2_8)));
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____merge_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_7 == CastY_8);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word TypeInfo_10_10;
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));

    succeeded = mercury__builtin__unify_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
    if (succeeded)
    {
      TypeInfo_10_10 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[9]);
      succeeded = mercury__builtin__unify_2_p_0(TypeInfo_10_10, ((MR_Box) (ArgX2_5)), ((MR_Box) (ArgY2_6)));
    }
  }
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____merge_context_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____merge_context_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_some_extra_arg_is_bad_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_some_extra_arg_is_bad_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_is_disjunctive_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_is_disjunctive_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____ground_or_nonground_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ground_or_nonground_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____final_inst_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____final_inst_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____exact_or_not_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____exact_or_not_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____delayed_goal_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_12 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_13 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_12 == CastY_13);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
    MR_Word SubResult1_6;

    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[8]), &SubResult1_6, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      MR_Word SubResult2_9;

      check_hlds__mode_errors____Compare____mode_error_info_0_0(&SubResult2_9, ArgX2_7, ArgY2_8);
      succeeded = (SubResult2_9 != (MR_Integer) 0);
      if (succeeded)
        *HeadVar__1_1 = SubResult2_9;
      else
        hlds__hlds_goal____Compare____hlds_goal_0_0(HeadVar__1_1, ArgX3_10, ArgY3_11);
    }
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_info_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_15 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_16 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_15 == CastY_16);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
    MR_Word ArgX4_13 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
    MR_Word ArgY4_14 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 3))));
    MR_Word SubResult1_6;

    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[8]), &SubResult1_6, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      MR_Word SubResult2_9;

      check_hlds__mode_errors____Compare____mode_error_0_0(&SubResult2_9, ArgX2_7, ArgY2_8);
      succeeded = (SubResult2_9 != (MR_Integer) 0);
      if (succeeded)
        *HeadVar__1_1 = SubResult2_9;
      else
      {
        MR_Word SubResult3_12;

        mercury__term_context____Compare____term_context_0_0(&SubResult3_12, ArgX3_10, ArgY3_11);
        succeeded = (SubResult3_12 != (MR_Integer) 0);
        if (succeeded)
          *HeadVar__1_1 = SubResult3_12;
        else
          check_hlds__mode_info____Compare____mode_context_0_0(HeadVar__1_1, ArgX4_13, ArgY4_14);
      }
    }
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_185 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_186 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_185 == CastY_186);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Integer IndexX_4;
    MR_Integer IndexY_5;

    check_hlds__mode_errors____Index____mode_error_0_0(HeadVar__2_2, &IndexX_4);
    check_hlds__mode_errors____Index____mode_error_0_0(HeadVar__3_3, &IndexY_5);
    succeeded = (IndexX_4 < IndexY_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 1;
    else
    {
      succeeded = (IndexX_4 > IndexY_5);
      if (succeeded)
        *HeadVar__1_1 = (MR_Integer) 2;
      else
      {
        MR_Word CompareResult_6;

        switch (MR_tag((MR_Word) HeadVar__2_2)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word ArgX1_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
              MR_Word ArgY1_8;
              MR_Word ArgX2_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
              MR_Word ArgY2_11;
              MR_Word ArgX3_13 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
              MR_Word ArgY3_14;
              MR_Word ArgX4_16 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
              MR_Word ArgY4_17;
              MR_Word SubResult1_9;
              MR_Word TypeInfo_241_241;

              succeeded = ((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 0);
              if (succeeded)
              {
                ArgY1_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
                ArgY2_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
                ArgY3_14 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
                ArgY4_17 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 3))));
                TypeInfo_241_241 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                mercury__builtin__compare_3_p_0(TypeInfo_241_241, &SubResult1_9, ((MR_Box) (ArgX1_7)), ((MR_Box) (ArgY1_8)));
                succeeded = (SubResult1_9 != (MR_Integer) 0);
                if (succeeded)
                  CompareResult_6 = SubResult1_9;
                else
                {
                  MR_Word SubResult2_12;

                  mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult2_12, ((MR_Box) (ArgX2_10)), ((MR_Box) (ArgY2_11)));
                  succeeded = (SubResult2_12 != (MR_Integer) 0);
                  if (succeeded)
                    CompareResult_6 = SubResult2_12;
                  else
                  {
                    MR_Word SubResult3_15;

                    parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult3_15, ArgX3_13, ArgY3_14);
                    succeeded = (SubResult3_15 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult3_15;
                    else
                      parse_tree__prog_data____Compare____mer_inst_0_0(&CompareResult_6, ArgX4_16, ArgY4_17);
                  }
                }
                succeeded = MR_TRUE;
              }
            }
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_18 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_19;
              MR_Word ArgX2_21 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
              MR_Word ArgY2_22;
              MR_Word SubResult1_20;
              MR_Word TypeInfo_239_239;

              succeeded = ((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 1);
              if (succeeded)
              {
                ArgY1_19 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
                ArgY2_22 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
                TypeInfo_239_239 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                mercury__builtin__compare_3_p_0(TypeInfo_239_239, &SubResult1_20, ((MR_Box) (ArgX1_18)), ((MR_Box) (ArgY1_19)));
                succeeded = (SubResult1_20 != (MR_Integer) 0);
                if (succeeded)
                  CompareResult_6 = SubResult1_20;
                else
                  parse_tree__prog_data____Compare____mer_inst_0_0(&CompareResult_6, ArgX2_21, ArgY2_22);
                succeeded = MR_TRUE;
              }
            }
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_23 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_24;
              MR_Word ArgX2_26 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 1))));
              MR_Word ArgY2_27;
              MR_Word ArgX3_29 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 2))));
              MR_Word ArgY3_30;
              MR_Word ArgX4_32 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 3))));
              MR_Word ArgY4_33;
              MR_Word ArgX5_35 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 4))));
              MR_Word ArgY5_36;
              MR_Word SubResult1_25;
              MR_Word TypeInfo_229_229;

              succeeded = ((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 2);
              if (succeeded)
              {
                ArgY1_24 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));
                ArgY2_27 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 1))));
                ArgY3_30 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 2))));
                ArgY4_33 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 3))));
                ArgY5_36 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 4))));
                TypeInfo_229_229 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                mercury__builtin__compare_3_p_0(TypeInfo_229_229, &SubResult1_25, ((MR_Box) (ArgX1_23)), ((MR_Box) (ArgY1_24)));
                succeeded = (SubResult1_25 != (MR_Integer) 0);
                if (succeeded)
                  CompareResult_6 = SubResult1_25;
                else
                {
                  MR_Word SubResult2_28;

                  parse_tree__prog_data____Compare____cons_id_0_0(&SubResult2_28, ArgX2_26, ArgY2_27);
                  succeeded = (SubResult2_28 != (MR_Integer) 0);
                  if (succeeded)
                    CompareResult_6 = SubResult2_28;
                  else
                  {
                    MR_Word SubResult3_31;

                    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), &SubResult3_31, ((MR_Box) (ArgX3_29)), ((MR_Box) (ArgY3_30)));
                    succeeded = (SubResult3_31 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult3_31;
                    else
                    {
                      MR_Word SubResult4_34;

                      parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult4_34, ArgX4_32, ArgY4_33);
                      succeeded = (SubResult4_34 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult4_34;
                      else
                        mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[12]), &CompareResult_6, ((MR_Box) (ArgX5_35)), ((MR_Box) (ArgY5_36)));
                    }
                  }
                }
                succeeded = MR_TRUE;
              }
            }
            break;
          case (MR_Integer) 3:
            switch (((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0))))) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                {
                  MR_Word ArgX1_37 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_38;
                  MR_Word ArgX2_40 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_41;
                  MR_Word ArgX3_43 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_44;
                  MR_Word SubResult1_39;
                  MR_Word TypeInfo_234_234;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 0)));
                  if (succeeded)
                  {
                    ArgY1_38 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_41 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_44 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    TypeInfo_234_234 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_234_234, &SubResult1_39, ((MR_Box) (ArgX1_37)), ((MR_Box) (ArgY1_38)));
                    succeeded = (SubResult1_39 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_39;
                    else
                    {
                      MR_Word SubResult2_42;

                      parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult2_42, ArgX2_40, ArgY2_41);
                      succeeded = (SubResult2_42 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_42;
                      else
                        parse_tree__prog_data____Compare____mer_inst_0_0(&CompareResult_6, ArgX3_43, ArgY3_44);
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 1:
                {
                  MR_Word ArgX1_45 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_46;
                  MR_Word ArgX2_48 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_49;
                  MR_Word SubResult1_47;
                  MR_Word TypeInfo_237_237;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 1)));
                  if (succeeded)
                  {
                    ArgY1_46 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_49 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    TypeInfo_237_237 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_237_237, &SubResult1_47, ((MR_Box) (ArgX1_45)), ((MR_Box) (ArgY1_46)));
                    succeeded = (SubResult1_47 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_47;
                    else
                      check_hlds__mode_errors____Compare____pred_id_var_multimode_error_0_0(&CompareResult_6, ArgX2_48, ArgY2_49);
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 2:
                {
                  MR_Word ArgX1_50 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_51;
                  MR_Word ArgX2_53 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_54;
                  MR_Word SubResult1_52;
                  MR_Word TypeInfo_220_220;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 2)));
                  if (succeeded)
                  {
                    ArgY1_51 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_54 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    TypeInfo_220_220 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_220_220, &SubResult1_52, ((MR_Box) (ArgX1_50)), ((MR_Box) (ArgY1_51)));
                    succeeded = (SubResult1_52 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_52;
                    else
                      parse_tree__prog_data____Compare____mer_inst_0_0(&CompareResult_6, ArgX2_53, ArgY2_54);
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 3:
                {
                  MR_Word ArgX1_55 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_56;
                  MR_Word ArgX2_58 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_59;
                  MR_Word ArgX3_61 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_62;
                  MR_Word ArgX4_64 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 4))) & (MR_Integer) 1);
                  MR_Word ArgY4_65;
                  MR_Word SubResult1_57;
                  MR_Word TypeInfo_203_203;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 3)));
                  if (succeeded)
                  {
                    ArgY1_56 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_59 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_62 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_65 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__3_3, 4))) & (MR_Integer) 1);
                    TypeInfo_203_203 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_203_203, &SubResult1_57, ((MR_Box) (ArgX1_55)), ((MR_Box) (ArgY1_56)));
                    succeeded = (SubResult1_57 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_57;
                    else
                    {
                      MR_Word SubResult2_60;

                      check_hlds__mode_errors____Compare____mode_error_unify_rhs_0_0(&SubResult2_60, ArgX2_58, ArgY2_59);
                      succeeded = (SubResult2_60 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_60;
                      else
                      {
                        MR_Word SubResult3_63;

                        parse_tree__prog_data____Compare____mer_type_0_0(&SubResult3_63, ArgX3_61, ArgY3_62);
                        succeeded = (SubResult3_63 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_63;
                        else
                        {
                          MR_Integer Var_260 = (MR_Integer) (ArgX4_64);
                          MR_Integer Var_261 = (MR_Integer) (ArgY4_65);

                          succeeded = (Var_260 < Var_261);
                          if (succeeded)
                            CompareResult_6 = (MR_Integer) 1;
                          else
                          {
                            succeeded = (Var_260 > Var_261);
                            if (succeeded)
                              CompareResult_6 = (MR_Integer) 2;
                            else
                              CompareResult_6 = (MR_Integer) 0;
                          }
                        }
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 4:
                {
                  MR_Word ArgX1_66 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_67;
                  MR_Word ArgX2_69 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_70;
                  MR_Word ArgX3_72 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_73;
                  MR_Word ArgX4_75 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Word ArgY4_76;
                  MR_Word SubResult1_68;
                  MR_Word TypeInfo_247_247;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 4)));
                  if (succeeded)
                  {
                    ArgY1_67 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_70 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_73 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_76 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    TypeInfo_247_247 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_247_247, &SubResult1_68, ((MR_Box) (ArgX1_66)), ((MR_Box) (ArgY1_67)));
                    succeeded = (SubResult1_68 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_68;
                    else
                    {
                      MR_Word SubResult2_71;

                      parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult2_71, ArgX2_69, ArgY2_70);
                      succeeded = (SubResult2_71 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_71;
                      else
                      {
                        MR_Word SubResult3_74;

                        parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult3_74, ArgX3_72, ArgY3_73);
                        succeeded = (SubResult3_74 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_74;
                        else
                          mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[17]), &CompareResult_6, ((MR_Box) (ArgX4_75)), ((MR_Box) (ArgY4_76)));
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 5:
                {
                  MR_Word TypeInfo_201_201;
                  MR_Word ArgX1_77 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_78;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 5)));
                  if (succeeded)
                  {
                    ArgY1_78 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    TypeInfo_201_201 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_201_201, &CompareResult_6, ((MR_Box) (ArgX1_77)), ((MR_Box) (ArgY1_78)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 6:
                {
                  MR_Word ArgX1_79 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_80;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 6)));
                  if (succeeded)
                  {
                    ArgY1_80 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    hlds__hlds_pred____Compare____pred_id_0_0(&CompareResult_6, ArgX1_79, ArgY1_80);
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 7:
                {
                  MR_Word ArgX1_81 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_82;
                  MR_Word ArgX2_84 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_85;
                  MR_Word ArgX3_87 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_88;
                  MR_Word ArgX4_90 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Word ArgY4_91;
                  MR_Word ArgX5_93 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 5))));
                  MR_Word ArgY5_94;
                  MR_Word SubResult1_83;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 7)));
                  if (succeeded)
                  {
                    ArgY1_82 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_85 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_88 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_91 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    ArgY5_94 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 5))));
                    check_hlds__mode_errors____Compare____match_what_0_0(&SubResult1_83, ArgX1_81, ArgY1_82);
                    succeeded = (SubResult1_83 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_83;
                    else
                    {
                      MR_Word SubResult2_86;

                      hlds__instmap____Compare____instmap_0_0(&SubResult2_86, ArgX2_84, ArgY2_85);
                      succeeded = (SubResult2_86 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_86;
                      else
                      {
                        MR_Word SubResult3_89;

                        mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), &SubResult3_89, ((MR_Box) (ArgX3_87)), ((MR_Box) (ArgY3_88)));
                        succeeded = (SubResult3_89 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_89;
                        else
                        {
                          MR_Word SubResult4_92;

                          check_hlds__mode_errors____Compare____mode_mismatch_0_0(&SubResult4_92, ArgX4_90, ArgY4_91);
                          succeeded = (SubResult4_92 != (MR_Integer) 0);
                          if (succeeded)
                            CompareResult_6 = SubResult4_92;
                          else
                            mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[15]), &CompareResult_6, ((MR_Box) (ArgX5_93)), ((MR_Box) (ArgY5_94)));
                        }
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 8:
                {
                  MR_Word ArgX1_95 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_96;
                  MR_Word ArgX2_98 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_99;
                  MR_Word ArgX3_101 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 3))) & (MR_Integer) 1);
                  MR_Word ArgY3_102;
                  MR_Word ArgX4_104 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Word ArgY4_105;
                  MR_Word ArgX5_107 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 5))));
                  MR_Word ArgY5_108;
                  MR_Word SubResult1_97;
                  MR_Word TypeInfo_187_187;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 8)));
                  if (succeeded)
                  {
                    ArgY1_96 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_99 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_102 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__3_3, 3))) & (MR_Integer) 1);
                    ArgY4_105 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    ArgY5_108 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 5))));
                    TypeInfo_187_187 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_187_187, &SubResult1_97, ((MR_Box) (ArgX1_95)), ((MR_Box) (ArgY1_96)));
                    succeeded = (SubResult1_97 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_97;
                    else
                    {
                      MR_Word SubResult2_100;

                      parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult2_100, ArgX2_98, ArgY2_99);
                      succeeded = (SubResult2_100 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_100;
                      else
                      {
                        MR_Word SubResult3_103;
                        MR_Integer Var_254 = (MR_Integer) (ArgX3_101);
                        MR_Integer Var_255 = (MR_Integer) (ArgY3_102);

                        succeeded = (Var_254 < Var_255);
                        if (succeeded)
                        {
                          SubResult3_103 = (MR_Integer) 1;
                          succeeded = MR_TRUE;
                        }
                        else
                        {
                          succeeded = (Var_254 > Var_255);
                          if (succeeded)
                          {
                            SubResult3_103 = (MR_Integer) 2;
                            succeeded = MR_TRUE;
                          }
                        }
                        if (succeeded)
                          CompareResult_6 = SubResult3_103;
                        else
                        {
                          MR_Word SubResult4_106;
                          MR_Integer Var_256 = (MR_Integer) (ArgX4_104);
                          MR_Integer Var_257 = (MR_Integer) (ArgY4_105);

                          succeeded = (Var_256 < Var_257);
                          if (succeeded)
                          {
                            SubResult4_106 = (MR_Integer) 1;
                            succeeded = MR_TRUE;
                          }
                          else
                          {
                            succeeded = (Var_256 > Var_257);
                            if (succeeded)
                            {
                              SubResult4_106 = (MR_Integer) 2;
                              succeeded = MR_TRUE;
                            }
                          }
                          if (succeeded)
                            CompareResult_6 = SubResult4_106;
                          else
                            check_hlds__mode_errors____Compare____higher_order_mismatch_info_0_0(&CompareResult_6, ArgX5_107, ArgY5_108);
                        }
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 9:
                {
                  MR_Word ArgX1_109 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_110;
                  MR_Word ArgX2_112 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_113;
                  MR_Word SubResult1_111;
                  MR_Word TypeInfo_245_245;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 9)));
                  if (succeeded)
                  {
                    ArgY1_110 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_113 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    TypeInfo_245_245 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[16]);
                    mercury__builtin__compare_3_p_0(TypeInfo_245_245, &SubResult1_111, ((MR_Box) (ArgX1_109)), ((MR_Box) (ArgY1_110)));
                    succeeded = (SubResult1_111 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_111;
                    else
                      check_hlds__mode_errors____Compare____schedule_culprit_0_0(&CompareResult_6, ArgX2_112, ArgY2_113);
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 10:
                {
                  MR_Word TypeInfo_214_214;
                  MR_Word ArgX1_114 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_115;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 10)));
                  if (succeeded)
                  {
                    ArgY1_115 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    TypeInfo_214_214 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[14]);
                    mercury__builtin__compare_3_p_0(TypeInfo_214_214, &CompareResult_6, ((MR_Box) (ArgX1_114)), ((MR_Box) (ArgY1_115)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 11:
                {
                  MR_Word ArgX1_116 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 1))) & (MR_Integer) 3);
                  MR_Word ArgY1_117;
                  MR_Word ArgX2_119 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_120;
                  MR_Word SubResult1_118;
                  MR_Integer Var_262;
                  MR_Integer Var_263;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 11)));
                  if (succeeded)
                  {
                    ArgY1_117 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__3_3, 1))) & (MR_Integer) 3);
                    ArgY2_120 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    Var_262 = (MR_Integer) (ArgX1_116);
                    Var_263 = (MR_Integer) (ArgY1_117);
                    succeeded = (Var_262 < Var_263);
                    if (succeeded)
                    {
                      SubResult1_118 = (MR_Integer) 1;
                      succeeded = MR_TRUE;
                    }
                    else
                    {
                      succeeded = (Var_262 > Var_263);
                      if (succeeded)
                      {
                        SubResult1_118 = (MR_Integer) 2;
                        succeeded = MR_TRUE;
                      }
                    }
                    if (succeeded)
                      CompareResult_6 = SubResult1_118;
                    else
                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[14]), &CompareResult_6, ((MR_Box) (ArgX2_119)), ((MR_Box) (ArgY2_120)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 12:
                {
                  MR_Word TypeInfo_202_202;
                  MR_Word ArgX1_121 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_122;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 12)));
                  if (succeeded)
                  {
                    ArgY1_122 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    TypeInfo_202_202 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[10]);
                    mercury__builtin__compare_3_p_0(TypeInfo_202_202, &CompareResult_6, ((MR_Box) (ArgX1_121)), ((MR_Box) (ArgY1_122)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 13:
                {
                  MR_Word ArgX1_123 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_124;
                  MR_Word ArgX2_126 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_127;
                  MR_Word SubResult1_125;
                  MR_Word TypeInfo_222_222;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 13)));
                  if (succeeded)
                  {
                    ArgY1_124 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_127 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    TypeInfo_222_222 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                    mercury__builtin__compare_3_p_0(TypeInfo_222_222, &SubResult1_125, ((MR_Box) (ArgX1_123)), ((MR_Box) (ArgY1_124)));
                    succeeded = (SubResult1_125 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_125;
                    else
                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), &CompareResult_6, ((MR_Box) (ArgX2_126)), ((MR_Box) (ArgY2_127)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 14:
                {
                  MR_Word ArgX1_128 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_129;
                  MR_Word ArgX2_131 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_132;
                  MR_Word ArgX3_134 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_135;
                  MR_Word ArgX4_137 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Word ArgY4_138;
                  MR_Word SubResult1_130;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 14)));
                  if (succeeded)
                  {
                    ArgY1_129 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_132 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_135 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_138 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    check_hlds__mode_info____Compare____var_lock_reason_0_0(&SubResult1_130, ArgX1_128, ArgY1_129);
                    succeeded = (SubResult1_130 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_130;
                    else
                    {
                      MR_Word SubResult2_133;

                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult2_133, ((MR_Box) (ArgX2_131)), ((MR_Box) (ArgY2_132)));
                      succeeded = (SubResult2_133 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_133;
                      else
                      {
                        MR_Word SubResult3_136;

                        parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult3_136, ArgX3_134, ArgY3_135);
                        succeeded = (SubResult3_136 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_136;
                        else
                          parse_tree__prog_data____Compare____mer_inst_0_0(&CompareResult_6, ArgX4_137, ArgY4_138);
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 15:
                {
                  MR_Integer ArgX1_139 = ((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Integer ArgY1_140;
                  MR_Word ArgX2_142 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_143;
                  MR_Word ArgX3_145 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_146;
                  MR_Word ArgX4_148 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Word ArgY4_149;
                  MR_Word ArgX5_151 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 5))) & (MR_Integer) 3);
                  MR_Word ArgY5_152;
                  MR_Word SubResult1_141;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 15)));
                  if (succeeded)
                  {
                    ArgY1_140 = ((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_143 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_146 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_149 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    ArgY5_152 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__3_3, 5))) & (MR_Integer) 3);
                    succeeded = (ArgX1_139 < ArgY1_140);
                    if (succeeded)
                    {
                      SubResult1_141 = (MR_Integer) 1;
                      succeeded = MR_TRUE;
                    }
                    else
                    {
                      succeeded = (ArgX1_139 > ArgY1_140);
                      if (succeeded)
                      {
                        SubResult1_141 = (MR_Integer) 2;
                        succeeded = MR_TRUE;
                      }
                    }
                    if (succeeded)
                      CompareResult_6 = SubResult1_141;
                    else
                    {
                      MR_Word SubResult2_144;

                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult2_144, ((MR_Box) (ArgX2_142)), ((MR_Box) (ArgY2_143)));
                      succeeded = (SubResult2_144 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_144;
                      else
                      {
                        MR_Word SubResult3_147;

                        parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult3_147, ArgX3_145, ArgY3_146);
                        succeeded = (SubResult3_147 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_147;
                        else
                        {
                          MR_Word SubResult4_150;

                          parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult4_150, ArgX4_148, ArgY4_149);
                          succeeded = (SubResult4_150 != (MR_Integer) 0);
                          if (succeeded)
                            CompareResult_6 = SubResult4_150;
                          else
                          {
                            MR_Integer Var_264 = (MR_Integer) (ArgX5_151);
                            MR_Integer Var_265 = (MR_Integer) (ArgY5_152);

                            succeeded = (Var_264 < Var_265);
                            if (succeeded)
                              CompareResult_6 = (MR_Integer) 1;
                            else
                            {
                              succeeded = (Var_264 > Var_265);
                              if (succeeded)
                                CompareResult_6 = (MR_Integer) 2;
                              else
                                CompareResult_6 = (MR_Integer) 0;
                            }
                          }
                        }
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 16:
                {
                  MR_Word ArgX1_153 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_154;
                  MR_Word ArgX2_156 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_157;
                  MR_Word ArgX3_159 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_160;
                  MR_Integer ArgX4_162 = ((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Integer ArgY4_163;
                  MR_Word ArgX5_165 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 5))));
                  MR_Word ArgY5_166;
                  MR_Word SubResult1_155;
                  MR_Word TypeInfo_207_207;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 16)));
                  if (succeeded)
                  {
                    ArgY1_154 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    ArgY2_157 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_160 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_163 = ((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    ArgY5_166 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 5))));
                    TypeInfo_207_207 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
                    mercury__builtin__compare_3_p_0(TypeInfo_207_207, &SubResult1_155, ((MR_Box) (ArgX1_153)), ((MR_Box) (ArgY1_154)));
                    succeeded = (SubResult1_155 != (MR_Integer) 0);
                    if (succeeded)
                      CompareResult_6 = SubResult1_155;
                    else
                    {
                      MR_Word SubResult2_158;

                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[12]), &SubResult2_158, ((MR_Box) (ArgX2_156)), ((MR_Box) (ArgY2_157)));
                      succeeded = (SubResult2_158 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_158;
                      else
                      {
                        MR_Word SubResult3_161;

                        hlds__hlds_pred____Compare____pred_id_0_0(&SubResult3_161, ArgX3_159, ArgY3_160);
                        succeeded = (SubResult3_161 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_161;
                        else
                        {
                          MR_Word SubResult4_164;

                          succeeded = (ArgX4_162 < ArgY4_163);
                          if (succeeded)
                          {
                            SubResult4_164 = (MR_Integer) 1;
                            succeeded = MR_TRUE;
                          }
                          else
                          {
                            succeeded = (ArgX4_162 > ArgY4_163);
                            if (succeeded)
                            {
                              SubResult4_164 = (MR_Integer) 2;
                              succeeded = MR_TRUE;
                            }
                          }
                          if (succeeded)
                            CompareResult_6 = SubResult4_164;
                          else
                            mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[13]), &CompareResult_6, ((MR_Box) (ArgX5_165)), ((MR_Box) (ArgY5_166)));
                        }
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 17:
                {
                  MR_Word ArgX1_167 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 1))) & (MR_Integer) 1);
                  MR_Word ArgY1_168;
                  MR_Word ArgX2_170 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_171;
                  MR_Word ArgX3_173 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                  MR_Word ArgY3_174;
                  MR_Word ArgX4_176 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                  MR_Word ArgY4_177;
                  MR_Word SubResult1_169;
                  MR_Integer Var_258;
                  MR_Integer Var_259;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 17)));
                  if (succeeded)
                  {
                    ArgY1_168 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__3_3, 1))) & (MR_Integer) 1);
                    ArgY2_171 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    ArgY3_174 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 3))));
                    ArgY4_177 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 4))));
                    Var_258 = (MR_Integer) (ArgX1_167);
                    Var_259 = (MR_Integer) (ArgY1_168);
                    succeeded = (Var_258 < Var_259);
                    if (succeeded)
                    {
                      SubResult1_169 = (MR_Integer) 1;
                      succeeded = MR_TRUE;
                    }
                    else
                    {
                      succeeded = (Var_258 > Var_259);
                      if (succeeded)
                      {
                        SubResult1_169 = (MR_Integer) 2;
                        succeeded = MR_TRUE;
                      }
                    }
                    if (succeeded)
                      CompareResult_6 = SubResult1_169;
                    else
                    {
                      MR_Word SubResult2_172;

                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult2_172, ((MR_Box) (ArgX2_170)), ((MR_Box) (ArgY2_171)));
                      succeeded = (SubResult2_172 != (MR_Integer) 0);
                      if (succeeded)
                        CompareResult_6 = SubResult2_172;
                      else
                      {
                        MR_Word SubResult3_175;

                        parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult3_175, ArgX3_173, ArgY3_174);
                        succeeded = (SubResult3_175 != (MR_Integer) 0);
                        if (succeeded)
                          CompareResult_6 = SubResult3_175;
                        else
                          parse_tree__prog_data____Compare____mer_inst_0_0(&CompareResult_6, ArgX4_176, ArgY4_177);
                      }
                    }
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 18:
                {
                  MR_Word ArgX1_178 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 1))) & (MR_Integer) 1);
                  MR_Word ArgY1_179;
                  MR_Word ArgX2_181 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                  MR_Word ArgY2_182;
                  MR_Word SubResult1_180;
                  MR_Integer Var_266;
                  MR_Integer Var_267;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 18)));
                  if (succeeded)
                  {
                    ArgY1_179 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__3_3, 1))) & (MR_Integer) 1);
                    ArgY2_182 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 2))));
                    Var_266 = (MR_Integer) (ArgX1_178);
                    Var_267 = (MR_Integer) (ArgY1_179);
                    succeeded = (Var_266 < Var_267);
                    if (succeeded)
                    {
                      SubResult1_180 = (MR_Integer) 1;
                      succeeded = MR_TRUE;
                    }
                    else
                    {
                      succeeded = (Var_266 > Var_267);
                      if (succeeded)
                      {
                        SubResult1_180 = (MR_Integer) 2;
                        succeeded = MR_TRUE;
                      }
                    }
                    if (succeeded)
                      CompareResult_6 = SubResult1_180;
                    else
                      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &CompareResult_6, ((MR_Box) (ArgX2_181)), ((MR_Box) (ArgY2_182)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
              case (MR_Integer) 19:
                {
                  MR_Word TypeInfo_251_251;
                  MR_Word ArgX1_183 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                  MR_Word ArgY1_184;

                  succeeded = ((((MR_tag((MR_Word) HeadVar__3_3)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__3_3, 0)))) == (MR_Integer) 19)));
                  if (succeeded)
                  {
                    ArgY1_184 = ((MR_Word) ((MR_hl_field(3, HeadVar__3_3, 1))));
                    TypeInfo_251_251 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[18]);
                    mercury__builtin__compare_3_p_0(TypeInfo_251_251, &CompareResult_6, ((MR_Box) (ArgX1_183)), ((MR_Box) (ArgY1_184)));
                    succeeded = MR_TRUE;
                  }
                }
                break;
            }
            break;
        }
        if (succeeded)
          *HeadVar__1_1 = CompareResult_6;
        else
          {
            mercury__private_builtin__compare_error_0_p_0();
            return;
          }
      }
    }
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____schedule_culprit_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_6 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_7 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_6 == CastY_7);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_unmkbody(HeadVar__2_2)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                  case (MR_Integer) 1:
                    *HeadVar__1_1 = (MR_Integer) 1;
                    break;
                }
                break;
              case (MR_Integer) 1:
                *HeadVar__1_1 = (MR_Integer) 1;
                break;
            }
            break;
          case (MR_Integer) 1:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                    *HeadVar__1_1 = (MR_Integer) 2;
                    break;
                  case (MR_Integer) 1:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                }
                break;
              case (MR_Integer) 1:
                *HeadVar__1_1 = (MR_Integer) 2;
                break;
            }
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            switch (MR_unmkbody(HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                *HeadVar__1_1 = (MR_Integer) 2;
                break;
              case (MR_Integer) 1:
                *HeadVar__1_1 = (MR_Integer) 1;
                break;
            }
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));

              hlds__hlds_goal____Compare____hlds_goal_0_0(HeadVar__1_1, ArgX1_4, ArgY1_5);
            }
            break;
        }
        break;
    }
}

void MR_CALL 
check_hlds__mode_errors____Compare____pred_id_var_multimode_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word SubResult1_6;

    hlds__hlds_pred____Compare____pred_id_0_0(&SubResult1_6, ArgX1_4, ArgY1_5);
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
      check_hlds__mode_errors____Compare____var_multimode_error_0_0(HeadVar__1_1, ArgX2_7, ArgY2_8);
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____var_multimode_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_19 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_20 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_19 == CastY_20);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), HeadVar__1_1, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
            }
            break;
          case (MR_Integer) 1:
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_7 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
              MR_Integer ArgX2_9 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 1))));
              MR_Integer ArgY2_10 = ((MR_Integer) ((MR_hl_field(1, HeadVar__3_3, 1))));
              MR_Integer ArgX3_12 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 2))));
              MR_Integer ArgY3_13 = ((MR_Integer) ((MR_hl_field(1, HeadVar__3_3, 2))));
              MR_Word ArgX4_15 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 3))));
              MR_Word ArgY4_16 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 3))));
              MR_Word SubResult1_8;

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), &SubResult1_8, ((MR_Box) (ArgX1_6)), ((MR_Box) (ArgY1_7)));
              succeeded = (SubResult1_8 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_8;
              else
              {
                MR_Word SubResult2_11;

                succeeded = (ArgX2_9 < ArgY2_10);
                if (succeeded)
                {
                  SubResult2_11 = (MR_Integer) 1;
                  succeeded = MR_TRUE;
                }
                else
                {
                  succeeded = (ArgX2_9 > ArgY2_10);
                  if (succeeded)
                  {
                    SubResult2_11 = (MR_Integer) 2;
                    succeeded = MR_TRUE;
                  }
                }
                if (succeeded)
                  *HeadVar__1_1 = SubResult2_11;
                else
                {
                  MR_Word SubResult3_14;

                  succeeded = (ArgX3_12 < ArgY3_13);
                  if (succeeded)
                  {
                    SubResult3_14 = (MR_Integer) 1;
                    succeeded = MR_TRUE;
                  }
                  else
                  {
                    succeeded = (ArgX3_12 > ArgY3_13);
                    if (succeeded)
                    {
                      SubResult3_14 = (MR_Integer) 2;
                      succeeded = MR_TRUE;
                    }
                  }
                  if (succeeded)
                    *HeadVar__1_1 = SubResult3_14;
                  else
                    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[21]), HeadVar__1_1, ((MR_Box) (ArgX4_15)), ((MR_Box) (ArgY4_16)));
                }
              }
            }
            break;
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_17 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_18 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), HeadVar__1_1, ((MR_Box) (ArgX1_17)), ((MR_Box) (ArgY1_18)));
            }
            break;
        }
        break;
    }
}

void MR_CALL 
check_hlds__mode_errors____Compare____mode_mismatch_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_12 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_13 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_12 == CastY_13);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Unsigned) ((MR_hl_field(0, HeadVar__2_2, 0))) & (MR_Integer) 1);
    MR_Word ArgY1_5 = ((MR_Unsigned) ((MR_hl_field(0, HeadVar__3_3, 0))) & (MR_Integer) 1);
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
    MR_Word SubResult1_6;
    MR_Integer Var_17 = (MR_Integer) (ArgX1_4);
    MR_Integer Var_18 = (MR_Integer) (ArgY1_5);

    succeeded = (Var_17 < Var_18);
    if (succeeded)
    {
      SubResult1_6 = (MR_Integer) 1;
      succeeded = MR_TRUE;
    }
    else
    {
      succeeded = (Var_17 > Var_18);
      if (succeeded)
      {
        SubResult1_6 = (MR_Integer) 2;
        succeeded = MR_TRUE;
      }
    }
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      MR_Word SubResult2_9;

      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[12]), &SubResult2_9, ((MR_Box) (ArgX2_7)), ((MR_Box) (ArgY2_8)));
      succeeded = (SubResult2_9 != (MR_Integer) 0);
      if (succeeded)
        *HeadVar__1_1 = SubResult2_9;
      else
        mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[20]), HeadVar__1_1, ((MR_Box) (ArgX3_10)), ((MR_Box) (ArgY3_11)));
    }
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_unify_rhs_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_16 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_17 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_16 == CastY_17);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), HeadVar__1_1, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
            }
            break;
          case (MR_Integer) 1:
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_7 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
              MR_Word ArgX2_9 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
              MR_Word ArgY2_10 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
              MR_Word SubResult1_8;

              parse_tree__prog_data____Compare____cons_id_0_0(&SubResult1_8, ArgX1_6, ArgY1_7);
              succeeded = (SubResult1_8 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_8;
              else
                mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), HeadVar__1_1, ((MR_Box) (ArgX2_9)), ((MR_Box) (ArgY2_10)));
            }
            break;
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_11 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_12 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));
              MR_Word ArgX2_14 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 1))));
              MR_Word ArgY2_15 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 1))));
              MR_Word SubResult1_13;

              mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]), &SubResult1_13, ((MR_Box) (ArgX1_11)), ((MR_Box) (ArgY1_12)));
              succeeded = (SubResult1_13 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_13;
              else
                mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[19]), HeadVar__1_1, ((MR_Box) (ArgX2_14)), ((MR_Box) (ArgY2_15)));
            }
            break;
        }
        break;
    }
}

void MR_CALL 
check_hlds__mode_errors____Index____mode_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Integer * HeadVar__2_2)
{
  switch (MR_tag((MR_Word) HeadVar__1_1)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      *HeadVar__2_2 = (MR_Integer) 0;
      break;
    case (MR_Integer) 1:
      *HeadVar__2_2 = (MR_Integer) 1;
      break;
    case (MR_Integer) 2:
      *HeadVar__2_2 = (MR_Integer) 2;
      break;
    case (MR_Integer) 3:
      switch (((MR_Integer) ((MR_hl_field(3, HeadVar__1_1, 0))))) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          *HeadVar__2_2 = (MR_Integer) 3;
          break;
        case (MR_Integer) 1:
          *HeadVar__2_2 = (MR_Integer) 4;
          break;
        case (MR_Integer) 2:
          *HeadVar__2_2 = (MR_Integer) 5;
          break;
        case (MR_Integer) 3:
          *HeadVar__2_2 = (MR_Integer) 6;
          break;
        case (MR_Integer) 4:
          *HeadVar__2_2 = (MR_Integer) 7;
          break;
        case (MR_Integer) 5:
          *HeadVar__2_2 = (MR_Integer) 8;
          break;
        case (MR_Integer) 6:
          *HeadVar__2_2 = (MR_Integer) 9;
          break;
        case (MR_Integer) 7:
          *HeadVar__2_2 = (MR_Integer) 10;
          break;
        case (MR_Integer) 8:
          *HeadVar__2_2 = (MR_Integer) 11;
          break;
        case (MR_Integer) 9:
          *HeadVar__2_2 = (MR_Integer) 12;
          break;
        case (MR_Integer) 10:
          *HeadVar__2_2 = (MR_Integer) 13;
          break;
        case (MR_Integer) 11:
          *HeadVar__2_2 = (MR_Integer) 14;
          break;
        case (MR_Integer) 12:
          *HeadVar__2_2 = (MR_Integer) 15;
          break;
        case (MR_Integer) 13:
          *HeadVar__2_2 = (MR_Integer) 16;
          break;
        case (MR_Integer) 14:
          *HeadVar__2_2 = (MR_Integer) 17;
          break;
        case (MR_Integer) 15:
          *HeadVar__2_2 = (MR_Integer) 18;
          break;
        case (MR_Integer) 16:
          *HeadVar__2_2 = (MR_Integer) 19;
          break;
        case (MR_Integer) 17:
          *HeadVar__2_2 = (MR_Integer) 20;
          break;
        case (MR_Integer) 18:
          *HeadVar__2_2 = (MR_Integer) 21;
          break;
        case (MR_Integer) 19:
          *HeadVar__2_2 = (MR_Integer) 22;
          break;
      }
      break;
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____match_what_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_8 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_9 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_8 == CastY_9);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_unmkbody(HeadVar__2_2)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                  case (MR_Integer) 1:
                  case (MR_Integer) 2:
                    *HeadVar__1_1 = (MR_Integer) 1;
                    break;
                }
                break;
              case (MR_Integer) 1:
              case (MR_Integer) 2:
                *HeadVar__1_1 = (MR_Integer) 2;
                break;
            }
            break;
          case (MR_Integer) 1:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                    *HeadVar__1_1 = (MR_Integer) 2;
                    break;
                  case (MR_Integer) 1:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                  case (MR_Integer) 2:
                    *HeadVar__1_1 = (MR_Integer) 1;
                    break;
                }
                break;
              case (MR_Integer) 1:
              case (MR_Integer) 2:
                *HeadVar__1_1 = (MR_Integer) 2;
                break;
            }
            break;
          case (MR_Integer) 2:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                  case (MR_Integer) 1:
                    *HeadVar__1_1 = (MR_Integer) 2;
                    break;
                  case (MR_Integer) 2:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                }
                break;
              case (MR_Integer) 1:
              case (MR_Integer) 2:
                *HeadVar__1_1 = (MR_Integer) 2;
                break;
            }
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));

              hlds__hlds_pred____Compare____pred_id_0_0(HeadVar__1_1, ArgX1_4, ArgY1_5);
            }
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_6 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_7 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));

              hlds__hlds_goal____Compare____generic_call_0_0(HeadVar__1_1, ArgX1_6, ArgY1_7);
            }
            break;
        }
        break;
    }
}

void MR_CALL 
check_hlds__mode_errors____Compare____higher_order_mismatch_info_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_8 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_9 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_8 == CastY_9);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_unmkbody(HeadVar__2_2)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                  case (MR_Integer) 1:
                    *HeadVar__1_1 = (MR_Integer) 1;
                    break;
                }
                break;
              case (MR_Integer) 1:
              case (MR_Integer) 2:
                *HeadVar__1_1 = (MR_Integer) 1;
                break;
            }
            break;
          case (MR_Integer) 1:
            switch (MR_tag((MR_Word) HeadVar__3_3)) {
              default: /*NOTREACHED*/ MR_assert(0);
              case (MR_Integer) 0:
                switch (MR_unmkbody(HeadVar__3_3)) {
                  default: /*NOTREACHED*/ MR_assert(0);
                  case (MR_Integer) 0:
                    *HeadVar__1_1 = (MR_Integer) 2;
                    break;
                  case (MR_Integer) 1:
                    *HeadVar__1_1 = (MR_Integer) 0;
                    break;
                }
                break;
              case (MR_Integer) 1:
              case (MR_Integer) 2:
                *HeadVar__1_1 = (MR_Integer) 1;
                break;
            }
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_4 = ((MR_Unsigned) ((MR_hl_field(1, HeadVar__2_2, 0))) & (MR_Integer) 1);
              MR_Word ArgY1_5 = ((MR_Unsigned) ((MR_hl_field(1, HeadVar__3_3, 0))) & (MR_Integer) 1);
              MR_Integer Var_14 = (MR_Integer) (ArgX1_4);
              MR_Integer Var_15 = (MR_Integer) (ArgY1_5);

              succeeded = (Var_14 < Var_15);
              if (succeeded)
                *HeadVar__1_1 = (MR_Integer) 1;
              else
              {
                succeeded = (Var_14 > Var_15);
                if (succeeded)
                  *HeadVar__1_1 = (MR_Integer) 2;
                else
                  *HeadVar__1_1 = (MR_Integer) 0;
              }
            }
            break;
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_6 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_7 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));
              MR_Integer Var_12 = (MR_Integer) (ArgX1_6);
              MR_Integer Var_13 = (MR_Integer) (ArgY1_7);

              succeeded = (Var_12 < Var_13);
              if (succeeded)
                *HeadVar__1_1 = (MR_Integer) 1;
              else
              {
                succeeded = (Var_12 > Var_13);
                if (succeeded)
                  *HeadVar__1_1 = (MR_Integer) 2;
                else
                  *HeadVar__1_1 = (MR_Integer) 0;
              }
            }
            break;
        }
        break;
    }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____delayed_goal_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
    MR_Word ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));

    succeeded = mercury__builtin__unify_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[8]), ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
    if (succeeded)
    {
      succeeded = check_hlds__mode_errors____Unify____mode_error_info_0_0(ArgX2_5, ArgY2_6);
      if (succeeded)
        succeeded = hlds__hlds_goal____Unify____hlds_goal_0_0(ArgX3_7, ArgY3_8);
    }
  }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_info_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_11 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_12 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_11 == CastY_12);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
    MR_Word ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgX4_9 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 3))));
    MR_Word ArgY4_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));

    succeeded = mercury__builtin__unify_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[8]), ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
    if (succeeded)
    {
      succeeded = check_hlds__mode_errors____Unify____mode_error_0_0(ArgX2_5, ArgY2_6);
      if (succeeded)
      {
        succeeded = mercury__term_context____Unify____term_context_0_0(ArgX3_7, ArgY3_8);
        if (succeeded)
          succeeded = check_hlds__mode_info____Unify____mode_context_0_0(ArgX4_9, ArgY4_10);
      }
    }
  }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_137 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_138 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_137 == CastY_138);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word TypeInfo_182_182;
          MR_Word TypeInfo_183_183;
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;
          MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
          MR_Word ArgY2_6;
          MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
          MR_Word ArgY3_8;
          MR_Word ArgX4_9 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 3))));
          MR_Word ArgY4_10;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 0);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
            ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
            ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
            ArgY4_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
            TypeInfo_182_182 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_182_182, ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
            if (succeeded)
            {
              TypeInfo_183_183 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
              succeeded = mercury__builtin__unify_2_p_0(TypeInfo_183_183, ((MR_Box) (ArgX2_5)), ((MR_Box) (ArgY2_6)));
              if (succeeded)
              {
                succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_7, ArgY3_8);
                if (succeeded)
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_9, ArgY4_10);
              }
            }
          }
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word TypeInfo_180_180;
          MR_Word ArgX1_11 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_12;
          MR_Word ArgX2_13 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 1))));
          MR_Word ArgY2_14;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_12 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            ArgY2_14 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
            TypeInfo_180_180 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_180_180, ((MR_Box) (ArgX1_11)), ((MR_Box) (ArgY1_12)));
            if (succeeded)
              succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX2_13, ArgY2_14);
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word TypeInfo_171_171;
          MR_Word TypeInfo_173_173;
          MR_Word TypeInfo_175_175;
          MR_Word ArgX1_15 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_16;
          MR_Word ArgX2_17 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 1))));
          MR_Word ArgY2_18;
          MR_Word ArgX3_19 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 2))));
          MR_Word ArgY3_20;
          MR_Word ArgX4_21 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 3))));
          MR_Word ArgY4_22;
          MR_Word ArgX5_23 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 4))));
          MR_Word ArgY5_24;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_16 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            ArgY2_18 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 1))));
            ArgY3_20 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 2))));
            ArgY4_22 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 3))));
            ArgY5_24 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 4))));
            TypeInfo_171_171 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_171_171, ((MR_Box) (ArgX1_15)), ((MR_Box) (ArgY1_16)));
            if (succeeded)
            {
              succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX2_17, ArgY2_18);
              if (succeeded)
              {
                TypeInfo_173_173 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_173_173, ((MR_Box) (ArgX3_19)), ((MR_Box) (ArgY3_20)));
                if (succeeded)
                {
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_21, ArgY4_22);
                  if (succeeded)
                  {
                    TypeInfo_175_175 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[12]);
                    succeeded = mercury__builtin__unify_2_p_0(TypeInfo_175_175, ((MR_Box) (ArgX5_23)), ((MR_Box) (ArgY5_24)));
                  }
                }
              }
            }
          }
        }
        break;
      case (MR_Integer) 3:
        switch (((MR_Integer) ((MR_hl_field(3, HeadVar__1_1, 0))))) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word TypeInfo_176_176;
              MR_Word ArgX1_25 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_26;
              MR_Word ArgX2_27 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_28;
              MR_Word ArgX3_29 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_30;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 0)));
              if (succeeded)
              {
                ArgY1_26 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_28 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_30 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                TypeInfo_176_176 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_176_176, ((MR_Box) (ArgX1_25)), ((MR_Box) (ArgY1_26)));
                if (succeeded)
                {
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX2_27, ArgY2_28);
                  if (succeeded)
                    succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_29, ArgY3_30);
                }
              }
            }
            break;
          case (MR_Integer) 1:
            {
              MR_Word TypeInfo_179_179;
              MR_Word ArgX1_31 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_32;
              MR_Word ArgX2_33 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_34;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 1)));
              if (succeeded)
              {
                ArgY1_32 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_34 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                TypeInfo_179_179 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_179_179, ((MR_Box) (ArgX1_31)), ((MR_Box) (ArgY1_32)));
                if (succeeded)
                  succeeded = check_hlds__mode_errors____Unify____pred_id_var_multimode_error_0_0(ArgX2_33, ArgY2_34);
              }
            }
            break;
          case (MR_Integer) 2:
            {
              MR_Word TypeInfo_164_164;
              MR_Word ArgX1_35 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_36;
              MR_Word ArgX2_37 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_38;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 2)));
              if (succeeded)
              {
                ArgY1_36 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_38 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                TypeInfo_164_164 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_164_164, ((MR_Box) (ArgX1_35)), ((MR_Box) (ArgY1_36)));
                if (succeeded)
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX2_37, ArgY2_38);
              }
            }
            break;
          case (MR_Integer) 3:
            {
              MR_Word TypeInfo_152_152;
              MR_Word ArgX1_39 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_40;
              MR_Word ArgX2_41 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_42;
              MR_Word ArgX3_43 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_44;
              MR_Word ArgX4_45 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__1_1, 4))) & (MR_Integer) 1);
              MR_Word ArgY4_46;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 3)));
              if (succeeded)
              {
                ArgY1_40 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_42 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_44 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_46 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 4))) & (MR_Integer) 1);
                TypeInfo_152_152 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_152_152, ((MR_Box) (ArgX1_39)), ((MR_Box) (ArgY1_40)));
                if (succeeded)
                {
                  succeeded = check_hlds__mode_errors____Unify____mode_error_unify_rhs_0_0(ArgX2_41, ArgY2_42);
                  if (succeeded)
                  {
                    succeeded = parse_tree__prog_data____Unify____mer_type_0_0(ArgX3_43, ArgY3_44);
                    if (succeeded)
                      succeeded = (ArgX4_45 == ArgY4_46);
                  }
                }
              }
            }
            break;
          case (MR_Integer) 4:
            {
              MR_Word TypeInfo_187_187;
              MR_Word TypeInfo_190_190;
              MR_Word ArgX1_47 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_48;
              MR_Word ArgX2_49 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_50;
              MR_Word ArgX3_51 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_52;
              MR_Word ArgX4_53 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Word ArgY4_54;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 4)));
              if (succeeded)
              {
                ArgY1_48 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_50 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_52 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_54 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                TypeInfo_187_187 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_187_187, ((MR_Box) (ArgX1_47)), ((MR_Box) (ArgY1_48)));
                if (succeeded)
                {
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX2_49, ArgY2_50);
                  if (succeeded)
                  {
                    succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_51, ArgY3_52);
                    if (succeeded)
                    {
                      TypeInfo_190_190 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[17]);
                      succeeded = mercury__builtin__unify_2_p_0(TypeInfo_190_190, ((MR_Box) (ArgX4_53)), ((MR_Box) (ArgY4_54)));
                    }
                  }
                }
              }
            }
            break;
          case (MR_Integer) 5:
            {
              MR_Word TypeInfo_150_150;
              MR_Word ArgX1_55 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_56;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 5)));
              if (succeeded)
              {
                ArgY1_56 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                TypeInfo_150_150 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_150_150, ((MR_Box) (ArgX1_55)), ((MR_Box) (ArgY1_56)));
              }
            }
            break;
          case (MR_Integer) 6:
            {
              MR_Word ArgX1_57 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_58;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 6)));
              if (succeeded)
              {
                ArgY1_58 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                succeeded = hlds__hlds_pred____Unify____pred_id_0_0(ArgX1_57, ArgY1_58);
              }
            }
            break;
          case (MR_Integer) 7:
            {
              MR_Word TypeInfo_162_162;
              MR_Word TypeInfo_163_163;
              MR_Word ArgX1_59 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_60;
              MR_Word ArgX2_61 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_62;
              MR_Word ArgX3_63 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_64;
              MR_Word ArgX4_65 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Word ArgY4_66;
              MR_Word ArgX5_67 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 5))));
              MR_Word ArgY5_68;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 7)));
              if (succeeded)
              {
                ArgY1_60 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_62 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_64 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_66 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                ArgY5_68 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 5))));
                succeeded = check_hlds__mode_errors____Unify____match_what_0_0(ArgX1_59, ArgY1_60);
                if (succeeded)
                {
                  succeeded = hlds__instmap____Unify____instmap_0_0(ArgX2_61, ArgY2_62);
                  if (succeeded)
                  {
                    TypeInfo_162_162 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
                    succeeded = mercury__builtin__unify_2_p_0(TypeInfo_162_162, ((MR_Box) (ArgX3_63)), ((MR_Box) (ArgY3_64)));
                    if (succeeded)
                    {
                      succeeded = check_hlds__mode_errors____Unify____mode_mismatch_0_0(ArgX4_65, ArgY4_66);
                      if (succeeded)
                      {
                        TypeInfo_163_163 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[15]);
                        succeeded = mercury__builtin__unify_2_p_0(TypeInfo_163_163, ((MR_Box) (ArgX5_67)), ((MR_Box) (ArgY5_68)));
                      }
                    }
                  }
                }
              }
            }
            break;
          case (MR_Integer) 8:
            {
              MR_Word TypeInfo_139_139;
              MR_Word ArgX1_69 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_70;
              MR_Word ArgX2_71 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_72;
              MR_Word ArgX3_73 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__1_1, 3))) & (MR_Integer) 1);
              MR_Word ArgY3_74;
              MR_Word ArgX4_75 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Word ArgY4_76;
              MR_Word ArgX5_77 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 5))));
              MR_Word ArgY5_78;
              MR_Integer Var_193;
              MR_Integer Var_194;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 8)));
              if (succeeded)
              {
                ArgY1_70 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_72 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_74 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 3))) & (MR_Integer) 1);
                ArgY4_76 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                ArgY5_78 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 5))));
                TypeInfo_139_139 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_139_139, ((MR_Box) (ArgX1_69)), ((MR_Box) (ArgY1_70)));
                if (succeeded)
                {
                  succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX2_71, ArgY2_72);
                  if (succeeded)
                  {
                    succeeded = (ArgX3_73 == ArgY3_74);
                    if (succeeded)
                    {
                      Var_193 = (MR_Integer) (ArgX4_75);
                      Var_194 = (MR_Integer) (ArgY4_76);
                      succeeded = (Var_193 == Var_194);
                      if (succeeded)
                        succeeded = check_hlds__mode_errors____Unify____higher_order_mismatch_info_0_0(ArgX5_77, ArgY5_78);
                    }
                  }
                }
              }
            }
            break;
          case (MR_Integer) 9:
            {
              MR_Word TypeInfo_186_186;
              MR_Word ArgX1_79 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_80;
              MR_Word ArgX2_81 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_82;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 9)));
              if (succeeded)
              {
                ArgY1_80 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_82 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                TypeInfo_186_186 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[16]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_186_186, ((MR_Box) (ArgX1_79)), ((MR_Box) (ArgY1_80)));
                if (succeeded)
                  succeeded = check_hlds__mode_errors____Unify____schedule_culprit_0_0(ArgX2_81, ArgY2_82);
              }
            }
            break;
          case (MR_Integer) 10:
            {
              MR_Word TypeInfo_160_160;
              MR_Word ArgX1_83 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_84;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 10)));
              if (succeeded)
              {
                ArgY1_84 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                TypeInfo_160_160 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[14]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_160_160, ((MR_Box) (ArgX1_83)), ((MR_Box) (ArgY1_84)));
              }
            }
            break;
          case (MR_Integer) 11:
            {
              MR_Word TypeInfo_159_159;
              MR_Word ArgX1_85 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__1_1, 1))) & (MR_Integer) 3);
              MR_Word ArgY1_86;
              MR_Word ArgX2_87 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_88;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 11)));
              if (succeeded)
              {
                ArgY1_86 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 1))) & (MR_Integer) 3);
                ArgY2_88 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                succeeded = (ArgX1_85 == ArgY1_86);
                if (succeeded)
                {
                  TypeInfo_159_159 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[14]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_159_159, ((MR_Box) (ArgX2_87)), ((MR_Box) (ArgY2_88)));
                }
              }
            }
            break;
          case (MR_Integer) 12:
            {
              MR_Word TypeInfo_151_151;
              MR_Word ArgX1_89 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_90;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 12)));
              if (succeeded)
              {
                ArgY1_90 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                TypeInfo_151_151 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[10]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_151_151, ((MR_Box) (ArgX1_89)), ((MR_Box) (ArgY1_90)));
              }
            }
            break;
          case (MR_Integer) 13:
            {
              MR_Word TypeInfo_166_166;
              MR_Word TypeInfo_167_167;
              MR_Word ArgX1_91 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_92;
              MR_Word ArgX2_93 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_94;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 13)));
              if (succeeded)
              {
                ArgY1_92 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_94 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                TypeInfo_166_166 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_166_166, ((MR_Box) (ArgX1_91)), ((MR_Box) (ArgY1_92)));
                if (succeeded)
                {
                  TypeInfo_167_167 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_167_167, ((MR_Box) (ArgX2_93)), ((MR_Box) (ArgY2_94)));
                }
              }
            }
            break;
          case (MR_Integer) 14:
            {
              MR_Word TypeInfo_143_143;
              MR_Word ArgX1_95 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_96;
              MR_Word ArgX2_97 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_98;
              MR_Word ArgX3_99 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_100;
              MR_Word ArgX4_101 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Word ArgY4_102;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 14)));
              if (succeeded)
              {
                ArgY1_96 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_98 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_100 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_102 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                succeeded = check_hlds__mode_info____Unify____var_lock_reason_0_0(ArgX1_95, ArgY1_96);
                if (succeeded)
                {
                  TypeInfo_143_143 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_143_143, ((MR_Box) (ArgX2_97)), ((MR_Box) (ArgY2_98)));
                  if (succeeded)
                  {
                    succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_99, ArgY3_100);
                    if (succeeded)
                      succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_101, ArgY4_102);
                  }
                }
              }
            }
            break;
          case (MR_Integer) 15:
            {
              MR_Word TypeInfo_168_168;
              MR_Integer ArgX1_103 = ((MR_Integer) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Integer ArgY1_104;
              MR_Word ArgX2_105 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_106;
              MR_Word ArgX3_107 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_108;
              MR_Word ArgX4_109 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Word ArgY4_110;
              MR_Word ArgX5_111 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__1_1, 5))) & (MR_Integer) 3);
              MR_Word ArgY5_112;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 15)));
              if (succeeded)
              {
                ArgY1_104 = ((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_106 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_108 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_110 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                ArgY5_112 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 5))) & (MR_Integer) 3);
                succeeded = (ArgX1_103 == ArgY1_104);
                if (succeeded)
                {
                  TypeInfo_168_168 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_168_168, ((MR_Box) (ArgX2_105)), ((MR_Box) (ArgY2_106)));
                  if (succeeded)
                  {
                    succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_107, ArgY3_108);
                    if (succeeded)
                    {
                      succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_109, ArgY4_110);
                      if (succeeded)
                        succeeded = (ArgX5_111 == ArgY5_112);
                    }
                  }
                }
              }
            }
            break;
          case (MR_Integer) 16:
            {
              MR_Word TypeInfo_154_154;
              MR_Word TypeInfo_155_155;
              MR_Word TypeInfo_158_158;
              MR_Word ArgX1_113 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_114;
              MR_Word ArgX2_115 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_116;
              MR_Word ArgX3_117 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_118;
              MR_Integer ArgX4_119 = ((MR_Integer) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Integer ArgY4_120;
              MR_Word ArgX5_121 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 5))));
              MR_Word ArgY5_122;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 16)));
              if (succeeded)
              {
                ArgY1_114 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                ArgY2_116 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_118 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_120 = ((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 4))));
                ArgY5_122 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 5))));
                TypeInfo_154_154 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_154_154, ((MR_Box) (ArgX1_113)), ((MR_Box) (ArgY1_114)));
                if (succeeded)
                {
                  TypeInfo_155_155 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[12]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_155_155, ((MR_Box) (ArgX2_115)), ((MR_Box) (ArgY2_116)));
                  if (succeeded)
                  {
                    succeeded = hlds__hlds_pred____Unify____pred_id_0_0(ArgX3_117, ArgY3_118);
                    if (succeeded)
                    {
                      succeeded = (ArgX4_119 == ArgY4_120);
                      if (succeeded)
                      {
                        TypeInfo_158_158 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[13]);
                        succeeded = mercury__builtin__unify_2_p_0(TypeInfo_158_158, ((MR_Box) (ArgX5_121)), ((MR_Box) (ArgY5_122)));
                      }
                    }
                  }
                }
              }
            }
            break;
          case (MR_Integer) 17:
            {
              MR_Word TypeInfo_147_147;
              MR_Word ArgX1_123 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__1_1, 1))) & (MR_Integer) 1);
              MR_Word ArgY1_124;
              MR_Word ArgX2_125 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_126;
              MR_Word ArgX3_127 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 3))));
              MR_Word ArgY3_128;
              MR_Word ArgX4_129 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 4))));
              MR_Word ArgY4_130;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 17)));
              if (succeeded)
              {
                ArgY1_124 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 1))) & (MR_Integer) 1);
                ArgY2_126 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                ArgY3_128 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 3))));
                ArgY4_130 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 4))));
                succeeded = (ArgX1_123 == ArgY1_124);
                if (succeeded)
                {
                  TypeInfo_147_147 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_147_147, ((MR_Box) (ArgX2_125)), ((MR_Box) (ArgY2_126)));
                  if (succeeded)
                  {
                    succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX3_127, ArgY3_128);
                    if (succeeded)
                      succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_129, ArgY4_130);
                  }
                }
              }
            }
            break;
          case (MR_Integer) 18:
            {
              MR_Word TypeInfo_192_192;
              MR_Word ArgX1_131 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__1_1, 1))) & (MR_Integer) 1);
              MR_Word ArgY1_132;
              MR_Word ArgX2_133 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 2))));
              MR_Word ArgY2_134;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 18)));
              if (succeeded)
              {
                ArgY1_132 = ((MR_Unsigned) ((MR_hl_field(3, HeadVar__2_2, 1))) & (MR_Integer) 1);
                ArgY2_134 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 2))));
                succeeded = (ArgX1_131 == ArgY1_132);
                if (succeeded)
                {
                  TypeInfo_192_192 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_192_192, ((MR_Box) (ArgX2_133)), ((MR_Box) (ArgY2_134)));
                }
              }
            }
            break;
          case (MR_Integer) 19:
            {
              MR_Word TypeInfo_191_191;
              MR_Word ArgX1_135 = ((MR_Word) ((MR_hl_field(3, HeadVar__1_1, 1))));
              MR_Word ArgY1_136;

              succeeded = ((((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, HeadVar__2_2, 0)))) == (MR_Integer) 19)));
              if (succeeded)
              {
                ArgY1_136 = ((MR_Word) ((MR_hl_field(3, HeadVar__2_2, 1))));
                TypeInfo_191_191 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[18]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_191_191, ((MR_Box) (ArgX1_135)), ((MR_Box) (ArgY1_136)));
              }
            }
            break;
        }
        break;
    }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____schedule_culprit_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_7 == CastY_8);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Integer CastX_5 = (MR_Integer) (HeadVar__1_1);
          MR_Integer CastY_6 = (MR_Integer) (HeadVar__2_2);

          succeeded = (CastY_6 == CastX_5);
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            succeeded = hlds__hlds_goal____Unify____hlds_goal_0_0(ArgX1_3, ArgY1_4);
          }
        }
        break;
    }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____pred_id_var_multimode_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_7 == CastY_8);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));

    succeeded = hlds__hlds_pred____Unify____pred_id_0_0(ArgX1_3, ArgY1_4);
    if (succeeded)
      succeeded = check_hlds__mode_errors____Unify____var_multimode_error_0_0(ArgX2_5, ArgY2_6);
  }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____var_multimode_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_15 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_16 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_15 == CastY_16);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word TypeInfo_21_21;
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 0);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
            TypeInfo_21_21 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_21_21, ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
          }
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word TypeInfo_17_17;
          MR_Word TypeInfo_20_20;
          MR_Word ArgX1_5 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_6;
          MR_Integer ArgX2_7 = ((MR_Integer) ((MR_hl_field(1, HeadVar__1_1, 1))));
          MR_Integer ArgY2_8;
          MR_Integer ArgX3_9 = ((MR_Integer) ((MR_hl_field(1, HeadVar__1_1, 2))));
          MR_Integer ArgY3_10;
          MR_Word ArgX4_11 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 3))));
          MR_Word ArgY4_12;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            ArgY2_8 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 1))));
            ArgY3_10 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 2))));
            ArgY4_12 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 3))));
            TypeInfo_17_17 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_17_17, ((MR_Box) (ArgX1_5)), ((MR_Box) (ArgY1_6)));
            if (succeeded)
            {
              succeeded = (ArgX2_7 == ArgY2_8);
              if (succeeded)
              {
                succeeded = (ArgX3_9 == ArgY3_10);
                if (succeeded)
                {
                  TypeInfo_20_20 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[21]);
                  succeeded = mercury__builtin__unify_2_p_0(TypeInfo_20_20, ((MR_Box) (ArgX4_11)), ((MR_Box) (ArgY4_12)));
                }
              }
            }
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word TypeInfo_22_22;
          MR_Word ArgX1_13 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_14;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_14 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            TypeInfo_22_22 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_22_22, ((MR_Box) (ArgX1_13)), ((MR_Box) (ArgY1_14)));
          }
        }
        break;
    }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_mismatch_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word TypeInfo_11_11;
    MR_Word TypeInfo_12_12;
    MR_Word ArgX1_3 = ((MR_Unsigned) ((MR_hl_field(0, HeadVar__1_1, 0))) & (MR_Integer) 1);
    MR_Word ArgY1_4 = ((MR_Unsigned) ((MR_hl_field(0, HeadVar__2_2, 0))) & (MR_Integer) 1);
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
    MR_Word ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));

    succeeded = (ArgX1_3 == ArgY1_4);
    if (succeeded)
    {
      TypeInfo_11_11 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[12]);
      succeeded = mercury__builtin__unify_2_p_0(TypeInfo_11_11, ((MR_Box) (ArgX2_5)), ((MR_Box) (ArgY2_6)));
      if (succeeded)
      {
        TypeInfo_12_12 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[20]);
        succeeded = mercury__builtin__unify_2_p_0(TypeInfo_12_12, ((MR_Box) (ArgX3_7)), ((MR_Box) (ArgY3_8)));
      }
    }
  }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_unify_rhs_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_13 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_14 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_13 == CastY_14);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word TypeInfo_19_19;
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 0);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
            TypeInfo_19_19 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_19_19, ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
          }
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word TypeInfo_16_16;
          MR_Word ArgX1_5 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_6;
          MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 1))));
          MR_Word ArgY2_8;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            ArgY2_8 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
            succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX1_5, ArgY1_6);
            if (succeeded)
            {
              TypeInfo_16_16 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
              succeeded = mercury__builtin__unify_2_p_0(TypeInfo_16_16, ((MR_Box) (ArgX2_7)), ((MR_Box) (ArgY2_8)));
            }
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word TypeInfo_17_17;
          MR_Word TypeInfo_18_18;
          MR_Word ArgX1_9 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_10;
          MR_Word ArgX2_11 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 1))));
          MR_Word ArgY2_12;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_10 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            ArgY2_12 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 1))));
            TypeInfo_17_17 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[11]);
            succeeded = mercury__builtin__unify_2_p_0(TypeInfo_17_17, ((MR_Box) (ArgX1_9)), ((MR_Box) (ArgY1_10)));
            if (succeeded)
            {
              TypeInfo_18_18 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[19]);
              succeeded = mercury__builtin__unify_2_p_0(TypeInfo_18_18, ((MR_Box) (ArgX2_11)), ((MR_Box) (ArgY2_12)));
            }
          }
        }
        break;
    }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____match_what_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
          MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

          succeeded = (CastY_8 == CastX_7);
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            succeeded = hlds__hlds_pred____Unify____pred_id_0_0(ArgX1_3, ArgY1_4);
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word ArgX1_5 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_6;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_6 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            succeeded = hlds__hlds_goal____Unify____generic_call_0_0(ArgX1_5, ArgY1_6);
          }
        }
        break;
    }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____higher_order_mismatch_info_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
          MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

          succeeded = (CastY_8 == CastX_7);
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word ArgX1_3 = ((MR_Unsigned) ((MR_hl_field(1, HeadVar__1_1, 0))) & (MR_Integer) 1);
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Unsigned) ((MR_hl_field(1, HeadVar__2_2, 0))) & (MR_Integer) 1);
            succeeded = (ArgX1_3 == ArgY1_4);
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word ArgX1_5 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_6;
          MR_Integer Var_12;
          MR_Integer Var_13;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_6 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            Var_12 = (MR_Integer) (ArgX1_5);
            Var_13 = (MR_Integer) (ArgY1_6);
            succeeded = (Var_12 == Var_13);
          }
        }
        break;
    }
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_term_path_step_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Integer ArgX2_7 = ((MR_Integer) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Integer ArgY2_8 = ((MR_Integer) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word SubResult1_6;

    parse_tree__prog_data____Compare____cons_id_0_0(&SubResult1_6, ArgX1_4, ArgY1_5);
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      succeeded = (ArgX2_7 < ArgY2_8);
      if (succeeded)
        *HeadVar__1_1 = (MR_Integer) 1;
      else
      {
        succeeded = (ArgX2_7 > ArgY2_8);
        if (succeeded)
          *HeadVar__1_1 = (MR_Integer) 2;
        else
          *HeadVar__1_1 = (MR_Integer) 0;
      }
    }
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_term_path_step_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_7 == CastY_8);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Integer ArgX2_5 = ((MR_Integer) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Integer ArgY2_6 = ((MR_Integer) ((MR_hl_field(0, HeadVar__2_2, 1))));

    succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX1_3, ArgY1_4);
    if (succeeded)
      succeeded = (ArgX2_5 == ArgY2_6);
  }
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_15 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_16 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_15 == CastY_16);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
    MR_Word ArgX4_13 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
    MR_Word ArgY4_14 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 3))));
    MR_Word SubResult1_6;

    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[6]), &SubResult1_6, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      MR_Word SubResult2_9;

      parse_tree__prog_data____Compare____mer_type_0_0(&SubResult2_9, ArgX2_7, ArgY2_8);
      succeeded = (SubResult2_9 != (MR_Integer) 0);
      if (succeeded)
        *HeadVar__1_1 = SubResult2_9;
      else
      {
        MR_Word SubResult3_12;

        parse_tree__prog_data____Compare____mer_type_0_0(&SubResult3_12, ArgX3_10, ArgY3_11);
        succeeded = (SubResult3_12 != (MR_Integer) 0);
        if (succeeded)
          *HeadVar__1_1 = SubResult3_12;
        else
          check_hlds__mode_errors____Compare____coerce_error_reason_0_0(HeadVar__1_1, ArgX4_13, ArgY4_14);
      }
    }
  }
}

void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_reason_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_16 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_17 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_16 == CastY_17);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));

              parse_tree__prog_data____Compare____mer_inst_0_0(HeadVar__1_1, ArgX1_4, ArgY1_5);
            }
            break;
          case (MR_Integer) 1:
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_7 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
              MR_Word ArgX2_9 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
              MR_Word ArgY2_10 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
              MR_Word ArgX3_12 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 2))));
              MR_Word ArgY3_13 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 2))));
              MR_Word SubResult1_8;

              parse_tree__prog_data____Compare____mer_inst_0_0(&SubResult1_8, ArgX1_6, ArgY1_7);
              succeeded = (SubResult1_8 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_8;
              else
              {
                MR_Word SubResult2_11;

                check_hlds__mode_errors____Compare____bound_functor_cons_id_error_0_0(&SubResult2_11, ArgX2_9, ArgY2_10);
                succeeded = (SubResult2_11 != (MR_Integer) 0);
                if (succeeded)
                  *HeadVar__1_1 = SubResult2_11;
                else
                  mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[7]), HeadVar__1_1, ((MR_Box) (ArgX3_12)), ((MR_Box) (ArgY3_13)));
              }
            }
            break;
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_14 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_15 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));

              parse_tree__prog_data____Compare____mer_inst_0_0(HeadVar__1_1, ArgX1_14, ArgY1_15);
            }
            break;
        }
        break;
    }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_11 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_12 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_11 == CastY_12);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
    MR_Word ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgX4_9 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 3))));
    MR_Word ArgY4_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));

    succeeded = mercury__builtin__unify_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[6]), ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
    if (succeeded)
    {
      succeeded = parse_tree__prog_data____Unify____mer_type_0_0(ArgX2_5, ArgY2_6);
      if (succeeded)
      {
        succeeded = parse_tree__prog_data____Unify____mer_type_0_0(ArgX3_7, ArgY3_8);
        if (succeeded)
          succeeded = check_hlds__mode_errors____Unify____coerce_error_reason_0_0(ArgX4_9, ArgY4_10);
      }
    }
  }
  return succeeded;
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_reason_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_13 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_14 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_13 == CastY_14);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 0);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
            succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX1_3, ArgY1_4);
          }
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word TypeInfo_16_16;
          MR_Word ArgX1_5 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_6;
          MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 1))));
          MR_Word ArgY2_8;
          MR_Word ArgX3_9 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 2))));
          MR_Word ArgY3_10;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            ArgY2_8 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
            ArgY3_10 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 2))));
            succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX1_5, ArgY1_6);
            if (succeeded)
            {
              succeeded = check_hlds__mode_errors____Unify____bound_functor_cons_id_error_0_0(ArgX2_7, ArgY2_8);
              if (succeeded)
              {
                TypeInfo_16_16 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[7]);
                succeeded = mercury__builtin__unify_2_p_0(TypeInfo_16_16, ((MR_Box) (ArgX3_9)), ((MR_Box) (ArgY3_10)));
              }
            }
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word ArgX1_11 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_12;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_12 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX1_11, ArgY1_12);
          }
        }
        break;
    }
  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____cannot_create_reason_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer Cast_HeadVar1_4 = (MR_Integer) (HeadVar__2_2);
  MR_Integer Cast_HeadVar2_5 = (MR_Integer) (HeadVar__3_3);

  succeeded = (Cast_HeadVar1_4 < Cast_HeadVar2_5);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 1;
  else
  {
    succeeded = (Cast_HeadVar1_4 > Cast_HeadVar2_5);
    if (succeeded)
      *HeadVar__1_1 = (MR_Integer) 2;
    else
      *HeadVar__1_1 = (MR_Integer) 0;
  }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____cannot_create_reason_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded = (HeadVar__1_1 == HeadVar__2_2);

  return succeeded;
}

void MR_CALL 
check_hlds__mode_errors____Compare____bound_functor_cons_id_error_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_16 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_17 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_16 == CastY_17);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
    switch (MR_tag((MR_Word) HeadVar__2_2)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
              MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));

              parse_tree__prog_data____Compare____cons_id_0_0(HeadVar__1_1, ArgX1_4, ArgY1_5);
            }
            break;
          case (MR_Integer) 1:
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 1:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 1:
            {
              MR_Word ArgX1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
              MR_Word ArgY1_7 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
              MR_Integer ArgX2_9 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 1))));
              MR_Integer ArgY2_10 = ((MR_Integer) ((MR_hl_field(1, HeadVar__3_3, 1))));
              MR_Integer ArgX3_12 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 2))));
              MR_Integer ArgY3_13 = ((MR_Integer) ((MR_hl_field(1, HeadVar__3_3, 2))));
              MR_Word SubResult1_8;

              parse_tree__prog_data____Compare____cons_id_0_0(&SubResult1_8, ArgX1_6, ArgY1_7);
              succeeded = (SubResult1_8 != (MR_Integer) 0);
              if (succeeded)
                *HeadVar__1_1 = SubResult1_8;
              else
              {
                MR_Word SubResult2_11;

                succeeded = (ArgX2_9 < ArgY2_10);
                if (succeeded)
                {
                  SubResult2_11 = (MR_Integer) 1;
                  succeeded = MR_TRUE;
                }
                else
                {
                  succeeded = (ArgX2_9 > ArgY2_10);
                  if (succeeded)
                  {
                    SubResult2_11 = (MR_Integer) 2;
                    succeeded = MR_TRUE;
                  }
                }
                if (succeeded)
                  *HeadVar__1_1 = SubResult2_11;
                else
                {
                  succeeded = (ArgX3_12 < ArgY3_13);
                  if (succeeded)
                    *HeadVar__1_1 = (MR_Integer) 1;
                  else
                  {
                    succeeded = (ArgX3_12 > ArgY3_13);
                    if (succeeded)
                      *HeadVar__1_1 = (MR_Integer) 2;
                    else
                      *HeadVar__1_1 = (MR_Integer) 0;
                  }
                }
              }
            }
            break;
          case (MR_Integer) 2:
            *HeadVar__1_1 = (MR_Integer) 1;
            break;
        }
        break;
      case (MR_Integer) 2:
        switch (MR_tag((MR_Word) HeadVar__3_3)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            *HeadVar__1_1 = (MR_Integer) 2;
            break;
          case (MR_Integer) 2:
            {
              MR_Word ArgX1_14 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
              MR_Word ArgY1_15 = ((MR_Word) ((MR_hl_field(2, HeadVar__3_3, 0))));

              parse_tree__prog_data____Compare____cons_id_0_0(HeadVar__1_1, ArgX1_14, ArgY1_15);
            }
            break;
        }
        break;
    }
}

MR_bool MR_CALL 
check_hlds__mode_errors____Unify____bound_functor_cons_id_error_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_13 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_14 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_13 == CastY_14);
  if (succeeded)
    succeeded = MR_TRUE;
  else
    switch (MR_tag((MR_Word) HeadVar__1_1)) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
          MR_Word ArgY1_4;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 0);
          if (succeeded)
          {
            ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
            succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX1_3, ArgY1_4);
          }
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word ArgX1_5 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
          MR_Word ArgY1_6;
          MR_Integer ArgX2_7 = ((MR_Integer) ((MR_hl_field(1, HeadVar__1_1, 1))));
          MR_Integer ArgY2_8;
          MR_Integer ArgX3_9 = ((MR_Integer) ((MR_hl_field(1, HeadVar__1_1, 2))));
          MR_Integer ArgY3_10;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 1);
          if (succeeded)
          {
            ArgY1_6 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
            ArgY2_8 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 1))));
            ArgY3_10 = ((MR_Integer) ((MR_hl_field(1, HeadVar__2_2, 2))));
            succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX1_5, ArgY1_6);
            if (succeeded)
            {
              succeeded = (ArgX2_7 == ArgY2_8);
              if (succeeded)
                succeeded = (ArgX3_9 == ArgY3_10);
            }
          }
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word ArgX1_11 = ((MR_Word) ((MR_hl_field(2, HeadVar__1_1, 0))));
          MR_Word ArgY1_12;

          succeeded = ((MR_tag((MR_Word) HeadVar__2_2)) == (MR_Integer) 2);
          if (succeeded)
          {
            ArgY1_12 = ((MR_Word) ((MR_hl_field(2, HeadVar__2_2, 0))));
            succeeded = parse_tree__prog_data____Unify____cons_id_0_0(ArgX1_11, ArgY1_12);
          }
        }
        break;
    }
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____argnum_var_type_inst_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_15 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_16 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_15 == CastY_16);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Integer ArgX1_4 = ((MR_Integer) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Integer ArgY1_5 = ((MR_Integer) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word ArgX3_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgY3_11 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 2))));
    MR_Word ArgX4_13 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));
    MR_Word ArgY4_14 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 3))));
    MR_Word SubResult1_6;

    succeeded = (ArgX1_4 < ArgY1_5);
    if (succeeded)
    {
      SubResult1_6 = (MR_Integer) 1;
      succeeded = MR_TRUE;
    }
    else
    {
      succeeded = (ArgX1_4 > ArgY1_5);
      if (succeeded)
      {
        SubResult1_6 = (MR_Integer) 2;
        succeeded = MR_TRUE;
      }
    }
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
    {
      MR_Word SubResult2_9;

      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), &SubResult2_9, ((MR_Box) (ArgX2_7)), ((MR_Box) (ArgY2_8)));
      succeeded = (SubResult2_9 != (MR_Integer) 0);
      if (succeeded)
        *HeadVar__1_1 = SubResult2_9;
      else
      {
        MR_Word SubResult3_12;

        parse_tree__prog_data____Compare____mer_type_0_0(&SubResult3_12, ArgX3_10, ArgY3_11);
        succeeded = (SubResult3_12 != (MR_Integer) 0);
        if (succeeded)
          *HeadVar__1_1 = SubResult3_12;
        else
          parse_tree__prog_data____Compare____mer_inst_0_0(HeadVar__1_1, ArgX4_13, ArgY4_14);
      }
    }
  }
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____argnum_var_type_inst_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_11 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_12 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_11 == CastY_12);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word TypeInfo_13_13;
    MR_Integer ArgX1_3 = ((MR_Integer) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Integer ArgY1_4 = ((MR_Integer) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgX3_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 2))));
    MR_Word ArgY3_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 2))));
    MR_Word ArgX4_9 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 3))));
    MR_Word ArgY4_10 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 3))));

    succeeded = (ArgX1_3 == ArgY1_4);
    if (succeeded)
    {
      TypeInfo_13_13 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]);
      succeeded = mercury__builtin__unify_2_p_0(TypeInfo_13_13, ((MR_Box) (ArgX2_5)), ((MR_Box) (ArgY2_6)));
      if (succeeded)
      {
        succeeded = parse_tree__prog_data____Unify____mer_type_0_0(ArgX3_7, ArgY3_8);
        if (succeeded)
          succeeded = parse_tree__prog_data____Unify____mer_inst_0_0(ArgX4_9, ArgY4_10);
      }
    }
  }
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____arg_ok_or_not_0_0(
  MR_Word * HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3)
{
  MR_bool succeeded;
  MR_Integer CastX_9 = (MR_Integer) (HeadVar__2_2);
  MR_Integer CastY_10 = (MR_Integer) (HeadVar__3_3);

  succeeded = (CastX_9 == CastY_10);
  if (succeeded)
    *HeadVar__1_1 = (MR_Integer) 0;
  else
  {
    MR_Word ArgX1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgY1_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 0))));
    MR_Word ArgX2_7 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));
    MR_Word ArgY2_8 = ((MR_Word) ((MR_hl_field(0, HeadVar__3_3, 1))));
    MR_Word SubResult1_6;

    mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[5]), &SubResult1_6, ((MR_Box) (ArgX1_4)), ((MR_Box) (ArgY1_5)));
    succeeded = (SubResult1_6 != (MR_Integer) 0);
    if (succeeded)
      *HeadVar__1_1 = SubResult1_6;
    else
      mercury__builtin__compare_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[5]), HeadVar__1_1, ((MR_Box) (ArgX2_7)), ((MR_Box) (ArgY2_8)));
  }
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____arg_ok_or_not_0_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2)
{
  MR_bool succeeded;
  MR_Integer CastX_7 = (MR_Integer) (HeadVar__1_1);
  MR_Integer CastY_8 = (MR_Integer) (HeadVar__2_2);

  succeeded = (CastX_7 == CastY_8);
  if (succeeded)
    succeeded = MR_TRUE;
  else
  {
    MR_Word TypeInfo_10_10;
    MR_Word ArgX1_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
    MR_Word ArgY1_4 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 0))));
    MR_Word ArgX2_5 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 1))));
    MR_Word ArgY2_6 = ((MR_Word) ((MR_hl_field(0, HeadVar__2_2, 1))));

    succeeded = mercury__builtin__unify_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[5]), ((MR_Box) (ArgX1_3)), ((MR_Box) (ArgY1_4)));
    if (succeeded)
    {
      TypeInfo_10_10 = (MR_Word) (&check_hlds__mode_errors_scalar_common_1[5]);
      succeeded = mercury__builtin__unify_2_p_0(TypeInfo_10_10, ((MR_Box) (ArgX2_5)), ((MR_Box) (ArgY2_6)));
    }
  }
  return succeeded;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_context_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word ReportIsGround_9,
  MR_Word MaybeColor_10,
  MR_Word VarNamePiece_11,
  MR_Word Type_12,
  MR_Word HeadVar__6_6)
{
  MR_bool succeeded;
  MR_Word Msg_15;
  MR_Word Context_13 = ((MR_Word) ((MR_hl_field(0, HeadVar__6_6, 0))));
  MR_Word Inst_14 = ((MR_Word) ((MR_hl_field(0, HeadVar__6_6, 1))));

  switch (ReportIsGround_9) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 1:
      {
        MR_Word ModuleInfo_17;
        MR_Word Pieces_30;

        check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_17);
        succeeded = hlds__inst_test__inst_is_ground_3_p_0(ModuleInfo_17, Type_12, Inst_14);
        if (succeeded)
          Pieces_30 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_10, VarNamePiece_11, (MR_String) "ground");
        else
        {
          succeeded = (Inst_14 == (MR_Word) ((MR_Unsigned) 0U));
          if (succeeded)
            Pieces_30 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_10, VarNamePiece_11, (MR_String) "free");
          else
            Pieces_30 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_10, VarNamePiece_11, (MR_String) "not ground");
        }
        {
          Msg_15 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
          MR_hl_field(0, Msg_15, 0) = ((MR_Box) (Context_13));
          MR_hl_field(0, Msg_15, 1) = ((MR_Box) (Pieces_30));
        }
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word ModuleInfo_35;

        check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_35);
        succeeded = hlds__inst_test__inst_is_ground_3_p_0(ModuleInfo_35, Type_12, Inst_14);
        if (succeeded)
        {
          MR_Word Var_24;
          MR_Word Var_25;
          MR_Word Pieces_31;

          Pieces_31 = check_hlds__mode_errors__report_inst_in_branch_5_f_0(ModeInfo_8, MaybeColor_10, VarNamePiece_11, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[8])), Inst_14);
          {
            Var_25 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(2, Var_25, 0) = ((MR_Box) (Pieces_31));
            MR_hl_field(2, Var_25, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          {
            Var_24 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_24, 0) = ((MR_Box) (Var_25));
            MR_hl_field(1, Var_24, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          {
            Msg_15 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(2, Msg_15, 0) = ((MR_Box) (Context_13));
            MR_hl_field(2, Msg_15, 1) = ((MR_Box) (Var_24));
          }
        }
        else
        {
          MR_Word Pieces_32;

          Pieces_32 = check_hlds__mode_errors__report_inst_in_branch_5_f_0(ModeInfo_8, MaybeColor_10, VarNamePiece_11, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[9])), Inst_14);
          {
            Msg_15 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
            MR_hl_field(0, Msg_15, 0) = ((MR_Box) (Context_13));
            MR_hl_field(0, Msg_15, 1) = ((MR_Box) (Pieces_32));
          }
        }
      }
      break;
    case (MR_Integer) 0:
      {
        MR_Word Pieces_16;

        Pieces_16 = check_hlds__mode_errors__report_inst_in_branch_5_f_0(ModeInfo_8, MaybeColor_10, VarNamePiece_11, (MR_Word) ((MR_Unsigned) 0U), Inst_14);
        {
          Msg_15 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
          MR_hl_field(0, Msg_15, 0) = ((MR_Box) (Context_13));
          MR_hl_field(0, Msg_15, 1) = ((MR_Box) (Pieces_16));
        }
      }
      break;
  }
  return Msg_15;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_branch_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word MaybeColor_8,
  MR_Word VarNamePiece_9,
  MR_Word MaybeGroundOrNonGround_10,
  MR_Word Inst_11)
{
  MR_bool succeeded;
  MR_Word Pieces_12;

  if ((MaybeGroundOrNonGround_10 == (MR_Word) ((MR_Unsigned) 0U)))
  {
    MR_Word Var_14;
    MR_Word Var_15;

    succeeded = ((MR_tag((MR_Word) Inst_11)) == (MR_Integer) 1);
    if (succeeded)
    {
      Var_14 = ((MR_Unsigned) ((MR_hl_field(1, Inst_11, 0))) & (MR_Integer) 7);
      Var_15 = ((MR_Word) ((MR_hl_field(1, Inst_11, 1))));
      succeeded = (Var_14 == (MR_Integer) 0);
      if (succeeded)
        succeeded = (Var_15 == (MR_Word) ((MR_Unsigned) 0U));
    }
    if (succeeded)
      Pieces_12 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_8, VarNamePiece_9, (MR_String) "ground");
    else
    {
      succeeded = (Inst_11 == (MR_Word) ((MR_Unsigned) 0U));
      if (succeeded)
        Pieces_12 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_8, VarNamePiece_9, (MR_String) "free");
      else
      {
        MR_Word IntroPieces_13;
        MR_Word Var_20;
        MR_Word Var_50;
        MR_Word Var_53;
        MR_Word Var_58;
        MR_Word Var_59;
        MR_Word ModuleInfo_65;
        MR_Word InstVarSet_66;

        {
          Var_20 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_20, 0) = ((MR_Box) (VarNamePiece_9));
          MR_hl_field(1, Var_20, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[371])));
        }
        {
          IntroPieces_13 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, IntroPieces_13, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[554])));
          MR_hl_field(1, IntroPieces_13, 1) = ((MR_Box) (Var_20));
        }
        {
          Var_50 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_50, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195])));
          MR_hl_field(1, Var_50, 1) = ((MR_Box) (IntroPieces_13));
        }
        check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_7, &ModuleInfo_65);
        check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_7, &InstVarSet_66);
        Var_59 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_65, InstVarSet_66, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[561])), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[561])), Inst_11);
        Var_58 = parse_tree__error_spec__maybe_color_pieces_2_f_0(MaybeColor_8, Var_59);
        Var_53 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_58);
        Pieces_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_50, Var_53);
      }
    }
  }
  else
  {
    MR_Word Var_49 = ((MR_Word) ((MR_hl_field(1, MaybeGroundOrNonGround_10, 0))));

    switch (Var_49) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word Var_26;
          MR_Word Var_27;

          succeeded = ((MR_tag((MR_Word) Inst_11)) == (MR_Integer) 1);
          if (succeeded)
          {
            Var_26 = ((MR_Unsigned) ((MR_hl_field(1, Inst_11, 0))) & (MR_Integer) 7);
            Var_27 = ((MR_Word) ((MR_hl_field(1, Inst_11, 1))));
            succeeded = (Var_26 == (MR_Integer) 0);
            if (succeeded)
              succeeded = (Var_27 == (MR_Word) ((MR_Unsigned) 0U));
          }
          if (succeeded)
            Pieces_12 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_8, VarNamePiece_9, (MR_String) "ground");
          else
          {
            MR_Word Var_31;
            MR_Word IntroPieces_45;
            MR_Word Var_70;
            MR_Word Var_73;
            MR_Word Var_78;
            MR_Word Var_79;
            MR_Word ModuleInfo_85;
            MR_Word InstVarSet_86;

            {
              Var_31 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_31, 0) = ((MR_Box) (VarNamePiece_9));
              MR_hl_field(1, Var_31, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[556])));
            }
            {
              IntroPieces_45 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, IntroPieces_45, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[554])));
              MR_hl_field(1, IntroPieces_45, 1) = ((MR_Box) (Var_31));
            }
            {
              Var_70 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_70, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195])));
              MR_hl_field(1, Var_70, 1) = ((MR_Box) (IntroPieces_45));
            }
            check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_7, &ModuleInfo_85);
            check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_7, &InstVarSet_86);
            Var_79 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_85, InstVarSet_86, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[561])), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[561])), Inst_11);
            Var_78 = parse_tree__error_spec__maybe_color_pieces_2_f_0(MaybeColor_8, Var_79);
            Var_73 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_78);
            Pieces_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_70, Var_73);
          }
        }
        break;
      case (MR_Integer) 1:
        {
          succeeded = (Inst_11 == (MR_Word) ((MR_Unsigned) 0U));
          if (succeeded)
            Pieces_12 = check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(MaybeColor_8, VarNamePiece_9, (MR_String) "free");
          else
          {
            MR_Word Var_40;
            MR_Word IntroPieces_48;

            {
              Var_40 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_40, 0) = ((MR_Box) (VarNamePiece_9));
              MR_hl_field(1, Var_40, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[558])));
            }
            {
              IntroPieces_48 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, IntroPieces_48, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[554])));
              MR_hl_field(1, IntroPieces_48, 1) = ((MR_Box) (Var_40));
            }
            Pieces_12 = check_hlds__mode_errors__report_inst_in_branch_detail_4_f_0(ModeInfo_7, IntroPieces_48, MaybeColor_8, Inst_11);
          }
        }
        break;
    }
  }
  return Pieces_12;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_branch_detail_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word IntroPieces_7,
  MR_Word MaybeColor_8,
  MR_Word Inst_9)
{
  MR_Word Pieces_10;
  MR_Word Var_11;
  MR_Word Var_14;
  MR_Word Var_19;
  MR_Word Var_20;
  MR_Word ModuleInfo_38;
  MR_Word InstVarSet_39;

  {
    Var_11 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_11, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195])));
    MR_hl_field(1, Var_11, 1) = ((MR_Box) (IntroPieces_7));
  }
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_6, &ModuleInfo_38);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_6, &InstVarSet_39);
  Var_20 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_38, InstVarSet_39, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[561])), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[561])), Inst_9);
  Var_19 = parse_tree__error_spec__maybe_color_pieces_2_f_0(MaybeColor_8, Var_20);
  Var_14 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_19);
  Pieces_10 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_11, Var_14);
  return Pieces_10;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_in_branch_simple_3_f_0(
  MR_Word MaybeColor_5,
  MR_Word VarNamePiece_6,
  MR_String FreeOrGround_7)
{
  MR_Word Pieces_8;
  MR_Word MainPieces_9;
  MR_Word Var_10;
  MR_Word Var_13;
  MR_Word Var_18;
  MR_Word Var_19;
  MR_Word Var_20;
  MR_Word Var_21;
  MR_Word Var_29;

  {
    Var_13 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_13, 0) = ((MR_Box) (VarNamePiece_6));
    MR_hl_field(1, Var_13, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[163])));
  }
  {
    Var_10 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_10, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[554])));
    MR_hl_field(1, Var_10, 1) = ((MR_Box) (Var_13));
  }
  {
    Var_21 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_21, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_21, 1) = ((MR_Box) (FreeOrGround_7));
  }
  {
    Var_20 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_20, 0) = ((MR_Box) (Var_21));
    MR_hl_field(1, Var_20, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])));
  }
  Var_19 = parse_tree__error_spec__maybe_color_pieces_2_f_0(MaybeColor_5, Var_20);
  Var_18 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_19, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  MainPieces_9 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_10, Var_18);
  {
    Var_29 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_29, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[195])));
    MR_hl_field(1, Var_29, 1) = ((MR_Box) (MainPieces_9));
  }
  Pieces_8 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_29, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])));
  return Pieces_8;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0_3(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv2_Msg_15;

  conv2_Msg_15 = check_hlds__mode_errors__report_inst_in_context_6_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) ((MR_hl_field(0, closure, 5)))), ((MR_Word) ((MR_hl_field(0, closure, 6)))), ((MR_Word) ((MR_hl_field(0, closure, 7)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv2_Msg_15));
  return wrapper_arg_2;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv1_Msg_15;

  conv1_Msg_15 = check_hlds__mode_errors__report_inst_in_context_6_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) ((MR_hl_field(0, closure, 5)))), ((MR_Word) ((MR_hl_field(0, closure, 6)))), ((MR_Word) ((MR_hl_field(0, closure, 7)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv1_Msg_15));
  return wrapper_arg_2;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_Msg_15;

  conv0_Msg_15 = check_hlds__mode_errors__report_inst_in_context_6_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) ((MR_hl_field(0, closure, 5)))), ((MR_Word) ((MR_hl_field(0, closure, 6)))), ((MR_Word) ((MR_hl_field(0, closure, 7)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_Msg_15));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__merge_error_to_msgs_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word MainContext_7,
  MR_Word IsDisjunctive_8,
  MR_Word MergeError_9)
{
  MR_bool succeeded;
  MR_Word Msgs_10;
  MR_Word Var_11 = ((MR_Word) ((MR_hl_field(0, MergeError_9, 0))));
  MR_Word ContextsInsts0_12 = ((MR_Word) ((MR_hl_field(0, MergeError_9, 1))));
  MR_Word ModuleInfo_13;
  MR_Word VarTable_14;
  MR_Word VarNamePiece_15;
  MR_Word ContextsInsts_16;
  MR_Word VarType_17;
  MR_Integer NumGroundInsts_18;
  MR_Integer NumAllInsts_19;
  MR_Integer Var_28;
  MR_Integer Var_29;

  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_6, &ModuleInfo_13);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_6, &VarTable_14);
  VarNamePiece_15 = parse_tree__error_spec__var_in_table_to_quote_piece_2_f_0(VarTable_14, Var_11);
  mercury__list__sort_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_3[0]), ContextsInsts0_12, &ContextsInsts_16);
  parse_tree__var_table__lookup_var_type_3_p_0(VarTable_14, Var_11, &VarType_17);
  check_hlds__mode_errors__count_ground_insts_7_p_0(ModuleInfo_13, VarType_17, ContextsInsts_16, (MR_Integer) 0, &NumGroundInsts_18, (MR_Integer) 0, &NumAllInsts_19);
  succeeded = (IsDisjunctive_8 == (MR_Integer) 1);
  if (succeeded)
  {
    succeeded = (NumGroundInsts_18 < NumAllInsts_19);
    if (succeeded)
    {
      Var_29 = (MR_Integer) 2;
      Var_28 = (MR_Integer) ((MR_Unsigned) NumGroundInsts_18 * (MR_Unsigned) Var_29);
      succeeded = (Var_28 > NumAllInsts_19);
    }
  }
  if (succeeded)
  {
    MR_Word CommonPieces_20;
    MR_Word NonVerbosePieces_22;
    MR_Word VarMsg_23;
    MR_Word InstMsgs_24;
    MR_Word Var_34;
    MR_Word Var_35;
    MR_Word Var_36;
    MR_Word Var_38;
    MR_Word Var_43;
    MR_Word Var_44;
    MR_Word Var_49;
    MR_Word Var_52;
    MR_Word Var_53;
    MR_Word Var_54;
    MR_Word Var_57;
    MR_Word Var_58;
    MR_Word Var_80;
    MR_Word Var_81;
    MR_Word Var_82;
    MR_Word Var_83;
    MR_Word Var_85;
    MR_Integer Var_70;

    {
      Var_36 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_36, 0) = ((MR_Box) (VarNamePiece_15));
      MR_hl_field(1, Var_36, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    Var_35 = parse_tree__error_spec__color_as_subject_1_f_0(Var_36);
    Var_44 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[375])));
    {
      Var_53 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(3, Var_53, 0) = ((MR_Box) ((MR_Unsigned) 1U));
      MR_hl_field(3, Var_53, 1) = ((MR_Box) (NumGroundInsts_18));
    }
    {
      Var_58 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(3, Var_58, 0) = ((MR_Box) ((MR_Unsigned) 1U));
      MR_hl_field(3, Var_58, 1) = ((MR_Box) (NumAllInsts_19));
    }
    {
      Var_57 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_57, 0) = ((MR_Box) (Var_58));
      MR_hl_field(1, Var_57, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[543])));
    }
    {
      Var_54 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_54, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[541])));
      MR_hl_field(1, Var_54, 1) = ((MR_Box) (Var_57));
    }
    {
      Var_52 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_52, 0) = ((MR_Box) (Var_53));
      MR_hl_field(1, Var_52, 1) = ((MR_Box) (Var_54));
    }
    {
      Var_49 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_49, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[348])));
      MR_hl_field(1, Var_49, 1) = ((MR_Box) (Var_52));
    }
    Var_43 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_44, Var_49);
    Var_38 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[163])), Var_43);
    Var_34 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_35, Var_38);
    CommonPieces_20 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[540])), Var_34);
    Var_70 = (MR_Integer) ((MR_Unsigned) NumAllInsts_19 - (MR_Unsigned) NumGroundInsts_18);
    succeeded = (Var_70 > (MR_Integer) 1);
    if (succeeded)
      NonVerbosePieces_22 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[549]));
    else
      NonVerbosePieces_22 = (MR_Word) ((MR_Unsigned) 0U);
    {
      Var_81 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, Var_81, 0) = ((MR_Box) (CommonPieces_20));
    }
    {
      Var_83 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(2, Var_83, 0) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[545])));
      MR_hl_field(2, Var_83, 1) = ((MR_Box) (NonVerbosePieces_22));
    }
    {
      Var_82 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_82, 0) = ((MR_Box) (Var_83));
      MR_hl_field(1, Var_82, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    {
      Var_80 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_80, 0) = ((MR_Box) (Var_81));
      MR_hl_field(1, Var_80, 1) = ((MR_Box) (Var_82));
    }
    {
      VarMsg_23 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(2, VarMsg_23, 0) = ((MR_Box) (MainContext_7));
      MR_hl_field(2, VarMsg_23, 1) = ((MR_Box) (Var_80));
    }
    {
      Var_85 = (MR_Word) MR_new_object(MR_Word, (8 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, Var_85, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_9[0]));
      MR_hl_field(0, Var_85, 1) = ((MR_Box) (check_hlds__mode_errors__merge_error_to_msgs_4_f_0_1));
      MR_hl_field(0, Var_85, 2) = ((MR_Box) ((MR_Integer) 5));
      MR_hl_field(0, Var_85, 3) = ((MR_Box) (ModeInfo_6));
      MR_hl_field(0, Var_85, 4) = ((MR_Box) ((MR_Integer) 2));
      MR_hl_field(0, Var_85, 5) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0])));
      MR_hl_field(0, Var_85, 6) = ((MR_Box) (VarNamePiece_15));
      MR_hl_field(0, Var_85, 7) = ((MR_Box) (VarType_17));
    }
    InstMsgs_24 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_3[0]), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Var_85, ContextsInsts_16);
    {
      Msgs_10 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Msgs_10, 0) = ((MR_Box) (VarMsg_23));
      MR_hl_field(1, Msgs_10, 1) = ((MR_Box) (InstMsgs_24));
    }
  }
  else
  {
    MR_Integer Var_89;

    succeeded = (IsDisjunctive_8 == (MR_Integer) 1);
    if (succeeded)
    {
      Var_89 = (MR_Integer) 0;
      succeeded = (Var_89 < NumGroundInsts_18);
      if (succeeded)
        succeeded = (NumGroundInsts_18 < NumAllInsts_19);
    }
    if (succeeded)
    {
      MR_Word VarPieces_25;
      MR_Word Var_94;
      MR_Word Var_95;
      MR_Word Var_96;
      MR_Word Var_104;
      MR_Word VarMsg_126;
      MR_Word InstMsgs_127;

      {
        Var_96 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_96, 0) = ((MR_Box) (VarNamePiece_15));
        MR_hl_field(1, Var_96, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      }
      Var_95 = parse_tree__error_spec__color_as_subject_1_f_0(Var_96);
      Var_94 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_95, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[551])));
      VarPieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[540])), Var_94);
      {
        VarMsg_126 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
        MR_hl_field(0, VarMsg_126, 0) = ((MR_Box) (MainContext_7));
        MR_hl_field(0, VarMsg_126, 1) = ((MR_Box) (VarPieces_25));
      }
      {
        Var_104 = (MR_Word) MR_new_object(MR_Word, (8 * sizeof(MR_Word)), NULL, NULL);
        MR_hl_field(0, Var_104, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_9[0]));
        MR_hl_field(0, Var_104, 1) = ((MR_Box) (check_hlds__mode_errors__merge_error_to_msgs_4_f_0_2));
        MR_hl_field(0, Var_104, 2) = ((MR_Box) ((MR_Integer) 5));
        MR_hl_field(0, Var_104, 3) = ((MR_Box) (ModeInfo_6));
        MR_hl_field(0, Var_104, 4) = ((MR_Box) ((MR_Integer) 1));
        MR_hl_field(0, Var_104, 5) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0])));
        MR_hl_field(0, Var_104, 6) = ((MR_Box) (VarNamePiece_15));
        MR_hl_field(0, Var_104, 7) = ((MR_Box) (VarType_17));
      }
      InstMsgs_127 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_3[0]), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Var_104, ContextsInsts_16);
      {
        Msgs_10 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Msgs_10, 0) = ((MR_Box) (VarMsg_126));
        MR_hl_field(1, Msgs_10, 1) = ((MR_Box) (InstMsgs_127));
      }
    }
    else
    {
      MR_Word Var_112;
      MR_Word Var_113;
      MR_Word Var_114;
      MR_Word Var_122;
      MR_Word VarMsg_128;
      MR_Word InstMsgs_129;
      MR_Word VarPieces_130;

      {
        Var_114 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_114, 0) = ((MR_Box) (VarNamePiece_15));
        MR_hl_field(1, Var_114, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      }
      Var_113 = parse_tree__error_spec__color_as_subject_1_f_0(Var_114);
      Var_112 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_113, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[553])));
      VarPieces_130 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[540])), Var_112);
      {
        VarMsg_128 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
        MR_hl_field(0, VarMsg_128, 0) = ((MR_Box) (MainContext_7));
        MR_hl_field(0, VarMsg_128, 1) = ((MR_Box) (VarPieces_130));
      }
      {
        Var_122 = (MR_Word) MR_new_object(MR_Word, (8 * sizeof(MR_Word)), NULL, NULL);
        MR_hl_field(0, Var_122, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_9[0]));
        MR_hl_field(0, Var_122, 1) = ((MR_Box) (check_hlds__mode_errors__merge_error_to_msgs_4_f_0_3));
        MR_hl_field(0, Var_122, 2) = ((MR_Box) ((MR_Integer) 5));
        MR_hl_field(0, Var_122, 3) = ((MR_Box) (ModeInfo_6));
        MR_hl_field(0, Var_122, 4) = ((MR_Box) ((MR_Integer) 0));
        MR_hl_field(0, Var_122, 5) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0])));
        MR_hl_field(0, Var_122, 6) = ((MR_Box) (VarNamePiece_15));
        MR_hl_field(0, Var_122, 7) = ((MR_Box) (VarType_17));
      }
      InstMsgs_129 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_3[0]), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Var_122, ContextsInsts_16);
      {
        Msgs_10 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Msgs_10, 0) = ((MR_Box) (VarMsg_128));
        MR_hl_field(1, Msgs_10, 1) = ((MR_Box) (InstMsgs_129));
      }
    }
  }
  return Msgs_10;
}

static void MR_CALL 
check_hlds__mode_errors__count_ground_insts_7_p_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3,
  MR_Integer STATE_VARIABLE_NumGroundInsts_0_4,
  MR_Integer * STATE_VARIABLE_NumGroundInsts_5,
  MR_Integer STATE_VARIABLE_NumAllInsts_0_6,
  MR_Integer * STATE_VARIABLE_NumAllInsts_7)
{
  while (MR_TRUE)
  {
    MR_bool succeeded;

    // setup for model_det tailcalls optimized into a loop
    ;
    if ((HeadVar__3_3 == (MR_Word) ((MR_Unsigned) 0U)))
    {
      *STATE_VARIABLE_NumAllInsts_7 = STATE_VARIABLE_NumAllInsts_0_6;
      *STATE_VARIABLE_NumGroundInsts_5 = STATE_VARIABLE_NumGroundInsts_0_4;
    }
    else
    {
      MR_Word ContextInst_18 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
      MR_Word ContextsInsts_19 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
      MR_Word Inst_23 = ((MR_Word) ((MR_hl_field(0, ContextInst_18, 1))));
      MR_Integer STATE_VARIABLE_NumGroundInsts_1_28;
      MR_Integer STATE_VARIABLE_NumAllInsts_1_30;
      MR_Word next_value_of_HeadVar__3_3;
      MR_Integer next_value_of_STATE_VARIABLE_NumGroundInsts_0_4;
      MR_Integer next_value_of_STATE_VARIABLE_NumAllInsts_0_6;

      succeeded = hlds__inst_test__inst_is_ground_3_p_0(HeadVar__1_1, HeadVar__2_2, Inst_23);
      if (succeeded)
        STATE_VARIABLE_NumGroundInsts_1_28 = (MR_Integer) ((MR_Unsigned) STATE_VARIABLE_NumGroundInsts_0_4 + (MR_Unsigned) 1);
      else
        STATE_VARIABLE_NumGroundInsts_1_28 = STATE_VARIABLE_NumGroundInsts_0_4;
      STATE_VARIABLE_NumAllInsts_1_30 = (MR_Integer) ((MR_Unsigned) STATE_VARIABLE_NumAllInsts_0_6 + (MR_Unsigned) 1);
      // direct tailcall eliminated
      ;
      next_value_of_HeadVar__3_3 = ContextsInsts_19;
      next_value_of_STATE_VARIABLE_NumGroundInsts_0_4 = STATE_VARIABLE_NumGroundInsts_1_28;
      next_value_of_STATE_VARIABLE_NumAllInsts_0_6 = STATE_VARIABLE_NumAllInsts_1_30;
      HeadVar__3_3 = next_value_of_HeadVar__3_3;
      STATE_VARIABLE_NumGroundInsts_0_4 = next_value_of_STATE_VARIABLE_NumGroundInsts_0_4;
      STATE_VARIABLE_NumAllInsts_0_6 = next_value_of_STATE_VARIABLE_NumAllInsts_0_6;
      continue;
    }
    break;
  }
}

static MR_Word MR_CALL 
check_hlds__mode_errors__report_bad_arity_pieces_1_f_0(
  MR_Tuple HeadVar__1_1)
{
  MR_Word Pieces_6;
  MR_Word ConsId_3 = ((MR_Word) ((MR_hl_field(0, HeadVar__1_1, 0))));
  MR_Integer InstArity_4 = ((MR_Integer) ((MR_hl_field(0, HeadVar__1_1, 1))));
  MR_Integer ExpectedArity_5 = ((MR_Integer) ((MR_hl_field(0, HeadVar__1_1, 2))));
  MR_Word Var_7;
  MR_Word Var_8;
  MR_Word Var_13;
  MR_Word Var_14;
  MR_Word Var_15;
  MR_Word Var_16;
  MR_Word Var_18;
  MR_Word Var_26;
  MR_Word Var_27;
  MR_Word Var_28;
  MR_Word Var_29;

  {
    Var_8 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_8, 0) = ((MR_Box) ((MR_Unsigned) 29U));
    MR_hl_field(3, Var_8, 1) = ((MR_Box) (ConsId_3));
  }
  {
    Var_7 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_7, 0) = ((MR_Box) (Var_8));
    MR_hl_field(1, Var_7, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[386])));
  }
  {
    Var_16 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_16, 0) = ((MR_Box) ((MR_Unsigned) 1U));
    MR_hl_field(3, Var_16, 1) = ((MR_Box) (InstArity_4));
  }
  {
    Var_15 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_15, 0) = ((MR_Box) (Var_16));
    MR_hl_field(1, Var_15, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_14 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_15);
  {
    Var_29 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_29, 0) = ((MR_Box) ((MR_Unsigned) 1U));
    MR_hl_field(3, Var_29, 1) = ((MR_Box) (ExpectedArity_5));
  }
  {
    Var_28 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_28, 0) = ((MR_Box) (Var_29));
    MR_hl_field(1, Var_28, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_27 = parse_tree__error_spec__color_as_correct_1_f_0(Var_28);
  Var_26 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_27, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[392])));
  Var_18 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[390])), Var_26);
  Var_13 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_14, Var_18);
  Pieces_6 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_7, Var_13);
  return Pieces_6;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__make_term_path_piece_1_f_0(
  MR_Word Step_3)
{
  MR_bool succeeded;
  MR_Word Pieces_4;
  MR_Word ConsId_5 = ((MR_Word) ((MR_hl_field(0, Step_3, 0))));
  MR_Integer ArgNum_6 = ((MR_Integer) ((MR_hl_field(0, Step_3, 1))));
  MR_Word ArgPieces_9;
  MR_Word Var_23;
  MR_Word Var_26;
  MR_Word Var_27;
  MR_Word Var_10;
  MR_Integer Var_11;

  succeeded = (ArgNum_6 == (MR_Integer) 1);
  if (succeeded)
  {
    succeeded = ((MR_tag((MR_Word) ConsId_5)) == (MR_Integer) 1);
    if (succeeded)
    {
      Var_10 = (MR_Word) (MR_body((MR_Word) (ConsId_5), (MR_Integer) 1));
      Var_11 = ((MR_Integer) ((MR_hl_field(0, Var_10, 1))));
      succeeded = (Var_11 == (MR_Integer) 1);
    }
  }
  if (succeeded)
    ArgPieces_9 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[379]));
  else
  {
    MR_Word Var_17;
    MR_Word Var_18;

    {
      Var_18 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(3, Var_18, 0) = ((MR_Box) ((MR_Unsigned) 5U));
      MR_hl_field(3, Var_18, 1) = ((MR_Box) (ArgNum_6));
    }
    {
      Var_17 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_17, 0) = ((MR_Box) (Var_18));
      MR_hl_field(1, Var_17, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[382])));
    }
    {
      ArgPieces_9 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, ArgPieces_9, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[380])));
      MR_hl_field(1, ArgPieces_9, 1) = ((MR_Box) (Var_17));
    }
  }
  {
    Var_27 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_27, 0) = ((MR_Box) ((MR_Unsigned) 29U));
    MR_hl_field(3, Var_27, 1) = ((MR_Box) (ConsId_5));
  }
  {
    Var_26 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_26, 0) = ((MR_Box) (Var_27));
    MR_hl_field(1, Var_26, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[384])));
  }
  {
    Var_23 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_23, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[383])));
    MR_hl_field(1, Var_23, 1) = ((MR_Box) (Var_26));
  }
  Pieces_4 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgPieces_9, Var_23);
  return Pieces_4;
}

static MR_bool MR_CALL 
check_hlds__mode_errors__is_error_important_1_p_0(
  MR_Word Error_2)
{
  MR_bool succeeded;
  MR_Word ModeError_5;
  MR_Word ModeContext_7;
  MR_Word Var_14 = ((MR_Word) ((MR_hl_field(0, Error_2, 1))));
  MR_Word UnifyContext_9;
  MR_Word Var_15;

  ModeError_5 = ((MR_Word) ((MR_hl_field(0, Var_14, 1))));
  ModeContext_7 = ((MR_Word) ((MR_hl_field(0, Var_14, 3))));
  succeeded = ((MR_tag((MR_Word) ModeContext_7)) == (MR_Integer) 3);
  if (succeeded)
  {
    Var_15 = ((MR_Word) ((MR_hl_field(3, ModeContext_7, 0))));
    UnifyContext_9 = ((MR_Word) ((MR_hl_field(0, Var_15, 0))));
    succeeded = (UnifyContext_9 != (MR_Word) ((MR_Unsigned) 0U));
    if (succeeded)
    {
      succeeded = ((((MR_tag((MR_Word) ModeError_5)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, ModeError_5, 0)))) == (MR_Integer) 2)));
      succeeded = !(succeeded);
    }
  }
  if (succeeded)
    succeeded = MR_FALSE;
  else
    succeeded = MR_TRUE;
  return succeeded;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__prefix_with_blank_line_2_f_0(
  MR_Word Context_4,
  MR_Word Msgs_5)
{
  MR_Word HeadVar__3_3;
  MR_Word BlankMsg_6;

  {
    BlankMsg_6 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, BlankMsg_6, 0) = ((MR_Box) (Context_4));
    MR_hl_field(0, BlankMsg_6, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[229])));
  }
  {
    HeadVar__3_3 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, HeadVar__3_3, 0) = ((MR_Box) (BlankMsg_6));
    MR_hl_field(1, HeadVar__3_3, 1) = ((MR_Box) (Msgs_5));
  }
  return HeadVar__3_3;
}

static void MR_CALL 
check_hlds__mode_errors__acc_not_ok_in_any_proc_args_4_p_0(
  MR_Integer ArgNum_5,
  MR_Word ArgOkOrNot_6,
  MR_Word STATE_VARIABLE_NeverOkArgNums_0_10,
  MR_Word * STATE_VARIABLE_NeverOkArgNums_11)
{
  MR_bool succeeded;
  MR_Word OkProcs_8 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot_6, 0))));

  succeeded = mercury__set__is_empty_1_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), OkProcs_8);
  if (succeeded)
    {
      MR_Word base;
      base = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      *STATE_VARIABLE_NeverOkArgNums_11 = base;
      MR_hl_field(1, base, 0) = ((MR_Box) (ArgNum_5));
      MR_hl_field(1, base, 1) = ((MR_Box) (STATE_VARIABLE_NeverOkArgNums_0_10));
    }
  else
    *STATE_VARIABLE_NeverOkArgNums_11 = STATE_VARIABLE_NeverOkArgNums_0_10;
}

static void MR_CALL 
check_hlds__mode_errors__is_any_extra_arg_bad_5_p_0(
  MR_Integer NumExtra_6,
  MR_Integer ArgNum_7,
  MR_Word ArgOkOrNot_8,
  MR_Word STATE_VARIABLE_SomeExtraIsBad_0_10,
  MR_Word * STATE_VARIABLE_SomeExtraIsBad_11)
{
  MR_bool succeeded;
  MR_Word Var_12 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot_8, 1))));

  succeeded = mercury__set__is_non_empty_1_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), Var_12);
  if (succeeded)
  {
    succeeded = (ArgNum_7 <= NumExtra_6);
    if (succeeded)
      *STATE_VARIABLE_SomeExtraIsBad_11 = (MR_Integer) 1;
    else
      *STATE_VARIABLE_SomeExtraIsBad_11 = STATE_VARIABLE_SomeExtraIsBad_0_10;
  }
  else
    *STATE_VARIABLE_SomeExtraIsBad_11 = STATE_VARIABLE_SomeExtraIsBad_0_10;
}

MR_String MR_CALL 
check_hlds__mode_errors__mode_decl_to_string_3_f_0(
  MR_Word Lang_5,
  MR_Integer ProcId_6,
  MR_Word PredInfo_7)
{
  MR_String String_8;
  MR_Word PredOrFunc_9;
  MR_String Name_10;
  MR_Word SymName_11;
  MR_Word Procs_12;
  MR_Word ProcInfo_13;
  MR_Word Modes0_14;
  MR_Word MaybeDet_15;
  MR_Word InstVarSet_16;
  MR_Word Modes_17;
  MR_Box conv0_ProcInfo_13;

  PredOrFunc_9 = hlds__hlds_pred__pred_info_is_pred_or_func_1_f_0(PredInfo_7);
  Name_10 = hlds__hlds_pred__pred_info_name_1_f_0(PredInfo_7);
  {
    SymName_11 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, SymName_11, 0) = ((MR_Box) (Name_10));
  }
  hlds__hlds_pred__pred_info_get_proc_table_2_p_0(PredInfo_7, &Procs_12);
  mercury__map__lookup_3_p_0((MR_Word) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_proc_id_0), (MR_Word) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_proc_info_0), Procs_12, ((MR_Box) (ProcId_6)), &conv0_ProcInfo_13);
  ProcInfo_13 = ((MR_Word) (conv0_ProcInfo_13));
  hlds__hlds_proc_util__proc_info_declared_argmodes_2_p_0(ProcInfo_13, &Modes0_14);
  hlds__hlds_pred__proc_info_get_declared_determinism_2_p_0(ProcInfo_13, &MaybeDet_15);
  mercury__varset__init_1_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0), &InstVarSet_16);
  parse_tree__prog_mode__strip_module_names_from_mode_list_4_p_0((MR_Integer) 0, (MR_Integer) 0, Modes0_14, &Modes_17);
  String_8 = parse_tree__parse_tree_out_pred_decl__mercury_mode_subdecl_to_string_6_f_0(Lang_5, PredOrFunc_9, InstVarSet_16, SymName_11, Modes_17, MaybeDet_15);
  return String_8;
}

MR_Word MR_CALL 
check_hlds__mode_errors__should_report_mode_warning_for_pred_origin_1_f_0(
  MR_Word Origin_3)
{
  MR_Word Report_4;

  switch (MR_tag((MR_Word) Origin_3)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word OriginUser_5 = ((MR_Word) ((MR_hl_field(0, Origin_3, 0))));

        switch (MR_tag((MR_Word) OriginUser_5)) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
          case (MR_Integer) 1:
            Report_4 = (MR_Integer) 1;
            break;
          case (MR_Integer) 2:
          case (MR_Integer) 3:
            Report_4 = (MR_Integer) 0;
            break;
        }
      }
      break;
    case (MR_Integer) 1:
    case (MR_Integer) 2:
    case (MR_Integer) 3:
      Report_4 = (MR_Integer) 0;
      break;
  }
  return Report_4;
}

MR_Word MR_CALL 
check_hlds__mode_errors__mode_warning_info_to_spec_2_f_0(
  MR_Word STATE_VARIABLE_ModeInfo_0_17,
  MR_Word Warning_5)
{
  MR_Word Spec_6;
  MR_Word ModeWarning_7 = ((MR_Word) ((MR_hl_field(0, Warning_5, 0))));
  MR_Word Context_8 = ((MR_Word) ((MR_hl_field(0, Warning_5, 1))));
  MR_Word ModeContext_9 = ((MR_Word) ((MR_hl_field(0, Warning_5, 2))));
  MR_Word STATE_VARIABLE_ModeInfo_1_18;
  MR_Word STATE_VARIABLE_ModeInfo_2_19;

  check_hlds__mode_info__mode_info_set_context_3_p_0(Context_8, STATE_VARIABLE_ModeInfo_0_17, &STATE_VARIABLE_ModeInfo_1_18);
  check_hlds__mode_info__mode_info_set_mode_context_3_p_0(ModeContext_9, STATE_VARIABLE_ModeInfo_1_18, &STATE_VARIABLE_ModeInfo_2_19);
  switch (MR_tag((MR_Word) ModeWarning_7)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word VarA_10 = ((MR_Word) ((MR_hl_field(0, ModeWarning_7, 0))));
        MR_Word VarB_11 = ((MR_Word) ((MR_hl_field(0, ModeWarning_7, 1))));
        MR_Word InstA_12 = ((MR_Word) ((MR_hl_field(0, ModeWarning_7, 2))));
        MR_Word InstB_13 = ((MR_Word) ((MR_hl_field(0, ModeWarning_7, 3))));

        Spec_6 = check_hlds__mode_errors__mode_warning_cannot_succeed_var_var_5_f_0(STATE_VARIABLE_ModeInfo_2_19, VarA_10, VarB_11, InstA_12, InstB_13);
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word Var_14 = ((MR_Word) ((MR_hl_field(1, ModeWarning_7, 0))));
        MR_Word Inst_15 = ((MR_Word) ((MR_hl_field(1, ModeWarning_7, 1))));
        MR_Word ConsId_16 = ((MR_Word) ((MR_hl_field(1, ModeWarning_7, 2))));

        Spec_6 = check_hlds__mode_errors__mode_warning_cannot_succeed_var_functor_4_f_0(STATE_VARIABLE_ModeInfo_2_19, Var_14, Inst_15, ConsId_16);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word Var_20 = ((MR_Word) ((MR_hl_field(2, ModeWarning_7, 0))));
        MR_Word ConsId_21 = ((MR_Word) ((MR_hl_field(2, ModeWarning_7, 1))));
        MR_Word Preamble_22;
        MR_Word Context_23;
        MR_Word VarTable_24;
        MR_String NameX_25;
        MR_String ConsIdStr_26;
        MR_Word Pieces_27;
        MR_Word Var_35;
        MR_Word Var_36;
        MR_Word Var_37;
        MR_Word Var_38;
        MR_Word Var_40;
        MR_Word Var_45;
        MR_Word Var_46;
        MR_Word Var_47;
        MR_Word Var_48;
        MR_Word Var_50;
        MR_Word Var_55;
        MR_Word Var_56;
        MR_Word Var_57;
        MR_Word Var_67;

        Preamble_22 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(STATE_VARIABLE_ModeInfo_2_19);
        check_hlds__mode_info__mode_info_get_context_2_p_0(STATE_VARIABLE_ModeInfo_2_19, &Context_23);
        check_hlds__mode_info__mode_info_get_var_table_2_p_0(STATE_VARIABLE_ModeInfo_2_19, &VarTable_24);
        NameX_25 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_24, Var_20);
        ConsIdStr_26 = parse_tree__parse_tree_out_cons_id__mercury_cons_id_to_string_3_f_0((MR_Integer) 0, (MR_Integer) 1, ConsId_21);
        {
          Var_38 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_38, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_38, 1) = ((MR_Box) (NameX_25));
        }
        {
          Var_37 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_37, 0) = ((MR_Box) (Var_38));
          MR_hl_field(1, Var_37, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_36 = parse_tree__error_spec__color_as_subject_1_f_0(Var_37);
        {
          Var_48 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_48, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_48, 1) = ((MR_Box) (ConsIdStr_26));
        }
        {
          Var_47 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_47, 0) = ((MR_Box) (Var_48));
          MR_hl_field(1, Var_47, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_46 = parse_tree__error_spec__color_as_subject_1_f_0(Var_47);
        {
          Var_57 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_57, 0) = ((MR_Box) (Var_38));
          MR_hl_field(1, Var_57, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[571])));
        }
        Var_56 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_57);
        Var_55 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_56, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_50 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[567])), Var_55);
        Var_45 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_46, Var_50);
        Var_40 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[368])), Var_45);
        Var_35 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_36, Var_40);
        Pieces_27 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[563])), Var_35);
        Var_67 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_22, Pieces_27);
        {
          Spec_6 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
          MR_hl_field(0, Spec_6, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_warning_cannot_succeed_ground_occur_check\'/3"));
          MR_hl_field(0, Spec_6, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[11])));
          MR_hl_field(0, Spec_6, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
          MR_hl_field(0, Spec_6, 3) = ((MR_Box) (Context_23));
          MR_hl_field(0, Spec_6, 4) = ((MR_Box) (Var_67));
        }
      }
      break;
  }
  return Spec_6;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_warning_cannot_succeed_var_functor_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word X_7,
  MR_Word InstX_8,
  MR_Word ConsId_9)
{
  MR_Word Spec_10;
  MR_Word Preamble_11;
  MR_Word Context_12;
  MR_Word VarTable_13;
  MR_String NameX_14;
  MR_String ConsIdStr_15;
  MR_Word Pieces_16;
  MR_Word Var_24;
  MR_Word Var_25;
  MR_Word Var_26;
  MR_Word Var_27;
  MR_Word Var_29;
  MR_Word Var_34;
  MR_Word Var_35;
  MR_Word Var_36;
  MR_Word Var_37;
  MR_Word Var_39;
  MR_Word Var_46;
  MR_Word Var_47;
  MR_Word Var_51;
  MR_Word Var_59;

  Preamble_11 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_6);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_6, &Context_12);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_6, &VarTable_13);
  NameX_14 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_13, X_7);
  ConsIdStr_15 = parse_tree__parse_tree_out_cons_id__mercury_cons_id_to_string_3_f_0((MR_Integer) 0, (MR_Integer) 1, ConsId_9);
  {
    Var_27 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_27, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_27, 1) = ((MR_Box) (NameX_14));
  }
  {
    Var_26 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_26, 0) = ((MR_Box) (Var_27));
    MR_hl_field(1, Var_26, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_25 = parse_tree__error_spec__color_as_subject_1_f_0(Var_26);
  {
    Var_37 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_37, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_37, 1) = ((MR_Box) (ConsIdStr_15));
  }
  {
    Var_36 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_36, 0) = ((MR_Box) (Var_37));
    MR_hl_field(1, Var_36, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_35 = parse_tree__error_spec__color_as_subject_1_f_0(Var_36);
  Var_47 = parse_tree__error_spec__color_as_subject_1_f_0(Var_26);
  Var_51 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_6, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[2])), InstX_8, (MR_String) ".");
  Var_46 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_47, Var_51);
  Var_39 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[565])), Var_46);
  Var_34 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_35, Var_39);
  Var_29 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[368])), Var_34);
  Var_24 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_25, Var_29);
  Pieces_16 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[563])), Var_24);
  Var_59 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_11, Pieces_16);
  {
    Spec_10 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_10, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_warning_cannot_succeed_var_functor\'/4"));
    MR_hl_field(0, Spec_10, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[11])));
    MR_hl_field(0, Spec_10, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[10])));
    MR_hl_field(0, Spec_10, 3) = ((MR_Box) (Context_12));
    MR_hl_field(0, Spec_10, 4) = ((MR_Box) (Var_59));
  }
  return Spec_10;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_warning_cannot_succeed_var_var_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word X_8,
  MR_Word Y_9,
  MR_Word InstX_10,
  MR_Word InstY_11)
{
  MR_Word Spec_12;
  MR_Word Preamble_13;
  MR_Word Context_14;
  MR_Word VarTable_15;
  MR_String NameX_16;
  MR_String NameY_17;
  MR_Word MaybeColor_18;
  MR_Word Pieces_19;
  MR_Word Var_26;
  MR_Word Var_27;
  MR_Word Var_28;
  MR_Word Var_29;
  MR_Word Var_31;
  MR_Word Var_36;
  MR_Word Var_37;
  MR_Word Var_38;
  MR_Word Var_39;
  MR_Word Var_41;
  MR_Word Var_48;
  MR_Word Var_49;
  MR_Word Var_53;
  MR_Word Var_54;
  MR_Word Var_56;
  MR_Word Var_57;
  MR_Word Var_61;
  MR_Word Var_67;

  Preamble_13 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_7);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_7, &Context_14);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_7, &VarTable_15);
  NameX_16 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, X_8);
  NameY_17 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, Y_9);
  MaybeColor_18 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0]));
  {
    Var_29 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_29, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_29, 1) = ((MR_Box) (NameX_16));
  }
  {
    Var_28 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_28, 0) = ((MR_Box) (Var_29));
    MR_hl_field(1, Var_28, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_27 = parse_tree__error_spec__color_as_subject_1_f_0(Var_28);
  {
    Var_39 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_39, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_39, 1) = ((MR_Box) (NameY_17));
  }
  {
    Var_38 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_38, 0) = ((MR_Box) (Var_39));
    MR_hl_field(1, Var_38, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_37 = parse_tree__error_spec__color_as_subject_1_f_0(Var_38);
  Var_49 = parse_tree__error_spec__color_as_subject_1_f_0(Var_28);
  Var_54 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_7, MaybeColor_18, InstX_10, (MR_String) ",");
  Var_57 = parse_tree__error_spec__color_as_subject_1_f_0(Var_38);
  Var_61 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_7, MaybeColor_18, InstY_11, (MR_String) ".");
  Var_56 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_57, Var_61);
  Var_53 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_54, Var_56);
  Var_48 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_49, Var_53);
  Var_41 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[565])), Var_48);
  Var_36 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_37, Var_41);
  Var_31 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[368])), Var_36);
  Var_26 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_27, Var_31);
  Pieces_19 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[563])), Var_26);
  Var_67 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_13, Pieces_19);
  {
    Spec_12 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_warning_cannot_succeed_var_var\'/5"));
    MR_hl_field(0, Spec_12, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[11])));
    MR_hl_field(0, Spec_12, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[10])));
    MR_hl_field(0, Spec_12, 3) = ((MR_Box) (Context_14));
    MR_hl_field(0, Spec_12, 4) = ((MR_Box) (Var_67));
  }
  return Spec_12;
}

MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_info_to_spec_2_f_0(
  MR_Word ModeInfo0_4,
  MR_Word ModeErrorInfo_5)
{
  MR_Word Spec_6;
  MR_Word ModeError_9 = ((MR_Word) ((MR_hl_field(0, ModeErrorInfo_5, 1))));
  MR_Word Context_10 = ((MR_Word) ((MR_hl_field(0, ModeErrorInfo_5, 2))));
  MR_Word ModeContext_11 = ((MR_Word) ((MR_hl_field(0, ModeErrorInfo_5, 3))));
  MR_Word STATE_VARIABLE_ModeInfo_2_13;
  MR_Word STATE_VARIABLE_ModeInfo_3_14;

  check_hlds__mode_info__mode_info_set_context_3_p_0(Context_10, ModeInfo0_4, &STATE_VARIABLE_ModeInfo_2_13);
  check_hlds__mode_info__mode_info_set_mode_context_3_p_0(ModeContext_11, STATE_VARIABLE_ModeInfo_2_13, &STATE_VARIABLE_ModeInfo_3_14);
  Spec_6 = check_hlds__mode_errors__mode_error_to_spec_2_f_0(STATE_VARIABLE_ModeInfo_3_14, ModeError_9);
  return Spec_6;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_to_spec_2_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_Msgs_10;

  conv0_Msgs_10 = check_hlds__mode_errors__merge_error_to_msgs_4_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) ((MR_hl_field(0, closure, 5)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_Msgs_10));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word ModeError_5)
{
  MR_Word Spec_6;

  switch (MR_tag((MR_Word) ModeError_5)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word VarA_7 = ((MR_Word) ((MR_hl_field(0, ModeError_5, 0))));
        MR_Word VarB_8 = ((MR_Word) ((MR_hl_field(0, ModeError_5, 1))));
        MR_Word InstA_9 = ((MR_Word) ((MR_hl_field(0, ModeError_5, 2))));
        MR_Word InstB_10 = ((MR_Word) ((MR_hl_field(0, ModeError_5, 3))));

        Spec_6 = check_hlds__mode_errors__mode_error_unify_var_var_to_spec_5_f_0(ModeInfo_4, VarA_7, VarB_8, InstA_9, InstB_10);
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word Var_11 = ((MR_Word) ((MR_hl_field(1, ModeError_5, 0))));
        MR_Word Inst_12 = ((MR_Word) ((MR_hl_field(1, ModeError_5, 1))));

        Spec_6 = check_hlds__mode_errors__mode_error_unify_var_poly_to_spec_3_f_0(ModeInfo_4, Var_11, Inst_12);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word Name_13 = ((MR_Word) ((MR_hl_field(2, ModeError_5, 1))));
        MR_Word Args_14 = ((MR_Word) ((MR_hl_field(2, ModeError_5, 2))));
        MR_Word ArgInsts_15 = ((MR_Word) ((MR_hl_field(2, ModeError_5, 4))));
        MR_Word Var_48 = ((MR_Word) ((MR_hl_field(2, ModeError_5, 0))));
        MR_Word Inst_49 = ((MR_Word) ((MR_hl_field(2, ModeError_5, 3))));

        Spec_6 = check_hlds__mode_errors__mode_error_unify_var_functor_to_spec_6_f_0(ModeInfo_4, Var_48, Name_13, Args_14, Inst_49, ArgInsts_15);
      }
      break;
    case (MR_Integer) 3:
      switch (((MR_Integer) ((MR_hl_field(3, ModeError_5, 0))))) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          {
            MR_Word VarA_50 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word InstA_51 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word InstB_52 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));

            Spec_6 = check_hlds__mode_errors__mode_error_unify_var_lambda_to_spec_4_f_0(ModeInfo_4, VarA_50, InstA_51, InstB_52);
          }
          break;
        case (MR_Integer) 1:
          {
            MR_Word PredMultiModeError_16 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word Var_53 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0(ModeInfo_4, Var_53, PredMultiModeError_16);
          }
          break;
        case (MR_Integer) 2:
          {
            MR_Word Var_54 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word Inst_55 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__mode_error_non_ground_non_local_lambda_var_to_spec_3_f_0(ModeInfo_4, Var_54, Inst_55);
          }
          break;
        case (MR_Integer) 3:
          {
            MR_Word RHS_17 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word Type_18 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Word PredOrFunc_19 = ((MR_Unsigned) ((MR_hl_field(3, ModeError_5, 4))) & (MR_Integer) 1);
            MR_Word Var_56 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__mode_error_higher_order_unify_to_spec_5_f_0(ModeInfo_4, Var_56, RHS_17, Type_18, PredOrFunc_19);
          }
          break;
        case (MR_Integer) 4:
          {
            MR_Word ActualInst_20 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word ExpectedInst_21 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Word MaybeMultiMode_22 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word Var_57 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__mode_error_var_is_not_sufficiently_instantiated_to_spec_5_f_0(ModeInfo_4, Var_57, ActualInst_20, ExpectedInst_21, MaybeMultiMode_22);
          }
          break;
        case (MR_Integer) 5:
          {
            MR_Word Var_58 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__mode_error_clobbered_var_is_live_to_spec_2_f_0(ModeInfo_4, Var_58);
          }
          break;
        case (MR_Integer) 6:
          {
            MR_Word PredId_23 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__mode_error_callee_pred_has_no_mode_decl_to_spec_2_f_0(ModeInfo_4, PredId_23);
          }
          break;
        case (MR_Integer) 7:
          {
            MR_Word MatchWhat_24 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word InstMap_25 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word ArgVars_26 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Word ModeMismatch_27 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word ModeMismatches_28 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 5))));

            Spec_6 = check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0(ModeInfo_4, MatchWhat_24, InstMap_25, ArgVars_26, ModeMismatch_27, ModeMismatches_28);
          }
          break;
        case (MR_Integer) 8:
          {
            MR_Word ExpectedPredOrFunc_29 = ((MR_Unsigned) ((MR_hl_field(3, ModeError_5, 3))) & (MR_Integer) 1);
            MR_Word ExpectedUserArity_30 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word Mismatch_31 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 5))));
            MR_Word Var_59 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word Inst_60 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__mode_error_bad_higher_order_inst_to_spec_6_f_0(ModeInfo_4, Var_59, Inst_60, ExpectedPredOrFunc_29, ExpectedUserArity_30, Mismatch_31);
          }
          break;
        case (MR_Integer) 9:
          {
            MR_Word OoMErrors_32 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word Culprit_33 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0(ModeInfo_4, OoMErrors_32, Culprit_33);
          }
          break;
        case (MR_Integer) 10:
          {
            MR_Word MergeErrors_34 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word Preamble_74;
            MR_Word Context_75;
            MR_Word MergeMsgLists_77;
            MR_Word MergeMsgs_78;
            MR_Word Var_80;
            MR_Word Var_82;
            MR_Word Var_85;
            MR_Word Var_86;
            MR_Word Var_87;

            Preamble_74 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_4);
            check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_4, &Context_75);
            {
              Var_80 = (MR_Word) MR_new_object(MR_Word, (6 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, Var_80, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_6[1]));
              MR_hl_field(0, Var_80, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_to_spec_2_f_0_1));
              MR_hl_field(0, Var_80, 2) = ((MR_Box) ((MR_Integer) 3));
              MR_hl_field(0, Var_80, 3) = ((MR_Box) (ModeInfo_4));
              MR_hl_field(0, Var_80, 4) = ((MR_Box) (Context_75));
              MR_hl_field(0, Var_80, 5) = ((MR_Box) ((MR_Integer) 0));
            }
            Var_82 = mercury__one_or_more__one_or_more_to_list_1_f_1((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0), MergeErrors_34);
            MergeMsgLists_77 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[4]), Var_80, Var_82);
            mercury__list__condense_2_p_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), MergeMsgLists_77, &MergeMsgs_78);
            Var_87 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_74, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[343])));
            {
              Var_86 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, Var_86, 0) = ((MR_Box) (Context_75));
              MR_hl_field(0, Var_86, 1) = ((MR_Box) (Var_87));
            }
            {
              Var_85 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_85, 0) = ((MR_Box) (Var_86));
              MR_hl_field(1, Var_85, 1) = ((MR_Box) (MergeMsgs_78));
            }
            {
              Spec_6 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(2, Spec_6, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_merge_par_conj_to_spec\'/2"));
              MR_hl_field(2, Spec_6, 1) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(2, Spec_6, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
              MR_hl_field(2, Spec_6, 3) = ((MR_Box) (Var_85));
            }
          }
          break;
        case (MR_Integer) 11:
          {
            MR_Word MergeContext_35 = ((MR_Unsigned) ((MR_hl_field(3, ModeError_5, 1))) & (MR_Integer) 3);
            MR_Word MergeErrors_61 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__mode_error_merge_disj_to_spec_3_f_0(ModeInfo_4, MergeContext_35, MergeErrors_61);
          }
          break;
        case (MR_Integer) 12:
          {
            MR_Word CoerceErrors_36 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0(ModeInfo_4, CoerceErrors_36);
          }
          break;
        case (MR_Integer) 13:
          {
            MR_Word HeadNGVar_37 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word TailNGVars_38 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__mode_error_nonground_trace_goal_to_spec_3_f_0(ModeInfo_4, HeadNGVar_37, TailNGVars_38);
          }
          break;
        case (MR_Integer) 14:
          {
            MR_Word Reason_39 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word InstA_62 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Word InstB_63 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word Var_64 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__mode_error_bind_locked_var_to_spec_5_f_0(ModeInfo_4, Reason_39, Var_64, InstA_62, InstB_63);
          }
          break;
        case (MR_Integer) 15:
          {
            MR_Integer ArgNum_40 = ((MR_Integer) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word Var_65 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word ActualInst_66 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Word ExpectedInst_67 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word Reason_68 = ((MR_Unsigned) ((MR_hl_field(3, ModeError_5, 5))) & (MR_Integer) 3);

            Spec_6 = check_hlds__mode_errors__mode_error_unexpected_final_inst_to_spec_6_f_0(ModeInfo_4, ArgNum_40, Var_65, ActualInst_66, ExpectedInst_67, Reason_68);
          }
          break;
        case (MR_Integer) 16:
          {
            MR_Word Vars_41 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));
            MR_Word Insts_42 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word CalleePredId_43 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Integer CalleeProcId_44 = ((MR_Integer) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word CalleeErrors_45 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 5))));

            Spec_6 = check_hlds__mode_errors__mode_error_in_callee_to_spec_6_f_0(ModeInfo_4, Vars_41, Insts_42, CalleePredId_43, CalleeProcId_44, CalleeErrors_45);
          }
          break;
        case (MR_Integer) 17:
          {
            MR_Word NonImpliedInitialInst_46 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 4))));
            MR_Word Var_69 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));
            MR_Word ActualInst_70 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 3))));
            MR_Word Reason_71 = ((MR_Unsigned) ((MR_hl_field(3, ModeError_5, 1))) & (MR_Integer) 1);

            Spec_6 = check_hlds__mode_errors__mode_error_cannot_create_implied_mode_to_spec_5_f_0(ModeInfo_4, Reason_71, Var_69, ActualInst_70, NonImpliedInitialInst_46);
          }
          break;
        case (MR_Integer) 18:
          {
            MR_Word NegCtxt_47 = ((MR_Unsigned) ((MR_hl_field(3, ModeError_5, 1))) & (MR_Integer) 1);
            MR_Word Var_72 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 2))));

            Spec_6 = check_hlds__mode_errors__purity_error_should_be_in_promise_purity_scope_to_spec_3_f_0(NegCtxt_47, ModeInfo_4, Var_72);
          }
          break;
        case (MR_Integer) 19:
          {
            MR_Word Vars_73 = ((MR_Word) ((MR_hl_field(3, ModeError_5, 1))));

            Spec_6 = check_hlds__mode_errors__purity_error_lambda_should_be_any_to_spec_2_f_0(ModeInfo_4, Vars_73);
          }
          break;
      }
      break;
  }
  return Spec_6;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_in_callee_to_spec_6_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_HeadVar__3_3;

  conv0_HeadVar__3_3 = parse_tree__error_spec__var_in_table_to_quote_piece_2_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_HeadVar__3_3));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_in_callee_to_spec_6_f_0(
  MR_Word STATE_VARIABLE_ModeInfo_0_57,
  MR_Word Vars_9,
  MR_Word Insts_10,
  MR_Word CalleePredId_11,
  MR_Integer CalleeProcId_12,
  MR_Word CalleeModeErrors_13)
{
  MR_Word Spec_14;
  MR_Word Preamble_15;
  MR_Word ModuleInfo_16;
  MR_Word Context_17;
  MR_Word VarTable_18;
  MR_Word MainPieces_21;
  MR_Word HeadInst_26;
  MR_Word TailInsts_27;
  MR_Word NoMatchPieces_28;
  MR_Word CalleePredIdPieces_29;
  MR_Word VerboseCalleePieces_30;
  MR_Word VerbosePieces_31;
  MR_Word NonVerbosePieces_33;
  MR_Word InitMsg_34;
  MR_Word Var_92;
  MR_Word Var_93;
  MR_Word Var_108;
  MR_Word Var_120;
  MR_Word Var_126;
  MR_Word Var_127;
  MR_Word Var_128;
  MR_Word Var_129;
  MR_Word Var_130;
  MR_Box conv1_HeadInst_26;

  Preamble_15 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(STATE_VARIABLE_ModeInfo_0_57);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(STATE_VARIABLE_ModeInfo_0_57, &ModuleInfo_16);
  check_hlds__mode_info__mode_info_get_context_2_p_0(STATE_VARIABLE_ModeInfo_0_57, &Context_17);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(STATE_VARIABLE_ModeInfo_0_57, &VarTable_18);
  if ((Vars_9 == (MR_Word) ((MR_Unsigned) 0U)))
    mercury__require__unexpected_2_p_0((MR_String) "function \140check_hlds.mode_errors.mode_error_in_callee_to_spec\'/6", (MR_String) "Vars = []");
  else
  {
    MR_Word Var_171 = ((MR_Word) ((MR_hl_field(1, Vars_9, 1))));
    MR_Word Var_172 = ((MR_Word) ((MR_hl_field(1, Vars_9, 0))));

    if ((Var_171 == (MR_Word) ((MR_Unsigned) 0U)))
    {
      MR_Word VarPiece_20;
      MR_Word Var_65;
      MR_Word Var_66;
      MR_Word Var_67;

      VarPiece_20 = parse_tree__error_spec__var_in_table_to_quote_piece_2_f_0(VarTable_18, Var_172);
      {
        Var_67 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_67, 0) = ((MR_Box) (VarPiece_20));
        MR_hl_field(1, Var_67, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      }
      Var_66 = parse_tree__error_spec__color_as_subject_1_f_0(Var_67);
      Var_65 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_66, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[472])));
      MainPieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[470])), Var_65);
    }
    else
    {
      MR_Word VarPieces_25;
      MR_Word Var_74;
      MR_Word Var_79;
      MR_Word Var_80;

      {
        Var_74 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
        MR_hl_field(0, Var_74, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_5[2]));
        MR_hl_field(0, Var_74, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_in_callee_to_spec_6_f_0_1));
        MR_hl_field(0, Var_74, 2) = ((MR_Box) ((MR_Integer) 1));
        MR_hl_field(0, Var_74, 3) = ((MR_Box) (VarTable_18));
      }
      VarPieces_25 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_74, Vars_9);
      Var_80 = parse_tree__error_spec__piece_list_to_color_pieces_4_f_0((MR_Integer) 0, (MR_String) "and", (MR_Word) ((MR_Unsigned) 0U), VarPieces_25);
      Var_79 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_80, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[476])));
      MainPieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[474])), Var_79);
    }
  }
  mercury__list__det_head_tail_3_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0), Insts_10, &conv1_HeadInst_26, &TailInsts_27);
  HeadInst_26 = ((MR_Word) (conv1_HeadInst_26));
  Var_93 = check_hlds__mode_errors__inst_list_to_sep_lines_3_f_0(STATE_VARIABLE_ModeInfo_0_57, HeadInst_26, TailInsts_27);
  Var_92 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_93, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[479])));
  NoMatchPieces_28 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_92);
  CalleePredIdPieces_29 = hlds__hlds_error_util__describe_qual_pred_name_2_f_0(ModuleInfo_16, CalleePredId_11);
  Var_108 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), CalleePredIdPieces_29, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[485])));
  VerboseCalleePieces_30 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[481])), Var_108);
  Var_120 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), NoMatchPieces_28, VerboseCalleePieces_30);
  VerbosePieces_31 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), MainPieces_21, Var_120);
  Var_126 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), NoMatchPieces_28, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[487])));
  NonVerbosePieces_33 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), MainPieces_21, Var_126);
  {
    Var_128 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_128, 0) = ((MR_Box) (Preamble_15));
  }
  {
    Var_130 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Var_130, 0) = ((MR_Box) (VerbosePieces_31));
    MR_hl_field(2, Var_130, 1) = ((MR_Box) (NonVerbosePieces_33));
  }
  {
    Var_129 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_129, 0) = ((MR_Box) (Var_130));
    MR_hl_field(1, Var_129, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Var_127 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_127, 0) = ((MR_Box) (Var_128));
    MR_hl_field(1, Var_127, 1) = ((MR_Box) (Var_129));
  }
  {
    InitMsg_34 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, InitMsg_34, 0) = ((MR_Box) (Context_17));
    MR_hl_field(2, InitMsg_34, 1) = ((MR_Box) (Var_127));
  }
  if ((CalleeModeErrors_13 == (MR_Word) ((MR_Unsigned) 0U)))
    mercury__require__unexpected_2_p_0((MR_String) "function \140check_hlds.mode_errors.mode_error_in_callee_to_spec\'/6", (MR_String) "no error");
  else
  {
    MR_Word FirstModeError_35 = ((MR_Word) ((MR_hl_field(1, CalleeModeErrors_13, 0))));
    MR_Word CalleeModeError_38 = ((MR_Word) ((MR_hl_field(0, FirstModeError_35, 1))));
    MR_Word CalleeContext_39 = ((MR_Word) ((MR_hl_field(0, FirstModeError_35, 2))));
    MR_Word CalleeModeContext_40 = ((MR_Word) ((MR_hl_field(0, FirstModeError_35, 3))));
    MR_Word CalleeProcInfo_41;
    MR_Word CalleeVarTable_42;
    MR_Word CalleeModeErrorSpec0_43;
    MR_Word Globals_44;
    MR_Word LaterMsgs0_45;
    MR_Word LaterMsgs_46;
    MR_Word STATE_VARIABLE_ModeInfo_1_132;
    MR_Word STATE_VARIABLE_ModeInfo_2_133;
    MR_Word STATE_VARIABLE_ModeInfo_3_134;
    MR_Word STATE_VARIABLE_ModeInfo_4_135;
    MR_Word STATE_VARIABLE_ModeInfo_5_136;
    MR_Word Var_157;

    check_hlds__mode_info__mode_info_set_pred_id_3_p_0(CalleePredId_11, STATE_VARIABLE_ModeInfo_0_57, &STATE_VARIABLE_ModeInfo_1_132);
    check_hlds__mode_info__mode_info_set_proc_id_3_p_0(CalleeProcId_12, STATE_VARIABLE_ModeInfo_1_132, &STATE_VARIABLE_ModeInfo_2_133);
    check_hlds__mode_info__mode_info_set_context_3_p_0(CalleeContext_39, STATE_VARIABLE_ModeInfo_2_133, &STATE_VARIABLE_ModeInfo_3_134);
    check_hlds__mode_info__mode_info_set_mode_context_3_p_0(CalleeModeContext_40, STATE_VARIABLE_ModeInfo_3_134, &STATE_VARIABLE_ModeInfo_4_135);
    hlds__hlds_module__module_info_proc_info_4_p_0(ModuleInfo_16, CalleePredId_11, CalleeProcId_12, &CalleeProcInfo_41);
    hlds__hlds_pred__proc_info_get_var_table_2_p_0(CalleeProcInfo_41, &CalleeVarTable_42);
    check_hlds__mode_info__mode_info_set_var_table_3_p_0(CalleeVarTable_42, STATE_VARIABLE_ModeInfo_4_135, &STATE_VARIABLE_ModeInfo_5_136);
    CalleeModeErrorSpec0_43 = check_hlds__mode_errors__mode_error_to_spec_2_f_0(STATE_VARIABLE_ModeInfo_5_136, CalleeModeError_38);
    hlds__hlds_module__module_info_get_globals_2_p_0(ModuleInfo_16, &Globals_44);
    parse_tree__error_spec__extract_spec_msgs_and_maybe_add_id_3_p_0(Globals_44, CalleeModeErrorSpec0_43, &LaterMsgs0_45);
    if ((LaterMsgs0_45 == (MR_Word) ((MR_Unsigned) 0U)))
      LaterMsgs_46 = (MR_Word) ((MR_Unsigned) 0U);
    else
    {
      MR_Word LaterHead0_47 = ((MR_Word) ((MR_hl_field(1, LaterMsgs0_45, 0))));
      MR_Word LaterTail_48 = ((MR_Word) ((MR_hl_field(1, LaterMsgs0_45, 1))));
      MR_Word LaterHead_51;
      MR_Word Var_153;

      switch (MR_tag((MR_Word) LaterHead0_47)) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          {
            MR_Word LaterContext_49 = ((MR_Word) ((MR_hl_field(0, LaterHead0_47, 0))));
            MR_Word Pieces_50 = ((MR_Word) ((MR_hl_field(0, LaterHead0_47, 1))));
            MR_Word Var_137;
            MR_Word Var_140;
            MR_Word Var_141;

            {
              Var_137 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_137, 0) = ((MR_Box) (LaterContext_49));
            }
            {
              Var_141 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, Var_141, 0) = ((MR_Box) (Pieces_50));
            }
            {
              Var_140 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_140, 0) = ((MR_Box) (Var_141));
              MR_hl_field(1, Var_140, 1) = ((MR_Box) ((MR_Unsigned) 0U));
            }
            {
              LaterHead_51 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(3, LaterHead_51, 0) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 1) = ((MR_Box) (Var_137));
              MR_hl_field(3, LaterHead_51, 2) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 0));
              MR_hl_field(3, LaterHead_51, 3) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 4) = ((MR_Box) (Var_140));
            }
          }
          break;
        case (MR_Integer) 1:
          {
            MR_Word Var_146;
            MR_Word Var_147;
            MR_Word Pieces_160 = ((MR_Word) ((MR_hl_field(1, LaterHead0_47, 0))));

            {
              Var_147 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, Var_147, 0) = ((MR_Box) (Pieces_160));
            }
            {
              Var_146 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_146, 0) = ((MR_Box) (Var_147));
              MR_hl_field(1, Var_146, 1) = ((MR_Box) ((MR_Unsigned) 0U));
            }
            {
              LaterHead_51 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(3, LaterHead_51, 0) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 1) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 2) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 0));
              MR_hl_field(3, LaterHead_51, 3) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 4) = ((MR_Box) (Var_146));
            }
          }
          break;
        case (MR_Integer) 2:
          {
            MR_Word Components_52 = ((MR_Word) ((MR_hl_field(2, LaterHead0_47, 1))));
            MR_Word Var_149;
            MR_Word LaterContext_161 = ((MR_Word) ((MR_hl_field(2, LaterHead0_47, 0))));

            {
              Var_149 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_149, 0) = ((MR_Box) (LaterContext_161));
            }
            {
              LaterHead_51 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(3, LaterHead_51, 0) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 1) = ((MR_Box) (Var_149));
              MR_hl_field(3, LaterHead_51, 2) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 0));
              MR_hl_field(3, LaterHead_51, 3) = ((MR_Box) ((MR_Unsigned) 0U));
              MR_hl_field(3, LaterHead_51, 4) = ((MR_Box) (Components_52));
            }
          }
          break;
        case (MR_Integer) 3:
          switch (((MR_Integer) ((MR_hl_field(3, LaterHead0_47, 0))))) {
            default: /*NOTREACHED*/ MR_assert(0);
            case (MR_Integer) 0:
              {
                MR_Word MaybeLaterContext_53 = ((MR_Word) ((MR_hl_field(3, LaterHead0_47, 1))));
                MR_Unsigned Indent_55 = ((MR_Unsigned) ((MR_hl_field(3, LaterHead0_47, 3))));
                MR_Word Components_162 = ((MR_Word) ((MR_hl_field(3, LaterHead0_47, 4))));

                {
                  LaterHead_51 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL));
                  MR_hl_field(3, LaterHead_51, 0) = ((MR_Box) ((MR_Unsigned) 0U));
                  MR_hl_field(3, LaterHead_51, 1) = ((MR_Box) (MaybeLaterContext_53));
                  MR_hl_field(3, LaterHead_51, 2) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 0));
                  MR_hl_field(3, LaterHead_51, 3) = ((MR_Box) (Indent_55));
                  MR_hl_field(3, LaterHead_51, 4) = ((MR_Box) (Components_162));
                }
              }
              break;
            case (MR_Integer) 1:
              LaterHead_51 = LaterHead0_47;
              break;
          }
          break;
      }
      {
        Var_153 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_153, 0) = ((MR_Box) (LaterHead_51));
        MR_hl_field(1, Var_153, 1) = ((MR_Box) (LaterTail_48));
      }
      LaterMsgs_46 = parse_tree__error_util__start_each_msg_with_blank_line_1_f_0(Var_153);
    }
    {
      Var_157 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_157, 0) = ((MR_Box) (InitMsg_34));
      MR_hl_field(1, Var_157, 1) = ((MR_Box) (LaterMsgs_46));
    }
    {
      Spec_14 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(2, Spec_14, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_in_callee_to_spec\'/6"));
      MR_hl_field(2, Spec_14, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      MR_hl_field(2, Spec_14, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
      MR_hl_field(2, Spec_14, 3) = ((MR_Box) (Var_157));
    }
  }
  return Spec_14;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_conjunct_to_msgs_3_f_0(
  MR_Word Context_5,
  MR_Word STATE_VARIABLE_ModeInfo_0_37,
  MR_Word DelayedGoal_7)
{
  MR_Word Msgs_8;
  MR_Word ModuleInfo_9;
  MR_Word Globals_10;
  MR_Word Vars_11;
  MR_Word Error_12;
  MR_Word Goal_13;
  MR_Word ModeError_15;
  MR_Word ErrorContext_16;
  MR_Word ModeContext_17;
  MR_Word SubSpec0_18;
  MR_Word SubMsgs_19;
  MR_Word DebugModes_20;
  MR_Word STATE_VARIABLE_ModeInfo_1_38;
  MR_Word STATE_VARIABLE_ModeInfo_2_39;

  check_hlds__mode_info__mode_info_get_module_info_2_p_0(STATE_VARIABLE_ModeInfo_0_37, &ModuleInfo_9);
  hlds__hlds_module__module_info_get_globals_2_p_0(ModuleInfo_9, &Globals_10);
  Vars_11 = ((MR_Word) ((MR_hl_field(0, DelayedGoal_7, 0))));
  Error_12 = ((MR_Word) ((MR_hl_field(0, DelayedGoal_7, 1))));
  Goal_13 = ((MR_Word) ((MR_hl_field(0, DelayedGoal_7, 2))));
  ModeError_15 = ((MR_Word) ((MR_hl_field(0, Error_12, 1))));
  ErrorContext_16 = ((MR_Word) ((MR_hl_field(0, Error_12, 2))));
  ModeContext_17 = ((MR_Word) ((MR_hl_field(0, Error_12, 3))));
  check_hlds__mode_info__mode_info_set_context_3_p_0(ErrorContext_16, STATE_VARIABLE_ModeInfo_0_37, &STATE_VARIABLE_ModeInfo_1_38);
  check_hlds__mode_info__mode_info_set_mode_context_3_p_0(ModeContext_17, STATE_VARIABLE_ModeInfo_1_38, &STATE_VARIABLE_ModeInfo_2_39);
  SubSpec0_18 = check_hlds__mode_errors__mode_error_to_spec_2_f_0(STATE_VARIABLE_ModeInfo_2_39, ModeError_15);
  parse_tree__error_spec__extract_spec_msgs_and_maybe_add_id_3_p_0(Globals_10, SubSpec0_18, &SubMsgs_19);
  libs__globals__lookup_bool_option_3_p_0(Globals_10, (MR_Integer) 700, &DebugModes_20);
  switch (DebugModes_20) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      Msgs_8 = SubMsgs_19;
      break;
    case (MR_Integer) 1:
      {
        MR_Word VarList_21;
        MR_Word VarTable_22;
        MR_String VarNames_23;
        MR_Word Pieces1_24;
        MR_Word Msg1_25;
        MR_Word VeryVerbose_26;
        MR_Word Var_43;
        MR_Word Var_44;

        parse_tree__set_of_var__to_sorted_list_2_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_prog_var_type_0), Vars_11, &VarList_21);
        check_hlds__mode_info__mode_info_get_var_table_2_p_0(STATE_VARIABLE_ModeInfo_2_39, &VarTable_22);
        VarNames_23 = parse_tree__parse_tree_out_term__mercury_vars_to_name_only_2_f_0(VarTable_22, VarList_21);
        {
          Var_44 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_44, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_44, 1) = ((MR_Box) (VarNames_23));
        }
        {
          Var_43 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_43, 0) = ((MR_Box) (Var_44));
          MR_hl_field(1, Var_43, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[335])));
        }
        {
          Pieces1_24 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Pieces1_24, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[333])));
          MR_hl_field(1, Pieces1_24, 1) = ((MR_Box) (Var_43));
        }
        {
          Msg1_25 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
          MR_hl_field(0, Msg1_25, 0) = ((MR_Box) (Context_5));
          MR_hl_field(0, Msg1_25, 1) = ((MR_Box) (Pieces1_24));
        }
        libs__globals__lookup_bool_option_3_p_0(Globals_10, (MR_Integer) 132, &VeryVerbose_26);
        switch (VeryVerbose_26) {
          default: /*NOTREACHED*/ MR_assert(0);
          case (MR_Integer) 0:
            {
              MR_Word Var_52;

              {
                Var_52 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_52, 0) = ((MR_Box) (Msg1_25));
                MR_hl_field(1, Var_52, 1) = ((MR_Box) ((MR_Unsigned) 0U));
              }
              Msgs_8 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Var_52, SubMsgs_19);
            }
            break;
          case (MR_Integer) 1:
            {
              MR_Word OutInfo_27;
              MR_Word VarNameSrc_28;
              MR_Word TVarSet_29;
              MR_Word InstVarSet_30;
              MR_Word StringBuilder0_31;
              MR_Word StringBuilder1_32;
              MR_Word StringBuilder_33;
              MR_String GoalStr_34;
              MR_Word Components2_35;
              MR_Word Msg2_36;
              MR_Word Var_59;
              MR_Word Var_60;
              MR_Word Var_62;
              MR_Word Var_63;
              MR_Word Var_71;
              MR_Word Var_72;

              OutInfo_27 = hlds__hlds_out__hlds_out_util__init_hlds_out_info_2_f_0(Globals_10, (MR_Integer) 1);
              {
                VarNameSrc_28 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, VarNameSrc_28, 0) = ((MR_Box) (VarTable_22));
              }
              mercury__varset__init_1_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_tvar_type_0), &TVarSet_29);
              mercury__varset__init_1_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_inst_var_type_0), &InstVarSet_30);
              StringBuilder0_31 = mercury__string__builder__init_0_f_0();
              mercury__string__builder__append_string_3_p_0((MR_String) "\t\t", StringBuilder0_31, &StringBuilder1_32);
              hlds__hlds_out__hlds_out_goal__format_goal_nl_11_p_0(OutInfo_27, ModuleInfo_9, VarNameSrc_28, (MR_Integer) 0, TVarSet_29, InstVarSet_30, (MR_Unsigned) 2U, (MR_String) ".\n", Goal_13, StringBuilder1_32, &StringBuilder_33);
              GoalStr_34 = mercury__string__builder__to_string_1_f_0(StringBuilder_33);
              {
                Var_63 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(2, Var_63, 0) = ((MR_Box) (GoalStr_34));
              }
              {
                Var_62 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_62, 0) = ((MR_Box) (Var_63));
                MR_hl_field(1, Var_62, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
              }
              {
                Var_60 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_60, 0) = ((MR_Box) ((MR_Unsigned) 12U));
                MR_hl_field(1, Var_60, 1) = ((MR_Box) (Var_62));
              }
              {
                Var_59 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
                MR_hl_field(0, Var_59, 0) = ((MR_Box) (Var_60));
              }
              {
                Components2_35 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Components2_35, 0) = ((MR_Box) (Var_59));
                MR_hl_field(1, Components2_35, 1) = ((MR_Box) ((MR_Unsigned) 0U));
              }
              {
                Msg2_36 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(3, Msg2_36, 0) = ((MR_Box) ((MR_Unsigned) 0U));
                MR_hl_field(3, Msg2_36, 1) = ((MR_Box) ((MR_Unsigned) 0U));
                MR_hl_field(3, Msg2_36, 2) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 1));
                MR_hl_field(3, Msg2_36, 3) = ((MR_Box) ((MR_Unsigned) 0U));
                MR_hl_field(3, Msg2_36, 4) = ((MR_Box) (Components2_35));
              }
              {
                Var_72 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_72, 0) = ((MR_Box) (Msg2_36));
                MR_hl_field(1, Var_72, 1) = ((MR_Box) ((MR_Unsigned) 0U));
              }
              {
                Var_71 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_71, 0) = ((MR_Box) (Msg1_25));
                MR_hl_field(1, Var_71, 1) = ((MR_Box) (Var_72));
              }
              Msgs_8 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Var_71, SubMsgs_19);
            }
            break;
        }
      }
      break;
  }
  return Msgs_8;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_3(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv1_HeadVar__3_3;

  conv1_HeadVar__3_3 = check_hlds__mode_errors__prefix_with_blank_line_2_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv1_HeadVar__3_3));
  return wrapper_arg_2;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_Msgs_8;

  conv0_Msgs_8 = check_hlds__mode_errors__mode_error_conjunct_to_msgs_3_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_Msgs_8));
  return wrapper_arg_2;
}

static MR_bool MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_bool succeeded;
  MR_Box closure = closure_arg;

  succeeded = check_hlds__mode_errors__is_error_important_1_p_0(((MR_Word) (wrapper_arg_1)));
  return succeeded;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word OoMErrors_6,
  MR_Word Culprit_7)
{
  MR_bool succeeded;
  MR_Word Spec_8;
  MR_Word Context_9;
  MR_Word HeadError_10;
  MR_Word TailErrors_11;
  MR_Word Msgs1_12;
  MR_Word Msgs2_33;
  MR_Word Var_103;

  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_5, &Context_9);
  HeadError_10 = ((MR_Word) ((MR_hl_field(0, OoMErrors_6, 0))));
  TailErrors_11 = ((MR_Word) ((MR_hl_field(0, OoMErrors_6, 1))));
  if ((TailErrors_11 == (MR_Word) ((MR_Unsigned) 0U)))
    Msgs1_12 = check_hlds__mode_errors__mode_error_conjunct_to_msgs_3_f_0(Context_9, ModeInfo_5, HeadError_10);
  else
  {
    MR_Word Errors_15;
    MR_Word ImportantErrors_16;
    MR_Word OtherErrors_17;
    MR_Word ModuleInfo_18;
    MR_Word Globals_19;
    MR_Word VerboseErrors_20;

    {
      Errors_15 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Errors_15, 0) = ((MR_Box) (HeadError_10));
      MR_hl_field(1, Errors_15, 1) = ((MR_Box) (TailErrors_11));
    }
    mercury__list__filter_4_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[11]), Errors_15, &ImportantErrors_16, &OtherErrors_17);
    check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_5, &ModuleInfo_18);
    hlds__hlds_module__module_info_get_globals_2_p_0(ModuleInfo_18, &Globals_19);
    libs__globals__lookup_bool_option_3_p_0(Globals_19, (MR_Integer) 139, &VerboseErrors_20);
    switch (VerboseErrors_20) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 0:
        {
          MR_Word ConjMsgs_23;
          MR_Word MoreMsg_26;
          MR_Word Var_51;

          if ((ImportantErrors_16 == (MR_Word) ((MR_Unsigned) 0U)))
            if ((OtherErrors_17 == (MR_Word) ((MR_Unsigned) 0U)))
              mercury__require__unexpected_2_p_0((MR_String) "function \140check_hlds.mode_errors.mode_error_unschedulable_conjuncts_to_spec\'/3", (MR_String) "no errors of any kind");
            else
            {
              MR_Word FirstOtherError_24 = ((MR_Word) ((MR_hl_field(1, OtherErrors_17, 0))));

              ConjMsgs_23 = check_hlds__mode_errors__mode_error_conjunct_to_msgs_3_f_0(Context_9, ModeInfo_5, FirstOtherError_24);
            }
          else
          {
            MR_Word FirstImportantError_21 = ((MR_Word) ((MR_hl_field(1, ImportantErrors_16, 0))));

            ConjMsgs_23 = check_hlds__mode_errors__mode_error_conjunct_to_msgs_3_f_0(Context_9, ModeInfo_5, FirstImportantError_21);
          }
          {
            MoreMsg_26 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(2, MoreMsg_26, 0) = ((MR_Box) (Context_9));
            MR_hl_field(2, MoreMsg_26, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[318])));
          }
          {
            Var_51 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_51, 0) = ((MR_Box) (MoreMsg_26));
            MR_hl_field(1, Var_51, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          Msgs1_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), ConjMsgs_23, Var_51);
        }
        break;
      case (MR_Integer) 1:
        {
          MR_Word Preamble_27;
          MR_Integer NumErrors_28;
          MR_Word ConjPieces_29;
          MR_Word Msgs1Start_30;
          MR_Word Msgs1Rest0_31;
          MR_Word Msgs1Rest_32;
          MR_Word Var_55;
          MR_Word Var_56;
          MR_Word Var_66;
          MR_Word Var_67;
          MR_Word Var_69;
          MR_Word Var_70;
          MR_Word Var_71;
          MR_Word Var_72;

          Preamble_27 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_5);
          NumErrors_28 = mercury__list__length_1_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0), Errors_15);
          {
            Var_56 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_56, 0) = ((MR_Box) ((MR_Unsigned) 2U));
            MR_hl_field(3, Var_56, 1) = ((MR_Box) (NumErrors_28));
          }
          {
            Var_55 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_55, 0) = ((MR_Box) (Var_56));
            MR_hl_field(1, Var_55, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[323])));
          }
          {
            ConjPieces_29 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, ConjPieces_29, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[319])));
            MR_hl_field(1, ConjPieces_29, 1) = ((MR_Box) (Var_55));
          }
          Var_67 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_27, ConjPieces_29);
          {
            Var_66 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
            MR_hl_field(0, Var_66, 0) = ((MR_Box) (Context_9));
            MR_hl_field(0, Var_66, 1) = ((MR_Box) (Var_67));
          }
          {
            Msgs1Start_30 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Msgs1Start_30, 0) = ((MR_Box) (Var_66));
            MR_hl_field(1, Msgs1Start_30, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          {
            Var_69 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
            MR_hl_field(0, Var_69, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_7[2]));
            MR_hl_field(0, Var_69, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_2));
            MR_hl_field(0, Var_69, 2) = ((MR_Box) ((MR_Integer) 2));
            MR_hl_field(0, Var_69, 3) = ((MR_Box) (Context_9));
            MR_hl_field(0, Var_69, 4) = ((MR_Box) (ModeInfo_5));
          }
          Var_70 = mercury__list__f_43_43_2_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0), ImportantErrors_16, OtherErrors_17);
          Msgs1Rest0_31 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[4]), Var_69, Var_70);
          {
            Var_71 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
            MR_hl_field(0, Var_71, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_5[3]));
            MR_hl_field(0, Var_71, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_unschedulable_conjuncts_to_spec_3_f_0_3));
            MR_hl_field(0, Var_71, 2) = ((MR_Box) ((MR_Integer) 1));
            MR_hl_field(0, Var_71, 3) = ((MR_Box) (Context_9));
          }
          Msgs1Rest_32 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[4]), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[4]), Var_71, Msgs1Rest0_31);
          Var_72 = mercury__list__condense_1_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Msgs1Rest_32);
          Msgs1_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Msgs1Start_30, Var_72);
        }
        break;
    }
  }
  switch (MR_tag((MR_Word) Culprit_7)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      switch (MR_unmkbody(Culprit_7)) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          {
            MR_Word Var_81;

            {
              Var_81 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, Var_81, 0) = ((MR_Box) (Context_9));
              MR_hl_field(0, Var_81, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[327])));
            }
            {
              Msgs2_33 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Msgs2_33, 0) = ((MR_Box) (Var_81));
              MR_hl_field(1, Msgs2_33, 1) = ((MR_Box) ((MR_Unsigned) 0U));
            }
          }
          break;
        case (MR_Integer) 1:
          Msgs2_33 = (MR_Word) ((MR_Unsigned) 0U);
          break;
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word ImpureGoal_35 = ((MR_Word) ((MR_hl_field(1, Culprit_7, 0))));
        MR_Word ImpureGoalInfo_37 = ((MR_Word) ((MR_hl_field(0, ImpureGoal_35, 1))));
        MR_Word ImpureGoalContext_38;
        MR_Word Var_96;
        MR_Word Var_97;
        MR_Word Var_98;

        ImpureGoalContext_38 = hlds__hlds_goal__goal_info_get_context_1_f_0(ImpureGoalInfo_37);
        {
          Var_96 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
          MR_hl_field(0, Var_96, 0) = ((MR_Box) (Context_9));
          MR_hl_field(0, Var_96, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[330])));
        }
        {
          Var_98 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
          MR_hl_field(0, Var_98, 0) = ((MR_Box) (ImpureGoalContext_38));
          MR_hl_field(0, Var_98, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[332])));
        }
        {
          Var_97 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_97, 0) = ((MR_Box) (Var_98));
          MR_hl_field(1, Var_97, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        {
          Msgs2_33 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Msgs2_33, 0) = ((MR_Box) (Var_96));
          MR_hl_field(1, Msgs2_33, 1) = ((MR_Box) (Var_97));
        }
      }
      break;
  }
  Var_103 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), Msgs1_12, Msgs2_33);
  {
    Spec_8 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unschedulable_conjuncts_to_spec\'/3"));
    MR_hl_field(2, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_8, 3) = ((MR_Box) (Var_103));
  }
  return Spec_8;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__purity_error_lambda_should_be_any_to_spec_2_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_HeadVar__3_3;

  conv0_HeadVar__3_3 = parse_tree__error_spec__var_in_table_to_quote_piece_2_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_HeadVar__3_3));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__purity_error_lambda_should_be_any_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word OoMVars_5)
{
  MR_Word Spec_6;
  MR_Word Preamble_7;
  MR_Word Context_8;
  MR_Word VarTable_9;
  MR_Word HeadVar_10;
  MR_Word TailVars_11;
  MR_Word VarsWhoseInstsContain_12;
  MR_Word VarsDotPieces_14;
  MR_Word Pieces_19;
  MR_Word Always_20;
  MR_Word Var_57;
  MR_Word Var_58;
  MR_Word Var_66;
  MR_Word Var_70;
  MR_Word Var_111;
  MR_Word Var_112;
  MR_Word Var_113;

  Preamble_7 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_4);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_4, &Context_8);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_4, &VarTable_9);
  HeadVar_10 = ((MR_Word) ((MR_hl_field(0, OoMVars_5, 0))));
  TailVars_11 = ((MR_Word) ((MR_hl_field(0, OoMVars_5, 1))));
  if ((TailVars_11 == (MR_Word) ((MR_Unsigned) 0U)))
  {
    MR_Word HeadVarPiece_13;
    MR_Word Var_29;

    VarsWhoseInstsContain_12 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[511]));
    HeadVarPiece_13 = parse_tree__error_spec__var_in_table_to_quote_piece_2_f_0(VarTable_9, HeadVar_10);
    {
      Var_29 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_29, 0) = ((MR_Box) (HeadVarPiece_13));
      MR_hl_field(1, Var_29, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])));
    }
    VarsDotPieces_14 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_29);
  }
  else
  {
    MR_Word Vars_17;
    MR_Word VarPieces_18;
    MR_Word Var_40;

    VarsWhoseInstsContain_12 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[515]));
    {
      Vars_17 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Vars_17, 0) = ((MR_Box) (HeadVar_10));
      MR_hl_field(1, Vars_17, 1) = ((MR_Box) (TailVars_11));
    }
    {
      Var_40 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, Var_40, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_5[2]));
      MR_hl_field(0, Var_40, 1) = ((MR_Box) (check_hlds__mode_errors__purity_error_lambda_should_be_any_to_spec_2_f_0_1));
      MR_hl_field(0, Var_40, 2) = ((MR_Box) ((MR_Integer) 1));
      MR_hl_field(0, Var_40, 3) = ((MR_Box) (VarTable_9));
    }
    VarPieces_18 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_40, Vars_17);
    VarsDotPieces_14 = parse_tree__error_spec__piece_list_to_color_pieces_4_f_0((MR_Integer) 2, (MR_String) "and", (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])), VarPieces_18);
  }
  Var_66 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), VarsDotPieces_14, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  Var_58 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[521])), Var_66);
  Var_57 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), VarsWhoseInstsContain_12, Var_58);
  Pieces_19 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[520])), Var_57);
  Var_70 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_7, Pieces_19);
  {
    Always_20 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Always_20, 0) = ((MR_Box) (Var_70));
  }
  {
    Var_113 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_113, 0) = ((MR_Box) (Always_20));
    MR_hl_field(1, Var_113, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[579])));
  }
  {
    Var_112 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Var_112, 0) = ((MR_Box) (Context_8));
    MR_hl_field(2, Var_112, 1) = ((MR_Box) (Var_113));
  }
  {
    Var_111 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_111, 0) = ((MR_Box) (Var_112));
    MR_hl_field(1, Var_111, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Spec_6 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_6, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.purity_error_lambda_should_be_any_to_spec\'/2"));
    MR_hl_field(2, Spec_6, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_6, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_6, 3) = ((MR_Box) (Var_111));
  }
  return Spec_6;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__purity_error_should_be_in_promise_purity_scope_to_spec_3_f_0(
  MR_Word NegCtxtDesc_5,
  MR_Word ModeInfo_6,
  MR_Word Var_7)
{
  MR_Word Spec_8;
  MR_Word Preamble_9;
  MR_Word Context_10;
  MR_Word VarTable_11;
  MR_String VarName_12;
  MR_Word Pieces_13;
  MR_Word Var_76;

  Preamble_9 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_6);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_6, &Context_10);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_6, &VarTable_11);
  VarName_12 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_11, Var_7);
  switch (NegCtxtDesc_5) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word Var_22;
        MR_Word Var_23;
        MR_Word Var_24;
        MR_Word Var_25;
        MR_Word Var_27;
        MR_Word Var_32;
        MR_Word Var_33;

        {
          Var_25 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_25, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_25, 1) = ((MR_Box) (VarName_12));
        }
        {
          Var_24 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_24, 0) = ((MR_Box) (Var_25));
          MR_hl_field(1, Var_24, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_23 = parse_tree__error_spec__color_as_subject_1_f_0(Var_24);
        Var_33 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[502])));
        Var_32 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_33, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[504])));
        Var_27 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[501])), Var_32);
        Var_22 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_23, Var_27);
        Pieces_13 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[499])), Var_22);
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word Var_51;
        MR_Word Var_52;
        MR_Word Var_53;
        MR_Word Var_54;
        MR_Word Var_56;
        MR_Word Var_61;
        MR_Word Var_62;

        {
          Var_54 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_54, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_54, 1) = ((MR_Box) (VarName_12));
        }
        {
          Var_53 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_53, 0) = ((MR_Box) (Var_54));
          MR_hl_field(1, Var_53, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_52 = parse_tree__error_spec__color_as_subject_1_f_0(Var_53);
        Var_62 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[502])));
        Var_61 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_62, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[508])));
        Var_56 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[501])), Var_61);
        Var_51 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_52, Var_56);
        Pieces_13 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[506])), Var_51);
      }
      break;
  }
  Var_76 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_9, Pieces_13);
  {
    Spec_8 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.purity_error_should_be_in_promise_purity_scope_to_spec\'/3"));
    MR_hl_field(0, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_8, 3) = ((MR_Box) (Context_10));
    MR_hl_field(0, Spec_8, 4) = ((MR_Box) (Var_76));
  }
  return Spec_8;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_cannot_create_implied_mode_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word Reason_8,
  MR_Word Var_9,
  MR_Word VarInst_10,
  MR_Word NonImpliedInitialInst_11)
{
  MR_bool succeeded;
  MR_Word Spec_12;
  MR_Word ModuleInfo_13;
  MR_Word Globals_14;
  MR_Word OpMode_15;
  MR_Word Context_16;
  MR_Word Phase_17;
  MR_Word Var_26;
  MR_Word Var_27;

  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_7, &ModuleInfo_13);
  hlds__hlds_module__module_info_get_globals_2_p_0(ModuleInfo_13, &Globals_14);
  libs__globals__get_op_mode_2_p_0(Globals_14, &OpMode_15);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_7, &Context_16);
  Phase_17 = (MR_Word) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1]));
  succeeded = ((MR_tag((MR_Word) OpMode_15)) == (MR_Integer) 3);
  if (succeeded)
  {
    Var_26 = ((MR_Word) ((MR_hl_field(3, OpMode_15, 0))));
    succeeded = ((MR_tag((MR_Word) Var_26)) == (MR_Integer) 3);
    if (succeeded)
    {
      Var_27 = ((MR_Word) ((MR_hl_field(3, Var_26, 0))));
      succeeded = ((MR_tag((MR_Word) Var_27)) == (MR_Integer) 1);
    }
  }
  if (succeeded)
  {
    MR_Word Preamble_20;
    MR_Word VarTable_21;
    MR_Word ReasonPieces_22;
    MR_String VarName_23;
    MR_Word Pieces_24;
    MR_Word Var_41;
    MR_Word Var_42;
    MR_Word Var_52;
    MR_Word Var_53;
    MR_Word Var_54;
    MR_Word Var_55;
    MR_Word Var_57;
    MR_Word Var_60;
    MR_Word Var_69;
    MR_Word Var_73;
    MR_Word InstPieces0_75;
    MR_Word InstPieces_76;
    MR_Word ModuleInfo_86;
    MR_Word InstVarSet_87;

    Preamble_20 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_7);
    check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_7, &VarTable_21);
    switch (Reason_8) {
      default: /*NOTREACHED*/ MR_assert(0);
      case (MR_Integer) 1:
        ReasonPieces_22 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[489]));
        break;
      case (MR_Integer) 0:
        ReasonPieces_22 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[491]));
        break;
    }
    VarName_23 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_21, Var_9);
    {
      Var_55 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(3, Var_55, 0) = ((MR_Box) ((MR_Unsigned) 0U));
      MR_hl_field(3, Var_55, 1) = ((MR_Box) (VarName_23));
    }
    {
      Var_54 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_54, 0) = ((MR_Box) (Var_55));
      MR_hl_field(1, Var_54, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    Var_53 = parse_tree__error_spec__color_as_subject_1_f_0(Var_54);
    Var_69 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_7, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[2])), VarInst_10, (MR_String) ",");
    check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_7, &ModuleInfo_86);
    check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_7, &InstVarSet_87);
    InstPieces0_75 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_86, InstVarSet_87, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 0, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[468])), NonImpliedInitialInst_11);
    InstPieces_76 = parse_tree__error_spec__color_as_correct_1_f_0(InstPieces0_75);
    {
      Var_73 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_73, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[43])));
      MR_hl_field(1, Var_73, 1) = ((MR_Box) (InstPieces_76));
    }
    Var_57 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_69, Var_73);
    Var_52 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_53, Var_57);
    Var_42 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[28])), Var_52);
    Var_41 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ReasonPieces_22, Var_42);
    Pieces_24 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[495])), Var_41);
    Var_60 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_20, Pieces_24);
    {
      Spec_12 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_cannot_create_implied_mode_to_spec\'/5"));
      MR_hl_field(0, Spec_12, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      MR_hl_field(0, Spec_12, 2) = ((MR_Box) (Phase_17));
      MR_hl_field(0, Spec_12, 3) = ((MR_Box) (Context_16));
      MR_hl_field(0, Spec_12, 4) = ((MR_Box) (Var_60));
    }
  }
  else
  {
    MR_Word Var_64;
    MR_Word Var_65;

    {
      Var_65 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(2, Var_65, 0) = ((MR_Box) (Context_16));
      MR_hl_field(2, Var_65, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    {
      Var_64 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_64, 0) = ((MR_Box) (Var_65));
      MR_hl_field(1, Var_64, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    {
      Spec_12 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(2, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_cannot_create_implied_mode_to_spec\'/5"));
      MR_hl_field(2, Spec_12, 1) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[7])));
      MR_hl_field(2, Spec_12, 2) = ((MR_Box) (Phase_17));
      MR_hl_field(2, Spec_12, 3) = ((MR_Box) (Var_64));
    }
  }
  return Spec_12;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__inst_list_to_sep_lines_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word Inst1_6,
  MR_Word Insts2plus_7)
{
  MR_Word Pieces_8;

  if ((Insts2plus_7 == (MR_Word) ((MR_Unsigned) 0U)))
  {
    MR_Word ModuleInfo_32;
    MR_Word InstVarSet_33;

    check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_5, &ModuleInfo_32);
    check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_5, &InstVarSet_33);
    Pieces_8 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_32, InstVarSet_33, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) ((MR_Unsigned) 0U), Inst1_6);
  }
  else
  {
    MR_Word Inst2_9 = ((MR_Word) ((MR_hl_field(1, Insts2plus_7, 0))));
    MR_Word Insts3plus_10 = ((MR_Word) ((MR_hl_field(1, Insts2plus_7, 1))));
    MR_Word HeadPieces_11;
    MR_Word TailPieces_12;
    MR_Word Var_17;
    MR_Word ModuleInfo_37;
    MR_Word InstVarSet_38;

    check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_5, &ModuleInfo_37);
    check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_5, &InstVarSet_38);
    Var_17 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_37, InstVarSet_38, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])), Inst1_6);
    HeadPieces_11 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_17, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
    TailPieces_12 = check_hlds__mode_errors__inst_list_to_sep_lines_3_f_0(ModeInfo_5, Inst2_9, Insts3plus_10);
    Pieces_8 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), HeadPieces_11, TailPieces_12);
  }
  return Pieces_8;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unexpected_final_inst_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Integer RawArgNum_9,
  MR_Word Var_10,
  MR_Word ActualInst_11,
  MR_Word ExpectedInst_12,
  MR_Word Reason_13)
{
  MR_bool succeeded;
  MR_Word Spec_14;
  MR_Word Preamble_15;
  MR_Word Context_16;
  MR_Word VarTable_17;
  MR_String Problem_18;
  MR_Word ModuleInfo_19;
  MR_Word PredId_20;
  MR_Word PredInfo_21;
  MR_Integer NumPolyAddedArgs_22;
  MR_Integer ArgNum_23;
  MR_Word ArgNumPieces_26;
  MR_String VarName_27;
  MR_Word Pieces_28;
  MR_Word Var_49;
  MR_Word Var_50;
  MR_Word Var_51;
  MR_Word Var_52;
  MR_Word Var_59;
  MR_Word Var_60;
  MR_Word Var_61;
  MR_Word Var_62;
  MR_Word Var_64;
  MR_Word Var_69;
  MR_Word Var_70;
  MR_Word Var_71;
  MR_Word Var_90;
  MR_Word Var_95;
  MR_Word Var_96;
  MR_Word Var_118;
  MR_Word ModuleInfo_120;
  MR_Word InstVarSet_121;

  Preamble_15 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_8);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_8, &Context_16);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_8, &VarTable_17);
  switch (Reason_13) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 1:
      Problem_18 = (MR_String) "did not get sufficiently instantiated.";
      break;
    case (MR_Integer) 0:
      Problem_18 = (MR_String) "became too instantiated.";
      break;
    case (MR_Integer) 2:
      Problem_18 = (MR_String) "had the wrong instantiatedness.";
      break;
  }
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_19);
  check_hlds__mode_info__mode_info_get_pred_id_2_p_0(ModeInfo_8, &PredId_20);
  hlds__hlds_module__module_info_pred_info_3_p_0(ModuleInfo_19, PredId_20, &PredInfo_21);
  hlds__hlds_pred__pred_info_get_polymorphism_added_args_2_p_0(PredInfo_21, &NumPolyAddedArgs_22);
  ArgNum_23 = (MR_Integer) ((MR_Unsigned) RawArgNum_9 - (MR_Unsigned) NumPolyAddedArgs_22);
  succeeded = (ArgNum_23 >= (MR_Integer) 1);
  if (succeeded)
  {
    MR_Word PredOrFunc_24;
    MR_Integer PredFormArityInt_25;
    MR_Word Var_31;

    PredOrFunc_24 = hlds__hlds_pred__pred_info_is_pred_or_func_1_f_0(PredInfo_21);
    Var_31 = hlds__hlds_pred__pred_info_pred_form_arity_1_f_0(PredInfo_21);
    PredFormArityInt_25 = (MR_Integer) (Var_31);
    succeeded = (PredOrFunc_24 == (MR_Integer) 1);
    if (succeeded)
      succeeded = (ArgNum_23 == PredFormArityInt_25);
    if (succeeded)
      ArgNumPieces_26 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[458]));
    else
    {
      MR_Word Var_37;
      MR_Word Var_38;

      {
        Var_38 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(3, Var_38, 0) = ((MR_Box) ((MR_Unsigned) 1U));
        MR_hl_field(3, Var_38, 1) = ((MR_Box) (ArgNum_23));
      }
      {
        Var_37 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_37, 0) = ((MR_Box) (Var_38));
        MR_hl_field(1, Var_37, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      }
      {
        ArgNumPieces_26 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, ArgNumPieces_26, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[381])));
        MR_hl_field(1, ArgNumPieces_26, 1) = ((MR_Box) (Var_37));
      }
    }
  }
  else
  {
    MR_Word Var_42;
    MR_Word Var_43;

    {
      Var_43 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(3, Var_43, 0) = ((MR_Box) ((MR_Unsigned) 1U));
      MR_hl_field(3, Var_43, 1) = ((MR_Box) (RawArgNum_9));
    }
    {
      Var_42 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_42, 0) = ((MR_Box) (Var_43));
      MR_hl_field(1, Var_42, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    {
      ArgNumPieces_26 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, ArgNumPieces_26, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[459])));
      MR_hl_field(1, ArgNumPieces_26, 1) = ((MR_Box) (Var_42));
    }
  }
  VarName_27 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_17, Var_10);
  {
    Var_52 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_52, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_52, 1) = ((MR_Box) (Problem_18));
  }
  {
    Var_51 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_51, 0) = ((MR_Box) (Var_52));
    MR_hl_field(1, Var_51, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[462])));
  }
  {
    Var_62 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_62, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_62, 1) = ((MR_Box) (VarName_27));
  }
  {
    Var_61 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_61, 0) = ((MR_Box) (Var_62));
    MR_hl_field(1, Var_61, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_60 = parse_tree__error_spec__color_as_subject_1_f_0(Var_61);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_120);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_8, &InstVarSet_121);
  Var_71 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_120, InstVarSet_121, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 0, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[465])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[210])), ActualInst_11);
  Var_70 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_71);
  Var_96 = check_hlds__mode_errors__report_inst_6_f_0(ModeInfo_8, (MR_Integer) 0, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[468])), ExpectedInst_12);
  Var_95 = parse_tree__error_spec__color_as_correct_1_f_0(Var_96);
  Var_90 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[467])), Var_95);
  Var_69 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_70, Var_90);
  Var_64 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[464])), Var_69);
  Var_59 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_60, Var_64);
  Var_50 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_51, Var_59);
  Var_49 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgNumPieces_26, Var_50);
  Pieces_28 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[173])), Var_49);
  Var_118 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_15, Pieces_28);
  {
    Spec_14 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_14, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unexpected_final_inst_to_spec\'/6"));
    MR_hl_field(0, Spec_14, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_14, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_14, 3) = ((MR_Box) (Context_16));
    MR_hl_field(0, Spec_14, 4) = ((MR_Box) (Var_118));
  }
  return Spec_14;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_bind_locked_var_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word Reason_8,
  MR_Word Var_9,
  MR_Word VarInst_10,
  MR_Word Inst_11)
{
  MR_Word Spec_12;
  MR_Word Preamble_13;
  MR_Word Context_14;
  MR_Word VarTable_15;
  MR_String ReasonStr_16;
  MR_String VarName_19;
  MR_Word MainPieces_20;
  MR_Word VerbosePieces_21;
  MR_Word Var_35;
  MR_Word Var_38;
  MR_Word Var_39;
  MR_Word Var_43;
  MR_Word Var_48;
  MR_Word Var_49;
  MR_Word Var_50;
  MR_Word Var_51;
  MR_Word Var_53;
  MR_Word Var_201;
  MR_Word Var_202;
  MR_Word Var_203;
  MR_Word Var_204;
  MR_Word Var_205;
  MR_Word Var_206;
  MR_Word Var_207;

  Preamble_13 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_7);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_7, &Context_14);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_7, &VarTable_15);
  VarName_19 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, Var_9);
  {
    Var_51 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_51, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_51, 1) = ((MR_Box) (VarName_19));
  }
  {
    Var_50 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_50, 0) = ((MR_Box) (Var_51));
    MR_hl_field(1, Var_50, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_49 = parse_tree__error_spec__color_as_subject_1_f_0(Var_50);
  Var_53 = check_hlds__mode_errors__has_inst_expected_inst_was_3_f_0(ModeInfo_7, VarInst_10, Inst_11);
  Var_48 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_49, Var_53);
  Var_43 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[25])), Var_48);
  switch (MR_tag((MR_Word) Reason_8)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      switch (MR_unmkbody(Reason_8)) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          {
            MR_Word Var_61;
            MR_Word Var_62;

            ReasonStr_16 = (MR_String) "attempt to bind a non-local variable inside a negation.";
            Var_62 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[438])));
            Var_61 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_62, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[444])));
            VerbosePieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[436])), Var_61);
          }
          break;
        case (MR_Integer) 1:
          {
            MR_Word Var_86;
            MR_Word Var_87;
            MR_Word Var_92;
            MR_Word Var_97;
            MR_Word Var_98;

            ReasonStr_16 = (MR_String) "attempt to bind a non-local variable inside the condition of an if-then-else.";
            Var_87 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[414])));
            Var_98 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[424])));
            Var_97 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_98, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
            Var_92 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[416])), Var_97);
            Var_86 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_87, Var_92);
            VerbosePieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[412])), Var_86);
          }
          break;
        case (MR_Integer) 2:
          {
            MR_Word Var_146;
            MR_Word Var_147;

            ReasonStr_16 = (MR_String) "attempt to bind a non-local variable inside a trace goal.";
            Var_147 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[456])));
            Var_146 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_147, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
            VerbosePieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[452])), Var_146);
          }
          break;
        case (MR_Integer) 3:
          {
            MR_Word Var_162;
            MR_Word Var_163;
            MR_Word Var_168;
            MR_Word Var_173;
            MR_Word Var_174;

            ReasonStr_16 = (MR_String) "attempt to bind outer state variables inside an atomic goal.";
            Var_163 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[404])));
            Var_174 = parse_tree__error_spec__color_as_subject_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[408])));
            Var_173 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_174, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
            Var_168 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[406])), Var_173);
            Var_162 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_163, Var_168);
            VerbosePieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[402])), Var_162);
          }
          break;
        case (MR_Integer) 4:
          {
            MR_Word Var_189;
            MR_Word Var_190;

            ReasonStr_16 = (MR_String) "attempt to bind a non-local variable inside more than one parallel conjunct.";
            Var_190 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[450])));
            Var_189 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_190, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
            VerbosePieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[448])), Var_189);
          }
          break;
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word PredOrFunc_17 = ((MR_Unsigned) ((MR_hl_field(1, Reason_8, 0))) & (MR_Integer) 1);
        MR_String PredOrFuncS_18;
        MR_String Var_27;
        MR_String Var_29;
        MR_Word Var_119;
        MR_Word Var_120;
        MR_Word Var_125;
        MR_Word Var_130;
        MR_Word Var_131;

        PredOrFuncS_18 = mdbcomp__prim_data__pred_or_func_to_str_1_f_0(PredOrFunc_17);
        Var_29 = mercury__string__f_43_43_2_f_0(PredOrFuncS_18, (MR_String) " lambda goal.");
        Var_27 = mercury__string__f_43_43_2_f_0((MR_String) " a ", Var_29);
        ReasonStr_16 = mercury__string__f_43_43_2_f_0((MR_String) "attempt to bind a non-local variable inside", Var_27);
        Var_120 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[428])));
        Var_131 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[432])));
        Var_130 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_131, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_125 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[368])), Var_130);
        Var_119 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_120, Var_125);
        VerbosePieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[426])), Var_119);
      }
      break;
  }
  {
    Var_39 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_39, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_39, 1) = ((MR_Box) (ReasonStr_16));
  }
  {
    Var_38 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_38, 0) = ((MR_Box) (Var_39));
    MR_hl_field(1, Var_38, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  }
  {
    Var_35 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_35, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[400])));
    MR_hl_field(1, Var_35, 1) = ((MR_Box) (Var_38));
  }
  MainPieces_20 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_35, Var_43);
  Var_205 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_13, MainPieces_20);
  {
    Var_204 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_204, 0) = ((MR_Box) (Var_205));
  }
  {
    Var_207 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_207, 0) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 0));
    MR_hl_field(1, Var_207, 1) = ((MR_Box) (VerbosePieces_21));
  }
  {
    Var_206 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_206, 0) = ((MR_Box) (Var_207));
    MR_hl_field(1, Var_206, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Var_203 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_203, 0) = ((MR_Box) (Var_204));
    MR_hl_field(1, Var_203, 1) = ((MR_Box) (Var_206));
  }
  {
    Var_202 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Var_202, 0) = ((MR_Box) (Context_14));
    MR_hl_field(2, Var_202, 1) = ((MR_Box) (Var_203));
  }
  {
    Var_201 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_201, 0) = ((MR_Box) (Var_202));
    MR_hl_field(1, Var_201, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Spec_12 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_bind_locked_var_to_spec\'/5"));
    MR_hl_field(2, Spec_12, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_12, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_12, 3) = ((MR_Box) (Var_201));
  }
  return Spec_12;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_nonground_trace_goal_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_String conv0_HeadVar__4_4;

  conv0_HeadVar__4_4 = parse_tree__parse_tree_out_term__mercury_var_to_string_3_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_HeadVar__4_4));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_nonground_trace_goal_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word HeadNGVar_6,
  MR_Word TailNGVars_7)
{
  MR_Word Spec_8;
  MR_Word Preamble_9;
  MR_Word Context_10;
  MR_Word VarTable_11;
  MR_Word NGVarNames_12;
  MR_Word VarNameCommaPieces_13;
  MR_String VarOrVars_14;
  MR_String IsOrAre_15;
  MR_Word Pieces_18;
  MR_Word Var_20;
  MR_Word Var_22;
  MR_Word Var_29;
  MR_Word Var_32;
  MR_Word Var_33;
  MR_Word Var_35;
  MR_Word Var_36;
  MR_Word Var_37;
  MR_Word Var_40;
  MR_Word Var_43;
  MR_Word Var_44;
  MR_Word Var_46;
  MR_Word Var_47;
  MR_Word Var_61;

  Preamble_9 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_5);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_5, &Context_10);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_5, &VarTable_11);
  {
    Var_20 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_20, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_7[1]));
    MR_hl_field(0, Var_20, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_nonground_trace_goal_to_spec_3_f_0_1));
    MR_hl_field(0, Var_20, 2) = ((MR_Box) ((MR_Integer) 2));
    MR_hl_field(0, Var_20, 3) = ((MR_Box) (VarTable_11));
    MR_hl_field(0, Var_20, 4) = ((MR_Box) ((MR_Integer) 0));
  }
  {
    Var_22 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_22, 0) = ((MR_Box) (HeadNGVar_6));
    MR_hl_field(1, Var_22, 1) = ((MR_Box) (TailNGVars_7));
  }
  NGVarNames_12 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), Var_20, Var_22);
  VarNameCommaPieces_13 = parse_tree__error_spec__quote_list_to_color_pieces_4_f_0((MR_Integer) 0, (MR_String) "and", (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])), NGVarNames_12);
  if ((TailNGVars_7 == (MR_Word) ((MR_Unsigned) 0U)))
  {
    VarOrVars_14 = (MR_String) "variable";
    IsOrAre_15 = (MR_String) "is";
  }
  else
  {
    VarOrVars_14 = (MR_String) "variables";
    IsOrAre_15 = (MR_String) "are";
  }
  {
    Var_33 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_33, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_33, 1) = ((MR_Box) (VarOrVars_14));
  }
  {
    Var_32 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_32, 0) = ((MR_Box) (Var_33));
    MR_hl_field(1, Var_32, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Var_29 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_29, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[393])));
    MR_hl_field(1, Var_29, 1) = ((MR_Box) (Var_32));
  }
  {
    Var_44 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_44, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_44, 1) = ((MR_Box) (IsOrAre_15));
  }
  {
    Var_43 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_43, 0) = ((MR_Box) (Var_44));
    MR_hl_field(1, Var_43, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Var_40 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_40, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[395])));
    MR_hl_field(1, Var_40, 1) = ((MR_Box) (Var_43));
  }
  {
    Var_37 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_37, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[394])));
    MR_hl_field(1, Var_37, 1) = ((MR_Box) (Var_40));
  }
  Var_47 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[397])));
  Var_46 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_47, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[399])));
  Var_36 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_37, Var_46);
  Var_35 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), VarNameCommaPieces_13, Var_36);
  Pieces_18 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_29, Var_35);
  Var_61 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_9, Pieces_18);
  {
    Spec_8 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_nonground_trace_goal_to_spec\'/3"));
    MR_hl_field(0, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_8, 3) = ((MR_Box) (Context_10));
    MR_hl_field(0, Spec_8, 4) = ((MR_Box) (Var_61));
  }
  return Spec_8;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_4(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv6_LambdaHeadVar__2_177;

  conv6_LambdaHeadVar__2_177 = check_hlds__mode_errors__IntroducedFrom__func__mode_error_coerce_error_to_spec__1915__1_1_f_0(((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv6_LambdaHeadVar__2_177));
  return wrapper_arg_2;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_3(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv4_Pieces_6;

  conv4_Pieces_6 = check_hlds__mode_errors__report_bad_arity_pieces_1_f_0(((MR_Tuple) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv4_Pieces_6));
  return wrapper_arg_2;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv2_LambdaHeadVar__2_118;

  conv2_LambdaHeadVar__2_118 = check_hlds__mode_errors__IntroducedFrom__func__mode_error_coerce_error_to_spec__1875__1_1_f_0(((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv2_LambdaHeadVar__2_118));
  return wrapper_arg_2;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv1_Pieces_4;

  conv1_Pieces_4 = check_hlds__mode_errors__make_term_path_piece_1_f_0(((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv1_Pieces_4));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_coerce_error_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word Errors_5)
{
  MR_Word Spec_6;
  MR_Word Error_7;
  MR_Word TermPath_8;
  MR_Word FromType_9;
  MR_Word ToType_10;
  MR_Word Reason_11;
  MR_Word Preamble_12;
  MR_Word Context_13;
  MR_Word TypeVarSet_14;
  MR_Word TermPathPieces_15;
  MR_Word CoercedTermOrTerms_16;
  MR_Word TheTermPieces_19;
  MR_String FromTypeStr_20;
  MR_String ToTypeStr_21;
  MR_Word ReasonPieces_23;
  MR_Word Pieces_50;
  MR_Word Var_67;
  MR_Word Var_68;
  MR_Word Var_294;
  MR_Word Var_298;
  MR_Box conv0_Error_7;

  conv0_Error_7 = mercury__list__det_head_1_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_0), Errors_5);
  Error_7 = ((MR_Word) (conv0_Error_7));
  TermPath_8 = ((MR_Word) ((MR_hl_field(0, Error_7, 0))));
  FromType_9 = ((MR_Word) ((MR_hl_field(0, Error_7, 1))));
  ToType_10 = ((MR_Word) ((MR_hl_field(0, Error_7, 2))));
  Reason_11 = ((MR_Word) ((MR_hl_field(0, Error_7, 3))));
  Preamble_12 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_4);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_4, &Context_13);
  mercury__varset__init_1_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_tvar_type_0), &TypeVarSet_14);
  if ((TermPath_8 == (MR_Word) ((MR_Unsigned) 0U)))
  {
    TermPathPieces_15 = (MR_Word) ((MR_Unsigned) 0U);
    CoercedTermOrTerms_16 = (MR_Word) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[349]));
  }
  else
  {
    MR_Word Var_59;
    MR_Word Var_60;

    Var_60 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[7]), TermPath_8);
    Var_59 = mercury__list__condense_1_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_60);
    TermPathPieces_15 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[351])), Var_59);
    CoercedTermOrTerms_16 = (MR_Word) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[352]));
  }
  {
    Var_68 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_68, 0) = ((MR_Box) (CoercedTermOrTerms_16));
    MR_hl_field(1, Var_68, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_67 = parse_tree__error_spec__color_as_subject_1_f_0(Var_68);
  TheTermPieces_19 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[199])), Var_67);
  FromTypeStr_20 = parse_tree__parse_tree_out_type__mercury_type_to_string_3_f_0(TypeVarSet_14, (MR_Integer) 0, FromType_9);
  ToTypeStr_21 = parse_tree__parse_tree_out_type__mercury_type_to_string_3_f_0(TypeVarSet_14, (MR_Integer) 0, ToType_10);
  switch (MR_tag((MR_Word) Reason_11)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word Inst_22 = ((MR_Word) ((MR_hl_field(0, Reason_11, 0))));
        MR_Word Var_72;
        MR_Word Var_77;
        MR_Word Var_78;
        MR_Word Var_79;
        MR_Word Var_96;
        MR_Word Var_101;
        MR_Word Var_102;

        Var_79 = check_hlds__mode_errors__report_inst_6_f_0(ModeInfo_4, (MR_Integer) 0, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[210])), Inst_22);
        Var_78 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_79);
        Var_102 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[375])));
        Var_101 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_102, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[377])));
        Var_96 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[373])), Var_101);
        Var_77 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_78, Var_96);
        Var_72 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[371])), Var_77);
        ReasonPieces_23 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), TheTermPieces_19, Var_72);
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word HeadConsError_25 = ((MR_Word) ((MR_hl_field(1, Reason_11, 1))));
        MR_Word TailConsErrors_26 = ((MR_Word) ((MR_hl_field(1, Reason_11, 2))));
        MR_Word InputBadConsIdSet_27;
        MR_Word InputBadInstArityConsIdSet_28;
        MR_Word ResultBadConsIdSet_29;
        MR_Word InputBadConsIds_30;
        MR_Word InputBadInstArityConsIds_31;
        MR_Word ResultBadConsIds_32;
        MR_Word ResultBadConsIdMsgPieces_33;
        MR_String BadAritySuffix_34;
        MR_Word InputBadInstArityConsIdMsgPieces_40;
        MR_String BadInputSuffix_41;
        MR_Word InputBadConsIdMsgPieces_45;
        MR_Word Var_113;
        MR_Word Var_114;
        MR_Word Var_115;
        MR_Word Var_116;
        MR_Word Var_212;
        MR_Word Var_213;
        MR_Word Var_214;
        MR_Word Var_217;
        MR_Word Var_218;
        MR_Word Var_219;
        MR_Word Var_222;
        MR_Word Var_223;
        MR_Word Var_228;
        MR_Word Var_229;

        {
          Var_113 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_113, 0) = ((MR_Box) (HeadConsError_25));
          MR_hl_field(1, Var_113, 1) = ((MR_Box) (TailConsErrors_26));
        }
        Var_114 = mercury__set__init_0_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0));
        Var_115 = mercury__set__init_0_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_2[0]));
        Var_116 = mercury__set__init_0_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0));
        check_hlds__mode_errors__classify_bound_functor_cons_id_errors_7_p_0(Var_113, Var_114, &InputBadConsIdSet_27, Var_115, &InputBadInstArityConsIdSet_28, Var_116, &ResultBadConsIdSet_29);
        InputBadConsIds_30 = mercury__set__to_sorted_list_1_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), InputBadConsIdSet_27);
        InputBadInstArityConsIds_31 = mercury__set__to_sorted_list_1_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_2[0]), InputBadInstArityConsIdSet_28);
        ResultBadConsIds_32 = mercury__set__to_sorted_list_1_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), ResultBadConsIdSet_29);
        if ((ResultBadConsIds_32 == (MR_Word) ((MR_Unsigned) 0U)))
        {
          ResultBadConsIdMsgPieces_33 = (MR_Word) ((MR_Unsigned) 0U);
          BadAritySuffix_34 = (MR_String) ".";
        }
        else
        {
          MR_Word ResultBadConsIdPieces_39;
          MR_Word Var_119;
          MR_Word Var_122;
          MR_Word Var_123;
          MR_String Var_124;
          MR_Word Var_128;
          MR_Word Var_129;
          MR_Word Var_134;
          MR_Word Var_139;
          MR_Word Var_140;
          MR_Box conv3_Var_124;

          ResultBadConsIdPieces_39 = mercury__list__map_2_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[8]), ResultBadConsIds_32);
          conv3_Var_124 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ResultBadConsIds_32, ((MR_Box) ((MR_String) "symbol in the input term\'s instantiatedness is")), ((MR_Box) ((MR_String) "symbols in the input term\'s instantiatedness are")));
          Var_124 = ((MR_String) (conv3_Var_124));
          {
            Var_123 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_123, 0) = ((MR_Box) ((MR_Unsigned) 9U));
            MR_hl_field(3, Var_123, 1) = ((MR_Box) (Var_124));
          }
          {
            Var_122 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_122, 0) = ((MR_Box) (Var_123));
            MR_hl_field(1, Var_122, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          {
            Var_119 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_119, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[353])));
            MR_hl_field(1, Var_119, 1) = ((MR_Box) (Var_122));
          }
          Var_129 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[355])));
          Var_140 = parse_tree__error_spec__piece_list_to_color_line_pieces_3_f_0((MR_Integer) 2, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])), ResultBadConsIdPieces_39);
          Var_139 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_140, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])));
          Var_134 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_139);
          Var_128 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_129, Var_134);
          ResultBadConsIdMsgPieces_33 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_119, Var_128);
          BadAritySuffix_34 = (MR_String) ";";
        }
        if ((InputBadInstArityConsIds_31 == (MR_Word) ((MR_Unsigned) 0U)))
        {
          InputBadInstArityConsIdMsgPieces_40 = (MR_Word) ((MR_Unsigned) 0U);
          BadInputSuffix_41 = (MR_String) ".";
        }
        else
        {
          MR_Word InputBadInstArityConsIdPieces_44;
          MR_Word Var_151;
          MR_Word Var_154;
          MR_Word Var_155;
          MR_String Var_156;
          MR_Word Var_166;
          MR_Word Var_167;
          MR_Word Var_169;
          MR_Word Var_170;
          MR_Box conv5_Var_156;

          InputBadInstArityConsIdPieces_44 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_2[0]), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[9]), InputBadInstArityConsIds_31);
          conv5_Var_156 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_2[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), InputBadInstArityConsIds_31, ((MR_Box) ((MR_String) "symbol is used with an incorrect arity")), ((MR_Box) ((MR_String) "symbols are used with incorrect arities")));
          Var_156 = ((MR_String) (conv5_Var_156));
          {
            Var_155 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_155, 0) = ((MR_Box) ((MR_Unsigned) 9U));
            MR_hl_field(3, Var_155, 1) = ((MR_Box) (Var_156));
          }
          {
            Var_154 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_154, 0) = ((MR_Box) (Var_155));
            MR_hl_field(1, Var_154, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[357])));
          }
          {
            Var_151 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_151, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[353])));
            MR_hl_field(1, Var_151, 1) = ((MR_Box) (Var_154));
          }
          {
            Var_170 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_170, 0) = ((MR_Box) ((MR_Unsigned) 8U));
            MR_hl_field(3, Var_170, 1) = ((MR_Box) (BadAritySuffix_34));
          }
          {
            Var_169 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_169, 0) = ((MR_Box) (Var_170));
            MR_hl_field(1, Var_169, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          Var_167 = parse_tree__error_spec__pieces_list_to_color_line_pieces_3_f_0((MR_Integer) 2, Var_169, InputBadInstArityConsIdPieces_44);
          Var_166 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_167, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])));
          InputBadInstArityConsIdMsgPieces_40 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_151, Var_166);
          BadInputSuffix_41 = (MR_String) ";";
        }
        if ((InputBadConsIds_30 == (MR_Word) ((MR_Unsigned) 0U)))
          InputBadConsIdMsgPieces_45 = (MR_Word) ((MR_Unsigned) 0U);
        else
        {
          MR_Word InputBadConsIdPieces_49;
          MR_Word Var_178;
          MR_Word Var_181;
          MR_Word Var_182;
          MR_String Var_183;
          MR_Word Var_187;
          MR_Word Var_188;
          MR_Word Var_193;
          MR_Word Var_198;
          MR_Word Var_199;
          MR_Word Var_201;
          MR_Word Var_202;
          MR_Box conv7_Var_183;

          InputBadConsIdPieces_49 = mercury__list__map_2_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[10]), InputBadConsIds_30);
          conv7_Var_183 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), InputBadConsIds_30, ((MR_Box) ((MR_String) "symbol in the input term\'s instantiatedness is")), ((MR_Box) ((MR_String) "symbols in the input term\'s instantiatedness are")));
          Var_183 = ((MR_String) (conv7_Var_183));
          {
            Var_182 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_182, 0) = ((MR_Box) ((MR_Unsigned) 9U));
            MR_hl_field(3, Var_182, 1) = ((MR_Box) (Var_183));
          }
          {
            Var_181 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_181, 0) = ((MR_Box) (Var_182));
            MR_hl_field(1, Var_181, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          {
            Var_178 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_178, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[353])));
            MR_hl_field(1, Var_178, 1) = ((MR_Box) (Var_181));
          }
          Var_188 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[359])));
          {
            Var_202 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_202, 0) = ((MR_Box) ((MR_Unsigned) 8U));
            MR_hl_field(3, Var_202, 1) = ((MR_Box) (BadInputSuffix_41));
          }
          {
            Var_201 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_201, 0) = ((MR_Box) (Var_202));
            MR_hl_field(1, Var_201, 1) = ((MR_Box) ((MR_Unsigned) 0U));
          }
          Var_199 = parse_tree__error_spec__piece_list_to_color_line_pieces_3_f_0((MR_Integer) 2, Var_201, InputBadConsIdPieces_49);
          Var_198 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_199, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])));
          Var_193 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_198);
          Var_187 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_188, Var_193);
          InputBadConsIdMsgPieces_45 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_178, Var_187);
        }
        {
          Var_218 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_218, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_218, 1) = ((MR_Box) (FromTypeStr_20));
        }
        {
          Var_223 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_223, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_223, 1) = ((MR_Box) (ToTypeStr_21));
        }
        {
          Var_222 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_222, 0) = ((MR_Box) (Var_223));
          MR_hl_field(1, Var_222, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[365])));
        }
        {
          Var_219 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_219, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[363])));
          MR_hl_field(1, Var_219, 1) = ((MR_Box) (Var_222));
        }
        {
          Var_217 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_217, 0) = ((MR_Box) (Var_218));
          MR_hl_field(1, Var_217, 1) = ((MR_Box) (Var_219));
        }
        {
          Var_214 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_214, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[362])));
          MR_hl_field(1, Var_214, 1) = ((MR_Box) (Var_217));
        }
        Var_229 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), InputBadInstArityConsIdMsgPieces_40, ResultBadConsIdMsgPieces_33);
        Var_228 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), InputBadConsIdMsgPieces_45, Var_229);
        Var_213 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_214, Var_228);
        Var_212 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), TheTermPieces_19, Var_213);
        ReasonPieces_23 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[361])), Var_212);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word Var_234;
        MR_Word Var_235;
        MR_Word Var_236;
        MR_Word Var_239;
        MR_Word Var_240;
        MR_Word Var_241;
        MR_Word Var_244;
        MR_Word Var_245;
        MR_Word Var_250;
        MR_Word Var_251;
        MR_Word Var_252;
        MR_Word Var_269;
        MR_Word Var_274;
        MR_Word Var_275;
        MR_Word Var_276;
        MR_Word Var_279;
        MR_Word Var_282;
        MR_Word Inst_301 = ((MR_Word) ((MR_hl_field(2, Reason_11, 0))));

        {
          Var_240 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_240, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_240, 1) = ((MR_Box) (FromTypeStr_20));
        }
        {
          Var_245 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_245, 0) = ((MR_Box) ((MR_Unsigned) 0U));
          MR_hl_field(3, Var_245, 1) = ((MR_Box) (ToTypeStr_21));
        }
        {
          Var_244 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_244, 0) = ((MR_Box) (Var_245));
          MR_hl_field(1, Var_244, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[367])));
        }
        {
          Var_241 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_241, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[363])));
          MR_hl_field(1, Var_241, 1) = ((MR_Box) (Var_244));
        }
        {
          Var_239 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_239, 0) = ((MR_Box) (Var_240));
          MR_hl_field(1, Var_239, 1) = ((MR_Box) (Var_241));
        }
        {
          Var_236 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_236, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[362])));
          MR_hl_field(1, Var_236, 1) = ((MR_Box) (Var_239));
        }
        Var_252 = check_hlds__mode_errors__report_inst_6_f_0(ModeInfo_4, (MR_Integer) 0, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[210])), Inst_301);
        Var_251 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_252);
        {
          Var_276 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_276, 0) = ((MR_Box) (Var_240));
          MR_hl_field(1, Var_276, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_275 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_276);
        {
          Var_282 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_282, 0) = ((MR_Box) (Var_245));
          MR_hl_field(1, Var_282, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
        }
        {
          Var_279 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_279, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[369])));
          MR_hl_field(1, Var_279, 1) = ((MR_Box) (Var_282));
        }
        Var_274 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_275, Var_279);
        Var_269 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[368])), Var_274);
        Var_250 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_251, Var_269);
        Var_235 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_236, Var_250);
        Var_234 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), TheTermPieces_19, Var_235);
        ReasonPieces_23 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[361])), Var_234);
      }
      break;
  }
  Var_294 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), TermPathPieces_15, ReasonPieces_23);
  Pieces_50 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[173])), Var_294);
  Var_298 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_12, Pieces_50);
  {
    Spec_6 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_6, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_coerce_error_to_spec\'/2"));
    MR_hl_field(0, Spec_6, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_6, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_6, 3) = ((MR_Box) (Context_13));
    MR_hl_field(0, Spec_6, 4) = ((MR_Box) (Var_298));
  }
  return Spec_6;
}

static void MR_CALL 
check_hlds__mode_errors__classify_bound_functor_cons_id_errors_7_p_0(
  MR_Word HeadVar__1_1,
  MR_Word STATE_VARIABLE_InputBadConsIds_0_2,
  MR_Word * STATE_VARIABLE_InputBadConsIds_3,
  MR_Word STATE_VARIABLE_InputBadInstArityConsIds_0_4,
  MR_Word * STATE_VARIABLE_InputBadInstArityConsIds_5,
  MR_Word STATE_VARIABLE_ResultBadConsIds_0_6,
  MR_Word * STATE_VARIABLE_ResultBadConsIds_7)
{
  while (MR_TRUE)
  {
    // setup for model_det tailcalls optimized into a loop
    ;
    if ((HeadVar__1_1 == (MR_Word) ((MR_Unsigned) 0U)))
    {
      *STATE_VARIABLE_ResultBadConsIds_7 = STATE_VARIABLE_ResultBadConsIds_0_6;
      *STATE_VARIABLE_InputBadInstArityConsIds_5 = STATE_VARIABLE_InputBadInstArityConsIds_0_4;
      *STATE_VARIABLE_InputBadConsIds_3 = STATE_VARIABLE_InputBadConsIds_0_2;
    }
    else
    {
      MR_Word Error_17 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 0))));
      MR_Word Errors_18 = ((MR_Word) ((MR_hl_field(1, HeadVar__1_1, 1))));
      MR_Word STATE_VARIABLE_InputBadConsIds_1_31;
      MR_Word STATE_VARIABLE_InputBadInstArityConsIds_1_33;
      MR_Word STATE_VARIABLE_ResultBadConsIds_1_34;
      MR_Word next_value_of_HeadVar__1_1;
      MR_Word next_value_of_STATE_VARIABLE_InputBadConsIds_0_2;
      MR_Word next_value_of_STATE_VARIABLE_InputBadInstArityConsIds_0_4;
      MR_Word next_value_of_STATE_VARIABLE_ResultBadConsIds_0_6;

      switch (MR_tag((MR_Word) Error_17)) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          {
            MR_Word ConsId_22 = ((MR_Word) ((MR_hl_field(0, Error_17, 0))));

            mercury__set__insert_3_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), ((MR_Box) (ConsId_22)), STATE_VARIABLE_InputBadConsIds_0_2, &STATE_VARIABLE_InputBadConsIds_1_31);
            STATE_VARIABLE_InputBadInstArityConsIds_1_33 = STATE_VARIABLE_InputBadInstArityConsIds_0_4;
            STATE_VARIABLE_ResultBadConsIds_1_34 = STATE_VARIABLE_ResultBadConsIds_0_6;
          }
          break;
        case (MR_Integer) 1:
          {
            MR_Integer InstArity_23 = ((MR_Integer) ((MR_hl_field(1, Error_17, 1))));
            MR_Integer ExpectedArity_24 = ((MR_Integer) ((MR_hl_field(1, Error_17, 2))));
            MR_Tuple Var_32;
            MR_Word ConsId_38 = ((MR_Word) ((MR_hl_field(1, Error_17, 0))));

            {
              Var_32 = (MR_Tuple) MR_new_object(MR_Tuple, (3 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, Var_32, 0) = ((MR_Box) (ConsId_38));
              MR_hl_field(0, Var_32, 1) = ((MR_Box) (InstArity_23));
              MR_hl_field(0, Var_32, 2) = ((MR_Box) (ExpectedArity_24));
            }
            mercury__set__insert_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_2[0]), ((MR_Box) (Var_32)), STATE_VARIABLE_InputBadInstArityConsIds_0_4, &STATE_VARIABLE_InputBadInstArityConsIds_1_33);
            STATE_VARIABLE_InputBadConsIds_1_31 = STATE_VARIABLE_InputBadConsIds_0_2;
            STATE_VARIABLE_ResultBadConsIds_1_34 = STATE_VARIABLE_ResultBadConsIds_0_6;
          }
          break;
        case (MR_Integer) 2:
          {
            MR_Word ConsId_39 = ((MR_Word) ((MR_hl_field(2, Error_17, 0))));

            mercury__set__insert_3_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_cons_id_0), ((MR_Box) (ConsId_39)), STATE_VARIABLE_ResultBadConsIds_0_6, &STATE_VARIABLE_ResultBadConsIds_1_34);
            STATE_VARIABLE_InputBadConsIds_1_31 = STATE_VARIABLE_InputBadConsIds_0_2;
            STATE_VARIABLE_InputBadInstArityConsIds_1_33 = STATE_VARIABLE_InputBadInstArityConsIds_0_4;
          }
          break;
      }
      // direct tailcall eliminated
      ;
      next_value_of_HeadVar__1_1 = Errors_18;
      next_value_of_STATE_VARIABLE_InputBadConsIds_0_2 = STATE_VARIABLE_InputBadConsIds_1_31;
      next_value_of_STATE_VARIABLE_InputBadInstArityConsIds_0_4 = STATE_VARIABLE_InputBadInstArityConsIds_1_33;
      next_value_of_STATE_VARIABLE_ResultBadConsIds_0_6 = STATE_VARIABLE_ResultBadConsIds_1_34;
      HeadVar__1_1 = next_value_of_HeadVar__1_1;
      STATE_VARIABLE_InputBadConsIds_0_2 = next_value_of_STATE_VARIABLE_InputBadConsIds_0_2;
      STATE_VARIABLE_InputBadInstArityConsIds_0_4 = next_value_of_STATE_VARIABLE_InputBadInstArityConsIds_0_4;
      STATE_VARIABLE_ResultBadConsIds_0_6 = next_value_of_STATE_VARIABLE_ResultBadConsIds_0_6;
      continue;
    }
    break;
  }
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_merge_disj_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_Msgs_10;

  conv0_Msgs_10 = check_hlds__mode_errors__merge_error_to_msgs_4_f_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) ((MR_hl_field(0, closure, 4)))), ((MR_Word) ((MR_hl_field(0, closure, 5)))), ((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_Msgs_10));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_merge_disj_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word MergeContext_6,
  MR_Word MergeErrors_7)
{
  MR_Word Spec_8;
  MR_Word Preamble_9;
  MR_String MergeContextStr_10;
  MR_Word Context_11;
  MR_Word MainPieces_12;
  MR_Word MergeMsgLists_13;
  MR_Word MergeMsgs_14;
  MR_Word Var_20;
  MR_Word Var_21;
  MR_Word Var_26;
  MR_Word Var_29;
  MR_Word Var_30;
  MR_Word Var_37;
  MR_Word Var_39;
  MR_Word Var_43;
  MR_Word Var_44;
  MR_Word Var_45;

  Preamble_9 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_5);
  switch (MergeContext_6) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      MergeContextStr_10 = (MR_String) "disjunction";
      break;
    case (MR_Integer) 1:
      MergeContextStr_10 = (MR_String) "if-then-else";
      break;
    case (MR_Integer) 2:
      MergeContextStr_10 = (MR_String) "atomic";
      break;
  }
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_5, &Context_11);
  Var_21 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[347])));
  {
    Var_30 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_30, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_30, 1) = ((MR_Box) (MergeContextStr_10));
  }
  {
    Var_29 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_29, 0) = ((MR_Box) (Var_30));
    MR_hl_field(1, Var_29, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
  }
  {
    Var_26 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_26, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[348])));
    MR_hl_field(1, Var_26, 1) = ((MR_Box) (Var_29));
  }
  Var_20 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_21, Var_26);
  MainPieces_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[345])), Var_20);
  {
    Var_37 = (MR_Word) MR_new_object(MR_Word, (6 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_37, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_6[1]));
    MR_hl_field(0, Var_37, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_merge_disj_to_spec_3_f_0_1));
    MR_hl_field(0, Var_37, 2) = ((MR_Box) ((MR_Integer) 3));
    MR_hl_field(0, Var_37, 3) = ((MR_Box) (ModeInfo_5));
    MR_hl_field(0, Var_37, 4) = ((MR_Box) (Context_11));
    MR_hl_field(0, Var_37, 5) = ((MR_Box) ((MR_Integer) 1));
  }
  Var_39 = mercury__one_or_more__one_or_more_to_list_1_f_1((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0), MergeErrors_7);
  MergeMsgLists_13 = mercury__list__map_2_f_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[4]), Var_37, Var_39);
  mercury__list__condense_2_p_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), MergeMsgLists_13, &MergeMsgs_14);
  Var_45 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_9, MainPieces_12);
  {
    Var_44 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_44, 0) = ((MR_Box) (Context_11));
    MR_hl_field(0, Var_44, 1) = ((MR_Box) (Var_45));
  }
  {
    Var_43 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_43, 0) = ((MR_Box) (Var_44));
    MR_hl_field(1, Var_43, 1) = ((MR_Box) (MergeMsgs_14));
  }
  {
    Spec_8 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_merge_disj_to_spec\'/3"));
    MR_hl_field(2, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_8, 3) = ((MR_Box) (Var_43));
  }
  return Spec_8;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_bad_higher_order_inst_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word PredVar_9,
  MR_Word PredVarInst_10,
  MR_Word ExpectedPredOrFunc_11,
  MR_Word ExpectedUserArity_12,
  MR_Word Mismatch_13)
{
  MR_bool succeeded;
  MR_Word Spec_14;
  MR_Word PreamblePieces_15;
  MR_Word Context_16;
  MR_Word VarTable_17;
  MR_String PredVarName_18;
  MR_Word PredVarNamePieces_19;
  MR_String ExpPFStr_20;
  MR_Integer ExpUserArityInt_21;
  MR_Word ExpArityPiece_22;
  MR_Word ExpPieces0_23;
  MR_Word ExpPieces_24;
  MR_Word ActPieces_25;
  MR_Word Pieces_35;
  MR_Word Var_37;
  MR_Word Var_38;
  MR_String Var_40;
  MR_String Var_42;
  MR_Word Var_43;
  MR_Word Var_44;
  MR_Word Var_47;
  MR_Word Var_297;
  MR_Word Var_302;

  PreamblePieces_15 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_8);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_8, &Context_16);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_8, &VarTable_17);
  PredVarName_18 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_17, PredVar_9);
  {
    Var_38 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_38, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_38, 1) = ((MR_Box) (PredVarName_18));
  }
  {
    Var_37 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_37, 0) = ((MR_Box) (Var_38));
    MR_hl_field(1, Var_37, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  PredVarNamePieces_19 = parse_tree__error_spec__color_as_subject_1_f_0(Var_37);
  ExpPFStr_20 = mdbcomp__prim_data__pred_or_func_to_full_str_1_f_0(ExpectedPredOrFunc_11);
  ExpUserArityInt_21 = (MR_Integer) (ExpectedUserArity_12);
  Var_42 = parse_tree__error_spec__int_name_str_1_f_0(ExpUserArityInt_21);
  Var_40 = mercury__string__f_43_43_2_f_0((MR_String) "arity ", Var_42);
  {
    ExpArityPiece_22 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, ExpArityPiece_22, 0) = ((MR_Box) (Var_40));
  }
  {
    Var_43 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_43, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_43, 1) = ((MR_Box) (ExpPFStr_20));
  }
  {
    Var_47 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_47, 0) = ((MR_Box) (ExpArityPiece_22));
    MR_hl_field(1, Var_47, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])));
  }
  {
    Var_44 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_44, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[175])));
    MR_hl_field(1, Var_44, 1) = ((MR_Box) (Var_47));
  }
  {
    ExpPieces0_23 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, ExpPieces0_23, 0) = ((MR_Box) (Var_43));
    MR_hl_field(1, ExpPieces0_23, 1) = ((MR_Box) (Var_44));
  }
  ExpPieces_24 = parse_tree__error_spec__color_as_correct_1_f_0(ExpPieces0_23);
  switch (MR_tag((MR_Word) Mismatch_13)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      switch (MR_unmkbody(Mismatch_13)) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          {
            MR_Word Var_56;
            MR_Word Var_57;
            MR_Word Var_62;
            MR_Word Var_63;

            Var_63 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[310])));
            Var_62 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_63, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
            Var_57 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[163])), Var_62);
            Var_56 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredVarNamePieces_19, Var_57);
            ActPieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[308])), Var_56);
          }
          break;
        case (MR_Integer) 1:
          {
            succeeded = (PredVarInst_10 == (MR_Word) ((MR_Unsigned) 0U));
            if (succeeded)
            {
              MR_Word Var_78;
              MR_Word Var_79;
              MR_Word Var_84;
              MR_Word Var_85;

              Var_85 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[236])));
              Var_84 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_85, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
              Var_79 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[238])), Var_84);
              Var_78 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredVarNamePieces_19, Var_79);
              ActPieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[86])), Var_78);
            }
            else
            {
              MR_Word ModuleInfo_27;
              MR_Word InstVarSet_28;
              MR_Word PredVarInstPieces_29;
              MR_Word Var_106;
              MR_Word Var_107;
              MR_Word Var_108;
              MR_Word Var_111;
              MR_Word Var_114;
              MR_Word Var_117;
              MR_Word Var_120;
              MR_Word Var_123;
              MR_Word Var_125;
              MR_Word Var_128;
              MR_Word Var_140;
              MR_Word Var_141;
              MR_Word Var_142;
              MR_Word Var_147;
              MR_Word Var_148;
              MR_Word Var_151;
              MR_Word Var_157;
              MR_Word Var_158;

              check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_27);
              check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_8, &InstVarSet_28);
              PredVarInstPieces_29 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_27, InstVarSet_28, (MR_Integer) 0, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 0, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])), PredVarInst_10);
              {
                Var_128 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_128, 0) = ((MR_Box) (Var_38));
                MR_hl_field(1, Var_128, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[252])));
              }
              {
                Var_125 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_125, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[246])));
                MR_hl_field(1, Var_125, 1) = ((MR_Box) (Var_128));
              }
              {
                Var_123 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_123, 0) = ((MR_Box) (Var_43));
                MR_hl_field(1, Var_123, 1) = ((MR_Box) (Var_125));
              }
              {
                Var_120 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_120, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[245])));
                MR_hl_field(1, Var_120, 1) = ((MR_Box) (Var_123));
              }
              {
                Var_117 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_117, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[244])));
                MR_hl_field(1, Var_117, 1) = ((MR_Box) (Var_120));
              }
              {
                Var_114 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_114, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[243])));
                MR_hl_field(1, Var_114, 1) = ((MR_Box) (Var_117));
              }
              {
                Var_111 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_111, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[242])));
                MR_hl_field(1, Var_111, 1) = ((MR_Box) (Var_114));
              }
              {
                Var_108 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_108, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[241])));
                MR_hl_field(1, Var_108, 1) = ((MR_Box) (Var_111));
              }
              Var_142 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredVarInstPieces_29, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])));
              Var_141 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_142);
              {
                Var_151 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_151, 0) = ((MR_Box) (Var_38));
                MR_hl_field(1, Var_151, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[255])));
              }
              {
                Var_148 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
                MR_hl_field(1, Var_148, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[253])));
                MR_hl_field(1, Var_148, 1) = ((MR_Box) (Var_151));
              }
              Var_158 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[257])));
              Var_157 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_158, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[306])));
              Var_147 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_148, Var_157);
              Var_140 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_141, Var_147);
              Var_107 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_108, Var_140);
              Var_106 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredVarNamePieces_19, Var_107);
              ActPieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[240])), Var_106);
            }
          }
          break;
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word ActualPredOrFunc_30 = ((MR_Unsigned) ((MR_hl_field(1, Mismatch_13, 0))) & (MR_Integer) 1);
        MR_String ActPFStr_31;
        MR_Word Var_257;
        MR_Word Var_258;
        MR_Word Var_263;
        MR_Word Var_264;
        MR_Word Var_265;
        MR_Word Var_266;

        ActPFStr_31 = mdbcomp__prim_data__pred_or_func_to_full_str_1_f_0(ActualPredOrFunc_30);
        {
          Var_266 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_266, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_266, 1) = ((MR_Box) (ActPFStr_31));
        }
        {
          Var_265 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_265, 0) = ((MR_Box) (Var_266));
          MR_hl_field(1, Var_265, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[314])));
        }
        Var_264 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_265);
        Var_263 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_264, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_258 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[238])), Var_263);
        Var_257 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredVarNamePieces_19, Var_258);
        ActPieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[86])), Var_257);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word ActualUserArity_32 = ((MR_Word) ((MR_hl_field(2, Mismatch_13, 0))));
        MR_Integer ActUserArityInt_33 = (MR_Integer) (ActualUserArity_32);
        MR_Word ActArityPiece_34;
        MR_String Var_274;
        MR_String Var_276;
        MR_Word Var_281;
        MR_Word Var_282;
        MR_Word Var_287;
        MR_Word Var_288;
        MR_Word Var_289;

        Var_276 = parse_tree__error_spec__int_name_str_1_f_0(ActUserArityInt_33);
        Var_274 = mercury__string__f_43_43_2_f_0((MR_String) "arity ", Var_276);
        {
          ActArityPiece_34 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(2, ActArityPiece_34, 0) = ((MR_Box) (Var_274));
        }
        {
          Var_289 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_289, 0) = ((MR_Box) (ActArityPiece_34));
          MR_hl_field(1, Var_289, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])));
        }
        Var_288 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_289);
        Var_287 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_288, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_282 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[312])), Var_287);
        Var_281 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredVarNamePieces_19, Var_282);
        ActPieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[86])), Var_281);
      }
      break;
  }
  Var_302 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ExpPieces_24, ActPieces_25);
  Var_297 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[316])), Var_302);
  Pieces_35 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PreamblePieces_15, Var_297);
  {
    Spec_14 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_14, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_bad_higher_order_inst_to_spec\'/6"));
    MR_hl_field(0, Spec_14, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_14, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_14, 3) = ((MR_Box) (Context_16));
    MR_hl_field(0, Spec_14, 4) = ((MR_Box) (Pieces_35));
  }
  return Spec_14;
}

static void MR_CALL 
check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3,
  MR_Box * wrapper_arg_4)
{
  MR_Box closure = closure_arg;
  MR_Word conv2_STATE_VARIABLE_NeverOkArgNums_11;

  check_hlds__mode_errors__acc_not_ok_in_any_proc_args_4_p_0(((MR_Integer) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)), &conv2_STATE_VARIABLE_NeverOkArgNums_11);
  *wrapper_arg_4 = ((MR_Box) (conv2_STATE_VARIABLE_NeverOkArgNums_11));
}

static void MR_CALL 
check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3,
  MR_Box * wrapper_arg_4)
{
  MR_Box closure = closure_arg;
  MR_Word conv0_STATE_VARIABLE_SomeExtraIsBad_11;

  check_hlds__mode_errors__is_any_extra_arg_bad_5_p_0(((MR_Integer) ((MR_hl_field(0, closure, 3)))), ((MR_Integer) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)), &conv0_STATE_VARIABLE_SomeExtraIsBad_11);
  *wrapper_arg_4 = ((MR_Box) (conv0_STATE_VARIABLE_SomeExtraIsBad_11));
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word MatchWhat_9,
  MR_Word InstMap_10,
  MR_Word Vars_11,
  MR_Word HeadMismatch_12,
  MR_Word TailMismatches_13)
{
  MR_bool succeeded;
  MR_Word Spec_14;
  MR_Word PrefixPieces_15;
  MR_Word ModeContext_16;
  MR_Word ModuleInfo_17;
  MR_Word PredOrFunc_23;
  MR_Integer NumExtra_34;
  MR_Word VarTable_41;
  MR_Word ArgTuples_42;
  MR_Word OkOrNotMap_43;
  MR_Word SomeExtraIsBad_44;
  MR_Word NeverOkArgNums_45;
  MR_Integer ArgNumMinus_46;
  MR_Word ArgNamePieceListsToPrint1_47;
  MR_Word MaybeReturnValueNamePieces_48;
  MR_Word BadArgPieces_49;
  MR_Word ArgNamePieceListsToPrint2_50;
  MR_Word ArgNamePieceListsToPrint_51;
  MR_String InstOrInsts_53;
  MR_String DoesOrDo_54;
  MR_String ArgOrArgs_55;
  MR_Word ArgsNoMatchPieces_56;
  MR_Word MatchWhatPieces_61;
  MR_Word InstVarSet_65;
  MR_Word BoundInstVarPieces0_66;
  MR_Word BoundInstVarPieces_67;
  MR_Word Pieces_70;
  MR_Word Context_72;
  MR_Word Var_73;
  MR_Word Var_82;
  MR_Word Var_84;
  MR_Word Var_85;
  MR_Word Var_97;
  MR_Word Var_100;
  MR_Word Var_101;
  MR_Word Var_102;
  MR_Word Var_105;
  MR_Word Var_106;
  MR_Word Var_108;
  MR_Word Var_109;
  MR_Word Var_111;
  MR_Word Var_112;
  MR_Word Var_113;
  MR_Word Var_197;
  MR_Word Var_198;
  MR_Word Var_199;
  MR_Word Var_204;
  MR_Word Var_205;
  MR_Word ProcMismatch_306;
  MR_Word ProcMismatches_307;
  MR_Word ProcReqInitialInsts_310;
  MR_Word STATE_VARIABLE_OkOrNotMap_1_314;
  MR_Box conv1_SomeExtraIsBad_44;
  MR_Box conv3_NeverOkArgNums_45;
  MR_Box conv4_InstOrInsts_53;
  MR_Box conv5_DoesOrDo_54;
  MR_Box conv6_ArgOrArgs_55;

  Var_73 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_8);
  PrefixPieces_15 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_73, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[173])));
  check_hlds__mode_info__mode_info_get_mode_context_2_p_0(ModeInfo_8, &ModeContext_16);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_17);
  switch (MR_tag((MR_Word) ModeContext_16)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
    case (MR_Integer) 3:
      mercury__require__unexpected_2_p_0((MR_String) "function \140check_hlds.mode_errors.mode_error_no_matching_mode_to_spec\'/6", (MR_String) "invalid context");
      break;
    case (MR_Integer) 1:
      {
        MR_Word ModeCallId_298 = ((MR_Word) ((MR_hl_field(1, ModeContext_16, 0))));

        if (((MR_tag((MR_Word) ModeCallId_298)) == (MR_Integer) 1))
        {
          MR_Word GenericCall0_261 = ((MR_Word) ((MR_hl_field(1, ModeCallId_298, 0))));

          switch (MR_tag((MR_Word) GenericCall0_261)) {
            default: /*NOTREACHED*/ MR_assert(0);
            case (MR_Integer) 0:
              PredOrFunc_23 = ((MR_Unsigned) ((MR_hl_field(0, GenericCall0_261, 1))) & (MR_Integer) 1);
              break;
            case (MR_Integer) 1:
              {
                MR_Word PFSymNameArity_244 = ((MR_Word) ((MR_hl_field(1, GenericCall0_261, 3))));

                PredOrFunc_23 = ((MR_Unsigned) ((MR_hl_field(0, PFSymNameArity_244, 0))) & (MR_Integer) 1);
              }
              break;
            case (MR_Integer) 2:
            case (MR_Integer) 3:
              PredOrFunc_23 = (MR_Integer) 0;
              break;
          }
          NumExtra_34 = (MR_Integer) 0;
        }
        else
        {
          MR_Word PredId0_273 = ((MR_Word) ((MR_hl_field(0, ModeCallId_298, 0))));
          MR_Integer OrigArity_274;
          MR_Integer NumVars_275;
          MR_Word Var_276;
          MR_Word PredInfo_278;
          MR_Word PFSymNameArity_272;

          hlds__hlds_module__module_info_pred_info_3_p_0(ModuleInfo_17, PredId0_273, &PredInfo_278);
          hlds__hlds_pred__pred_info_get_pf_sym_name_arity_2_p_0(PredInfo_278, &PFSymNameArity_272);
          PredOrFunc_23 = hlds__hlds_pred__pred_info_is_pred_or_func_1_f_0(PredInfo_278);
          hlds__hlds_pred__pred_info_get_orig_arity_2_p_0(PredInfo_278, &Var_276);
          OrigArity_274 = (MR_Integer) (Var_276);
          mercury__list__length_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), Vars_11, &NumVars_275);
          NumExtra_34 = (MR_Integer) ((MR_Unsigned) NumVars_275 - (MR_Unsigned) OrigArity_274);
        }
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word ModeCallId_18 = ((MR_Word) ((MR_hl_field(2, ModeContext_16, 0))));

        if (((MR_tag((MR_Word) ModeCallId_18)) == (MR_Integer) 1))
        {
          MR_Word GenericCall0_20 = ((MR_Word) ((MR_hl_field(1, ModeCallId_18, 0))));

          switch (MR_tag((MR_Word) GenericCall0_20)) {
            default: /*NOTREACHED*/ MR_assert(0);
            case (MR_Integer) 0:
              PredOrFunc_23 = ((MR_Unsigned) ((MR_hl_field(0, GenericCall0_20, 1))) & (MR_Integer) 1);
              break;
            case (MR_Integer) 1:
              {
                MR_Word PFSymNameArity_29 = ((MR_Word) ((MR_hl_field(1, GenericCall0_20, 3))));

                PredOrFunc_23 = ((MR_Unsigned) ((MR_hl_field(0, PFSymNameArity_29, 0))) & (MR_Integer) 1);
              }
              break;
            case (MR_Integer) 2:
            case (MR_Integer) 3:
              PredOrFunc_23 = (MR_Integer) 0;
              break;
          }
          NumExtra_34 = (MR_Integer) 0;
        }
        else
        {
          MR_Word PredId0_35 = ((MR_Word) ((MR_hl_field(0, ModeCallId_18, 0))));
          MR_Integer OrigArity_37;
          MR_Integer NumVars_38;
          MR_Word Var_78;
          MR_Word PredInfo_215;
          MR_Word PFSymNameArity_213;

          hlds__hlds_module__module_info_pred_info_3_p_0(ModuleInfo_17, PredId0_35, &PredInfo_215);
          hlds__hlds_pred__pred_info_get_pf_sym_name_arity_2_p_0(PredInfo_215, &PFSymNameArity_213);
          PredOrFunc_23 = hlds__hlds_pred__pred_info_is_pred_or_func_1_f_0(PredInfo_215);
          hlds__hlds_pred__pred_info_get_orig_arity_2_p_0(PredInfo_215, &Var_78);
          OrigArity_37 = (MR_Integer) (Var_78);
          mercury__list__length_2_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), Vars_11, &NumVars_38);
          NumExtra_34 = (MR_Integer) ((MR_Unsigned) NumVars_38 - (MR_Unsigned) OrigArity_37);
        }
      }
      break;
  }
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_8, &VarTable_41);
  check_hlds__mode_errors__construct_argnum_var_type_inst_tuples_5_p_0(VarTable_41, InstMap_10, (MR_Integer) 1, Vars_11, &ArgTuples_42);
  {
    Var_82 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_82, 0) = ((MR_Box) (HeadMismatch_12));
    MR_hl_field(1, Var_82, 1) = ((MR_Box) (TailMismatches_13));
  }
  Var_84 = mercury__map__init_0_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), (MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0));
  ProcMismatch_306 = ((MR_Word) ((MR_hl_field(1, Var_82, 0))));
  ProcMismatches_307 = ((MR_Word) ((MR_hl_field(1, Var_82, 1))));
  ProcReqInitialInsts_310 = ((MR_Word) ((MR_hl_field(0, ProcMismatch_306, 1))));
  check_hlds__mode_errors__find_satisfied_initial_insts_in_proc_6_p_0(ModuleInfo_17, ArgTuples_42, ProcReqInitialInsts_310, (MR_Integer) 1, Var_84, &STATE_VARIABLE_OkOrNotMap_1_314);
  check_hlds__mode_errors__find_satisfied_initial_insts_in_procs_6_p_0(ModuleInfo_17, ArgTuples_42, ProcMismatches_307, (MR_Integer) ((MR_Unsigned) 1 + (MR_Unsigned) 1), STATE_VARIABLE_OkOrNotMap_1_314, &OkOrNotMap_43);
  {
    Var_85 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_85, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_6[0]));
    MR_hl_field(0, Var_85, 1) = ((MR_Box) (check_hlds__mode_errors__mode_error_no_matching_mode_to_spec_6_f_0_1));
    MR_hl_field(0, Var_85, 2) = ((MR_Box) ((MR_Integer) 1));
    MR_hl_field(0, Var_85, 3) = ((MR_Box) (NumExtra_34));
  }
  mercury__map__foldl_4_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), (MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), (MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_some_extra_arg_is_bad_0), Var_85, OkOrNotMap_43, ((MR_Box) ((MR_Integer) 0)), &conv1_SomeExtraIsBad_44);
  SomeExtraIsBad_44 = ((MR_Word) (conv1_SomeExtraIsBad_44));
  mercury__map__foldl_4_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), (MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_1[1]), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[6]), OkOrNotMap_43, ((MR_Box) ((MR_Unsigned) 0U)), &conv3_NeverOkArgNums_45);
  NeverOkArgNums_45 = ((MR_Word) (conv3_NeverOkArgNums_45));
  switch (SomeExtraIsBad_44) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      ArgNumMinus_46 = NumExtra_34;
      break;
    case (MR_Integer) 1:
      ArgNumMinus_46 = (MR_Integer) 0;
      break;
  }
  check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0(ModeInfo_8, OkOrNotMap_43, NeverOkArgNums_45, PredOrFunc_23, NumExtra_34, ArgNumMinus_46, ArgTuples_42, &ArgNamePieceListsToPrint1_47, &MaybeReturnValueNamePieces_48, &BadArgPieces_49);
  mercury__list__det_drop_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), ArgNumMinus_46, ArgNamePieceListsToPrint1_47, &ArgNamePieceListsToPrint2_50);
  if ((MaybeReturnValueNamePieces_48 == (MR_Word) ((MR_Unsigned) 0U)))
    ArgNamePieceListsToPrint_51 = ArgNamePieceListsToPrint2_50;
  else
  {
    MR_Word ReturnValueNamePieces_52 = ((MR_Word) ((MR_hl_field(1, MaybeReturnValueNamePieces_48, 0))));
    MR_Word Var_89;

    {
      Var_89 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, Var_89, 0) = ((MR_Box) (ReturnValueNamePieces_52));
      MR_hl_field(1, Var_89, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    ArgNamePieceListsToPrint_51 = mercury__list__f_43_43_2_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), ArgNamePieceListsToPrint2_50, Var_89);
  }
  conv4_InstOrInsts_53 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgNamePieceListsToPrint_51, ((MR_Box) ((MR_String) "inst")), ((MR_Box) ((MR_String) "insts")));
  InstOrInsts_53 = ((MR_String) (conv4_InstOrInsts_53));
  conv5_DoesOrDo_54 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgNamePieceListsToPrint_51, ((MR_Box) ((MR_String) "does")), ((MR_Box) ((MR_String) "do")));
  DoesOrDo_54 = ((MR_String) (conv5_DoesOrDo_54));
  conv6_ArgOrArgs_55 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[2]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgNamePieceListsToPrint2_50, ((MR_Box) ((MR_String) "argument")), ((MR_Box) ((MR_String) "arguments")));
  ArgOrArgs_55 = ((MR_String) (conv6_ArgOrArgs_55));
  {
    Var_101 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_101, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_101, 1) = ((MR_Box) (InstOrInsts_53));
  }
  {
    Var_106 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_106, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_106, 1) = ((MR_Box) (ArgOrArgs_55));
  }
  {
    Var_105 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_105, 0) = ((MR_Box) (Var_106));
    MR_hl_field(1, Var_105, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Var_102 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_102, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[175])));
    MR_hl_field(1, Var_102, 1) = ((MR_Box) (Var_105));
  }
  {
    Var_100 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_100, 0) = ((MR_Box) (Var_101));
    MR_hl_field(1, Var_100, 1) = ((MR_Box) (Var_102));
  }
  {
    Var_97 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_97, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[174])));
    MR_hl_field(1, Var_97, 1) = ((MR_Box) (Var_100));
  }
  Var_109 = parse_tree__error_spec__pieces_list_to_pieces_2_f_0((MR_String) "and", ArgNamePieceListsToPrint_51);
  {
    Var_113 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_113, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_113, 1) = ((MR_Box) (DoesOrDo_54));
  }
  {
    Var_112 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_112, 0) = ((MR_Box) (Var_113));
    MR_hl_field(1, Var_112, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[177])));
  }
  Var_111 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_112);
  Var_108 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_109, Var_111);
  ArgsNoMatchPieces_56 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_97, Var_108);
  switch (MR_tag((MR_Word) MatchWhat_9)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      switch (MR_unmkbody(MatchWhat_9)) {
        default: /*NOTREACHED*/ MR_assert(0);
        case (MR_Integer) 0:
          MatchWhatPieces_61 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[188]));
          break;
        case (MR_Integer) 1:
          MatchWhatPieces_61 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[179]));
          break;
        case (MR_Integer) 2:
          MatchWhatPieces_61 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[181]));
          break;
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word PredId_57 = ((MR_Word) ((MR_hl_field(1, MatchWhat_9, 0))));
        MR_String CallIdStr_58;
        MR_Word ProcTable_59;
        MR_Integer NumProcs_60;
        MR_Word PFSymNameArity_216;
        MR_Word PredInfo_217;

        hlds__hlds_module__module_info_pred_info_3_p_0(ModuleInfo_17, PredId_57, &PredInfo_217);
        hlds__hlds_pred__pred_info_get_pf_sym_name_arity_2_p_0(PredInfo_217, &PFSymNameArity_216);
        CallIdStr_58 = parse_tree__parse_tree_out_sym_name__pf_sym_name_pred_form_arity_to_string_1_f_0(PFSymNameArity_216);
        hlds__hlds_pred__pred_info_get_proc_table_2_p_0(PredInfo_217, &ProcTable_59);
        mercury__map__count_2_p_0((MR_Word) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_proc_id_0), (MR_Word) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_proc_info_0), ProcTable_59, &NumProcs_60);
        succeeded = (NumProcs_60 == (MR_Integer) 1);
        if (succeeded)
        {
          MR_Word Var_120;
          MR_Word Var_121;

          {
            Var_121 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(3, Var_121, 0) = ((MR_Box) ((MR_Unsigned) 9U));
            MR_hl_field(3, Var_121, 1) = ((MR_Box) (CallIdStr_58));
          }
          {
            Var_120 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, Var_120, 0) = ((MR_Box) (Var_121));
            MR_hl_field(1, Var_120, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
          }
          {
            MatchWhatPieces_61 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
            MR_hl_field(1, MatchWhatPieces_61, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[184])));
            MR_hl_field(1, MatchWhatPieces_61, 1) = ((MR_Box) (Var_120));
          }
        }
        else
        {
          succeeded = (NumProcs_60 == (MR_Integer) 2);
          if (succeeded)
          {
            MR_Word Var_130;
            MR_Word Var_131;

            {
              Var_131 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(3, Var_131, 0) = ((MR_Box) ((MR_Unsigned) 9U));
              MR_hl_field(3, Var_131, 1) = ((MR_Box) (CallIdStr_58));
            }
            {
              Var_130 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_130, 0) = ((MR_Box) (Var_131));
              MR_hl_field(1, Var_130, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
            }
            {
              MatchWhatPieces_61 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, MatchWhatPieces_61, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[185])));
              MR_hl_field(1, MatchWhatPieces_61, 1) = ((MR_Box) (Var_130));
            }
          }
          else
          {
            MR_Word Var_140;
            MR_Word Var_141;
            MR_Word Var_142;
            MR_Word Var_145;
            MR_Word Var_148;
            MR_Word Var_149;

            {
              Var_141 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(3, Var_141, 0) = ((MR_Box) ((MR_Unsigned) 2U));
              MR_hl_field(3, Var_141, 1) = ((MR_Box) (NumProcs_60));
            }
            {
              Var_149 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(3, Var_149, 0) = ((MR_Box) ((MR_Unsigned) 9U));
              MR_hl_field(3, Var_149, 1) = ((MR_Box) (CallIdStr_58));
            }
            {
              Var_148 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_148, 0) = ((MR_Box) (Var_149));
              MR_hl_field(1, Var_148, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
            }
            {
              Var_145 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_145, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[170])));
              MR_hl_field(1, Var_145, 1) = ((MR_Box) (Var_148));
            }
            {
              Var_142 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_142, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[78])));
              MR_hl_field(1, Var_142, 1) = ((MR_Box) (Var_145));
            }
            {
              Var_140 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, Var_140, 0) = ((MR_Box) (Var_141));
              MR_hl_field(1, Var_140, 1) = ((MR_Box) (Var_142));
            }
            {
              MatchWhatPieces_61 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
              MR_hl_field(1, MatchWhatPieces_61, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[186])));
              MR_hl_field(1, MatchWhatPieces_61, 1) = ((MR_Box) (Var_140));
            }
          }
        }
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word GenericCall_62 = ((MR_Word) ((MR_hl_field(2, MatchWhat_9, 0))));
        MR_Word VarNameSrc_63;
        MR_Word CalleePieces_64;
        MR_Word Var_161;

        {
          VarNameSrc_63 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, VarNameSrc_63, 0) = ((MR_Box) (VarTable_41));
        }
        CalleePieces_64 = hlds__hlds_error_util__generic_callee_to_pieces_3_f_0((MR_Integer) 1, VarNameSrc_63, GenericCall_62);
        Var_161 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), CalleePieces_64, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
        MatchWhatPieces_61 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[183])), Var_161);
      }
      break;
  }
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_8, &InstVarSet_65);
  check_hlds__mode_errors__report_bound_inst_vars_4_p_0(InstVarSet_65, Var_82, (MR_Integer) 1, &BoundInstVarPieces0_66);
  if ((BoundInstVarPieces0_66 == (MR_Word) ((MR_Unsigned) 0U)))
    BoundInstVarPieces_67 = (MR_Word) ((MR_Unsigned) 0U);
  else
    BoundInstVarPieces_67 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), BoundInstVarPieces0_66, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[194])));
  Var_205 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])), BoundInstVarPieces_67);
  Var_204 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), BadArgPieces_49, Var_205);
  Var_199 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_204);
  Var_198 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), MatchWhatPieces_61, Var_199);
  Var_197 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgsNoMatchPieces_56, Var_198);
  Pieces_70 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PrefixPieces_15, Var_197);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_8, &Context_72);
  {
    Spec_14 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_14, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_no_matching_mode_to_spec\'/6"));
    MR_hl_field(0, Spec_14, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_14, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_14, 3) = ((MR_Box) (Context_72));
    MR_hl_field(0, Spec_14, 4) = ((MR_Box) (Pieces_70));
  }
  return Spec_14;
}

static void MR_CALL 
check_hlds__mode_errors__report_bound_inst_vars_4_p_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box * wrapper_arg_2)
{
  MR_Box closure = closure_arg;
  MR_String conv0_HeadVar__3_60;

  check_hlds__mode_errors__IntroducedFrom__pred__report_bound_inst_vars__1476__1_3_p_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) (wrapper_arg_1)), &conv0_HeadVar__3_60);
  *wrapper_arg_2 = ((MR_Box) (conv0_HeadVar__3_60));
}

static void MR_CALL 
check_hlds__mode_errors__report_bound_inst_vars_4_p_0(
  MR_Word InstVarSet_1,
  MR_Word HeadVar__2_2,
  MR_Integer ProcNum_3,
  MR_Word * HeadVar__4_4)
{
  MR_bool succeeded;

  if ((HeadVar__2_2 == (MR_Word) ((MR_Unsigned) 0U)))
    *HeadVar__4_4 = (MR_Word) ((MR_Unsigned) 0U);
  else
  {
    MR_Word Mismatch_8 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));
    MR_Word Mismatches_9 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
    MR_Word TailPieces_12;
    MR_Word BoundInstVars_15;
    MR_Integer Var_22 = (MR_Integer) ((MR_Unsigned) ProcNum_3 + (MR_Unsigned) 1);

    check_hlds__mode_errors__report_bound_inst_vars_4_p_0(InstVarSet_1, Mismatches_9, Var_22, &TailPieces_12);
    BoundInstVars_15 = ((MR_Word) ((MR_hl_field(0, Mismatch_8, 2))));
    succeeded = mercury__set__is_empty_1_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[3]), BoundInstVars_15);
    if (succeeded)
      *HeadVar__4_4 = TailPieces_12;
    else
    {
      MR_Word TheProcPieces_16;
      MR_Word BoundInstVarNames_17;
      MR_Word SortedBoundInstVarNames_18;
      MR_String VarOrVars_19;
      MR_Word InstVarNamePieces_20;
      MR_Word HeadPieces_21;
      MR_Word Var_35;
      MR_Word Var_44;
      MR_Word Var_45;
      MR_Word Var_48;
      MR_Word Var_51;
      MR_Word Var_52;
      MR_Word Var_54;
      MR_Box conv1_VarOrVars_19;

      succeeded = (ProcNum_3 == (MR_Integer) 1);
      if (succeeded)
        succeeded = (Mismatches_9 == (MR_Word) ((MR_Unsigned) 0U));
      if (succeeded)
        TheProcPieces_16 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[231]));
      else
      {
        MR_Word Var_29;
        MR_Word Var_30;

        {
          Var_30 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_30, 0) = ((MR_Box) ((MR_Unsigned) 5U));
          MR_hl_field(3, Var_30, 1) = ((MR_Box) (ProcNum_3));
        }
        {
          Var_29 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_29, 0) = ((MR_Box) (Var_30));
          MR_hl_field(1, Var_29, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[233])));
        }
        {
          TheProcPieces_16 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, TheProcPieces_16, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[75])));
          MR_hl_field(1, TheProcPieces_16, 1) = ((MR_Box) (Var_29));
        }
      }
      {
        Var_35 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
        MR_hl_field(0, Var_35, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_5[1]));
        MR_hl_field(0, Var_35, 1) = ((MR_Box) (check_hlds__mode_errors__report_bound_inst_vars_4_p_0_1));
        MR_hl_field(0, Var_35, 2) = ((MR_Box) ((MR_Integer) 1));
        MR_hl_field(0, Var_35, 3) = ((MR_Box) (InstVarSet_1));
      }
      mercury__set__map_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[3]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), Var_35, BoundInstVars_15, &BoundInstVarNames_17);
      mercury__set__to_sorted_list_2_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), BoundInstVarNames_17, &SortedBoundInstVarNames_18);
      conv1_VarOrVars_19 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), SortedBoundInstVarNames_18, ((MR_Box) ((MR_String) "variable")), ((MR_Box) ((MR_String) "variables")));
      VarOrVars_19 = ((MR_String) (conv1_VarOrVars_19));
      InstVarNamePieces_20 = parse_tree__error_spec__quote_list_to_color_pieces_4_f_0((MR_Integer) 0, (MR_String) "and", (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])), SortedBoundInstVarNames_18);
      {
        Var_52 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(3, Var_52, 0) = ((MR_Box) ((MR_Unsigned) 9U));
        MR_hl_field(3, Var_52, 1) = ((MR_Box) (VarOrVars_19));
      }
      {
        Var_51 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_51, 0) = ((MR_Box) (Var_52));
        MR_hl_field(1, Var_51, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      }
      {
        Var_48 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_48, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[234])));
        MR_hl_field(1, Var_48, 1) = ((MR_Box) (Var_51));
      }
      {
        Var_45 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_45, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[227])));
        MR_hl_field(1, Var_45, 1) = ((MR_Box) (Var_48));
      }
      Var_54 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), InstVarNamePieces_20, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
      Var_44 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_45, Var_54);
      HeadPieces_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), TheProcPieces_16, Var_44);
      *HeadVar__4_4 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), HeadPieces_21, TailPieces_12);
    }
  }
}

static MR_Box MR_CALL 
check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_String conv1_HeadVar__2_2;

  conv1_HeadVar__2_2 = parse_tree__error_spec__nth_fixed_str_1_f_0(((MR_Integer) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv1_HeadVar__2_2));
  return wrapper_arg_2;
}

static void MR_CALL 
check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0(
  MR_Word ModeInfo_1,
  MR_Word OkOrNotMap_2,
  MR_Word NeverOkArgNums_3,
  MR_Word PredOrFunc_4,
  MR_Integer NumExtra_5,
  MR_Integer ArgNumMinus_6,
  MR_Word HeadVar__7_7,
  MR_Word * HeadVar__8_8,
  MR_Word * HeadVar__9_9,
  MR_Word * HeadVar__10_10)
{
  MR_bool succeeded;

  if ((HeadVar__7_7 == (MR_Word) ((MR_Unsigned) 0U)))
  {
    *HeadVar__8_8 = (MR_Word) ((MR_Unsigned) 0U);
    *HeadVar__9_9 = (MR_Word) ((MR_Unsigned) 0U);
    *HeadVar__10_10 = (MR_Word) ((MR_Unsigned) 0U);
  }
  else
  {
    MR_Word ArgTuple_23 = ((MR_Word) ((MR_hl_field(1, HeadVar__7_7, 0))));
    MR_Word ArgTuples_24 = ((MR_Word) ((MR_hl_field(1, HeadVar__7_7, 1))));
    MR_Integer ArgNum_28 = ((MR_Integer) ((MR_hl_field(0, ArgTuple_23, 0))));
    MR_Word Var_29 = ((MR_Word) ((MR_hl_field(0, ArgTuple_23, 1))));
    MR_Word VarInst_31 = ((MR_Word) ((MR_hl_field(0, ArgTuple_23, 3))));
    MR_Word VarTable_32;
    MR_Word VarNamePiece_33;
    MR_Word TailBadArgPieces_35;
    MR_Word ArgNumCommaPieces_36;
    MR_Word ArgOkOrNot_39;
    MR_Word OkProcNumSet_40;
    MR_Word NotOkProcNumSet_41;
    MR_Word NotOkProcNums_42;
    MR_Box conv0_ArgOkOrNot_39;

    check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_1, &VarTable_32);
    VarNamePiece_33 = parse_tree__error_spec__var_in_table_to_quote_piece_2_f_0(VarTable_32, Var_29);
    succeeded = (PredOrFunc_4 == (MR_Integer) 1);
    if (succeeded)
      succeeded = (ArgTuples_24 == (MR_Word) ((MR_Unsigned) 0U));
    if (succeeded)
    {
      MR_Word ReturnValueNamePieces_34;
      MR_Word Var_58;
      MR_Word Var_59;
      MR_Word Var_62;

      {
        Var_62 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_62, 0) = ((MR_Box) (VarNamePiece_33));
        MR_hl_field(1, Var_62, 1) = ((MR_Box) (ArgTuples_24));
      }
      {
        Var_59 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_59, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[200])));
        MR_hl_field(1, Var_59, 1) = ((MR_Box) (Var_62));
      }
      Var_58 = parse_tree__error_spec__color_as_subject_1_f_0(Var_59);
      ReturnValueNamePieces_34 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[199])), Var_58);
      {
        MR_Word base;
        base = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
        *HeadVar__9_9 = base;
        MR_hl_field(1, base, 0) = ((MR_Box) (ReturnValueNamePieces_34));
      }
      *HeadVar__8_8 = (MR_Word) ((MR_Unsigned) 0U);
      TailBadArgPieces_35 = (MR_Word) ((MR_Unsigned) 0U);
      ArgNumCommaPieces_36 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[201]));
    }
    else
    {
      MR_Word TailVarNamePiecesList_37;
      MR_Word HeadVarNamePieces_38;
      MR_Word Var_67;
      MR_Word Var_69;
      MR_Integer Var_70;

      check_hlds__mode_errors__report_all_possibly_mismatched_args_10_p_0(ModeInfo_1, OkOrNotMap_2, NeverOkArgNums_3, PredOrFunc_4, NumExtra_5, ArgNumMinus_6, ArgTuples_24, &TailVarNamePiecesList_37, HeadVar__9_9, &TailBadArgPieces_35);
      {
        Var_67 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Var_67, 0) = ((MR_Box) (VarNamePiece_33));
        MR_hl_field(1, Var_67, 1) = ((MR_Box) ((MR_Unsigned) 0U));
      }
      HeadVarNamePieces_38 = parse_tree__error_spec__color_as_subject_1_f_0(Var_67);
      {
        MR_Word base;
        base = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        *HeadVar__8_8 = base;
        MR_hl_field(1, base, 0) = ((MR_Box) (HeadVarNamePieces_38));
        MR_hl_field(1, base, 1) = ((MR_Box) (TailVarNamePiecesList_37));
      }
      Var_70 = (MR_Integer) ((MR_Unsigned) ArgNum_28 - (MR_Unsigned) NumExtra_5);
      {
        Var_69 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(3, Var_69, 0) = ((MR_Box) ((MR_Unsigned) 5U));
        MR_hl_field(3, Var_69, 1) = ((MR_Box) (Var_70));
      }
      {
        ArgNumCommaPieces_36 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, ArgNumCommaPieces_36, 0) = ((MR_Box) (Var_69));
        MR_hl_field(1, ArgNumCommaPieces_36, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[203])));
      }
    }
    mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_108_111_111_107_117_112_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_3_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), OkOrNotMap_2, ArgNum_28, &conv0_ArgOkOrNot_39);
    ArgOkOrNot_39 = ((MR_Word) (conv0_ArgOkOrNot_39));
    OkProcNumSet_40 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot_39, 0))));
    NotOkProcNumSet_41 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot_39, 1))));
    mercury__set__to_sorted_list_2_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), NotOkProcNumSet_41, &NotOkProcNums_42);
    succeeded = (NotOkProcNums_42 == (MR_Word) ((MR_Unsigned) 0U));
    if (!(succeeded))
    {
      succeeded = (ArgNum_28 <= ArgNumMinus_6);
      if (!(succeeded))
      {
        succeeded = mercury__set__is_non_empty_1_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), OkProcNumSet_40);
        if (succeeded)
          succeeded = (NeverOkArgNums_3 != (MR_Word) ((MR_Unsigned) 0U));
      }
    }
    if (succeeded)
      *HeadVar__10_10 = TailBadArgPieces_35;
    else
    {
      MR_Word ArgNumNamePieces_45;
      MR_Word WhichIsPieces_46;
      MR_Word DoesNotMatchWhatPieces_48;
      MR_Word ModuleInfo_50;
      MR_Word HOPieces_51;
      MR_Word DoesNotMatchPieces_52;
      MR_Word HeadBadArgPieces_53;
      MR_Word Var_109;
      MR_Word Var_110;
      MR_Word Var_168;
      MR_Word Var_175;
      MR_Word Var_176;
      MR_Word Var_177;

      succeeded = (ArgNum_28 <= NumExtra_5);
      if (succeeded)
      {
        MR_Word Var_75;
        MR_Word Var_78;
        MR_Word Var_79;
        MR_Word Var_84;
        MR_Word Var_85;
        MR_Word Var_86;

        {
          Var_79 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_79, 0) = ((MR_Box) ((MR_Unsigned) 5U));
          MR_hl_field(3, Var_79, 1) = ((MR_Box) (ArgNum_28));
        }
        {
          Var_78 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_78, 0) = ((MR_Box) (Var_79));
          MR_hl_field(1, Var_78, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[203])));
        }
        {
          Var_75 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_75, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[204])));
          MR_hl_field(1, Var_75, 1) = ((MR_Box) (Var_78));
        }
        {
          Var_86 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_86, 0) = ((MR_Box) (VarNamePiece_33));
          MR_hl_field(1, Var_86, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_85 = parse_tree__error_spec__color_as_subject_1_f_0(Var_86);
        Var_84 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_85, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])));
        ArgNumNamePieces_45 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_75, Var_84);
      }
      else
      {
        MR_Word Var_96;
        MR_Word Var_97;
        MR_Word Var_98;
        MR_Word Var_99;

        {
          Var_99 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_99, 0) = ((MR_Box) (VarNamePiece_33));
          MR_hl_field(1, Var_99, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_98 = parse_tree__error_spec__color_as_subject_1_f_0(Var_99);
        Var_97 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_98, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])));
        Var_96 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgNumCommaPieces_36, Var_97);
        ArgNumNamePieces_45 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[207])), Var_96);
      }
      Var_110 = check_hlds__mode_errors__report_inst_6_f_0(ModeInfo_1, (MR_Integer) 0, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[205])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[210])), VarInst_31);
      Var_109 = parse_tree__error_spec__color_as_incorrect_1_f_0(Var_110);
      WhichIsPieces_46 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[209])), Var_109);
      succeeded = mercury__set__is_non_empty_1_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), OkProcNumSet_40);
      if (succeeded)
      {
        MR_Word NthNotOkProcNums_47;
        MR_Word Var_135;
        MR_Word Var_136;
        MR_Word Var_138;
        MR_Word Var_139;
        MR_String Var_140;
        MR_Box conv2_Var_140;

        NthNotOkProcNums_47 = mercury__list__map_2_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[5]), NotOkProcNums_42);
        Var_136 = parse_tree__error_spec__fixed_list_to_pieces_2_f_0((MR_String) "and", NthNotOkProcNums_47);
        conv2_Var_140 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), NthNotOkProcNums_47, ((MR_Box) ((MR_String) "mode.")), ((MR_Box) ((MR_String) "modes.")));
        Var_140 = ((MR_String) (conv2_Var_140));
        {
          Var_139 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_139, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_139, 1) = ((MR_Box) (Var_140));
        }
        {
          Var_138 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_138, 0) = ((MR_Box) (Var_139));
          MR_hl_field(1, Var_138, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        Var_135 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_136, Var_138);
        DoesNotMatchWhatPieces_48 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[214])), Var_135);
      }
      else
      {
        MR_Integer NumNotOkProcNums_49;

        mercury__list__length_2_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), NotOkProcNums_42, &NumNotOkProcNums_49);
        succeeded = (NumNotOkProcNums_49 == (MR_Integer) 1);
        if (succeeded)
          DoesNotMatchWhatPieces_48 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[216]));
        else
          DoesNotMatchWhatPieces_48 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[218]));
      }
      check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_1, &ModuleInfo_50);
      succeeded = hlds__inst_test__inst_contains_higher_order_2_p_0(ModuleInfo_50, VarInst_31);
      if (succeeded)
        HOPieces_51 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[226]));
      else
        HOPieces_51 = (MR_Word) ((MR_Unsigned) 0U);
      Var_168 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), DoesNotMatchWhatPieces_48, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
      DoesNotMatchPieces_52 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[228])), Var_168);
      Var_177 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), DoesNotMatchPieces_52, HOPieces_51);
      Var_176 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), WhichIsPieces_46, Var_177);
      Var_175 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgNumNamePieces_45, Var_176);
      HeadBadArgPieces_53 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[229])), Var_175);
      *HeadVar__10_10 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), HeadBadArgPieces_53, TailBadArgPieces_35);
    }
  }
}

static MR_Word MR_CALL 
check_hlds__mode_errors__report_inst_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word ShortInstQF_9,
  MR_Word ShortInstSuffix_10,
  MR_Word LongInstPrefix_11,
  MR_Word LongInstSuffix_12,
  MR_Word Inst0_13)
{
  MR_Word Pieces_14;
  MR_Word ModuleInfo_15;
  MR_Word InstVarSet_16;

  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_15);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_8, &InstVarSet_16);
  Pieces_14 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_15, InstVarSet_16, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), ShortInstQF_9, (MR_Word) ((MR_Unsigned) 0U), ShortInstSuffix_10, LongInstPrefix_11, LongInstSuffix_12, Inst0_13);
  return Pieces_14;
}

static void MR_CALL 
check_hlds__mode_errors__find_satisfied_initial_insts_in_procs_6_p_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3,
  MR_Integer HeadVar__4_4,
  MR_Word STATE_VARIABLE_OkOrNotMap_0_5,
  MR_Word * STATE_VARIABLE_OkOrNotMap_6)
{
  while (MR_TRUE)
  {
    // setup for model_det tailcalls optimized into a loop
    ;
    if ((HeadVar__3_3 == (MR_Word) ((MR_Unsigned) 0U)))
      *STATE_VARIABLE_OkOrNotMap_6 = STATE_VARIABLE_OkOrNotMap_0_5;
    else
    {
      MR_Word ProcMismatch_15 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
      MR_Word ProcMismatches_16 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
      MR_Word ProcReqInitialInsts_20 = ((MR_Word) ((MR_hl_field(0, ProcMismatch_15, 1))));
      MR_Word STATE_VARIABLE_OkOrNotMap_1_24;
      MR_Integer Var_25;
      MR_Word next_value_of_HeadVar__3_3;
      MR_Integer next_value_of_HeadVar__4_4;
      MR_Word next_value_of_STATE_VARIABLE_OkOrNotMap_0_5;

      check_hlds__mode_errors__find_satisfied_initial_insts_in_proc_6_p_0(HeadVar__1_1, HeadVar__2_2, ProcReqInitialInsts_20, HeadVar__4_4, STATE_VARIABLE_OkOrNotMap_0_5, &STATE_VARIABLE_OkOrNotMap_1_24);
      Var_25 = (MR_Integer) ((MR_Unsigned) HeadVar__4_4 + (MR_Unsigned) 1);
      // direct tailcall eliminated
      ;
      next_value_of_HeadVar__3_3 = ProcMismatches_16;
      next_value_of_HeadVar__4_4 = Var_25;
      next_value_of_STATE_VARIABLE_OkOrNotMap_0_5 = STATE_VARIABLE_OkOrNotMap_1_24;
      HeadVar__3_3 = next_value_of_HeadVar__3_3;
      HeadVar__4_4 = next_value_of_HeadVar__4_4;
      STATE_VARIABLE_OkOrNotMap_0_5 = next_value_of_STATE_VARIABLE_OkOrNotMap_0_5;
      continue;
    }
    break;
  }
}

static void MR_CALL 
check_hlds__mode_errors__find_satisfied_initial_insts_in_proc_6_p_0(
  MR_Word HeadVar__1_1,
  MR_Word HeadVar__2_2,
  MR_Word HeadVar__3_3,
  MR_Integer HeadVar__4_4,
  MR_Word STATE_VARIABLE_OkOrNotMap_0_5,
  MR_Word * STATE_VARIABLE_OkOrNotMap_6)
{
  while (MR_TRUE)
  {
    MR_bool succeeded;

    // setup for model_det tailcalls optimized into a loop
    ;
    if ((HeadVar__2_2 == (MR_Word) ((MR_Unsigned) 0U)))
      if ((HeadVar__3_3 == (MR_Word) ((MR_Unsigned) 0U)))
        *STATE_VARIABLE_OkOrNotMap_6 = STATE_VARIABLE_OkOrNotMap_0_5;
      else
        {
          mercury__require__unexpected_2_p_0((MR_String) "predicate \140check_hlds.mode_errors.find_satisfied_initial_insts_in_proc\'/6", (MR_String) "length mismatch");
          return;
        }
    else
    {
      MR_Word Var_49 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 1))));
      MR_Word Var_50 = ((MR_Word) ((MR_hl_field(1, HeadVar__2_2, 0))));

      if ((HeadVar__3_3 == (MR_Word) ((MR_Unsigned) 0U)))
        {
          mercury__require__unexpected_2_p_0((MR_String) "predicate \140check_hlds.mode_errors.find_satisfied_initial_insts_in_proc\'/6", (MR_String) "length mismatch");
          return;
        }
      else
      {
        MR_Word ProcInitialInst_33 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 0))));
        MR_Word ProcInitialInsts_34 = ((MR_Word) ((MR_hl_field(1, HeadVar__3_3, 1))));
        MR_Integer ArgNum_37 = ((MR_Integer) ((MR_hl_field(0, Var_50, 0))));
        MR_Word VarType_39 = ((MR_Word) ((MR_hl_field(0, Var_50, 2))));
        MR_Word VarInst_40 = ((MR_Word) ((MR_hl_field(0, Var_50, 3))));
        MR_Word STATE_VARIABLE_OkOrNotMap_1_46;
        MR_Word Var_45;
        MR_Word _UpdatedModuleInfo_41;
        MR_Word _Subst_42;
        MR_Word next_value_of_HeadVar__2_2;
        MR_Word next_value_of_HeadVar__3_3;
        MR_Word next_value_of_STATE_VARIABLE_OkOrNotMap_0_5;

        Var_45 = mercury__map__init_0_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[3]), (MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_inst_0));
        succeeded = hlds__inst_match__inst_matches_initial_sub_7_p_0(VarType_39, VarInst_40, ProcInitialInst_33, HeadVar__1_1, &_UpdatedModuleInfo_41, Var_45, &_Subst_42);
        if (succeeded)
        {
          MR_Word ArgOkOrNot0_51;
          MR_Box conv0_ArgOkOrNot0_51;

          succeeded = mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_115_101_97_114_99_104_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_3_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), STATE_VARIABLE_OkOrNotMap_0_5, ArgNum_37, &conv0_ArgOkOrNot0_51);
          if (succeeded)
          {
            ArgOkOrNot0_51 = ((MR_Word) (conv0_ArgOkOrNot0_51));
            succeeded = MR_TRUE;
          }
          if (succeeded)
          {
            MR_Word OkProcs0_52 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot0_51, 0))));
            MR_Word NotOkProcs0_53 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot0_51, 1))));
            MR_Word OkProcs_54;
            MR_Word ArgOkOrNot_55;

            mercury__set__insert_3_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), ((MR_Box) (HeadVar__4_4)), OkProcs0_52, &OkProcs_54);
            {
              ArgOkOrNot_55 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, ArgOkOrNot_55, 0) = ((MR_Box) (OkProcs_54));
              MR_hl_field(0, ArgOkOrNot_55, 1) = ((MR_Box) (NotOkProcs0_53));
            }
            mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_100_101_116_95_117_112_100_97_116_101_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_4_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), ArgNum_37, ((MR_Box) (ArgOkOrNot_55)), STATE_VARIABLE_OkOrNotMap_0_5, &STATE_VARIABLE_OkOrNotMap_1_46);
          }
          else
          {
            MR_Word Var_56;
            MR_Word Var_57;
            MR_Word ArgOkOrNot_58;

            Var_56 = mercury__set__make_singleton_set_1_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), ((MR_Box) (HeadVar__4_4)));
            Var_57 = mercury__set__init_0_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0));
            {
              ArgOkOrNot_58 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, ArgOkOrNot_58, 0) = ((MR_Box) (Var_56));
              MR_hl_field(0, ArgOkOrNot_58, 1) = ((MR_Box) (Var_57));
            }
            mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_100_101_116_95_105_110_115_101_114_116_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_4_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), ArgNum_37, ((MR_Box) (ArgOkOrNot_58)), STATE_VARIABLE_OkOrNotMap_0_5, &STATE_VARIABLE_OkOrNotMap_1_46);
          }
        }
        else
        {
          MR_Word ArgOkOrNot0_65;
          MR_Box conv1_ArgOkOrNot0_65;

          succeeded = mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_115_101_97_114_99_104_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_3_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), STATE_VARIABLE_OkOrNotMap_0_5, ArgNum_37, &conv1_ArgOkOrNot0_65);
          if (succeeded)
          {
            ArgOkOrNot0_65 = ((MR_Word) (conv1_ArgOkOrNot0_65));
            succeeded = MR_TRUE;
          }
          if (succeeded)
          {
            MR_Word OkProcs0_66 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot0_65, 0))));
            MR_Word NotOkProcs0_67 = ((MR_Word) ((MR_hl_field(0, ArgOkOrNot0_65, 1))));
            MR_Word NotOkProcs_68;
            MR_Word ArgOkOrNot_69;

            mercury__set__insert_3_p_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), ((MR_Box) (HeadVar__4_4)), NotOkProcs0_67, &NotOkProcs_68);
            {
              ArgOkOrNot_69 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, ArgOkOrNot_69, 0) = ((MR_Box) (OkProcs0_66));
              MR_hl_field(0, ArgOkOrNot_69, 1) = ((MR_Box) (NotOkProcs_68));
            }
            mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_100_101_116_95_117_112_100_97_116_101_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_4_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), ArgNum_37, ((MR_Box) (ArgOkOrNot_69)), STATE_VARIABLE_OkOrNotMap_0_5, &STATE_VARIABLE_OkOrNotMap_1_46);
          }
          else
          {
            MR_Word Var_70;
            MR_Word Var_71;
            MR_Word ArgOkOrNot_72;

            Var_70 = mercury__set__init_0_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0));
            Var_71 = mercury__set__make_singleton_set_1_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_int_0), ((MR_Box) (HeadVar__4_4)));
            {
              ArgOkOrNot_72 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
              MR_hl_field(0, ArgOkOrNot_72, 0) = ((MR_Box) (Var_70));
              MR_hl_field(0, ArgOkOrNot_72, 1) = ((MR_Box) (Var_71));
            }
            mercury__map__f_84_121_112_101_83_112_101_99_79_102_95_95_112_114_101_100_95_95_100_101_116_95_105_110_115_101_114_116_95_95_91_75_32_61_32_105_110_116_93_95_48_95_49_4_p_0((MR_Word) (&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0), ArgNum_37, ((MR_Box) (ArgOkOrNot_72)), STATE_VARIABLE_OkOrNotMap_0_5, &STATE_VARIABLE_OkOrNotMap_1_46);
          }
        }
        // direct tailcall eliminated
        ;
        next_value_of_HeadVar__2_2 = Var_49;
        next_value_of_HeadVar__3_3 = ProcInitialInsts_34;
        next_value_of_STATE_VARIABLE_OkOrNotMap_0_5 = STATE_VARIABLE_OkOrNotMap_1_46;
        HeadVar__2_2 = next_value_of_HeadVar__2_2;
        HeadVar__3_3 = next_value_of_HeadVar__3_3;
        STATE_VARIABLE_OkOrNotMap_0_5 = next_value_of_STATE_VARIABLE_OkOrNotMap_0_5;
        continue;
      }
    }
    break;
  }
}

static void MR_CALL 
check_hlds__mode_errors__construct_argnum_var_type_inst_tuples_5_p_0(
  MR_Word VarTable_1,
  MR_Word InstMap_2,
  MR_Integer ArgNum_3,
  MR_Word HeadVar__4_4,
  MR_Word * HeadVar__5_5)
{
  if ((HeadVar__4_4 == (MR_Word) ((MR_Unsigned) 0U)))
    *HeadVar__5_5 = (MR_Word) ((MR_Unsigned) 0U);
  else
  {
    MR_Word Var_12 = ((MR_Word) ((MR_hl_field(1, HeadVar__4_4, 0))));
    MR_Word Vars_13 = ((MR_Word) ((MR_hl_field(1, HeadVar__4_4, 1))));
    MR_Word ArgTuple_14;
    MR_Word ArgTuples_15;
    MR_Word Type_16;
    MR_Word Inst_17;
    MR_Integer Var_18;

    parse_tree__var_table__lookup_var_type_3_p_0(VarTable_1, Var_12, &Type_16);
    hlds__instmap__instmap_lookup_var_3_p_0(InstMap_2, Var_12, &Inst_17);
    {
      ArgTuple_14 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, ArgTuple_14, 0) = ((MR_Box) (ArgNum_3));
      MR_hl_field(0, ArgTuple_14, 1) = ((MR_Box) (Var_12));
      MR_hl_field(0, ArgTuple_14, 2) = ((MR_Box) (Type_16));
      MR_hl_field(0, ArgTuple_14, 3) = ((MR_Box) (Inst_17));
    }
    Var_18 = (MR_Integer) ((MR_Unsigned) ArgNum_3 + (MR_Unsigned) 1);
    check_hlds__mode_errors__construct_argnum_var_type_inst_tuples_5_p_0(VarTable_1, InstMap_2, Var_18, Vars_13, &ArgTuples_15);
    {
      MR_Word base;
      base = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      *HeadVar__5_5 = base;
      MR_hl_field(1, base, 0) = ((MR_Box) (ArgTuple_14));
      MR_hl_field(1, base, 1) = ((MR_Box) (ArgTuples_15));
    }
  }
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_callee_pred_has_no_mode_decl_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word PredId_5)
{
  MR_Word Spec_6;
  MR_Word Preamble_7;
  MR_Word ModuleInfo_8;
  MR_Word PredDotPieces_9;
  MR_Word Context_10;
  MR_Word Pieces_11;
  MR_Word Var_24;
  MR_Word Var_25;
  MR_Word Var_30;
  MR_Word Var_35;
  MR_Word Var_42;

  Preamble_7 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_4);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_4, &ModuleInfo_8);
  PredDotPieces_9 = hlds__hlds_error_util__describe_one_pred_name_5_f_0(ModuleInfo_8, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[4])), (MR_Integer) 0, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])), PredId_5);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_4, &Context_10);
  Var_25 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[169])));
  Var_35 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), PredDotPieces_9, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  Var_30 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[171])), Var_35);
  Var_24 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_25, Var_30);
  Pieces_11 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[167])), Var_24);
  Var_42 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_7, Pieces_11);
  {
    Spec_6 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_6, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_callee_pred_has_no_mode_decl_to_spec\'/2"));
    MR_hl_field(0, Spec_6, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_6, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_6, 3) = ((MR_Box) (Context_10));
    MR_hl_field(0, Spec_6, 4) = ((MR_Box) (Var_42));
  }
  return Spec_6;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_clobbered_var_is_live_to_spec_2_f_0(
  MR_Word ModeInfo_4,
  MR_Word Var_5)
{
  MR_Word Spec_6;
  MR_Word Preamble_7;
  MR_Word Context_8;
  MR_Word VarTable_9;
  MR_String VarName_10;
  MR_Word Pieces_11;
  MR_Word Var_20;
  MR_Word Var_21;
  MR_Word Var_22;
  MR_Word Var_23;
  MR_Word Var_25;
  MR_Word Var_30;
  MR_Word Var_31;
  MR_Word Var_42;

  Preamble_7 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_4);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_4, &Context_8);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_4, &VarTable_9);
  VarName_10 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_9, Var_5);
  {
    Var_23 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_23, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_23, 1) = ((MR_Box) (VarName_10));
  }
  {
    Var_22 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_22, 0) = ((MR_Box) (Var_23));
    MR_hl_field(1, Var_22, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_21 = parse_tree__error_spec__color_as_subject_1_f_0(Var_22);
  Var_31 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[165])));
  Var_30 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_31, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  Var_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[163])), Var_30);
  Var_20 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_21, Var_25);
  Pieces_11 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[161])), Var_20);
  Var_42 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_7, Pieces_11);
  {
    Spec_6 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_6, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_clobbered_var_is_live_to_spec\'/2"));
    MR_hl_field(0, Spec_6, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_6, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_6, 3) = ((MR_Box) (Context_8));
    MR_hl_field(0, Spec_6, 4) = ((MR_Box) (Var_42));
  }
  return Spec_6;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_var_is_not_sufficiently_instantiated_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word Var_8,
  MR_Word VarInst_9,
  MR_Word ExpectedInst_10,
  MR_Word MaybeMultiModeError_11)
{
  MR_bool succeeded;
  MR_Word Spec_12;
  MR_Word Preamble_13;
  MR_Word Context_14;
  MR_Word VarTable_15;
  MR_Word MainPieces_16;
  MR_Word MainMsgs_17;
  MR_Word UniqMsgs_20;
  MR_Word MultiModeMsgs_21;
  MR_Word AllMsgs_29;
  MR_Word Var_34;
  MR_Word Var_35;
  MR_Word Var_36;
  MR_Word Var_37;
  MR_String Var_38;
  MR_Word Var_40;
  MR_Word Var_41;
  MR_Word Var_42;
  MR_Word Var_137;
  MR_Word Var_46;

  Preamble_13 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_7);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_7, &Context_14);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_7, &VarTable_15);
  Var_38 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, Var_8);
  {
    Var_37 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_37, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_37, 1) = ((MR_Box) (Var_38));
  }
  {
    Var_36 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_36, 0) = ((MR_Box) (Var_37));
    MR_hl_field(1, Var_36, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_35 = parse_tree__error_spec__color_as_subject_1_f_0(Var_36);
  Var_40 = check_hlds__mode_errors__has_inst_expected_inst_was_3_f_0(ModeInfo_7, VarInst_9, ExpectedInst_10);
  Var_34 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_35, Var_40);
  MainPieces_16 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[39])), Var_34);
  Var_42 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_13, MainPieces_16);
  {
    Var_41 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_41, 0) = ((MR_Box) (Context_14));
    MR_hl_field(0, Var_41, 1) = ((MR_Box) (Var_42));
  }
  {
    MainMsgs_17 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, MainMsgs_17, 0) = ((MR_Box) (Var_41));
    MR_hl_field(1, MainMsgs_17, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  succeeded = check_hlds__mode_errors__inst_has_uniqueness_2_p_0(VarInst_9, (MR_Integer) 2);
  if (succeeded)
  {
    Var_46 = (MR_Integer) 1;
    succeeded = check_hlds__mode_errors__inst_has_uniqueness_2_p_0(ExpectedInst_10, Var_46);
  }
  if (succeeded)
  {
    MR_Word UniqPieces_19;
    MR_Word Var_54;
    MR_Word Var_55;
    MR_Word Var_60;
    MR_Word Var_65;
    MR_Word Var_66;
    MR_Word Var_74;
    MR_Word Var_75;
    MR_Word Var_83;
    MR_Word Var_96;
    MR_Word Var_97;
    MR_Word Var_102;
    MR_Word Var_110;
    MR_Word Var_111;
    MR_Word Var_125;

    Var_55 = parse_tree__error_spec__color_as_hint_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[126])));
    Var_66 = parse_tree__error_spec__color_as_hint_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[130])));
    Var_75 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[134])));
    Var_97 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[143])));
    Var_111 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[149])));
    Var_110 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_111, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[153])));
    Var_102 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[147])), Var_110);
    Var_96 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_97, Var_102);
    Var_83 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[141])), Var_96);
    Var_74 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_75, Var_83);
    Var_65 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_66, Var_74);
    Var_60 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[34])), Var_65);
    Var_54 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_55, Var_60);
    UniqPieces_19 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[124])), Var_54);
    {
      Var_125 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, Var_125, 0) = ((MR_Box) (Context_14));
      MR_hl_field(0, Var_125, 1) = ((MR_Box) (UniqPieces_19));
    }
    {
      UniqMsgs_20 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, UniqMsgs_20, 0) = ((MR_Box) (Var_125));
      MR_hl_field(1, UniqMsgs_20, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
  }
  else
    UniqMsgs_20 = (MR_Word) ((MR_Unsigned) 0U);
  if ((MaybeMultiModeError_11 == (MR_Word) ((MR_Unsigned) 0U)))
    MultiModeMsgs_21 = (MR_Word) ((MR_Unsigned) 0U);
  else
  {
    MR_Word PredMultiModeError_22 = ((MR_Word) ((MR_hl_field(1, MaybeMultiModeError_11, 0))));
    MR_Word ConnectMsgs_24;
    MR_Word SubSpec0_25;
    MR_Word ModuleInfo_26;
    MR_Word Globals_27;
    MR_Word SubMsgs_28;
    MR_Word Var_135;

    {
      Var_135 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
      MR_hl_field(0, Var_135, 0) = ((MR_Box) (Context_14));
      MR_hl_field(0, Var_135, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[157])));
    }
    {
      ConnectMsgs_24 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
      MR_hl_field(1, ConnectMsgs_24, 0) = ((MR_Box) (Var_135));
      MR_hl_field(1, ConnectMsgs_24, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    }
    SubSpec0_25 = check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0(ModeInfo_7, Var_8, PredMultiModeError_22);
    check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_7, &ModuleInfo_26);
    hlds__hlds_module__module_info_get_globals_2_p_0(ModuleInfo_26, &Globals_27);
    parse_tree__error_spec__extract_spec_msgs_and_maybe_add_id_3_p_0(Globals_27, SubSpec0_25, &SubMsgs_28);
    MultiModeMsgs_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), ConnectMsgs_24, SubMsgs_28);
  }
  Var_137 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), UniqMsgs_20, MultiModeMsgs_21);
  AllMsgs_29 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_error_msg_0), MainMsgs_17, Var_137);
  {
    Spec_12 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_var_is_not_sufficiently_instantiated_to_spec\'/5"));
    MR_hl_field(2, Spec_12, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_12, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_12, 3) = ((MR_Box) (AllMsgs_29));
  }
  return Spec_12;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__has_inst_expected_inst_was_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word ActualInst_6,
  MR_Word ExpectedInst_7)
{
  MR_Word HeadVar__4_4;
  MR_Word Var_8;
  MR_Word Var_12;
  MR_Word InstPieces0_14;
  MR_Word InstPieces_15;
  MR_Word ModuleInfo_25;
  MR_Word InstVarSet_26;

  Var_8 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_5, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[2])), ActualInst_6, (MR_String) ",");
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_5, &ModuleInfo_25);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_5, &InstVarSet_26);
  InstPieces0_14 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_25, InstVarSet_26, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 0, (MR_Word) ((MR_Unsigned) 0U), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[468])), ExpectedInst_7);
  InstPieces_15 = parse_tree__error_spec__color_as_correct_1_f_0(InstPieces0_14);
  {
    Var_12 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_12, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[43])));
    MR_hl_field(1, Var_12, 1) = ((MR_Box) (InstPieces_15));
  }
  HeadVar__4_4 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_8, Var_12);
  return HeadVar__4_4;
}

static MR_bool MR_CALL 
check_hlds__mode_errors__inst_has_uniqueness_2_p_0(
  MR_Word Inst_3,
  MR_Word SearchUniq_4)
{
  while (MR_TRUE)
  {
    MR_bool succeeded;

    // setup for model_semi tailcalls optimized into a loop
    ;
    switch (MR_tag((MR_Word) Inst_3)) {
      default:
        succeeded = MR_FALSE;
        break;
      case (MR_Integer) 1:
        {
          MR_Word Uniq_15 = ((MR_Unsigned) ((MR_hl_field(1, Inst_3, 0))) & (MR_Integer) 7);

          succeeded = (Uniq_15 == SearchUniq_4);
        }
        break;
      case (MR_Integer) 2:
        {
          MR_Word Uniq_9 = ((MR_Unsigned) ((MR_hl_field(2, Inst_3, 0))) & (MR_Integer) 7);

          succeeded = (Uniq_9 == SearchUniq_4);
        }
        break;
      case (MR_Integer) 3:
        switch (((MR_Integer) ((MR_hl_field(3, Inst_3, 0))))) {
          default:
            succeeded = MR_FALSE;
            break;
          case (MR_Integer) 1:
            {
              MR_Word SubInst_14 = ((MR_Word) ((MR_hl_field(3, Inst_3, 2))));
              MR_Word next_value_of_Inst_3 = SubInst_14;

              // direct tailcall eliminated
              ;
              Inst_3 = next_value_of_Inst_3;
              continue;
            }
            break;
        }
        break;
    }
    return succeeded;
    break;
  }
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_higher_order_unify_to_spec_5_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv0_HeadVar__2_2;

  conv0_HeadVar__2_2 = hlds__mode_util__from_to_insts_to_mode_1_f_0(((MR_Word) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv0_HeadVar__2_2));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_higher_order_unify_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word LHSVar_8,
  MR_Word RHS_9,
  MR_Word Type_10,
  MR_Word PredOrFunc_11)
{
  MR_Word Spec_12;
  MR_Word Preamble_13;
  MR_Word Context_14;
  MR_Word VarTable_15;
  MR_Word InstVarSet_16;
  MR_Word ModuleInfo_17;
  MR_String RHSStr_19;
  MR_Word TypeVarSet_25;
  MR_String LHSVarName_26;
  MR_Word MainPieces_27;
  MR_Word VerbosePieces_28;
  MR_Word Var_44;
  MR_Word Var_45;
  MR_Word Var_46;
  MR_Word Var_47;
  MR_Word Var_49;
  MR_Word Var_54;
  MR_Word Var_55;
  MR_Word Var_56;
  MR_Word Var_57;
  MR_Word Var_62;
  MR_Word Var_64;
  MR_Word Var_67;
  MR_Word Var_69;
  MR_Word Var_72;
  MR_Word Var_73;
  MR_String Var_74;
  MR_Word Var_84;
  MR_Word Var_85;
  MR_String Var_86;
  MR_String Var_87;
  MR_Word Var_89;
  MR_Word Var_92;
  MR_Word Var_95;
  MR_Word Var_96;
  MR_String Var_97;
  MR_String Var_98;
  MR_Word Var_133;
  MR_Word Var_134;
  MR_Word Var_135;
  MR_Word Var_136;
  MR_Word Var_137;
  MR_Word Var_138;
  MR_Word Var_139;

  Preamble_13 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_7);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_7, &Context_14);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_7, &VarTable_15);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_7, &InstVarSet_16);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_7, &ModuleInfo_17);
  switch (MR_tag((MR_Word) RHS_9)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word Y_18 = ((MR_Word) ((MR_hl_field(0, RHS_9, 0))));

        RHSStr_19 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, Y_18);
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word ConsId_20 = ((MR_Word) ((MR_hl_field(1, RHS_9, 0))));
        MR_Word ArgVars_21 = ((MR_Word) ((MR_hl_field(1, RHS_9, 1))));
        MR_Word Var_30;

        {
          Var_30 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_30, 0) = ((MR_Box) (VarTable_15));
        }
        RHSStr_19 = hlds__hlds_out__hlds_out_util__functor_cons_id_to_string_5_f_0(ModuleInfo_17, Var_30, (MR_Integer) 0, ConsId_20, ArgVars_21);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word ArgFromToInsts_22 = ((MR_Word) ((MR_hl_field(2, RHS_9, 1))));
        MR_Word ArgModes_23;
        MR_Word ArgVarsModes_24;
        MR_String Var_34;
        MR_String Var_35;
        MR_Word Var_37;
        MR_Word ArgVars_143 = ((MR_Word) ((MR_hl_field(2, RHS_9, 0))));

        ArgModes_23 = mercury__list__map_2_f_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_from_to_insts_0), (MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_mode_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[4]), ArgFromToInsts_22);
        mercury__assoc_list__from_corresponding_lists_3_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_mer_mode_0), ArgVars_143, ArgModes_23, &ArgVarsModes_24);
        {
          Var_37 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_37, 0) = ((MR_Box) (VarTable_15));
        }
        Var_35 = hlds__hlds_out__hlds_out_util__var_modes_to_string_5_f_0((MR_Integer) 1, Var_37, InstVarSet_16, (MR_Integer) 0, ArgVarsModes_24);
        Var_34 = mercury__string__f_43_43_2_f_0(Var_35, (MR_String) "] ... )");
        RHSStr_19 = mercury__string__f_43_43_2_f_0((MR_String) "lambda([", Var_34);
      }
      break;
  }
  mercury__varset__init_1_p_0((MR_Word) (&parse_tree__prog_data__parse_tree__prog_data__type_ctor_info_tvar_type_0), &TypeVarSet_25);
  LHSVarName_26 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, LHSVar_8);
  {
    Var_47 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_47, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_47, 1) = ((MR_Box) (LHSVarName_26));
  }
  {
    Var_46 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_46, 0) = ((MR_Box) (Var_47));
    MR_hl_field(1, Var_46, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_45 = parse_tree__error_spec__color_as_subject_1_f_0(Var_46);
  {
    Var_57 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_57, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_57, 1) = ((MR_Box) (RHSStr_19));
  }
  {
    Var_56 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_56, 0) = ((MR_Box) (Var_57));
    MR_hl_field(1, Var_56, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[100])));
  }
  Var_55 = parse_tree__error_spec__color_as_subject_1_f_0(Var_56);
  Var_74 = parse_tree__parse_tree_out_type__mercury_type_to_string_3_f_0(TypeVarSet_25, (MR_Integer) 0, Type_10);
  {
    Var_73 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_73, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_73, 1) = ((MR_Box) (Var_74));
  }
  {
    Var_72 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_72, 0) = ((MR_Box) (Var_73));
    MR_hl_field(1, Var_72, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
  }
  {
    Var_69 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_69, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[102])));
    MR_hl_field(1, Var_69, 1) = ((MR_Box) (Var_72));
  }
  {
    Var_67 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_67, 0) = ((MR_Box) ((MR_Unsigned) 12U));
    MR_hl_field(1, Var_67, 1) = ((MR_Box) (Var_69));
  }
  {
    Var_64 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_64, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[101])));
    MR_hl_field(1, Var_64, 1) = ((MR_Box) (Var_67));
  }
  {
    Var_62 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_62, 0) = ((MR_Box) ((MR_Unsigned) 12U));
    MR_hl_field(1, Var_62, 1) = ((MR_Box) (Var_64));
  }
  Var_54 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_55, Var_62);
  Var_49 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[98])), Var_54);
  Var_44 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_45, Var_49);
  MainPieces_27 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[96])), Var_44);
  Var_87 = mdbcomp__prim_data__pred_or_func_to_full_str_1_f_0(PredOrFunc_11);
  Var_86 = mercury__string__f_43_43_2_f_0(Var_87, (MR_String) "s");
  {
    Var_85 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_85, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_85, 1) = ((MR_Box) (Var_86));
  }
  Var_98 = mdbcomp__prim_data__pred_or_func_to_full_str_1_f_0(PredOrFunc_11);
  Var_97 = mercury__string__f_43_43_2_f_0(Var_98, (MR_String) "s");
  {
    Var_96 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_96, 0) = ((MR_Box) ((MR_Unsigned) 9U));
    MR_hl_field(3, Var_96, 1) = ((MR_Box) (Var_97));
  }
  {
    Var_95 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_95, 0) = ((MR_Box) (Var_96));
    MR_hl_field(1, Var_95, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[120])));
  }
  {
    Var_92 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_92, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[105])));
    MR_hl_field(1, Var_92, 1) = ((MR_Box) (Var_95));
  }
  {
    Var_89 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_89, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[104])));
    MR_hl_field(1, Var_89, 1) = ((MR_Box) (Var_92));
  }
  {
    Var_84 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_84, 0) = ((MR_Box) (Var_85));
    MR_hl_field(1, Var_84, 1) = ((MR_Box) (Var_89));
  }
  {
    VerbosePieces_28 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, VerbosePieces_28, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[103])));
    MR_hl_field(1, VerbosePieces_28, 1) = ((MR_Box) (Var_84));
  }
  Var_137 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_13, MainPieces_27);
  {
    Var_136 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_136, 0) = ((MR_Box) (Var_137));
  }
  {
    Var_139 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_139, 0) = (MR_Box) ((MR_Unsigned) ((MR_Integer) 1));
    MR_hl_field(1, Var_139, 1) = ((MR_Box) (VerbosePieces_28));
  }
  {
    Var_138 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_138, 0) = ((MR_Box) (Var_139));
    MR_hl_field(1, Var_138, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Var_135 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_135, 0) = ((MR_Box) (Var_136));
    MR_hl_field(1, Var_135, 1) = ((MR_Box) (Var_138));
  }
  {
    Var_134 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Var_134, 0) = ((MR_Box) (Context_14));
    MR_hl_field(2, Var_134, 1) = ((MR_Box) (Var_135));
  }
  {
    Var_133 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_133, 0) = ((MR_Box) (Var_134));
    MR_hl_field(1, Var_133, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Spec_12 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_higher_order_unify_to_spec\'/5"));
    MR_hl_field(2, Spec_12, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_12, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_12, 3) = ((MR_Box) (Var_133));
  }
  return Spec_12;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_non_ground_non_local_lambda_var_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word Var_6,
  MR_Word VarInst_7)
{
  MR_Word Spec_8;
  MR_Word Preamble_9;
  MR_Word Context_10;
  MR_Word VarTable_11;
  MR_Word Pieces_12;
  MR_Word Var_18;
  MR_Word Var_19;
  MR_Word Var_20;
  MR_Word Var_21;
  MR_String Var_22;
  MR_Word Var_24;
  MR_Word Var_25;
  MR_Word Var_29;
  MR_Word Var_37;
  MR_Word Var_38;
  MR_Word Var_52;

  Preamble_9 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_5);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_5, &Context_10);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_5, &VarTable_11);
  Var_22 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_11, Var_6);
  {
    Var_21 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_21, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_21, 1) = ((MR_Box) (Var_22));
  }
  {
    Var_20 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_20, 0) = ((MR_Box) (Var_21));
    MR_hl_field(1, Var_20, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_19 = parse_tree__error_spec__color_as_subject_1_f_0(Var_20);
  Var_25 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_5, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[2])), VarInst_7, (MR_String) ",");
  Var_38 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[94])));
  Var_37 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_38, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  Var_29 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[93])), Var_37);
  Var_24 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_25, Var_29);
  Var_18 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_19, Var_24);
  Pieces_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[39])), Var_18);
  Var_52 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_9, Pieces_12);
  {
    Spec_8 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_non_ground_non_local_lambda_var_to_spec\'/3"));
    MR_hl_field(0, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_8, 3) = ((MR_Box) (Context_10));
    MR_hl_field(0, Spec_8, 4) = ((MR_Box) (Var_52));
  }
  return Spec_8;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv1_LambdaHeadVar__2_106;

  conv1_LambdaHeadVar__2_106 = check_hlds__mode_errors__IntroducedFrom__func__mode_error_unify_var_multimode_pf_to_spec__804__1_1_f_0(((MR_Integer) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv1_LambdaHeadVar__2_106));
  return wrapper_arg_2;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_multimode_pf_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word X_6,
  MR_Word PredMultiModeError_7)
{
  MR_Word Spec_8;
  MR_Word PredId_9 = ((MR_Word) ((MR_hl_field(0, PredMultiModeError_7, 0))));
  MR_Word MultiModeError_10 = ((MR_Word) ((MR_hl_field(0, PredMultiModeError_7, 1))));
  MR_Word Preamble_11;
  MR_Word Context_12;
  MR_Word VarTable_13;
  MR_Word ModuleInfo_14;
  MR_Word PredInfo_15;
  MR_Word PredOrFunc_16;
  MR_Word PredModule_17;
  MR_String PredName_18;
  MR_Word PredFormArity_19;
  MR_Word SymName_20;
  MR_Word PFSNA_21;
  MR_Word StartPieces_22;
  MR_Word DetailPieces_26;
  MR_Word Var_42;
  MR_Word Var_43;
  MR_String Var_44;
  MR_Word Var_45;
  MR_Word Var_48;
  MR_Word Var_49;
  MR_Word Var_164;
  MR_Word Var_165;

  Preamble_11 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_5);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_5, &Context_12);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_5, &VarTable_13);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_5, &ModuleInfo_14);
  hlds__hlds_module__module_info_pred_info_3_p_0(ModuleInfo_14, PredId_9, &PredInfo_15);
  PredOrFunc_16 = hlds__hlds_pred__pred_info_is_pred_or_func_1_f_0(PredInfo_15);
  PredModule_17 = hlds__hlds_pred__pred_info_module_1_f_0(PredInfo_15);
  PredName_18 = hlds__hlds_pred__pred_info_name_1_f_0(PredInfo_15);
  hlds__hlds_pred__pred_info_get_orig_arity_2_p_0(PredInfo_15, &PredFormArity_19);
  {
    SymName_20 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, SymName_20, 0) = ((MR_Box) (PredModule_17));
    MR_hl_field(1, SymName_20, 1) = ((MR_Box) (PredName_18));
  }
  {
    PFSNA_21 = (MR_Word) MR_new_object(MR_Word, (3 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, PFSNA_21, 0) = (MR_Box) ((MR_Unsigned) (PredOrFunc_16));
    MR_hl_field(0, PFSNA_21, 1) = ((MR_Box) (SymName_20));
    MR_hl_field(0, PFSNA_21, 2) = ((MR_Box) (PredFormArity_19));
  }
  Var_44 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_13, X_6);
  {
    Var_43 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_43, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_43, 1) = ((MR_Box) (Var_44));
  }
  {
    Var_49 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_49, 0) = ((MR_Box) ((MR_Unsigned) 16U));
    MR_hl_field(3, Var_49, 1) = ((MR_Box) (PFSNA_21));
  }
  {
    Var_48 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_48, 0) = ((MR_Box) (Var_49));
    MR_hl_field(1, Var_48, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[66])));
  }
  {
    Var_45 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_45, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[65])));
    MR_hl_field(1, Var_45, 1) = ((MR_Box) (Var_48));
  }
  {
    Var_42 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_42, 0) = ((MR_Box) (Var_43));
    MR_hl_field(1, Var_42, 1) = ((MR_Box) (Var_45));
  }
  {
    StartPieces_22 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, StartPieces_22, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[22])));
    MR_hl_field(1, StartPieces_22, 1) = ((MR_Box) (Var_42));
  }
  switch (MR_tag((MR_Word) MultiModeError_10)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      {
        MR_Word Var_86;
        MR_String Var_87;
        MR_Word ArgVars_181 = ((MR_Word) ((MR_hl_field(0, MultiModeError_10, 0))));
        MR_Word MatchPieces_182;
        MR_String ModeOrModes_184;
        MR_Word ArgVarPieces_185;
        MR_Word Var_191;
        MR_Word Var_193;
        MR_Word Var_194;
        MR_Word Var_195;
        MR_Word Var_197;
        MR_Word Var_198;
        MR_Word Var_200;
        MR_Word Var_201;
        MR_Word Var_202;
        MR_Word Var_203;
        MR_Word Var_204;
        MR_Word Var_206;
        MR_Word Var_207;
        MR_Word Var_209;
        MR_String VarOrVars_211;
        MR_Box conv4_Var_87;
        MR_Box conv5_ModeOrModes_184;
        MR_Box conv6_VarOrVars_211;

        conv4_Var_87 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgVars_181, ((MR_Box) ((MR_String) "does")), ((MR_Box) ((MR_String) "do")));
        Var_87 = ((MR_String) (conv4_Var_87));
        {
          Var_86 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_86, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_86, 1) = ((MR_Box) (Var_87));
        }
        {
          MatchPieces_182 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, MatchPieces_182, 0) = ((MR_Box) (Var_86));
          MR_hl_field(1, MatchPieces_182, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[74])));
        }
        conv5_ModeOrModes_184 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgVars_181, ((MR_Box) ((MR_String) "mode")), ((MR_Box) ((MR_String) "modes")));
        ModeOrModes_184 = ((MR_String) (conv5_ModeOrModes_184));
        conv6_VarOrVars_211 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgVars_181, ((MR_Box) ((MR_String) "variable")), ((MR_Box) ((MR_String) "variables")));
        VarOrVars_211 = ((MR_String) (conv6_VarOrVars_211));
        ArgVarPieces_185 = check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0(VarTable_13, (MR_Integer) 0, ArgVars_181);
        {
          Var_194 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_194, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_194, 1) = ((MR_Box) (ModeOrModes_184));
        }
        {
          Var_198 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_198, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_198, 1) = ((MR_Box) (VarOrVars_211));
        }
        {
          Var_197 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_197, 0) = ((MR_Box) (Var_198));
          MR_hl_field(1, Var_197, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        {
          Var_195 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_195, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[76])));
          MR_hl_field(1, Var_195, 1) = ((MR_Box) (Var_197));
        }
        {
          Var_193 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_193, 0) = ((MR_Box) (Var_194));
          MR_hl_field(1, Var_193, 1) = ((MR_Box) (Var_195));
        }
        {
          Var_191 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_191, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[75])));
          MR_hl_field(1, Var_191, 1) = ((MR_Box) (Var_193));
        }
        Var_202 = parse_tree__error_spec__color_as_incorrect_1_f_0(MatchPieces_182);
        {
          Var_207 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_207, 0) = ((MR_Box) ((MR_Unsigned) 31U));
          MR_hl_field(3, Var_207, 1) = (MR_Box) ((MR_Unsigned) (PredOrFunc_16));
        }
        {
          Var_206 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_206, 0) = ((MR_Box) (Var_207));
          MR_hl_field(1, Var_206, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[81])));
        }
        {
          Var_204 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_204, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[77])));
          MR_hl_field(1, Var_204, 1) = ((MR_Box) (Var_206));
        }
        Var_209 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_203 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_204, Var_209);
        Var_201 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_202, Var_203);
        Var_200 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgVarPieces_185, Var_201);
        DetailPieces_26 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_191, Var_200);
      }
      break;
    case (MR_Integer) 1:
      {
        MR_Word ArgVars_27 = ((MR_Word) ((MR_hl_field(1, MultiModeError_10, 0))));
        MR_Word MatchPieces_28;
        MR_Word EndPieces_29;
        MR_Integer ProcA_30 = ((MR_Integer) ((MR_hl_field(1, MultiModeError_10, 1))));
        MR_Integer ProcB_31 = ((MR_Integer) ((MR_hl_field(1, MultiModeError_10, 2))));
        MR_Word ProcCs_32 = ((MR_Word) ((MR_hl_field(1, MultiModeError_10, 3))));
        MR_Word ModeNumberPieces_36;
        MR_String ModeOrModes_37;
        MR_Word ArgVarPieces_38;
        MR_Word Var_97;
        MR_String Var_98;
        MR_Word Var_109;
        MR_Word Var_110;
        MR_Word Var_118;
        MR_Word Var_119;
        MR_Word Var_130;
        MR_Word Var_133;
        MR_Word Var_134;
        MR_Word Var_135;
        MR_Word Var_138;
        MR_Word Var_139;
        MR_Word Var_141;
        MR_Word Var_142;
        MR_Word Var_143;
        MR_Word Var_144;
        MR_Word Var_145;
        MR_Word Var_148;
        MR_Word Var_149;
        MR_Word Var_157;
        MR_String VarOrVars_167;
        MR_Box conv0_Var_98;
        MR_Box conv2_ModeOrModes_37;
        MR_Box conv3_VarOrVars_167;

        conv0_Var_98 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgVars_27, ((MR_Box) ((MR_String) "matches")), ((MR_Box) ((MR_String) "match")));
        Var_98 = ((MR_String) (conv0_Var_98));
        {
          Var_97 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_97, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_97, 1) = ((MR_Box) (Var_98));
        }
        {
          MatchPieces_28 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, MatchPieces_28, 0) = ((MR_Box) (Var_97));
          MR_hl_field(1, MatchPieces_28, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[68])));
        }
        {
          Var_110 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_110, 0) = ((MR_Box) (ProcB_31));
          MR_hl_field(1, Var_110, 1) = ((MR_Box) (ProcCs_32));
        }
        {
          Var_109 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_109, 0) = ((MR_Box) (ProcA_30));
          MR_hl_field(1, Var_109, 1) = ((MR_Box) (Var_110));
        }
        ModeNumberPieces_36 = mercury__list__map_2_f_0((MR_Word) (&hlds__hlds_pred__hlds__hlds_pred__type_ctor_info_proc_id_0), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[3]), Var_109);
        Var_119 = parse_tree__error_spec__piece_list_to_pieces_2_f_0((MR_String) "and", ModeNumberPieces_36);
        Var_118 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_119, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[35])));
        EndPieces_29 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[72])), Var_118);
        conv2_ModeOrModes_37 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgVars_27, ((MR_Box) ((MR_String) "mode")), ((MR_Box) ((MR_String) "modes")));
        ModeOrModes_37 = ((MR_String) (conv2_ModeOrModes_37));
        conv3_VarOrVars_167 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), ArgVars_27, ((MR_Box) ((MR_String) "variable")), ((MR_Box) ((MR_String) "variables")));
        VarOrVars_167 = ((MR_String) (conv3_VarOrVars_167));
        ArgVarPieces_38 = check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0(VarTable_13, (MR_Integer) 0, ArgVars_27);
        {
          Var_134 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_134, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_134, 1) = ((MR_Box) (ModeOrModes_37));
        }
        {
          Var_139 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_139, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_139, 1) = ((MR_Box) (VarOrVars_167));
        }
        {
          Var_138 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_138, 0) = ((MR_Box) (Var_139));
          MR_hl_field(1, Var_138, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        {
          Var_135 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_135, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[76])));
          MR_hl_field(1, Var_135, 1) = ((MR_Box) (Var_138));
        }
        {
          Var_133 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_133, 0) = ((MR_Box) (Var_134));
          MR_hl_field(1, Var_133, 1) = ((MR_Box) (Var_135));
        }
        {
          Var_130 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_130, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[75])));
          MR_hl_field(1, Var_130, 1) = ((MR_Box) (Var_133));
        }
        Var_143 = parse_tree__error_spec__color_as_incorrect_1_f_0(MatchPieces_28);
        {
          Var_149 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_149, 0) = ((MR_Box) ((MR_Unsigned) 31U));
          MR_hl_field(3, Var_149, 1) = (MR_Box) ((MR_Unsigned) (PredOrFunc_16));
        }
        {
          Var_148 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_148, 0) = ((MR_Box) (Var_149));
          MR_hl_field(1, Var_148, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[81])));
        }
        {
          Var_145 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_145, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[77])));
          MR_hl_field(1, Var_145, 1) = ((MR_Box) (Var_148));
        }
        Var_157 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), EndPieces_29, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_144 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_145, Var_157);
        Var_142 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_143, Var_144);
        Var_141 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ArgVarPieces_38, Var_142);
        DetailPieces_26 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_130, Var_141);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word NonGroundArgVars_23 = ((MR_Word) ((MR_hl_field(2, MultiModeError_10, 0))));
        MR_String VarOrVars_24;
        MR_Word NonGroundArgVarPieces_25;
        MR_Word Var_59;
        MR_Word Var_62;
        MR_Word Var_63;
        MR_Word Var_65;
        MR_Word Var_66;
        MR_Word Var_67;
        MR_Word Var_72;
        MR_Word Var_77;
        MR_Word Var_78;
        MR_Box conv7_VarOrVars_24;

        conv7_VarOrVars_24 = parse_tree__error_spec__choose_number_3_f_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), NonGroundArgVars_23, ((MR_Box) ((MR_String) "variable")), ((MR_Box) ((MR_String) "variables")));
        VarOrVars_24 = ((MR_String) (conv7_VarOrVars_24));
        NonGroundArgVarPieces_25 = check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0(VarTable_13, (MR_Integer) 0, NonGroundArgVars_23);
        {
          Var_63 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(3, Var_63, 0) = ((MR_Box) ((MR_Unsigned) 9U));
          MR_hl_field(3, Var_63, 1) = ((MR_Box) (VarOrVars_24));
        }
        {
          Var_62 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_62, 0) = ((MR_Box) (Var_63));
          MR_hl_field(1, Var_62, 1) = ((MR_Box) ((MR_Unsigned) 0U));
        }
        {
          Var_59 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
          MR_hl_field(1, Var_59, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[82])));
          MR_hl_field(1, Var_59, 1) = ((MR_Box) (Var_62));
        }
        Var_67 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[84])));
        Var_78 = parse_tree__error_spec__color_as_incorrect_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[88])));
        Var_77 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_78, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
        Var_72 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[86])), Var_77);
        Var_66 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_67, Var_72);
        Var_65 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), NonGroundArgVarPieces_25, Var_66);
        DetailPieces_26 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_59, Var_65);
      }
      break;
  }
  Var_165 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), StartPieces_22, DetailPieces_26);
  Var_164 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_11, Var_165);
  {
    Spec_8 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unify_var_multimode_pf_to_spec\'/3"));
    MR_hl_field(0, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_8, 3) = ((MR_Box) (Context_12));
    MR_hl_field(0, Spec_8, 4) = ((MR_Box) (Var_164));
  }
  return Spec_8;
}

static MR_Box MR_CALL 
check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0_2(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1)
{
  MR_Box wrapper_arg_2;
  MR_Box closure = closure_arg;
  MR_Word conv1_LambdaHeadVar__2_27;

  conv1_LambdaHeadVar__2_27 = check_hlds__mode_errors__IntroducedFrom__func__named_and_unnamed_vars_to_pieces__843__1_1_f_0(((MR_String) (wrapper_arg_1)));
  wrapper_arg_2 = ((MR_Box) (conv1_LambdaHeadVar__2_27));
  return wrapper_arg_2;
}

static MR_bool MR_CALL 
check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0_1(
  MR_Box closure_arg,
  MR_Box wrapper_arg_1,
  MR_Box * wrapper_arg_2)
{
  MR_bool succeeded;
  MR_Box closure = closure_arg;
  MR_String conv0_LambdaHeadVar__2_24;

  succeeded = check_hlds__mode_errors__IntroducedFrom__pred__named_and_unnamed_vars_to_pieces__832__1_3_p_0(((MR_Word) ((MR_hl_field(0, closure, 3)))), ((MR_Word) (wrapper_arg_1)), &conv0_LambdaHeadVar__2_24);
  if (succeeded)
  {
    *wrapper_arg_2 = ((MR_Box) (conv0_LambdaHeadVar__2_24));
    succeeded = MR_TRUE;
  }
  return succeeded;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0(
  MR_Word VarTable_5,
  MR_Word Color_6,
  MR_Word Vars_7)
{
  MR_bool succeeded;
  MR_Word Pieces_8;
  MR_Word NamedVarNames_14;
  MR_Word UnnamedVars_15;
  MR_Word Var_22;

  {
    Var_22 = (MR_Word) MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_22, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_5[0]));
    MR_hl_field(0, Var_22, 1) = ((MR_Box) (check_hlds__mode_errors__named_and_unnamed_vars_to_pieces_3_f_0_1));
    MR_hl_field(0, Var_22, 2) = ((MR_Box) ((MR_Integer) 1));
    MR_hl_field(0, Var_22, 3) = ((MR_Box) (VarTable_5));
  }
  mercury__list__filter_map_4_p_0((MR_Word) (&check_hlds__mode_errors_scalar_common_1[0]), (MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), Var_22, Vars_7, &NamedVarNames_14, &UnnamedVars_15);
  if ((NamedVarNames_14 == (MR_Word) ((MR_Unsigned) 0U)))
    Pieces_8 = (MR_Word) ((MR_Unsigned) 0U);
  else
  {
    MR_Word NamedVarNamePieces_18;
    MR_Word NamedVarPieces_19;

    NamedVarNamePieces_18 = mercury__list__map_2_f_0((MR_Word) (&mercury__builtin__builtin__type_ctor_info_string_0), (MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (&check_hlds__mode_errors_scalar_common_3[2]), NamedVarNames_14);
    NamedVarPieces_19 = parse_tree__error_spec__piece_list_to_color_pieces_4_f_0(Color_6, (MR_String) "and", (MR_Word) ((MR_Unsigned) 0U), NamedVarNamePieces_18);
    if ((UnnamedVars_15 == (MR_Word) ((MR_Unsigned) 0U)))
      Pieces_8 = NamedVarPieces_19;
    else
      {
        Pieces_8 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
        MR_hl_field(1, Pieces_8, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[89])));
        MR_hl_field(1, Pieces_8, 1) = ((MR_Box) (NamedVarPieces_19));
      }
  }
  return Pieces_8;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_lambda_to_spec_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word X_7,
  MR_Word InstX_8,
  MR_Word InstY_9)
{
  MR_Word Spec_10;
  MR_Word Preamble_11;
  MR_Word Context_12;
  MR_Word VarTable_13;
  MR_Word InstColor_14;
  MR_Word Pieces_15;
  MR_Word Var_18;
  MR_Word Var_21;
  MR_Word Var_22;
  MR_String Var_23;
  MR_Word Var_33;
  MR_Word Var_34;
  MR_Word Var_35;
  MR_Word Var_36;
  MR_String Var_37;
  MR_Word Var_39;
  MR_Word Var_40;
  MR_Word Var_42;
  MR_Word Var_43;
  MR_Word Var_48;
  MR_Word Var_53;

  Preamble_11 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_6);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_6, &Context_12);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_6, &VarTable_13);
  InstColor_14 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0]));
  Var_23 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_13, X_7);
  {
    Var_22 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_22, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_22, 1) = ((MR_Box) (Var_23));
  }
  {
    Var_21 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_21, 0) = ((MR_Box) (Var_22));
    MR_hl_field(1, Var_21, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[62])));
  }
  {
    Var_18 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_18, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[22])));
    MR_hl_field(1, Var_18, 1) = ((MR_Box) (Var_21));
  }
  Var_37 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_13, X_7);
  {
    Var_36 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_36, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_36, 1) = ((MR_Box) (Var_37));
  }
  {
    Var_35 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_35, 0) = ((MR_Box) (Var_36));
    MR_hl_field(1, Var_35, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_34 = parse_tree__error_spec__color_as_subject_1_f_0(Var_35);
  Var_40 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_6, InstColor_14, InstX_8, (MR_String) ",");
  Var_43 = parse_tree__error_spec__color_as_subject_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[64])));
  Var_48 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_6, InstColor_14, InstY_9, (MR_String) ".");
  Var_42 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_43, Var_48);
  Var_39 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_40, Var_42);
  Var_33 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_34, Var_39);
  Pieces_15 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_18, Var_33);
  Var_53 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_11, Pieces_15);
  {
    Spec_10 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_10, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unify_var_lambda_to_spec\'/4"));
    MR_hl_field(0, Spec_10, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_10, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_10, 3) = ((MR_Box) (Context_12));
    MR_hl_field(0, Spec_10, 4) = ((MR_Box) (Var_53));
  }
  return Spec_10;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_functor_to_spec_6_f_0(
  MR_Word ModeInfo_8,
  MR_Word X_9,
  MR_Word ConsId_10,
  MR_Word ArgVars_11,
  MR_Word InstX_12,
  MR_Word ArgInsts_13)
{
  MR_Word Spec_14;
  MR_Word Preamble_15;
  MR_Word Context_16;
  MR_Word VarTable_17;
  MR_Word ModuleInfo_18;
  MR_String FunctorConsIdStr_19;
  MR_String ConsIdStr_20;
  MR_Word FakeTermInstSymName_22;
  MR_Word FakeTermInst_23;
  MR_Word InstColor_24;
  MR_Word Pieces_25;
  MR_Word Var_27;
  MR_Word Var_32;
  MR_Word Var_34;
  MR_Word Var_37;
  MR_Word Var_38;
  MR_String Var_39;
  MR_Word Var_40;
  MR_Word Var_43;
  MR_Word Var_44;
  MR_Word Var_54;
  MR_Word Var_55;
  MR_Word Var_56;
  MR_Word Var_57;
  MR_String Var_58;
  MR_Word Var_60;
  MR_Word Var_61;
  MR_Word Var_63;
  MR_Word Var_68;
  MR_Word Var_69;
  MR_Word Var_70;
  MR_Word Var_73;
  MR_Word Var_78;

  Preamble_15 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_8);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_8, &Context_16);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_8, &VarTable_17);
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_8, &ModuleInfo_18);
  {
    Var_27 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_27, 0) = ((MR_Box) (VarTable_17));
  }
  FunctorConsIdStr_19 = hlds__hlds_out__hlds_out_util__functor_cons_id_to_string_5_f_0(ModuleInfo_18, Var_27, (MR_Integer) 0, ConsId_10, ArgVars_11);
  ConsIdStr_20 = parse_tree__parse_tree_out_cons_id__mercury_cons_id_to_string_3_f_0((MR_Integer) 0, (MR_Integer) 1, ConsId_10);
  {
    FakeTermInstSymName_22 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, FakeTermInstSymName_22, 0) = ((MR_Box) (&check_hlds__mode_errors_scalar_common_4[3]));
    MR_hl_field(1, FakeTermInstSymName_22, 1) = ((MR_Box) (ConsIdStr_20));
  }
  {
    Var_32 = (MR_Word) MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_32, 0) = ((MR_Box) (FakeTermInstSymName_22));
    MR_hl_field(0, Var_32, 1) = ((MR_Box) (ArgInsts_13));
  }
  {
    FakeTermInst_23 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, FakeTermInst_23, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, FakeTermInst_23, 1) = ((MR_Box) (Var_32));
  }
  InstColor_24 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0]));
  Var_39 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_17, X_9);
  {
    Var_38 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_38, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_38, 1) = ((MR_Box) (Var_39));
  }
  {
    Var_44 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_44, 0) = ((MR_Box) ((MR_Unsigned) 10U));
    MR_hl_field(3, Var_44, 1) = ((MR_Box) (FunctorConsIdStr_19));
  }
  {
    Var_43 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_43, 0) = ((MR_Box) (Var_44));
    MR_hl_field(1, Var_43, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[28])));
  }
  {
    Var_40 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_40, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[23])));
    MR_hl_field(1, Var_40, 1) = ((MR_Box) (Var_43));
  }
  {
    Var_37 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_37, 0) = ((MR_Box) (Var_38));
    MR_hl_field(1, Var_37, 1) = ((MR_Box) (Var_40));
  }
  {
    Var_34 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_34, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[22])));
    MR_hl_field(1, Var_34, 1) = ((MR_Box) (Var_37));
  }
  Var_58 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_17, X_9);
  {
    Var_57 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_57, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_57, 1) = ((MR_Box) (Var_58));
  }
  {
    Var_56 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_56, 0) = ((MR_Box) (Var_57));
    MR_hl_field(1, Var_56, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_55 = parse_tree__error_spec__color_as_subject_1_f_0(Var_56);
  Var_61 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_8, InstColor_24, InstX_12, (MR_String) ",");
  {
    Var_70 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_70, 0) = ((MR_Box) (Var_44));
    MR_hl_field(1, Var_70, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_69 = parse_tree__error_spec__color_as_subject_1_f_0(Var_70);
  Var_73 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_8, InstColor_24, FakeTermInst_23, (MR_String) ".");
  Var_68 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_69, Var_73);
  Var_63 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[60])), Var_68);
  Var_60 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_61, Var_63);
  Var_54 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_55, Var_60);
  Pieces_25 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_34, Var_54);
  Var_78 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_15, Pieces_25);
  {
    Spec_14 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_14, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unify_var_functor_to_spec\'/6"));
    MR_hl_field(0, Spec_14, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_14, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_14, 3) = ((MR_Box) (Context_16));
    MR_hl_field(0, Spec_14, 4) = ((MR_Box) (Var_78));
  }
  return Spec_14;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_poly_to_spec_3_f_0(
  MR_Word ModeInfo_5,
  MR_Word Var_6,
  MR_Word VarInst_7)
{
  MR_Word Spec_8;
  MR_Word Preamble_9;
  MR_Word Context_10;
  MR_Word VarTable_11;
  MR_Word ExpectedInstPieces_12;
  MR_Word MainPieces_13;
  MR_Word Var_16;
  MR_Word Var_21;
  MR_Word Var_26;
  MR_Word Var_43;
  MR_Word Var_44;
  MR_Word Var_45;
  MR_Word Var_46;
  MR_String Var_47;
  MR_Word Var_49;
  MR_Word Var_50;
  MR_Word Var_54;
  MR_Word Var_59;
  MR_Word Var_87;
  MR_Word Var_88;
  MR_Word Var_89;
  MR_Word Var_90;
  MR_Word Var_91;

  Preamble_9 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_5);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_5, &Context_10);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_5, &VarTable_11);
  Var_16 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[32])));
  Var_26 = parse_tree__error_spec__color_as_correct_1_f_0((MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[37])));
  Var_21 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[34])), Var_26);
  ExpectedInstPieces_12 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_16, Var_21);
  Var_47 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_11, Var_6);
  {
    Var_46 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_46, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_46, 1) = ((MR_Box) (Var_47));
  }
  {
    Var_45 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_45, 0) = ((MR_Box) (Var_46));
    MR_hl_field(1, Var_45, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_44 = parse_tree__error_spec__color_as_subject_1_f_0(Var_45);
  Var_50 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_5, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[2])), VarInst_7, (MR_String) ",");
  Var_59 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ExpectedInstPieces_12, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  Var_54 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[44])), Var_59);
  Var_49 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_50, Var_54);
  Var_43 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_44, Var_49);
  MainPieces_13 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[42])), Var_43);
  Var_91 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_9, MainPieces_13);
  {
    Var_90 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Var_90, 0) = ((MR_Box) (Var_91));
  }
  {
    Var_89 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_89, 0) = ((MR_Box) (Var_90));
    MR_hl_field(1, Var_89, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[578])));
  }
  {
    Var_88 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Var_88, 0) = ((MR_Box) (Context_10));
    MR_hl_field(2, Var_88, 1) = ((MR_Box) (Var_89));
  }
  {
    Var_87 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_87, 0) = ((MR_Box) (Var_88));
    MR_hl_field(1, Var_87, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  {
    Spec_8 = (MR_Word) MR_mkword(2, MR_new_object(MR_Word, (4 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(2, Spec_8, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unify_var_poly_to_spec\'/3"));
    MR_hl_field(2, Spec_8, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(2, Spec_8, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(2, Spec_8, 3) = ((MR_Box) (Var_87));
  }
  return Spec_8;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_error_unify_var_var_to_spec_5_f_0(
  MR_Word ModeInfo_7,
  MR_Word X_8,
  MR_Word Y_9,
  MR_Word InstX_10,
  MR_Word InstY_11)
{
  MR_Word Spec_12;
  MR_Word Preamble_13;
  MR_Word Context_14;
  MR_Word VarTable_15;
  MR_Word Pieces_16;
  MR_Word Var_18;
  MR_Word Var_21;
  MR_Word Var_22;
  MR_String Var_23;
  MR_Word Var_24;
  MR_Word Var_27;
  MR_Word Var_28;
  MR_String Var_29;
  MR_Word Var_39;
  MR_Word Var_40;
  MR_Word Var_41;
  MR_Word Var_42;
  MR_String Var_43;
  MR_Word Var_45;
  MR_Word Var_46;
  MR_Word Var_50;
  MR_Word Var_55;
  MR_Word Var_56;
  MR_Word Var_57;
  MR_Word Var_58;
  MR_String Var_59;
  MR_Word Var_61;
  MR_Word Var_68;

  Preamble_13 = check_hlds__mode_errors__mode_info_context_preamble_1_f_0(ModeInfo_7);
  check_hlds__mode_info__mode_info_get_context_2_p_0(ModeInfo_7, &Context_14);
  check_hlds__mode_info__mode_info_get_var_table_2_p_0(ModeInfo_7, &VarTable_15);
  Var_23 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, X_8);
  {
    Var_22 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_22, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_22, 1) = ((MR_Box) (Var_23));
  }
  Var_29 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, Y_9);
  {
    Var_28 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_28, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_28, 1) = ((MR_Box) (Var_29));
  }
  {
    Var_27 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_27, 0) = ((MR_Box) (Var_28));
    MR_hl_field(1, Var_27, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[28])));
  }
  {
    Var_24 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_24, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[23])));
    MR_hl_field(1, Var_24, 1) = ((MR_Box) (Var_27));
  }
  {
    Var_21 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_21, 0) = ((MR_Box) (Var_22));
    MR_hl_field(1, Var_21, 1) = ((MR_Box) (Var_24));
  }
  {
    Var_18 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_18, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[22])));
    MR_hl_field(1, Var_18, 1) = ((MR_Box) (Var_21));
  }
  Var_43 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, X_8);
  {
    Var_42 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_42, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_42, 1) = ((MR_Box) (Var_43));
  }
  {
    Var_41 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_41, 0) = ((MR_Box) (Var_42));
    MR_hl_field(1, Var_41, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_40 = parse_tree__error_spec__color_as_subject_1_f_0(Var_41);
  Var_46 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_7, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0])), InstX_10, (MR_String) ",");
  Var_59 = parse_tree__parse_tree_out_term__mercury_var_to_name_only_2_f_0(VarTable_15, Y_9);
  {
    Var_58 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_58, 0) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(3, Var_58, 1) = ((MR_Box) (Var_59));
  }
  {
    Var_57 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_57, 0) = ((MR_Box) (Var_58));
    MR_hl_field(1, Var_57, 1) = ((MR_Box) ((MR_Unsigned) 0U));
  }
  Var_56 = parse_tree__error_spec__color_as_subject_1_f_0(Var_57);
  Var_61 = check_hlds__mode_errors__has_instantiatedness_4_f_0(ModeInfo_7, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_4[0])), InstY_11, (MR_String) ".");
  Var_55 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_56, Var_61);
  Var_50 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[30])), Var_55);
  Var_45 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_46, Var_50);
  Var_39 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_40, Var_45);
  Pieces_16 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_18, Var_39);
  Var_68 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Preamble_13, Pieces_16);
  {
    Spec_12 = (MR_Word) MR_new_object(MR_Word, (5 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, Spec_12, 0) = ((MR_Box) ((MR_String) "function \140check_hlds.mode_errors.mode_error_unify_var_var_to_spec\'/5"));
    MR_hl_field(0, Spec_12, 1) = ((MR_Box) ((MR_Unsigned) 0U));
    MR_hl_field(0, Spec_12, 2) = ((MR_Box) (MR_mkword(2, &check_hlds__mode_errors_scalar_common_4[1])));
    MR_hl_field(0, Spec_12, 3) = ((MR_Box) (Context_14));
    MR_hl_field(0, Spec_12, 4) = ((MR_Box) (Var_68));
  }
  return Spec_12;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__mode_info_context_preamble_1_f_0(
  MR_Word ModeInfo_3)
{
  MR_bool succeeded;
  MR_Word Pieces_4;
  MR_Word ModuleInfo_5;
  MR_Word PredId_6;
  MR_Integer ProcId_7;
  MR_Word PredInfo_8;
  MR_Word ProcInfo_9;
  MR_Word PredOrigin_10;
  MR_String Name_17;
  MR_Word ExtraMethodPieces_18;
  MR_Word PredOrFunc_19;
  MR_Word InstVarSet_20;
  MR_Word SymName_21;
  MR_Word PredMarkers_22;
  MR_Word Modes0_23;
  MR_Word Modes_24;
  MR_String ModeSubDeclStr_26;
  MR_Word ModeContext_27;
  MR_Word ModeContextPieces_28;
  MR_Word Var_39;
  MR_Word Var_40;
  MR_Word Var_41;
  MR_Word Var_42;
  MR_Word MethodSymName_15;
  MR_Word OriginUser_11;
  MR_Word PFMethodSymNameArity_12;

  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_3, &ModuleInfo_5);
  check_hlds__mode_info__mode_info_get_pred_id_2_p_0(ModeInfo_3, &PredId_6);
  check_hlds__mode_info__mode_info_get_proc_id_2_p_0(ModeInfo_3, &ProcId_7);
  hlds__hlds_module__module_info_pred_proc_info_5_p_0(ModuleInfo_5, PredId_6, ProcId_7, &PredInfo_8, &ProcInfo_9);
  hlds__hlds_pred__pred_info_get_origin_2_p_0(PredInfo_8, &PredOrigin_10);
  succeeded = ((MR_tag((MR_Word) PredOrigin_10)) == (MR_Integer) 0);
  if (succeeded)
  {
    OriginUser_11 = ((MR_Word) ((MR_hl_field(0, PredOrigin_10, 0))));
    succeeded = ((((MR_tag((MR_Word) OriginUser_11)) == (MR_Integer) 3)) && ((((MR_Integer) ((MR_hl_field(3, OriginUser_11, 0)))) == (MR_Integer) 0)));
    if (succeeded)
    {
      PFMethodSymNameArity_12 = ((MR_Word) ((MR_hl_field(3, OriginUser_11, 1))));
      MethodSymName_15 = ((MR_Word) ((MR_hl_field(0, PFMethodSymNameArity_12, 1))));
      succeeded = MR_TRUE;
    }
  }
  if (succeeded)
  {
    Name_17 = mdbcomp__sym_name__unqualify_name_1_f_0(MethodSymName_15);
    ExtraMethodPieces_18 = (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[573]));
  }
  else
  {
    Name_17 = hlds__hlds_pred__pred_info_name_1_f_0(PredInfo_8);
    ExtraMethodPieces_18 = (MR_Word) ((MR_Unsigned) 0U);
  }
  PredOrFunc_19 = hlds__hlds_pred__pred_info_is_pred_or_func_1_f_0(PredInfo_8);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_3, &InstVarSet_20);
  {
    SymName_21 = (MR_Word) MR_new_object(MR_Word, (1 * sizeof(MR_Word)), NULL, NULL);
    MR_hl_field(0, SymName_21, 0) = ((MR_Box) (Name_17));
  }
  hlds__hlds_pred__pred_info_get_markers_2_p_0(PredInfo_8, &PredMarkers_22);
  hlds__hlds_proc_util__proc_info_declared_argmodes_2_p_0(ProcInfo_9, &Modes0_23);
  parse_tree__prog_mode__strip_module_names_from_mode_list_4_p_0((MR_Integer) 0, (MR_Integer) 0, Modes0_23, &Modes_24);
  ModeSubDeclStr_26 = parse_tree__parse_tree_out_pred_decl__mercury_mode_subdecl_to_string_6_f_0((MR_Integer) 1, PredOrFunc_19, InstVarSet_20, SymName_21, Modes_24, (MR_Word) ((MR_Unsigned) 0U));
  check_hlds__mode_info__mode_info_get_mode_context_2_p_0(ModeInfo_3, &ModeContext_27);
  switch (MR_tag((MR_Word) ModeContext_27)) {
    default: /*NOTREACHED*/ MR_assert(0);
    case (MR_Integer) 0:
      ModeContextPieces_28 = (MR_Word) ((MR_Unsigned) 0U);
      break;
    case (MR_Integer) 1:
      {
        MR_Word ModeCallId_50 = ((MR_Word) ((MR_hl_field(1, ModeContext_27, 0))));
        MR_Integer ArgNum_51 = ((MR_Integer) ((MR_hl_field(1, ModeContext_27, 1))));
        MR_Word CallId_52;
        MR_Word CalleePieces_53;
        MR_Word Var_63;

        CallId_52 = check_hlds__modecheck_util__mode_call_id_to_call_id_2_f_0(ModeInfo_3, ModeCallId_50);
        CalleePieces_53 = hlds__hlds_error_util__call_arg_id_to_pieces_4_f_0((MR_Integer) 1, CallId_52, ArgNum_51, PredMarkers_22);
        Var_63 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), CalleePieces_53, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[384])));
        ModeContextPieces_28 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[576])), Var_63);
      }
      break;
    case (MR_Integer) 2:
      {
        MR_Word Var_70;
        MR_Word ModeCallId_74 = ((MR_Word) ((MR_hl_field(2, ModeContext_27, 0))));
        MR_Word CallId_75;
        MR_Word CalleePieces_76;

        CallId_75 = check_hlds__modecheck_util__mode_call_id_to_call_id_2_f_0(ModeInfo_3, ModeCallId_74);
        CalleePieces_76 = hlds__hlds_error_util__call_id_to_pieces_2_f_0((MR_Integer) 1, CallId_75);
        Var_70 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), CalleePieces_76, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[384])));
        ModeContextPieces_28 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[576])), Var_70);
      }
      break;
    case (MR_Integer) 3:
      {
        MR_Word UnifyContext_54 = ((MR_Word) ((MR_hl_field(3, ModeContext_27, 0))));
        MR_Word Var_56;
        MR_Word _LastContextWord_57;

        hlds__hlds_error_util__unify_context_first_to_pieces_6_p_0((MR_Integer) 1, &Var_56, UnifyContext_54, &_LastContextWord_57, (MR_Word) ((MR_Unsigned) 0U), &ModeContextPieces_28);
      }
      break;
  }
  {
    Var_42 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_42, 0) = ((MR_Box) ((MR_Unsigned) 10U));
    MR_hl_field(3, Var_42, 1) = ((MR_Box) (ModeSubDeclStr_26));
  }
  {
    Var_41 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_41, 0) = ((MR_Box) (Var_42));
    MR_hl_field(1, Var_41, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[384])));
  }
  Var_40 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), Var_41, ModeContextPieces_28);
  Var_39 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), ExtraMethodPieces_18, Var_40);
  Pieces_4 = mercury__list__f_43_43_2_f_0((MR_Word) (&parse_tree__error_spec__parse_tree__error_spec__type_ctor_info_format_piece_0), (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[575])), Var_39);
  return Pieces_4;
}

static MR_Word MR_CALL 
check_hlds__mode_errors__has_instantiatedness_4_f_0(
  MR_Word ModeInfo_6,
  MR_Word MaybeColor_7,
  MR_Word Inst_8,
  MR_String Suffix_9)
{
  MR_Word Pieces_10;
  MR_Word InstPieces0_11;
  MR_Word InstPieces_12;
  MR_Word Var_14;
  MR_Word Var_15;
  MR_Word Var_23;
  MR_Word ModuleInfo_31;
  MR_Word InstVarSet_32;

  {
    Var_15 = (MR_Word) MR_mkword(3, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(3, Var_15, 0) = ((MR_Box) ((MR_Unsigned) 8U));
    MR_hl_field(3, Var_15, 1) = ((MR_Box) (Suffix_9));
  }
  {
    Var_14 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_14, 0) = ((MR_Box) (Var_15));
    MR_hl_field(1, Var_14, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[45])));
  }
  {
    Var_23 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Var_23, 0) = ((MR_Box) (Var_15));
    MR_hl_field(1, Var_23, 1) = ((MR_Box) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[198])));
  }
  check_hlds__mode_info__mode_info_get_module_info_2_p_0(ModeInfo_6, &ModuleInfo_31);
  check_hlds__mode_info__mode_info_get_instvarset_2_p_0(ModeInfo_6, &InstVarSet_32);
  InstPieces0_11 = hlds__error_msg_inst__error_msg_inst_10_f_0(ModuleInfo_31, InstVarSet_32, (MR_Integer) 1, (MR_Word) ((MR_Unsigned) 0U), (MR_Integer) 0, (MR_Word) ((MR_Unsigned) 0U), Var_14, (MR_Word) (MR_mkword(1, &check_hlds__mode_errors_scalar_common_1[196])), Var_23, Inst_8);
  InstPieces_12 = parse_tree__error_spec__maybe_color_pieces_2_f_0(MaybeColor_7, InstPieces0_11);
  {
    Pieces_10 = (MR_Word) MR_mkword(1, MR_new_object(MR_Word, (2 * sizeof(MR_Word)), NULL, NULL));
    MR_hl_field(1, Pieces_10, 0) = ((MR_Box) (MR_mkword(3, &check_hlds__mode_errors_scalar_common_1[370])));
    MR_hl_field(1, Pieces_10, 1) = ((MR_Box) (InstPieces_12));
  }
  return Pieces_10;
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____arg_ok_or_not_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____arg_ok_or_not_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____arg_ok_or_not_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____arg_ok_or_not_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____argnum_var_type_inst_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____argnum_var_type_inst_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____argnum_var_type_inst_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____argnum_var_type_inst_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____bound_functor_cons_id_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____bound_functor_cons_id_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____bound_functor_cons_id_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____bound_functor_cons_id_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____cannot_create_reason_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____cannot_create_reason_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____cannot_create_reason_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____cannot_create_reason_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____coerce_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____coerce_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_reason_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____coerce_error_reason_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_reason_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____coerce_error_reason_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____coerce_error_term_path_step_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____coerce_error_term_path_step_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____coerce_error_term_path_step_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____coerce_error_term_path_step_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____delayed_goal_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____delayed_goal_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____delayed_goal_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____delayed_goal_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____exact_or_not_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____exact_or_not_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____exact_or_not_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____exact_or_not_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____final_inst_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____final_inst_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____final_inst_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____final_inst_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ground_or_nonground_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____ground_or_nonground_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____ground_or_nonground_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____ground_or_nonground_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____higher_order_mismatch_info_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____higher_order_mismatch_info_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____higher_order_mismatch_info_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____higher_order_mismatch_info_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____match_what_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____match_what_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____match_what_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____match_what_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_is_disjunctive_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____maybe_is_disjunctive_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_is_disjunctive_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____maybe_is_disjunctive_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____maybe_some_extra_arg_is_bad_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____maybe_some_extra_arg_is_bad_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____maybe_some_extra_arg_is_bad_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____maybe_some_extra_arg_is_bad_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____merge_context_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____merge_context_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____merge_context_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____merge_context_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____merge_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____merge_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____merge_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____merge_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____mode_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____mode_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_info_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____mode_error_info_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_info_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____mode_error_info_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_error_unify_rhs_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____mode_error_unify_rhs_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_error_unify_rhs_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____mode_error_unify_rhs_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_mismatch_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____mode_mismatch_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_mismatch_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____mode_mismatch_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_warning_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____mode_warning_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_warning_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____mode_warning_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____mode_warning_info_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____mode_warning_info_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____mode_warning_info_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____mode_warning_info_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____negated_context_desc_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____negated_context_desc_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____negated_context_desc_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____negated_context_desc_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____ok_or_not_map_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____ok_or_not_map_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____ok_or_not_map_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____ok_or_not_map_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____pred_id_var_multimode_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____pred_id_var_multimode_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____pred_id_var_multimode_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____pred_id_var_multimode_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____report_inst_how_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____report_inst_how_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____report_inst_how_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____report_inst_how_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____schedule_culprit_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____schedule_culprit_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____schedule_culprit_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____schedule_culprit_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

static MR_bool MR_CALL 
check_hlds__mode_errors____Unify____var_multimode_error_0_0_10001(
  MR_Box wrapper_arg_1,
  MR_Box wrapper_arg_2)
{
  MR_bool succeeded;

  succeeded = check_hlds__mode_errors____Unify____var_multimode_error_0_0(((MR_Word) (wrapper_arg_1)), ((MR_Word) (wrapper_arg_2)));
  return succeeded;
}

static void MR_CALL 
check_hlds__mode_errors____Compare____var_multimode_error_0_0_10001(
  MR_Box * wrapper_arg_1,
  MR_Box wrapper_arg_2,
  MR_Box wrapper_arg_3)
{
  MR_Word conv0_HeadVar__1_1;

  check_hlds__mode_errors____Compare____var_multimode_error_0_0(&conv0_HeadVar__1_1, ((MR_Word) (wrapper_arg_2)), ((MR_Word) (wrapper_arg_3)));
  *wrapper_arg_1 = ((MR_Box) (conv0_HeadVar__1_1));
}

void mercury__check_hlds__mode_errors__init(void)
{
}

void mercury__check_hlds__mode_errors__init_type_tables(void)
{
  static MR_bool initialised = MR_FALSE;
  if (initialised) return;
  initialised = MR_TRUE;

  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_arg_ok_or_not_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_argnum_var_type_inst_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_bound_functor_cons_id_error_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_cannot_create_reason_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_reason_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_coerce_error_term_path_step_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_delayed_goal_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_exact_or_not_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_final_inst_error_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_ground_or_nonground_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_higher_order_mismatch_info_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_match_what_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_is_disjunctive_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_maybe_some_extra_arg_is_bad_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_context_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_merge_error_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_info_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_error_unify_rhs_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_mismatch_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_warning_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_mode_warning_info_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_negated_context_desc_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_ok_or_not_map_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_pred_id_var_multimode_error_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_report_inst_how_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_schedule_culprit_0);
  MR_register_type_ctor_info(&check_hlds__mode_errors__check_hlds__mode_errors__type_ctor_info_var_multimode_error_0);
}

void mercury__check_hlds__mode_errors__init_debugger(void)
{
  MR_fatal_error("debugger initialization in MLDS grade");
}

// Ensure everything is compiled with the same grade.
const char *mercury__check_hlds__mode_errors__grade_check(void)
{
  return &MR_GRADE_VAR;
}

// :- end_module check_hlds.mode_errors.
