#include "chdecl.h"
void CH_typestate_tstypeof(current, sched, cop)
#define ARGUMENTS 5
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c9;
    case 4: goto c11;
    case 5: goto c13;
    case 6: goto c19;
    case 7: goto c30;
    case 8: goto c33;  }
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:
/* find 4 3.1 3.4.0.0 , 0 */
  if (findfunc(DEF(4),DEF(3)DOT(1),(
          arguments[0] = DEF(3)DOT(4)DOT(0)DOT(0),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
/* find 5 4.1 3.4.0.1 , 0 */
  if (findfunc(DEF(5),DEF(4)DOT(1),(
          arguments[0] = DEF(3)DOT(4)DOT(0)DOT(1),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* reveal 5.1 , 0 */
  if (0 != REF(5)DOT(1).value.variant->info.variant_case) goto ch_case_error;
/* copy 3.5 5.1.0 */
  if((ch_returncode = (REF(5)DOT(1)DOT(0).tsdr->copy)(& ch_val, 
    REF(5)DOT(1)DOT(0).value)) != Normal) goto ch_raise_exception;
  (*(REF(3)DOT(5).tsdr)->finalize)(REF(3)DOT(5).value,F_DISCARD,sched);
  REF(3)DOT(5).value = ch_val;
  REF(3)DOT(5).tsdr = datarepmap[REF(5)DOT(1)DOT(0).tsdr->number];
/* endblock */
  che_endblock(sched);
/* branch , 11 */
   goto c11;
c9:
/* find 6 3.3.6 3.4.0 , 0 */
  if (findfunc(DEF(6),DEF(3)DOT(3)DOT(6),(
          arguments[0] = DEF(3)DOT(4)DOT(0),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* copy 3.5 6.1 */
  if((ch_returncode = (REF(6)DOT(1).tsdr->copy)(& ch_val, REF(6)DOT(1).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(3)DOT(5).tsdr)->finalize)(REF(3)DOT(5).value,F_DISCARD,sched);
  REF(3)DOT(5).value = ch_val;
  REF(3)DOT(5).tsdr = datarepmap[REF(6)DOT(1).tsdr->number];
c11:
/* ilit 7 , 0 */
  REF(7).value.integer = 0;
  REF(7).tsdr = & dr_integer;
c13:
/* size 8 3.4.1 */
  REF(8).value.integer = REF(3)DOT(4)DOT(1).value.table->size;
  REF(8).tsdr = & dr_integer;
/* ige . 7 8 , 30 */
  if ( REF(7).value.integer >= REF(8).value.integer ) goto c30;
/* find 9 3.2 3.5.0 , 0 */
  if (findfunc(DEF(9),DEF(3)DOT(2),(
          arguments[0] = DEF(3)DOT(5)DOT(0),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* find 10 9.1 3.5.1 , 0 */
  if (findfunc(DEF(10),DEF(9)DOT(1),(
          arguments[0] = DEF(3)DOT(5)DOT(1),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* initget 11 10.1 , 0,0 */
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(11),DEF(10)DOT(1),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c19:
/* get_or_err 11 10.1 */
  if ((ch_returncode = get_selected_object(DEF(11),DEF(10)DOT(1)
    ,sched)) != Normal) goto ch_raise_exception;
/* lookup_at 12 3.4.1 7 */
  if((ch_i = REF(7).value.integer) < 0 || ch_i >= (ch_t = 
    REF(3)DOT(4)DOT(1).value.table)->size) goto ch_notfound;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(12).value,ch_i);
  REF(12).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 13 12 */
  if((ch_returncode = (REF(12).tsdr->copy)(& ch_val, REF(12).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  REF(13).value = ch_val;
  REF(13).tsdr = datarepmap[REF(12).tsdr->number];
/* notequal . 11.0 13 , 19 */
  if ( !(REF(11)DOT(0).tsdr->equal)(REF(11)DOT(0).value,REF(13).value) )
     goto c19;
/* copy 3.5 11.1 */
  if((ch_returncode = (REF(11)DOT(1).tsdr->copy)(& ch_val, REF(11)DOT(1).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(3)DOT(5).tsdr)->finalize)(REF(3)DOT(5).value,F_DISCARD,sched);
  REF(3)DOT(5).value = ch_val;
  REF(3)DOT(5).tsdr = datarepmap[REF(11)DOT(1).tsdr->number];
/* endget 11 10.1 */
  end_selector(DEF(11),DEF(10)DOT(1),sched,GET);
/* iadd 7 7 =(1) */
  if (!chf_iadd(DEF(7),REF(7).value.integer,1)) goto ch_depletion;
/* branch , 13 */
   goto c13;
c30:
/* 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);
c33:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
