#include "run-time.h"

/* Typedefs for referenced classes */

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

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

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

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

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

typedef struct {
  D wrapper;
} _KLintegerGVKd;

typedef struct {
  D wrapper;
} _KLobjectGVKd;

typedef struct {
  D wrapper;
} _KLunboundGVKe;

typedef struct {
  D wrapper;
} _KLbooleanGVKd;

typedef struct {
  D wrapper;
  D head_;
  D tail_;
} _KLpairGVKd;

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

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

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


/* Typedefs for defined classes */


/* Referenced object declarations */

D KCVKdMM0I (D, D);
extern _KLempty_listGVKd KPempty_listVKi;
extern _KLclassGVKd KLempty_listGVKd;
extern _KLclassGVKd KLclassGVKd;
extern _KLmm_wrapperGVKi_0 KLclassGVKdW;
extern _KLclassGVKd KLmm_wrapperGVKi;
extern _KLmm_wrapperGVKi_1 KLmm_wrapperGVKiW;
extern _KLmm_wrapperGVKi_0 KLempty_listGVKdW;
extern _KLincremental_generic_functionGVKe K_VKd;
extern _KLfunction_classGVKi KLincremental_generic_functionGVKe;
extern _KLclassGVKd KLfunction_classGVKi;
extern _KLmm_wrapperGVKi_0 KLfunction_classGVKiW;
extern _KLmm_wrapperGVKi_0 KLincremental_generic_functionGVKeW;
extern _KLclassGVKd KLintegerGVKd;
extern _KLmm_wrapperGVKi_0 KLintegerGVKdW;
extern _KLincremental_generic_functionGVKe KnegativeVKd;
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 _KLclassGVKd KLpairGVKd;
extern _KLmm_wrapperGVKi_0 KLpairGVKdW;
extern _KLfunction_classGVKi KLsimple_methodGVKe;
extern _KLmm_wrapperGVKi_0 KLsimple_methodGVKeW;
extern _KLclassGVKd KLsignatureAvaluesGVKi;
extern _KLmm_wrapperGVKi_0 KLsignatureAvaluesGVKiW;
extern _KLsimple_object_vectorGVKd_16 KDsignature_LintegerG_typesVKi;
extern _KLclassGVKd KLsimple_object_vectorGVKd;
extern _KLmm_wrapperGVKi_0 KLsimple_object_vectorGVKdW;

/* Defined object declarations */

extern _KLsimple_methodGVKe Ktag_as_addressVdood;
D Ktag_as_addressVdoodI (D object_, D address_);
static _KLsignatureAvaluesGVKi K4;
static _KLsimple_object_vectorGVKd_2 K5;

/* Indirection variables */


/* Variables */

D Ldood_disk_addressGVdood = &KLintegerGVKd;
D Ldood_disk_pointerGVdood = &KLintegerGVKd;
D Dmax_dood_integerVdood = &KPunboundVKi;
D Dmin_dood_integerVdood = &KPunboundVKi;
D tag_as_addressVdood = &Ktag_as_addressVdood;

/* Objects */

_KLsimple_methodGVKe Ktag_as_addressVdood = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_2,
  &K4,
  &Ktag_as_addressVdoodI
};

static _KLsignatureAvaluesGVKi K4 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (D) 33555465,
  &K5,
  &KDsignature_LintegerG_typesVKi
};

static _KLsimple_object_vectorGVKd_2 K5 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (D) 9,
  &KLobjectGVKd,
  &KLintegerGVKd
};

/* Code */

D Ktag_as_addressVdoodI (D object_, D address_) {
  D T2_0;
  D T3;
  D shiftF4;
  DWORD T5;
  DWORD T6;
  DWORD mxF7;
  D T8;
  DWORD T9;
  D T10;
  D T11;
  DWORD T12;
  DWORD T13;
  DWORD T14;
  DWORD T15;
  D T16;
  DWORD T17;
  DWORD T18;
  DWORD T19;
  DWORD T20;
  D T21_0;
  DWORD T22;
  D T23;
  D shiftF24;
  DWORD T25;
  DWORD T26;
  DWORD mxF27;
  D T28;
  DWORD T29;
  D T30;
  D T31;
  DWORD T32;
  DWORD T33;
  DWORD T34;
  DWORD T35;
  D T36;
  DWORD T37;
  DWORD T38;
  DWORD T39;
  DWORD T40;
  D T41_0;
  DWORD T42;
  D T43;

  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:99
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:101
  T3 = primitive_instanceQ(object_,&KLpairGVKd);
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:101
  if (T3 != &KPfalseVKi) {
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    shiftF4 = (D) 9;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T5 = primitive_cast_integer_as_raw(address_);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T6 = primitive_machine_word_logxor(T5,1);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    mxF7 = T6;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T8 = shiftF4;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T9 = primitive_cast_integer_as_raw(T8);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T10 = primitive_machine_word_equalQ(T9,129);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    if (T10 != &KPfalseVKi) {
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      shiftF4 = (D) 65;
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      T11 = shiftF4;
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      T12 = mxF7;
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      T13 = primitive_cast_integer_as_raw(T11);
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      T14 = primitive_machine_word_shift_right(T13,2);
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      T15 = primitive_machine_word_shift_left_signal_overflow(T12,T14);
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
      mxF7 = T15;
    }
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T16 = shiftF4;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T17 = mxF7;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T18 = primitive_cast_integer_as_raw(T16);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T19 = primitive_machine_word_shift_right(T18,2);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T20 = primitive_machine_word_shift_left_signal_overflow(T17,T19);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T22 = primitive_machine_word_logior(T20,5);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T23 = primitive_cast_raw_as_integer(T22);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:102
    T21_0 = T23;
    T2_0 = T21_0;
  } else {
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    shiftF24 = (D) 9;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T25 = primitive_cast_integer_as_raw(address_);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T26 = primitive_machine_word_logxor(T25,1);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    mxF27 = T26;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T28 = shiftF24;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T29 = primitive_cast_integer_as_raw(T28);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T30 = primitive_machine_word_equalQ(T29,129);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    if (T30 != &KPfalseVKi) {
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      shiftF24 = (D) 65;
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      T31 = shiftF24;
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      T32 = mxF27;
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      T33 = primitive_cast_integer_as_raw(T31);
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      T34 = primitive_machine_word_shift_right(T33,2);
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      T35 = primitive_machine_word_shift_left_signal_overflow(T32,T34);
      // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
      mxF27 = T35;
    }
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T36 = shiftF24;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T37 = mxF27;
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T38 = primitive_cast_integer_as_raw(T36);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T39 = primitive_machine_word_shift_right(T38,2);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T40 = primitive_machine_word_shift_left_signal_overflow(T37,T39);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T42 = primitive_machine_word_logior(T40,1);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T43 = primitive_cast_raw_as_integer(T42);
    // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:104
    T41_0 = T43;
    T2_0 = T41_0;
  }
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:101
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:99
  MV_SET_COUNT(1);
  return(T2_0);
}


/* SYSTEM INIT CODE */

void _Init_dood__X_types_for_system () {
  extern D KPresolve_symbolVKiI(D);
  return;
}

/* USER INIT CODE */

void _Init_dood__X_types_for_user () {
{
  D T0;
  D Dmax_dood_integer_tmp_;
  D T2;
  D T3;

  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:34
  T3 = KCVKdMM0I((D) 9, (D) 109);
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:34
  CONGRUENT_CALL_PROLOG(&K_VKd, 2);
  T0 = CONGRUENT_CALL2(T3, (D) 5);
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:33
  primitive_type_check(T0, &KLintegerGVKd);
  Dmax_dood_integer_tmp_ = T0;
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:33
  Dmax_dood_integerVdood = Dmax_dood_integer_tmp_;
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:33
  T2 = &KPfalseVKi;
  goto I0;
}
I0:

{
  D T0;
  D Dmin_dood_integer_tmp_;
  D T2;
  D T3;

  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:36
  T3 = KCVKdMM0I((D) 9, (D) 109);
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:36
  CONGRUENT_CALL_PROLOG(&KnegativeVKd, 1);
  T0 = CONGRUENT_CALL1(T3);
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:35
  primitive_type_check(T0, &KLintegerGVKd);
  Dmin_dood_integer_tmp_ = T0;
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:35
  Dmin_dood_integerVdood = Dmin_dood_integer_tmp_;
  // /Users/bruce/Development/dylan/opendylan/sources/lib/dood/types.dylan:35
  T2 = &KPfalseVKi;
  goto I1;
}
I1:

  return;
}


/* eof */
