% compiler: GNU Prolog 1.4.2
% file    : top_level.pl


file_name('/home/diaz/GP/src/src/BipsPl/top_level.pl').


predicate(top_level/0,45,static,private,monofile,built_in,[
    allocate(3),
    put_atom(prolog_name,0),
    put_variable(y(0),1),
    call(current_prolog_flag/2),
    put_atom(prolog_version,0),
    put_variable(y(1),1),
    call(current_prolog_flag/2),
    put_atom(prolog_copyright,0),
    put_variable(y(2),1),
    call(current_prolog_flag/2),
    put_atom(top_level_output,0),
    put_atom('~N~a ~a~n',1),
    put_list(2),
    unify_local_value(y(0)),
    unify_list,
    unify_local_value(y(1)),
    unify_nil,
    call(format/3),
    put_atom(top_level_output,0),
    put_atom('By Daniel Diaz',1),
    call(write/2),
    call(nl/0),
    put_atom(top_level_output,0),
    put_atom('~a~n',1),
    put_list(2),
    unify_local_value(y(2)),
    unify_nil,
    call(format/3),
    deallocate,
    execute(break/0)]).


predicate(break/0,58,static,private,monofile,built_in,[
    allocate(3),
    call_c('Pl_Set_Ctrl_C_Handler_0',[],[]),
    put_integer(10,0),
    put_variable(y(0),1),
    call('$sys_var_read'/2),
    put_integer(11,0),
    put_variable(y(1),1),
    call('$sys_var_read'/2),
    put_atom('$all_solutions',0),
    put_variable(y(2),1),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(1)]),
    put_value(y(0),0),
    call('$break/0_$aux1'/1),
    put_integer(10,0),
    call('$sys_var_inc'/1),
    put_atom('$cmd_line_consult_file',1),
    put_variable(x(0),2),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(1),x(2)]),
    call('$exec_cmd_line_consult_files'/1),
    put_atom('$cmd_line_entry_goal',1),
    put_variable(x(0),2),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(1),x(2)]),
    call('$exec_cmd_line_entry_goals'/1),
    put_atom('$cmd_line_entry_goal',0),
    put_nil(1),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(1)]),
    call('$top_level1'/0),
    put_integer(10,0),
    call('$sys_var_dec'/1),
    put_integer(11,0),
    put_value(y(1),1),
    call('$sys_var_write'/2),
    put_atom('$all_solutions',0),
    put_unsafe_value(y(2),1),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(1)]),
    put_unsafe_value(y(0),0),
    deallocate,
    execute('$break/0_$aux2'/1)]).


predicate('$break/0_$aux2'/1,58,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[>,2]),
    math_load_value(x(0),2),
    put_integer(0,3),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(2),x(3)]),
    cut(x(1)),
    put_list(2),
    unify_local_value(x(0)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('~N{End Break}~n',1),
    execute(format/3),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$break/0_$aux1'/1,58,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[>,2]),
    math_load_value(x(0),2),
    put_integer(0,3),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(2),x(3)]),
    cut(x(1)),
    put_list(2),
    unify_local_value(x(0)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('~N{Break Level ~d}~n',1),
    execute(format/3),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$top_level1'/0,85,static,private,monofile,built_in,[
    pragma_arity(1),
    get_current_choice(x(0)),
    allocate(1),
    get_variable(y(0),0),
    call(repeat/0),
    put_structure('$top_level_exception'/1,2),
    unify_variable(x(1)),
    put_atom('$top_level2',0),
    put_atom(false,3),
    call('$catch_internal'/4),
    cut(y(0)),
    deallocate,
    proceed]).


predicate('$top_level_abort'/0,92,static,private,monofile,built_in,[
    allocate(1),
    call('$reinit_after_exception'/0),
    put_integer(11,0),
    put_variable(y(0),1),
    call('$sys_var_read'/2),
    put_atom(top_level_output,0),
    put_atom('execution aborted\n',1),
    call(write/2),
    put_unsafe_value(y(0),0),
    deallocate,
    execute('$catch_sync_for_fail_at'/1)]).


predicate('$top_level_stop'/0,101,static,private,monofile,built_in,[
    allocate(1),
    call('$reinit_after_exception'/0),
    put_integer(11,0),
    put_variable(y(0),1),
    call('$sys_var_read'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    execute('$catch_sync_for_fail_at'/1)]).


predicate('$top_level_exception'/1,109,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    allocate(2),
    get_structure('$post_query_exception'/1,0),
    unify_variable(y(0)),
    get_variable(y(1),1),
    call('$reinit_after_exception'/0),
    cut(y(1)),
    put_atom(top_level_output,0),
    put_atom('~Ntop-level exception: ',1),
    put_nil(2),
    call(format/3),
    put_atom(top_level_output,0),
    put_value(y(0),1),
    put_structure(quoted/1,5),
    unify_atom(true),
    put_structure(numbervars/1,4),
    unify_atom(false),
    put_structure(namevars/1,3),
    unify_atom(false),
    put_list(2),
    unify_value(x(5)),
    unify_list,
    unify_value(x(4)),
    unify_list,
    unify_value(x(3)),
    unify_nil,
    call(write_term/3),
    put_atom(top_level_output,0),
    call(nl/1),
    fail,

label(1),
    trust_me_else_fail,
    allocate(1),
    get_variable(y(0),0),
    call('$reinit_after_exception'/0),
    put_atom(top_level_output,0),
    put_atom('~Nuncaught exception: ',1),
    put_nil(2),
    call(format/3),
    put_atom(top_level_output,0),
    put_value(y(0),1),
    put_structure(quoted/1,5),
    unify_atom(true),
    put_structure(numbervars/1,4),
    unify_atom(false),
    put_structure(namevars/1,3),
    unify_atom(false),
    put_list(2),
    unify_value(x(5)),
    unify_list,
    unify_value(x(4)),
    unify_list,
    unify_value(x(3)),
    unify_nil,
    call(write_term/3),
    put_atom(top_level_output,0),
    call(nl/1),
    fail]).


predicate('$reinit_after_exception'/0,127,static,private,monofile,built_in,[
    execute('$$reinit_after_exception/0_$aux1'/0)]).


predicate('$$reinit_after_exception/0_$aux1'/0,127,static,private,monofile,local,[
    pragma_arity(1),
    get_current_choice(x(0)),
    try_me_else(1),
    allocate(1),
    get_variable(y(0),0),
    put_integer(12,0),
    put_integer(1,1),
    call('$sys_var_read'/2),
    cut(y(0)),
    put_atom('$user_prompt',1),
    put_variable(x(0),2),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(1),x(2)]),
    deallocate,
    execute('$set_linedit_prompt'/1),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$top_level2'/0,139,static,private,monofile,built_in,[
    pragma_arity(1),
    get_current_choice(x(0)),
    allocate(6),
    get_variable(y(0),0),
    call(repeat/0),
    put_variable(y(1),0),
    call('$get_current_B'/1),
    put_integer(11,0),
    put_value(y(1),1),
    call('$sys_var_write'/2),
    call('$write_indicator'/0),
    put_atom('| ?- ',1),
    put_variable(y(2),0),
    call('$$top_level2/0_$aux1'/2),
    put_atom(top_level_output,0),
    call(flush_output/1),
    put_variable(y(3),0),
    put_variable(y(4),1),
    call('$read_query'/2),
    put_value(y(2),0),
    call('$$top_level2/0_$aux2'/1),
    put_value(y(4),0),
    put_variable(y(5),1),
    call(sort/2),
    put_unsafe_value(y(3),0),
    put_unsafe_value(y(0),1),
    put_unsafe_value(y(5),2),
    deallocate,
    execute('$$top_level2/0_$aux3'/3)]).


predicate('$$top_level2/0_$aux3'/3,139,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    allocate(1),
    get_variable(y(0),1),
    put_atom(end_of_file,1),
    call_c('Pl_Blt_Term_Eq',[fast_call,boolean],[x(0),x(1)]),
    cut(x(3)),
    put_atom(top_level_output,0),
    call(nl/1),
    cut(y(0)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    allocate(6),
    get_variable(y(0),0),
    get_variable(y(1),2),
    put_variable(y(2),0),
    call(user_time/1),
    put_value(y(0),0),
    put_value(y(1),1),
    put_variable(y(3),2),
    call('$$top_level2/0_$aux4'/3),
    put_variable(y(4),0),
    call(user_time/1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[is,2]),
    math_load_value(y(4),0),
    math_load_value(y(2),1),
    call_c('Pl_Fct_Sub',[fast_call,x(0)],[x(0),x(1)]),
    get_variable(y(5),0),
    put_atom(top_level_output,0),
    put_atom('~N~n',1),
    put_nil(2),
    call(format/3),
    put_value(y(5),0),
    call('$$top_level2/0_$aux5'/1),
    put_atom(top_level_output,0),
    put_atom('~a~n',1),
    put_list(2),
    unify_local_value(y(3)),
    unify_nil,
    call(format/3),
    fail]).


predicate('$$top_level2/0_$aux5'/1,139,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    get_integer(0,0),
    cut(x(1)),
    proceed,

label(1),
    trust_me_else_fail,
    put_list(2),
    unify_local_value(x(0)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('(~d ms) ',1),
    execute(format/3)]).


predicate('$$top_level2/0_$aux4'/3,139,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),2),
    get_variable(y(1),3),
    call('$exec_query'/2),
    cut(y(1)),
    put_value(y(0),0),
    get_atom(yes,0),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    get_atom(no,2),
    proceed]).


predicate('$$top_level2/0_$aux2'/1,139,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_integer(12,0),
    put_integer(1,1),
    call('$sys_var_read'/2),
    cut(y(1)),
    put_value(y(0),0),
    deallocate,
    execute('$set_linedit_prompt'/1),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$$top_level2/0_$aux1'/2,139,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_integer(12,0),
    put_integer(1,1),
    call('$sys_var_read'/2),
    cut(y(2)),
    put_value(y(0),0),
    call('$get_linedit_prompt'/1),
    put_atom('$user_prompt',0),
    put_value(y(0),1),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(1)]),
    put_value(y(1),0),
    deallocate,
    execute('$set_linedit_prompt'/1),

label(1),
    trust_me_else_fail,
    put_atom(top_level_output,0),
    execute(write/2)]).


predicate('$write_indicator'/0,185,static,private,monofile,built_in,[
    try_me_else(1),
    allocate(2),
    put_atom('$debug_mode',1),
    put_variable(x(0),2),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(1),x(2)]),
    put_variable(y(0),1),
    call('$dbg_indicator'/2),
    put_integer(10,0),
    put_variable(y(1),1),
    call('$sys_var_read'/2),
    put_value(y(1),0),
    put_value(y(0),1),
    call('$$write_indicator/0_$aux1'/2),
    fail,

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$$write_indicator/0_$aux1'/2,185,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    get_variable(x(3),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[>,2]),
    math_load_value(x(0),1),
    put_integer(1,4),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(1),x(4)]),
    cut(x(2)),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[is,2]),
    math_load_value(x(0),0),
    call_c('Pl_Fct_Dec',[fast_call,x(1)],[x(0)]),
    put_value(x(3),0),
    execute('$$write_indicator/0_$aux2'/2),

label(1),
    retry_me_else(2),
    get_atom('',1),
    cut(x(2)),
    proceed,

label(2),
    trust_me_else_fail,
    put_list(2),
    unify_local_value(x(1)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('{~a}~n',1),
    execute(format/3)]).


predicate('$$write_indicator/0_$aux2'/2,185,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    get_atom('',0),
    cut(x(2)),
    put_list(2),
    unify_local_value(x(1)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('{~d}~n',1),
    execute(format/3),

label(1),
    trust_me_else_fail,
    put_list(2),
    unify_local_value(x(0)),
    unify_list,
    unify_local_value(x(1)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('{~a,~d}~n',1),
    execute(format/3)]).


predicate('$dbg_indicator'/2,206,static,private,monofile,built_in,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(trace,3),(debug,5),(nodebug,7)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(trace,0),
    get_atom(trace,1),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_atom(debug,0),
    get_atom(debug,1),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_atom(nodebug,0),
    get_atom('',1),
    proceed]).


predicate('$read_query'/2,215,static,private,monofile,built_in,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_integer(10,0),
    put_integer(1,1),
    call('$sys_var_read'/2),
    put_atom('$cmd_line_query_goal',0),
    put_list(2),
    unify_variable(y(3)),
    unify_variable(x(1)),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(2)]),
    put_atom('$cmd_line_query_goal',0),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(1)]),
    cut(y(2)),
    put_atom('| ?- ',0),
    call('$$read_query/2_$aux1'/1),
    put_atom(top_level_output,0),
    put_atom('~a.~n',1),
    put_list(2),
    unify_value(y(3)),
    unify_nil,
    call(format/3),
    put_value(y(3),0),
    put_value(y(0),1),
    put_structure(end_of_term/1,4),
    unify_atom(eof),
    put_structure(variable_names/1,3),
    unify_local_value(y(1)),
    put_list(2),
    unify_value(x(4)),
    unify_list,
    unify_value(x(3)),
    unify_nil,
    deallocate,
    execute(read_term_from_atom/3),

label(1),
    trust_me_else_fail,
    put_structure(variable_names/1,3),
    unify_local_value(x(1)),
    put_list(2),
    unify_value(x(3)),
    unify_nil,
    put_value(x(0),1),
    put_atom(top_level_input,0),
    execute(read_term/3)]).


predicate('$$read_query/2_$aux1'/1,215,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_integer(12,0),
    put_integer(1,1),
    call('$sys_var_read'/2),
    cut(y(1)),
    put_atom(top_level_output,0),
    put_value(y(0),1),
    deallocate,
    execute(write/2),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$exec_query'/2,233,static,private,monofile,built_in,[
    allocate(5),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_atom('$debug_mode',0),
    put_variable(x(1),2),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(2)]),
    put_atom('$debug_next',0),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(1)]),
    put_atom('$all_solutions',0),
    put_atom(f,1),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(1)]),
    put_variable(y(2),0),
    call('$get_current_B'/1),
    call_c('Pl_Save_Regs_For_Signal',[],[]),
    put_value(y(0),0),
    put_atom(top_level,1),
    put_integer(0,2),
    put_atom(true,3),
    call('$call'/4),
    call_c('Pl_Save_Regs_For_Signal',[],[]),
    put_variable(y(3),0),
    call('$get_current_B'/1),
    put_atom(top_level_output,0),
    put_atom('~N',1),
    put_nil(2),
    call(format/3),
    put_structure(throw/1,2),
    unify_structure('$post_query_exception'/1),
    unify_variable(x(1)),
    put_structure('$set_query_vars_names'/2,0),
    unify_local_value(y(1)),
    unify_variable(y(4)),
    put_atom(false,3),
    call('$catch_internal'/4),
    put_value(y(4),0),
    put_unsafe_value(y(3),1),
    put_unsafe_value(y(2),2),
    deallocate,
    execute('$$exec_query/2_$aux1'/3)]).


predicate('$$exec_query/2_$aux1'/3,233,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),3),
    fail,

label(1),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),1),
    get_variable(y(1),2),
    put_value(y(0),1),
    put_value(y(1),2),
    call('$write_solution'/3),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute('$$exec_query/2_$aux2'/2)]).


predicate('$$exec_query/2_$aux2'/2,233,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    allocate(0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[>,2]),
    math_load_value(x(0),0),
    math_load_value(x(1),1),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(0),x(1)]),
    cut(x(2)),
    put_atom('$all_solutions',0),
    put_atom(f,1),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(1)]),
    put_atom(top_level_output,0),
    put_atom(' ? ',1),
    call(write/2),
    deallocate,
    execute('$read_return'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$set_query_vars_names'/2,261,static,private,monofile,built_in,[
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_value(y(0),0),
    put_variable(y(2),1),
    call(name_query_vars/2),
    put_value(y(2),0),
    put_value(y(1),1),
    call('$remove_underscore_vars'/2),
    put_value(y(1),0),
    call(name_singleton_vars/1),
    put_value(y(1),0),
    put_structure(exclude/1,2),
    unify_local_value(y(0)),
    put_list(1),
    unify_value(x(2)),
    unify_list,
    unify_atom(namevars),
    unify_nil,
    deallocate,
    execute(bind_variables/2)]).


predicate('$remove_underscore_vars'/2,270,static,private,monofile,built_in,[
    pragma_arity(3),
    get_current_choice(x(2)),
    switch_on_term(2,3,fail,1,fail),

label(1),
    try(5),
    trust(7),

label(2),
    try_me_else(4),

label(3),
    get_nil(0),
    get_nil(1),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    allocate(3),
    get_variable(y(1),1),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure((=)/2,0),
    unify_variable(x(0)),
    unify_variable(x(1)),
    get_variable(y(2),2),
    call('$$remove_underscore_vars/2_$aux1'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute('$remove_underscore_vars'/2),

label(6),
    trust_me_else_fail,

label(7),
    get_list(0),
    unify_variable(x(2)),
    unify_variable(x(0)),
    get_list(1),
    unify_value(x(2)),
    unify_variable(x(1)),
    execute('$remove_underscore_vars'/2)]).


predicate('$$remove_underscore_vars/2_$aux1'/2,272,static,private,monofile,local,[
    try_me_else(1),
    put_integer(0,1),
    put_integer(1,2),
    put_void(3),
    put_atom('_',4),
    execute(sub_atom/5),

label(1),
    trust_me_else_fail,
    get_structure('$VARNAME'/1,1),
    unify_variable(x(0)),
    put_integer(0,1),
    put_integer(1,2),
    put_void(3),
    put_atom('_',4),
    execute(sub_atom/5)]).


predicate('$write_solution'/3,285,static,private,monofile,built_in,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    get_nil(0),
    cut(x(3)),
    put_value(x(1),0),
    put_value(x(2),1),
    execute('$$write_solution/3_$aux1'/2),

label(1),
    trust_me_else_fail,
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),3),
    put_variable(y(2),0),
    call('$$write_solution/3_$aux2'/1),
    cut(y(1)),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[is,2]),
    math_load_value(y(2),0),
    call_c('Pl_Fct_Dec',[fast_call,x(1)],[x(0)]),
    put_value(y(0),0),
    deallocate,
    execute('$write_solution1'/2)]).


predicate('$$write_solution/3_$aux2'/1,292,static,private,monofile,local,[
    try_me_else(1),
    put_atom(xfx,1),
    put_atom(=,2),
    execute(current_op/3),

label(1),
    trust_me_else_fail,
    get_integer(700,0),
    proceed]).


predicate('$$write_solution/3_$aux1'/2,285,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[>,2]),
    math_load_value(x(0),0),
    math_load_value(x(1),1),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(0),x(1)]),
    cut(x(2)),
    put_atom(top_level_output,0),
    put_atom('~ntrue',1),
    put_nil(2),
    execute(format/3),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$write_solution1'/2,298,static,private,monofile,built_in,[
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    allocate(2),
    get_variable(y(1),1),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure((=)/2,0),
    unify_variable(x(1)),
    unify_variable(x(0)),
    put_value(y(1),2),
    call('$$write_solution1/2_$aux1'/3),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute('$write_solution1'/2)]).


predicate('$$write_solution1/2_$aux1'/3,300,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    put_value(y(0),0),
    call(acyclic_term/1),
    cut(y(3)),
    put_atom(top_level_output,0),
    put_atom('~n~a = ',1),
    put_list(2),
    unify_local_value(y(1)),
    unify_nil,
    call(format/3),
    put_atom(top_level_output,0),
    put_value(y(0),1),
    put_structure(quoted/1,6),
    unify_atom(true),
    put_structure(numbervars/1,5),
    unify_atom(false),
    put_structure(namevars/1,4),
    unify_atom(true),
    put_structure(priority/1,3),
    unify_local_value(y(2)),
    put_list(2),
    unify_value(x(6)),
    unify_list,
    unify_value(x(5)),
    unify_list,
    unify_value(x(4)),
    unify_list,
    unify_value(x(3)),
    unify_nil,
    deallocate,
    execute(write_term/3),

label(1),
    trust_me_else_fail,
    put_list(2),
    unify_local_value(x(1)),
    unify_nil,
    put_atom(top_level_output,0),
    put_atom('~ncannot display cyclic term for ~a',1),
    execute(format/3)]).


predicate('$read_return'/0,312,static,private,monofile,built_in,[
    pragma_arity(1),
    get_current_choice(x(0)),
    allocate(2),
    get_variable(y(0),0),
    put_atom(top_level_output,0),
    call(flush_output/1),
    put_atom(top_level_input,0),
    put_variable(y(1),1),
    call(get_key/2),
    put_value(y(1),0),
    call('$read_return'/1),
    cut(y(0)),
    deallocate,
    proceed]).


predicate('$read_return'/1,320,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(12),
    switch_on_term(2,fail,1,fail,fail),

label(1),
    switch_on_integer([(10,3),(13,5),(97,7),(59,9),(32,11)]),

label(2),
    try_me_else(4),

label(3),
    get_integer(10,0),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_integer(13,0),
    proceed,

label(6),
    retry_me_else(8),

label(7),
    get_integer(97,0),
    put_atom('$all_solutions',0),
    put_atom(t,2),
    call_c('Pl_Blt_G_Assign',[fast_call],[x(0),x(2)]),
    cut(x(1)),
    fail,

label(8),
    retry_me_else(10),

label(9),
    allocate(1),
    get_integer(59,0),
    get_variable(y(0),1),
    put_atom(top_level_output,0),
    put_atom('~N',1),
    put_nil(2),
    call(format/3),
    cut(y(0)),
    fail,

label(10),
    trust_me_else_fail,

label(11),
    allocate(1),
    get_integer(32,0),
    get_variable(y(0),1),
    put_atom(top_level_output,0),
    put_atom('\b;~N',1),
    put_nil(2),
    call(format/3),
    cut(y(0)),
    fail,

label(12),
    trust_me_else_fail,
    allocate(0),
    put_atom(top_level_output,0),
    call(nl/1),
    put_atom(top_level_output,0),
    put_atom('Action (; for next solution, a for all solutions, RET to stop) ? ',1),
    call(write/2),
    deallocate,
    execute('$read_return'/0)]).


predicate('$exec_cmd_line_consult_files'/1,345,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(6),
    switch_on_term(2,fail,fail,1,fail),

label(1),
    try(3),
    trust(5),

label(2),
    try_me_else(4),

label(3),
    allocate(2),
    get_list(0),
    unify_variable(y(0)),
    unify_void(1),
    put_structure('$consult2'/1,0),
    unify_value(y(0)),
    put_structure(error/2,1),
    unify_variable(y(1)),
    unify_void(1),
    put_atom(true,2),
    put_atom(false,3),
    call('$catch_internal'/4),
    put_value(y(1),0),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    put_atom('~Nwarning: command-line consulting file ~q failed due to ~q~n',0),
    put_list(1),
    unify_value(y(0)),
    unify_list,
    unify_value(y(1)),
    unify_nil,
    call(format/2),
    fail,

label(4),
    trust_me_else_fail,

label(5),
    get_list(0),
    unify_void(1),
    unify_variable(x(0)),
    cut(x(1)),
    execute('$exec_cmd_line_consult_files'/1),

label(6),
    trust_me_else_fail,
    proceed]).


predicate('$exec_cmd_line_entry_goals'/1,360,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    allocate(1),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    cut(x(1)),
    call('$exec_cmd_line_goal'/1),
    put_value(y(0),0),
    deallocate,
    execute('$exec_cmd_line_entry_goals'/1),

label(1),
    trust_me_else_fail,
    proceed]).


predicate('$exec_cmd_line_goal'/1,370,static,private,monofile,built_in,[
    execute('$$exec_cmd_line_goal/1_$aux1'/1)]).


predicate('$$exec_cmd_line_goal/1_$aux1'/1,370,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    allocate(1),
    get_variable(x(3),0),
    get_variable(y(0),1),
    put_structure('$exec_cmd1'/1,0),
    unify_local_value(x(3)),
    put_structure('$exec_cmd_err'/2,2),
    unify_local_value(x(3)),
    unify_variable(x(1)),
    put_atom('command-line',3),
    put_integer(-1,4),
    put_atom(false,5),
    call('$catch'/6),
    cut(y(0)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    put_list(1),
    unify_local_value(x(0)),
    unify_nil,
    put_atom('~Nwarning: command-line goal ~q failed~n',0),
    execute(format/2)]).


predicate('$exec_cmd1'/1,376,static,private,monofile,built_in,[
    allocate(1),
    put_variable(y(0),1),
    put_structure(end_of_term/1,3),
    unify_atom(eof),
    put_list(2),
    unify_value(x(3)),
    unify_nil,
    call(read_term_from_atom/3),
    put_unsafe_value(y(0),0),
    put_atom('command-line',1),
    put_integer(-1,2),
    put_atom(false,3),
    deallocate,
    execute('$call'/4)]).


predicate('$exec_cmd_err'/2,381,static,private,monofile,built_in,[
    get_variable(x(2),1),
    put_list(1),
    unify_local_value(x(0)),
    unify_list,
    unify_local_value(x(2)),
    unify_nil,
    put_atom('~Nwarning: command-line goal ~q caused exception: ~q~n',0),
    execute(format/2)]).


ensure_linked([consult/1,load/1]).
