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


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


predicate('$use_catch'/0,42,static,private,monofile,built_in,[
    proceed]).


predicate('$catch'/6,48,static,private,monofile,built_in,[
    call_c('Pl_Save_Call_Info_3',[],[x(3),x(4),x(5)]),
    put_integer(0,3),
    execute('$catch1'/4)]).


predicate('$catch1'/4,52,static,private,monofile,built_in,[
    put_integer(3,4),
    call_c('Pl_Load_Call_Info_Arg_1',[],[x(4)]),
    execute('$catch_internal'/4)]).


predicate('$catch_internal'/4,57,static,private,monofile,built_in,[
    allocate(5),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    put_integer(7,0),
    put_variable(y(4),1),
    call('$sys_var_read'/2),
    put_integer(8,0),
    put_atom('$no_ball$',1),
    call('$sys_var_put'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(2),2),
    put_value(y(3),3),
    put_unsafe_value(y(4),4),
    deallocate,
    execute('$catch_internal1'/5)]).


predicate('$catch_internal1'/5,63,static,private,monofile,built_in,[
    pragma_arity(6),
    get_current_choice(x(5)),
    try_me_else(1),
    allocate(6),
    get_variable(y(0),0),
    get_variable(y(1),3),
    get_variable(y(2),4),
    get_variable(y(3),5),
    put_variable(y(4),0),
    call('$get_current_B'/1),
    put_integer(7,0),
    put_value(y(4),1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    call('$call_internal'/2),
    put_variable(y(5),0),
    call('$get_current_B'/1),
    put_value(y(5),0),
    put_value(y(4),1),
    put_value(y(3),2),
    call('$$catch_internal1/5_$aux1'/3),
    put_integer(7,0),
    put_value(y(2),1),
    deallocate,
    execute('$sys_var_write'/2),

label(1),
    trust_me_else_fail,
    allocate(5),
    get_variable(y(0),1),
    get_variable(y(1),2),
    get_variable(y(2),3),
    get_variable(y(3),4),
    put_integer(7,0),
    put_value(y(3),1),
    call('$sys_var_write'/2),
    put_integer(8,0),
    put_variable(y(4),1),
    call('$sys_var_get'/2),
    put_unsafe_value(y(4),0),
    put_atom('$no_ball$',1),
    call_c('Pl_Blt_Term_Neq',[fast_call,boolean],[x(0),x(1)]),
    put_unsafe_value(y(4),0),
    put_value(y(0),1),
    put_value(y(1),2),
    put_value(y(2),3),
    put_value(y(3),4),
    deallocate,
    execute('$catch_a_throw'/5)]).


predicate('$$catch_internal1/5_$aux1'/3,63,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    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),2),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(0),x(2)]),
    cut(x(3)),
    put_value(x(1),0),
    execute('$trail_handler'/1),

label(1),
    trust_me_else_fail,
    cut(x(2)),
    proceed]).


predicate('$catch_a_throw'/5,92,static,private,monofile,built_in,[
    pragma_arity(6),
    get_current_choice(x(5)),
    try_me_else(1),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    get_structure('$catch_sync'/1,0),
    unify_variable(x(1)),
    cut(x(5)),
    put_value(x(4),0),
    execute('$$catch_a_throw/5_$aux1'/2),

label(1),
    retry_me_else(2),
    allocate(2),
    get_variable(y(0),2),
    get_variable(y(1),3),
    get_value(x(1),0),
    cut(x(5)),
    put_integer(8,0),
    put_atom('$no_ball$',1),
    call('$sys_var_put'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute('$call_internal'/2),

label(2),
    trust_me_else_fail,
    execute('$unwind'/1)]).


predicate('$$catch_a_throw/5_$aux1'/2,92,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),3),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(0),x(3)]),
    cut(x(2)),
    put_structure('$catch_sync'/1,0),
    unify_local_value(x(1)),
    execute('$unwind'/1),

label(1),
    trust_me_else_fail,
    put_value(x(1),0),
    execute('$catch_fail_now'/1)]).


predicate('$trail_handler'/1,118,static,private,monofile,built_in,[
    try_me_else(1),
    proceed,

label(1),
    trust_me_else_fail,
    allocate(0),
    put_value(x(0),1),
    put_integer(7,0),
    call('$sys_var_write'/2),
    fail]).


predicate('$catch_sync_for_fail_at'/1,127,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    put_integer(7,0),
    put_variable(y(1),1),
    call('$sys_var_read'/2),
    put_unsafe_value(y(1),0),
    put_value(y(0),1),
    deallocate,
    execute('$$catch_sync_for_fail_at/1_$aux1'/2)]).


predicate('$$catch_sync_for_fail_at/1_$aux1'/2,127,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),3),
    call_c('Pl_Blt_Gt',[fast_call,boolean],[x(0),x(3)]),
    cut(x(2)),
    put_structure('$catch_sync'/1,0),
    unify_local_value(x(1)),
    put_atom('$catch_sync_for_fail_at',1),
    put_integer(1,2),
    put_atom(true,3),
    execute('$throw'/4),

label(1),
    trust_me_else_fail,
    execute('$catch_fail_now'/1)]).


predicate('$catch_fail_now'/1,139,static,private,monofile,built_in,[
    allocate(0),
    call('$set_current_B'/1),
    fail]).
