#include "chdecl.h"
void CH_typestate_pomvts(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 c3;
    case 4: goto c11;
    case 5: goto cb19;
    case 6: goto c20;
    case 7: goto c22;
    case 8: goto c28;
    case 9: goto c38;
    case 10: goto c48;
    case 11: goto c54;
    case 12: goto c65;
    case 13: goto c66;
    case 14: goto c68;
    case 15: goto c72;
    case 16: goto cb75;
    case 17: goto c76;
    case 18: goto c98;  }
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.5.2 , 0,0 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(4),DEF(3)DOT(5)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c3:
/* get_or_err 4 3.5.2 */
  if ((ch_returncode = get_selected_object(DEF(4),DEF(3)DOT(5)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.5.2 , 0,0 */
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(8),DEF(3)DOT(5)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c11:
/* get_or_err 8 3.5.2 */
  if ((ch_returncode = get_selected_object(DEF(8),DEF(3)DOT(5)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;
/* new_table 12 , 1 */
  if ((ch_returncode = che_new_table(DEF(12),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
  current->ip = 5;
cb19:
/* call 3.0.4 3.6 4 12 13 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(4),
          arguments[1] = DEF(3)DOT(6),
          arguments[2] = DEF(4),
          arguments[3] = DEF(12),
          arguments[4] = DEF(13),
          arguments[4+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c20:
/* copy 14 13 */
  if((ch_returncode = cp_table(& ch_val, REF(13).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).value = ch_val;
  REF(14).tsdr = & dr_table;
/* initget 15 14 , 0,0 */
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(15),DEF(14),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c22:
/* get_or_goto 15 14 , 72 */
  if ((ch_returncode = get_selected_object(DEF(15),DEF(14),sched)) != Normal)
     goto c72;
/* new_record 16 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(16).tsdr)->finalize)(REF(16).value,F_DISCARD,sched);
  REF(16).value = ch_val; REF(16).tsdr = & dr_record;
/* copy 16.0 15.0 */
  if((ch_returncode = (REF(15)DOT(0).tsdr->copy)(& ch_val, REF(15)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(16)DOT(0).tsdr)->finalize)(REF(16)DOT(0).value,F_DISCARD,sched);
  REF(16)DOT(0).value = ch_val;
  REF(16)DOT(0).tsdr = datarepmap[REF(15)DOT(0).tsdr->number];
/* new_table 16.1 , 3 */
  if ((ch_returncode = che_new_table(DEF(16)DOT(1),QUAL(3),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 17 15.1 */
  if((ch_returncode = cp_table(& ch_val, REF(15)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  REF(17).value = ch_val;
  REF(17).tsdr = & dr_table;
/* initget 18 17 , 0,0 */
  (*(REF(18).tsdr)->finalize)(REF(18).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(18),DEF(17),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c28:
/* get_or_goto 18 17 , 68 */
  if ((ch_returncode = get_selected_object(DEF(18),DEF(17),sched)) != Normal)
     goto c68;
/* equal 19 18.0 4.0 */
  REF(19).value.boolean = ((REF(18)DOT(0).tsdr->equal)(REF(18)DOT(0).value,
    REF(4)DOT(0).value));
  REF(19).tsdr = & dr_boolean;
/* size 20 18.1 */
  REF(20).value.integer = REF(18)DOT(1).value.table->size;
  REF(20).tsdr = & dr_integer;
/* size 21 4.1 */
  REF(21).value.integer = REF(4)DOT(1).value.table->size;
  REF(21).tsdr = & dr_integer;
/* ige 22 20 21 */
  REF(22).value.boolean = (REF(20).value.integer >= REF(21).value.integer);
/* and 23 19 22 */
  REF(23).value.boolean = REF(19).value.boolean&REF(22).value.boolean;
  REF(23).tsdr = & dr_boolean;
/* branch_false 23 , 48 */
  if ( !REF(23).value.boolean ) goto c48;
/* boolean 24 , TRUE */
  REF(24).value.boolean = TRUE;
  REF(24).tsdr = & dr_boolean;
/* initget 25 4.1 , 0,0 */
  (*(REF(25).tsdr)->finalize)(REF(25).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(25),DEF(4)DOT(1),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c38:
/* get_or_goto 25 4.1 , 46 */
  if ((ch_returncode = get_selected_object(DEF(25),DEF(4)DOT(1)
    ,sched)) != Normal) goto c46;
/* position 26 25 */
  ch_frame = get_selector_frame(DEF(25),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(26).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(26).tsdr = &dr_integer;
/* lookup_at 27 18.1 26 */
  if((ch_i = REF(26).value.integer) < 0 || ch_i >= (ch_t = REF(18)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(27).tsdr)->finalize)(REF(27).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(27).value,ch_i);
  REF(27).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 28 27 */
  if((ch_returncode = (REF(27).tsdr->copy)(& ch_val, REF(27).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(28).tsdr)->finalize)(REF(28).value,F_DISCARD,sched);
  REF(28).value = ch_val;
  REF(28).tsdr = datarepmap[REF(27).tsdr->number];
/* equal 29 28 25 */
  REF(29).value.boolean = ((REF(28).tsdr->equal)(REF(28).value,REF(25).value)
    );
  REF(29).tsdr = & dr_boolean;
/* discard 28 */
  (*(REF(28).tsdr)->finalize)(REF(28).value,F_DISCARD,sched);
  REF(28).tsdr = & dr_bottom;
/* branch_true 29 , 38 */
  if ( REF(29).value.boolean ) goto c38;
/* boolean 24 , FALSE */
  REF(24).value.boolean = FALSE;
  REF(24).tsdr = & dr_boolean;
c46:
/* endget 25 4.1 */
  end_selector(DEF(25),DEF(4)DOT(1),sched,GET);
/* move 23 24 */
  REF(23) = REF(24);
  REF(24).tsdr = & dr_bottom;
c48:
/* branch_false 23 , 65 */
  if ( !REF(23).value.boolean ) goto c65;
/* new_record 30 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(30).tsdr)->finalize)(REF(30).value,F_DISCARD,sched);
  REF(30).value = ch_val; REF(30).tsdr = & dr_record;
/* copy 30.0 8.0 */
  if((ch_returncode = (REF(8)DOT(0).tsdr->copy)(& ch_val, REF(8)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(30)DOT(0).tsdr)->finalize)(REF(30)DOT(0).value,F_DISCARD,sched);
  REF(30)DOT(0).value = ch_val;
  REF(30)DOT(0).tsdr = datarepmap[REF(8)DOT(0).tsdr->number];
/* copy 30.1 8.1 */
  if((ch_returncode = cp_table(& ch_val, REF(8)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(30)DOT(1).tsdr)->finalize)(REF(30)DOT(1).value,F_DISCARD,sched);
  REF(30)DOT(1).value = ch_val;
  REF(30)DOT(1).tsdr = & dr_table;
/* copy 31 18.1 */
  if((ch_returncode = cp_table(& ch_val, REF(18)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(31).tsdr)->finalize)(REF(31).value,F_DISCARD,sched);
  REF(31).value = ch_val;
  REF(31).tsdr = & dr_table;
/* initget 32 31 , 0,0 */
  (*(REF(32).tsdr)->finalize)(REF(32).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(32),DEF(31),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c54:
/* get_or_goto 32 31 , 62 */
  if ((ch_returncode = get_selected_object(DEF(32),DEF(31),sched)) != Normal)
     goto c62;
/* position 33 32 */
  ch_frame = get_selector_frame(DEF(32),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(33).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(33).tsdr = &dr_integer;
/* size 34 4.1 */
  REF(34).value.integer = REF(4)DOT(1).value.table->size;
  REF(34).tsdr = & dr_integer;
/* ilt . 33 34 , 54 */
  if ( REF(33).value.integer < REF(34).value.integer ) goto c54;
/* copy 35 32 */
  if((ch_returncode = (REF(32).tsdr->copy)(& ch_val, REF(32).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(35).tsdr)->finalize)(REF(35).value,F_DISCARD,sched);
  REF(35).value = ch_val;
  REF(35).tsdr = datarepmap[REF(32).tsdr->number];
/* insert 30.1 35 */
  if ((ch_returncode = insertfunc(DEF(30)DOT(1),DEF(35),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 54 */
   goto c54;
c62:
/* endget 32 31 */
  end_selector(DEF(32),DEF(31),sched,GET);
/* discard 31 */
  (*(REF(31).tsdr)->finalize)(REF(31).value,F_DISCARD,sched);
  REF(31).tsdr = & dr_bottom;
/* branch , 66 */
   goto c66;
c65:
/* copy 30 18 */
  if((ch_returncode = cp_record(& ch_val, REF(18).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(30).tsdr)->finalize)(REF(30).value,F_DISCARD,sched);
  REF(30).value = ch_val;
  REF(30).tsdr = & dr_record;
c66:
/* insert 16.1 30 */
  if ((ch_returncode = insertfunc(DEF(16)DOT(1),DEF(30),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 28 */
   goto c28;
c68:
/* endget 18 17 */
  end_selector(DEF(18),DEF(17),sched,GET);
/* discard 17 */
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  REF(17).tsdr = & dr_bottom;
/* insert 3.8.0 16 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(0),DEF(16)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* branch , 22 */
   goto c22;
c72:
/* endget 15 14 */
  end_selector(DEF(15),DEF(14),sched,GET);
/* discard 14 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).tsdr = & dr_bottom;
/* merge 3.8.1 13 */
  if ((ch_returncode = mergefunc(DEF(3)DOT(8)DOT(1),DEF(13)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
  current->ip = 16;
cb75:
/* call 3.0.4 3.6 8 12 36 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(4),
          arguments[1] = DEF(3)DOT(6),
          arguments[2] = DEF(8),
          arguments[3] = DEF(12),
          arguments[4] = DEF(36),
          arguments[4+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c76:
/* size 37 36 */
  REF(37).value.integer = REF(36).value.table->size;
  REF(37).tsdr = & dr_integer;
/* ile . 37 =(0) , 93 */
  if ( REF(37).value.integer <= 0 ) goto c93;
/* privatize 36 */
  if (REF(36).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(36))) != Normal)
       goto ch_raise_exception;
/* initget 38 36 , 0,0 */
  (*(REF(38).tsdr)->finalize)(REF(38).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(38),DEF(36),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
/* get_or_err 38 36 */
  if ((ch_returncode = get_selected_object(DEF(38),DEF(36),sched)) != Normal)
     goto ch_raise_exception;
/* remove 39 38 36 */
  if ((ch_returncode = che_remove(DEF(39),DEF(38),DEF(36),sched)) != Normal)
     goto ch_raise_exception;
/* endget 38 36 */
  end_selector(DEF(38),DEF(36),sched,GET);
/* boolean 40 , FALSE */
  REF(40).value.boolean = FALSE;
  REF(40).tsdr = & dr_boolean;
/* find_or_goto 41 3.8.0 39 , 0,88 */
  if (findfunc(DEF(41),DEF(3)DOT(8)DOT(0),(
          arguments[0] = DEF(39),& arguments[0]),sched,0) == FAILURE) goto c88;
/* boolean 40 , TRUE */
  REF(40).value.boolean = TRUE;
  REF(40).tsdr = & dr_boolean;
c88:
/* branch_false 40 , 91 */
  if ( !REF(40).value.boolean ) goto c91;
/* discard 39 */
  (*(REF(39).tsdr)->finalize)(REF(39).value,F_DISCARD,sched);
  REF(39).tsdr = & dr_bottom;
/* branch , 76 */
   goto c76;
c91:
/* insert 3.8.1 39 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(1),DEF(39)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* branch , 76 */
   goto c76;
c93:
/* endget 8 3.5.2 */
  end_selector(DEF(8),DEF(3)DOT(5)DOT(2),sched,GET);
/* endget 4 3.5.2 */
  end_selector(DEF(4),DEF(3)DOT(5)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);
c98:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
