#include "chdecl.h"
void CH_chcode_chimprove_convert(current, sched, cop)
#define ARGUMENTS 6
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c5;
    case 4: goto c26;
    case 5: goto c28;
    case 6: goto c33;
    case 7: goto c35;
    case 8: goto c74;
    case 9: goto c75;
    case 10: goto c77;  }
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:
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
/* 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;
c5:
/* 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 =(1) */
  if (1 >= (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,1);
  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 , 5 */
  if ( REF(7).value.integer != REF(8).value.integer ) goto c5;
/* ord_case 9 5.4 */
  REF(9).value.ord_enum = REF(5)DOT(4).value.variant->info.variant_case;
  REF(9).tsdr = & dr_ord_enumeration;
/* equal . 9 =(2) , 19 */
  if ( REF(9).value.ord_enum == 2 ) goto c19;
/* equal . 9 =(1) , 28 */
  if ( REF(9).value.ord_enum == 1 ) goto c28;
/* branch , 33 */
   goto c33;
c19:
/* reveal 5.4 , 2 */
  if (2 != REF(5)DOT(4).value.variant->info.variant_case) goto ch_case_error;
/* copy 10 5.4.0 */
  if((ch_returncode = cp_real(& ch_val, REF(5)DOT(4)DOT(0).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).value = ch_val;
  REF(10).tsdr = & dr_real;
/* block , 2 */
  if((ch_returncode = che_block(QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* rcvt_int 11 10 */
  if (*REF(10).value.real >= (MAXINT+1.0) || *REF(10).value.real
     <= (MININT-1.0)) goto ch_range_error;
  REF(11).value.integer = *REF(10).value.real;
  REF(11).tsdr = & dr_integer;
/* endblock */
  che_endblock(sched);
/* branch , 35 */
   goto c35;
c26:
/* exit , 3 */
  ch_e = handler_type__exit; ch_val = QUAL(3); goto ch_exception;
c28:
/* reveal 5.4 , 1 */
  if (1 != REF(5)DOT(4).value.variant->info.variant_case) goto ch_case_error;
/* copy 11 5.4.0 */
  REF(11) = REF(5)DOT(4)DOT(0);
/* icvt_real 10 11 */
  if ((ch_real = (dfd_real *) new(dfd_real)) == nil) goto ch_depletion;
  REF(10).value.real = ch_real;
  REF(10).tsdr = & dr_real;*ch_real = REF(11).value.integer;
/* branch , 35 */
   goto c35;
c33:
/* exit , 3 */
  ch_e = handler_type__exit; ch_val = QUAL(3); goto ch_exception;
c35:
/* find 12 3.0.11 4.0 , 0 */
  if (findfunc(DEF(12),DEF(3)DOT(0)DOT(11),(
          arguments[0] = DEF(4)DOT(0),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* lookup_at 13 12.4 =(0) */
  if ( !((ch_t = REF(12)DOT(4).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);
/* equal . 14 =(4) , 47 */
  if ( REF(14).value.ord_enum == 4 ) goto c47;
/* equal . 14 =(3) , 51 */
  if ( REF(14).value.ord_enum == 3 ) goto c51;
/* equal . 14 =(2) , 55 */
  if ( REF(14).value.ord_enum == 2 ) goto c55;
/* branch , 67 */
   goto c67;
c47:
/* enum_lit 3.4 , 24 */
  REF(3)DOT(4).value.enumeration = 24;
  REF(3)DOT(4).tsdr = & dr_enumeration;
/* unite 3.5 10 , 3 */
  if ((ch_returncode = che_unite(DEF(3)DOT(5),DEF(10),sched,3)) != Normal)
     goto ch_raise_exception;
/* branch , 70 */
   goto c70;
c51:
/* enum_lit 3.4 , 10 */
  REF(3)DOT(4).value.enumeration = 10;
  REF(3)DOT(4).tsdr = & dr_enumeration;
/* unite 3.5 11 , 2 */
  if ((ch_returncode = che_unite(DEF(3)DOT(5),DEF(11),sched,2)) != Normal)
     goto ch_raise_exception;
/* branch , 70 */
   goto c70;
c55:
/* reveal 4.2 , 2 */
  if (2 != REF(4)DOT(2).value.variant->info.variant_case) goto ch_case_error;
/* ile 15 =(0) 11 */
  REF(15).value.boolean = (0 <= REF(11).value.integer);
/* ilt 16 11 4.2.0 */
  REF(16).value.boolean = (REF(11).value.integer < 
    REF(4)DOT(2)DOT(0).value.integer);
/* and 17 15 16 */
  REF(17).value.boolean = REF(15).value.boolean&REF(16).value.boolean;
  REF(17).tsdr = & dr_boolean;
/* branch_false 17 , 65 */
  if ( !REF(17).value.boolean ) goto c65;
/* enum_lit 3.4 , 36 */
  REF(3)DOT(4).value.enumeration = 36;
  REF(3)DOT(4).tsdr = & dr_enumeration;
/* unite 3.5 11 , 2 */
  if ((ch_returncode = che_unite(DEF(3)DOT(5),DEF(11),sched,2)) != Normal)
     goto ch_raise_exception;
/* branch , 70 */
   goto c70;
c65:
/* exit , 3 */
  ch_e = handler_type__exit; ch_val = QUAL(3); goto ch_exception;
c67:
/* exit , 3 */
  ch_e = handler_type__exit; ch_val = QUAL(3); goto ch_exception;
c70:
/* endget 5 3.2 */
  end_selector(DEF(5),DEF(3)DOT(2),sched,GET);
/* return_exception 3 , 4 */
  if (ch_caller = do_return(REF(3).value)) {
    raise_user(QUAL(4),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(3),QUAL(4));
  REF(3).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 75 */
   goto c75;
c74:
/* 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;
c75:
/* endblock */
  che_endblock(sched);
c77:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
