#include "chdecl.h"
void CH_typestate_popolyts(current, sched, cop)
#define ARGUMENTS 7
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c5;
    case 4: goto cb14;
    case 5: goto c15;
    case 6: goto c18;
    case 7: goto c40;
    case 8: goto cb49;
    case 9: goto c50;
    case 10: goto c71;  }
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:
/* new_table 4 , 1 */
  if ((ch_returncode = che_new_table(DEF(4),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* reveal 3.5.3 , 17 */
  if (17 != REF(3)DOT(5)DOT(3).value.variant->info.variant_case)
     goto ch_case_error;
/* initget 5 3.5.2 , 0,0 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(5),DEF(3)DOT(5)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c5:
/* get_or_err 5 3.5.2 */
  if ((ch_returncode = get_selected_object(DEF(5),DEF(3)DOT(5)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* 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);
/* position 8 5 */
  ch_frame = get_selector_frame(DEF(5),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(8).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(8).tsdr = &dr_integer;
/* notequal . 7 8 , 5 */
  if ( REF(7).value.integer != REF(8).value.integer ) goto c5;
/* copy 9 5 */
  if((ch_returncode = (REF(5).tsdr->copy)(& ch_val, REF(5).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).value = ch_val;
  REF(9).tsdr = datarepmap[REF(5).tsdr->number];
/* endget 5 3.5.2 */
  end_selector(DEF(5),DEF(3)DOT(5)DOT(2),sched,GET);
  current->ip = 4;
cb14:
/* call 3.0.14 3.0 9 3.5.3.0 10 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(14),
          arguments[1] = DEF(3)DOT(0),
          arguments[2] = DEF(9),
          arguments[3] = DEF(3)DOT(5)DOT(3)DOT(0),
          arguments[4] = DEF(10),
          arguments[4+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c15:
/* unite 11 12 , 5 */
  if ((ch_returncode = che_unite(DEF(11),DEF(12),sched,5)) != Normal)
     goto ch_raise_exception;
/* copy 13 10 */
  if((ch_returncode = cp_table(& ch_val, REF(10).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  REF(13).value = ch_val;
  REF(13).tsdr = & dr_table;
/* initget 14 13 , 0,0 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(14),DEF(13),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c18:
/* get_or_goto 14 13 , 36 */
  if ((ch_returncode = get_selected_object(DEF(14),DEF(13),sched)) != Normal)
     goto c36;
/* notequal . 14.0 11 , 18 */
  if ( !eq_variant(REF(14)DOT(0).value,REF(11).value) ) goto c18;
/* privatize 10 */
  if (REF(10).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(10))) != Normal)
       goto ch_raise_exception;
/* find 15 10 14 , 0 */
  if (findfunc(DEF(15),DEF(10),(
          arguments[0] = DEF(14),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* fremove 16 15 10 , 0 */
  if ((ch_returncode = removefunc(DEF(16),DEF(15),DEF(10),sched,0
    ,NO_TBL,(position *) nil)) != Normal) goto ch_raise_exception;
/* new_record 17 , 3 */
  if ((ch_val.record = new_record(3)) == nil) goto ch_depletion;
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  REF(17).value = ch_val; REF(17).tsdr = & dr_record;
/* copy 18 3.4 */
  if((ch_returncode = (REF(3)DOT(4).tsdr->copy)(& ch_val, REF(3)DOT(4).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(18).tsdr)->finalize)(REF(18).value,F_DISCARD,sched);
  REF(18).value = ch_val;
  REF(18).tsdr = datarepmap[REF(3)DOT(4).tsdr->number];
/* unite 17.0 18 , 0 */
  if ((ch_returncode = che_unite(DEF(17)DOT(0),DEF(18),sched,0)) != Normal)
     goto ch_raise_exception;
/* ordenum_lit 17.1 , 21 */
  REF(17)DOT(1).value.ord_enum = 21;
  REF(17)DOT(1).tsdr = & dr_ord_enumeration;
/* new_table 17.2 , 3 */
  if ((ch_returncode = che_new_table(DEF(17)DOT(2),QUAL(3),sched)) != Normal) 
     goto ch_raise_exception;
/* unite 19 16 , 1 */
  if ((ch_returncode = che_unite(DEF(19),DEF(16),sched,1)) != Normal)
     goto ch_raise_exception;
/* insert 17.2 19 */
  if ((ch_returncode = insertfunc(DEF(17)DOT(2),DEF(19),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* insert 3.2.11 17 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(2)DOT(11),DEF(17)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* branch , 18 */
   goto c18;
c36:
/* endget 14 13 */
  end_selector(DEF(14),DEF(13),sched,GET);
/* discard 13 */
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  REF(13).tsdr = & dr_bottom;
/* merge 3.8.0 10 */
  if ((ch_returncode = mergefunc(DEF(3)DOT(8)DOT(0),DEF(10)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* initget 20 3.5.2 , 0,0 */
  (*(REF(20).tsdr)->finalize)(REF(20).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(20),DEF(3)DOT(5)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c40:
/* get_or_err 20 3.5.2 */
  if ((ch_returncode = get_selected_object(DEF(20),DEF(3)DOT(5)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* lookup_at 21 3.7 =(0) */
  if ( !((ch_t = REF(3)DOT(7).value.table)->size) ) goto ch_notfound;
  (*(REF(21).tsdr)->finalize)(REF(21).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(21).value,0);
  REF(21).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 22 21 */
  REF(22) = REF(21);
/* position 23 20 */
  ch_frame = get_selector_frame(DEF(20),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(23).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(23).tsdr = &dr_integer;
/* notequal . 22 23 , 40 */
  if ( REF(22).value.integer != REF(23).value.integer ) goto c40;
/* copy 24 20 */
  if((ch_returncode = (REF(20).tsdr->copy)(& ch_val, REF(20).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(24).tsdr)->finalize)(REF(24).value,F_DISCARD,sched);
  REF(24).value = ch_val;
  REF(24).tsdr = datarepmap[REF(20).tsdr->number];
/* endget 20 3.5.2 */
  end_selector(DEF(20),DEF(3)DOT(5)DOT(2),sched,GET);
  current->ip = 8;
cb49:
/* call 3.0.4 3.6 24 4 25 , 4 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(4),
          arguments[1] = DEF(3)DOT(6),
          arguments[2] = DEF(24),
          arguments[3] = DEF(4),
          arguments[4] = DEF(25),
          arguments[4+1] = nil,& arguments[0]),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c50:
/* size 26 25 */
  REF(26).value.integer = REF(25).value.table->size;
  REF(26).tsdr = & dr_integer;
/* ile . 26 =(0) , 68 */
  if ( REF(26).value.integer <= 0 ) goto c68;
/* privatize 25 */
  if (REF(25).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(25))) != Normal)
       goto ch_raise_exception;
/* initget 27 25 , 0,0 */
  (*(REF(27).tsdr)->finalize)(REF(27).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(27),DEF(25),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
/* get_or_err 27 25 */
  if ((ch_returncode = get_selected_object(DEF(27),DEF(25),sched)) != Normal)
     goto ch_raise_exception;
/* remove 28 27 25 */
  if ((ch_returncode = che_remove(DEF(28),DEF(27),DEF(25),sched)) != Normal)
     goto ch_raise_exception;
/* endget 27 25 */
  end_selector(DEF(27),DEF(25),sched,GET);
/* boolean 29 , FALSE */
  REF(29).value.boolean = FALSE;
  REF(29).tsdr = & dr_boolean;
/* find_or_goto 30 3.8.0 28 , 0,62 */
  if (findfunc(DEF(30),DEF(3)DOT(8)DOT(0),(
          arguments[0] = DEF(28),& arguments[0]),sched,0) == FAILURE) goto c62;
/* boolean 29 , TRUE */
  REF(29).value.boolean = TRUE;
  REF(29).tsdr = & dr_boolean;
c62:
/* branch_false 29 , 65 */
  if ( !REF(29).value.boolean ) goto c65;
/* discard 28 */
  (*(REF(28).tsdr)->finalize)(REF(28).value,F_DISCARD,sched);
  REF(28).tsdr = & dr_bottom;
/* branch , 50 */
   goto c50;
c65:
/* insert 3.8.1 28 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(1),DEF(28)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* branch , 50 */
   goto c50;
c68:
/* 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);
c71:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
