#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 mep_;
} _KLsimple_methodGVKe;

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 signature_properties_;
  dylan_value signature_required_;
} _KLsignatureGVKe;

#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(3);
define__KLsimple_object_vectorGVKd(2);
define__KLsimple_object_vectorGVKd(16);

typedef struct {
  dylan_value wrapper;
  D raw_pointer_address_;
} _KLc_pointerGVKc;

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_;
  dylan_value alignment_of_;
  dylan_value size_of_;
  dylan_value referenced_type_;
  dylan_value concrete_pointer_type_;
  dylan_value abstract_pointer_type_;
} _KLdesignator_classGVKc;

typedef struct {
  dylan_value wrapper;
} _KLintegerGVKd;

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


/* 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 _KLfunction_classGVKi KLsimple_methodGVKe;
extern _KLclassGVKd KLfunction_classGVKi;
extern _KLmm_wrapperGVKi_0 KLfunction_classGVKiW;
extern _KLmm_wrapperGVKi_0 KLsimple_methodGVKeW;
extern _KLclassGVKd KLsignatureGVKe;
extern _KLmm_wrapperGVKi_0 KLsignatureGVKeW;
extern _KLclassGVKd KLsimple_object_vectorGVKd;
extern _KLmm_wrapperGVKi_0 KLsimple_object_vectorGVKdW;
extern _KLdesignator_classGVKc KLc_pointerGVKc;
extern _KLclassGVKd KLdesignator_classGVKc;
extern _KLmm_wrapperGVKi_0 KLdesignator_classGVKcW;
extern _KLmm_wrapperGVKi_1 KLc_pointerGVKcW;
extern _KLclassGVKd KLintegerGVKd;
extern _KLmm_wrapperGVKi_0 KLintegerGVKdW;
extern _KLclassGVKd KLsignatureAvaluesGVKi;
extern _KLmm_wrapperGVKi_0 KLsignatureAvaluesGVKiW;
extern _KLsimple_object_vectorGVKd_16 KDsignature_LbooleanG_typesVKi;

/* Defined object declarations */

extern _KLsimple_methodGVKe Kclear_memoryXYc_ffi_interfaceVc_ffi;
dylan_value Kclear_memoryXYc_ffi_interfaceVc_ffiI (dylan_value pointer_, dylan_value size_in_bytes_);
static _KLsignatureGVKe K2;
static _KLsimple_object_vectorGVKd_2 K3;
extern _KLsimple_methodGVKe Kequal_memoryQYc_ffi_interfaceVc_ffi;
dylan_value Kequal_memoryQYc_ffi_interfaceVc_ffiI (dylan_value pointer_1_, dylan_value pointer_2_, dylan_value size_in_bytes_);
static _KLsignatureAvaluesGVKi K6;
static _KLsimple_object_vectorGVKd_3 K7;
extern _KLsimple_methodGVKe Kcopy_bytesXYc_ffi_interfaceVc_ffi;
dylan_value Kcopy_bytesXYc_ffi_interfaceVc_ffiI (dylan_value destination_, dylan_value source_, dylan_value size_);
static _KLsignatureGVKe K10;
extern _KLsimple_methodGVKe Kcopy_intoXYc_ffi_interfaceVc_ffi;
dylan_value Kcopy_intoXYc_ffi_interfaceVc_ffiI (dylan_value destination_, dylan_value source_, dylan_value size_in_bytes_);

/* Indirection variables */


/* Variables */

dylan_value copy_intoXYc_ffi_interfaceVc_ffi = &Kcopy_intoXYc_ffi_interfaceVc_ffi;
dylan_value copy_bytesXYc_ffi_interfaceVc_ffi = &Kcopy_bytesXYc_ffi_interfaceVc_ffi;
dylan_value equal_memoryQYc_ffi_interfaceVc_ffi = &Kequal_memoryQYc_ffi_interfaceVc_ffi;
dylan_value clear_memoryXYc_ffi_interfaceVc_ffi = &Kclear_memoryXYc_ffi_interfaceVc_ffi;

/* Objects */

_KLsimple_methodGVKe Kclear_memoryXYc_ffi_interfaceVc_ffi = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_2,
  &K2,
  &Kclear_memoryXYc_ffi_interfaceVc_ffiI
};

static _KLsignatureGVKe K2 = {
  &KLsignatureGVKeW /* wrapper */,
  (dylan_value) 41943049,
  &K3
};

static _KLsimple_object_vectorGVKd_2 K3 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (dylan_value) 9,
  &KLc_pointerGVKc,
  &KLintegerGVKd
};

_KLsimple_methodGVKe Kequal_memoryQYc_ffi_interfaceVc_ffi = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_3,
  &K6,
  &Kequal_memoryQYc_ffi_interfaceVc_ffiI
};

static _KLsignatureAvaluesGVKi K6 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (dylan_value) 33555469,
  &K7,
  &KDsignature_LbooleanG_typesVKi
};

static _KLsimple_object_vectorGVKd_3 K7 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (dylan_value) 13,
  &KLc_pointerGVKc,
  &KLc_pointerGVKc,
  &KLintegerGVKd
};

_KLsimple_methodGVKe Kcopy_bytesXYc_ffi_interfaceVc_ffi = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_3,
  &K10,
  &Kcopy_bytesXYc_ffi_interfaceVc_ffiI
};

static _KLsignatureGVKe K10 = {
  &KLsignatureGVKeW /* wrapper */,
  (dylan_value) 41943053,
  &K7
};

_KLsimple_methodGVKe Kcopy_intoXYc_ffi_interfaceVc_ffi = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_3,
  &K10,
  &Kcopy_intoXYc_ffi_interfaceVc_ffiI
};

/* Code */

dylan_value Kclear_memoryXYc_ffi_interfaceVc_ffiI (dylan_value pointer_, dylan_value size_in_bytes_) {
  void* raw_pointer_;
  dylan_value T4;
  DWORD T5;
  DWORD T6;
  DWORD T7_0;
  DWORD T7_1;
  DWORD quotient_;
  DWORD T9;
  DWORD T10;
  dylan_value T11;
  DWORD T12;

  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:50
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  T5 = primitive_cast_integer_as_raw(size_in_bytes_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  T6 = primitive_machine_word_shift_right(T5,2);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  T7_0 = primitive_machine_word_truncateS_byref(T6,8,(DWORD*)&T7_1);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  quotient_ = T7_0;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  T9 = primitive_machine_word_shift_left_signal_overflow(quotient_,2);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  T10 = primitive_machine_word_logior(T9,1);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:52
  T11 = primitive_cast_raw_as_integer(T10);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:53
  raw_pointer_ = primitive_unwrap_c_pointer(pointer_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:55
  T12 = primitive_unwrap_abstract_integer(T11);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:56
  primitive_fillX(raw_pointer_,0,0,T12,0);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:56
  T4 = &KPfalseVKi;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:50
  MV_SET_COUNT(0);
  return(T4);
}

dylan_value Kequal_memoryQYc_ffi_interfaceVc_ffiI (dylan_value pointer_1_, dylan_value pointer_2_, dylan_value size_in_bytes_) {
  void* raw_pointer_1_;
  void* raw_pointer_2_;
  dylan_value T6;
  dylan_value T7_0;
  DWORD T8;
  DWORD T9;
  DWORD T10_0;
  DWORD T10_1;
  DWORD quotient_;
  DWORD T12;
  DWORD T13;
  dylan_value T14;
  DWORD T15;

  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:37
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  T8 = primitive_cast_integer_as_raw(size_in_bytes_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  T9 = primitive_machine_word_shift_right(T8,2);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  T10_0 = primitive_machine_word_truncateS_byref(T9,8,(DWORD*)&T10_1);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  quotient_ = T10_0;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  T12 = primitive_machine_word_shift_left_signal_overflow(quotient_,2);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  T13 = primitive_machine_word_logior(T12,1);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:40
  T14 = primitive_cast_raw_as_integer(T13);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:41
  raw_pointer_1_ = primitive_unwrap_c_pointer(pointer_1_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:42
  raw_pointer_2_ = primitive_unwrap_c_pointer(pointer_2_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:44
  T15 = primitive_unwrap_abstract_integer(T14);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:45
  T6 = primitive_compare_words(raw_pointer_1_,0,raw_pointer_2_,0,T15);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:45
  T7_0 = T6;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:37
  MV_SET_COUNT(1);
  return(T7_0);
}

dylan_value Kcopy_bytesXYc_ffi_interfaceVc_ffiI (dylan_value destination_, dylan_value source_, dylan_value size_) {
  void* raw_destination_;
  void* raw_source_;
  dylan_value T6;
  DWORD T7;

  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:26
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:28
  raw_destination_ = primitive_unwrap_c_pointer(destination_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:29
  raw_source_ = primitive_unwrap_c_pointer(source_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:31
  T7 = primitive_unwrap_abstract_integer(size_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:32
  primitive_replace_bytesX(raw_destination_,0,0,raw_source_,0,0,T7);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:32
  T6 = &KPfalseVKi;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:26
  MV_SET_COUNT(0);
  return(T6);
}

dylan_value Kcopy_intoXYc_ffi_interfaceVc_ffiI (dylan_value destination_, dylan_value source_, dylan_value size_in_bytes_) {
  void* raw_destination_;
  void* raw_source_;
  dylan_value T6;
  DWORD T7;
  DWORD T8;
  DWORD T9_0;
  DWORD T9_1;
  DWORD quotient_;
  DWORD T11;
  DWORD T12;
  dylan_value T13;
  DWORD T14;

  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:14
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  T7 = primitive_cast_integer_as_raw(size_in_bytes_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  T8 = primitive_machine_word_shift_right(T7,2);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  T9_0 = primitive_machine_word_truncateS_byref(T8,8,(DWORD*)&T9_1);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  quotient_ = T9_0;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  T11 = primitive_machine_word_shift_left_signal_overflow(quotient_,2);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  T12 = primitive_machine_word_logior(T11,1);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:16
  T13 = primitive_cast_raw_as_integer(T12);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:17
  raw_destination_ = primitive_unwrap_c_pointer(destination_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:18
  raw_source_ = primitive_unwrap_c_pointer(source_);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:20
  T14 = primitive_unwrap_abstract_integer(T13);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:21
  primitive_replaceX(raw_destination_,0,0,raw_source_,0,0,T14);
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:21
  T6 = &KPfalseVKi;
  // /home/bruce/Development/dylan/opendylan/sources/lib/c-ffi/memory-functions.dylan:14
  MV_SET_COUNT(0);
  return(T6);
}


/* SYSTEM INIT CODE */

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

/* USER INIT CODE */

void _Init_c_ffi__X_memory_functions_for_user () {
  return;
}


/* eof */
