#include "chdecl.h"
void CH_codegen_typedef(current, sched, cop)
#define ARGUMENTS 6
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb2;
    case 2: goto c3;
    case 3: goto c11;
    case 4: goto cb11;
    case 6: goto c13;
    case 7: goto cb15;
    case 8: goto c16;
    case 5: goto c22;
    case 9: goto c22;
    case 10: goto c24;
    case 11: goto c27;
    case 12: goto c30;
    case 13: goto c32;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 1;
cb2:
/* receive 3 0 */
  if ((ch_returncode = che_receive(DEF(3),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c3:
/* copy 4 3.0.0 */
  if((ch_returncode = cp_table(& ch_val, REF(3)DOT(0)DOT(0).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;
/* new_inport 5 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).value = ch_val; REF(5).tsdr = & dr_inport;
/* connect 3.1 5 */
  if (REF(5).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(1).tsdr)->finalize)(REF(3)DOT(1).value,F_DISCARD,sched);
  REF(5).value.inport->refcount++;
  REF(3)DOT(1).value.outport = REF(5).value.inport;
  REF(3)DOT(1).tsdr = & dr_outport;
/* new_inport 6 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).value = ch_val; REF(6).tsdr = & dr_inport;
/* connect 3.2 6 */
  if (REF(6).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(2).tsdr)->finalize)(REF(3)DOT(2).value,F_DISCARD,sched);
  REF(6).value.inport->refcount++;
  REF(3)DOT(2).value.outport = REF(6).value.inport;
  REF(3)DOT(2).tsdr = & dr_outport;
/* 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;
c9:
/* noop */
  
c11:
  current->ip = 4;
cb11:
/* select 6 * 5 * , 2 */
  if ((ch_returncode = che_select((
          arguments[0] = DEF(6),
          arguments[1] = NO_OBJECT,
          arguments[2] = DEF(5),
          arguments[3] = NO_OBJECT,
          arguments[3+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  if (current->ip == 4) return; else COMPUTE_TARGET;
c13:
/* exit , 3 */
  ch_e = handler_type__exit; ch_val = QUAL(3); goto ch_exception;
c15:
  current->ip = 7;
cb15:
/* receive 7 5 */
  if ((ch_returncode = che_receive(DEF(7),DEF(5),sched)) != Normal)
     goto ch_raise_exception;
  return;
c16:
/* find 8 4 7.0.0 , 0 */
  if (findfunc(DEF(8),DEF(4),(
          arguments[0] = DEF(7)DOT(0)DOT(0),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* find 9 8.1 7.0.1 , 0 */
  if (findfunc(DEF(9),DEF(8)DOT(1),(
          arguments[0] = DEF(7)DOT(0)DOT(1),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* copy 7.1 9 */
  if((ch_returncode = (REF(9).tsdr->copy)(& ch_val, REF(9).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(7)DOT(1).tsdr)->finalize)(REF(7)DOT(1).value,F_DISCARD,sched);
  REF(7)DOT(1).value = ch_val;
  REF(7)DOT(1).tsdr = datarepmap[REF(9).tsdr->number];
/* return 7 */
  if (ch_caller = do_return(REF(7).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(7).value);
  REF(7).tsdr = & dr_bottom;
/* branch , 9 */
   goto c9;
c12:
c22:
/* exit , 4 */
  ch_e = handler_type__exit; ch_val = QUAL(4); goto ch_exception;
c24:
/* endblock */
  che_endblock(sched);
/* branch , 30 */
   goto c30;
c27:
/* chs_lit 10 , "CantHappen exit taken in typedef" */
  if( !chs_lit(DEF(10),"CantHappen exit taken in typedef") )
     goto ch_depletion;
/* print 10 */
  re_print(stderr, 0, DEF(10)); fflush(stderr);
/* discard 10 */
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).tsdr = & dr_bottom;
c30:
/* endblock */
  che_endblock(sched);
c32:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
