:- module version_array.
:- use_module builtin, exception, int, list, pretty_printer, private_builtin, string, table_builtin.
:- type version_array.version_array(T)
	--->	version_array(T).
:- pragma foreign_type(c, version_array.version_array(T), "struct ML_va *")
	where	equality is (version_array.eq_version_array),
		comparison is (version_array.cmp_version_array).
:- pragma foreign_type(java, version_array.version_array(T), "jmercury.version_array.ML_va")
	where	equality is (version_array.eq_version_array),
		comparison is (version_array.cmp_version_array).
:- pragma foreign_type(csharp, version_array.version_array(T), "version_array.ML_va")
	where	equality is (version_array.eq_version_array),
		comparison is (version_array.cmp_version_array).
:- pragma foreign_import_module("C", version_array).
:- pragma foreign_import_module("C#", version_array).
:- pragma foreign_import_module("Java", version_array).
:- pragma foreign_import_module("C", table_builtin).
:- pragma foreign_import_module("IL", table_builtin).
:- pragma foreign_import_module("C", table_builtin).
:- pragma foreign_import_module("IL", table_builtin).
:- pragma foreign_import_module("C", io).
:- pragma foreign_import_module("C#", io).
:- pragma foreign_import_module("Java", io).
:- pragma foreign_import_module("IL", io).
:- pragma foreign_import_module("Erlang", io).
:- pragma foreign_import_module("C", io).
:- pragma foreign_import_module("C#", io).
:- pragma foreign_import_module("Java", io).
:- pragma foreign_import_module("IL", io).
:- pragma foreign_import_module("Erlang", io).
:- pragma foreign_import_module("C", time).
:- pragma foreign_import_module("C", string).
:- pragma foreign_import_module("C", bitmap).
:- pragma foreign_import_module("C#", bitmap).
:- pragma foreign_import_module("Java", bitmap).
:- pragma foreign_import_module("IL", bitmap).
:- pragma foreign_import_module("Erlang", bitmap).
:- pragma foreign_import_module("C", bitmap).
:- pragma foreign_import_module("C#", bitmap).
:- pragma foreign_import_module("Java", bitmap).
:- pragma foreign_import_module("IL", bitmap).
:- pragma foreign_import_module("Erlang", bitmap).
:- pragma foreign_import_module("C", time).
:- pragma foreign_import_module("C#", time).
:- pragma foreign_import_module("Java", time).
:- pragma foreign_import_module("IL", time).
:- pragma foreign_import_module("Erlang", time).
:- pragma foreign_import_module("C", time).
:- pragma foreign_import_module("C#", time).
:- pragma foreign_import_module("Java", time).
:- pragma foreign_import_module("IL", time).
:- pragma foreign_import_module("Erlang", time).
:- pragma foreign_import_module("C#", rtti_implementation).
:- pragma foreign_import_module("Java", rtti_implementation).
:- pragma foreign_import_module("C#", rtti_implementation).
:- pragma foreign_import_module("Java", rtti_implementation).
:- pragma foreign_import_module("C", stm_builtin).
:- pragma foreign_import_module("C", stm_builtin).
:- pragma foreign_import_module("C", store).
:- pragma foreign_import_module("C#", store).
:- pragma foreign_import_module("Java", store).
:- pragma foreign_import_module("IL", store).
:- pragma foreign_import_module("Erlang", store).
:- pragma foreign_import_module("C", store).
:- pragma foreign_import_module("C#", store).
:- pragma foreign_import_module("Java", store).
:- pragma foreign_import_module("IL", store).
:- pragma foreign_import_module("Erlang", store).
:- pragma foreign_import_module("C", array).
:- pragma foreign_import_module("C#", array).
:- pragma foreign_import_module("Java", array).
:- pragma foreign_import_module("IL", array).
:- pragma foreign_import_module("Erlang", array).
:- pragma foreign_import_module("C", array).
:- pragma foreign_import_module("C#", array).
:- pragma foreign_import_module("Java", array).
:- pragma foreign_import_module("IL", array).
:- pragma foreign_import_module("Erlang", array).
:- func version_array.do_foldl_func((func(T1_1, T2_2) = T2_2), version_array.version_array(T1_1), T2_2, int, int) = T2_2.
:- mode version_array.do_foldl_func((builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.in)) = (builtin.out) is det.
:- pred version_array.do_foldl_pred(pred(T1_1, T2_2, T2_2), version_array.version_array(T1_1), int, int, T2_2, T2_2).
:- mode version_array.do_foldl_pred((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out)) is det.
:- mode version_array.do_foldl_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)) is det.
:- mode version_array.do_foldl_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)) is det.
:- mode version_array.do_foldl_pred((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out)) is semidet.
:- mode version_array.do_foldl_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)) is semidet.
:- mode version_array.do_foldl_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)) is semidet.
:- pred version_array.do_foldl2(pred(T1_1, T2_2, T2_2, T3_3, T3_3), version_array.version_array(T1_1), int, int, T2_2, T2_2, T3_3, T3_3).
:- mode version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det.
:- mode version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det.
:- mode version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det.
:- mode version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet.
:- mode version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet.
:- mode version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet.
:- func version_array.do_foldr_func((func(T1_1, T2_2) = T2_2), version_array.version_array(T1_1), T2_2, int) = T2_2.
:- mode version_array.do_foldr_func((builtin.in), (builtin.in), (builtin.in), (builtin.in)) = (builtin.out) is det.
:- pred version_array.do_foldr_pred(pred(T1_1, T2_2, T2_2), version_array.version_array(T1_1), int, T2_2, T2_2).
:- mode version_array.do_foldr_pred((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out)) is det.
:- mode version_array.do_foldr_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)) is det.
:- mode version_array.do_foldr_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)) is det.
:- mode version_array.do_foldr_pred((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out)) is semidet.
:- mode version_array.do_foldr_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)) is semidet.
:- mode version_array.do_foldr_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)) is semidet.
:- pred version_array.do_foldr2(pred(T1_1, T2_2, T2_2, T3_3, T3_3), version_array.version_array(T1_1), int, T2_2, T2_2, T3_3, T3_3).
:- mode version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det.
:- mode version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det.
:- mode version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det.
:- mode version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet.
:- mode version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet.
:- mode version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet.
:- pred version_array.do_all_true((pred T_1), int, int, version_array.version_array(T_1)).
:- mode version_array.do_all_true(builtin.in((pred((builtin.in)) is semidet)), (builtin.in), (builtin.in), (builtin.in)) is semidet.
:- pred version_array.do_all_false((pred T_1), int, int, version_array.version_array(T_1)).
:- mode version_array.do_all_false(builtin.in((pred((builtin.in)) is semidet)), (builtin.in), (builtin.in), (builtin.in)) is semidet.
:- pred version_array.eq_version_array(version_array.version_array(T_1), version_array.version_array(T_1)).
:- mode version_array.eq_version_array((builtin.in), (builtin.in)) is semidet.
:- pragma terminates((version_array.eq_version_array)/2).
:- pred version_array.cmp_version_array(builtin.comparison_result, version_array.version_array(T_1), version_array.version_array(T_1)).
:- mode version_array.cmp_version_array((builtin.uo), (builtin.in), (builtin.in)) is det.
:- pragma terminates((version_array.cmp_version_array)/3).
:- pragma foreign_proc("C", version_array.empty = (VA :: (builtin.out)), [will_not_call_mercury, thread_safe, not_tabled_for_io, promise_pure, will_not_modify_trail, doesnt_affect_liveness], "
    MR_Word array;

    MR_incr_hp_type_msg(VA, struct ML_va,
        MR_ALLOC_ID, \"version_array.version_array/1\");
    MR_incr_hp_msg(array, 1,
        MR_ALLOC_ID, \"version_array.version_array/1\");

    VA->index            = -1;
    VA->value            = (MR_Word) NULL;
    VA->rest.array       = (MR_ArrayPtr) array;
    VA->rest.array->size = 0;
    VA->prev             = MR_NULL_WEAK_PTR;

#ifdef MR_THREAD_SAFE
    MR_incr_hp_type_msg(VA->lock, MercuryLock, MR_ALLOC_ID, NULL);
    pthread_mutex_init(VA->lock, MR_MUTEX_ATTR);
#endif
").
:- pragma foreign_proc("C", version_array.unsafe_empty = (VA :: (builtin.out)), [will_not_call_mercury, thread_safe, not_tabled_for_io, promise_pure, will_not_modify_trail, doesnt_affect_liveness], "
    MR_Word array;

    MR_incr_hp_type_msg(VA, struct ML_va,
        MR_ALLOC_ID, \"version_array.version_array/1\");
    MR_incr_hp_msg(array, 1,
        MR_ALLOC_ID, \"version_array.version_array/1\");

    VA->index            = -1;
    VA->value            = (MR_Word) NULL;
    VA->rest.array       = (MR_ArrayPtr) array;
    VA->rest.array->size = 0;
    VA->prev             = MR_NULL_WEAK_PTR;

#ifdef MR_THREAD_SAFE
    VA->lock             = NULL;
#endif
").
version_array.unsafe_new(N_4, X_5) = HeadVar__3_3 :-
    HeadVar__3_3 = version_array.unsafe_init(N_4, X_5).
version_array.from_list(Xs_3) = HeadVar__2_2 :-
    HeadVar__2_2 = version_array.version_array(Xs_3).
:- pragma inline((version_array.elem)/2).
version_array.elem(I_5, VA_4) = HeadVar__3_3 :-
    HeadVar__3_3 = version_array.lookup(VA_4, I_5).
:- pragma inline((version_array.'elem :=')/3).
version_array.'elem :='(I_6, VA0_5, X_7) = VA_8 :-
    version_array.set(I_6, X_7, VA0_5, VA_8).
:- pragma foreign_proc("C", version_array.size(VA :: (builtin.in)) = (N :: (builtin.out)), [will_not_call_mercury, thread_safe, not_tabled_for_io, promise_pure, will_not_modify_trail, doesnt_affect_liveness], "
    N = ML_va_size_dolock(VA);
").
version_array.max(VA_3) = HeadVar__2_2 :-
    HeadVar__2_2 = int.(V_4 - V_5),
    V_4 = version_array.size(VA_3),
    V_5 = 1 : int.
version_array.is_empty(VA_2) :-
    V_3 = version_array.size(VA_2),
    V_3 = 0 : int.
:- pragma foreign_proc("C", version_array.resize(VA0 :: (builtin.in), N :: (builtin.in), X :: (builtin.in)) = (VA :: (builtin.out)), [will_not_call_mercury, thread_safe, not_tabled_for_io, promise_pure, will_not_modify_trail, doesnt_affect_liveness], "
    VA = ML_va_resize_dolock(VA0, N, X, MR_ALLOC_ID);
").
version_array.resize(N_5, X_6, VA_7, HeadVar__4_4) :-
    HeadVar__4_4 = version_array.resize(VA_7, N_5, X_6).
version_array.list(VA_3) = HeadVar__2_2 :-
    HeadVar__2_2 = version_array.foldr(V_4, VA_3, V_5),
    V_4 = list.cons : (func(T_1, list.list(T_1)) = list.list(T_1)),
    V_5 = list.[] : list.list(T_1).
version_array.to_list(VA_3) = HeadVar__2_2 :-
    HeadVar__2_2 = version_array.list(VA_3).
version_array.foldl(F_5, VA_6, Acc_7) = HeadVar__4_4 :-
    HeadVar__4_4 = version_array.do_foldl_func(F_5, VA_6, Acc_7, V_8, V_9),
    V_8 = 0 : int,
    V_9 = version_array.size(VA_6).
version_array.foldl(P_5, VA_6, STATE_VARIABLE_Acc_0_8, STATE_VARIABLE_Acc_9) :-
    V_10 = 0 : int,
    V_11 = version_array.size(VA_6),
    version_array.do_foldl_pred(P_5, VA_6, V_10, V_11, STATE_VARIABLE_Acc_0_8, STATE_VARIABLE_Acc_9).
version_array.foldl2(P_7, VA_8, STATE_VARIABLE_Acc1_0_11, STATE_VARIABLE_Acc1_12, STATE_VARIABLE_Acc2_0_13, STATE_VARIABLE_Acc2_14) :-
    V_15 = 0 : int,
    V_16 = version_array.size(VA_8),
    version_array.do_foldl2(P_7, VA_8, V_15, V_16, STATE_VARIABLE_Acc1_0_11, STATE_VARIABLE_Acc1_12, STATE_VARIABLE_Acc2_0_13, STATE_VARIABLE_Acc2_14).
version_array.foldr(F_5, VA_6, Acc_7) = HeadVar__4_4 :-
    HeadVar__4_4 = version_array.do_foldr_func(F_5, VA_6, Acc_7, V_8),
    V_8 = version_array.max(VA_6).
version_array.foldr(P_5, VA_6, STATE_VARIABLE_Acc_0_8, STATE_VARIABLE_Acc_9) :-
    V_10 = version_array.max(VA_6),
    version_array.do_foldr_pred(P_5, VA_6, V_10, STATE_VARIABLE_Acc_0_8, STATE_VARIABLE_Acc_9).
version_array.foldr2(P_7, VA_8, STATE_VARIABLE_Acc1_0_11, STATE_VARIABLE_Acc1_12, STATE_VARIABLE_Acc2_0_13, STATE_VARIABLE_Acc2_14) :-
    V_15 = version_array.max(VA_8),
    version_array.do_foldr2(P_7, VA_8, V_15, STATE_VARIABLE_Acc1_0_11, STATE_VARIABLE_Acc1_12, STATE_VARIABLE_Acc2_0_13, STATE_VARIABLE_Acc2_14).
version_array.all_true(Pred_3, VA_4) :-
    V_5 = 0 : int,
    V_6 = version_array.size(VA_4),
    version_array.do_all_true(Pred_3, V_5, V_6, VA_4).
version_array.all_false(Pred_3, VA_4) :-
    V_5 = 0 : int,
    V_6 = version_array.size(VA_4),
    version_array.do_all_false(Pred_3, V_5, V_6, VA_4).
:- pragma foreign_proc("C", version_array.unsafe_rewind(VA0 :: (builtin.in)) = (VA :: (builtin.out)), [will_not_call_mercury, thread_safe, not_tabled_for_io, promise_pure, will_not_modify_trail, doesnt_affect_liveness], "
    VA = ML_va_rewind_dolock(VA0);
").
version_array.unsafe_rewind(VA_3, HeadVar__2_2) :-
    HeadVar__2_2 = version_array.unsafe_rewind(VA_3).
version_array.do_foldl_func(F_7, VA_8, Acc_9, Lo_10, Hi_11) = HeadVar__6_6 :-
    (if
      int.(Lo_10 < Hi_11)
    then
      HeadVar__6_6 = version_array.do_foldl_func(F_7, VA_8, V_12, V_14, Hi_11),
      V_12 = apply(F_7, V_13, Acc_9),
      V_13 = version_array.lookup(VA_8, Lo_10),
      V_14 = int.(Lo_10 + V_15),
      V_15 = 1 : int
    else
      HeadVar__6_6 = Acc_9
    ).
version_array.do_foldl_pred(P_7, VA_8, Lo_9, Hi_10, STATE_VARIABLE_Acc_0_12, STATE_VARIABLE_Acc_13) :-
    (if
      int.(Lo_9 < Hi_10)
    then
      V_14 = version_array.lookup(VA_8, Lo_9),
      call(P_7, V_14, STATE_VARIABLE_Acc_0_12, STATE_VARIABLE_Acc_15_15),
      V_16 = int.(Lo_9 + V_18),
      V_18 = 1 : int,
      version_array.do_foldl_pred(P_7, VA_8, V_16, Hi_10, STATE_VARIABLE_Acc_15_15, STATE_VARIABLE_Acc_13)
    else
      STATE_VARIABLE_Acc_13 = STATE_VARIABLE_Acc_0_12
    ).
version_array.do_foldl2(P_9, VA_10, Lo_11, Hi_12, STATE_VARIABLE_Acc1_0_15, STATE_VARIABLE_Acc1_16, STATE_VARIABLE_Acc2_0_17, STATE_VARIABLE_Acc2_18) :-
    (if
      int.(Lo_11 < Hi_12)
    then
      V_19 = version_array.lookup(VA_10, Lo_11),
      call(P_9, V_19, STATE_VARIABLE_Acc1_0_15, STATE_VARIABLE_Acc1_20_20, STATE_VARIABLE_Acc2_0_17, STATE_VARIABLE_Acc2_21_21),
      V_22 = int.(Lo_11 + V_25),
      V_25 = 1 : int,
      version_array.do_foldl2(P_9, VA_10, V_22, Hi_12, STATE_VARIABLE_Acc1_20_20, STATE_VARIABLE_Acc1_16, STATE_VARIABLE_Acc2_21_21, STATE_VARIABLE_Acc2_18)
    else
      STATE_VARIABLE_Acc2_18 = STATE_VARIABLE_Acc2_0_17,
      STATE_VARIABLE_Acc1_16 = STATE_VARIABLE_Acc1_0_15
    ).
version_array.do_foldr_func(F_6, VA_7, Acc_8, Hi_9) = HeadVar__5_5 :-
    (if
      V_10 = 0 : int,
      int.(V_10 =< Hi_9)
    then
      HeadVar__5_5 = version_array.do_foldr_func(F_6, VA_7, V_11, V_13),
      V_11 = apply(F_6, V_12, Acc_8),
      V_12 = version_array.lookup(VA_7, Hi_9),
      V_13 = int.(Hi_9 - V_14),
      V_14 = 1 : int
    else
      HeadVar__5_5 = Acc_8
    ).
version_array.do_foldr_pred(P_6, VA_7, I_8, STATE_VARIABLE_Acc_0_10, STATE_VARIABLE_Acc_11) :-
    (if
      V_12 = 0 : int,
      int.(I_8 >= V_12)
    then
      V_13 = version_array.lookup(VA_7, I_8),
      call(P_6, V_13, STATE_VARIABLE_Acc_0_10, STATE_VARIABLE_Acc_14_14),
      V_15 = int.(I_8 - V_17),
      V_17 = 1 : int,
      version_array.do_foldr_pred(P_6, VA_7, V_15, STATE_VARIABLE_Acc_14_14, STATE_VARIABLE_Acc_11)
    else
      STATE_VARIABLE_Acc_11 = STATE_VARIABLE_Acc_0_10
    ).
version_array.do_foldr2(P_8, VA_9, I_10, STATE_VARIABLE_Acc1_0_13, STATE_VARIABLE_Acc1_14, STATE_VARIABLE_Acc2_0_15, STATE_VARIABLE_Acc2_16) :-
    (if
      V_17 = 0 : int,
      int.(I_10 >= V_17)
    then
      V_18 = version_array.lookup(VA_9, I_10),
      call(P_8, V_18, STATE_VARIABLE_Acc1_0_13, STATE_VARIABLE_Acc1_19_19, STATE_VARIABLE_Acc2_0_15, STATE_VARIABLE_Acc2_20_20),
      V_21 = int.(I_10 - V_24),
      V_24 = 1 : int,
      version_array.do_foldr2(P_8, VA_9, V_21, STATE_VARIABLE_Acc1_19_19, STATE_VARIABLE_Acc1_14, STATE_VARIABLE_Acc2_20_20, STATE_VARIABLE_Acc2_16)
    else
      STATE_VARIABLE_Acc2_16 = STATE_VARIABLE_Acc2_0_15,
      STATE_VARIABLE_Acc1_14 = STATE_VARIABLE_Acc1_0_13
    ).
version_array.do_all_true(Pred_5, I_6, N_7, VA_8) :-
    (if
      int.(I_6 < N_7)
    then
      Elem_9 = version_array.elem(I_6, VA_8),
      call(Pred_5, Elem_9),
      V_10 = int.(I_6 + V_11),
      V_11 = 1 : int,
      version_array.do_all_true(Pred_5, V_10, N_7, VA_8)
    else
      true
    ).
version_array.do_all_false(Pred_5, I_6, N_7, VA_8) :-
    (if
      int.(I_6 < N_7)
    then
      Elem_9 = version_array.elem(I_6, VA_8),
      \+ (
        call(Pred_5, Elem_9)
      ),
      V_10 = int.(I_6 + V_11),
      V_11 = 1 : int,
      version_array.do_all_false(Pred_5, V_10, N_7, VA_8)
    else
      true
    ).
:- pragma exceptions(function, (version_array.empty), 1, 0, will_not_throw).
:- pragma exceptions(function, (version_array.init), 3, 0, will_not_throw).
:- pragma exceptions(function, (version_array.unsafe_empty), 1, 0, will_not_throw).
:- pragma exceptions(function, (version_array.unsafe_init), 3, 0, will_not_throw).
:- pragma exceptions(function, (version_array.unsafe_new), 3, 0, will_not_throw).
:- pragma exceptions(function, (version_array.version_array), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.from_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.elem), 3, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.lookup), 3, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.'elem :='), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.set), 4, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.size), 2, 0, will_not_throw).
:- pragma exceptions(function, (version_array.max), 2, 0, will_not_throw).
:- pragma exceptions(predicate, (version_array.is_empty), 1, 0, will_not_throw).
:- pragma exceptions(function, (version_array.resize), 4, 0, will_not_throw).
:- pragma exceptions(predicate, (version_array.resize), 4, 0, will_not_throw).
:- pragma exceptions(function, (version_array.list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.to_list), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.foldl), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl), 4, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl), 4, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl), 4, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl), 4, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl), 4, 5, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl2), 6, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl2), 6, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl2), 6, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl2), 6, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl2), 6, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldl2), 6, 5, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.foldr), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr), 4, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr), 4, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr), 4, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr), 4, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr), 4, 5, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr2), 6, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr2), 6, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr2), 6, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr2), 6, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr2), 6, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.foldr2), 6, 5, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.all_true), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.all_false), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.copy), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.unsafe_rewind), 2, 0, will_not_throw).
:- pragma exceptions(predicate, (version_array.unsafe_rewind), 2, 0, will_not_throw).
:- pragma exceptions(function, (version_array.version_array_to_doc), 2, 0, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.do_foldl_func), 6, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl_pred), 6, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl_pred), 6, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl_pred), 6, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl_pred), 6, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl_pred), 6, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl_pred), 6, 5, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl2), 8, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl2), 8, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl2), 8, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl2), 8, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl2), 8, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldl2), 8, 5, may_throw(user_exception)).
:- pragma exceptions(function, (version_array.do_foldr_func), 5, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr_pred), 5, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr_pred), 5, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr_pred), 5, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr_pred), 5, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr_pred), 5, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr_pred), 5, 5, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr2), 7, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr2), 7, 1, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr2), 7, 2, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr2), 7, 3, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr2), 7, 4, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_foldr2), 7, 5, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_all_true), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.do_all_false), 4, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.eq_version_array), 2, 0, may_throw(user_exception)).
:- pragma exceptions(predicate, (version_array.cmp_version_array), 3, 0, may_throw(user_exception)).
:- pragma termination_info((version_array.empty) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.init((builtin.in), (builtin.in)) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info((version_array.unsafe_empty) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.unsafe_init((builtin.in), (builtin.in)) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.unsafe_new((builtin.in), (builtin.in)) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.version_array((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.from_list((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.elem((builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.lookup((builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.'elem :='((builtin.in), (builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.set((builtin.in), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.size((builtin.in)) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.max((builtin.in)) = (builtin.out), finite(0, [no, no, no]), cannot_loop).
:- pragma termination_info(version_array.is_empty((builtin.in)), finite(0, [no, no]), cannot_loop).
:- pragma termination_info(version_array.resize((builtin.in), (builtin.in), (builtin.in)) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.resize((builtin.in), (builtin.in), (builtin.in), (builtin.out)), infinite, cannot_loop).
:- pragma termination_info(version_array.list((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.to_list((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.foldl((builtin.in), (builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.foldl((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldl((pred((builtin.in), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl((pred((builtin.in), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldl((pred((builtin.in), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl((pred((builtin.in), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr((builtin.in), (builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.foldr((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldr((pred((builtin.in), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr((pred((builtin.in), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldr((pred((builtin.in), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr((pred((builtin.in), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.all_true(builtin.in((pred((builtin.in)) is semidet)), (builtin.in)), infinite, can_loop).
:- pragma termination_info(version_array.all_false(builtin.in((pred((builtin.in)) is semidet)), (builtin.in)), infinite, can_loop).
:- pragma termination_info(version_array.copy((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.unsafe_rewind((builtin.in)) = (builtin.out), infinite, cannot_loop).
:- pragma termination_info(version_array.unsafe_rewind((builtin.in), (builtin.out)), infinite, cannot_loop).
:- pragma termination_info(version_array.version_array_to_doc((builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_func((builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_pred((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_pred((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldl2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_func((builtin.in), (builtin.in), (builtin.in), (builtin.in)) = (builtin.out), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_pred((pred((builtin.in), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_pred((pred((builtin.in), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_pred((pred((builtin.in), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr_pred((pred((builtin.in), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is det), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.in), (builtin.out)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.mdi), (builtin.muo)), infinite, can_loop).
:- pragma termination_info(version_array.do_foldr2((pred((builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)) is semidet), (builtin.in), (builtin.in), (builtin.in), (builtin.out), (builtin.di), (builtin.uo)), infinite, can_loop).
:- pragma termination_info(version_array.do_all_true(builtin.in((pred((builtin.in)) is semidet)), (builtin.in), (builtin.in), (builtin.in)), infinite, can_loop).
:- pragma termination_info(version_array.do_all_false(builtin.in((pred((builtin.in)) is semidet)), (builtin.in), (builtin.in), (builtin.in)), infinite, can_loop).
:- pragma termination_info(version_array.eq_version_array((builtin.in), (builtin.in)), finite(0, [no, no, no]), cannot_loop).
:- pragma termination_info(version_array.cmp_version_array((builtin.uo), (builtin.in), (builtin.in)), finite(0, [no, no, no, no]), cannot_loop).
