#include "chdecl.h"
void CH_safewindow_safewindowgen(current, sched, cop)
#define ARGUMENTS 4
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto cb7;
    case 4: goto c8;
    case 5: goto c10;
    case 6: goto c13;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 1;
cb1:
/* receive 3 0 */
  if ((ch_returncode = che_receive(DEF(3),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c2:
/* connect 4 3.2 */
  if (REF(3)DOT(2).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(3)DOT(2).value.inport->refcount++;
  REF(4).value.outport = REF(3)DOT(2).value.inport;
  REF(4).tsdr = & dr_outport;
/* copy 5 3.1 */
  if((ch_returncode = cp_outport(& ch_val, REF(3)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).value = ch_val;
  REF(5).tsdr = & dr_outport;
/* copy 6 3.0 */
  if((ch_returncode = (REF(3)DOT(0).tsdr->copy)(& ch_val, REF(3)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).value = ch_val;
  REF(6).tsdr = datarepmap[REF(3)DOT(0).tsdr->number];
/* return 3 */
  if (ch_caller = do_return(REF(3).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(3).value);
  REF(3).tsdr = & dr_bottom;
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 3;
cb7:
/* call 4 6 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(4),
          arguments[1] = DEF(6),
          arguments[1+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c8:
/* endblock */
  che_endblock(sched);
c10:
/* send 5 7 */
  if ((ch_returncode = che_send(DEF(5),DEF(7),sched)) != Normal)
     goto ch_raise_exception;
/* endblock */
  che_endblock(sched);
c13:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
