#include "chdecl.h"
void CH_codegen(current, sched, cop)
#define ARGUMENTS 7
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto cb16;
    case 4: goto c17;
    case 5: goto c23;
    case 6: goto cb23;
    case 7: goto c24;
    case 8: goto c25;
    case 9: goto c28;
    case 10: goto c30;
    case 11: goto c32;
    case 12: goto c34;  }
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_record 4 , 7 */
  if ((ch_val.record = new_record(7)) == 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_record 4.0 , 3 */
  if ((ch_val.record = new_record(3)) == nil) goto ch_depletion;
  (*(REF(4)DOT(0).tsdr)->finalize)(REF(4)DOT(0).value,F_DISCARD,sched);
  REF(4)DOT(0).value = ch_val; REF(4)DOT(0).tsdr = & dr_record;
/* copy 4.0.0 3.0.0 */
  if((ch_returncode = (REF(3)DOT(0)DOT(0).tsdr->copy)(& ch_val, 
    REF(3)DOT(0)DOT(0).value)) != Normal) goto ch_raise_exception;
  (*(REF(4)DOT(0)DOT(0).tsdr)->finalize)(REF(4)DOT(0)DOT(0).value
    ,F_DISCARD,sched);
  REF(4)DOT(0)DOT(0).value = ch_val;
  REF(4)DOT(0)DOT(0).tsdr = datarepmap[REF(3)DOT(0)DOT(0).tsdr->number];
/* copy 4.0.1 3.0.1 */
  if((ch_returncode = (REF(3)DOT(0)DOT(1).tsdr->copy)(& ch_val, 
    REF(3)DOT(0)DOT(1).value)) != Normal) goto ch_raise_exception;
  (*(REF(4)DOT(0)DOT(1).tsdr)->finalize)(REF(4)DOT(0)DOT(1).value
    ,F_DISCARD,sched);
  REF(4)DOT(0)DOT(1).value = ch_val;
  REF(4)DOT(0)DOT(1).tsdr = datarepmap[REF(3)DOT(0)DOT(1).tsdr->number];
/* copy 4.0.2 3.1 */
  if((ch_returncode = (REF(3)DOT(1).tsdr->copy)(& ch_val, REF(3)DOT(1).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(4)DOT(0)DOT(2).tsdr)->finalize)(REF(4)DOT(0)DOT(2).value
    ,F_DISCARD,sched);
  REF(4)DOT(0)DOT(2).value = ch_val;
  REF(4)DOT(0)DOT(2).tsdr = datarepmap[REF(3)DOT(1).tsdr->number];
/* copy 4.1 3.2 */
  if((ch_returncode = (REF(3)DOT(2).tsdr->copy)(& ch_val, REF(3)DOT(2).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(4)DOT(1).tsdr)->finalize)(REF(4)DOT(1).value,F_DISCARD,sched);
  REF(4)DOT(1).value = ch_val;
  REF(4)DOT(1).tsdr = datarepmap[REF(3)DOT(2).tsdr->number];
/* prog_lit 5 , 1 */
  if ((ch_returncode = che_prog_lit(DEF(5),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* create 6 5 , 2 */
  if ((ch_returncode = che_create(DEF(6),DEF(5),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* discard 5 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).tsdr = & dr_bottom;
/* move 7 6 */
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  REF(7) = REF(6);
  REF(6).tsdr = & dr_bottom;
/* prog_lit 8 , 3 */
  if ((ch_returncode = che_prog_lit(DEF(8),QUAL(3),sched)) != Normal) 
     goto ch_raise_exception;
/* procedure 9 8 , 4 */
  if ((ch_returncode = che_procedure(DEF(9),DEF(8),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
/* discard 8 */
  (*(REF(8).tsdr)->finalize)(REF(8).value,F_DISCARD,sched);
  REF(8).tsdr = & dr_bottom;
/* move 10 9 */
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10) = REF(9);
  REF(9).tsdr = & dr_bottom;
  current->ip = 3;
cb16:
/* call 7 3.3 3.4 11 4 , 5 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(7),
          arguments[1] = DEF(3)DOT(3),
          arguments[2] = DEF(3)DOT(4),
          arguments[3] = DEF(11),
          arguments[4] = DEF(4),
          arguments[4+1] = nil,& arguments[0]),QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
  return;
c17:
/* new_inport 12 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val; REF(12).tsdr = & dr_inport;
/* connect 3.5 12 */
  if (REF(12).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(5).tsdr)->finalize)(REF(3)DOT(5).value,F_DISCARD,sched);
  REF(12).value.inport->refcount++;
  REF(3)DOT(5).value.outport = REF(12).value.inport;
  REF(3)DOT(5).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;
/* block , 6 */
  if((ch_returncode = che_block(QUAL(6),sched)) != Normal)
     goto ch_raise_exception;
c21:
/* noop */
  
c23:
  current->ip = 6;
cb23:
/* receive 13 12 */
  if ((ch_returncode = che_receive(DEF(13),DEF(12),sched)) != Normal)
     goto ch_raise_exception;
  return;
c24:
/* call 10 13.0 4 14 , 7 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(10),
          arguments[1] = DEF(13)DOT(0),
          arguments[2] = DEF(4),
          arguments[3] = DEF(14),
          arguments[3+1] = nil,& arguments[0]),QUAL(7),sched)) != Normal)
     goto ch_raise_exception;
  return;
c25:
/* move 13.1 14 */
  (*(REF(13)DOT(1).tsdr)->finalize)(REF(13)DOT(1).value,F_DISCARD,sched);
  REF(13)DOT(1) = REF(14);
  REF(14).tsdr = & dr_bottom;
/* return 13 */
  if (ch_caller = do_return(REF(13).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(13).value);
  REF(13).tsdr = & dr_bottom;
/* branch , 21 */
   goto c21;
c28:
/* endblock */
  che_endblock(sched);
/* branch , 32 */
   goto c32;
c30:
/* discard 13 */
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  REF(13).tsdr = & dr_bottom;
/* send 11 15 */
  if ((ch_returncode = che_send(DEF(11),DEF(15),sched)) != Normal)
     goto ch_raise_exception;
c32:
/* endblock */
  che_endblock(sched);
c34:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
