#include "chdecl.h"
void CH_linkserver(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 cb5;
    case 4: goto c6;
    case 5: goto cb8;
    case 6: goto c9;
    case 7: goto cb12;
    case 8: goto c13;
    case 9: goto c18;
    case 10: goto cb18;
    case 11: goto c19;
    case 12: goto c23;
    case 13: goto c25;  }
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:
/* chs_lit 4 , "system" */
  if( !chs_lit(DEF(4),"system") ) goto ch_depletion;
/* chs_lit 5 , "CLoader" */
  if( !chs_lit(DEF(5),"CLoader") ) goto ch_depletion;
/* chs_lit 6 , "" */
  if( !chs_lit(DEF(6),"") ) goto ch_depletion;
  current->ip = 3;
cb5:
/* call 3.2.2 4 5 6 7 , 1 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(2),
          arguments[1] = DEF(4),
          arguments[2] = DEF(5),
          arguments[3] = DEF(6),
          arguments[4] = DEF(7),
          arguments[4+1] = nil,& arguments[0]),QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  return;
c6:
/* unwrap 8 7 , 2 */
  if ((ch_returncode = che_unwrap(DEF(8),DEF(7),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* chs_lit 9 , "set linking port" */
  if( !chs_lit(DEF(9),"set linking port") ) goto ch_depletion;
  current->ip = 5;
cb8:
/* call 8 9 10 , 3 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(8),
          arguments[1] = DEF(9),
          arguments[2] = DEF(10),
          arguments[2+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  return;
c9:
/* unwrap 11 10 , 4 */
  if ((ch_returncode = che_unwrap(DEF(11),DEF(10),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
/* new_inport 12 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).value = ch_val; REF(12).tsdr = & dr_inport;
/* connect 13 12 */
  if (REF(12).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(13).tsdr)->finalize)(REF(13).value,F_DISCARD,sched);
  REF(12).value.inport->refcount++;
  REF(13).value.outport = REF(12).value.inport;
  REF(13).tsdr = & dr_outport;
  current->ip = 7;
cb12:
/* call 11 13 , 5 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(11),
          arguments[1] = DEF(13),
          arguments[1+1] = nil,& arguments[0]),QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
  return;
c13:
/* copy 14 3.2 */
  if((ch_returncode = (REF(3)DOT(2).tsdr->copy)(& ch_val, REF(3)DOT(2).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(3)DOT(2).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;
/* discard 0 */
  (*(REF(0).tsdr)->finalize)(REF(0).value,F_DISCARD,sched);
  REF(0).tsdr = & dr_bottom;
c16:
/* noop */
  
c18:
  current->ip = 10;
cb18:
/* receive 15 12 */
  if ((ch_returncode = che_receive(DEF(15),DEF(12),sched)) != Normal)
     goto ch_raise_exception;
  return;
c19:
/* copy 16 14 */
  if((ch_returncode = (REF(14).tsdr->copy)(& ch_val, REF(14).value
    )) != Normal) goto ch_raise_exception;
  (*(REF(16).tsdr)->finalize)(REF(16).value,F_DISCARD,sched);
  REF(16).value = ch_val;
  REF(16).tsdr = datarepmap[REF(14).tsdr->number];
/* wrap 15.0 16 , 6 */
  if ((ch_returncode = che_wrap(DEF(15)DOT(0),DEF(16),QUAL(6)
    ,sched)) != Normal) goto ch_raise_exception;
/* return 15 */
  if (ch_caller = do_return(REF(15).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(15).value);
  REF(15).tsdr = & dr_bottom;
/* branch , 16 */
   goto c16;
c23:
/* endblock */
  che_endblock(sched);
c25:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
