/* Compiler: ECL 26.3.27                                                      */
/* Source: /build/ecl/src/ecl-26.3.27/src/cmp/cmpclos.lsp                     */
#include <ecl/ecl-cmp.h>
#include "cmp/cmpclos.eclh"
/* function definition for MAYBE-OPTIMIZE-GENERIC-FUNCTION                    */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L4079maybe_optimize_generic_function(cl_object v1fname, cl_object v2args)
{
 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:;
 if (Null(cl_fboundp(v1fname))){
  goto L2;
 }
 {
  cl_object v3gf;
  v3gf = cl_fdefinition(v1fname);
  if (Null(si_of_class_p(2, v3gf, ECL_SYM("STANDARD-GENERIC-FUNCTION",978)))){
   goto L5;
  }
  if (Null((cl_env_copy->function=ecl_fdefinition(VV[1]))->cfun.entry(0) /*  POLICY-INLINE-SLOT-ACCESS */)){
   goto L7;
  }
  value0 = L4083maybe_optimize_slot_accessor(v1fname, v3gf, v2args);
  return value0;
L7:;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
L5:;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
 }
L2:;
 value0 = ECL_NIL;
 cl_env_copy->nvalues = 1;
 return value0;
}
static cl_object L4079maybe_optimize_generic_function_va(cl_narg narg, cl_object v4fname, cl_object v5args, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[0]);
 {
  return L4079maybe_optimize_generic_function(v4fname, v5args);
 }
}
/* function definition for PRECOMPUTE-APPLICABLE-METHODS                      */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L4081precompute_applicable_methods(cl_object v1methods, cl_object v2c_args)
{
 cl_object env0 = ECL_NIL;
 cl_object CLV0;
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
 ecl_cs_check(cl_env_copy,value0);
 env0 = ECL_NIL;
 CLV0 = env0 = CONS(v2c_args,env0);               /*  C-ARGS                  */
 {
  cl_object v3;
  v3 = ecl_make_cclosure_va((cl_objectfn)LC4080applicable_method_p,env0,Cblock,1);
  value0 = cl_delete_if_not(2, v3, v1methods);
  return value0;
 }
}
static cl_object L4081precompute_applicable_methods_va(cl_narg narg, cl_object v4methods, cl_object v5c_args, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[4]);
 {
  return L4081precompute_applicable_methods(v4methods, v5c_args);
 }
}
/* function definition for FIND-SLOT-ACCESSORS                                */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L4082find_slot_accessors(cl_object v1gf)
{
 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;
  cl_object v3method;
  cl_object v4;
  {
   cl_object v5;
   v5 = (cl_env_copy->function=(ECL_SYM("GENERIC-FUNCTION-METHODS",1600)->symbol.gfdef))->cfun.entry(1, v1gf) /*  GENERIC-FUNCTION-METHODS */;
   if (ecl_unlikely(!ECL_LISTP(v5))) FEtype_error_list(v5);
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 0;
   v2 = v5;
  }
  v3method = ECL_NIL;
  v4 = v2;
  {
   cl_object v5readers;
   v5readers = ECL_NIL;
   {
    cl_object v6writers;
    v6writers = ECL_NIL;
    {
     cl_object v7reader_class;
     v7reader_class = cl_find_class(1, ECL_SYM("STANDARD-READER-METHOD",1640));
     {
      cl_object v8writer_class;
      v8writer_class = cl_find_class(1, ECL_SYM("STANDARD-WRITER-METHOD",1642));
L11:;
      if (!(ecl_endp(v4))){
       goto L13;
      }
      goto L12;
L13:;
      v3method = ECL_CONS_CAR(v4);
      {
       cl_object v9;
       v9 = ECL_CONS_CDR(v4);
       if (ecl_unlikely(!ECL_LISTP(v9))) FEtype_error_list(v9);
       value0 = ECL_NIL;
       cl_env_copy->nvalues = 0;
       v4 = v9;
      }
      {
       cl_object v9method_class;
       v9method_class = cl_class_of(v3method);
       if (Null(si_subclassp(2, v9method_class, v7reader_class))){
        goto L23;
       }
       v5readers = CONS(v3method,v5readers);
       goto L21;
L23:;
       if (Null(si_subclassp(2, v9method_class, v8writer_class))){
        goto L21;
       }
       v6writers = CONS(v3method,v6writers);
      }
L21:;
      goto L11;
L12:;
      cl_env_copy->nvalues = 2;
      cl_env_copy->values[1] = v6writers;
      cl_env_copy->values[0] = v5readers;
      return cl_env_copy->values[0];
     }
    }
   }
  }
 }
}
static cl_object L4082find_slot_accessors_va(cl_narg narg, cl_object v9gf, ...)
{
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[11]);
 {
  return L4082find_slot_accessors(v9gf);
 }
}
/* function definition for MAYBE-OPTIMIZE-SLOT-ACCESSOR                       */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L4083maybe_optimize_slot_accessor(cl_object v1fname, cl_object v2gf, cl_object v3args)
{
 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 v4;                                   /*  READERS                 */
  cl_object v5;                                   /*  WRITERS                 */
  value0 = L4082find_slot_accessors(v2gf);
  {
   const int v6 = cl_env_copy->nvalues;
   v4 = value0;
   cl_object v7;
   v7 = (v6<=1)? ECL_NIL : cl_env_copy->values[1];
   v5 = v7;
  }
  if (Null(v4)){
   goto L3;
  }
  if (Null(v5)){
   goto L3;
  }
  value0 = (cl_env_copy->function=ecl_fdefinition(VV[13]))->cfun.entry(2, VV[14], v1fname) /*  CMPWARN */;
  return value0;
L3:;
  if (v4!=ECL_NIL) {
   goto L6;
  }
  if (v5!=ECL_NIL) {
   goto L6;
  }
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
L6:;
  {
   cl_fixnum v6;
   v6 = ecl_length(v3args);
   T0 = (cl_env_copy->function=(VV[15]->symbol.gfdef))->cfun.entry(1, v2gf) /*  GENERIC-FUNCTION-SPEC-LIST */;
   {
    cl_fixnum v7;
    v7 = ecl_length(T0);
    if (!((v6)!=(v7))){
     goto L9;
    }
   }
  }
  (cl_env_copy->function=ecl_fdefinition(VV[13]))->cfun.entry(2, VV[16], v1fname) /*  CMPWARN */;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
L9:;
  if (Null(v4)){
   goto L12;
  }
  value0 = L4084try_optimize_slot_reader(v4, v3args);
  return value0;
L12:;
  if (Null(v5)){
   goto L14;
  }
  value0 = L4085try_optimize_slot_writer(v5, v3args);
  return value0;
L14:;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
 }
}
static cl_object L4083maybe_optimize_slot_accessor_va(cl_narg narg, cl_object v4fname, cl_object v5gf, cl_object v6args, ...)
{
 if (ecl_unlikely(narg!=3)) FEwrong_num_arguments(VV[2]);
 {
  return L4083maybe_optimize_slot_accessor(v4fname, v5gf, v6args);
 }
}
/* function definition for TRY-OPTIMIZE-SLOT-READER                           */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L4084try_optimize_slot_reader(cl_object v1readers, cl_object v2args)
{
 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 v3object;
  cl_object v4c_object;
  cl_object v5readers;
  v3object = ecl_car(v2args);
  v4c_object = (cl_env_copy->function=ecl_fdefinition(VV[20]))->cfun.entry(1, v3object) /*  C1EXPR */;
  T0 = ecl_list1(v4c_object);
  v5readers = L4081precompute_applicable_methods(v1readers, T0);
  {
   cl_fixnum v6;
   v6 = ecl_length(v5readers);
   if (!((v6)==((cl_fixnum)(1)))){
    goto L5;
   }
  }
  {
   cl_object v6reader;
   v6reader = ecl_car(v5readers);
   if (Null(si_of_class_p(2, v6reader, ECL_SYM("STANDARD-READER-METHOD",1640)))){
    goto L8;
   }
   {
    cl_object v7slotd;
    cl_object v8index;
    v7slotd = (cl_env_copy->function=(ECL_SYM("ACCESSOR-METHOD-SLOT-DEFINITION",1558)->symbol.gfdef))->cfun.entry(1, v6reader) /*  ACCESSOR-METHOD-SLOT-DEFINITION */;
    v8index = (cl_env_copy->function=(VV[21]->symbol.gfdef))->cfun.entry(1, v7slotd) /*  SAFE-SLOT-DEFINITION-LOCATION */;
    if (!(ECL_FIXNUMP(v8index))){
     goto L12;
    }
    value0 = cl_list(3, ECL_SYM("SAFE-INSTANCE-REF",1656), v3object, v8index);
    return value0;
L12:;
    value0 = ECL_NIL;
    cl_env_copy->nvalues = 1;
    return value0;
   }
L8:;
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 1;
   return value0;
  }
L5:;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
 }
}
static cl_object L4084try_optimize_slot_reader_va(cl_narg narg, cl_object v9readers, cl_object v10args, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[17]);
 {
  return L4084try_optimize_slot_reader(v9readers, v10args);
 }
}
/* function definition for TRY-OPTIMIZE-SLOT-WRITER                           */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object L4085try_optimize_slot_writer(cl_object v1orig_writers, cl_object v2args)
{
 cl_object T0, T1;
 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 v3c_args;
  cl_object v4writers;
  {
   cl_object v5;
   v5 = ecl_fdefinition(VV[20]);
   {
    cl_object v6;
    cl_object v7;
    cl_object v8;
    {
     cl_object v9;
     v9 = v2args;
     if (ecl_unlikely(!ECL_LISTP(v9))) FEtype_error_list(v9);
     value0 = ECL_NIL;
     cl_env_copy->nvalues = 0;
     v6 = v9;
    }
    v7 = ECL_NIL;
    v8 = v6;
    {
     cl_object v9;
     cl_object v10;
     v9 = ecl_list1(ECL_NIL);
     v10 = v9;
L11:;
     if (!(ecl_endp(v8))){
      goto L13;
     }
     goto L12;
L13:;
     v7 = ECL_CONS_CAR(v8);
     {
      cl_object v11;
      v11 = ECL_CONS_CDR(v8);
      if (ecl_unlikely(!ECL_LISTP(v11))) FEtype_error_list(v11);
      value0 = ECL_NIL;
      cl_env_copy->nvalues = 0;
      v8 = v11;
     }
     {
      cl_object v11;
      v11 = v10;
      if (ecl_unlikely(ECL_ATOM(v11))) FEtype_error_cons(v11);
      value0 = ECL_NIL;
      cl_env_copy->nvalues = 0;
      T0 = v11;
     }
     T1 = ecl_function_dispatch(cl_env_copy,v5)(1, v7);
     v10 = ecl_list1(T1);
     (ECL_CONS_CDR(T0)=v10,T0);
     goto L11;
L12:;
     v3c_args = ecl_cdr(v9);
     goto L2;
    }
   }
  }
L2:;
  v4writers = L4081precompute_applicable_methods(v1orig_writers, v3c_args);
  {
   cl_fixnum v5;
   v5 = ecl_length(v4writers);
   if (!((v5)==((cl_fixnum)(1)))){
    goto L30;
   }
  }
  {
   cl_object v5writer;
   v5writer = ecl_car(v4writers);
   if (Null(si_of_class_p(2, v5writer, ECL_SYM("STANDARD-WRITER-METHOD",1642)))){
    goto L33;
   }
   {
    cl_object v6slotd;
    cl_object v7index;
    v6slotd = (cl_env_copy->function=(ECL_SYM("ACCESSOR-METHOD-SLOT-DEFINITION",1558)->symbol.gfdef))->cfun.entry(1, v5writer) /*  ACCESSOR-METHOD-SLOT-DEFINITION */;
    v7index = (cl_env_copy->function=(VV[21]->symbol.gfdef))->cfun.entry(1, v6slotd) /*  SAFE-SLOT-DEFINITION-LOCATION */;
    if (!(ECL_FIXNUMP(v7index))){
     goto L37;
    }
    T0 = ecl_cadr(v2args);
    T1 = ecl_car(v2args);
    value0 = cl_list(4, ECL_SYM("INSTANCE-SET",1197), T0, v7index, T1);
    return value0;
L37:;
    value0 = ECL_NIL;
    cl_env_copy->nvalues = 1;
    return value0;
   }
L33:;
   value0 = ECL_NIL;
   cl_env_copy->nvalues = 1;
   return value0;
  }
L30:;
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
 }
}
static cl_object L4085try_optimize_slot_writer_va(cl_narg narg, cl_object v8orig_writers, cl_object v9args, ...)
{
 if (ecl_unlikely(narg!=2)) FEwrong_num_arguments(VV[18]);
 {
  return L4085try_optimize_slot_writer(v8orig_writers, v9args);
 }
}
/* closure APPLICABLE-METHOD-P                                                */
/* optimize speed 1, debug 1, space 1, safety 2                               */
static cl_object LC4080applicable_method_p(cl_narg narg, cl_object v1m, ...)
{
 cl_object T0, T1;
 cl_object CLV0;
 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 ... */
 CLV0 = env0;                                     /*  C-ARGS                  */
 { /* ... closure scanning finished */
 if (ecl_unlikely(narg!=1)) FEwrong_num_arguments(VV[5]);
 {
L1:;
  {
   cl_object v2;
   cl_object v3specializer;
   cl_object v4;
   {
    cl_object v5;
    v5 = (cl_env_copy->function=(ECL_SYM("METHOD-SPECIALIZERS",1610)->symbol.gfdef))->cfun.entry(1, v1m) /*  METHOD-SPECIALIZERS */;
    if (ecl_unlikely(!ECL_LISTP(v5))) FEtype_error_list(v5);
    value0 = ECL_NIL;
    cl_env_copy->nvalues = 0;
    v2 = v5;
   }
   v3specializer = ECL_NIL;
   v4 = v2;
   {
    cl_object v5;
    cl_object v6arg;
    cl_object v7;
    {
     cl_object v8;
     v8 = ECL_CONS_CAR(CLV0);
     if (ecl_unlikely(!ECL_LISTP(v8))) FEtype_error_list(v8);
     value0 = ECL_NIL;
     cl_env_copy->nvalues = 0;
     v5 = v8;
    }
    v6arg = ECL_NIL;
    v7 = v5;
L12:;
    if (!(ecl_endp(v4))){
     goto L14;
    }
    goto L13;
L14:;
    v3specializer = ECL_CONS_CAR(v4);
    {
     cl_object v8;
     v8 = ECL_CONS_CDR(v4);
     if (ecl_unlikely(!ECL_LISTP(v8))) FEtype_error_list(v8);
     value0 = ECL_NIL;
     cl_env_copy->nvalues = 0;
     v4 = v8;
    }
    if (!(ecl_endp(v7))){
     goto L22;
    }
    goto L13;
L22:;
    v6arg = ECL_CONS_CAR(v7);
    {
     cl_object v8;
     v8 = ECL_CONS_CDR(v7);
     if (ecl_unlikely(!ECL_LISTP(v8))) FEtype_error_list(v8);
     value0 = ECL_NIL;
     cl_env_copy->nvalues = 0;
     v7 = v8;
    }
    {
     cl_object v8arg_type;
     v8arg_type = (cl_env_copy->function=ecl_fdefinition(VV[8]))->cfun.entry(1, v6arg) /*  C1FORM-TYPE */;
     if (!(ECL_CONSP(v3specializer))){
      goto L34;
     }
     T1 = ecl_cadr(v3specializer);
     T0 = cl_list(2, ECL_SYM("MEMBER",554), T1);
     goto L33;
L34:;
     T0 = v3specializer;
L33:;
     if (cl_subtypep(3, v8arg_type, T0, ecl_cmp_symbol_value(cl_env_copy,VV[9]))!=ECL_NIL) {
      goto L30;
     }
    }
    value0 = ECL_NIL;
    cl_env_copy->nvalues = 1;
    return value0;
L30:;
    goto L12;
L13:;
    value0 = ECL_T;
    cl_env_copy->nvalues = 1;
    return value0;
   }
  }
 }
 }
}
#include "cmp/cmpclos.data"
#ifdef __cplusplus
extern "C"
#endif

ECL_DLLEXPORT void _eclrFmz321dtUOk9_PJg0M881(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:CMP;CMPCLOS.LSP.NEWEST",-1);
 return;}
 #ifdef ECL_DYNAMIC_VV
 VV = Cblock->cblock.data;
 #endif
 Cblock->cblock.data_text = (const cl_object *)"@EcLtAg:_eclrFmz321dtUOk9_PJg0M881@";
 VVtemp = Cblock->cblock.temp_data;
 ECL_DEFINE_SETF_FUNCTIONS
/* MAKE-LOAD-FORMs                                                            */
/* TOP-LEVEL-FORMs                                                            */
  si_select_package(VVtemp[0]);
  ecl_cmp_defun(VV[27]);                          /*  MAYBE-OPTIMIZE-GENERIC-FUNCTION */
  ecl_cmp_defun(VV[28]);                          /*  PRECOMPUTE-APPLICABLE-METHODS */
  ecl_cmp_defun(VV[29]);                          /*  FIND-SLOT-ACCESSORS     */
  ecl_cmp_defun(VV[30]);                          /*  MAYBE-OPTIMIZE-SLOT-ACCESSOR */
  ecl_cmp_defun(VV[31]);                          /*  TRY-OPTIMIZE-SLOT-READER */
  ecl_cmp_defun(VV[32]);                          /*  TRY-OPTIMIZE-SLOT-WRITER */
}
