#include "chdecl.h"
void CH_typestate_beginaltern(current, sched, cop)
#define ARGUMENTS 10
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c14;
    case 4: goto cb14;
    case 6: goto c16;
    case 7: goto cb17;
    case 8: goto c18;
    case 9: goto cb23;
    case 10: goto c24;
    case 11: goto c29;
    case 12: goto c30;
    case 13: goto cb34;
    case 14: goto c35;
    case 15: goto cb40;
    case 16: goto c41;
    case 17: goto c43;
    case 18: goto cb44;
    case 19: goto c45;
    case 20: goto c46;
    case 21: goto cb50;
    case 22: goto c51;
    case 23: goto c55;
    case 24: goto c56;
    case 5: goto c58;
    case 25: goto c58;
    case 26: goto c60;
    case 27: goto c62;
    case 28: goto c64;  }
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_inport 4 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).value = ch_val; REF(4).tsdr = & dr_inport;
/* 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;
/* 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.1 4 */
  if (REF(4).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(1).tsdr)->finalize)(REF(3)DOT(1).value,F_DISCARD,sched);
  REF(4).value.inport->refcount++;
  REF(3)DOT(1).value.outport = REF(4).value.inport;
  REF(3)DOT(1).tsdr = & dr_outport;
/* connect 3.2 5 */
  if (REF(5).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(2).tsdr)->finalize)(REF(3)DOT(2).value,F_DISCARD,sched);
  REF(5).value.inport->refcount++;
  REF(3)DOT(2).value.outport = REF(5).value.inport;
  REF(3)DOT(2).tsdr = & dr_outport;
/* connect 3.3 6 */
  if (REF(6).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(3).tsdr)->finalize)(REF(3)DOT(3).value,F_DISCARD,sched);
  REF(6).value.inport->refcount++;
  REF(3)DOT(3).value.outport = REF(6).value.inport;
  REF(3)DOT(3).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 , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
/* unite 7 8 , 1 */
  if ((ch_returncode = che_unite(DEF(7),DEF(8),sched,1)) != Normal)
     goto ch_raise_exception;
c12:
/* noop */
  
c14:
  current->ip = 4;
cb14:
/* select 5 * 6 * 4 * , 2 */
  if ((ch_returncode = che_select((
          arguments[0] = DEF(5),
          arguments[1] = NO_OBJECT,
          arguments[2] = DEF(6),
          arguments[3] = NO_OBJECT,
          arguments[4] = DEF(4),
          arguments[5] = NO_OBJECT,
          arguments[5+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  if (current->ip == 4) return; else COMPUTE_TARGET;
c16:
/* block , 3 */
  if((ch_returncode = che_block(QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 7;
cb17:
/* receive 9 5 */
  if ((ch_returncode = che_receive(DEF(9),DEF(5),sched)) != Normal)
     goto ch_raise_exception;
  return;
c18:
/* reveal 7 , 0 */
  if (0 != REF(7).value.variant->info.variant_case) goto ch_case_error;
/* copy 10 7.0 */
  if((ch_returncode = (REF(7)DOT(0).tsdr->copy)(& ch_val, REF(7)DOT(0).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(7)DOT(0).tsdr->number];
/* move 9.5 10.0 */
  (*(REF(9)DOT(5).tsdr)->finalize)(REF(9)DOT(5).value,F_DISCARD,sched);
  REF(9)DOT(5) = REF(10)DOT(0);
  REF(10)DOT(0).tsdr = & dr_bottom;
/* new_record 11 , 2 */
  if ((ch_val.record = new_record(2)) == nil) goto ch_depletion;
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).value = ch_val; REF(11).tsdr = & dr_record;
/* copy 11.0 9.4 */
  if((ch_returncode = (REF(9)DOT(4).tsdr->copy)(& ch_val, REF(9)DOT(4).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(11)DOT(0).tsdr)->finalize)(REF(11)DOT(0).value,F_DISCARD,sched);
  REF(11)DOT(0).value = ch_val;
  REF(11)DOT(0).tsdr = datarepmap[REF(9)DOT(4).tsdr->number];
  current->ip = 9;
cb23:
/* call 9.0.9 9.0 9.1.0 9.3 9.2 10.1 12 , 4 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(9)DOT(0)DOT(9),
          arguments[1] = DEF(9)DOT(0),
          arguments[2] = DEF(9)DOT(1)DOT(0),
          arguments[3] = DEF(9)DOT(3),
          arguments[4] = DEF(9)DOT(2),
          arguments[5] = DEF(10)DOT(1),
          arguments[6] = DEF(12),
          arguments[6+1] = nil,& arguments[0]),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c24:
/* move 11.1 12 */
  (*(REF(11)DOT(1).tsdr)->finalize)(REF(11)DOT(1).value,F_DISCARD,sched);
  REF(11)DOT(1) = REF(12);
  REF(12).tsdr = & dr_bottom;
/* insert 9.3.8 11 */
  if ((ch_returncode = insertfunc(DEF(9)DOT(3)DOT(8),DEF(11)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* return 9 */
  if (ch_caller = do_return(REF(9).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(9).value);
  REF(9).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 30 */
   goto c30;
c29:
/* return_exception 9 , 5 */
  if (ch_caller = do_return(REF(9).value)) {
    raise_user(QUAL(5),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(9),QUAL(5));
  REF(9).tsdr = & dr_bottom;
c30:
/* discard 10 */
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).tsdr = & dr_bottom;
/* exit , 6 */
  ch_e = handler_type__exit; ch_val = QUAL(6); goto ch_exception;
c34:
  current->ip = 13;
cb34:
/* receive 13 6 */
  if ((ch_returncode = che_receive(DEF(13),DEF(6),sched)) != Normal)
     goto ch_raise_exception;
  return;
c35:
/* copy 14 13.3 */
  if((ch_returncode = (REF(13)DOT(3).tsdr->copy)(& ch_val, REF(13)DOT(3).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).value = ch_val;
  REF(14).tsdr = datarepmap[REF(13)DOT(3).tsdr->number];
/* size 15 13.4.0 */
  REF(15).value.integer = REF(13)DOT(4)DOT(0).value.table->size;
  REF(15).tsdr = & dr_integer;
/* copy 16 15 */
  REF(16) = REF(15);
/* isubtract 17 16 =(1) */
  if (!chf_isubtract(DEF(17),REF(16).value.integer,1)) goto ch_depletion;
  current->ip = 15;
cb40:
/* call 13.0.8 13.0 13.1.0 13.4 13.2 14 17 7 , 7 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(13)DOT(0)DOT(8),
          arguments[1] = DEF(13)DOT(0),
          arguments[2] = DEF(13)DOT(1)DOT(0),
          arguments[3] = DEF(13)DOT(4),
          arguments[4] = DEF(13)DOT(2),
          arguments[5] = DEF(14),
          arguments[6] = DEF(17),
          arguments[7] = DEF(7),
          arguments[7+1] = nil,& arguments[0]),QUAL(7),sched)) != Normal)
     goto ch_raise_exception;
  return;
c41:
/* 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 , 58 */
   goto c58;
c43:
/* block , 8 */
  if((ch_returncode = che_block(QUAL(8),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 18;
cb44:
/* receive 18 4 */
  if ((ch_returncode = che_receive(DEF(18),DEF(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c45:
/* call 18.0.0 18.0 18.1 18.2 18.3 18.4 19 18.5 , 9 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(18)DOT(0)DOT(0),
          arguments[1] = DEF(18)DOT(0),
          arguments[2] = DEF(18)DOT(1),
          arguments[3] = DEF(18)DOT(2),
          arguments[4] = DEF(18)DOT(3),
          arguments[5] = DEF(18)DOT(4),
          arguments[6] = DEF(19),
          arguments[7] = DEF(18)DOT(5),
          arguments[7+1] = nil,& arguments[0]),QUAL(9),sched)) != Normal)
     goto ch_raise_exception;
  return;
c46:
/* size 20 18.5.0 */
  REF(20).value.integer = REF(18)DOT(5)DOT(0).value.table->size;
  REF(20).tsdr = & dr_integer;
/* copy 21 20 */
  REF(21) = REF(20);
/* isubtract 22 21 =(1) */
  if (!chf_isubtract(DEF(22),REF(21).value.integer,1)) goto ch_depletion;
  current->ip = 21;
cb50:
/* call 18.0.8 18.0 18.1.0 18.5 18.2 19 22 7 , 7 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(18)DOT(0)DOT(8),
          arguments[1] = DEF(18)DOT(0),
          arguments[2] = DEF(18)DOT(1)DOT(0),
          arguments[3] = DEF(18)DOT(5),
          arguments[4] = DEF(18)DOT(2),
          arguments[5] = DEF(19),
          arguments[6] = DEF(22),
          arguments[7] = DEF(7),
          arguments[7+1] = nil,& arguments[0]),QUAL(7),sched)) != Normal)
     goto ch_raise_exception;
  return;
c51:
/* return 18 */
  if (ch_caller = do_return(REF(18).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(18).value);
  REF(18).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 56 */
   goto c56;
c55:
/* return 18 */
  if (ch_caller = do_return(REF(18).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(18).value);
  REF(18).tsdr = & dr_bottom;
c56:
/* discard 19 */
  (*(REF(19).tsdr)->finalize)(REF(19).value,F_DISCARD,sched);
  REF(19).tsdr = & dr_bottom;
c15:
c58:
/* discard 14 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).tsdr = & dr_bottom;
/* branch , 12 */
   goto c12;
c60:
/* endblock */
  che_endblock(sched);
c62:
/* endblock */
  che_endblock(sched);
c64:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
