#include "chdecl.h"
void CH_typestate_pomakeinit(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 c7;
    case 4: goto c21;
    case 5: goto c25;  }
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;
/* new_record 4 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).value = ch_val; REF(4).tsdr = & dr_record;
/* new_table 4.1 , 2 */
  if ((ch_returncode = che_new_table(DEF(4)DOT(1),QUAL(2),sched)) != Normal) 
     goto ch_raise_exception;
/* unite 4.0 5 , 0 */
  if ((ch_returncode = che_unite(DEF(4)DOT(0),DEF(5),sched,0)) != Normal)
     goto ch_raise_exception;
/* initget 6 3.5.2 , 0,0 */
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(6),DEF(3)DOT(5)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c7:
/* get_or_err 6 3.5.2 */
  if ((ch_returncode = get_selected_object(DEF(6),DEF(3)DOT(5)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* position 7 6 */
  ch_frame = get_selector_frame(DEF(6),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(7).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(7).tsdr = &dr_integer;
/* lookup_at 8 3.7 =(0) */
  if ( !((ch_t = REF(3)DOT(7).value.table)->size) ) goto ch_notfound;
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(8).value,0);
  REF(8).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 9 8 */
  REF(9) = REF(8);
/* notequal . 7 9 , 7 */
  if ( REF(7).value.integer != REF(9).value.integer ) goto c7;
/* copy 10 6 */
  if((ch_returncode = (REF(6).tsdr->copy)(& ch_val, REF(6).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).value = ch_val;
  REF(10).tsdr = datarepmap[REF(6).tsdr->number];
/* endget 6 3.5.2 */
  end_selector(DEF(6),DEF(3)DOT(5)DOT(2),sched,GET);
/* insert 4.1 10 */
  if ((ch_returncode = insertfunc(DEF(4)DOT(1),DEF(10),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* insert 3.8.0 4 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(8)DOT(0),DEF(4)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* endblock */
  che_endblock(sched);
c21:
/* 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);
c25:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
