#include "run-time.h"

/* Typedefs for referenced classes */

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;
} _KLobjectGVKd;

typedef struct {
  D wrapper;
} _KLunboundGVKe;

typedef struct {
  D wrapper;
} _KLbooleanGVKd;

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

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

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

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

typedef struct {
  D wrapper;
  D instanceQ_iep_;
  D debug_name_;
  D class_implementation_class_;
  D class_subtype_bit_;
  D class_module_;
  D alignment_of_;
  D size_of_;
  D referenced_type_;
  D concrete_pointer_type_;
  D abstract_pointer_type_;
} _KLdesignator_classGVKc;

typedef struct {
  D wrapper;
} _KLintegerGVKd;

typedef struct {
  D wrapper;
  D signature_properties_;
  D signature_required_;
  D 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;
D Kclear_memoryXYc_ffi_interfaceVc_ffiI (D pointer_, D size_in_bytes_);
static _KLsignatureGVKe K2;
static _KLsimple_object_vectorGVKd_2 K3;
extern _KLsimple_methodGVKe Kequal_memoryQYc_ffi_interfaceVc_ffi;
D Kequal_memoryQYc_ffi_interfaceVc_ffiI (D pointer_1_, D pointer_2_, D size_in_bytes_);
static _KLsignatureAvaluesGVKi K6;
static _KLsimple_object_vectorGVKd_3 K7;
extern _KLsimple_methodGVKe Kcopy_bytesXYc_ffi_interfaceVc_ffi;
D Kcopy_bytesXYc_ffi_interfaceVc_ffiI (D destination_, D source_, D size_);
static _KLsignatureGVKe K10;
extern _KLsimple_methodGVKe Kcopy_intoXYc_ffi_interfaceVc_ffi;
D Kcopy_intoXYc_ffi_interfaceVc_ffiI (D destination_, D source_, D size_in_bytes_);

/* Indirection variables */


/* Variables */

D copy_intoXYc_ffi_interfaceVc_ffi = &Kcopy_intoXYc_ffi_interfaceVc_ffi;
D copy_bytesXYc_ffi_interfaceVc_ffi = &Kcopy_bytesXYc_ffi_interfaceVc_ffi;
D equal_memoryQYc_ffi_interfaceVc_ffi = &Kequal_memoryQYc_ffi_interfaceVc_ffi;
D clear_memoryXYc_ffi_interfaceVc_ffi = &Kclear_memoryXYc_ffi_interfaceVc_ffi;
D Dtrace_ffi_callsYc_ffi_interfaceVc_ffi = &KPfalseVKi;

/* Objects */

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

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

static _KLsimple_object_vectorGVKd_2 K3 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (D) 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 */,
  (D) 33555469,
  &K7,
  &KDsignature_LbooleanG_typesVKi
};

static _KLsimple_object_vectorGVKd_3 K7 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (D) 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 */,
  (D) 41943053,
  &K7
};

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

/* Code */

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

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

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

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

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

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

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

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

/* USER INIT CODE */

void _Init_c_ffi__X_memory_functions_for_user () {
  return;
}


/* eof */
