#include "chdecl.h"
void CH_typestate_substobject(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 c11;
    case 5: goto c22;
    case 6: goto c27;  }
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.3 , 1 */
  if ((ch_returncode = che_new_table(DEF(3)DOT(3),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 4 3.2 */
  if((ch_returncode = cp_table(& ch_val, REF(3)DOT(2).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 , 22 */
  if ((ch_returncode = get_selected_object(DEF(5),DEF(4),sched)) != Normal)
     goto c22;
/* new_record 6 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).value = ch_val; REF(6).tsdr = & dr_record;
/* copy 6.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(6)DOT(0).tsdr)->finalize)(REF(6)DOT(0).value,F_DISCARD,sched);
  REF(6)DOT(0).value = ch_val;
  REF(6)DOT(0).tsdr = datarepmap[REF(5)DOT(0).tsdr->number];
/* new_table 6.1 , 2 */
  if ((ch_returncode = che_new_table(DEF(6)DOT(1),QUAL(2),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 7 5.1 */
  if((ch_returncode = cp_table(& ch_val, REF(5)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  REF(7).value = ch_val;
  REF(7).tsdr = & dr_table;
/* initget 8 7 , 0,0 */
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(8),DEF(7),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c11:
/* get_or_goto 8 7 , 18 */
  if ((ch_returncode = get_selected_object(DEF(8),DEF(7),sched)) != Normal)
     goto c18;
/* 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 3.1.0 */
  if((ch_returncode = (REF(3)DOT(1)DOT(0).tsdr->copy)(& ch_val, 
    REF(3)DOT(1)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(3)DOT(1)DOT(0).tsdr->number];
/* concat 9.1 3.1.1 8 */
  if ((ch_returncode = che_concat(DEF(9)DOT(1),DEF(3)DOT(1)DOT(1),DEF(8)
    ,sched)) != Normal) goto ch_raise_exception;
/* insert 6.1 9 */
  if ((ch_returncode = insertfunc(DEF(6)DOT(1),DEF(9),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 11 */
   goto c11;
c18:
/* endget 8 7 */
  end_selector(DEF(8),DEF(7),sched,GET);
/* discard 7 */
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  REF(7).tsdr = & dr_bottom;
/* insert 3.3 6 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(3),DEF(6),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 5 */
   goto c5;
c22:
/* 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);
c27:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
