/* Compiler: ECL 26.3.27                                                      */
/* Source: /build/ecl/src/ecl-26.3.27/src/lsp/process.lsp                     */
#include <ecl/ecl-cmp.h>
#include "clos/process.eclh"
/* local function WITH-PROCESS-LOCK                                           */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2867with_process_lock(cl_object v1, cl_object v2)
{
 cl_object T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  cl_object v5;
  cl_object v6process;
  cl_object v7wait;
  v3 = ecl_cdr(v1);
  if (!(v3==ECL_NIL)){
   goto L4;
  }
  si_dm_too_few_arguments(v1);
L4:;
  {
   cl_object v8;
   v8 = ecl_car(v3);
   v3 = ecl_cdr(v3);
   v4 = v8;
  }
  v5 = v4;
  if (!(v5==ECL_NIL)){
   goto L11;
  }
  si_dm_too_few_arguments(v1);
L11:;
  {
   cl_object v8;
   v8 = ecl_car(v5);
   v5 = ecl_cdr(v5);
   v6process = v8;
  }
  if (Null(v5)){
   goto L17;
  }
  {
   cl_object v8;
   v8 = ecl_car(v5);
   v5 = ecl_cdr(v5);
   v7wait = v8;
   goto L16;
  }
L17:;
  v7wait = ECL_T;
L16:;
  if (Null(v5)){
   goto L22;
  }
  si_dm_too_many_arguments(v1);
L22:;
  {
   cl_object v8lock;
   cl_object v9wait_p;
   v8lock = cl_gensym(1, _ecl_static_0);
   v9wait_p = cl_gensym(1, _ecl_static_1);
   T0 = cl_list(2, VV[3], v6process);
   T1 = cl_list(2, v8lock, T0);
   T2 = cl_list(2, v9wait_p, v7wait);
   T3 = cl_list(2, T1, T2);
   T4 = cl_list(3, ECL_SYM("GET-LOCK",1462), v8lock, v9wait_p);
   T5 = CONS(ECL_SYM("LOCALLY",492),v3);
   T6 = cl_list(2, ECL_SYM("WITH-RESTORED-INTERRUPTS",1833), T5);
   T7 = cl_list(2, ECL_SYM("GIVEUP-LOCK",1463), v8lock);
   T8 = cl_list(3, ECL_SYM("UNWIND-PROTECT",892), T6, T7);
   T9 = cl_list(2, ECL_SYM("WITHOUT-INTERRUPTS",1832), T8);
   T10 = cl_list(3, ECL_SYM("WHEN",909), T4, T9);
   value0 = cl_list(3, ECL_SYM("LET",479), T3, T10);
   return value0;
  }
 }
}
static cl_object LC2867with_process_lock_va(cl_narg narg, cl_object v10, cl_object v11, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[1]);
 {
  return LC2867with_process_lock(v10, v11);
 }
}
/* function definition for MAKE-EXTERNAL-PROCESS                              */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L2868make_external_process()
{
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v1_lock;
  cl_object v2_pipe;
  v1_lock = mp_make_lock(0);
  v2_pipe = mp_make_process(0);
  value0 = si_make_structure(9, VV[8], ECL_NIL, ECL_NIL, ECL_NIL, ECL_NIL, ECL_SYM("RUNNING",1852), ECL_NIL, v1_lock, v2_pipe);
  return value0;
 }
}
static cl_object L2868make_external_process_va(cl_narg narg, ...)
{
 if (ecl_unlikely(narg!=0)) FEwrong_num_arguments(VV[9]);
 {
  return L2868make_external_process();
 }
}
/* local function LAMBDA16                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2869__lambda16(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(7), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(7));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2869__lambda16_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[12]);
 {
  return LC2869__lambda16(v5, v6si__x);
 }
}
/* local function LAMBDA21                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2870__lambda21(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(6), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(6));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2870__lambda21_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[13]);
 {
  return LC2870__lambda21(v5, v6si__x);
 }
}
/* local function LAMBDA26                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2871__lambda26(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(5), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(5));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2871__lambda26_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[15]);
 {
  return LC2871__lambda26(v5, v6si__x);
 }
}
/* local function LAMBDA31                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2872__lambda31(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(4), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(4));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2872__lambda31_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[17]);
 {
  return LC2872__lambda31(v5, v6si__x);
 }
}
/* local function LAMBDA36                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2873__lambda36(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(3), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(3));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2873__lambda36_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[18]);
 {
  return LC2873__lambda36(v5, v6si__x);
 }
}
/* local function LAMBDA41                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2874__lambda41(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(2), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(2));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2874__lambda41_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[19]);
 {
  return LC2874__lambda41(v5, v6si__x);
 }
}
/* local function LAMBDA46                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2875__lambda46(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(1), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(1));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2875__lambda46_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[20]);
 {
  return LC2875__lambda46(v5, v6si__x);
 }
}
/* local function LAMBDA51                                                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2876__lambda51(cl_object v1, cl_object v2si__x)
{
 cl_object T0, T1, T2, T3;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v3;
  cl_object v4;
  v3 = cl_gensym(0);
  v4 = cl_gensym(0);
  T0 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T1 = cl_list(6, ECL_SYM("COMPARE-AND-SWAP-STRUCTURE",1527), v2si__x, T0, ecl_make_int8_t(0), v3, v4);
  T2 = cl_list(2, ECL_SYM("QUOTE",682), ECL_SYM("EXTERNAL-PROCESS",1844));
  T3 = cl_list(4, ECL_SYM("STRUCTURE-REF",1178), v2si__x, T2, ecl_make_int8_t(0));
  cl_env_copy->nvalues = 6;
  cl_env_copy->values[5] = T3;
  cl_env_copy->values[4] = T1;
  cl_env_copy->values[3] = v4;
  cl_env_copy->values[2] = v3;
  cl_env_copy->values[1] = ECL_NIL;
  cl_env_copy->values[0] = ECL_NIL;
  return cl_env_copy->values[0];
 }
}
static cl_object LC2876__lambda51_va(cl_narg narg, cl_object v5, cl_object v6si__x, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[21]);
 {
  return LC2876__lambda51(v5, v6si__x);
 }
}
/* function definition for EXTERNAL-PROCESS-STATUS                            */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L2877external_process_status(cl_object v1external_process)
{
 cl_object T0;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v2status;
  v2status = (cl_env_copy->function=ecl_fdefinition(VV[16]))->cfun.entry(1, v1external_process) /*  EXTERNAL-PROCESS-%STATUS */;
  if (!((v2status)==(ECL_SYM("STOPPED",1855)))){
   goto L8;
  }
  goto L5;
L8:;
  goto L6;
L6:;
  if (!((v2status)==(ECL_SYM("RESUMED",1856)))){
   goto L12;
  }
  goto L5;
L12:;
  goto L10;
L10:;
  if (!((v2status)==(ECL_SYM("RUNNING",1852)))){
   goto L3;
  }
  goto L4;
L5:;
L4:;
  value0 = L2878external_process_wait(2, v1external_process, ECL_NIL);
  return value0;
L3:;
  T0 = (cl_env_copy->function=ecl_fdefinition(VV[14]))->cfun.entry(1, v1external_process) /*  EXTERNAL-PROCESS-%CODE */;
  cl_env_copy->nvalues = 2;
  cl_env_copy->values[1] = T0;
  cl_env_copy->values[0] = v2status;
  return cl_env_copy->values[0];
 }
}
static cl_object L2877external_process_status_va(cl_narg narg, cl_object v3external_process, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[25]);
 {
  return L2877external_process_status(v3external_process);
 }
}
/* function definition for EXTERNAL-PROCESS-WAIT                              */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L2878external_process_wait(volatile cl_narg narg, cl_object volatile v1process, ...)
{
 cl_object T0, T1;
 cl_object volatile env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object volatile value0;
 ecl_cs_check(cl_env_copy,value0);
 if (ecl_unlikely(narg<1)) FEwrong_num_arguments(VV[32]);
 if (ecl_unlikely(narg>2)) FEwrong_num_arguments(VV[32]);
 {
  cl_object volatile v2wait;
  va_list args; va_start(args,v1process);
  {
   int i = 1;
   if (i >= narg) {
    v2wait = ECL_NIL;
   } else {
    i++;
    v2wait = va_arg(args,cl_object);
   }
  }
  va_end(args);
  {
   volatile cl_object v3;
   v3 = (cl_env_copy->function=ecl_fdefinition(VV[3]))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-%LOCK */;
   if (Null(mp_get_lock(2, v3, v2wait))){
    goto L2;
   }
   {
    struct ecl_stack_frame _ecl_inner_frame_aux;
    volatile cl_object _ecl_inner_frame=ecl_stack_frame_open(cl_env_copy,(cl_object)&_ecl_inner_frame_aux,0);
    {
     volatile cl_object v4;
     v4 = ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7));
     ecl_bds_bind(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7),ECL_NIL); /*  *INTERRUPTS-ENABLED* */
     ecl_bds_bind(cl_env_copy,ECL_SYM("*ALLOW-WITH-INTERRUPTS*",1821),ECL_NIL); /*  *ALLOW-WITH-INTERRUPTS* */
     {
      struct ecl_stack_frame _ecl_inner_frame_aux;
      volatile cl_object _ecl_inner_frame=ecl_stack_frame_open(cl_env_copy,(cl_object)&_ecl_inner_frame_aux,0);
      volatile bool unwinding = FALSE;
      ecl_frame_ptr next_fr;
      {
       ecl_frs_push(cl_env_copy,ECL_PROTECT_TAG);
       if (__ecl_frs_push_result!=0) {
         unwinding = TRUE; next_fr=cl_env_copy->frs_stack.nlj_fr;
       } else {
       ecl_bds_bind(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7),v4); /*  *INTERRUPTS-ENABLED* */
       {
        cl_object v5pid;
        v5pid = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("EXTERNAL-PROCESS-PID",1845)))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-PID */;
        if (Null(v5pid)){
         goto L9;
        }
        {
         cl_object v6;                            /*  STATUS                  */
         cl_object v7;                            /*  CODE                    */
         value0 = si_waitpid(v5pid, v2wait);
         {
          v6 = value0;
          v7 = cl_env_copy->values[1];
         }
         if (!((v6)==(ECL_SYM("EXITED",1853)))){
          goto L17;
         }
         goto L14;
L17:;
         goto L15;
L15:;
         if (!((v6)==(ECL_SYM("SIGNALED",1854)))){
          goto L21;
         }
         goto L14;
L21:;
         goto L19;
L19:;
         if (!((v6)==(ECL_SYM("ABORT",1225)))){
          goto L25;
         }
         goto L14;
L25:;
         goto L23;
L23:;
         if (!((v6)==(ECL_SYM("ERROR",1260)))){
          goto L12;
         }
         goto L13;
L14:;
L13:;
         ecl_structure_set(v1process,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(0),ECL_NIL);
         ecl_structure_set(v1process,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(4),v6);
         ecl_structure_set(v1process,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(5),v7);
         T0 = (cl_env_copy->function=ecl_fdefinition(VV[10]))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-%PIPE */;
         cl_env_copy->values[0] = mp_process_join(T0);
         ecl_bds_unwind1(cl_env_copy);
         goto L7;
L12:;
         if (!((v6)==(ECL_SYM("STOPPED",1855)))){
          goto L36;
         }
         goto L33;
L36:;
         goto L34;
L34:;
         if (!((v6)==(ECL_SYM("RESUMED",1856)))){
          goto L40;
         }
         goto L33;
L40:;
         goto L38;
L38:;
         if (!((v6)==(ECL_SYM("RUNNING",1852)))){
          goto L31;
         }
         goto L32;
L33:;
L32:;
         ecl_structure_set(v1process,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(4),v6);
         cl_env_copy->values[0] = ecl_structure_set(v1process,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(5),v7);
         cl_env_copy->nvalues = 1;
         ecl_bds_unwind1(cl_env_copy);
         goto L7;
L31:;
         if (!((v6)==(ECL_NIL))){
          goto L44;
         }
         cl_env_copy->values[0] = ECL_NIL;
         cl_env_copy->nvalues = 1;
         ecl_bds_unwind1(cl_env_copy);
         goto L7;
L44:;
         cl_env_copy->values[0] = si_ecase_error(v6, VV[31]);
         ecl_bds_unwind1(cl_env_copy);
         goto L7;
        }
L9:;
        cl_env_copy->values[0] = ECL_NIL;
        cl_env_copy->nvalues = 1;
        ecl_bds_unwind1(cl_env_copy);
       }
L7:;
       }
      }
      ecl_frs_pop(cl_env_copy);
      ecl_stack_frame_push_values(_ecl_inner_frame);
      mp_giveup_lock(v3);
      ecl_stack_frame_pop_values(_ecl_inner_frame);
      if (unwinding) ecl_unwind(cl_env_copy,next_fr);
      ecl_stack_frame_close(_ecl_inner_frame);
      ecl_bds_unwind1(cl_env_copy);
      ecl_bds_unwind1(cl_env_copy);
     }
    }
    ecl_stack_frame_push_values(_ecl_inner_frame);
    if (Null(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7)))){
     goto L48;
    }
    si_check_pending_interrupts();
L48:;
    ecl_stack_frame_pop_values(_ecl_inner_frame);
    ecl_stack_frame_close(_ecl_inner_frame);
   }
  }
L2:;
  T0 = (cl_env_copy->function=ecl_fdefinition(VV[16]))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-%STATUS */;
  T1 = (cl_env_copy->function=ecl_fdefinition(VV[14]))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-%CODE */;
  cl_env_copy->nvalues = 2;
  cl_env_copy->values[1] = T1;
  cl_env_copy->values[0] = T0;
  return cl_env_copy->values[0];
 }
}
/* function definition for TERMINATE-PROCESS                                  */
/* optimize speed 1, debug 1, space 1, safety 2                               */
cl_object si_terminate_process(volatile cl_narg narg, cl_object volatile v1process, ...)
{
 cl_object T0, T1;
 cl_object volatile env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object volatile value0;
 ecl_cs_check(cl_env_copy,value0);
 if (ecl_unlikely(narg<1)) FEwrong_num_arguments(ECL_SYM("TERMINATE-PROCESS",1851));
 if (ecl_unlikely(narg>2)) FEwrong_num_arguments(ECL_SYM("TERMINATE-PROCESS",1851));
 {
  cl_object volatile v2force;
  va_list args; va_start(args,v1process);
  {
   int i = 1;
   if (i >= narg) {
    v2force = ECL_NIL;
   } else {
    i++;
    v2force = va_arg(args,cl_object);
   }
  }
  va_end(args);
  {
   volatile cl_object v3;
   v3 = (cl_env_copy->function=ecl_fdefinition(VV[3]))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-%LOCK */;
   if (Null(mp_get_lock(2, v3, ECL_T))){
    goto L3;
   }
   {
    struct ecl_stack_frame _ecl_inner_frame_aux;
    volatile cl_object _ecl_inner_frame=ecl_stack_frame_open(cl_env_copy,(cl_object)&_ecl_inner_frame_aux,0);
    {
     volatile cl_object v4;
     v4 = ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7));
     ecl_bds_bind(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7),ECL_NIL); /*  *INTERRUPTS-ENABLED* */
     ecl_bds_bind(cl_env_copy,ECL_SYM("*ALLOW-WITH-INTERRUPTS*",1821),ECL_NIL); /*  *ALLOW-WITH-INTERRUPTS* */
     {
      struct ecl_stack_frame _ecl_inner_frame_aux;
      volatile cl_object _ecl_inner_frame=ecl_stack_frame_open(cl_env_copy,(cl_object)&_ecl_inner_frame_aux,0);
      volatile bool unwinding = FALSE;
      ecl_frame_ptr next_fr;
      {
       ecl_frs_push(cl_env_copy,ECL_PROTECT_TAG);
       if (__ecl_frs_push_result!=0) {
         unwinding = TRUE; next_fr=cl_env_copy->frs_stack.nlj_fr;
       } else {
       ecl_bds_bind(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7),v4); /*  *INTERRUPTS-ENABLED* */
       {
        cl_object v5pid;
        v5pid = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("EXTERNAL-PROCESS-PID",1845)))->cfun.entry(1, v1process) /*  EXTERNAL-PROCESS-PID */;
        if (Null(v5pid)){
         goto L9;
        }
        if (Null(v2force)){
         goto L14;
        }
        T0 = ecl_make_int8_t(9);
        goto L13;
L14:;
        T0 = ecl_make_int8_t(15);
L13:;
        T1 = si_killpid(v5pid, T0);
        if ((ecl_fixnum(T1))==0) {
         goto L11;
        }
        cl_env_copy->values[0] = cl_error(2, VV[35], v1process);
        ecl_bds_unwind1(cl_env_copy);
        goto L7;
L11:;
        cl_env_copy->values[0] = ECL_NIL;
        cl_env_copy->nvalues = 1;
        ecl_bds_unwind1(cl_env_copy);
        goto L7;
L9:;
        cl_env_copy->values[0] = ECL_NIL;
        cl_env_copy->nvalues = 1;
        ecl_bds_unwind1(cl_env_copy);
       }
L7:;
       }
      }
      ecl_frs_pop(cl_env_copy);
      ecl_stack_frame_push_values(_ecl_inner_frame);
      mp_giveup_lock(v3);
      ecl_stack_frame_pop_values(_ecl_inner_frame);
      if (unwinding) ecl_unwind(cl_env_copy,next_fr);
      ecl_stack_frame_close(_ecl_inner_frame);
      ecl_bds_unwind1(cl_env_copy);
      ecl_bds_unwind1(cl_env_copy);
     }
    }
    ecl_stack_frame_push_values(_ecl_inner_frame);
    if (Null(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*INTERRUPTS-ENABLED*",7)))){
     goto L17;
    }
    si_check_pending_interrupts();
L17:;
    ecl_stack_frame_pop_values(_ecl_inner_frame);
    ecl_stack_frame_close(_ecl_inner_frame);
    return cl_env_copy->values[0];
   }
L3:;
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 1;
   return value0;
  }
 }
}
/* function definition for FINALIZE-EXTERNAL-PROCESS                          */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L2879finalize_external_process(cl_object v1process)
{
 cl_object T0;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v2;
  v2 = L2878external_process_wait(2, v1process, ECL_NIL);
  if (!((v2)==(ECL_SYM("EXITED",1853)))){
   goto L7;
  }
  goto L2;
L7:;
  goto L5;
L5:;
  if (!((v2)==(ECL_SYM("SIGNALED",1854)))){
   goto L11;
  }
  goto L2;
L11:;
  goto L9;
L9:;
  if (!((v2)==(ECL_SYM("ABORT",1225)))){
   goto L15;
  }
  goto L2;
L15:;
  goto L13;
L13:;
  if (!((v2)==(ECL_SYM("ERROR",1260)))){
   goto L18;
  }
  goto L2;
L18:;
  goto L3;
 }
L3:;
 T0 = ecl_fdefinition(VV[36]);
 value0 = si_set_finalizer(v1process, T0);
 return value0;
L2:;
 value0 = ECL_NIL;
 cl_env_copy->nvalues = 1;
 return value0;
}
static cl_object L2879finalize_external_process_va(cl_narg narg, cl_object v2process, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[36]);
 {
  return L2879finalize_external_process(v2process);
 }
}
/* function definition for RUN-PROGRAM                                        */
/* optimize speed 1, debug 1, space 1, safety 2                               */
cl_object si_run_program(volatile cl_narg narg, cl_object volatile v1command, cl_object volatile v2argv, ...)
{
 cl_object T0, T1, T2;
 volatile cl_object lex0[1];
 cl_object volatile env0 = ECL_NIL;
 volatile struct ecl_cclosure aux_closure;
 cl_object volatile CLV0, CLV1, CLV2, CLV3;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object volatile value0;
 ecl_cs_check(cl_env_copy,value0);
 if (ecl_unlikely(narg<2)) FEwrong_num_arguments(ECL_SYM("RUN-PROGRAM",1842));
 {
  cl_object volatile v3input;
  cl_object volatile v4output;
  cl_object volatile v5error;
  cl_object volatile v6wait;
  cl_object volatile v7environ;
  ecl_va_list args; ecl_va_start(args,v2argv,narg,2);
  {
   cl_object keyvars[18];
   cl_parse_key(args,9,si_run_programkeys,keyvars,NULL,FALSE);
   ecl_va_end(args);
   if (Null(keyvars[9])) {
    v3input = ECL_SYM("STREAM",1350);
   } else {
    v3input = keyvars[0];
   }
   if (Null(keyvars[10])) {
    v4output = ECL_SYM("STREAM",1350);
   } else {
    v4output = keyvars[1];
   }
   if (Null(keyvars[11])) {
    v5error = ECL_SYM("OUTPUT",1319);
   } else {
    v5error = keyvars[2];
   }
   if (Null(keyvars[12])) {
    v6wait = ECL_T;
   } else {
    v6wait = keyvars[3];
   }
   if (Null(keyvars[13])) {
    v7environ = ECL_SYM("DEFAULT",1246);
   } else {
    v7environ = keyvars[4];
   }
   env0 = ECL_NIL;
   CLV0 = env0 = CONS(keyvars[5],env0);           /*  IF-INPUT-DOES-NOT-EXIST */
   if (Null(keyvars[15])) {
    CLV1 = env0 = CONS(ECL_SYM("ERROR",1260),env0); /*  IF-OUTPUT-EXISTS      */
   } else {
    CLV1 = env0 = CONS(keyvars[6],env0);          /*  IF-OUTPUT-EXISTS        */
   }
   if (Null(keyvars[16])) {
    CLV2 = env0 = CONS(ECL_SYM("ERROR",1260),env0); /*  IF-ERROR-EXISTS       */
   } else {
    CLV2 = env0 = CONS(keyvars[7],env0);          /*  IF-ERROR-EXISTS         */
   }
   if (Null(keyvars[17])) {
    lex0[0] = ECL_SYM("DEFAULT",1246);            /*  EXTERNAL-FORMAT         */
   } else {
    lex0[0] = keyvars[8];                         /*  EXTERNAL-FORMAT         */
   }
  }
  {
   CLV3 = env0 = CONS(ECL_NEW_FRAME_ID(cl_env_copy),env0); /*  RUN-PROGRAM    */
   {
    ecl_frs_push(cl_env_copy,ECL_CONS_CAR(CLV3));
    if (__ecl_frs_push_result!=0) {
    ecl_frs_pop_n(cl_env_copy, 1);
    return cl_env_copy->values[0];
    } else {
    if (!((v3input)==(ECL_T))){
     goto L6;
    }
    v3input = ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*STANDARD-INPUT*",68));
L6:;
    if (!((v4output)==(ECL_T))){
     goto L9;
    }
    v4output = ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*STANDARD-OUTPUT*",69));
L9:;
    if (!((v5error)==(ECL_T))){
     goto L12;
    }
    v5error = ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*ERROR-OUTPUT*",35));
L12:;
    {
     cl_object v8;
     cl_object v9;
     cl_object v10;
     cl_object v11;
     cl_object v12;
     cl_object v13pid;
     cl_object v14parent_write;
     cl_object v15parent_read;
     cl_object v16parent_error;
     T0 = CONS(v1command,v2argv);
     v8 = LC2881prepare_args(T0);
     v9 = L2868make_external_process();
     v10 = LC2880process_stream(5, lex0, v3input, ECL_SYM("DIRECTION",1249), ECL_SYM("INPUT",1289), ECL_SYM("IF-DOES-NOT-EXIST",1277), ECL_CONS_CAR(CLV0));
     v11 = LC2880process_stream(5, lex0, v4output, ECL_SYM("DIRECTION",1249), ECL_SYM("OUTPUT",1319), ECL_SYM("IF-EXISTS",1279), ECL_CONS_CAR(CLV1));
     if (!((v5error)==(ECL_SYM("OUTPUT",1319)))){
      goto L20;
     }
     v12 = ECL_SYM("OUTPUT",1319);
     goto L19;
L20:;
     v12 = LC2880process_stream(5, lex0, v5error, ECL_SYM("DIRECTION",1249), ECL_SYM("OUTPUT",1319), ECL_SYM("IF-EXISTS",1279), ECL_CONS_CAR(CLV2));
L19:;
     v13pid = ECL_NIL;
     v14parent_write = ECL_NIL;
     v15parent_read = ECL_NIL;
     v16parent_error = ECL_NIL;
     T0 = (aux_closure.env=env0,cl_env_copy->function=(cl_object)&aux_closure,LC2883verify_stream(2, v10, ECL_SYM("INPUT",1289)));
     T1 = (aux_closure.env=env0,cl_env_copy->function=(cl_object)&aux_closure,LC2883verify_stream(2, v11, ECL_SYM("OUTPUT",1319)));
     T2 = (aux_closure.env=env0,cl_env_copy->function=(cl_object)&aux_closure,LC2883verify_stream(2, v12, ECL_SYM("ERROR",1260)));
     value0 = si_spawn_subprocess(v1command, v8, v7environ, T0, T1, T2);
     {
      v13pid = value0;
      v14parent_write = cl_env_copy->values[1];
      v15parent_read = cl_env_copy->values[2];
      v16parent_error = cl_env_copy->values[3];
     }
     {
      cl_object v17;
      cl_object v18;
      cl_object v19;
      cl_object v20pipes;
      if (!(ecl_plusp(v14parent_write))){
       goto L32;
      }
      v17 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAKE-STREAM-FROM-FD",1082)))->cfun.entry(6, v14parent_write, ECL_SYM("OUTPUT",1319), ECL_SYM("ELEMENT-TYPE",1255), ECL_SYM("BASE-CHAR",122), ECL_SYM("EXTERNAL-FORMAT",1267), lex0[0]) /*  MAKE-STREAM-FROM-FD */;
      goto L31;
L32:;
      v17 = ECL_NIL;
L31:;
      if (!(ecl_plusp(v15parent_read))){
       goto L35;
      }
      v18 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAKE-STREAM-FROM-FD",1082)))->cfun.entry(6, v15parent_read, ECL_SYM("INPUT",1289), ECL_SYM("ELEMENT-TYPE",1255), ECL_SYM("BASE-CHAR",122), ECL_SYM("EXTERNAL-FORMAT",1267), lex0[0]) /*  MAKE-STREAM-FROM-FD */;
      goto L34;
L35:;
      v18 = ECL_NIL;
L34:;
      if (!(ecl_plusp(v16parent_error))){
       goto L38;
      }
      v19 = (cl_env_copy->function=ecl_fdefinition(ECL_SYM("MAKE-STREAM-FROM-FD",1082)))->cfun.entry(6, v16parent_error, ECL_SYM("INPUT",1289), ECL_SYM("ELEMENT-TYPE",1255), ECL_SYM("BASE-CHAR",122), ECL_SYM("EXTERNAL-FORMAT",1267), lex0[0]) /*  MAKE-STREAM-FROM-FD */;
      goto L37;
L38:;
      v19 = ECL_NIL;
L37:;
      v20pipes = ECL_NIL;
      if (!((v10)==(VV[40]))){
       goto L41;
      }
      T0 = cl_list(3, v3input, v17, ECL_SYM("INPUT",1289));
      v20pipes = CONS(T0,v20pipes);
L41:;
      if (!((v11)==(VV[40]))){
       goto L44;
      }
      T0 = cl_list(3, v18, v4output, ECL_SYM("OUTPUT",1319));
      v20pipes = CONS(T0,v20pipes);
L44:;
      if (!((v12)==(VV[40]))){
       goto L47;
      }
      T0 = cl_list(3, v19, v5error, ECL_SYM("ERROR",1260));
      v20pipes = CONS(T0,v20pipes);
L47:;
      ecl_structure_set(v9,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(0),v13pid);
      ecl_structure_set(v9,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(1),v17);
      ecl_structure_set(v9,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(2),v18);
      ecl_structure_set(v9,ECL_SYM("EXTERNAL-PROCESS",1844),(cl_fixnum)(3),v19);
      if (Null(v20pipes)){
       goto L54;
      }
      {
       cl_object v21thread;
       v21thread = (cl_env_copy->function=ecl_fdefinition(VV[10]))->cfun.entry(1, v9) /*  EXTERNAL-PROCESS-%PIPE */;
       T0 = ecl_fdefinition(VV[45]);
       mp_process_preset(4, v21thread, T0, v9, v20pipes);
       mp_process_enable(v21thread);
      }
L54:;
      if (Null(v6wait)){
       goto L60;
      }
      L2878external_process_wait(2, v9, ECL_T);
      goto L59;
L60:;
      T0 = ecl_fdefinition(VV[36]);
      si_set_finalizer(v9, T0);
L59:;
      if (Null(v18)){
       goto L64;
      }
      if (Null(v17)){
       goto L64;
      }
      T0 = cl_make_two_way_stream(v18, v17);
      goto L63;
L64:;
      value0 = v18;
      if (value0!=ECL_NIL) {
       goto L68;
      }
      T0 = v17;
      goto L63;
L68:;
      T0 = value0;
      goto L63;
L63:;
      T1 = (cl_env_copy->function=ecl_fdefinition(VV[14]))->cfun.entry(1, v9) /*  EXTERNAL-PROCESS-%CODE */;
      cl_env_copy->nvalues = 3;
      cl_env_copy->values[2] = v9;
      cl_env_copy->values[1] = T1;
      cl_env_copy->values[0] = T0;
      ecl_frs_pop_n(cl_env_copy, 1);
      return cl_env_copy->values[0];
     }
    }
    }
   }
  }
 }
}
/* function definition for PIPE-STREAMS                                       */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L2885pipe_streams(cl_object v1process, cl_object v2pipes)
{
 volatile cl_object lex0[2];
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 lex0[0] = v2pipes;                               /*  PIPES                   */
L1:;
 lex0[1] = ECL_NIL;                               /*  TO-REMOVE               */
 goto L4;
L3:;
 LC2884thunk(lex0);
 if (Null(lex0[1])){
  goto L7;
 }
 lex0[0] = cl_set_difference(2, lex0[0], lex0[1]);
L7:;
 cl_sleep(_ecl_static_3);
L4:;
 if (lex0[0]==ECL_NIL) {
  goto L11;
 }
 {
  cl_object v3;
  v3 = L2878external_process_wait(2, v1process, ECL_NIL);
  if (!((v3)==(ECL_SYM("EXITED",1853)))){
   goto L17;
  }
  goto L11;
L17:;
  goto L15;
L15:;
  if (!((v3)==(ECL_SYM("SIGNALED",1854)))){
   goto L21;
  }
  goto L11;
L21:;
  goto L19;
L19:;
  if (!((v3)==(ECL_SYM("ABORT",1225)))){
   goto L25;
  }
  goto L11;
L25:;
  goto L23;
L23:;
  if (!((v3)==(ECL_SYM("ERROR",1260)))){
   goto L28;
  }
  goto L11;
L28:;
  goto L12;
 }
L12:;
 goto L3;
L11:;
 value0 = LC2884thunk(lex0);
 return value0;
}
static cl_object L2885pipe_streams_va(cl_narg narg, cl_object v3process, cl_object v4pipes, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[45]);
 {
  return L2885pipe_streams(v3process, v4pipes);
 }
}
/* closure VERIFY-STREAM                                                      */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2883verify_stream(cl_narg narg, cl_object v1stream, cl_object v2stream_type, ...)
{
 cl_object T0;
 cl_object CLV0, CLV1, CLV2, CLV3;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object env0 = cl_env_copy->function->cclosure.env;
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 /* Scanning closure data ... */
 CLV3 = env0;                                     /*  RUN-PROGRAM             */
 CLV2 = _ecl_cdr(CLV3);
 CLV1 = _ecl_cdr(CLV2);
 CLV0 = _ecl_cdr(CLV1);
 { /* ... closure scanning finished */
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[44]);
 {
L1:;
  if (!((v1stream)==(ECL_NIL))){
   goto L2;
  }
  if (!((v2stream_type)==(ECL_SYM("INPUT",1289)))){
   goto L8;
  }
  T0 = ECL_CONS_CAR(CLV0);
  goto L7;
L8:;
  if (!((v2stream_type)==(ECL_SYM("OUTPUT",1319)))){
   goto L10;
  }
  T0 = ECL_CONS_CAR(CLV1);
  goto L7;
L10:;
  if (!((v2stream_type)==(ECL_SYM("ERROR",1260)))){
   goto L12;
  }
  T0 = ECL_CONS_CAR(CLV2);
  goto L7;
L12:;
  T0 = ECL_NIL;
L7:;
  if (!(T0==ECL_NIL)){
   goto L5;
  }
  cl_env_copy->values[0] = ECL_NIL;
  cl_env_copy->nvalues = 1;
  cl_return_from(ECL_CONS_CAR(CLV3),ECL_SYM("RUN-PROGRAM",1842));
L5:;
  if (!((v2stream_type)==(ECL_SYM("INPUT",1289)))){
   goto L16;
  }
  T0 = ECL_SYM("OUTPUT",1319);
  goto L15;
L16:;
  T0 = ECL_SYM("INPUT",1289);
L15:;
  value0 = LC2882null_stream(T0);
  return value0;
L2:;
  if (!((v1stream)==(VV[40]))){
   goto L18;
  }
  value0 = ECL_SYM("STREAM",1350);
  cl_env_copy->nvalues = 1;
  return value0;
L18:;
  value0 = v1stream;
  cl_env_copy->nvalues = 1;
  return value0;
 }
 }
}
/* local function NULL-STREAM                                                 */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2882null_stream(cl_object v1direction)
{
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 value0 = cl_open(5, VV[43], ECL_SYM("DIRECTION",1249), v1direction, ECL_SYM("IF-EXISTS",1279), ECL_SYM("OVERWRITE",1320));
 return value0;
}
static cl_object LC2882null_stream_va(cl_narg narg, cl_object v2direction, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[39]);
 {
  return LC2882null_stream(v2direction);
 }
}
/* local function PREPARE-ARGS                                                */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2881prepare_args(cl_object v1args)
{
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 value0 = v1args;
 cl_env_copy->nvalues = 1;
 return value0;
}
static cl_object LC2881prepare_args_va(cl_narg narg, cl_object v2args, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[42]);
 {
  return LC2881prepare_args(v2args);
 }
}
/* local function PROCESS-STREAM                                              */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2880process_stream(cl_narg narg, volatile cl_object *lex0, cl_object v1which, ...)
{
 cl_object T0;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 if (ecl_unlikely(narg<1)) FEwrong_num_arguments(VV[38]);
 {
  cl_object v2args;
  ecl_va_list args; ecl_va_start(args,v1which,narg,1);
  v2args = cl_grab_rest_args(args);
  ecl_va_end(args);
  goto L3;
L2:;
  T0 = cl_synonym_stream_symbol(v1which);
  v1which = cl_symbol_value(T0);
L3:;
  if (Null(si_of_class_p(2, v1which, ECL_SYM("SYNONYM-STREAM",851)))){
   goto L7;
  }
  goto L2;
L7:;
  if (!(v1which==ECL_NIL)){
   goto L9;
  }
  T0 = cl_getf(2, v2args, ECL_SYM("DIRECTION",1249));
  value0 = LC2882null_stream(T0);
  return value0;
L9:;
  if (ECL_STRINGP(v1which)) {
   goto L13;
  }
  if (Null(cl_pathnamep(v1which))){
   goto L11;
  }
  goto L12;
L13:;
L12:;
  T0 = (ECL_SYM("OPEN",613)->symbol.gfdef);
  value0 = cl_apply(5, T0, v1which, ECL_SYM("EXTERNAL-FORMAT",1267), lex0[0], v2args);
  return value0;
L11:;
  if (si_of_class_p(2, v1which, ECL_SYM("STRING-STREAM",819))!=ECL_NIL) {
   goto L18;
  }
  if (Null(si_of_class_p(2, v1which, ECL_SYM("FUNDAMENTAL-STREAM",1724)))){
   goto L16;
  }
  goto L17;
L18:;
L17:;
  value0 = VV[40];
  cl_env_copy->nvalues = 1;
  return value0;
L16:;
  if ((v1which)==(ECL_SYM("STREAM",1350))) {
   goto L22;
  }
  if (Null(cl_streamp(v1which))){
   goto L20;
  }
  goto L21;
L22:;
L21:;
  value0 = v1which;
  cl_env_copy->nvalues = 1;
  return value0;
L20:;
  value0 = cl_error(2, VV[41], v1which);
  return value0;
 }
}
/* local function THUNK                                                       */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC2884thunk(volatile cl_object *lex0)
{
 cl_object T0;
 cl_object env0 = ECL_NIL;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
L1:;
 {
  cl_object v1;
  cl_object v2pipe;
  cl_object v3;
  {
   cl_object v4;
   v4 = lex0[0];
   if (ecl_unlikely(!ECL_LISTP(v4))) FEtype_error_list(v4);
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 0;
   v1 = v4;
  }
  v2pipe = ECL_NIL;
  v3 = v1;
  {
   cl_object v4input;
   cl_object v5output;
   cl_object v6type;
   v4input = ECL_NIL;
   v5output = ECL_NIL;
   v6type = ECL_NIL;
L10:;
   if (!(ecl_endp(v3))){
    goto L12;
   }
   goto L11;
L12:;
   v2pipe = ECL_CONS_CAR(v3);
   {
    cl_object v7;
    v7 = ECL_CONS_CDR(v3);
    if (ecl_unlikely(!ECL_LISTP(v7))) FEtype_error_list(v7);
    value0 = ECL_NIL;
    cl_env_copy->nvalues = 0;
    v3 = v7;
   }
   {
    cl_object v7;
    v7 = v2pipe;
    v4input = ecl_car(v7);
    v7 = ecl_cdr(v7);
    v5output = ecl_car(v7);
    v7 = ecl_cdr(v7);
    v6type = ecl_car(v7);
   }
   T0 = cl_open_stream_p(v5output);
   if (T0==ECL_NIL) {
    goto L33;
   }
   T0 = cl_open_stream_p(v4input);
   if (T0==ECL_NIL) {
    goto L33;
   }
   {
    cl_object v7next_char;
    v7next_char = cl_read_char_no_hang(3, v4input, ECL_NIL, ECL_SYM("EOF",1259));
    if (!((v7next_char)==(ECL_SYM("EOF",1259)))){
     goto L37;
    }
    goto L32;
L37:;
    if (Null(v7next_char)){
     goto L39;
    }
    cl_unread_char(2, v7next_char, v4input);
    if (Null(si_copy_stream(v4input, v5output, ECL_NIL))){
     goto L31;
    }
    goto L32;
L39:;
    goto L31;
   }
L33:;
L32:;
   if (!((v6type)==(ECL_SYM("INPUT",1289)))){
    goto L42;
   }
   cl_close(1, v5output);
L42:;
   lex0[1] = CONS(v2pipe,lex0[1]);
L31:;
   goto L10;
L11:;
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 1;
   return value0;
  }
 }
}
#include "clos/process.data"
#ifdef __cplusplus
extern "C"
#endif

ECL_DLLEXPORT void _eclHyXK6vLliCBi9_SSH0M881(cl_object flag)
{
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 cl_object *VVtemp;
 if (flag != OBJNULL){
 Cblock = flag;
 #ifndef ECL_DYNAMIC_VV
 flag->cblock.data = VV;
 #endif
 flag->cblock.data_size = VM;
 flag->cblock.temp_data_size = VMtemp;
 flag->cblock.data_text = compiler_data_text;
 flag->cblock.cfuns_size = compiler_cfuns_size;
 flag->cblock.cfuns = compiler_cfuns;
 flag->cblock.source = ecl_make_constant_base_string("SRC:LSP;PROCESS.LSP.NEWEST",-1);
 return;}
 #ifdef ECL_DYNAMIC_VV
 VV = Cblock->cblock.data;
 #endif
 Cblock->cblock.data_text = (const cl_object *)"@EcLtAg:_eclHyXK6vLliCBi9_SSH0M881@";
 VVtemp = Cblock->cblock.temp_data;
 ECL_DEFINE_SETF_FUNCTIONS
 {
  cl_object T0;
  cl_object volatile env0 = ECL_NIL;
/* MAKE-LOAD-FORMs                                                            */
/* TOP-LEVEL-FORMs                                                            */
  si_select_package(VVtemp[0]);
  ecl_cmp_defmacro(VV[50]);                       /*  WITH-PROCESS-LOCK       */
  si_define_structure(ECL_SYM("EXTERNAL-PROCESS",1844), _ecl_static_2, ECL_NIL, ECL_NIL, VVtemp[1], VVtemp[2], VV[6], ECL_NIL, ECL_NIL, ECL_NIL, VVtemp[3], ecl_make_int8_t(8), ECL_NIL, ECL_NIL, VV[7]);
  VV[8]=cl_find_class(1, ECL_SYM("EXTERNAL-PROCESS",1844));
  ecl_cmp_defun(VV[51]);                          /*  MAKE-EXTERNAL-PROCESS   */
  {
   cl_object v1package;
   v1package = cl_symbol_package(VV[10]);
   if (Null(v1package)){
    goto L11;
   }
   if (Null(si_package_locked_p(v1package))){
    goto L11;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L11;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[6], ECL_SYM("PACKAGE",1321), v1package);
  }
L11:;
  {
   cl_object volatile v2;
   v2 = ecl_make_cfun_va((cl_objectfn)LC2869__lambda16_va,ECL_NIL,Cblock,2);
   T0 = v2;
  }
  si_put_sysprop(VV[10], VV[11], T0);
  {
   cl_object v2package;
   v2package = cl_symbol_package(VV[3]);
   if (Null(v2package)){
    goto L19;
   }
   if (Null(si_package_locked_p(v2package))){
    goto L19;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L19;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[7], ECL_SYM("PACKAGE",1321), v2package);
  }
L19:;
  {
   cl_object volatile v3;
   v3 = ecl_make_cfun_va((cl_objectfn)LC2870__lambda21_va,ECL_NIL,Cblock,2);
   T0 = v3;
  }
  si_put_sysprop(VV[3], VV[11], T0);
  {
   cl_object v3package;
   v3package = cl_symbol_package(VV[14]);
   if (Null(v3package)){
    goto L27;
   }
   if (Null(si_package_locked_p(v3package))){
    goto L27;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L27;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[8], ECL_SYM("PACKAGE",1321), v3package);
  }
L27:;
  {
   cl_object volatile v4;
   v4 = ecl_make_cfun_va((cl_objectfn)LC2871__lambda26_va,ECL_NIL,Cblock,2);
   T0 = v4;
  }
  si_put_sysprop(VV[14], VV[11], T0);
  {
   cl_object v4package;
   v4package = cl_symbol_package(VV[16]);
   if (Null(v4package)){
    goto L35;
   }
   if (Null(si_package_locked_p(v4package))){
    goto L35;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L35;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[9], ECL_SYM("PACKAGE",1321), v4package);
  }
L35:;
  {
   cl_object volatile v5;
   v5 = ecl_make_cfun_va((cl_objectfn)LC2872__lambda31_va,ECL_NIL,Cblock,2);
   T0 = v5;
  }
  si_put_sysprop(VV[16], VV[11], T0);
  {
   cl_object v5package;
   v5package = cl_symbol_package(ECL_SYM("EXTERNAL-PROCESS-ERROR-STREAM",1848));
   if (Null(v5package)){
    goto L43;
   }
   if (Null(si_package_locked_p(v5package))){
    goto L43;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L43;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[10], ECL_SYM("PACKAGE",1321), v5package);
  }
L43:;
  {
   cl_object volatile v6;
   v6 = ecl_make_cfun_va((cl_objectfn)LC2873__lambda36_va,ECL_NIL,Cblock,2);
   T0 = v6;
  }
  si_put_sysprop(ECL_SYM("EXTERNAL-PROCESS-ERROR-STREAM",1848), VV[11], T0);
  {
   cl_object v6package;
   v6package = cl_symbol_package(ECL_SYM("EXTERNAL-PROCESS-OUTPUT",1847));
   if (Null(v6package)){
    goto L51;
   }
   if (Null(si_package_locked_p(v6package))){
    goto L51;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L51;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[11], ECL_SYM("PACKAGE",1321), v6package);
  }
L51:;
  {
   cl_object volatile v7;
   v7 = ecl_make_cfun_va((cl_objectfn)LC2874__lambda41_va,ECL_NIL,Cblock,2);
   T0 = v7;
  }
  si_put_sysprop(ECL_SYM("EXTERNAL-PROCESS-OUTPUT",1847), VV[11], T0);
  {
   cl_object v7package;
   v7package = cl_symbol_package(ECL_SYM("EXTERNAL-PROCESS-INPUT",1846));
   if (Null(v7package)){
    goto L59;
   }
   if (Null(si_package_locked_p(v7package))){
    goto L59;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L59;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[12], ECL_SYM("PACKAGE",1321), v7package);
  }
L59:;
  {
   cl_object volatile v8;
   v8 = ecl_make_cfun_va((cl_objectfn)LC2875__lambda46_va,ECL_NIL,Cblock,2);
   T0 = v8;
  }
  si_put_sysprop(ECL_SYM("EXTERNAL-PROCESS-INPUT",1846), VV[11], T0);
  {
   cl_object v8package;
   v8package = cl_symbol_package(ECL_SYM("EXTERNAL-PROCESS-PID",1845));
   if (Null(v8package)){
    goto L67;
   }
   if (Null(si_package_locked_p(v8package))){
    goto L67;
   }
   if (!(ecl_cmp_symbol_value(cl_env_copy,ECL_SYM("*IGNORE-PACKAGE-LOCKS*",1128))==ECL_NIL)){
    goto L67;
   }
   si_signal_simple_error(6, ECL_SYM("PACKAGE-ERROR",620), VVtemp[4], VVtemp[5], VVtemp[13], ECL_SYM("PACKAGE",1321), v8package);
  }
L67:;
  {
   cl_object volatile v9;
   v9 = ecl_make_cfun_va((cl_objectfn)LC2876__lambda51_va,ECL_NIL,Cblock,2);
   T0 = v9;
  }
  si_put_sysprop(ECL_SYM("EXTERNAL-PROCESS-PID",1845), VV[11], T0);
  ecl_cmp_defun(VV[52]);                          /*  EXTERNAL-PROCESS-STATUS */
  ecl_cmp_defun(VV[53]);                          /*  EXTERNAL-PROCESS-WAIT   */
  (void)0; /* No entry created for TERMINATE-PROCESS */
  ecl_cmp_defun(VV[54]);                          /*  FINALIZE-EXTERNAL-PROCESS */
  (void)0; /* No entry created for RUN-PROGRAM */
  ecl_cmp_defun(VV[55]);                          /*  PIPE-STREAMS            */
 }
}
