% compiler: GNU Prolog 1.1.1 (Oct 18 1999)
% file    : syn_sugar.pl
% date    : 10 22 1999
% time    : 14:54:25


file_name('/home/lima/diaz/GNU-Prolog/src/Pl2Wam/syn_sugar.pl').


predicate(syntactic_sugar_init_pred/2,25,static,private,user,[
    load_cut_level(2),
    try_me_else(1),
    allocate(1),
    get_variable(y(0),2),
    call('$aux_name'/1),
    cut(y(0)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(aux,0),
    put_integer(1,1),
    call_c_test('Blt_G_Assign',[0,1]),
    proceed]).


predicate(syntactic_sugar/3,35,static,private,user,[
    load_cut_level(3),
    allocate(5),
    get_variable(y(0),1),
    get_variable(y(1),2),
    get_variable(y(2),3),
    put_value(y(0),1),
    put_variable(y(3),2),
    call('$syntactic_sugar/3_$aux1'/3),
    cut(y(2)),
    put_value(y(3),0),
    put_variable(y(4),1),
    call(normalize_cuts/2),
    put_unsafe_value(y(4),0),
    put_value(y(0),1),
    put_value(y(1),2),
    deallocate,
    execute(normalize_alts/3)]).


predicate('$syntactic_sugar/3_$aux1'/3,35,static,private,user,[
    try_me_else(2),
    switch_on_term(1,fail,fail,fail,1),

label(1),
    get_structure((:-)/2,0),
    unify_local_value(x(1)),
    unify_local_value(x(2)),
    proceed,

label(2),
    trust_me_else_fail,
    get_value(x(1),0),
    get_atom(true,2),
    proceed]).


predicate(normalize_cuts/2,43,static,private,user,[
    load_cut_level(2),
    allocate(4),
    get_variable(y(0),1),
    get_variable(y(1),2),
    put_atom(has_cut,1),
    put_atom(f,2),
    call_c_test('Blt_G_Assign',[1,2]),
    put_variable(y(2),1),
    put_variable(y(3),2),
    call(normalize_cuts1/3),
    cut(y(1)),
    put_value(y(0),0),
    put_unsafe_value(y(2),1),
    put_unsafe_value(y(3),2),
    deallocate,
    execute('$normalize_cuts/2_$aux1'/3)]).


predicate('$normalize_cuts/2_$aux1'/3,43,static,private,user,[
    load_cut_level(3),
    try_me_else(1),
    put_atom(has_cut,4),
    put_atom(t,5),
    call_c_test('Blt_G_Read',[4,5]),
    cut(x(3)),
    get_structure((',')/2,0),
    unify_variable(x(0)),
    unify_local_value(x(2)),
    get_structure('$get_cut_level'/1,0),
    unify_local_value(x(1)),
    proceed,

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


predicate(normalize_cuts1/3,52,static,private,user,[
    try_me_else(1),
    get_variable(x(3),0),
    call_c_test('Blt_Var',[3]),
    put_structure(call/1,0),
    unify_local_value(x(3)),
    execute(normalize_cuts1/3),

label(1),
    retry_me_else(20),
    switch_on_term(4,9,fail,fail,2),

label(2),
    switch_on_structure([((;)/2,3),((->)/2,7),((',')/2,11),(call/1,15),(catch/3,17),(throw/1,19)]),

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

label(4),
    try_me_else(6),

label(5),
    allocate(3),
    get_variable(y(1),1),
    get_structure((;)/2,0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    call_c_test('Blt_Non_Var',[0]),
    get_structure((->)/2,0),
    unify_variable(x(3)),
    unify_variable(x(0)),
    get_structure((;)/2,2),
    unify_variable(x(1)),
    unify_variable(y(2)),
    get_structure((',')/2,1),
    unify_variable(x(1)),
    unify_structure((',')/2),
    unify_value(x(3)),
    unify_structure((',')/2),
    unify_variable(x(3)),
    unify_variable(x(2)),
    get_structure('$get_cut_level'/1,1),
    unify_variable(x(1)),
    get_structure('$cut'/1,3),
    unify_value(x(1)),
    put_value(y(1),1),
    call(normalize_cuts1/3),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),2),
    deallocate,
    execute(normalize_cuts1/3),

label(6),
    retry_me_else(8),

label(7),
    get_structure((->)/2,0),
    unify_variable(x(4)),
    unify_variable(x(0)),
    get_structure((;)/2,2),
    unify_variable(x(2)),
    unify_atom(fail),
    get_structure((',')/2,2),
    unify_variable(x(3)),
    unify_structure((',')/2),
    unify_value(x(4)),
    unify_structure((',')/2),
    unify_variable(x(4)),
    unify_variable(x(2)),
    get_structure('$get_cut_level'/1,3),
    unify_variable(x(3)),
    get_structure('$cut'/1,4),
    unify_value(x(3)),
    execute(normalize_cuts1/3),

label(8),
    retry_me_else(10),

label(9),
    get_atom(!,0),
    get_structure('$cut'/1,2),
    unify_local_value(x(1)),
    put_atom(has_cut,0),
    put_atom(t,1),
    call_c_test('Blt_G_Assign',[0,1]),
    proceed,

label(10),
    retry_me_else(12),

label(11),
    allocate(3),
    get_variable(y(1),1),
    get_structure((',')/2,0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure((',')/2,2),
    unify_variable(x(2)),
    unify_variable(y(2)),
    put_value(y(1),1),
    call(normalize_cuts1/3),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),2),
    deallocate,
    execute(normalize_cuts1/3),

label(12),
    retry_me_else(14),

label(13),
    allocate(3),
    get_variable(y(1),1),
    get_structure((;)/2,0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_structure((;)/2,2),
    unify_variable(x(2)),
    unify_variable(y(2)),
    put_value(y(1),1),
    call(normalize_cuts1/3),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),2),
    deallocate,
    execute(normalize_cuts1/3),

label(14),
    retry_me_else(16),

label(15),
    get_structure(call/1,0),
    unify_variable(x(0)),
    get_structure('$call'/4,2),
    unify_value(x(0)),
    unify_variable(x(0)),
    unify_variable(x(1)),
    unify_atom(true),
    execute(cur_pred_without_aux/2),

label(16),
    retry_me_else(18),

label(17),
    get_structure(catch/3,0),
    unify_variable(x(3)),
    unify_variable(x(1)),
    unify_variable(x(0)),
    get_structure('$catch'/6,2),
    unify_value(x(3)),
    unify_value(x(1)),
    unify_value(x(0)),
    unify_variable(x(0)),
    unify_variable(x(1)),
    unify_atom(true),
    execute(cur_pred_without_aux/2),

label(18),
    trust_me_else_fail,

label(19),
    get_structure(throw/1,0),
    unify_variable(x(0)),
    get_structure('$throw'/4,2),
    unify_value(x(0)),
    unify_variable(x(0)),
    unify_variable(x(1)),
    unify_atom(true),
    execute(cur_pred_without_aux/2),

label(20),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),2),
    put_value(y(0),0),
    call('$normalize_cuts1/3_$aux1'/1),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute(pred_rewriting/2)]).


predicate('$normalize_cuts1/3_$aux1'/1,87,static,private,user,[
    load_cut_level(1),
    try_me_else(1),
    call_c_test('Blt_Callable',[0]),
    cut(x(1)),
    proceed,

label(1),
    trust_me_else_fail,
    put_list(1),
    unify_local_value(x(0)),
    unify_nil,
    put_atom('body goal is not callable (~q)',0),
    execute(error/2)]).


predicate(normalize_alts/3,95,static,private,user,[
    load_cut_level(3),
    allocate(1),
    get_variable(y(0),3),
    put_variable(x(5),3),
    put_variable(x(4),6),
    call_c_test('Blt_Functor',[1,3,6]),
    put_atom(head_functor,3),
    call_c_test('Blt_G_Assign',[3,5]),
    put_atom(head_arity,3),
    call_c_test('Blt_G_Assign',[3,4]),
    call(normalize_alts1/3),
    cut(y(0)),
    deallocate,
    proceed]).


predicate(normalize_alts1/3,103,static,private,user,[
    try_me_else(1),
    get_structure(call/1,2),
    unify_local_value(x(0)),
    call_c_test('Blt_Var',[0]),
    proceed,

label(1),
    retry_me_else(7),
    switch_on_term(3,fail,fail,fail,2),

label(2),
    switch_on_structure([((',')/2,4),((;)/2,6)]),

label(3),
    try_me_else(5),

label(4),
    allocate(4),
    get_structure((',')/2,0),
    unify_variable(y(0)),
    unify_variable(y(1)),
    get_variable(y(2),1),
    get_structure((',')/2,2),
    unify_variable(x(2)),
    unify_variable(y(3)),
    put_value(y(0),0),
    put_structure((',')/2,1),
    unify_local_value(y(2)),
    unify_value(y(1)),
    call(normalize_alts1/3),
    put_value(y(1),0),
    put_structure((',')/2,1),
    unify_local_value(y(2)),
    unify_value(y(0)),
    put_value(y(3),2),
    deallocate,
    execute(normalize_alts1/3),

label(5),
    trust_me_else_fail,

label(6),
    allocate(9),
    get_structure((;)/2,0),
    unify_variable(y(0)),
    unify_variable(y(1)),
    get_variable(y(2),2),
    put_value(x(1),0),
    put_nil(1),
    put_variable(y(3),2),
    call(lst_var/3),
    put_structure((;)/2,0),
    unify_value(y(0)),
    unify_value(y(1)),
    put_nil(1),
    put_variable(y(4),2),
    call(lst_var/3),
    put_value(y(4),0),
    put_value(y(3),1),
    put_variable(y(5),2),
    call(set_inter/3),
    put_value(y(5),0),
    put_variable(y(6),1),
    call(length/2),
    put_atom(head_functor,1),
    put_variable(x(0),2),
    call_c_test('Blt_G_Read',[1,2]),
    put_atom(head_arity,2),
    put_variable(x(1),3),
    call_c_test('Blt_G_Read',[2,3]),
    put_variable(y(7),2),
    put_value(y(6),3),
    call(init_aux_pred_name/4),
    put_value(y(2),0),
    put_list(1),
    unify_local_value(y(7)),
    unify_local_value(y(5)),
    call_c_test('Blt_Univ',[0,1]),
    put_atom(where,0),
    put_variable(x(2),1),
    call_c_test('Blt_G_Read',[0,1]),
    put_structure((;)/2,0),
    unify_value(y(0)),
    unify_value(y(1)),
    put_value(y(2),1),
    put_variable(y(8),3),
    call(linearize/4),
    put_structure(buff_aux_pred/3,0),
    unify_local_value(y(7)),
    unify_local_value(y(6)),
    unify_local_value(y(8)),
    deallocate,
    execute(asserta/1),

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


predicate(init_aux_pred_name/4,128,static,private,user,[
    load_cut_level(4),
    allocate(5),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    get_variable(y(4),4),
    put_atom(aux,0),
    put_variable(x(2),1),
    call_c_test('Blt_G_Read',[0,1]),
    math_fast_load_value(x(2),0),
    function('Fct_Fast_Inc',1,[0]),
    put_atom(aux,0),
    call_c_test('Blt_G_Assign',[0,1]),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),3),
    call('$make_aux_name'/4),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),2),
    put_value(y(3),3),
    call('$init_aux_pred_name/4_$aux1'/4),
    cut(y(4)),
    deallocate,
    proceed]).


predicate('$init_aux_pred_name/4_$aux1'/4,128,static,private,user,[
    try_me_else(1),
    allocate(2),
    get_variable(y(0),2),
    get_variable(y(1),3),
    get_variable(x(2),1),
    put_value(x(0),1),
    put_atom(bpl,0),
    call(test_pred_info/3),
    put_atom(bpl,0),
    put_value(y(0),1),
    put_value(y(1),2),
    deallocate,
    execute(set_pred_info/3),

label(1),
    retry_me_else(2),
    allocate(2),
    get_variable(y(0),2),
    get_variable(y(1),3),
    get_variable(x(2),1),
    put_value(x(0),1),
    put_atom(bfd,0),
    call(test_pred_info/3),
    put_atom(bfd,0),
    put_value(y(0),1),
    put_value(y(1),2),
    deallocate,
    execute(set_pred_info/3),

label(2),
    trust_me_else_fail,
    proceed]).


predicate(linearize/4,143,static,private,user,[
    execute('$linearize/4_$aux1'/4)]).


predicate('$linearize/4_$aux1'/4,143,static,private,user,[
    load_cut_level(4),
    try_me_else(2),
    switch_on_term(1,fail,fail,fail,1),

label(1),
    allocate(6),
    get_variable(y(0),1),
    get_variable(y(1),2),
    get_variable(y(2),3),
    get_structure((;)/2,0),
    unify_variable(y(3)),
    unify_variable(x(0)),
    cut(x(4)),
    put_value(y(0),1),
    put_value(y(1),2),
    put_variable(y(4),3),
    call(linearize/4),
    put_value(y(3),0),
    put_value(y(0),1),
    put_value(y(1),2),
    put_variable(y(5),3),
    call(linearize1/4),
    put_unsafe_value(y(5),0),
    put_unsafe_value(y(4),1),
    put_value(y(2),2),
    deallocate,
    execute(append/3),

label(2),
    trust_me_else_fail,
    execute(linearize1/4)]).


predicate(linearize1/4,151,static,private,user,[
    load_cut_level(4),
    try_me_else(2),
    switch_on_term(1,1,fail,fail,fail),

label(1),
    get_atom(fail,0),
    get_nil(3),
    cut(x(4)),
    proceed,

label(2),
    trust_me_else_fail,
    get_variable(x(5),1),
    get_variable(x(4),0),
    get_list(3),
    unify_variable(x(0)),
    unify_nil,
    get_structure((+)/2,0),
    unify_local_value(x(2)),
    unify_variable(x(1)),
    put_structure((:-)/2,0),
    unify_local_value(x(5)),
    unify_local_value(x(4)),
    execute(copy_term/2)]).


predicate(lst_var/3,160,static,private,user,[
    load_cut_level(3),
    try_me_else(1),
    get_variable(x(4),1),
    get_variable(x(1),0),
    call_c_test('Blt_Var',[1]),
    cut(x(3)),
    put_value(x(4),0),
    execute(set_add/3),

label(1),
    trust_me_else_fail,
    get_variable(x(4),2),
    get_variable(x(3),1),
    put_void(2),
    put_variable(x(1),5),
    call_c_test('Blt_Functor',[0,2,5]),
    put_value(x(0),2),
    put_integer(1,0),
    execute(lst_var_args/5)]).


predicate(lst_var_args/5,171,static,private,user,[
    execute('$lst_var_args/5_$aux1'/5)]).


predicate('$lst_var_args/5_$aux1'/5,171,static,private,user,[
    load_cut_level(5),
    try_me_else(1),
    allocate(5),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),4),
    math_fast_load_value(y(0),0),
    math_fast_load_value(y(1),1),
    call_c_test('Blt_Fast_Lte',[0,1]),
    cut(x(5)),
    put_value(y(0),1),
    put_value(y(2),2),
    put_variable(x(0),4),
    call_c_test('Blt_Arg',[1,2,4]),
    put_value(x(3),1),
    put_variable(y(4),2),
    call(lst_var/3),
    math_fast_load_value(y(0),0),
    function('Fct_Fast_Inc',0,[0]),
    put_value(y(1),1),
    put_value(y(2),2),
    put_unsafe_value(y(4),3),
    put_value(y(3),4),
    deallocate,
    execute(lst_var_args/5),

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


predicate(pred_rewriting/2,184,static,private,user,[
    load_cut_level(2),
    try_me_else(6),
    switch_on_term(2,fail,fail,fail,1),

label(1),
    switch_on_structure([(fd_tell/1,3),(set_bip_name/2,5)]),

label(2),
    try_me_else(4),

label(3),
    allocate(1),
    get_structure(fd_tell/1,0),
    unify_variable(x(0)),
    get_structure('$call_c_test'/1,1),
    unify_value(x(0)),
    get_variable(y(0),2),
    put_structure((/)/2,0),
    unify_atom(fd_tell),
    unify_integer(1),
    call(test_call_c_allowed/1),
    cut(y(0)),
    deallocate,
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    allocate(4),
    get_structure(set_bip_name/2,0),
    unify_variable(y(0)),
    unify_variable(y(1)),
    get_variable(y(2),1),
    get_variable(y(3),2),
    put_atom(inline,0),
    put_atom(t,1),
    call_c_test('Blt_G_Read',[0,1]),
    put_value(y(0),0),
    call_c_test('Blt_Non_Var',[0]),
    put_value(y(1),0),
    call_c_test('Blt_Non_Var',[0]),
    cut(y(3)),
    put_value(y(0),0),
    call('$pred_rewriting/2_$aux1'/1),
    put_value(y(1),0),
    call('$pred_rewriting/2_$aux2'/1),
    cut(y(3)),
    put_value(y(2),0),
    get_structure('$call_c'/1,0),
    unify_structure('Set_Bip_Name_2'/2),
    unify_value(y(0)),
    unify_value(y(1)),
    deallocate,
    proceed,

label(6),
    retry_me_else(7),
    allocate(4),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_atom(inline,0),
    put_atom(t,1),
    call_c_test('Blt_G_Read',[0,1]),
    put_atom(fast_math,0),
    put_atom(f,1),
    call_c_test('Blt_G_Read',[0,1]),
    put_value(y(0),0),
    put_variable(y(3),1),
    put_integer(2,2),
    call_c_test('Blt_Functor',[0,1,2]),
    put_value(y(3),0),
    call('$pred_rewriting/2_$aux3'/1),
    cut(y(2)),
    put_value(y(1),0),
    get_structure((',')/2,0),
    unify_variable(x(0)),
    unify_local_value(y(0)),
    get_structure('$call_c'/1,0),
    unify_structure('Set_Bip_Name_2'/2),
    unify_local_value(y(3)),
    unify_integer(2),
    deallocate,
    proceed,

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


predicate('$pred_rewriting/2_$aux3'/1,202,static,private,user,[
    try_me_else(2),
    switch_on_term(1,1,fail,fail,fail),

label(1),
    get_atom(is,0),
    proceed,

label(2),
    trust_me_else_fail,
    put_void(1),
    execute(math_cmp_functor_name/2)]).


predicate('$pred_rewriting/2_$aux2'/1,188,static,private,user,[
    try_me_else(1),
    call_c_test('Blt_Integer',[0]),
    proceed,

label(1),
    trust_me_else_fail,
    put_list(1),
    unify_local_value(x(0)),
    unify_nil,
    put_atom('set_bip_name/2 inline: integer expected instead of ~q',0),
    execute(error/2)]).


predicate('$pred_rewriting/2_$aux1'/1,188,static,private,user,[
    try_me_else(1),
    call_c_test('Blt_Atom',[0]),
    proceed,

label(1),
    trust_me_else_fail,
    put_list(1),
    unify_local_value(x(0)),
    unify_nil,
    put_atom('set_bip_name/2 inline: atom expected instead of ~q',0),
    execute(error/2)]).


predicate(test_call_c_allowed/1,215,static,private,user,[
    load_cut_level(1),
    try_me_else(1),
    put_atom(call_c,0),
    put_atom(t,2),
    call_c_test('Blt_G_Read',[0,2]),
    cut(x(1)),
    proceed,

label(1),
    trust_me_else_fail,
    put_list(1),
    unify_local_value(x(0)),
    unify_nil,
    put_atom('~q not allowed in this mode',0),
    execute(error/2)]).


predicate(add_wrapper_to_dyn_clause/4,225,static,private,user,[
    allocate(5),
    get_variable(y(0),1),
    get_structure((+)/2,2),
    unify_variable(y(1)),
    unify_variable(y(2)),
    get_variable(y(3),3),
    put_value(y(0),1),
    put_value(y(3),2),
    put_value(y(0),3),
    call(init_aux_pred_name/4),
    put_value(y(2),0),
    put_value(y(3),1),
    put_variable(y(4),2),
    call('$add_wrapper_to_dyn_clause/4_$aux1'/3),
    put_structure((+)/2,1),
    unify_value(y(1)),
    unify_local_value(y(4)),
    put_structure(buff_aux_pred/3,0),
    unify_local_value(y(3)),
    unify_local_value(y(0)),
    unify_list,
    unify_value(x(1)),
    unify_nil,
    deallocate,
    execute(assertz/1)]).


predicate('$add_wrapper_to_dyn_clause/4_$aux1'/3,225,static,private,user,[
    load_cut_level(3),
    try_me_else(2),
    switch_on_term(1,fail,fail,fail,1),

label(1),
    allocate(3),
    get_variable(y(0),2),
    get_structure((:-)/2,0),
    unify_variable(x(0)),
    unify_variable(y(1)),
    cut(x(3)),
    put_variable(y(2),2),
    call(head_wrapper/3),
    put_value(y(0),0),
    get_structure((:-)/2,0),
    unify_local_value(y(2)),
    unify_value(y(1)),
    deallocate,
    proceed,

label(2),
    trust_me_else_fail,
    execute(head_wrapper/3)]).


predicate(head_wrapper/3,235,static,private,user,[
    put_list(4),
    unify_void(1),
    unify_variable(x(3)),
    call_c_test('Blt_Univ',[0,4]),
    put_list(0),
    unify_local_value(x(1)),
    unify_value(x(3)),
    call_c_test('Blt_Univ',[2,0]),
    proceed]).
