#include "chdecl.h"
void CH_typestate_checkloop(current, sched, cop)
#define ARGUMENTS 10
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c8;
    case 4: goto c15;
    case 5: goto cb19;
    case 6: goto c20;
    case 7: goto c39;  }
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:
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
/* privatize 3.3.9 */
  if (REF(3)DOT(3)DOT(9).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(3)DOT(3)DOT(9))) != Normal)
       goto ch_raise_exception;
/* find 4 3.3.9 3.7 , 0 */
  if (findfunc(DEF(4),DEF(3)DOT(3)DOT(9),(
          arguments[0] = DEF(3)DOT(7),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* fremove 5 4 3.3.9 , 0 */
  if ((ch_returncode = removefunc(DEF(5),DEF(4),DEF(3)DOT(3)DOT(9),sched,0
    ,NO_TBL,(position *) nil)) != Normal) goto ch_raise_exception;
/* endblock */
  che_endblock(sched);
/* branch , 15 */
   goto c15;
c8:
/* new_record 5 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).value = ch_val; REF(5).tsdr = & dr_record;
/* copy 5.0 3.7 */
  if((ch_returncode = (REF(3)DOT(7).tsdr->copy)(& ch_val, REF(3)DOT(7).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(5)DOT(0).tsdr)->finalize)(REF(5)DOT(0).value,F_DISCARD,sched);
  REF(5)DOT(0).value = ch_val;
  REF(5)DOT(0).tsdr = datarepmap[REF(3)DOT(7).tsdr->number];
/* new_record 6 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).value = ch_val; REF(6).tsdr = & dr_record;
/* copy 6.0 3.4 */
  if((ch_returncode = (REF(3)DOT(4).tsdr->copy)(& ch_val, REF(3)DOT(4).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(6)DOT(0).tsdr)->finalize)(REF(6)DOT(0).value,F_DISCARD,sched);
  REF(6)DOT(0).value = ch_val;
  REF(6)DOT(0).tsdr = datarepmap[REF(3)DOT(4).tsdr->number];
/* new_table 6.1 , 2 */
  if ((ch_returncode = che_new_table(DEF(6)DOT(1),QUAL(2),sched)) != Normal) 
     goto ch_raise_exception;
/* unite 5.1 6 , 0 */
  if ((ch_returncode = che_unite(DEF(5)DOT(1),DEF(6),sched,0)) != Normal)
     goto ch_raise_exception;
c15:
/* size 7 3.3.0 */
  REF(7).value.integer = REF(3)DOT(3)DOT(0).value.table->size;
  REF(7).tsdr = & dr_integer;
/* copy 8 7 */
  REF(8) = REF(7);
/* isubtract 9 8 =(1) */
  if (!chf_isubtract(DEF(9),REF(8).value.integer,1)) goto ch_depletion;
  current->ip = 5;
cb19:
/* call 3.0.8 3.0 3.1.0 3.3 3.2 3.5 9 5.1 , 3 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(8),
          arguments[1] = DEF(3)DOT(0),
          arguments[2] = DEF(3)DOT(1)DOT(0),
          arguments[3] = DEF(3)DOT(3),
          arguments[4] = DEF(3)DOT(2),
          arguments[5] = DEF(3)DOT(5),
          arguments[6] = DEF(9),
          arguments[7] = DEF(5)DOT(1),
          arguments[7+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  return;
c20:
/* reveal 5.1 , 0 */
  if (0 != REF(5)DOT(1).value.variant->info.variant_case) goto ch_case_error;
/* equal . 5.1.0.0 3.4 , 27 */
  if ( (REF(5)DOT(1)DOT(0)DOT(0).tsdr->equal)(REF(5)DOT(1)DOT(0)DOT(0).value,
    REF(3)DOT(4).value) ) goto c27;
/* boolean 3.6 , TRUE */
  REF(3)DOT(6).value.boolean = TRUE;
  REF(3)DOT(6).tsdr = & dr_boolean;
/* copy 3.4 5.1.0.0 */
  if((ch_returncode = (REF(5)DOT(1)DOT(0)DOT(0).tsdr->copy)(& ch_val, 
    REF(5)DOT(1)DOT(0)DOT(0).value)) != Normal) goto ch_raise_exception;
  (*(REF(3)DOT(4).tsdr)->finalize)(REF(3)DOT(4).value,F_DISCARD,sched);
  REF(3)DOT(4).value = ch_val;
  REF(3)DOT(4).tsdr = datarepmap[REF(5)DOT(1)DOT(0)DOT(0).tsdr->number];
/* branch , 29 */
   goto c29;
c27:
/* boolean 3.6 , FALSE */
  REF(3)DOT(6).value.boolean = FALSE;
  REF(3)DOT(6).tsdr = & dr_boolean;
c29:
/* size 10 5.1.0.1 */
  REF(10).value.integer = REF(5)DOT(1)DOT(0)DOT(1).value.table->size;
  REF(10).tsdr = & dr_integer;
/* ile . 10 =(0) , 35 */
  if ( REF(10).value.integer <= 0 ) goto c35;
/* insert 3.3.9 5 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(3)DOT(9),DEF(5)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
c35:
/* discard 5 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).tsdr = & dr_bottom;
/* 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;
/* endblock */
  che_endblock(sched);
c39:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
