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


file_name('/home/diaz/GP/src/src/Pl2Wam/indexing.pl').


predicate(indexing/2,135,static,private,monofile,global,[
    allocate(4),
    get_variable(y(0),1),
    put_atom(f,1),
    put_void(2),
    put_list(3),
    unify_void(1),
    unify_variable(y(1)),
    call(indexing1/4),
    put_variable(y(2),0),
    put_variable(y(3),1),
    call(cur_pred/2),
    put_value(y(2),0),
    put_value(y(3),1),
    put_value(y(0),2),
    put_value(y(1),3),
    call('$indexing/2_$aux1'/4),
    put_value(y(0),0),
    put_integer(1,1),
    put_void(2),
    deallocate,
    execute(allocate_labels/3)]).


predicate('$indexing/2_$aux1'/4,135,static,private,monofile,local,[
    pragma_arity(5),
    get_current_choice(x(4)),
    try_me_else(1),
    allocate(4),
    get_variable(y(0),1),
    get_variable(y(1),2),
    get_variable(y(2),3),
    get_variable(y(3),4),
    put_value(x(0),1),
    put_atom(cut,0),
    put_value(y(0),2),
    call(test_pred_info/3),
    cut(y(3)),
    math_fast_load_value(y(0),0),
    call_c('Pl_Fct_Fast_Inc',[fast_call,x(1)],[x(0)]),
    put_value(y(1),0),
    get_list(0),
    unify_variable(x(2)),
    unify_list,
    unify_variable(x(0)),
    unify_local_value(y(2)),
    get_structure(pragma_arity/1,2),
    unify_local_value(x(1)),
    get_structure(get_current_choice/1,0),
    unify_structure(x/1),
    unify_local_value(y(0)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    get_value(x(3),2),
    proceed]).


predicate(indexing1/4,148,static,private,monofile,global,[
    pragma_arity(5),
    get_current_choice(x(4)),
    allocate(7),
    get_variable(y(0),1),
    get_list(3),
    unify_variable(x(1)),
    unify_variable(y(1)),
    get_structure(label/1,1),
    unify_local_value(x(2)),
    get_variable(y(2),4),
    put_variable(y(3),1),
    put_variable(y(4),2),
    put_variable(y(5),3),
    put_variable(y(6),4),
    call(look_for_var/5),
    put_value(y(3),0),
    put_value(y(4),1),
    put_value(y(5),2),
    put_value(y(6),3),
    put_value(y(0),4),
    put_value(y(1),5),
    call(mk_indexing/6),
    cut(y(2)),
    deallocate,
    proceed]).


predicate(look_for_var/5,155,static,private,monofile,global,[
    pragma_arity(6),
    get_current_choice(x(5)),
    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_integer(2,1),
    get_nil(2),
    get_nil(4),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_nil(2),
    get_list(0),
    unify_variable(x(0)),
    unify_local_value(x(4)),
    get_structure(cl/3,0),
    unify_variable(x(2)),
    unify_atom(var),
    unify_variable(x(0)),
    get_structure(cl/3,3),
    unify_value(x(2)),
    unify_atom(var),
    unify_value(x(0)),
    cut(x(5)),
    put_value(x(4),0),
    execute('$look_for_var/5_$aux1'/2),

label(6),
    trust_me_else_fail,

label(7),
    allocate(2),
    get_variable(y(0),1),
    get_list(0),
    unify_variable(x(1)),
    unify_variable(x(0)),
    get_list(2),
    unify_value(x(1)),
    unify_variable(x(2)),
    put_variable(y(1),1),
    call(look_for_var/5),
    put_unsafe_value(y(1),0),
    put_value(y(0),1),
    deallocate,
    execute('$look_for_var/5_$aux2'/2)]).


predicate('$look_for_var/5_$aux2'/2,164,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(6),
    switch_on_term(2,fail,1,fail,fail),

label(1),
    switch_on_integer([(13,3),(14,5)]),

label(2),
    try_me_else(4),

label(3),
    get_integer(13,0),
    cut(x(2)),
    get_integer(11,1),
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    get_integer(14,0),
    cut(x(2)),
    get_integer(12,1),
    proceed,

label(6),
    trust_me_else_fail,
    get_value(x(0),1),
    proceed]).


predicate('$look_for_var/5_$aux1'/2,157,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    get_nil(0),
    cut(x(2)),
    get_integer(14,1),
    proceed,

label(1),
    trust_me_else_fail,
    get_integer(13,1),
    proceed]).


predicate(mk_indexing/6,176,static,private,monofile,global,[
    pragma_arity(7),
    get_current_choice(x(6)),
    switch_on_term(2,fail,1,fail,fail),

label(1),
    switch_on_integer([(11,3),(12,5),(13,7),(14,9),(2,11)]),

label(2),
    try_me_else(4),

label(3),
    allocate(9),
    get_integer(11,0),
    get_variable(y(0),1),
    get_structure(cl/3,2),
    unify_void(2),
    unify_variable(y(1)),
    get_variable(y(2),3),
    get_variable(y(3),5),
    put_value(x(4),0),
    put_variable(y(4),1),
    put_variable(y(5),2),
    call('$mk_indexing/6_$aux1'/3),
    put_integer(2,0),
    put_value(y(0),1),
    put_void(2),
    put_void(3),
    put_atom(f,4),
    put_variable(y(6),5),
    call(mk_indexing/6),
    put_value(y(2),0),
    put_atom(t,1),
    put_variable(y(7),2),
    put_variable(y(8),3),
    call(indexing1/4),
    put_value(y(3),0),
    get_list(0),
    unify_local_value(y(4)),
    unify_list,
    unify_local_value(y(6)),
    unify_list,
    unify_variable(x(1)),
    unify_list,
    unify_variable(x(0)),
    unify_list,
    unify_value(y(1)),
    unify_local_value(y(8)),
    get_structure(label/1,1),
    unify_local_value(y(5)),
    get_structure(retry_me_else/1,0),
    unify_local_value(y(7)),
    deallocate,
    proceed,

label(4),
    retry_me_else(6),

label(5),
    allocate(6),
    get_integer(12,0),
    get_variable(y(0),1),
    get_structure(cl/3,2),
    unify_void(2),
    unify_variable(y(1)),
    get_variable(y(2),5),
    put_value(x(4),0),
    put_variable(y(3),1),
    put_variable(y(4),2),
    call('$mk_indexing/6_$aux2'/3),
    put_integer(2,0),
    put_value(y(0),1),
    put_void(2),
    put_void(3),
    put_atom(f,4),
    put_variable(y(5),5),
    call(mk_indexing/6),
    put_value(y(2),0),
    get_list(0),
    unify_local_value(y(3)),
    unify_list,
    unify_local_value(y(5)),
    unify_list,
    unify_variable(x(0)),
    unify_list,
    unify_atom(trust_me_else_fail),
    unify_value(y(1)),
    get_structure(label/1,0),
    unify_local_value(y(4)),
    deallocate,
    proceed,

label(6),
    retry_me_else(8),

label(7),
    allocate(6),
    get_integer(13,0),
    get_structure(cl/3,2),
    unify_void(2),
    unify_variable(y(0)),
    get_variable(y(1),3),
    get_variable(y(2),5),
    put_value(x(4),0),
    put_variable(y(3),1),
    put_variable(y(4),2),
    call('$mk_indexing/6_$aux3'/3),
    put_value(y(1),0),
    put_atom(t,1),
    put_value(y(4),2),
    put_variable(y(5),3),
    call(indexing1/4),
    put_value(y(2),0),
    get_list(0),
    unify_local_value(y(3)),
    unify_list,
    unify_value(y(0)),
    unify_local_value(y(5)),
    deallocate,
    proceed,

label(8),
    retry_me_else(10),

label(9),
    get_integer(14,0),
    get_structure(cl/3,2),
    unify_void(2),
    unify_variable(x(2)),
    put_value(x(4),0),
    put_value(x(5),1),
    execute('$mk_indexing/6_$aux4'/3),

label(10),
    trust_me_else_fail,

label(11),
    allocate(18),
    get_integer(2,0),
    get_variable(y(0),1),
    get_variable(y(1),6),
    put_value(x(4),0),
    put_value(x(5),1),
    put_variable(y(2),2),
    call('$mk_indexing/6_$aux5'/3),
    put_value(y(0),0),
    put_variable(y(3),1),
    put_value(y(2),2),
    put_variable(y(4),3),
    put_variable(y(5),4),
    put_variable(y(6),5),
    put_variable(y(7),6),
    put_variable(y(8),7),
    call('$mk_indexing/6_$aux6'/8),
    put_value(y(3),0),
    get_variable(y(9),0),
    put_value(y(0),0),
    put_variable(y(10),1),
    put_variable(y(11),2),
    put_variable(y(12),3),
    put_variable(y(13),4),
    call(split/5),
    cut(y(1)),
    put_value(y(10),0),
    put_atom(switch_on_atom,1),
    put_value(y(5),2),
    put_variable(y(14),3),
    put_value(y(9),4),
    call(gen_switch/5),
    put_value(y(11),0),
    put_atom(switch_on_integer,1),
    put_value(y(6),2),
    put_variable(y(15),3),
    put_value(y(14),4),
    call(gen_switch/5),
    put_value(y(12),0),
    put_value(y(7),1),
    put_variable(y(16),2),
    put_value(y(15),3),
    call(gen_list/4),
    put_value(y(13),0),
    put_atom(switch_on_structure,1),
    put_value(y(8),2),
    put_variable(y(17),3),
    put_value(y(16),4),
    call(gen_switch/5),
    put_value(y(0),0),
    put_unsafe_value(y(4),1),
    put_unsafe_value(y(17),2),
    deallocate,
    execute(gen_insts/3)]).


predicate('$mk_indexing/6_$aux6'/8,207,static,private,monofile,local,[
    pragma_arity(9),
    get_current_choice(x(8)),
    try_me_else(1),
    get_list(0),
    unify_void(1),
    unify_nil,
    cut(x(8)),
    get_list(1),
    unify_void(1),
    unify_variable(x(0)),
    get_value(x(0),2),
    proceed,

label(1),
    trust_me_else_fail,
    get_list(2),
    unify_variable(x(0)),
    unify_local_value(x(1)),
    get_structure(switch_on_term/5,0),
    unify_local_value(x(3)),
    unify_local_value(x(4)),
    unify_local_value(x(5)),
    unify_local_value(x(6)),
    unify_local_value(x(7)),
    proceed]).


predicate('$mk_indexing/6_$aux5'/3,207,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    get_atom(f,0),
    cut(x(3)),
    get_value(x(2),1),
    proceed,

label(1),
    trust_me_else_fail,
    get_list(1),
    unify_atom(trust_me_else_fail),
    unify_local_value(x(2)),
    proceed]).


predicate('$mk_indexing/6_$aux4'/3,201,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    get_atom(f,0),
    cut(x(3)),
    get_value(x(2),1),
    proceed,

label(1),
    trust_me_else_fail,
    get_list(1),
    unify_atom(trust_me_else_fail),
    unify_local_value(x(2)),
    proceed]).


predicate('$mk_indexing/6_$aux3'/3,193,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    get_atom(f,0),
    cut(x(3)),
    get_structure(try_me_else/1,1),
    unify_local_value(x(2)),
    proceed,

label(1),
    trust_me_else_fail,
    get_structure(retry_me_else/1,1),
    unify_local_value(x(2)),
    proceed]).


predicate('$mk_indexing/6_$aux2'/3,185,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    get_atom(f,0),
    cut(x(3)),
    get_structure(try_me_else/1,1),
    unify_local_value(x(2)),
    proceed,

label(1),
    trust_me_else_fail,
    get_structure(retry_me_else/1,1),
    unify_local_value(x(2)),
    proceed]).


predicate('$mk_indexing/6_$aux1'/3,176,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    get_atom(f,0),
    cut(x(3)),
    get_structure(try_me_else/1,1),
    unify_local_value(x(2)),
    proceed,

label(1),
    trust_me_else_fail,
    get_structure(retry_me_else/1,1),
    unify_local_value(x(2)),
    proceed]).


predicate(split/5,228,static,private,monofile,global,[
    allocate(6),
    get_variable(y(0),1),
    get_variable(y(1),2),
    get_variable(y(2),4),
    get_variable(x(1),3),
    put_structure(a/2,3),
    unify_variable(x(2)),
    unify_value(x(2)),
    put_structure(a/2,7),
    unify_nil,
    unify_local_value(x(1)),
    put_nil(1),
    put_nil(2),
    put_nil(4),
    put_variable(y(3),5),
    put_variable(y(4),6),
    put_variable(y(5),8),
    call(split1/9),
    put_value(y(3),0),
    put_value(y(0),1),
    call(terminate_list/2),
    put_value(y(4),0),
    put_value(y(1),1),
    call(terminate_list/2),
    put_unsafe_value(y(5),0),
    put_value(y(2),1),
    deallocate,
    execute(terminate_list/2)]).


predicate(split1/9,235,static,private,monofile,global,[
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    get_value(x(8),4),
    get_value(x(7),3),
    get_value(x(6),2),
    get_value(x(5),1),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    allocate(9),
    get_variable(y(1),5),
    get_variable(y(2),6),
    get_variable(y(3),7),
    get_variable(y(4),8),
    get_variable(x(5),4),
    get_variable(x(4),3),
    get_variable(x(3),2),
    get_variable(x(2),1),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure(cl/3,0),
    unify_variable(x(1)),
    unify_variable(x(0)),
    unify_void(1),
    put_variable(y(5),6),
    put_variable(y(6),7),
    put_variable(y(7),8),
    put_variable(y(8),9),
    call(split2/10),
    put_value(y(0),0),
    put_unsafe_value(y(5),1),
    put_unsafe_value(y(6),2),
    put_unsafe_value(y(7),3),
    put_unsafe_value(y(8),4),
    put_value(y(1),5),
    put_value(y(2),6),
    put_value(y(3),7),
    put_value(y(4),8),
    deallocate,
    execute(split1/9)]).


predicate(split2/10,242,static,private,monofile,global,[
    switch_on_term(2,7,fail,fail,1),

label(1),
    switch_on_structure([(atm/1,3),(int/1,5),(stc/2,9)]),

label(2),
    try_me_else(4),

label(3),
    get_value(x(9),5),
    get_value(x(8),4),
    get_value(x(7),3),
    get_variable(x(3),2),
    get_variable(x(2),1),
    get_structure(atm/1,0),
    unify_variable(x(1)),
    put_value(x(3),0),
    put_value(x(6),3),
    execute(add_to_list/4),

label(4),
    retry_me_else(6),

label(5),
    get_value(x(9),5),
    get_value(x(8),4),
    get_value(x(6),2),
    get_variable(x(2),1),
    get_structure(int/1,0),
    unify_variable(x(1)),
    put_value(x(3),0),
    put_value(x(7),3),
    execute(add_to_list/4),

label(6),
    retry_me_else(8),

label(7),
    get_atom(lst,0),
    get_value(x(9),5),
    get_value(x(7),3),
    get_value(x(6),2),
    get_structure(a/2,4),
    unify_variable(x(2)),
    unify_variable(x(0)),
    get_list(2),
    unify_local_value(x(1)),
    unify_variable(x(1)),
    get_structure(a/2,8),
    unify_value(x(1)),
    unify_value(x(0)),
    proceed,

label(8),
    trust_me_else_fail,

label(9),
    get_value(x(8),4),
    get_value(x(7),3),
    get_value(x(6),2),
    get_variable(x(2),1),
    get_structure(stc/2,0),
    unify_variable(x(3)),
    unify_variable(x(0)),
    put_structure((/)/2,1),
    unify_value(x(3)),
    unify_value(x(0)),
    put_value(x(5),0),
    put_value(x(9),3),
    execute(add_to_list/4)]).


predicate(add_to_list/4,256,static,private,monofile,global,[
    pragma_arity(5),
    get_current_choice(x(4)),
    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_list(3),
    unify_variable(x(0)),
    unify_nil,
    get_structure(a/3,0),
    unify_local_value(x(1)),
    unify_variable(x(0)),
    unify_list,
    unify_local_value(x(2)),
    unify_value(x(0)),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(x(5)),
    get_structure(a/3,0),
    unify_local_value(x(1)),
    unify_variable(x(6)),
    unify_variable(x(0)),
    get_list(6),
    unify_local_value(x(2)),
    unify_variable(x(2)),
    get_list(3),
    unify_variable(x(3)),
    unify_value(x(5)),
    get_structure(a/3,3),
    unify_local_value(x(1)),
    unify_value(x(2)),
    unify_value(x(0)),
    cut(x(4)),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_list(0),
    unify_variable(x(4)),
    unify_variable(x(0)),
    get_list(3),
    unify_value(x(4)),
    unify_variable(x(3)),
    execute(add_to_list/4)]).


predicate(terminate_list/2,267,static,private,monofile,global,[
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

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

label(3),
    trust_me_else_fail,

label(4),
    get_list(0),
    unify_variable(x(2)),
    unify_variable(x(0)),
    get_structure(a/3,2),
    unify_variable(x(3)),
    unify_nil,
    unify_variable(x(2)),
    get_list(1),
    unify_variable(x(4)),
    unify_variable(x(1)),
    get_structure(a/2,4),
    unify_value(x(3)),
    unify_value(x(2)),
    execute(terminate_list/2)]).


predicate(gen_switch/5,275,static,private,monofile,global,[
    pragma_arity(6),
    get_current_choice(x(5)),
    try_me_else(5),
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    get_atom(fail,2),
    get_value(x(4),3),
    cut(x(5)),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    get_value(x(4),3),
    get_list(0),
    unify_variable(x(0)),
    unify_nil,
    get_structure(a/2,0),
    unify_void(1),
    unify_list,
    unify_local_value(x(2)),
    unify_nil,
    cut(x(5)),
    proceed,

label(5),
    trust_me_else_fail,
    allocate(3),
    get_variable(y(0),1),
    get_variable(x(1),3),
    get_list(4),
    unify_variable(x(4)),
    unify_list,
    unify_variable(y(1)),
    unify_variable(x(3)),
    get_structure(label/1,4),
    unify_local_value(x(2)),
    put_value(x(1),2),
    put_variable(y(2),1),
    call(create_switch_list/4),
    put_value(y(1),0),
    put_list(1),
    unify_local_value(y(0)),
    unify_list,
    unify_local_value(y(2)),
    unify_nil,
    call_c('Pl_Blt_Univ',[fast_call,boolean],[x(0),x(1)]),
    deallocate,
    proceed]).


predicate(create_switch_list/4,296,static,private,monofile,global,[
    switch_on_term(1,2,fail,4,fail),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    get_nil(1),
    get_value(x(3),2),
    proceed,

label(3),
    trust_me_else_fail,

label(4),
    allocate(4),
    get_variable(y(2),2),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure(a/2,0),
    unify_variable(x(2)),
    unify_variable(x(0)),
    get_list(1),
    unify_variable(x(1)),
    unify_variable(y(1)),
    get_structure((',')/2,1),
    unify_value(x(2)),
    unify_variable(x(1)),
    put_variable(y(3),2),
    call(gen_list/4),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),2),
    put_unsafe_value(y(3),3),
    deallocate,
    execute(create_switch_list/4)]).


predicate(gen_list/4,305,static,private,monofile,global,[
    pragma_arity(5),
    get_current_choice(x(4)),
    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_atom(fail,1),
    get_value(x(3),2),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_value(x(3),2),
    get_list(0),
    unify_local_value(x(1)),
    unify_nil,
    cut(x(4)),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_variable(x(4),2),
    get_list(0),
    unify_variable(x(5)),
    unify_variable(x(0)),
    get_list(3),
    unify_variable(x(6)),
    unify_list,
    unify_variable(x(3)),
    unify_variable(x(2)),
    get_structure(label/1,6),
    unify_local_value(x(1)),
    get_structure(try/1,3),
    unify_value(x(5)),
    put_value(x(4),1),
    execute(gen_list1/3)]).


predicate(gen_list1/3,315,static,private,monofile,global,[
    switch_on_term(2,fail,fail,1,fail),

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

label(2),
    try_me_else(4),

label(3),
    get_list(0),
    unify_variable(x(0)),
    unify_nil,
    get_list(2),
    unify_variable(x(2)),
    unify_local_value(x(1)),
    get_structure(trust/1,2),
    unify_value(x(0)),
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    get_list(0),
    unify_variable(x(3)),
    unify_variable(x(0)),
    get_list(2),
    unify_variable(x(4)),
    unify_variable(x(2)),
    get_structure(retry/1,4),
    unify_value(x(3)),
    execute(gen_list1/3)]).


predicate(gen_insts/3,324,static,private,monofile,global,[
    pragma_arity(4),
    get_current_choice(x(3)),
    switch_on_term(2,fail,fail,1,fail),

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

label(2),
    try_me_else(4),

label(3),
    get_list(0),
    unify_variable(x(0)),
    unify_nil,
    get_structure(cl/3,0),
    unify_local_value(x(1)),
    unify_void(1),
    unify_variable(x(4)),
    get_list(2),
    unify_variable(x(0)),
    unify_value(x(4)),
    get_structure(label/1,0),
    unify_local_value(x(1)),
    cut(x(3)),
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    allocate(6),
    get_variable(y(2),1),
    get_variable(y(3),2),
    get_list(0),
    unify_variable(x(1)),
    unify_variable(x(0)),
    get_structure(cl/3,1),
    unify_variable(y(0)),
    unify_void(1),
    unify_variable(y(1)),
    put_variable(y(4),1),
    put_variable(y(5),2),
    call(gen_insts1/3),
    put_value(y(3),0),
    get_list(0),
    unify_variable(x(2)),
    unify_list,
    unify_variable(x(1)),
    unify_list,
    unify_variable(x(0)),
    unify_list,
    unify_value(y(1)),
    unify_local_value(y(5)),
    get_structure(label/1,2),
    unify_local_value(y(2)),
    get_structure(try_me_else/1,1),
    unify_local_value(y(4)),
    get_structure(label/1,0),
    unify_value(y(0)),
    deallocate,
    proceed]).


predicate(gen_insts1/3,333,static,private,monofile,global,[
    pragma_arity(4),
    get_current_choice(x(3)),
    switch_on_term(2,fail,fail,1,fail),

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

label(2),
    try_me_else(4),

label(3),
    get_list(0),
    unify_variable(x(0)),
    unify_nil,
    get_structure(cl/3,0),
    unify_variable(x(0)),
    unify_void(1),
    unify_variable(x(5)),
    get_list(2),
    unify_variable(x(4)),
    unify_list,
    unify_atom(trust_me_else_fail),
    unify_list,
    unify_variable(x(2)),
    unify_value(x(5)),
    get_structure(label/1,4),
    unify_local_value(x(1)),
    get_structure(label/1,2),
    unify_value(x(0)),
    cut(x(3)),
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    allocate(6),
    get_variable(y(2),1),
    get_variable(y(3),2),
    get_list(0),
    unify_variable(x(1)),
    unify_variable(x(0)),
    get_structure(cl/3,1),
    unify_variable(y(0)),
    unify_void(1),
    unify_variable(y(1)),
    put_variable(y(4),1),
    put_variable(y(5),2),
    call(gen_insts1/3),
    put_value(y(3),0),
    get_list(0),
    unify_variable(x(2)),
    unify_list,
    unify_variable(x(1)),
    unify_list,
    unify_variable(x(0)),
    unify_list,
    unify_value(y(1)),
    unify_local_value(y(5)),
    get_structure(label/1,2),
    unify_local_value(y(2)),
    get_structure(retry_me_else/1,1),
    unify_local_value(y(4)),
    get_structure(label/1,0),
    unify_value(y(0)),
    deallocate,
    proceed]).


predicate(allocate_labels/3,343,static,private,monofile,global,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(7),
    switch_on_term(1,2,fail,4,6),

label(1),
    try_me_else(3),

label(2),
    get_nil(0),
    get_value(x(2),1),
    cut(x(3)),
    proceed,

label(3),
    retry_me_else(5),

label(4),
    allocate(3),
    get_variable(y(1),2),
    get_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    cut(x(3)),
    put_variable(y(2),2),
    call(allocate_labels/3),
    put_value(y(0),0),
    put_unsafe_value(y(2),1),
    put_value(y(1),2),
    deallocate,
    execute(allocate_labels/3),

label(5),
    trust_me_else_fail,

label(6),
    get_structure(label/1,0),
    unify_local_value(x(1)),
    cut(x(3)),
    math_fast_load_value(x(1),0),
    call_c('Pl_Fct_Fast_Inc',[fast_call,x(0)],[x(0)]),
    get_value(x(2),0),
    proceed,

label(7),
    trust_me_else_fail,
    get_value(x(2),1),
    proceed]).
