#include "chdecl.h"
void CH_typestate_pomakecase(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 cb36;
    case 5: goto c37;
    case 6: goto cb42;
    case 7: goto c43;
    case 8: goto c44;
    case 9: goto c55;
    case 10: goto c57;
    case 11: goto c59;
    case 12: goto c62;  }
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;
/* copy 8 4 */
  if((ch_returncode = (REF(4).tsdr->copy)(& ch_val, REF(4).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  REF(8).value = ch_val;
  REF(8).tsdr = datarepmap[REF(4).tsdr->number];
/* endget 4 3.5.2 */
  end_selector(DEF(4),DEF(3)DOT(5)DOT(2),sched,GET);
/* move 9 8 */
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9) = REF(8);
  REF(8).tsdr = & dr_bottom;
/* copy 10 9 */
  if((ch_returncode = (REF(9).tsdr->copy)(& ch_val, REF(9).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).value = ch_val;
  REF(10).tsdr = datarepmap[REF(9).tsdr->number];
/* privatize 10.1 */
  if (REF(10)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(10)DOT(1))) != Normal)
       goto ch_raise_exception;
/* size 11 10.1 */
  REF(11).value.integer = REF(10)DOT(1).value.table->size;
  REF(11).tsdr = & dr_integer;
/* isubtract 12 11 =(1) */
  if (!chf_isubtract(DEF(12),REF(11).value.integer,1)) goto ch_depletion;
/* lookup_at 13 10.1 12 */
  if((ch_i = REF(12).value.integer) < 0 || ch_i >= (ch_t = REF(10)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(13).value,ch_i);
  REF(13).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 14 10.1 12 */
  if ((ch_returncode = remove_at_func(DEF(14),DEF(10)DOT(1),
    REF(12).value.integer)) != Normal) goto ch_raise_exception;
/* new_record 15 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  REF(15).value = ch_val; REF(15).tsdr = & dr_record;
/* new_table 15.1 , 1 */
  if ((ch_returncode = che_new_table(DEF(15)DOT(1),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* unite 15.0 16 , 1 */
  if ((ch_returncode = che_unite(DEF(15)DOT(0),DEF(16),sched,1)) != Normal)
     goto ch_raise_exception;
/* copy 17 10 */
  if((ch_returncode = (REF(10).tsdr->copy)(& ch_val, REF(10).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  REF(17).value = ch_val;
  REF(17).tsdr = datarepmap[REF(10).tsdr->number];
/* insert 15.1 17 */
  if ((ch_returncode = insertfunc(DEF(15)DOT(1),DEF(17),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* copy 18 9 */
  if((ch_returncode = (REF(9).tsdr->copy)(& ch_val, REF(9).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(9).tsdr->number];
/* insert 15.1 18 */
  if ((ch_returncode = insertfunc(DEF(15)DOT(1),DEF(18),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* new_record 19 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(19).tsdr)->finalize)(REF(19).value,F_DISCARD,sched);
  REF(19).value = ch_val; REF(19).tsdr = & dr_record;
/* new_table 19.1 , 1 */
  if ((ch_returncode = che_new_table(DEF(19)DOT(1),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* unite 19.0 20 , 0 */
  if ((ch_returncode = che_unite(DEF(19)DOT(0),DEF(20),sched,0)) != Normal)
     goto ch_raise_exception;
/* copy 21 10 */
  if((ch_returncode = (REF(10).tsdr->copy)(& ch_val, REF(10).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(21).tsdr)->finalize)(REF(21).value,F_DISCARD,sched);
  REF(21).value = ch_val;
  REF(21).tsdr = datarepmap[REF(10).tsdr->number];
/* insert 19.1 21 */
  if ((ch_returncode = insertfunc(DEF(19)DOT(1),DEF(21),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* insert 3.8.0 15 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(0),DEF(15)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* insert 3.8.0 19 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(0),DEF(19)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
  current->ip = 4;
cb36:
/* call 3.0.13 3.0 3.1 3.3 3.2 10 22 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(13),
          arguments[1] = DEF(3)DOT(0),
          arguments[2] = DEF(3)DOT(1),
          arguments[3] = DEF(3)DOT(3),
          arguments[4] = DEF(3)DOT(2),
          arguments[5] = DEF(10),
          arguments[6] = DEF(22),
          arguments[6+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c37:
/* noop */
  
/* find 23 3.3 22.0 , 0 */
  if (findfunc(DEF(23),DEF(3)DOT(3),(
          arguments[0] = DEF(22)DOT(0),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* find 24 23.1 22.1 , 0 */
  if (findfunc(DEF(24),DEF(23)DOT(1),(
          arguments[0] = DEF(22)DOT(1),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* reveal 24.2 , 6 */
  if (6 != REF(24)DOT(2).value.variant->info.variant_case) goto ch_case_error;
/* find 25 24.2.0.1 14 , 0 */
  if (findfunc(DEF(25),DEF(24)DOT(2)DOT(0)DOT(1),(
          arguments[0] = DEF(14),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
  current->ip = 6;
cb42:
/* call 3.0.14 3.0 9 25.2 26 , 3 */
  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(25)DOT(2),
          arguments[4] = DEF(26),
          arguments[4+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  return;
c43:
/* block , 4 */
  if((ch_returncode = che_block(QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
c44:
/* noop */
  
/* privatize 26 */
  if (REF(26).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(26))) != Normal)
       goto ch_raise_exception;
/* initget 27 26 , 0,0 */
  (*(REF(27).tsdr)->finalize)(REF(27).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(27),DEF(26),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
/* get_or_err 27 26 */
  if ((ch_returncode = get_selected_object(DEF(27),DEF(26),sched)) != Normal)
     goto ch_raise_exception;
/* remove 28 27 26 */
  if ((ch_returncode = che_remove(DEF(28),DEF(27),DEF(26),sched)) != Normal)
     goto ch_raise_exception;
/* endget 27 26 */
  end_selector(DEF(27),DEF(26),sched,GET);
/* block , 5 */
  if((ch_returncode = che_block(QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
/* insert 3.8.0 28 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(0),DEF(28)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* endblock */
  che_endblock(sched);
c55:
/* discard 28 */
  (*(REF(28).tsdr)->finalize)(REF(28).value,F_DISCARD,sched);
  REF(28).tsdr = & dr_bottom;
/* branch , 44 */
   goto c44;
c57:
/* endblock */
  che_endblock(sched);
c59:
/* 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);
c62:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
