#include "chdecl.h"
void CH_sorterrors(current, sched, cop)
#define ARGUMENTS 6
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb5;
    case 2: goto c6;
    case 3: goto c8;
    case 4: goto c18;
    case 5: goto c36;
    case 6: goto c45;
    case 7: goto c47;
    case 8: goto c49;
    case 9: goto c51;
    case 10: goto c58;
    case 11: goto cb66;
    case 12: goto c67;
    case 13: goto c78;
    case 14: goto c82;
    case 15: goto c85;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
/* prog_lit 3 , 1 */
  if ((ch_returncode = che_prog_lit(DEF(3),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* procedure 4 3 , 2 */
  if ((ch_returncode = che_procedure(DEF(4),DEF(3),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* discard 3 */
  (*(REF(3).tsdr)->finalize)(REF(3).value,F_DISCARD,sched);
  REF(3).tsdr = & dr_bottom;
/* move 5 4 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5) = REF(4);
  REF(4).tsdr = & dr_bottom;
  current->ip = 1;
cb5:
/* receive 6 0 */
  if ((ch_returncode = che_receive(DEF(6),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c6:
/* block , 3 */
  if((ch_returncode = che_block(QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
/* initget 7 6.0 , 0,0 */
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(7),DEF(6)DOT(0),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c8:
/* get_or_err 7 6.0 */
  if ((ch_returncode = get_selected_object(DEF(7),DEF(6)DOT(0)
    ,sched)) != Normal) goto ch_raise_exception;
/* case 8 7.0 */
  REF(8).value.enumeration = REF(7)DOT(0).value.variant->info.variant_case;
  REF(8).tsdr = & dr_enumeration;
/* notequal . 8 =(0) , 8 */
  if ( REF(8).value.enumeration != 0 ) goto c8;
/* position 9 7 */
  ch_frame = get_selector_frame(DEF(7),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;
/* endget 7 6.0 */
  end_selector(DEF(7),DEF(6)DOT(0),sched,GET);
/* move 10 9 */
  REF(10) = REF(9);
  REF(9).tsdr = & dr_bottom;
/* size 11 6.0 */
  REF(11).value.integer = REF(6)DOT(0).value.table->size;
  REF(11).tsdr = & dr_integer;
c18:
/* noop */
  
/* isubtract 12 11 =(1) */
  if (!chf_isubtract(DEF(12),REF(11).value.integer,1)) goto ch_depletion;
/* ige . 10 12 , 45 */
  if ( REF(10).value.integer >= REF(12).value.integer ) goto c45;
/* isubtract 11 11 =(1) */
  if (!chf_isubtract(DEF(11),REF(11).value.integer,1)) goto ch_depletion;
/* privatize 6.0 */
  if (REF(6)DOT(0).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(6)DOT(0))) != Normal)
       goto ch_raise_exception;
/* lookup_at 13 6.0 11 */
  if((ch_i = REF(11).value.integer) < 0 || ch_i >= (ch_t = REF(6)DOT(0).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 6.0 11 */
  if ((ch_returncode = remove_at_func(DEF(14),DEF(6)DOT(0),
    REF(11).value.integer)) != Normal) goto ch_raise_exception;
/* insert_at 6.0 14 10 */
  ch_i = REF(10).value.integer;
  if (ch_i < 0 || REF(6)DOT(0).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(6)DOT(0),DEF(14),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
/* privatize 6.0 */
  if (REF(6)DOT(0).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(6)DOT(0))) != Normal)
       goto ch_raise_exception;
/* iadd 15 10 =(1) */
  if (!chf_iadd(DEF(15),REF(10).value.integer,1)) goto ch_depletion;
/* lookup_at 16 6.0 15 */
  if((ch_i = REF(15).value.integer) < 0 || ch_i >= (ch_t = REF(6)DOT(0).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 14 6.0 15 */
  if ((ch_returncode = remove_at_func(DEF(14),DEF(6)DOT(0),
    REF(15).value.integer)) != Normal) goto ch_raise_exception;
/* insert 6.0 14 */
  if ((ch_returncode = insertfunc(DEF(6)DOT(0),DEF(14),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* initget 17 6.0 , 0,0 */
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(17),DEF(6)DOT(0),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c36:
/* get_or_err 17 6.0 */
  if ((ch_returncode = get_selected_object(DEF(17),DEF(6)DOT(0)
    ,sched)) != Normal) goto ch_raise_exception;
/* case 18 17.0 */
  REF(18).value.enumeration = REF(17)DOT(0).value.variant->info.variant_case;
  REF(18).tsdr = & dr_enumeration;
/* notequal . 18 =(0) , 36 */
  if ( REF(18).value.enumeration != 0 ) goto c36;
/* position 19 17 */
  ch_frame = get_selector_frame(DEF(17),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(19).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(19).tsdr = &dr_integer;
/* endget 17 6.0 */
  end_selector(DEF(17),DEF(6)DOT(0),sched,GET);
/* move 10 19 */
  REF(10) = REF(19);
  REF(19).tsdr = & dr_bottom;
/* branch , 18 */
   goto c18;
c45:
/* endblock */
  che_endblock(sched);
/* branch , 49 */
   goto c49;
c47:
/* size 11 6.0 */
  REF(11).value.integer = REF(6)DOT(0).value.table->size;
  REF(11).tsdr = & dr_integer;
c49:
/* ilit 10 , 0 */
  REF(10).value.integer = 0;
  REF(10).tsdr = & dr_integer;
c51:
/* noop */
  
/* isubtract 20 11 =(1) */
  if (!chf_isubtract(DEF(20),REF(11).value.integer,1)) goto ch_depletion;
/* ige . 10 20 , 82 */
  if ( REF(10).value.integer >= REF(20).value.integer ) goto c82;
/* isubtract 21 11 =(1) */
  if (!chf_isubtract(DEF(21),REF(11).value.integer,1)) goto ch_depletion;
c58:
/* ile . 21 10 , 78 */
  if ( REF(21).value.integer <= REF(10).value.integer ) goto c78;
/* isubtract 22 21 =(1) */
  if (!chf_isubtract(DEF(22),REF(21).value.integer,1)) goto ch_depletion;
/* lookup_at 23 6.0 22 */
  if((ch_i = REF(22).value.integer) < 0 || ch_i >= (ch_t = REF(6)DOT(0).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];
/* reveal 23.0 , 1 */
  if (1 != REF(23)DOT(0).value.variant->info.variant_case) goto ch_case_error;
/* lookup_at 24 6.0 21 */
  if((ch_i = REF(21).value.integer) < 0 || ch_i >= (ch_t = REF(6)DOT(0).value
    .table)->size) goto ch_notfound;
  (*(REF(24).tsdr)->finalize)(REF(24).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(24).value,ch_i);
  REF(24).tsdr = qdatarepmap[ch_t->tsdr->number];
/* reveal 24.0 , 1 */
  if (1 != REF(24)DOT(0).value.variant->info.variant_case) goto ch_case_error;
  current->ip = 11;
cb66:
/* call 5 23.0.0 24.0.0 25 , 4 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(5),
          arguments[1] = DEF(23)DOT(0)DOT(0),
          arguments[2] = DEF(24)DOT(0)DOT(0),
          arguments[3] = DEF(25),
          arguments[3+1] = nil,& arguments[0]),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c67:
/* branch_false 25 , 74 */
  if ( !REF(25).value.boolean ) goto c74;
/* privatize 6.0 */
  if (REF(6)DOT(0).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(6)DOT(0))) != Normal)
       goto ch_raise_exception;
/* lookup_at 26 6.0 21 */
  if((ch_i = REF(21).value.integer) < 0 || ch_i >= (ch_t = REF(6)DOT(0).value
    .table)->size) goto ch_notfound;
  (*(REF(26).tsdr)->finalize)(REF(26).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(26).value,ch_i);
  REF(26).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 14 6.0 21 */
  if ((ch_returncode = remove_at_func(DEF(14),DEF(6)DOT(0),
    REF(21).value.integer)) != Normal) goto ch_raise_exception;
/* isubtract 27 21 =(1) */
  if (!chf_isubtract(DEF(27),REF(21).value.integer,1)) goto ch_depletion;
/* insert_at 6.0 14 27 */
  ch_i = REF(27).value.integer;
  if (ch_i < 0 || REF(6)DOT(0).value.table->size < ch_i) goto ch_range_error;
  if ((ch_returncode = insertfunc(DEF(6)DOT(0),DEF(14),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
c74:
/* noop */
  
/* isubtract 21 21 =(1) */
  if (!chf_isubtract(DEF(21),REF(21).value.integer,1)) goto ch_depletion;
/* branch , 58 */
   goto c58;
c78:
/* noop */
  
/* iadd 10 10 =(1) */
  if (!chf_iadd(DEF(10),REF(10).value.integer,1)) goto ch_depletion;
/* branch , 51 */
   goto c51;
c82:
/* return 6 */
  if (ch_caller = do_return(REF(6).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(6).value);
  REF(6).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
c85:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
