#include "chdecl.h"
void CH_codegen_varcaseid(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 cb9;
    case 4: goto c10;
    case 5: goto c11;
    case 6: goto c19;  }
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:
/* copy 4 3.0 */
  if((ch_returncode = (REF(3)DOT(0).tsdr->copy)(& ch_val, REF(3)DOT(0).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).value = ch_val;
  REF(4).tsdr = datarepmap[REF(3)DOT(0).tsdr->number];
/* privatize 4.1 */
  if (REF(4)DOT(1).value.table->refcount != 1)
    if ((ch_returncode = doCopyOnWrite(DEF(4)DOT(1))) != Normal)
       goto ch_raise_exception;
/* size 5 4.1 */
  REF(5).value.integer = REF(4)DOT(1).value.table->size;
  REF(5).tsdr = & dr_integer;
/* isubtract 6 5 =(1) */
  if (!chf_isubtract(DEF(6),REF(5).value.integer,1)) goto ch_depletion;
/* lookup_at 7 4.1 6 */
  if((ch_i = REF(6).value.integer) < 0 || ch_i >= (ch_t = REF(4)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,ch_i);
  REF(7).tsdr = qdatarepmap[ch_t->tsdr->number];
/* remove_at 8 4.1 6 */
  if ((ch_returncode = remove_at_func(DEF(8),DEF(4)DOT(1),REF(6).value.integer
    )) != Normal) goto ch_raise_exception;
  current->ip = 3;
cb9:
/* call 3.1.4.6 4 9 , 1 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(1)DOT(4)DOT(6),
          arguments[1] = DEF(4),
          arguments[2] = DEF(9),
          arguments[2+1] = nil,& arguments[0]),QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  return;
c10:
/* call 3.1.3.16 9 10 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(1)DOT(3)DOT(16),
          arguments[1] = DEF(9),
          arguments[2] = DEF(10),
          arguments[2+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c11:
/* noop */
  
/* reveal 10.2 , 6 */
  if (6 != REF(10)DOT(2).value.variant->info.variant_case) goto ch_case_error;
/* copy 11 10.2.0 */
  if((ch_returncode = (REF(10)DOT(2)DOT(0).tsdr->copy)(& ch_val, 
    REF(10)DOT(2)DOT(0).value)) != Normal) goto ch_raise_exception;
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).value = ch_val;
  REF(11).tsdr = datarepmap[REF(10)DOT(2)DOT(0).tsdr->number];
/* find 12 11.1 8 , 0 */
  if (findfunc(DEF(12),DEF(11)DOT(1),(
          arguments[0] = DEF(8),& arguments[0]),sched,0) == FAILURE)
             goto ch_notfound;
/* copy 3.2 12.1 */
  if((ch_returncode = (REF(12)DOT(1).tsdr->copy)(& ch_val, REF(12)DOT(1).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(3)DOT(2).tsdr)->finalize)(REF(3)DOT(2).value,F_DISCARD,sched);
  REF(3)DOT(2).value = ch_val;
  REF(3)DOT(2).tsdr = datarepmap[REF(12)DOT(1).tsdr->number];
/* 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);
c19:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
