#include "chdecl.h"
void CH_chcode_chphase2_proglit(current, sched, cop)
#define ARGUMENTS 6
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb2;
    case 2: goto c3;
    case 5: goto c9;
    case 3: goto c11;
    case 4: goto cb11;
    case 6: goto cb13;
    case 7: goto c14;
    case 8: goto c25;
    case 9: goto c31;
    case 10: goto cb34;
    case 11: goto c35;
    case 12: goto c41;
    case 13: goto c43;
    case 14: goto c46;
    case 15: goto c48;
    case 16: goto c51;
    case 17: goto c56;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 1;
cb2:
/* receive 3 0 */
  if ((ch_returncode = che_receive(DEF(3),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c3:
/* new_inport 4 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).value = ch_val; REF(4).tsdr = & dr_inport;
/* connect 3.0 4 */
  if (REF(4).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(0).tsdr)->finalize)(REF(3)DOT(0).value,F_DISCARD,sched);
  REF(4).value.inport->refcount++;
  REF(3)DOT(0).value.outport = REF(4).value.inport;
  REF(3)DOT(0).tsdr = & dr_outport;
/* new_inport 5 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).value = ch_val; REF(5).tsdr = & dr_inport;
/* connect 3.1 5 */
  if (REF(5).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(1).tsdr)->finalize)(REF(3)DOT(1).value,F_DISCARD,sched);
  REF(5).value.inport->refcount++;
  REF(3)DOT(1).value.outport = REF(5).value.inport;
  REF(3)DOT(1).tsdr = & dr_outport;
/* 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;
/* new_table 6 , 2 */
  if ((ch_returncode = che_new_table(DEF(6),QUAL(2),sched)) != Normal) 
     goto ch_raise_exception;
c12:
c9:
/* noop */
  
c11:
  current->ip = 4;
cb11:
/* select 5 * 4 * , 3 */
  if ((ch_returncode = che_select((
          arguments[0] = DEF(5),
          arguments[1] = NO_OBJECT,
          arguments[2] = DEF(4),
          arguments[3] = NO_OBJECT,
          arguments[3+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  if (current->ip == 4) return; else COMPUTE_TARGET;
c13:
  current->ip = 6;
cb13:
/* receive 7 5 */
  if ((ch_returncode = che_receive(DEF(7),DEF(5),sched)) != Normal)
     goto ch_raise_exception;
  return;
c14:
/* block , 4 */
  if((ch_returncode = che_block(QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
/* privatize 6 */
  if (REF(6).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(6))) != Normal)
       goto ch_raise_exception;
/* find 8 6 7.1 , 0 */
  if (findfunc(DEF(8),DEF(6),(
          arguments[0] = DEF(7)DOT(1),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* fremove 9 8 6 , 0 */
  if ((ch_returncode = removefunc(DEF(9),DEF(8),DEF(6),sched,0
    ,NO_TBL,(position *) nil)) != Normal) goto ch_raise_exception;
/* iadd 9.1 9.1 =(1) */
  if (!chf_iadd(DEF(9)DOT(1),REF(9)DOT(1).value.integer,1)) goto ch_depletion;
/* boolean 7.2 , TRUE */
  REF(7)DOT(2).value.boolean = TRUE;
  REF(7)DOT(2).tsdr = & dr_boolean;
/* endblock */
  che_endblock(sched);
/* branch , 31 */
   goto c31;
c25:
/* new_record 9 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).value = ch_val; REF(9).tsdr = & dr_record;
/* copy 9.0 7.1 */
  if((ch_returncode = (REF(7)DOT(1).tsdr->copy)(& ch_val, REF(7)DOT(1).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(9)DOT(0).tsdr)->finalize)(REF(9)DOT(0).value,F_DISCARD,sched);
  REF(9)DOT(0).value = ch_val;
  REF(9)DOT(0).tsdr = datarepmap[REF(7)DOT(1).tsdr->number];
/* ilit 9.1 , 1 */
  REF(9)DOT(1).value.integer = 1;
  REF(9)DOT(1).tsdr = & dr_integer;
/* boolean 7.2 , FALSE */
  REF(7)DOT(2).value.boolean = FALSE;
  REF(7)DOT(2).tsdr = & dr_boolean;
c31:
/* insert 6 9 */
  if ((ch_returncode = insertfunc(DEF(6),DEF(9),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* return 7 */
  if (ch_caller = do_return(REF(7).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(7).value);
  REF(7).tsdr = & dr_bottom;
/* branch , 9 */
   goto c9;
c34:
  current->ip = 10;
cb34:
/* receive 10 4 */
  if ((ch_returncode = che_receive(DEF(10),DEF(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c35:
/* block , 5 */
  if((ch_returncode = che_block(QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
/* find 11 6 10.0 , 0 */
  if (findfunc(DEF(11),DEF(6),(
          arguments[0] = DEF(10)DOT(0),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* notequal 10.2 11.1 10.1 */
  REF(10)DOT(2).value.boolean = (!(REF(11)DOT(1).tsdr->equal)(
    REF(11)DOT(1).value,REF(10)DOT(1).value));
  REF(10)DOT(2).tsdr = & dr_boolean;
/* endblock */
  che_endblock(sched);
/* branch , 43 */
   goto c43;
c41:
/* boolean 10.2 , TRUE */
  REF(10)DOT(2).value.boolean = TRUE;
  REF(10)DOT(2).tsdr = & dr_boolean;
c43:
/* return 10 */
  if (ch_caller = do_return(REF(10).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(10).value);
  REF(10).tsdr = & dr_bottom;
/* branch , 9 */
   goto c9;
c46:
/* endblock */
  che_endblock(sched);
/* branch , 51 */
   goto c51;
c48:
/* discard 4 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).tsdr = & dr_bottom;
/* discard 5 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).tsdr = & dr_bottom;
/* discard 6 */
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).tsdr = & dr_bottom;
c51:
/* discard 4 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).tsdr = & dr_bottom;
/* discard 5 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).tsdr = & dr_bottom;
/* discard 6 */
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
c56:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
