#include "chdecl.h"
void CH_typestate_substcparms(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 c5;
    case 4: goto c8;
    case 5: goto c21;
    case 6: goto c26;
    case 7: goto c38;
    case 8: goto c51;
    case 9: goto c55;
    case 10: goto c60;  }
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:
/* new_table 3.4 , 1 */
  if ((ch_returncode = che_new_table(DEF(3)DOT(4),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 4 3.3 */
  if((ch_returncode = cp_table(& ch_val, REF(3)DOT(3).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).value = ch_val;
  REF(4).tsdr = & dr_table;
/* initget 5 4 , 0,0 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(5),DEF(4),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c5:
/* get_or_goto 5 4 , 55 */
  if ((ch_returncode = get_selected_object(DEF(5),DEF(4),sched)) != Normal)
     goto c55;
/* boolean 6 , TRUE */
  REF(6).value.boolean = TRUE;
  REF(6).tsdr = & dr_boolean;
/* initget 7 5.1 , 0,0 */
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(7),DEF(5)DOT(1),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c8:
/* get_or_goto 7 5.1 , 14 */
  if ((ch_returncode = get_selected_object(DEF(7),DEF(5)DOT(1)
    ,sched)) != Normal) goto c14;
/* size 8 7 */
  REF(8).value.integer = REF(7).value.table->size;
  REF(8).tsdr = & dr_integer;
/* igt . 8 =(0) , 8 */
  if ( REF(8).value.integer > 0 ) goto c8;
/* boolean 6 , FALSE */
  REF(6).value.boolean = FALSE;
  REF(6).tsdr = & dr_boolean;
c14:
/* endget 7 5.1 */
  end_selector(DEF(7),DEF(5)DOT(1),sched,GET);
/* branch_false 6 , 5 */
  if ( !REF(6).value.boolean ) goto c5;
/* new_record 9 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).value = ch_val; REF(9).tsdr = & dr_record;
/* copy 9.0 5.0 */
  if((ch_returncode = (REF(5)DOT(0).tsdr->copy)(& ch_val, REF(5)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(9)DOT(0).tsdr)->finalize)(REF(9)DOT(0).value,F_DISCARD,sched);
  REF(9)DOT(0).value = ch_val;
  REF(9)DOT(0).tsdr = datarepmap[REF(5)DOT(0).tsdr->number];
/* new_table 9.1 , 2 */
  if ((ch_returncode = che_new_table(DEF(9)DOT(1),QUAL(2),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 10 5.1 */
  if((ch_returncode = cp_table(& ch_val, REF(5)DOT(1).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_table;
/* initget 11 10 , 0,0 */
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(11),DEF(10),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c21:
/* get_or_goto 11 10 , 51 */
  if ((ch_returncode = get_selected_object(DEF(11),DEF(10),sched)) != Normal)
     goto c51;
/* new_record 12 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val; REF(12).tsdr = & dr_record;
/* lookup_at 13 11 =(0) */
  if ( !((ch_t = REF(11).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];
/* initget 14 3.1 , 0,0 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(14),DEF(3)DOT(1),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c26:
/* get_or_err 14 3.1 */
  if ((ch_returncode = get_selected_object(DEF(14),DEF(3)DOT(1)
    ,sched)) != Normal) goto ch_raise_exception;
/* find 15 3.2 13 , 0 */
  if (findfunc(DEF(15),DEF(3)DOT(2),(
          arguments[0] = DEF(13),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* scan_position 16 15 3.2 */
  ch_t = REF(3)DOT(2).value.table;
  (*(ch_t->tbls[ORDER_TBL].des->foreach))
    (ch_t,ORDER_TBL,do_table_position,& ch_ctr,CONT_FOREACH,REF(15).value);
  REF(16).value.integer = (dfd_integer) ch_ctr;
  REF(16).tsdr = & dr_integer;
/* iadd 17 16 =(1) */
  if (!chf_iadd(DEF(17),REF(16).value.integer,1)) goto ch_depletion;
/* position 18 14 */
  ch_frame = get_selector_frame(DEF(14),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(18).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(18).tsdr = &dr_integer;
/* notequal . 17 18 , 26 */
  if ( REF(17).value.integer != REF(18).value.integer ) goto c26;
/* copy 12.0 14.0 */
  if((ch_returncode = (REF(14)DOT(0).tsdr->copy)(& ch_val, REF(14)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(12)DOT(0).tsdr)->finalize)(REF(12)DOT(0).value,F_DISCARD,sched);
  REF(12)DOT(0).value = ch_val;
  REF(12)DOT(0).tsdr = datarepmap[REF(14)DOT(0).tsdr->number];
/* copy 12.1 14.1 */
  if((ch_returncode = cp_table(& ch_val, REF(14)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(12)DOT(1).tsdr)->finalize)(REF(12)DOT(1).value,F_DISCARD,sched);
  REF(12)DOT(1).value = ch_val;
  REF(12)DOT(1).tsdr = & dr_table;
/* copy 19 11 */
  if((ch_returncode = cp_table(& ch_val, REF(11).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(19).tsdr)->finalize)(REF(19).value,F_DISCARD,sched);
  REF(19).value = ch_val;
  REF(19).tsdr = & dr_table;
/* initget 20 19 , 0,0 */
  (*(REF(20).tsdr)->finalize)(REF(20).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(20),DEF(19),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c38:
/* get_or_goto 20 19 , 46 */
  if ((ch_returncode = get_selected_object(DEF(20),DEF(19),sched)) != Normal)
     goto c46;
/* position 21 20 */
  ch_frame = get_selector_frame(DEF(20),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(21).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(21).tsdr = &dr_integer;
/* ile . 21 =(0) , 38 */
  if ( REF(21).value.integer <= 0 ) goto c38;
/* copy 22 20 */
  if((ch_returncode = (REF(20).tsdr->copy)(& ch_val, REF(20).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(22).tsdr)->finalize)(REF(22).value,F_DISCARD,sched);
  REF(22).value = ch_val;
  REF(22).tsdr = datarepmap[REF(20).tsdr->number];
/* insert 12.1 22 */
  if ((ch_returncode = insertfunc(DEF(12)DOT(1),DEF(22),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 38 */
   goto c38;
c46:
/* endget 20 19 */
  end_selector(DEF(20),DEF(19),sched,GET);
/* discard 19 */
  (*(REF(19).tsdr)->finalize)(REF(19).value,F_DISCARD,sched);
  REF(19).tsdr = & dr_bottom;
/* endget 14 3.1 */
  end_selector(DEF(14),DEF(3)DOT(1),sched,GET);
/* insert 9.1 12 */
  if ((ch_returncode = insertfunc(DEF(9)DOT(1),DEF(12),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 21 */
   goto c21;
c51:
/* endget 11 10 */
  end_selector(DEF(11),DEF(10),sched,GET);
/* discard 10 */
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).tsdr = & dr_bottom;
/* insert 3.4 9 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(4),DEF(9),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 5 */
   goto c5;
c55:
/* endget 5 4 */
  end_selector(DEF(5),DEF(4),sched,GET);
/* discard 4 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).tsdr = & dr_bottom;
/* 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);
c60:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
