#include "chdecl.h"
void CH_typestate_checkvar(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 c21;
    case 5: goto c31;
    case 6: goto c33;
    case 7: goto c40;
    case 8: goto c42;
    case 9: goto c44;
    case 10: goto c65;
    case 11: goto c78;
    case 12: goto c82;  }
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:
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
/* boolean 4 , FALSE */
  REF(4).value.boolean = FALSE;
  REF(4).tsdr = & dr_boolean;
/* initget 5 3.3.3 , 0,0 */
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(5),DEF(3)DOT(3)DOT(3),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c5:
/* get_or_goto 5 3.3.3 , 9 */
  if ((ch_returncode = get_selected_object(DEF(5),DEF(3)DOT(3)DOT(3)
    ,sched)) != Normal) goto c9;
/* notequal . 5 3.4.0 , 5 */
  if ( !(REF(5).tsdr->equal)(REF(5).value,REF(3)DOT(4)DOT(0).value) ) goto c5;
/* boolean 4 , TRUE */
  REF(4).value.boolean = TRUE;
  REF(4).tsdr = & dr_boolean;
c9:
/* endget 5 3.3.3 */
  end_selector(DEF(5),DEF(3)DOT(3)DOT(3),sched,GET);
/* branch_false 4 , 12 */
  if ( !REF(4).value.boolean ) goto c12;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c12:
/* block , 3 */
  if((ch_returncode = che_block(QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
/* size 6 3.3.1 */
  REF(6).value.integer = REF(3)DOT(3)DOT(1).value.table->size;
  REF(6).tsdr = & dr_integer;
/* isubtract 7 6 =(1) */
  if (!chf_isubtract(DEF(7),REF(6).value.integer,1)) goto ch_depletion;
/* lookup_at 8 3.3.1 7 */
  if((ch_i = REF(7).value.integer) < 0 || ch_i >= (ch_t = 
    REF(3)DOT(3)DOT(1).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,ch_i);
  REF(8).tsdr = qdatarepmap[ch_t->tsdr->number];
/* notequal . 3.4.0 8.1 , 20 */
  if ( !(REF(3)DOT(4)DOT(0).tsdr->equal)(REF(3)DOT(4)DOT(0).value,
    REF(8)DOT(1).value) ) goto c20;
/* branch , 31 */
   goto c31;
c20:
/* initget 9 3.3.0 , 0,0 */
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(9),DEF(3)DOT(3)DOT(0),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c21:
/* get_or_err 9 3.3.0 */
  if ((ch_returncode = get_selected_object(DEF(9),DEF(3)DOT(3)DOT(0)
    ,sched)) != Normal) goto ch_raise_exception;
/* notequal . 9 3.4.0.0 , 21 */
  if ( !(REF(9).tsdr->equal)(REF(9).value,REF(3)DOT(4)DOT(0)DOT(0).value) )
     goto c21;
/* position 10 9 */
  ch_frame = get_selector_frame(DEF(9),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(10).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(10).tsdr = &dr_integer;
/* endget 9 3.3.0 */
  end_selector(DEF(9),DEF(3)DOT(3)DOT(0),sched,GET);
/* copy 11 10 */
  REF(11) = REF(10);
/* ilt . 11 8.0 , 30 */
  if ( REF(11).value.integer < REF(8)DOT(0).value.integer ) goto c30;
/* branch , 31 */
   goto c31;
c30:
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c31:
/* endblock */
  che_endblock(sched);
c33:
/* block , 4 */
  if((ch_returncode = che_block(QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
/* find 12 3.2 3.4.0.0 , 0 */
  if (findfunc(DEF(12),DEF(3)DOT(2),(
          arguments[0] = DEF(3)DOT(4)DOT(0)DOT(0),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* find 13 12.1 3.4.0.1 , 0 */
  if (findfunc(DEF(13),DEF(12)DOT(1),(
          arguments[0] = DEF(3)DOT(4)DOT(0)DOT(1),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* reveal 13.1 , 0 */
  if (0 != REF(13)DOT(1).value.variant->info.variant_case) goto ch_case_error;
/* copy 14 13.1.0 */
  if((ch_returncode = (REF(13)DOT(1)DOT(0).tsdr->copy)(& ch_val, 
    REF(13)DOT(1)DOT(0).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(1)DOT(0).tsdr->number];
/* endblock */
  che_endblock(sched);
/* branch , 42 */
   goto c42;
c40:
/* find 15 3.3.6 3.4.0 , 0 */
  if (findfunc(DEF(15),DEF(3)DOT(3)DOT(6),(
          arguments[0] = DEF(3)DOT(4)DOT(0),& arguments[0]),sched,0
            ) == FAILURE) goto ch_notfound;
/* copy 14 15.1 */
  if((ch_returncode = (REF(15)DOT(1).tsdr->copy)(& ch_val, REF(15)DOT(1).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(15)DOT(1).tsdr->number];
c42:
/* copy 16 3.4.1 */
  if((ch_returncode = cp_table(& ch_val, REF(3)DOT(4)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(16).tsdr)->finalize)(REF(16).value,F_DISCARD,sched);
  REF(16).value = ch_val;
  REF(16).tsdr = & dr_table;
/* initget 17 16 , 0,0 */
  (*(REF(17).tsdr)->finalize)(REF(17).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(17),DEF(16),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c44:
/* get_or_goto 17 16 , 61 */
  if ((ch_returncode = get_selected_object(DEF(17),DEF(16),sched)) != Normal)
     goto c61;
/* find 18 3.1 14.0 , 0 */
  if (findfunc(DEF(18),DEF(3)DOT(1),(
          arguments[0] = DEF(14)DOT(0),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* find 19 18.1 14.1 , 0 */
  if (findfunc(DEF(19),DEF(18)DOT(1),(
          arguments[0] = DEF(14)DOT(1),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* ord_case 20 19.2 */
  REF(20).value.ord_enum = REF(19)DOT(2).value.variant->info.variant_case;
  REF(20).tsdr = & dr_ord_enumeration;
/* notequal . 20 =(10) , 58 */
  if ( REF(20).value.ord_enum != 10 ) goto c58;
/* reveal 19.2 , 10 */
  if (10 != REF(19)DOT(2).value.variant->info.variant_case)
     goto ch_case_error;
/* boolean 21 , FALSE */
  REF(21).value.boolean = FALSE;
  REF(21).tsdr = & dr_boolean;
/* find_or_goto 22 19.2.0.0 17 , 0,55 */
  if (findfunc(DEF(22),DEF(19)DOT(2)DOT(0)DOT(0),(
          arguments[0] = DEF(17),& arguments[0]),sched,0) == FAILURE) goto c55;
/* boolean 21 , TRUE */
  REF(21).value.boolean = TRUE;
  REF(21).tsdr = & dr_boolean;
c55:
/* branch_false 21 , 58 */
  if ( !REF(21).value.boolean ) goto c58;
/* exit , 2 */
  ch_e = handler_type__exit; ch_val = QUAL(2); goto ch_exception;
c58:
/* find 23 19.1 17 , 0 */
  if (findfunc(DEF(23),DEF(19)DOT(1),(
          arguments[0] = DEF(17),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* copy 14 23.1 */
  if((ch_returncode = (REF(23)DOT(1).tsdr->copy)(& ch_val, REF(23)DOT(1).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(23)DOT(1).tsdr->number];
/* branch , 44 */
   goto c44;
c61:
/* endget 17 16 */
  end_selector(DEF(17),DEF(16),sched,GET);
/* discard 16 */
  (*(REF(16).tsdr)->finalize)(REF(16).value,F_DISCARD,sched);
  REF(16).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 78 */
   goto c78;
c65:
/* discard 14 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).tsdr = & dr_bottom;
/* new_record 24 , 3 */
  if ((ch_val.record = new_record(3)) == nil) goto ch_depletion;
  (*(REF(24).tsdr)->finalize)(REF(24).value,F_DISCARD,sched);
  REF(24).value = ch_val; REF(24).tsdr = & dr_record;
/* copy 25 3.5 */
  if((ch_returncode = (REF(3)DOT(5).tsdr->copy)(& ch_val, REF(3)DOT(5).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(25).tsdr)->finalize)(REF(25).value,F_DISCARD,sched);
  REF(25).value = ch_val;
  REF(25).tsdr = datarepmap[REF(3)DOT(5).tsdr->number];
/* unite 24.0 25 , 0 */
  if ((ch_returncode = che_unite(DEF(24)DOT(0),DEF(25),sched,0)) != Normal)
     goto ch_raise_exception;
/* ordenum_lit 24.1 , 14 */
  REF(24)DOT(1).value.ord_enum = 14;
  REF(24)DOT(1).tsdr = & dr_ord_enumeration;
/* new_table 24.2 , 5 */
  if ((ch_returncode = che_new_table(DEF(24)DOT(2),QUAL(5),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 26 3.4 */
  if((ch_returncode = (REF(3)DOT(4).tsdr->copy)(& ch_val, REF(3)DOT(4).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(26).tsdr)->finalize)(REF(26).value,F_DISCARD,sched);
  REF(26).value = ch_val;
  REF(26).tsdr = datarepmap[REF(3)DOT(4).tsdr->number];
/* unite 27 26 , 0 */
  if ((ch_returncode = che_unite(DEF(27),DEF(26),sched,0)) != Normal)
     goto ch_raise_exception;
/* insert 24.2 27 */
  if ((ch_returncode = insertfunc(DEF(24)DOT(2),DEF(27),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* insert 3.3.11 24 */
  if ((ch_returncode = insertfunc(DEF(3)DOT(3)DOT(11),DEF(24)
    ,FALSE,0)) != Normal) goto ch_raise_exception;
c78:
/* discard 14 */
  (*(REF(14).tsdr)->finalize)(REF(14).value,F_DISCARD,sched);
  REF(14).tsdr = & dr_bottom;
/* 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);
c82:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
