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


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


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


predicate(current_input/1,45,static,private,monofile,built_in,[
    allocate(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[current_input,1]),
    put_variable(y(0),1),
    call('$check_stream_or_var'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    call_c('Pl_Current_Input_1',[boolean],[x(0)]),
    proceed]).


predicate(current_output/1,53,static,private,monofile,built_in,[
    allocate(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[current_output,1]),
    put_variable(y(0),1),
    call('$check_stream_or_var'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    call_c('Pl_Current_Output_1',[boolean],[x(0)]),
    proceed]).


predicate('$check_stream_or_var'/2,61,static,private,monofile,built_in,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    allocate(1),
    get_structure('$stream'/1,0),
    unify_local_value(x(1)),
    get_variable(y(0),2),
    put_value(x(1),0),
    call('$$check_stream_or_var/2_$aux1'/1),
    cut(y(0)),
    deallocate,
    proceed,

label(1),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(stream,0),
    execute('$pl_err_domain'/2)]).


predicate('$$check_stream_or_var/2_$aux1'/1,61,static,private,monofile,local,[
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    proceed,

label(1),
    trust_me_else_fail,
    call_c('Pl_Blt_Integer',[fast_call,boolean],[x(0)]),
    proceed]).


predicate(set_input/1,72,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_input,1]),
    call_c('Pl_Set_Input_1',[],[x(0)]),
    proceed]).


predicate(set_output/1,79,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_output,1]),
    call_c('Pl_Set_Output_1',[],[x(0)]),
    proceed]).


predicate('$set_top_level_streams'/2,86,static,private,monofile,built_in,[
    call_c('Pl_Set_Top_Level_Streams_2',[],[x(0),x(1)]),
    proceed]).


predicate('$set_debugger_streams'/2,92,static,private,monofile,built_in,[
    call_c('Pl_Set_Debugger_Streams_2',[],[x(0),x(1)]),
    proceed]).


predicate(open/3,111,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open,3]),
    put_nil(3),
    execute('$open'/4)]).


predicate(open/4,116,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open,4]),
    execute('$open'/4)]).


predicate('$open'/4,121,static,private,monofile,built_in,[
    allocate(7),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    get_variable(y(3),3),
    call('$set_open_defaults'/0),
    put_value(y(2),0),
    put_variable(y(4),1),
    call('$get_open_stm'/2),
    put_atom('$open_aliases',0),
    put_variable(y(5),1),
    call_c('Pl_Blt_G_Link',[fast_call],[x(0),x(1)]),
    put_atom('$open_mirrors',0),
    put_variable(y(6),1),
    call_c('Pl_Blt_G_Link',[fast_call],[x(0),x(1)]),
    put_value(y(3),0),
    call('$get_open_options'/1),
    put_atom('$open_aliases',0),
    put_nil(1),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(1)]),
    put_atom('$open_mirrors',0),
    put_nil(1),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(1)]),
    put_value(y(0),0),
    put_value(y(1),1),
    put_value(y(4),2),
    call_c('Pl_Open_3',[],[x(0),x(1),x(2)]),
    put_value(y(5),0),
    put_value(y(2),1),
    call('$add_aliases_to_stream'/2),
    put_unsafe_value(y(6),0),
    put_value(y(2),1),
    deallocate,
    execute('$add_mirrors_to_stream'/2)]).


predicate('$set_open_defaults'/0,136,static,private,monofile,built_in,[
    put_integer(0,0),
    put_integer(1,1),
    execute('$sys_var_write'/2)]).


predicate('$get_open_stm'/2,142,static,private,monofile,built_in,[
    execute('$$get_open_stm/2_$aux1'/2)]).


predicate('$$get_open_stm/2_$aux1'/2,142,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    cut(x(2)),
    execute('$pl_err_uninstantiation'/1),

label(1),
    trust_me_else_fail,
    get_structure('$stream'/1,0),
    unify_local_value(x(1)),
    proceed]).


predicate('$get_open_options'/1,151,static,private,monofile,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_value(y(0),0),
    call('$check_list'/1),
    put_value(y(0),0),
    deallocate,
    execute('$get_open_options1'/1)]).


predicate('$get_open_options1'/1,156,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    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_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_variable(y(1),1),
    call('$get_open_options2'/1),
    cut(y(1)),
    put_value(y(0),0),
    deallocate,
    execute('$get_open_options1'/1)]).


predicate('$get_open_options2'/1,163,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    execute('$pl_err_instantiation'/0),

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

label(2),
    switch_on_structure([(type/1,4),(reposition/1,6),(eof_action/1,8),(buffering/1,10),(alias/1,12),(mirror/1,14)]),

label(3),
    try_me_else(5),

label(4),
    get_structure(type/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_open_options2/1_$aux1'/1),

label(5),
    retry_me_else(7),

label(6),
    allocate(0),
    get_structure(reposition/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    call('$$get_open_options2/1_$aux2'/1),
    put_integer(0,0),
    put_integer(2,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(7),
    retry_me_else(9),

label(8),
    allocate(0),
    get_structure(eof_action/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    call('$$get_open_options2/1_$aux3'/1),
    put_integer(0,0),
    put_integer(5,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(9),
    retry_me_else(11),

label(10),
    allocate(0),
    get_structure(buffering/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    call('$$get_open_options2/1_$aux4'/1),
    put_integer(0,0),
    put_integer(8,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(11),
    retry_me_else(13),

label(12),
    get_structure(alias/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Atom',[fast_call,boolean],[x(0)]),
    cut(x(1)),
    execute('$$get_open_options2/1_$aux5'/1),

label(13),
    trust_me_else_fail,

label(14),
    allocate(2),
    get_structure(mirror/1,0),
    unify_variable(y(0)),
    get_variable(y(1),1),
    put_value(y(0),0),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    put_value(y(0),0),
    call('$$get_open_options2/1_$aux6'/1),
    cut(y(1)),
    put_value(y(0),0),
    call_c('Pl_Check_Valid_Mirror_1',[],[x(0)]),
    put_atom('$open_mirrors',0),
    put_list(2),
    unify_value(y(0)),
    unify_variable(x(1)),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(0),x(2)]),
    put_atom('$open_mirrors',0),
    call_c('Pl_Blt_G_Link',[fast_call],[x(0),x(1)]),
    deallocate,
    proceed,

label(15),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(stream_option,0),
    execute('$pl_err_domain'/2)]).


predicate('$$get_open_options2/1_$aux6'/1,220,static,private,monofile,local,[
    try_me_else(1),
    get_structure('$stream'/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Integer',[fast_call,boolean],[x(0)]),
    proceed,

label(1),
    trust_me_else_fail,
    call_c('Pl_Blt_Atom',[fast_call,boolean],[x(0)]),
    proceed]).


predicate('$$get_open_options2/1_$aux5'/1,212,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Test_Alias_Not_Assigned_1',[boolean],[x(0)]),
    cut(x(1)),
    put_atom('$open_aliases',2),
    put_list(3),
    unify_local_value(x(0)),
    unify_variable(x(1)),
    call_c('Pl_Blt_G_Read',[fast_call,boolean],[x(2),x(3)]),
    put_atom('$open_aliases',0),
    call_c('Pl_Blt_G_Link',[fast_call],[x(0),x(1)]),
    proceed,

label(1),
    trust_me_else_fail,
    put_structure(alias/1,2),
    unify_local_value(x(0)),
    put_atom(open,0),
    put_atom(source_sink,1),
    execute('$pl_err_permission'/3)]).


predicate('$$get_open_options2/1_$aux4'/1,198,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(none,3),(line,5),(block,7)]),

label(2),
    try_me_else(4),

label(3),
    allocate(0),
    get_atom(none,0),
    put_integer(0,0),
    put_integer(7,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(6,1),
    deallocate,
    execute('$sys_var_reset_bit'/2),

label(4),
    retry_me_else(6),

label(5),
    allocate(0),
    get_atom(line,0),
    put_integer(0,0),
    put_integer(7,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(6,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(6),
    trust_me_else_fail,

label(7),
    allocate(0),
    get_atom(block,0),
    put_integer(0,0),
    put_integer(7,1),
    call('$sys_var_set_bit'/2),
    put_integer(0,0),
    put_integer(6,1),
    deallocate,
    execute('$sys_var_reset_bit'/2)]).


predicate('$$get_open_options2/1_$aux3'/1,184,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(error,3),(eof_code,5),(reset,7)]),

label(2),
    try_me_else(4),

label(3),
    allocate(0),
    get_atom(error,0),
    put_integer(0,0),
    put_integer(4,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_reset_bit'/2),

label(4),
    retry_me_else(6),

label(5),
    allocate(0),
    get_atom(eof_code,0),
    put_integer(0,0),
    put_integer(4,1),
    call('$sys_var_reset_bit'/2),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_set_bit'/2),

label(6),
    trust_me_else_fail,

label(7),
    allocate(0),
    get_atom(reset,0),
    put_integer(0,0),
    put_integer(4,1),
    call('$sys_var_set_bit'/2),
    put_integer(0,0),
    put_integer(3,1),
    deallocate,
    execute('$sys_var_reset_bit'/2)]).


predicate('$$get_open_options2/1_$aux2'/1,175,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(false,3),(true,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(false,0),
    put_integer(0,0),
    put_integer(1,1),
    execute('$sys_var_reset_bit'/2),

label(4),
    trust_me_else_fail,

label(5),
    get_atom(true,0),
    put_integer(0,0),
    put_integer(1,1),
    execute('$sys_var_set_bit'/2)]).


predicate('$$get_open_options2/1_$aux1'/1,167,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(text,3),(binary,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(text,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_set_bit'/2),

label(4),
    trust_me_else_fail,

label(5),
    get_atom(binary,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_reset_bit'/2)]).


predicate('$add_aliases_to_stream'/2,234,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),
    get_list(0),
    unify_variable(x(2)),
    unify_variable(x(0)),
    call_c('Pl_Add_Stream_Alias_2',[],[x(1),x(2)]),
    execute('$add_aliases_to_stream'/2)]).


predicate('$add_mirrors_to_stream'/2,242,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),
    get_list(0),
    unify_variable(x(2)),
    unify_variable(x(0)),
    call_c('Pl_Add_Stream_Mirror_2',[],[x(1),x(2)]),
    execute('$add_mirrors_to_stream'/2)]).


predicate(close/1,260,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close,1]),
    put_nil(1),
    execute('$close'/2)]).


predicate(close/2,264,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close,2]),
    execute('$close'/2)]).


predicate('$close'/2,269,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_integer(0,0),
    put_integer(0,1),
    call('$sys_var_write'/2),
    put_value(y(1),0),
    call('$get_close_options'/1),
    put_value(y(0),0),
    deallocate,
    call_c('Pl_Close_1',[],[x(0)]),
    proceed]).


predicate('$get_close_options'/1,277,static,private,monofile,built_in,[
    allocate(1),
    get_variable(y(0),0),
    put_value(y(0),0),
    call('$check_list'/1),
    put_value(y(0),0),
    deallocate,
    execute('$get_close_options1'/1)]).


predicate('$get_close_options1'/1,282,static,private,monofile,built_in,[
    pragma_arity(2),
    get_current_choice(x(1)),
    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_list(0),
    unify_variable(x(0)),
    unify_variable(y(0)),
    get_variable(y(1),1),
    call('$get_close_options2'/1),
    cut(y(1)),
    put_value(y(0),0),
    deallocate,
    execute('$get_close_options1'/1)]).


predicate('$get_close_options2'/1,289,static,private,monofile,built_in,[
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    execute('$pl_err_instantiation'/0),

label(1),
    retry_me_else(2),
    get_structure(force/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    execute('$$get_close_options2/1_$aux1'/1),

label(2),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(close_option,0),
    execute('$pl_err_domain'/2)]).


predicate('$$get_close_options2/1_$aux1'/1,293,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(false,3),(true,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(false,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_reset_bit'/2),

label(4),
    trust_me_else_fail,

label(5),
    get_atom(true,0),
    put_integer(0,0),
    put_integer(0,1),
    execute('$sys_var_set_bit'/2)]).


predicate(add_stream_alias/2,307,static,private,monofile,built_in,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[add_stream_alias,2]),
    call_c('Pl_Add_Stream_Alias_2',[boolean],[x(0),x(1)]),
    cut(x(2)),
    proceed,

label(1),
    trust_me_else_fail,
    put_structure(alias/1,2),
    unify_local_value(x(1)),
    put_atom(add_alias,0),
    put_atom(source_sink,1),
    execute('$pl_err_permission'/3)]).


predicate(add_stream_mirror/2,317,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[add_stream_mirror,2]),
    call_c('Pl_Add_Stream_Mirror_2',[],[x(0),x(1)]),
    proceed]).


predicate(remove_stream_mirror/2,324,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[remove_stream_mirror,2]),
    call_c('Pl_Remove_Stream_Mirror_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(set_stream_type/2,331,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),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_stream_type,2]),
    put_value(y(1),0),
    call('$set_stream_type/2_$aux1'/1),
    put_value(y(1),0),
    put_variable(y(3),1),
    call('$set_stream_type/2_$aux2'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    deallocate,
    call_c('Pl_Set_Stream_Type_2',[],[x(0),x(1)]),
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(stream_type,0),
    execute('$pl_err_domain'/2)]).


predicate('$set_stream_type/2_$aux2'/2,331,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(text,3),(binary,5)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(text,0),
    get_integer(1,1),
    proceed,

label(4),
    trust_me_else_fail,

label(5),
    get_atom(binary,0),
    get_integer(0,1),
    proceed]).


predicate('$set_stream_type/2_$aux1'/1,331,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    cut(x(1)),
    execute('$pl_err_instantiation'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(set_stream_eof_action/2,350,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),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_stream_eof_action,2]),
    put_value(y(1),0),
    call('$set_stream_eof_action/2_$aux1'/1),
    put_value(y(1),0),
    put_variable(y(3),1),
    call('$set_stream_eof_action/2_$aux2'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    deallocate,
    call_c('Pl_Set_Stream_Eof_Action_2',[],[x(0),x(1)]),
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(eof_action,0),
    execute('$pl_err_domain'/2)]).


predicate('$set_stream_eof_action/2_$aux2'/2,350,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(error,3),(eof_code,5),(reset,7)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(error,0),
    get_integer(0,1),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_atom(eof_code,0),
    get_integer(1,1),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_atom(reset,0),
    get_integer(2,1),
    proceed]).


predicate('$set_stream_eof_action/2_$aux1'/1,350,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    cut(x(1)),
    execute('$pl_err_instantiation'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(set_stream_buffering/2,371,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),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_stream_buffering,2]),
    put_value(y(1),0),
    call('$set_stream_buffering/2_$aux1'/1),
    put_value(y(1),0),
    put_variable(y(3),1),
    call('$set_stream_buffering/2_$aux2'/2),
    cut(y(2)),
    put_value(y(0),0),
    put_unsafe_value(y(3),1),
    deallocate,
    call_c('Pl_Set_Stream_Buffering_2',[],[x(0),x(1)]),
    proceed,

label(1),
    trust_me_else_fail,
    put_atom(buffering_mode,0),
    execute('$pl_err_domain'/2)]).


predicate('$set_stream_buffering/2_$aux2'/2,371,static,private,monofile,local,[
    switch_on_term(2,1,fail,fail,fail),

label(1),
    switch_on_atom([(none,3),(line,5),(block,7)]),

label(2),
    try_me_else(4),

label(3),
    get_atom(none,0),
    get_integer(0,1),
    proceed,

label(4),
    retry_me_else(6),

label(5),
    get_atom(line,0),
    get_integer(1,1),
    proceed,

label(6),
    trust_me_else_fail,

label(7),
    get_atom(block,0),
    get_integer(2,1),
    proceed]).


predicate('$set_stream_buffering/2_$aux1'/1,371,static,private,monofile,local,[
    pragma_arity(2),
    get_current_choice(x(1)),
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    cut(x(1)),
    execute('$pl_err_instantiation'/0),

label(1),
    trust_me_else_fail,
    proceed]).


predicate(flush_output/0,392,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[flush_output,0]),
    call_c('Pl_Flush_Output_0',[],[]),
    proceed]).


predicate(flush_output/1,396,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[flush_output,1]),
    call_c('Pl_Flush_Output_1',[],[x(0)]),
    proceed]).


predicate(current_stream/1,403,static,private,monofile,built_in,[
    allocate(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[current_stream,1]),
    put_variable(y(0),1),
    call('$check_stream_or_var'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    execute('$current_stream'/1)]).


predicate('$current_stream'/1,411,static,private,monofile,built_in,[
    call_c('Pl_Current_Stream_1',[boolean],[x(0)]),
    proceed]).


predicate('$current_stream_alt'/0,415,static,private,monofile,built_in,[
    call_c('Pl_Current_Stream_Alt_0',[boolean],[]),
    proceed]).


predicate(stream_property/2,421,static,private,monofile,built_in,[
    pragma_arity(3),
    get_current_choice(x(2)),
    allocate(3),
    get_variable(y(0),1),
    get_variable(y(1),2),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[stream_property,2]),
    put_variable(y(2),1),
    call('$check_stream_or_var'/2),
    put_value(y(0),0),
    put_unsafe_value(y(2),1),
    put_unsafe_value(y(1),2),
    deallocate,
    execute('$stream_property/2_$aux1'/3)]).


predicate('$stream_property/2_$aux1'/3,421,static,private,monofile,local,[
    pragma_arity(4),
    get_current_choice(x(3)),
    try_me_else(1),
    call_c('Pl_Blt_Non_Var',[fast_call,boolean],[x(0)]),
    get_structure(alias/1,0),
    unify_variable(x(0)),
    call_c('Pl_Blt_Atom',[fast_call,boolean],[x(0)]),
    cut(x(3)),
    call_c('Pl_From_Alias_To_Stream_2',[boolean],[x(0),x(1)]),
    proceed,

label(1),
    trust_me_else_fail,
    allocate(3),
    get_variable(y(0),0),
    get_variable(y(1),1),
    get_variable(y(2),2),
    put_value(y(0),0),
    call('$check_stream_prop'/1),
    cut(y(2)),
    put_value(y(1),0),
    call('$current_stream'/1),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    execute('$stream_property1'/2)]).


predicate('$check_stream_prop'/1,436,static,private,monofile,built_in,[
    try_me_else(1),
    call_c('Pl_Blt_Var',[fast_call,boolean],[x(0)]),
    proceed,

label(1),
    retry_me_else(28),
    switch_on_term(4,2,fail,fail,3),

label(2),
    switch_on_atom([(input,9),(output,11)]),

label(3),
    switch_on_structure([(file_name/1,5),(mode/1,7),(alias/1,13),(mirror/1,15),(type/1,17),(reposition/1,19),(eof_action/1,21),(buffering/1,23),(end_of_stream/1,25),(position/1,27)]),

label(4),
    try_me_else(6),

label(5),
    get_structure(file_name/1,0),
    unify_void(1),
    proceed,

label(6),
    retry_me_else(8),

label(7),
    get_structure(mode/1,0),
    unify_void(1),
    proceed,

label(8),
    retry_me_else(10),

label(9),
    get_atom(input,0),
    proceed,

label(10),
    retry_me_else(12),

label(11),
    get_atom(output,0),
    proceed,

label(12),
    retry_me_else(14),

label(13),
    get_structure(alias/1,0),
    unify_void(1),
    proceed,

label(14),
    retry_me_else(16),

label(15),
    get_structure(mirror/1,0),
    unify_void(1),
    proceed,

label(16),
    retry_me_else(18),

label(17),
    get_structure(type/1,0),
    unify_void(1),
    proceed,

label(18),
    retry_me_else(20),

label(19),
    get_structure(reposition/1,0),
    unify_void(1),
    proceed,

label(20),
    retry_me_else(22),

label(21),
    get_structure(eof_action/1,0),
    unify_void(1),
    proceed,

label(22),
    retry_me_else(24),

label(23),
    get_structure(buffering/1,0),
    unify_void(1),
    proceed,

label(24),
    retry_me_else(26),

label(25),
    get_structure(end_of_stream/1,0),
    unify_void(1),
    proceed,

label(26),
    trust_me_else_fail,

label(27),
    get_structure(position/1,0),
    unify_void(1),
    proceed,

label(28),
    trust_me_else_fail,
    put_value(x(0),1),
    put_atom(stream_property,0),
    execute('$pl_err_domain'/2)]).


predicate('$stream_property1'/2,469,static,private,monofile,built_in,[
    switch_on_term(3,1,fail,fail,2),

label(1),
    switch_on_atom([(input,8),(output,10)]),

label(2),
    switch_on_structure([(file_name/1,4),(mode/1,6),(alias/1,12),(mirror/1,14),(type/1,16),(reposition/1,18),(eof_action/1,20),(buffering/1,22),(position/1,24),(end_of_stream/1,26)]),

label(3),
    try_me_else(5),

label(4),
    get_structure(file_name/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_File_Name_2',[boolean],[x(0),x(1)]),
    proceed,

label(5),
    retry_me_else(7),

label(6),
    get_structure(mode/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_Mode_2',[boolean],[x(0),x(1)]),
    proceed,

label(7),
    retry_me_else(9),

label(8),
    get_atom(input,0),
    call_c('Pl_Stream_Prop_Input_1',[boolean],[x(1)]),
    proceed,

label(9),
    retry_me_else(11),

label(10),
    get_atom(output,0),
    call_c('Pl_Stream_Prop_Output_1',[boolean],[x(1)]),
    proceed,

label(11),
    retry_me_else(13),

label(12),
    get_variable(x(2),1),
    get_structure(alias/1,0),
    unify_variable(x(1)),
    put_value(x(2),0),
    execute('$current_alias'/2),

label(13),
    retry_me_else(15),

label(14),
    allocate(2),
    get_structure(mirror/1,0),
    unify_variable(y(0)),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$current_mirror'/2),
    put_value(y(0),0),
    get_structure('$stream'/1,0),
    unify_local_value(y(1)),
    deallocate,
    proceed,

label(15),
    retry_me_else(17),

label(16),
    get_structure(type/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_Type_2',[boolean],[x(0),x(1)]),
    proceed,

label(17),
    retry_me_else(19),

label(18),
    get_structure(reposition/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_Reposition_2',[boolean],[x(0),x(1)]),
    proceed,

label(19),
    retry_me_else(21),

label(20),
    get_structure(eof_action/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_Eof_Action_2',[boolean],[x(0),x(1)]),
    proceed,

label(21),
    retry_me_else(23),

label(22),
    get_structure(buffering/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_Buffering_2',[boolean],[x(0),x(1)]),
    proceed,

label(23),
    retry_me_else(25),

label(24),
    get_variable(x(2),1),
    get_structure(position/1,0),
    unify_variable(x(1)),
    put_structure('$stream'/1,0),
    unify_local_value(x(2)),
    execute('$stream_position'/2),

label(25),
    trust_me_else_fail,

label(26),
    get_structure(end_of_stream/1,0),
    unify_variable(x(0)),
    call_c('Pl_Stream_Prop_End_Of_Stream_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(at_end_of_stream/0,510,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[at_end_of_stream,0]),
    call_c('Pl_At_End_Of_Stream_0',[boolean],[]),
    proceed]).


predicate(at_end_of_stream/1,514,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[at_end_of_stream,1]),
    call_c('Pl_At_End_Of_Stream_1',[boolean],[x(0)]),
    proceed]).


predicate(current_alias/2,521,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[current_alias,2]),
    put_variable(y(1),1),
    call('$check_stream_or_var'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    deallocate,
    execute('$current_alias/2_$aux1'/2)]).


predicate('$current_alias/2_$aux1'/2,521,static,private,monofile,local,[
    pragma_arity(3),
    get_current_choice(x(2)),
    try_me_else(1),
    call_c('Pl_Blt_Atom',[fast_call,boolean],[x(0)]),
    cut(x(2)),
    call_c('Pl_From_Alias_To_Stream_2',[boolean],[x(0),x(1)]),
    proceed,

label(1),
    trust_me_else_fail,
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    put_value(y(1),0),
    call('$current_stream'/1),
    put_value(y(1),0),
    put_value(y(0),1),
    deallocate,
    execute('$current_alias'/2)]).


predicate('$current_alias'/2,533,static,private,monofile,built_in,[
    call_c('Pl_Current_Alias_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate('$current_alias_alt'/0,536,static,private,monofile,built_in,[
    call_c('Pl_Current_Alias_Alt_0',[boolean],[]),
    proceed]).


predicate(current_mirror/2,542,static,private,monofile,built_in,[
    allocate(3),
    get_variable(y(0),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[current_mirror,2]),
    put_variable(y(1),1),
    call('$check_stream_or_var'/2),
    put_value(y(0),0),
    put_variable(y(2),1),
    call('$check_stream_or_var'/2),
    put_value(y(1),0),
    call('$current_stream'/1),
    put_unsafe_value(y(1),0),
    put_unsafe_value(y(2),1),
    deallocate,
    execute('$current_mirror'/2)]).


predicate('$current_mirror'/2,552,static,private,monofile,built_in,[
    call_c('Pl_Current_Mirror_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate('$current_mirror_alt'/0,555,static,private,monofile,built_in,[
    call_c('Pl_Current_Mirror_Alt_0',[boolean],[]),
    proceed]).


predicate(stream_position/2,561,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[stream_position,2]),
    execute('$stream_position'/2)]).


predicate('$stream_position'/2,566,static,private,monofile,built_in,[
    call_c('Pl_Stream_Position_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(set_stream_position/2,572,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_stream_position,2]),
    call_c('Pl_Set_Stream_Position_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(seek/4,579,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[seek,4]),
    call_c('Pl_Seek_4',[boolean],[x(0),x(1),x(2),x(3)]),
    proceed]).


predicate(character_count/2,586,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[character_count,2]),
    call_c('Pl_Character_Count_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(line_count/2,593,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[line_count,2]),
    call_c('Pl_Line_Count_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(line_position/2,600,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[line_position,2]),
    call_c('Pl_Line_Position_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(stream_line_column/3,607,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[stream_line_column,3]),
    call_c('Pl_Stream_Line_Column_3',[boolean],[x(0),x(1),x(2)]),
    proceed]).


predicate(set_stream_line_column/3,614,static,private,monofile,built_in,[
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[set_stream_line_column,3]),
    call_c('Pl_Set_Stream_Line_Column_3',[boolean],[x(0),x(1),x(2)]),
    proceed]).


predicate(open_input_atom_stream/2,627,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open_input_atom_stream,2]),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    deallocate,
    call_c('Pl_Open_Input_Term_Stream_2',[],[x(0),x(1)]),
    proceed]).


predicate(open_input_chars_stream/2,636,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open_input_chars_stream,2]),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    deallocate,
    call_c('Pl_Open_Input_Term_Stream_2',[],[x(0),x(1)]),
    proceed]).


predicate(open_input_codes_stream/2,645,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open_input_codes_stream,2]),
    put_value(x(1),0),
    put_variable(y(1),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(3,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_unsafe_value(y(1),1),
    deallocate,
    call_c('Pl_Open_Input_Term_Stream_2',[],[x(0),x(1)]),
    proceed]).


predicate(close_input_atom_stream/1,654,static,private,monofile,built_in,[
    allocate(1),
    get_variable(y(0),0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close_input_atom_stream,1]),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    deallocate,
    call_c('Pl_Close_Input_Term_Stream_1',[],[x(0)]),
    proceed]).


predicate(close_input_chars_stream/1,662,static,private,monofile,built_in,[
    allocate(1),
    get_variable(y(0),0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close_input_chars_stream,1]),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    deallocate,
    call_c('Pl_Close_Input_Term_Stream_1',[],[x(0)]),
    proceed]).


predicate(close_input_codes_stream/1,670,static,private,monofile,built_in,[
    allocate(1),
    get_variable(y(0),0),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close_input_codes_stream,1]),
    put_integer(0,0),
    put_integer(3,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    deallocate,
    call_c('Pl_Close_Input_Term_Stream_1',[],[x(0)]),
    proceed]).


predicate(open_output_atom_stream/1,678,static,private,monofile,built_in,[
    allocate(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open_output_atom_stream,1]),
    put_variable(y(0),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    call_c('Pl_Open_Output_Term_Stream_1',[],[x(0)]),
    proceed]).


predicate(open_output_chars_stream/1,687,static,private,monofile,built_in,[
    allocate(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open_output_chars_stream,1]),
    put_variable(y(0),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    call_c('Pl_Open_Output_Term_Stream_1',[],[x(0)]),
    proceed]).


predicate(open_output_codes_stream/1,696,static,private,monofile,built_in,[
    allocate(1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[open_output_codes_stream,1]),
    put_variable(y(0),1),
    call('$get_open_stm'/2),
    put_integer(0,0),
    put_integer(3,1),
    call('$sys_var_write'/2),
    put_unsafe_value(y(0),0),
    deallocate,
    call_c('Pl_Open_Output_Term_Stream_1',[],[x(0)]),
    proceed]).


predicate(close_output_atom_stream/2,705,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close_output_atom_stream,2]),
    put_integer(0,0),
    put_integer(1,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    call_c('Pl_Close_Output_Term_Stream_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(close_output_chars_stream/2,713,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close_output_chars_stream,2]),
    put_integer(0,0),
    put_integer(2,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    call_c('Pl_Close_Output_Term_Stream_2',[boolean],[x(0),x(1)]),
    proceed]).


predicate(close_output_codes_stream/2,721,static,private,monofile,built_in,[
    allocate(2),
    get_variable(y(0),0),
    get_variable(y(1),1),
    call_c('Pl_Set_Bip_Name_Untagged_2',[by_value],[close_output_codes_stream,2]),
    put_integer(0,0),
    put_integer(3,1),
    call('$sys_var_write'/2),
    put_value(y(0),0),
    put_value(y(1),1),
    deallocate,
    call_c('Pl_Close_Output_Term_Stream_2',[boolean],[x(0),x(1)]),
    proceed]).
