#include "chdecl.h"
void CH_chcode_chimprove_code_proglit(current, sched, cop)
#define ARGUMENTS 5
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c21;  }
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:
/* noop */
  
/* ilt . 3.1 =(0) , 18 */
  if ( REF(3)DOT(1).value.integer < 0 ) goto c18;
/* 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 4 3.2 3.1 */
  if((ch_i = REF(3)DOT(1).value.integer) < 0 || ch_i >= (ch_t = 
    REF(3)DOT(2).value.table)->size) goto ch_notfound;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(4).value,ch_i);
  REF(4).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 5 3.2 3.1 */
  if ((ch_returncode = remove_at_func(DEF(5),DEF(3)DOT(2),
    REF(3)DOT(1).value.integer)) != Normal) goto ch_raise_exception;
/* isubtract 5.3 5.3 =(1) */
  if (!chf_isubtract(DEF(5)DOT(3),REF(5)DOT(3).value.integer,1))
     goto ch_depletion;
/* equal . 3.0 =(0) , 17 */
  if ( REF(3)DOT(0).value.enumeration == 0 ) goto c17;
/* isubtract 5.2 5.2 =(1) */
  if (!chf_isubtract(DEF(5)DOT(2),REF(5)DOT(2).value.integer,1))
     goto ch_depletion;
c17:
/* insert_at 3.2 5 3.1 */
  ch_i = REF(3)DOT(1).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(5),TRUE, ch_i)) != Normal)
     goto ch_raise_exception;
c18:
/* 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);
c21:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
