#include "chdecl.h"
void CH_typestate_prepos(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 c3;
    case 4: goto c12;
    case 5: goto c35;  }
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:
/* initget 4 3.4.2 , 0,0 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(4),DEF(3)DOT(4)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c3:
/* get_or_err 4 3.4.2 */
  if ((ch_returncode = get_selected_object(DEF(4),DEF(3)DOT(4)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* position 5 4 */
  ch_frame = get_selector_frame(DEF(4),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(5).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(5).tsdr = &dr_integer;
/* lookup_at 6 3.7 =(0) */
  if ( !((ch_t = REF(3)DOT(7).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);
/* notequal . 5 7 , 3 */
  if ( REF(5).value.integer != REF(7).value.integer ) goto c3;
/* boolean 8 , FALSE */
  REF(8).value.boolean = FALSE;
  REF(8).tsdr = & dr_boolean;
/* initget 9 3.3.5 , 0,0 */
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(9),DEF(3)DOT(3)DOT(5),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c12:
/* get_or_goto 9 3.3.5 , 16 */
  if ((ch_returncode = get_selected_object(DEF(9),DEF(3)DOT(3)DOT(5)
    ,sched)) != Normal) goto c16;
/* notequal . 9 4.0 , 12 */
  if ( !(REF(9).tsdr->equal)(REF(9).value,REF(4)DOT(0).value) ) goto c12;
/* boolean 8 , TRUE */
  REF(8).value.boolean = TRUE;
  REF(8).tsdr = & dr_boolean;
c16:
/* endget 9 3.3.5 */
  end_selector(DEF(9),DEF(3)DOT(3)DOT(5),sched,GET);
/* branch_false 8 , 19 */
  if ( !REF(8).value.boolean ) goto c19;
/* branch , 31 */
   goto c31;
c19:
/* new_record 10 , 3 */
  if ((ch_val.record = new_record(3)) == nil) goto ch_depletion;
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).value = ch_val; REF(10).tsdr = & dr_record;
/* copy 11 3.5 */
  if((ch_returncode = (REF(3)DOT(5).tsdr->copy)(& ch_val, REF(3)DOT(5).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).value = ch_val;
  REF(11).tsdr = datarepmap[REF(3)DOT(5).tsdr->number];
/* unite 10.0 11 , 0 */
  if ((ch_returncode = che_unite(DEF(10)DOT(0),DEF(11),sched,0)) != Normal)
     goto ch_raise_exception;
/* ordenum_lit 10.1 , 15 */
  REF(10)DOT(1).value.ord_enum = 15;
  REF(10)DOT(1).tsdr = & dr_ord_enumeration;
/* new_table 10.2 , 1 */
  if ((ch_returncode = che_new_table(DEF(10)DOT(2),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 12 4 */
  if((ch_returncode = (REF(4).tsdr->copy)(& ch_val, REF(4).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val;
  REF(12).tsdr = datarepmap[REF(4).tsdr->number];
/* unite 13 12 , 0 */
  if ((ch_returncode = che_unite(DEF(13),DEF(12),sched,0)) != Normal)
     goto ch_raise_exception;
/* insert 10.2 13 */
  if ((ch_returncode = insertfunc(DEF(10)DOT(2),DEF(13),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* insert 3.3.11 10 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(3)DOT(11),DEF(10)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
c31:
/* endget 4 3.4.2 */
  end_selector(DEF(4),DEF(3)DOT(4)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);
c35:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
