#include "chdecl.h"
void CH_typestate_prewrap(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 c5;
    case 4: goto cb12;
    case 5: goto c13;
    case 6: goto c14;
    case 7: goto c20;
    case 8: goto c23;  }
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;
/* reveal 3.4.3 , 17 */
  if (17 != REF(3)DOT(4)DOT(3).value.variant->info.variant_case)
     goto ch_case_error;
/* initget 4 3.4.2 , 0,0 */
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(4),DEF(3)DOT(4)DOT(2),nil,sched,GET,
    0,0)) != Normal) goto ch_raise_exception;
c5:
/* get_or_err 4 3.4.2 */
  if ((ch_returncode = get_selected_object(DEF(4),DEF(3)DOT(4)DOT(2)
    ,sched)) != Normal) goto ch_raise_exception;
/* lookup_at 5 3.7 =(0) */
  if ( !((ch_t = REF(3)DOT(7).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 */
  REF(6) = REF(5);
/* position 7 4 */
  ch_frame = get_selector_frame(DEF(4),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(7).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(7).tsdr = &dr_integer;
/* notequal . 6 7 , 5 */
  if ( REF(6).value.integer != REF(7).value.integer ) goto c5;
  current->ip = 4;
cb12:
/* call 3.0.14 3.0 4 3.4.3.0 8 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(14),
          arguments[1] = DEF(3)DOT(0),
          arguments[2] = DEF(4),
          arguments[3] = DEF(3)DOT(4)DOT(3)DOT(0),
          arguments[4] = DEF(8),
          arguments[4+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c13:
/* call 3.0.4 3.6 4 8 9 , 3 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(0)DOT(4),
          arguments[1] = DEF(3)DOT(6),
          arguments[2] = DEF(4),
          arguments[3] = DEF(8),
          arguments[4] = DEF(9),
          arguments[4+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  return;
c14:
/* merge 3.8 8 */
  if ((ch_returncode = mergefunc(DEF(3)DOT(8),DEF(8),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* merge 3.9 9 */
  if ((ch_returncode = mergefunc(DEF(3)DOT(9),DEF(9),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* endget 4 3.4.2 */
  end_selector(DEF(4),DEF(3)DOT(4)DOT(2),sched,GET);
/* endblock */
  che_endblock(sched);
/* branch , 20 */
   goto c20;
c20:
/* 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);
c23:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
