#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_;
  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(4);
define__KLsimple_object_vectorGVKd(0);
define__KLsimple_object_vectorGVKd(2);
define__KLsimple_object_vectorGVKd(16);

typedef struct {
  dylan_value wrapper;
} _KLintegerGVKd;

#define  define__KLbufferGYstreamsVio(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value buffer_next_; \
    dylan_value buffer_end_; \
    dylan_value buffer_position_; \
    dylan_value buffer_dirtyQ_; \
    dylan_value buffer_start_; \
    dylan_value buffer_on_page_bits_; \
    dylan_value buffer_off_page_bits_; \
    dylan_value buffer_use_count_; \
    dylan_value buffer_owning_stream_; \
    dylan_value size_; \
    char buffer_element_[nrepeated+1]; \
  } _KLbufferGYstreamsVio_##nrepeated;

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

#define  define__KLbyte_stringGVKd(nrepeated) \
  typedef struct { \
    dylan_value wrapper; \
    dylan_value size_; \
    char string_element_[nrepeated+1]; \
  } _KLbyte_stringGVKd_##nrepeated;
define__KLbyte_stringGVKd(6);


/* 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 int isatty (unsigned int);
extern _KLfunction_classGVKi KLsimple_methodGVKe;
extern _KLclassGVKd KLfunction_classGVKi;
extern _KLmm_wrapperGVKi_0 KLfunction_classGVKiW;
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;
extern _KLsimple_object_vectorGVKd_16 KDsignature_LbooleanG_typesVKi;
extern int io_fd_positionable (unsigned int);
extern int close (unsigned int);
extern int io_errno ();
extern long io_lseek (int, long, int);
extern int read (unsigned int, D, unsigned long);
extern _KLclassGVKd KLintegerGVKd;
extern _KLmm_wrapperGVKi_0 KLintegerGVKdW;
extern _KLclassGVKd KLbufferGYstreamsVio;
extern _KLmm_wrapperGVKi_0 KLbufferGYstreamsVioW;
dylan_value KerrorVKdMM1I (dylan_value, dylan_value);
extern _KLempty_listGVKd KPempty_listVKi;
extern _KLclassGVKd KLempty_listGVKd;
extern _KLmm_wrapperGVKi_0 KLempty_listGVKdW;
extern _KLclassGVKd KLbyte_stringGVKd;
extern _KLmm_wrapperGVKi_0 KLbyte_stringGVKdW;
extern DBSTR strerror (int);
dylan_value Kcopy_sequenceVKdMM3I (dylan_value, dylan_value, dylan_value, dylan_value);
extern _KLsimple_object_vectorGVKd_0 KPempty_vectorVKi;
extern _KLsimple_object_vectorGVKd_2 KDsignature_LstringG_typesVKi;
extern int write (unsigned int, D, unsigned long);
extern int fsync (unsigned int);

/* Defined object declarations */

extern _KLsimple_methodGVKe Kunix_fsyncYio_internalsVio;
dylan_value Kunix_fsyncYio_internalsVioI (dylan_value);
extern _KLsimple_methodGVKe Kunix_writeYio_internalsVio;
dylan_value Kunix_writeYio_internalsVioI (dylan_value, dylan_value, dylan_value, dylan_value);
dylan_value Kunix_errorYio_internalsVioI (dylan_value, dylan_value, dylan_value);
extern _KLsimple_methodGVKe Kunix_readYio_internalsVio;
dylan_value Kunix_readYio_internalsVioI (dylan_value, dylan_value, dylan_value, dylan_value);
extern _KLsimple_methodGVKe Kunix_lseekYio_internalsVio;
dylan_value Kunix_lseekYio_internalsVioI (dylan_value, dylan_value, dylan_value);
extern _KLsimple_methodGVKe Kunix_closeYio_internalsVio;
dylan_value Kunix_closeYio_internalsVioI (dylan_value);
extern _KLsimple_methodGVKe Kunix_fd_positionableQYio_internalsVio;
dylan_value Kunix_fd_positionableQYio_internalsVioI (dylan_value);
extern _KLsimple_methodGVKe Kunix_isattyYio_internalsVio;
dylan_value Kunix_isattyYio_internalsVioI (dylan_value);
static _KLsignatureAvaluesGVKi K15;
dylan_value Kunix_errnoYio_internalsVioI ();
static _KLsignatureAvaluesGVKi K17;
static _KLsignatureAvaluesGVKi K18;
static _KLsignatureAvaluesGVKi K19;
static _KLsimple_object_vectorGVKd_4 K20;
extern _KLsimple_methodGVKe Kget_unix_errorYio_internalsVio;
dylan_value Kget_unix_errorYio_internalsVioI (dylan_value);
static _KLbyte_stringGVKd_6 K23;
static _KLsignatureAvaluesGVKi K24;
static _KLsignatureAvaluesGVKi K25;
static _KLsimple_object_vectorGVKd_4 K26;

/* Indirection variables */


/* Variables */

dylan_value unix_closeYio_internalsVio = &Kunix_closeYio_internalsVio;
dylan_value unix_readYio_internalsVio = &Kunix_readYio_internalsVio;
dylan_value unix_writeYio_internalsVio = &Kunix_writeYio_internalsVio;
dylan_value unix_lseekYio_internalsVio = &Kunix_lseekYio_internalsVio;
dylan_value unix_fsyncYio_internalsVio = &Kunix_fsyncYio_internalsVio;
dylan_value unix_fd_positionableQYio_internalsVio = &Kunix_fd_positionableQYio_internalsVio;
dylan_value unix_isattyYio_internalsVio = &Kunix_isattyYio_internalsVio;

/* Objects */

_KLsimple_methodGVKe Kunix_fsyncYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K17,
  &Kunix_fsyncYio_internalsVioI
};

_KLsimple_methodGVKe Kunix_writeYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_4,
  &K25,
  &Kunix_writeYio_internalsVioI
};

_KLsimple_methodGVKe Kunix_readYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_4,
  &K19,
  &Kunix_readYio_internalsVioI
};

_KLsimple_methodGVKe Kunix_lseekYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_3,
  &K18,
  &Kunix_lseekYio_internalsVioI
};

_KLsimple_methodGVKe Kunix_closeYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K17,
  &Kunix_closeYio_internalsVioI
};

_KLsimple_methodGVKe Kunix_fd_positionableQYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K15,
  &Kunix_fd_positionableQYio_internalsVioI
};

_KLsimple_methodGVKe Kunix_isattyYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K15,
  &Kunix_isattyYio_internalsVioI
};

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

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

static _KLsignatureAvaluesGVKi K18 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (dylan_value) 33555469,
  &KDsignature_LintegerG_typesVKi,
  &KDsignature_LintegerG_typesVKi
};

static _KLsignatureAvaluesGVKi K19 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (dylan_value) 33555473,
  &K20,
  &KDsignature_LintegerG_typesVKi
};

static _KLsimple_object_vectorGVKd_4 K20 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (dylan_value) 17,
  &KLintegerGVKd,
  &KLbufferGYstreamsVio,
  &KLintegerGVKd,
  &KLintegerGVKd
};

_KLsimple_methodGVKe Kget_unix_errorYio_internalsVio = {
  &KLsimple_methodGVKeW /* wrapper */,
  &xep_1,
  &K24,
  &Kget_unix_errorYio_internalsVioI
};

static _KLbyte_stringGVKd_6 K23 = {
  &KLbyte_stringGVKdW /* wrapper */,
  (dylan_value) 25,
  "%s: %s"
};

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

static _KLsignatureAvaluesGVKi K25 = {
  &KLsignatureAvaluesGVKiW /* wrapper */,
  (dylan_value) 33555473,
  &K26,
  &KDsignature_LintegerG_typesVKi
};

static _KLsimple_object_vectorGVKd_4 K26 = {
  &KLsimple_object_vectorGVKdW /* wrapper */,
  (dylan_value) 17,
  &KLintegerGVKd,
  &KLobjectGVKd,
  &KLintegerGVKd,
  &KLintegerGVKd
};

/* Code */

dylan_value Kunix_fsyncYio_internalsVioI (dylan_value fd_) {
  int T1;
  dylan_value T2;
  dylan_value T3;
  dylan_value T4;
  dylan_value T5;
  DWORD T6;
  DWORD T7;
  DWORD T8;
  DWORD T9;
  dylan_value T10;
  dylan_value T11;
  dylan_value T12;
  dylan_value T13;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:89
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
L0: ;
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:94
    T6 = primitive_cast_integer_as_raw(fd_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:94
    T7 = primitive_machine_word_shift_right(T6,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:92
    T1 = fsync(T7);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:91
    T8 = primitive_machine_word_shift_left_signal_overflow(T1,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:91
    T9 = primitive_machine_word_logior(T8,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:91
    T10 = primitive_cast_raw_as_integer(T9);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
    T11 = primitive_machine_word_less_thanQ(T9,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
    if (T11 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
      T2 = Kunix_errnoYio_internalsVioI();
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
      T12 = primitive_idQ(T2,(dylan_value) 17);
      T3 = T12;
    } else {
      T3 = &KPfalseVKi;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
    if (T3 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
      goto L0;
      T5 = T13;
    } else {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
      T4 = T10;
      MV_SET_ELT(0, T10);
      MV_SET_COUNT(1);
      T5 = T4;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:90
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:89
  return(T5);
}

dylan_value Kunix_writeYio_internalsVioI (dylan_value fd_, dylan_value data_, dylan_value offset_, dylan_value count_) {
  DSINT T4;
  D T5;
  DADDR T6;
  DADDR T7;
  DWORD T8;
  D T9;
  int T10;
  dylan_value T11;
  dylan_value T12;
  dylan_value T13;
  dylan_value T14;
  DWORD T15;
  DWORD T16;
  DWORD T17;
  DWORD T18;
  DWORD T19;
  DWORD T20;
  DWORD T21;
  DWORD T22;
  dylan_value T23;
  dylan_value T24;
  dylan_value T25;
  dylan_value T26;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:59
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
L0: ;
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:67
    T15 = primitive_cast_integer_as_raw(fd_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:67
    T16 = primitive_machine_word_shift_right(T15,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:71
    T4 = primitive_repeated_slot_offset(data_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:71
    T5 = primitive_repeated_slot_as_raw(data_,T4);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:70
    T6 = primitive_cast_pointer_as_raw(T5);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:72
    T17 = primitive_cast_integer_as_raw(offset_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:72
    T18 = primitive_machine_word_shift_right(T17,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:72
    T7 = primitive_cast_pointer_as_raw(T18);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:69
    T8 = primitive_machine_word_add(T6,T7);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:68
    T9 = primitive_cast_raw_as_pointer(T8);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:73
    T19 = primitive_cast_integer_as_raw(count_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:73
    T20 = primitive_machine_word_shift_right(T19,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:63
    T10 = write(T16, T9, T20);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:62
    T21 = primitive_machine_word_shift_left_signal_overflow(T10,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:62
    T22 = primitive_machine_word_logior(T21,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:62
    T23 = primitive_cast_raw_as_integer(T22);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
    T24 = primitive_machine_word_less_thanQ(T22,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
    if (T24 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
      T11 = Kunix_errnoYio_internalsVioI();
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
      T25 = primitive_idQ(T11,(dylan_value) 17);
      T12 = T25;
    } else {
      T12 = &KPfalseVKi;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
    if (T12 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
      goto L0;
      T14 = T26;
    } else {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
      T13 = T23;
      MV_SET_ELT(0, T23);
      MV_SET_COUNT(1);
      T14 = T13;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:61
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:59
  return(T14);
}

dylan_value Kunix_errorYio_internalsVioI (dylan_value syscall_, dylan_value Urest_, dylan_value errno_) {
  dylan_value T4;
  dylan_value T5;
  dylan_value T6;
  _KLsimple_object_vectorGVKd_2 T7 = {&KLsimple_object_vectorGVKdW, (dylan_value) 9};
  dylan_value T8_0;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:134
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:137
  if (errno_ != &KPfalseVKi) {
    T5 = errno_;
  } else {
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:137
    T4 = Kunix_errnoYio_internalsVioI();
    T5 = T4;
  }
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:137
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:137
  T6 = CALL1(&Kget_unix_errorYio_internalsVio, T5);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:138
  T7.vector_element_[0] = syscall_;
  T7.vector_element_[1] = T6;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:138
  T8_0 = KerrorVKdMM1I(&K23, &T7);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:134
  MV_SET_COUNT(1);
  return(T8_0);
}

dylan_value Kunix_readYio_internalsVioI (dylan_value fd_, dylan_value data_, dylan_value offset_, dylan_value count_) {
  D T4;
  DADDR T5;
  DADDR T6;
  DWORD T7;
  D T8;
  int T9;
  dylan_value T10;
  dylan_value T11;
  dylan_value T12;
  dylan_value T13;
  DWORD T14;
  DWORD T15;
  DWORD T16;
  DWORD T17;
  DWORD T18;
  DWORD T19;
  DWORD T20;
  DWORD T21;
  dylan_value T22;
  dylan_value T23;
  dylan_value T24;
  dylan_value T25;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:40
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
L0: ;
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:48
    T14 = primitive_cast_integer_as_raw(fd_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:48
    T15 = primitive_machine_word_shift_right(T14,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:52
    T4 = primitive_repeated_slot_as_raw(data_,11);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:51
    T5 = primitive_cast_pointer_as_raw(T4);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:53
    T16 = primitive_cast_integer_as_raw(offset_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:53
    T17 = primitive_machine_word_shift_right(T16,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:53
    T6 = primitive_cast_pointer_as_raw(T17);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:50
    T7 = primitive_machine_word_add(T5,T6);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:49
    T8 = primitive_cast_raw_as_pointer(T7);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:54
    T18 = primitive_cast_integer_as_raw(count_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:54
    T19 = primitive_machine_word_shift_right(T18,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:44
    T9 = read(T15, T8, T19);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:43
    T20 = primitive_machine_word_shift_left_signal_overflow(T9,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:43
    T21 = primitive_machine_word_logior(T20,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:43
    T22 = primitive_cast_raw_as_integer(T21);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
    T23 = primitive_machine_word_less_thanQ(T21,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
    if (T23 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
      T10 = Kunix_errnoYio_internalsVioI();
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
      T24 = primitive_idQ(T10,(dylan_value) 17);
      T11 = T24;
    } else {
      T11 = &KPfalseVKi;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
    if (T11 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
      goto L0;
      T13 = T25;
    } else {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
      T12 = T22;
      MV_SET_ELT(0, T22);
      MV_SET_COUNT(1);
      T13 = T12;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:42
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:40
  return(T13);
}

dylan_value Kunix_lseekYio_internalsVioI (dylan_value fd_, dylan_value position_, dylan_value mode_) {
  long T3;
  DWORD T4;
  DWORD T5;
  DWORD T6;
  DWORD T7;
  DWORD T8;
  DWORD T9;
  DWORD T10;
  DWORD T11;
  dylan_value T12;
  dylan_value T13_0;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:78
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:85
  T4 = primitive_cast_integer_as_raw(fd_);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:85
  T5 = primitive_machine_word_shift_right(T4,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:85
  T6 = primitive_cast_integer_as_raw(position_);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:85
  T7 = primitive_machine_word_shift_right(T6,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:85
  T8 = primitive_cast_integer_as_raw(mode_);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:85
  T9 = primitive_machine_word_shift_right(T8,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:81
  T3 = io_lseek(T5, T7, T9);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:80
  T10 = primitive_machine_word_shift_left_signal_overflow(T3,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:80
  T11 = primitive_machine_word_logior(T10,1);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:80
  T12 = primitive_cast_raw_as_integer(T11);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:80
  T13_0 = T12;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:78
  MV_SET_COUNT(1);
  return(T13_0);
}

dylan_value Kunix_closeYio_internalsVioI (dylan_value fd_) {
  int T1;
  dylan_value T2;
  dylan_value T3;
  dylan_value T4;
  dylan_value T5;
  DWORD T6;
  DWORD T7;
  DWORD T8;
  DWORD T9;
  dylan_value T10;
  dylan_value T11;
  dylan_value T12;
  dylan_value T13;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:31
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
L0: ;
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:36
    T6 = primitive_cast_integer_as_raw(fd_);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:36
    T7 = primitive_machine_word_shift_right(T6,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:34
    T1 = close(T7);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:33
    T8 = primitive_machine_word_shift_left_signal_overflow(T1,2);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:33
    T9 = primitive_machine_word_logior(T8,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:33
    T10 = primitive_cast_raw_as_integer(T9);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
    T11 = primitive_machine_word_less_thanQ(T9,1);
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
    if (T11 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
      T2 = Kunix_errnoYio_internalsVioI();
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
      T12 = primitive_idQ(T2,(dylan_value) 17);
      T3 = T12;
    } else {
      T3 = &KPfalseVKi;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
    if (T3 != &KPfalseVKi) {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
      goto L0;
      T5 = T13;
    } else {
      // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
      T4 = T10;
      MV_SET_ELT(0, T10);
      MV_SET_COUNT(1);
      T5 = T4;
    }
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
    // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:32
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:31
  return(T5);
}

dylan_value Kunix_fd_positionableQYio_internalsVioI (dylan_value fd_) {
  int T1;
  DWORD T2;
  DWORD T3;
  DWORD T4;
  DWORD T5;
  dylan_value T6;
  dylan_value T7;
  dylan_value T8_0;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:98
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:104
  T2 = primitive_cast_integer_as_raw(fd_);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:104
  T3 = primitive_machine_word_shift_right(T2,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:102
  T1 = io_fd_positionable(T3);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:102
  T4 = primitive_machine_word_shift_left_signal_overflow(T1,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:102
  T5 = primitive_machine_word_logior(T4,1);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:106
  T6 = primitive_machine_word_equalQ(T5,1);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:106
  T7 = primitive_not(T6);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:106
  T8_0 = T7;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:98
  MV_SET_COUNT(1);
  return(T8_0);
}

dylan_value Kunix_isattyYio_internalsVioI (dylan_value fd_) {
  int T1;
  DWORD T2;
  DWORD T3;
  DWORD T4;
  DWORD T5;
  dylan_value T6;
  dylan_value T7;
  dylan_value T8_0;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:109
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:115
  T2 = primitive_cast_integer_as_raw(fd_);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:115
  T3 = primitive_machine_word_shift_right(T2,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:113
  T1 = isatty(T3);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:113
  T4 = primitive_machine_word_shift_left_signal_overflow(T1,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:113
  T5 = primitive_machine_word_logior(T4,1);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:113
  T6 = primitive_cast_raw_as_integer(T5);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:117
  T7 = primitive_idQ(T6,(dylan_value) 5);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:117
  T8_0 = T7;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:109
  MV_SET_COUNT(1);
  return(T8_0);
}

dylan_value Kunix_errnoYio_internalsVioI () {
  int T0;
  DWORD T1;
  DWORD T2;
  dylan_value T3;
  dylan_value T4_0;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:11
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:13
  T0 = io_errno();
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:12
  T1 = primitive_machine_word_shift_left_signal_overflow(T0,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:12
  T2 = primitive_machine_word_logior(T1,1);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:12
  T3 = primitive_cast_raw_as_integer(T2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:12
  T4_0 = T3;
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:11
  MV_SET_COUNT(1);
  return(T4_0);
}

dylan_value Kget_unix_errorYio_internalsVioI (dylan_value errno_) {
  DBSTR T1;
  dylan_value T2;
  DWORD T3;
  DWORD T4;
  dylan_value T5_0;

  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:120
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:125
  T3 = primitive_cast_integer_as_raw(errno_);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:125
  T4 = primitive_machine_word_shift_right(T3,2);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:123
  T1 = strerror(T4);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:122
  T2 = primitive_raw_as_string(T1);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:128
  T5_0 = Kcopy_sequenceVKdMM3I(T2, &KPempty_vectorVKi, (dylan_value) 1, &KPunboundVKi);
  // /home/bruce/Development/dylan/opendylan/sources/io/unix-interface.dylan:120
  MV_SET_COUNT(1);
  return(T5_0);
}


/* SYSTEM INIT CODE */

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

/* USER INIT CODE */

void _Init_io__X_unix_interface_for_user () {
  return;
}


/* eof */
