#include "chdecl.h"
void CH_safewindow(current, sched, cop)
#define ARGUMENTS 8
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb9;
    case 2: goto c10;
    case 3: goto c17;
    case 4: goto cb17;
    case 5: goto c18;
    case 6: goto cb19;
    case 7: goto c20;
    case 8: goto c21;
    case 9: goto c22;
    case 10: goto c25;
    case 11: goto c26;
    case 12: goto c29;
    case 13: goto c31;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
/* prog_lit 3 , 1 */
  if ((ch_returncode = che_prog_lit(DEF(3),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* procedure 4 3 , 2 */
  if ((ch_returncode = che_procedure(DEF(4),DEF(3),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* discard 3 */
  (*(REF(3).tsdr)->finalize)(REF(3).value,F_DISCARD,sched);
  REF(3).tsdr = & dr_bottom;
/* move 5 4 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5) = REF(4);
  REF(4).tsdr = & dr_bottom;
/* prog_lit 6 , 3 */
  if ((ch_returncode = che_prog_lit(DEF(6),QUAL(3),sched)) != Normal) 
     goto ch_raise_exception;
/* procedure 7 6 , 4 */
  if ((ch_returncode = che_procedure(DEF(7),DEF(6),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
/* discard 6 */
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).tsdr = & dr_bottom;
/* move 8 7 */
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  REF(8) = REF(7);
  REF(7).tsdr = & dr_bottom;
  current->ip = 1;
cb9:
/* receive 9 0 */
  if ((ch_returncode = che_receive(DEF(9),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c10:
/* copy 10 9.0 */
  if((ch_returncode = (REF(9)DOT(0).tsdr->copy)(& ch_val, REF(9)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).value = ch_val;
  REF(10).tsdr = datarepmap[REF(9)DOT(0).tsdr->number];
/* new_inport 11 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).value = ch_val; REF(11).tsdr = & dr_inport;
/* connect 9.1 11 */
  if (REF(11).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(9)DOT(1).tsdr)->finalize)(REF(9)DOT(1).value,F_DISCARD,sched);
  REF(11).value.inport->refcount++;
  REF(9)DOT(1).value.outport = REF(11).value.inport;
  REF(9)DOT(1).tsdr = & dr_outport;
/* return 9 */
  if (ch_caller = do_return(REF(9).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(9).value);
  REF(9).tsdr = & dr_bottom;
/* new_inport 12 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val; REF(12).tsdr = & dr_inport;
c15:
/* noop */
  
c17:
  current->ip = 4;
cb17:
/* receive 13 11 */
  if ((ch_returncode = che_receive(DEF(13),DEF(11),sched)) != Normal)
     goto ch_raise_exception;
  return;
c18:
/* block , 5 */
  if((ch_returncode = che_block(QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 6;
cb19:
/* call 8 10 13.0 13.1 14 15 , 6 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(8),
          arguments[1] = DEF(10),
          arguments[2] = DEF(13)DOT(0),
          arguments[3] = DEF(13)DOT(1),
          arguments[4] = DEF(14),
          arguments[5] = DEF(15),
          arguments[5+1] = nil,& arguments[0]),QUAL(6),sched)) != Normal)
     goto ch_raise_exception;
  return;
c20:
/* call 5 14 15 12 , 7 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(5),
          arguments[1] = DEF(14),
          arguments[2] = DEF(15),
          arguments[3] = DEF(12),
          arguments[3+1] = nil,& arguments[0]),QUAL(7),sched)) != Normal)
     goto ch_raise_exception;
  return;
c21:
/* receive 13.2 12 */
  if ((ch_returncode = che_receive(DEF(13)DOT(2),DEF(12),sched)) != Normal)
     goto ch_raise_exception;
  return;
c22:
/* return 13 */
  if (ch_caller = do_return(REF(13).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(13).value);
  REF(13).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 26 */
   goto c26;
c25:
/* return_exception 13 , 8 */
  if (ch_caller = do_return(REF(13).value)) {
    raise_user(QUAL(8),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(13),QUAL(8));
  REF(13).tsdr = & dr_bottom;
c26:
/* discard 14 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).tsdr = & dr_bottom;
/* discard 15 */
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  REF(15).tsdr = & dr_bottom;
/* branch , 15 */
   goto c15;
c29:
/* endblock */
  che_endblock(sched);
c31:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
