#include "chdecl.h"
void CH_typestate_softcoerce(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 c12;
    case 5: goto c57;
    case 6: goto c70;
    case 7: goto c80;
    case 8: goto c83;
    case 9: goto c98;
    case 10: goto c101;
    case 11: goto c107;
    case 12: goto c109;
    case 13: goto c112;  }
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.5 , 1 */
  if ((ch_returncode = che_new_table(DEF(3)DOT(5),QUAL(1),sched)) != Normal) 
     goto ch_raise_exception;
/* ilit 4 , 0 */
  REF(4).value.integer = 0;
  REF(4).tsdr = & dr_integer;
c5:
/* size 5 3.4 */
  REF(5).value.integer = REF(3)DOT(4).value.table->size;
  REF(5).tsdr = & dr_integer;
/* ile . 5 =(0) , 109 */
  if ( REF(5).value.integer <= 0 ) goto c109;
/* block , 2 */
  if((ch_returncode = che_block(QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* privatize 3.4 */
  if (REF(3)DOT(4).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(3)DOT(4))) != Normal)
       goto ch_raise_exception;
/* initget 6 3.4 , 0,0 */
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(6),DEF(3)DOT(4),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c12:
/* get_or_err 6 3.4 */
  if ((ch_returncode = get_selected_object(DEF(6),DEF(3)DOT(4)
    ,sched)) != Normal) goto ch_raise_exception;
/* lookup_at 7 6.1 =(0) */
  if ( !((ch_t = REF(6)DOT(1).value.table)->size) ) goto ch_notfound;
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(7).value,0);
  REF(7).tsdr = qdatarepmap[ch_t->tsdr->number];
/* size 8 7.1 */
  REF(8).value.integer = REF(7)DOT(1).value.table->size;
  REF(8).tsdr = & dr_integer;
/* imultiply 9 =(2) 8 */
  if (!chf_imultiply(DEF(9),2,REF(8).value.integer)) goto ch_depletion;
/* case 10 6.0 */
  REF(10).value.enumeration = REF(6)DOT(0).value.variant->info.variant_case;
  REF(10).tsdr = & dr_enumeration;
/* notequal . 10 =(1) , 26 */
  if ( REF(10).value.enumeration != 1 ) goto c26;
/* iadd 9 9 =(1) */
  if (!chf_iadd(DEF(9),REF(9).value.integer,1)) goto ch_depletion;
c26:
/* notequal . 9 4 , 12 */
  if ( REF(9).value.integer != REF(4).value.integer ) goto c12;
/* remove 11 6 3.4 */
  if ((ch_returncode = che_remove(DEF(11),DEF(6),DEF(3)DOT(4)
    ,sched)) != Normal) goto ch_raise_exception;
/* endget 6 3.4 */
  end_selector(DEF(6),DEF(3)DOT(4),sched,GET);
/* new_record 12 , 5 */
  if ((ch_val.record = new_record(5)) == nil) goto ch_depletion;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val; REF(12).tsdr = & dr_record;
/* block , 3 */
  if((ch_returncode = che_block(QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
/* case 13 11.0 */
  REF(13).value.enumeration = REF(11)DOT(0).value.variant->info.variant_case;
  REF(13).tsdr = & dr_enumeration;
/* equal . 13 =(1) , 39 */
  if ( REF(13).value.enumeration == 1 ) goto c39;
/* equal . 13 =(0) , 46 */
  if ( REF(13).value.enumeration == 0 ) goto c46;
/* branch , 54 */
   goto c54;
c39:
/* ordenum_lit 12.1 , 30 */
  REF(12)DOT(1).value.ord_enum = 30;
  REF(12)DOT(1).tsdr = & dr_ord_enumeration;
/* privatize 11.1 */
  if (REF(11)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(11)DOT(1))) != Normal)
       goto ch_raise_exception;
/* lookup_at 14 11.1 =(0) */
  if ( !((ch_t = REF(11)DOT(1).value.table)->size) ) goto ch_notfound;
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(14).value,0);
  REF(14).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 15 11.1 =(0) */
  if ((ch_returncode = remove_at_func(DEF(15),DEF(11)DOT(1),0)) != Normal)
     goto ch_raise_exception;
/* branch , 55 */
   goto c55;
c46:
/* ordenum_lit 12.1 , 14 */
  REF(12)DOT(1).value.ord_enum = 14;
  REF(12)DOT(1).tsdr = & dr_ord_enumeration;
/* privatize 11.1 */
  if (REF(11)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(11)DOT(1))) != Normal)
       goto ch_raise_exception;
/* initget 16 11.1 , 0,0 */
  (*(REF(16).tsdr)->finalize)(REF(16).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(16),DEF(11)DOT(1),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
/* get_or_err 16 11.1 */
  if ((ch_returncode = get_selected_object(DEF(16),DEF(11)DOT(1)
    ,sched)) != Normal) goto ch_raise_exception;
/* remove 15 16 11.1 */
  if ((ch_returncode = che_remove(DEF(15),DEF(16),DEF(11)DOT(1)
    ,sched)) != Normal) goto ch_raise_exception;
/* endget 16 11.1 */
  end_selector(DEF(16),DEF(11)DOT(1),sched,GET);
/* branch , 55 */
   goto c55;
c54:
/* exit , 4 */
  ch_e = handler_type__exit; ch_val = QUAL(4); goto ch_exception;
c55:
/* boolean 17 , FALSE */
  REF(17).value.boolean = FALSE;
  REF(17).tsdr = & dr_boolean;
/* initget 18 3.5 , 0,0 */
  (*(REF(18).tsdr)->finalize)(REF(18).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(18),DEF(3)DOT(5),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c57:
/* get_or_goto 18 3.5 , 83 */
  if ((ch_returncode = get_selected_object(DEF(18),DEF(3)DOT(5)
    ,sched)) != Normal) goto c83;
/* initget 19 18.2 , 0,0 */
  (*(REF(19).tsdr)->finalize)(REF(19).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(19),DEF(18)DOT(2),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
/* get_or_err 19 18.2 */
  if ((ch_returncode = get_selected_object(DEF(19),DEF(18)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* size 20 19.1 */
  REF(20).value.integer = REF(19)DOT(1).value.table->size;
  REF(20).tsdr = & dr_integer;
/* size 21 15.1 */
  REF(21).value.integer = REF(15)DOT(1).value.table->size;
  REF(21).tsdr = & dr_integer;
/* ile 22 20 21 */
  REF(22).value.boolean = (REF(20).value.integer <= REF(21).value.integer);
/* branch_false 22 , 80 */
  if ( !REF(22).value.boolean ) goto c80;
/* equal 22 19.0 15.0 */
  REF(22).value.boolean = ((REF(19)DOT(0).tsdr->equal)(REF(19)DOT(0).value,
    REF(15)DOT(0).value));
  REF(22).tsdr = & dr_boolean;
/* branch_false 22 , 80 */
  if ( !REF(22).value.boolean ) goto c80;
/* boolean 23 , TRUE */
  REF(23).value.boolean = TRUE;
  REF(23).tsdr = & dr_boolean;
/* initget 24 19.1 , 0,0 */
  (*(REF(24).tsdr)->finalize)(REF(24).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(24),DEF(19)DOT(1),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c70:
/* get_or_goto 24 19.1 , 78 */
  if ((ch_returncode = get_selected_object(DEF(24),DEF(19)DOT(1)
    ,sched)) != Normal) goto c78;
/* position 25 24 */
  ch_frame = get_selector_frame(DEF(24),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(25).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(25).tsdr = &dr_integer;
/* lookup_at 26 15.1 25 */
  if((ch_i = REF(25).value.integer) < 0 || ch_i >= (ch_t = REF(15)DOT(1).value
    .table)->size) goto ch_notfound;
  (*(REF(26).tsdr)->finalize)(REF(26).value,F_DISCARD,sched);
  (*(ch_t->tbls[ORDER_TBL].des->lookup_at))
    (ch_t, ORDER_TBL, & REF(26).value,ch_i);
  REF(26).tsdr = qdatarepmap[ch_t->tsdr->number];
/* copy 27 26 */
  if((ch_returncode = (REF(26).tsdr->copy)(& ch_val, REF(26).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(27).tsdr)->finalize)(REF(27).value,F_DISCARD,sched);
  REF(27).value = ch_val;
  REF(27).tsdr = datarepmap[REF(26).tsdr->number];
/* equal 28 24 27 */
  REF(28).value.boolean = ((REF(24).tsdr->equal)(REF(24).value,REF(27).value)
    );
  REF(28).tsdr = & dr_boolean;
/* discard 27 */
  (*(REF(27).tsdr)->finalize)(REF(27).value,F_DISCARD,sched);
  REF(27).tsdr = & dr_bottom;
/* branch_true 28 , 70 */
  if ( REF(28).value.boolean ) goto c70;
/* boolean 23 , FALSE */
  REF(23).value.boolean = FALSE;
  REF(23).tsdr = & dr_boolean;
c78:
/* endget 24 19.1 */
  end_selector(DEF(24),DEF(19)DOT(1),sched,GET);
/* move 22 23 */
  REF(22) = REF(23);
  REF(23).tsdr = & dr_bottom;
c80:
/* endget 19 18.2 */
  end_selector(DEF(19),DEF(18)DOT(2),sched,GET);
/* branch_false 22 , 57 */
  if ( !REF(22).value.boolean ) goto c57;
/* boolean 17 , TRUE */
  REF(17).value.boolean = TRUE;
  REF(17).tsdr = & dr_boolean;
c83:
/* endget 18 3.5 */
  end_selector(DEF(18),DEF(3)DOT(5),sched,GET);
/* branch_false 17 , 87 */
  if ( !REF(17).value.boolean ) goto c87;
/* discard 15 */
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  REF(15).tsdr = & dr_bottom;
/* branch , 95 */
   goto c95;
c87:
/* new_table 12.2 , 5 */
  if ((ch_returncode = che_new_table(DEF(12)DOT(2),QUAL(5),sched)) != Normal) 
     goto ch_raise_exception;
/* insert 12.2 15 */
  if ((ch_returncode = insertfunc(DEF(12)DOT(2),DEF(15),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* unique 12.0 */
  if ((ch_returncode = che_unique(DEF(12)DOT(0),sched)) != Normal)
     goto ch_raise_exception;
/* unite 12.3 29 , 0 */
  if ((ch_returncode = che_unite(DEF(12)DOT(3),DEF(29),sched,0)) != Normal)
     goto ch_raise_exception;
/* new_table 12.4 , 6 */
  if ((ch_returncode = che_new_table(DEF(12)DOT(4),QUAL(6),sched)) != Normal) 
     goto ch_raise_exception;
/* insert 3.5 12 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(5),DEF(12),FALSE,0)) != Normal)
     goto ch_raise_exception;
c95:
/* discard 12 */
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
c98:
/* discard 12 */
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 107 */
   goto c107;
c101:
/* discard 11 */
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).tsdr = & dr_bottom;
/* discard 12 */
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).tsdr = & dr_bottom;
/* discard 15 */
  (*(REF(15).tsdr)->finalize)(REF(15).value,F_DISCARD,sched);
  REF(15).tsdr = & dr_bottom;
/* iadd 4 4 =(1) */
  if (!chf_iadd(DEF(4),REF(4).value.integer,1)) goto ch_depletion;
c107:
/* discard 11 */
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).tsdr = & dr_bottom;
/* branch , 5 */
   goto c5;
c109:
/* 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);
c112:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
