#include "opendylan/run-time.h"

/* Generated by Open Dylan 2014.1 for x86_64-linux */

/* Typedefs for referenced classes */

typedef struct {
  dylan_value wrapper;
  dylan_value instanceQ_iep_;
  dylan_value debug_name_;
  dylan_value class_implementation_class_;
  dylan_value class_subtype_bit_;
  dylan_value class_module_;
} _KLclassGVKd;

#define  define__KLmm_wrapperGVKi(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value mm_wrapper_implementation_class_; \
    dylan_value mm_wrapper_subtype_mask_; \
    DWORD mm_wrapper_fixed_part_; \
    DWORD mm_wrapper_variable_part_; \
    dylan_value mm_wrapper_number_patterns_; \
    DWORD mm_wrapper_pattern_element_[nrepeated+1]; \
  } _KLmm_wrapperGVKi_##nrepeated;
define__KLmm_wrapperGVKi(1);
define__KLmm_wrapperGVKi(0);

typedef struct {
  dylan_value wrapper;
} _KLobjectGVKd;

typedef struct {
  dylan_value wrapper;
} _KLunboundGVKe;

typedef struct {
  dylan_value wrapper;
} _KLbooleanGVKd;

typedef struct {
  dylan_value wrapper;
  dylan_value xep_;
  dylan_value function_signature_;
  dylan_value Pgf_cache_;
  dylan_value debug_name_;
  dylan_value generic_function_methods_;
  dylan_value discriminator_;
  dylan_value incremental_gf_module_;
  dylan_value incremental_gf_domain_info_;
  dylan_value incremental_gf_method_libraries_;
  dylan_value incremental_gf_properties_;
} _KLincremental_generic_functionGVKe;

typedef struct {
  dylan_value wrapper;
  dylan_value instanceQ_iep_;
  dylan_value debug_name_;
  dylan_value class_implementation_class_;
  dylan_value class_subtype_bit_;
  dylan_value class_module_;
} _KLfunction_classGVKi;

typedef struct {
  dylan_value wrapper;
  dylan_value head_;
  dylan_value tail_;
} _KLempty_listGVKd;

typedef struct {
  dylan_value wrapper;
  dylan_value xep_;
  dylan_value function_signature_;
  dylan_value mep_;
} _KLsimple_methodGVKe;

typedef struct {
  dylan_value wrapper;
  dylan_value signature_properties_;
  dylan_value signature_required_;
  dylan_value signature_values_;
} _KLsignatureAvaluesGVKi;

#define  define__KLsimple_object_vectorGVKd(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value size_; \
    dylan_value vector_element_[nrepeated+1]; \
  } _KLsimple_object_vectorGVKd_##nrepeated;
define__KLsimple_object_vectorGVKd(16);
define__KLsimple_object_vectorGVKd(2);

typedef struct {
  dylan_value wrapper;
} _KLintegerGVKd;


/* Typedefs for defined classes */


/* Referenced object declarations */

extern _KLclassGVKd KLclassGVKd;
extern _KLmm_wrapperGVKi_0 KLclassGVKdW;
extern _KLclassGVKd KLmm_wrapperGVKi;
extern _KLmm_wrapperGVKi_1 KLmm_wrapperGVKiW;
extern _KLclassGVKd KLobjectGVKd;
extern _KLmm_wrapperGVKi_0 KLobjectGVKdW;
extern _KLunboundGVKe KPunboundVKi;
extern _KLclassGVKd KLunboundGVKe;
extern _KLmm_wrapperGVKi_0 KLunboundGVKeW;
extern _KLbooleanGVKd KPtrueVKi;
extern _KLclassGVKd KLbooleanGVKd;
extern _KLmm_wrapperGVKi_0 KLbooleanGVKdW;
extern _KLbooleanGVKd KPfalseVKi;
extern _KLincremental_generic_functionGVKe Kforward_iteration_protocolVKd;
extern _KLfunction_classGVKi KLincremental_generic_functionGVKe;
extern _KLclassGVKd KLfunction_classGVKi;
extern _KLmm_wrapperGVKi_0 KLfunction_classGVKiW;
extern _KLmm_wrapperGVKi_0 KLincremental_generic_functionGVKeW;
extern _KLempty_listGVKd KPempty_listVKi;
extern _KLclassGVKd KLempty_listGVKd;
extern _KLmm_wrapperGVKi_0 KLempty_listGVKdW;
extern _KLmm_wrapperGVKi_0 KLpairGVKdW;
dylan_value KreverseXVKdMM2I (dylan_value l_);
extern _KLfunction_classGVKi KLsimple_methodGVKe;
extern _KLmm_wrapperGVKi_0 KLsimple_methodGVKeW;
extern _KLclassGVKd KLsignatureAvaluesGVKi;
extern _KLmm_wrapperGVKi_0 KLsignatureAvaluesGVKiW;
extern _KLsimple_object_vectorGVKd_2 KDsignature_Lexplicit_key_collectionG_typesVKi;
extern _KLclassGVKd KLsimple_object_vectorGVKd;
extern _KLmm_wrapperGVKi_0 KLsimple_object_vectorGVKdW;
extern _KLsimple_object_vectorGVKd_2 KDsignature_LsequenceG_typesVKi;
extern _KLclassGVKd KLintegerGVKd;
extern _KLmm_wrapperGVKi_0 KLintegerGVKdW;
extern _KLsimple_object_vectorGVKd_16 KDsignature_LintegerG_typesVKi;

/* Defined object declarations */

extern _KLsimple_methodGVKe Kmaximum_sequence_keyVKiMM0;
dylan_value Kmaximum_sequence_keyVKiMM0I (dylan_value);
extern _KLsimple_methodGVKe Kkey_sequenceVKdMM0;
dylan_value Kkey_sequenceVKdMM0I (dylan_value);
static _KLsignatureAvaluesGVKi K4;
static _KLsignatureAvaluesGVKi K5;

/* Indirection variables */


/* Variables */


/* Objects */

_KLsimple_methodGVKe Kmaximum_sequence_keyVKiMM0 = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K5,
  &Kmaximum_sequence_keyVKiMM0I
};

_KLsimple_methodGVKe Kkey_sequenceVKdMM0 = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K4,
  &Kkey_sequenceVKdMM0I
};

static _KLsignatureAvaluesGVKi K4 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (dylan_value) 33555461,
  &KDsignature_Lexplicit_key_collectionG_typesVKi,
  &KDsignature_LsequenceG_typesVKi
};

static _KLsignatureAvaluesGVKi K5 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (dylan_value) 33555461,
  &KDsignature_Lexplicit_key_collectionG_typesVKi,
  &KDsignature_LintegerG_typesVKi
};

/* Code */

dylan_value Kmaximum_sequence_keyVKiMM0I (dylan_value collection_) {
  dylan_value T2;
  dylan_value T3;
  dylan_value T4;
  dylan_value T5;
  dylan_value T6;
  dylan_value T7;
  dylan_value T8;
  dylan_value T9T, T9;
  dylan_value T10;
  dylan_value k_;
  dylan_value T12;
  dylan_value T13_0;
  dylan_value max_key_;
  dylan_value T15;
  dylan_value T16;
  dylan_value T17;
  dylan_value T18;
  dylan_value T19;
  DWORD T20;
  DWORD T21;
  dylan_value T22;

  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:38
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:40
  max_key_ = (dylan_value) -3;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  CONGRUENT_CALL_PROLOG(&Kforward_iteration_protocolVKd, 1);
  T2 = CONGRUENT_CALL1(collection_);
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T3 = T2;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T4 = MV_GET_ELT(1);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T5 = MV_GET_ELT(2);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T6 = MV_GET_ELT(3);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T7 = MV_GET_ELT(4);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T8 = MV_GET_ELT(5);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  T9T = T3;
L0: ;
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
    T9 = T9T;
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
    T10 = CALL3(T6, collection_, T9, T4);
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
    if (T10 == &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
      CALL2(T8, collection_, T9);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
      k_ = CALL2(T7, collection_, T9);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
      T18 = primitive_instanceQ(k_,&KLintegerGVKd);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
      if (T18 != &KPfalseVKi) {
        T17 = k_;
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        T16 = max_key_;
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        T20 = primitive_cast_integer_as_raw(T16);
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        T21 = primitive_cast_integer_as_raw(T17);
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        T22 = primitive_machine_word_less_thanQ(T20,T21);
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        if (T22 != &KPfalseVKi) {
          T19 = T17;
        } else {
          T19 = T16;
        }
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
        max_key_ = T19;
      }
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:42
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
      T12 = CALL2(T5, collection_, T9);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
      T9T = T12;
      goto L0;
    }
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:41
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:44
  T15 = max_key_;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:44
  T13_0 = T15;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:38
  MV_SET_COUNT(1);
  return(T13_0);
}

dylan_value Kkey_sequenceVKdMM0I (dylan_value collection_) {
  dylan_value T2;
  dylan_value T3;
  dylan_value T4;
  dylan_value T5;
  dylan_value T6;
  dylan_value T7;
  dylan_value T8;
  dylan_value keys_T, keys_;
  dylan_value T10T, T10;
  dylan_value T11;
  dylan_value k_;
  dylan_value T13;
  dylan_value T14;
  dylan_value T15_0;

  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:24
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  CONGRUENT_CALL_PROLOG(&Kforward_iteration_protocolVKd, 1);
  T2 = CONGRUENT_CALL1(collection_);
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  T3 = T2;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  T4 = MV_GET_ELT(1);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  T5 = MV_GET_ELT(2);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  T6 = MV_GET_ELT(3);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  T7 = MV_GET_ELT(4);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  T8 = MV_GET_ELT(5);
;
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  keys_T = &KPempty_listVKi;
  T10T = T3;
L0: ;
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
    keys_ = keys_T;
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
    T10 = T10T;
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
    T11 = CALL3(T6, collection_, T10, T4);
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
    if (T11 == &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      CALL2(T8, collection_, T10);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      k_ = CALL2(T7, collection_, T10);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      T14 = primitive_object_allocate_filled(3,&KLpairGVKdW,2,&KPunboundVKi,0,0,&KPunboundVKi);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      SLOT_VALUE_SETTER(k_, T14, 0);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      SLOT_VALUE_SETTER(keys_, T14, 1);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      T13 = CALL2(T5, collection_, T10);
      // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
      keys_T = T14;
      T10T = T13;
      goto L0;
    }
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:29
    T15_0 = KreverseXVKdMM2I(keys_);
    // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:26
  // /home/bruce/Development/dylan/opendylan/sources/dylan/explicit-key-collection.dylan:24
  MV_SET_COUNT(1);
  return(T15_0);
}


/* SYSTEM INIT CODE */

void _Init_dylan__X_explicit_key_collection_for_system () {
  extern dylan_value KPresolve_symbolVKiI(dylan_value);
  return;
}

/* USER INIT CODE */

void _Init_dylan__X_explicit_key_collection_for_user () {
  return;
}


/* eof */
