#include "chdecl.h"
void CH_chcode_chimprove_move(current, sched, cop)
#define ARGUMENTS 6
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb4;
    case 2: goto c5;
    case 3: goto cb123;
    case 4: goto c124;
    case 5: goto c129;
    case 6: goto c131;
    case 7: goto c132;
    case 8: goto c134;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 1;
cb4:
/* receive 3 0 */
  if ((ch_returncode = che_receive(DEF(3),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c5:
/* size 4 3.3 */
  REF(4).value.integer = REF(3)DOT(3).value.table->size;
  REF(4).tsdr = & dr_integer;
/* isubtract 5 4 =(1) */
  if (!chf_isubtract(DEF(5),REF(4).value.integer,1)) goto ch_depletion;
/* lookup_at 6 3.3 5 */
  if((ch_i = REF(5).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(3).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,ch_i);
  REF(6).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 7 6 */
  REF(7) = REF(6);
/* lookup_at 8 3.1 7 */
  if((ch_i = REF(7).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(8).value,ch_i);
  REF(8).tsdr = qdatarepmap[ch_t->tsdr->number];
/* equal . 8.6 =(0) , 17 */
  if ( REF(8)DOT(6).value.integer == 0 ) goto c17;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c17:
/* noop */
  
/* ile . 5 =(0) , 26 */
  if ( REF(5).value.integer <= 0 ) goto c26;
/* isubtract 9 5 =(1) */
  if (!chf_isubtract(DEF(9),REF(5).value.integer,1)) goto ch_depletion;
/* lookup_at 10 3.3 9 */
  if((ch_i = REF(9).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(3).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,ch_i);
  REF(10).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 11 10 */
  REF(11) = REF(10);
/* branch , 34 */
   goto c34;
c26:
/* noop */
  
/* isubtract 11 7 =(1) */
  if (!chf_isubtract(DEF(11),REF(7).value.integer,1)) goto ch_depletion;
/* lookup_at 12 3.1 11 */
  if((ch_i = REF(11).value.integer) < 0 || ch_i >= (ch_t = REF(3)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];
/* oele . 12.4 =(1) , 34 */
  if ( REF(12)DOT(4).value.ord_enum <= 1 ) goto c34;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c34:
/* noop */
  
/* lookup_at 13 8.1 =(0) */
  if ( !((ch_t = REF(8)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,0);
  REF(13).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 14 13 */
  REF(14) = REF(13);
/* lookup_at 15 8.1 =(1) */
  if (1 >= (ch_t = REF(8)DOT(1).value.table)->size) goto ch_notfound;
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(15).value,1);
  REF(15).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 16 15 */
  REF(16) = REF(15);
/* lookup_at 17 3.1 11 */
  if((ch_i = REF(11).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(17).value,ch_i);
  REF(17).tsdr = qdatarepmap[ch_t->tsdr->number];
/* notequal . 17.0 =(90) , 66 */
  if ( REF(17)DOT(0).value.enumeration != 90 ) goto c66;
/* size 18 17.1 */
  REF(18).value.integer = REF(17)DOT(1).value.table->size;
  REF(18).tsdr = & dr_integer;
/* isubtract 19 18 =(1) */
  if (!chf_isubtract(DEF(19),REF(18).value.integer,1)) goto ch_depletion;
/* lookup_at 20 17.1 19 */
  if((ch_i = REF(19).value.integer) < 0 || ch_i >= (ch_t = REF(17)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(20).tsdr)->finalize)(REF(20).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(20).value,ch_i);
  REF(20).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 21 20 */
  REF(21) = REF(20);
/* equal . 21 16 , 55 */
  if ( REF(21).value.integer == REF(16).value.integer ) goto c55;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c55:
/* lookup_at 22 3.2 16 */
  if((ch_i = REF(16).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(2).value
    .table)->size) goto ch_notfound;
  (*(REF(22).tsdr)->finalize)(REF(22).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(22).value,ch_i);
  REF(22).tsdr = qdatarepmap[ch_t->tsdr->number];
/* equal . 22.2 =(1) , 60 */
  if ( REF(22)DOT(2).value.integer == 1 ) goto c60;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c60:
/* lookup_at 23 3.2 14 */
  if((ch_i = REF(14).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(2).value
    .table)->size) goto ch_notfound;
  (*(REF(23).tsdr)->finalize)(REF(23).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(23).value,ch_i);
  REF(23).tsdr = qdatarepmap[ch_t->tsdr->number];
/* equal . 23.2 =(1) , 92 */
  if ( REF(23)DOT(2).value.integer == 1 ) goto c92;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c66:
/* find 24 3.0.11 17.0 , 0 */
  if (findfunc(DEF(24),DEF(3)DOT(0)DOT(11),(
          arguments[0] = DEF(17)DOT(0),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* equal . 24.3 =(2) , 71 */
  if ( REF(24)DOT(3).value.enumeration == 2 ) goto c71;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c71:
/* ilit 19 , 0 */
  REF(19).value.integer = 0;
  REF(19).tsdr = & dr_integer;
/* lookup_at 25 17.1 19 */
  if((ch_i = REF(19).value.integer) < 0 || ch_i >= (ch_t = REF(17)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(25).tsdr)->finalize)(REF(25).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(25).value,ch_i);
  REF(25).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 26 25 */
  REF(26) = REF(25);
/* equal . 26 16 , 78 */
  if ( REF(26).value.integer == REF(16).value.integer ) goto c78;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c78:
/* noop */
  
/* notequal . 24.5 =(5) , 92 */
  if ( REF(24)DOT(5).value.enumeration != 5 ) goto c92;
/* lookup_at 27 3.2 14 */
  if((ch_i = REF(14).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(2).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];
/* notequal . 27.2 =(1) , 92 */
  if ( REF(27)DOT(2).value.integer != 1 ) goto c92;
/* lookup_at 28 3.2 16 */
  if((ch_i = REF(16).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(2).value
    .table)->size) goto ch_notfound;
  (*(REF(28).tsdr)->finalize)(REF(28).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(28).value,ch_i);
  REF(28).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 29 28.4 */
  if((ch_returncode = (REF(28)DOT(4).tsdr->copy)(& ch_val, REF(28)DOT(4).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(29).tsdr)->finalize)(REF(29).value,F_DISCARD,sched);
  REF(29).value = ch_val;
  REF(29).tsdr = datarepmap[REF(28)DOT(4).tsdr->number];
/* privatize 3.2 */
  if (REF(3)DOT(2).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(3)DOT(2))) != Normal)
       goto ch_raise_exception;
/* lookup_at 30 3.2 14 */
  if((ch_i = REF(14).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(2).value
    .table)->size) goto ch_notfound;
  (*(REF(30).tsdr)->finalize)(REF(30).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(30).value,ch_i);
  REF(30).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 31 3.2 14 */
  if ((ch_returncode = remove_at_func(DEF(31),DEF(3)DOT(2),
    REF(14).value.integer)) != Normal) goto ch_raise_exception;
/* move 31.4 29 */
  (*(REF(31)DOT(4).tsdr)->finalize)(REF(31)DOT(4).value,F_DISCARD,sched);
  REF(31)DOT(4) = REF(29);
  REF(29).tsdr = & dr_bottom;
/* insert_at 3.2 31 14 */
  ch_i = REF(14).value.integer;
  if (ch_i < 0 || REF(3)DOT(2).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(3)DOT(2),DEF(31),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
c92:
/* privatize 3.1 */
  if (REF(3)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(3)DOT(1))) != Normal)
       goto ch_raise_exception;
/* lookup_at 32 3.1 11 */
  if((ch_i = REF(11).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(32).tsdr)->finalize)(REF(32).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(32).value,ch_i);
  REF(32).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 33 3.1 11 */
  if ((ch_returncode = remove_at_func(DEF(33),DEF(3)DOT(1),
    REF(11).value.integer)) != Normal) goto ch_raise_exception;
/* privatize 33.1 */
  if (REF(33)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(33)DOT(1))) != Normal)
       goto ch_raise_exception;
/* lookup_at 34 33.1 19 */
  if((ch_i = REF(19).value.integer) < 0 || ch_i >= (ch_t = REF(33)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(34).tsdr)->finalize)(REF(34).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(34).value,ch_i);
  REF(34).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 16 33.1 19 */
  if ((ch_returncode = remove_at_func(DEF(16),DEF(33)DOT(1),
    REF(19).value.integer)) != Normal) goto ch_raise_exception;
/* insert_at 33.1 14 19 */
  ch_i = REF(19).value.integer;
  if (ch_i < 0 || REF(33)DOT(1).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(33)DOT(1),DEF(14),TRUE, ch_i
    )) != Normal) goto ch_raise_exception;
/* insert_at 3.1 33 11 */
  ch_i = REF(11).value.integer;
  if (ch_i < 0 || REF(3)DOT(1).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(3)DOT(1),DEF(33),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
/* privatize 3.1 */
  if (REF(3)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(3)DOT(1))) != Normal)
       goto ch_raise_exception;
/* lookup_at 35 3.1 7 */
  if((ch_i = REF(7).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(35).tsdr)->finalize)(REF(35).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(35).value,ch_i);
  REF(35).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 33 3.1 7 */
  if ((ch_returncode = remove_at_func(DEF(33),DEF(3)DOT(1),
    REF(7).value.integer)) != Normal) goto ch_raise_exception;
/* privatize 33.1 */
  if (REF(33)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(33)DOT(1))) != Normal)
       goto ch_raise_exception;
/* lookup_at 36 33.1 =(0) */
  if ( !((ch_t = REF(33)DOT(1).value.table)->size) ) goto ch_notfound;
  (*(REF(36).tsdr)->finalize)(REF(36).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(36).value,0);
  REF(36).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 14 33.1 =(0) */
  if ((ch_returncode = remove_at_func(DEF(14),DEF(33)DOT(1),0)) != Normal)
     goto ch_raise_exception;
/* lookup_at 37 3.2 16 */
  if((ch_i = REF(16).value.integer) < 0 || ch_i >= (ch_t = REF(3)DOT(2).value
    .table)->size) goto ch_notfound;
  (*(REF(37).tsdr)->finalize)(REF(37).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(37).value,ch_i);
  REF(37).tsdr = qdatarepmap[ch_t->tsdr->number];
/* notequal . 37.2 =(1) , 119 */
  if ( REF(37)DOT(2).value.integer != 1 ) goto c119;
/* lookup_at 38 37.0 =(0) */
  if ( !((ch_t = REF(37)DOT(0).value.table)->size) ) goto ch_notfound;
  (*(REF(38).tsdr)->finalize)(REF(38).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(38).value,0);
  REF(38).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 39 38 */
  REF(39) = REF(38);
/* ilt . 39 =(3) , 119 */
  if ( REF(39).value.integer < 3 ) goto c119;
/* insert 33.1 16 */
  if ((ch_returncode = insertfunc(DEF(33)DOT(1),DEF(16),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* insert_at 3.1 33 7 */
  ch_i = REF(7).value.integer;
  if (ch_i < 0 || REF(3)DOT(1).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(3)DOT(1),DEF(33),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
/* exit , 3 */
  ch_e = handler_type__exit; ch_val = QUAL(3); goto ch_exception;
c119:
/* enum_lit 33.0 , 2 */
  REF(33)DOT(0).value.enumeration = 2;
  REF(33)DOT(0).tsdr = & dr_enumeration;
/* insert_at 3.1 33 7 */
  ch_i = REF(7).value.integer;
  if (ch_i < 0 || REF(3)DOT(1).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(3)DOT(1),DEF(33),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
/* enum_lit 40 , 2 */
  REF(40).value.enumeration = 2;
  REF(40).tsdr = & dr_enumeration;
  current->ip = 3;
cb123:
/* call 3.4 40 16 3.2 , 4 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(4),
          arguments[1] = DEF(40),
          arguments[2] = DEF(16),
          arguments[3] = DEF(3)DOT(2),
          arguments[3+1] = nil,& arguments[0]),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c124:
/* boolean 3.5 , TRUE */
  REF(3)DOT(5).value.boolean = TRUE;
  REF(3)DOT(5).tsdr = & dr_boolean;
/* 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);
/* branch , 132 */
   goto c132;
c129:
/* 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;
/* branch , 132 */
   goto c132;
c131:
/* return_exception 3 , 5 */
  if (ch_caller = do_return(REF(3).value)) {
    raise_user(QUAL(5),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(3),QUAL(5));
  REF(3).tsdr = & dr_bottom;
c132:
/* endblock */
  che_endblock(sched);
c134:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
