#include "chdecl.h"
void CH_typestate_precasets(current, sched, cop)
#define ARGUMENTS 9
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c3;
    case 4: goto c11;
    case 5: goto cb27;
    case 6: goto c28;
    case 7: goto cb33;
    case 8: goto c34;
    case 9: 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:
/* initget 4 3.4.2 , 0,0 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(4),DEF(3)DOT(4)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c3:
/* get_or_err 4 3.4.2 */
  if ((ch_returncode = get_selected_object(DEF(4),DEF(3)DOT(4)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* position 5 4 */
  ch_frame = get_selector_frame(DEF(4),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(5).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(5).tsdr = &dr_integer;
/* lookup_at 6 3.7 =(0) */
  if ( !((ch_t = REF(3)DOT(7).value.table)->size) ) goto ch_notfound;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(6).value,0);
  REF(6).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 7 6 */
  REF(7) = REF(6);
/* notequal . 5 7 , 3 */
  if ( REF(5).value.integer != REF(7).value.integer ) goto c3;
/* initget 8 3.4.2 , 0,0 */
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(8),DEF(3)DOT(4)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c11:
/* get_or_err 8 3.4.2 */
  if ((ch_returncode = get_selected_object(DEF(8),DEF(3)DOT(4)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* position 9 8 */
  ch_frame = get_selector_frame(DEF(8),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(9).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(9).tsdr = &dr_integer;
/* lookup_at 10 3.7 =(1) */
  if (1 >= (ch_t = REF(3)DOT(7).value.table)->size) goto ch_notfound;
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(10).value,1);
  REF(10).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 11 10 */
  REF(11) = REF(10);
/* notequal . 9 11 , 11 */
  if ( REF(9).value.integer != REF(11).value.integer ) goto c11;
/* copy 12 8 */
  if((ch_returncode = (REF(8).tsdr->copy)(& ch_val, REF(8).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val;
  REF(12).tsdr = datarepmap[REF(8).tsdr->number];
/* endget 8 3.4.2 */
  end_selector(DEF(8),DEF(3)DOT(4)DOT(2),sched,GET);
/* move 13 12 */
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  REF(13) = REF(12);
  REF(12).tsdr = & dr_bottom;
/* privatize 13.1 */
  if (REF(13)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(13)DOT(1))) != Normal)
       goto ch_raise_exception;
/* size 14 13.1 */
  REF(14).value.integer = REF(13)DOT(1).value.table->size;
  REF(14).tsdr = & dr_integer;
/* isubtract 15 14 =(1) */
  if (!chf_isubtract(DEF(15),REF(14).value.integer,1)) goto ch_depletion;
/* lookup_at 16 13.1 15 */
  if((ch_i = REF(15).value.integer) < 0 || ch_i >= (ch_t = REF(13)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(16).tsdr)->finalize)(REF(16).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(16).value,ch_i);
  REF(16).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 17 13.1 15 */
  if ((ch_returncode = remove_at_func(DEF(17),DEF(13)DOT(1),
    REF(15).value.integer)) != Normal) goto ch_raise_exception;
  current->ip = 5;
cb27:
/* call 3.0.13 3.0 3.2 3.1 3.3 13 18 , 1 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(13),
          arguments[1] = DEF(3)DOT(0),
          arguments[2] = DEF(3)DOT(2),
          arguments[3] = DEF(3)DOT(1),
          arguments[4] = DEF(3)DOT(3),
          arguments[5] = DEF(13),
          arguments[6] = DEF(18),
          arguments[6+1] = nil,& arguments[0]),QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  return;
c28:
/* noop */
  
/* find 19 3.1 18.0 , 0 */
  if (findfunc(DEF(19),DEF(3)DOT(1),(
          arguments[0] = DEF(18)DOT(0),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* find 20 19.1 18.1 , 0 */
  if (findfunc(DEF(20),DEF(19)DOT(1),(
          arguments[0] = DEF(18)DOT(1),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* reveal 20.2 , 6 */
  if (6 != REF(20)DOT(2).value.variant->info.variant_case) goto ch_case_error;
/* find 21 20.2.0.1 17 , 0 */
  if (findfunc(DEF(21),DEF(20)DOT(2)DOT(0)DOT(1),(
          arguments[0] = DEF(17),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
  current->ip = 7;
cb33:
/* call 3.0.14 3.0 4 21.2 22 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(14),
          arguments[1] = DEF(3)DOT(0),
          arguments[2] = DEF(4),
          arguments[3] = DEF(21)DOT(2),
          arguments[4] = DEF(22),
          arguments[4+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c34:
/* merge 3.8 22 */
  if ((ch_returncode = mergefunc(DEF(3)DOT(8),DEF(22),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* endget 4 3.4.2 */
  end_selector(DEF(4),DEF(3)DOT(4)DOT(2),sched,GET);
/* 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"
