#include "chdecl.h"
void CH_chcode_chimprove_discard(current, sched, cop)
#define ARGUMENTS 5
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb4;
    case 2: goto c5;
    case 3: goto c7;
    case 4: goto c30;
    case 5: goto c31;
    case 6: goto c33;  }
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:
/* lookup_at 4 3.1 3.3 */
  if((ch_i = REF(3)DOT(3).value.integer) < 0 || ch_i >= (ch_t = 
    REF(3)DOT(1).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];
/* initget 5 3.2 , 0,0 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(5),DEF(3)DOT(2),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c7:
/* get_or_err 5 3.2 */
  if ((ch_returncode = get_selected_object(DEF(5),DEF(3)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* lookup_at 6 4.1 =(0) */
  if ( !((ch_t = REF(4)DOT(1).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);
/* position 8 5 */
  ch_frame = get_selector_frame(DEF(5),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(8).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(8).tsdr = &dr_integer;
/* notequal . 7 8 , 7 */
  if ( REF(7).value.integer != REF(8).value.integer ) goto c7;
/* lookup_at 9 5.0 =(0) */
  if ( !((ch_t = REF(5)DOT(0).value.table)->size) ) goto ch_notfound;
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(9).value,0);
  REF(9).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 10 9 */
  REF(10) = REF(9);
/* ilt . 10 =(3) , 26 */
  if ( REF(10).value.integer < 3 ) goto c26;
/* notequal . 5.2 =(0) , 26 */
  if ( REF(5)DOT(2).value.integer != 0 ) goto c26;
/* notequal . 5.3 =(1) , 26 */
  if ( REF(5)DOT(3).value.integer != 1 ) goto c26;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c26:
/* endget 5 3.2 */
  end_selector(DEF(5),DEF(3)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);
/* branch , 31 */
   goto c31;
c30:
/* return_exception 3 , 3 */
  if (ch_caller = do_return(REF(3).value)) {
    raise_user(QUAL(3),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(3),QUAL(3));
  REF(3).tsdr = & dr_bottom;
c31:
/* endblock */
  che_endblock(sched);
c33:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
