#include "chdecl.h"
void CH_codegen_cgnew(current, sched, cop)
#define ARGUMENTS 7
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb2;
    case 2: goto c3;
    case 3: goto cb8;
    case 4: goto c9;
    case 5: goto cb13;
    case 6: goto c14;
    case 7: goto c15;
    case 8: goto cb28;
    case 9: goto c29;
    case 10: goto c31;
    case 11: goto c35;
    case 12: goto c49;
    case 13: goto c52;
    case 14: goto c56;
    case 15: goto c59;
    case 16: goto c63;  }
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:
/* new_record 4 , 3 */
  if ((ch_val.record = new_record(3)) == 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;
/* lookup_at 5 3.0.2 =(0) */
  if ( !((ch_t = REF(3)DOT(0)DOT(2).value.table)->size) ) goto ch_notfound;
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(5).value,0);
  REF(5).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 6 5 */
  if((ch_returncode = (REF(5).tsdr->copy)(& ch_val, REF(5).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).value = ch_val;
  REF(6).tsdr = datarepmap[REF(5).tsdr->number];
  current->ip = 3;
cb8:
/* call 3.2.4.4 6 7 , 3 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(4)DOT(4),
          arguments[1] = DEF(6),
          arguments[2] = DEF(7),
          arguments[2+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  return;
c9:
/* insert 4.1 7 */
  if ((ch_returncode = insertfunc(DEF(4)DOT(1),DEF(7),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* lookup_at 8 3.0.2 =(0) */
  if ( !((ch_t = REF(3)DOT(0)DOT(2).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 */
  if((ch_returncode = (REF(8).tsdr->copy)(& ch_val, REF(8).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).value = ch_val;
  REF(9).tsdr = datarepmap[REF(8).tsdr->number];
  current->ip = 5;
cb13:
/* call 3.2.4.6 9 10 , 4 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(4)DOT(6),
          arguments[1] = DEF(9),
          arguments[2] = DEF(10),
          arguments[2+1] = nil,& arguments[0]),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
  return;
c14:
/* call 3.2.3.16 10 11 , 5 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(3)DOT(16),
          arguments[1] = DEF(10),
          arguments[2] = DEF(11),
          arguments[2+1] = nil,& arguments[0]),QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
  return;
c15:
/* noop */
  
/* ord_case 12 11.2 */
  REF(12).value.ord_enum = REF(11)DOT(2).value.variant->info.variant_case;
  REF(12).tsdr = & dr_ord_enumeration;
/* equal . 12 =(7) , 25 */
  if ( REF(12).value.ord_enum == 7 ) goto c25;
/* equal . 12 =(8) , 31 */
  if ( REF(12).value.ord_enum == 8 ) goto c31;
/* equal . 12 =(5) , 35 */
  if ( REF(12).value.ord_enum == 5 ) goto c35;
/* branch , 49 */
   goto c49;
c25:
/* reveal 11.2 , 7 */
  if (7 != REF(11)DOT(2).value.variant->info.variant_case) goto ch_case_error;
/* enum_lit 4.0 , 54 */
  REF(4)DOT(0).value.enumeration = 54;
  REF(4)DOT(0).tsdr = & dr_enumeration;
  current->ip = 8;
cb28:
/* call 3.2.3.11 11.2.0 3.1 3.2 13 , 6 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(3)DOT(11),
          arguments[1] = DEF(11)DOT(2)DOT(0),
          arguments[2] = DEF(3)DOT(1),
          arguments[3] = DEF(3)DOT(2),
          arguments[4] = DEF(13),
          arguments[4+1] = nil,& arguments[0]),QUAL(6),sched)) != Normal)
     goto ch_raise_exception;
  return;
c29:
/* unite 4.2 13 , 12 */
  if ((ch_returncode = che_unite(DEF(4)DOT(2),DEF(13),sched,12)) != Normal)
     goto ch_raise_exception;
/* branch , 52 */
   goto c52;
c31:
/* enum_lit 4.0 , 85 */
  REF(4)DOT(0).value.enumeration = 85;
  REF(4)DOT(0).tsdr = & dr_enumeration;
/* unite 4.2 14 , 0 */
  if ((ch_returncode = che_unite(DEF(4)DOT(2),DEF(14),sched,0)) != Normal)
     goto ch_raise_exception;
/* branch , 52 */
   goto c52;
c35:
/* chs_lit 15 , "program" */
  if( !chs_lit(DEF(15),"program") ) goto ch_depletion;
/* equal 16 11.3 15 */
  REF(16).value.boolean = (eq_table(REF(11)DOT(3).value,REF(15).value));
  REF(16).tsdr = & dr_boolean;
/* discard 15 */
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  REF(15).tsdr = & dr_bottom;
/* branch_false 16 , 43 */
  if ( !REF(16).value.boolean ) goto c43;
/* enum_lit 4.0 , 96 */
  REF(4)DOT(0).value.enumeration = 96;
  REF(4)DOT(0).tsdr = & dr_enumeration;
/* unite 4.2 14 , 0 */
  if ((ch_returncode = che_unite(DEF(4)DOT(2),DEF(14),sched,0)) != Normal)
     goto ch_raise_exception;
/* branch , 52 */
   goto c52;
c43:
/* enum_lit 4.0 , 46 */
  REF(4)DOT(0).value.enumeration = 46;
  REF(4)DOT(0).tsdr = & dr_enumeration;
/* size 17 11.1 */
  REF(17).value.integer = REF(11)DOT(1).value.table->size;
  REF(17).tsdr = & dr_integer;
/* unite 4.2 17 , 2 */
  if ((ch_returncode = che_unite(DEF(4)DOT(2),DEF(17),sched,2)) != Normal)
     goto ch_raise_exception;
/* branch , 52 */
   goto c52;
c49:
/* exit , 7 */
  ch_e = handler_type__exit; ch_val = QUAL(7); goto ch_exception;
c52:
/* insert 3.2.4.3.1 4 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(2)DOT(4)DOT(3)DOT(1),DEF(4)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
/* 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);
/* branch , 59 */
   goto c59;
c56:
/* chs_lit 18 , "CantHappen exit taken in cgnew" */
  if( !chs_lit(DEF(18),"CantHappen exit taken in cgnew") ) goto ch_depletion;
/* print 18 */
  re_print(stderr, 0, DEF(18)); fflush(stderr);
/* discard 18 */
  (*(REF(18).tsdr)->finalize)(REF(18).value,F_DISCARD,sched);
  REF(18).tsdr = & dr_bottom;
c59:
/* discard 3 */
  (*(REF(3).tsdr)->finalize)(REF(3).value,F_DISCARD,sched);
  REF(3).tsdr = & dr_bottom;
/* discard 4 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
c63:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
