__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_CreateDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17901;
  unsigned int D.17904;
  int D.17905;
  MonoBoolean D.17906;
  gboolean ret;

  *error = 0;
  D.17901 = mono_string_chars (path);
  ret = CreateDirectory (D.17901, 0B);
  if (ret == 0) goto <D.17902>; else goto <D.17903>;
  <D.17902>:
  D.17904 = GetLastError ();
  D.17905 = (int) D.17904;
  *error = D.17905;
  <D.17903>:
  D.17906 = (MonoBoolean) ret;
  return D.17906;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_RemoveDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17908;
  unsigned int D.17911;
  int D.17912;
  MonoBoolean D.17913;
  gboolean ret;

  *error = 0;
  D.17908 = mono_string_chars (path);
  ret = RemoveDirectory (D.17908);
  if (ret == 0) goto <D.17909>; else goto <D.17910>;
  <D.17909>:
  D.17911 = GetLastError ();
  D.17912 = (int) D.17911;
  *error = D.17912;
  <D.17910>:
  D.17913 = (MonoBoolean) ret;
  return D.17913;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetFileSystemEntries (struct MonoString * path, struct MonoString * path_with_pattern, gint attrs, gint mask, gint32 * error)
{
  unsigned int D.17915;
  mono_unichar2 * D.17916;
  unsigned int D.17917;
  int D.17920;
  unsigned int D.17924;
  int D.17925;
  mono_unichar2 * D.17926;
  unsigned int D.17929;
  unsigned int D.17934;
  unsigned int D.17935;
  short unsigned int D.17938;
  unsigned int D.17939;
  unsigned int mask.0;
  unsigned int D.17941;
  unsigned int attrs.1;
  int D.17947;
  int D.17948;
  unsigned int D.17951;
  int D.17952;
  struct MonoClass * D.17954;
  unsigned int D.17955;
  long unsigned int D.17956;
  long unsigned int D.17957;
  void * * D.17958;
  long unsigned int D.17959;
  long unsigned int D.17960;
  void * * D.17961;
  void * D.17962;
  struct MonoString * D.17963;
  unsigned int i.2;
  int D.17967;
  struct MonoArray * D.17970;
  struct MonoDomain * domain;
  struct MonoArray * result;
  int i;
  struct WIN32_FIND_DATA data;
  void * find_handle;
  struct GPtrArray * names;
  gchar * utf8_path;
  gchar * utf8_result;
  gchar * full_name;
  gint32 attributes;
  void leave = <<< error >>>;

  try
    {
      result = 0B;
      *error = 0;
      domain = mono_domain_get ();
      D.17915 = convert_attrs (mask);
      mask = (gint) D.17915;
      D.17916 = mono_string_chars (path);
      D.17917 = get_file_attributes (D.17916);
      attributes = (gint32) D.17917;
      if (attributes != -1) goto <D.17918>; else goto <D.17919>;
      <D.17918>:
      D.17920 = attributes & 16;
      if (D.17920 == 0) goto <D.17921>; else goto <D.17922>;
      <D.17921>:
      *error = 123;
      goto leave;
      <D.17922>:
      goto <D.17923>;
      <D.17919>:
      D.17924 = GetLastError ();
      D.17925 = (int) D.17924;
      *error = D.17925;
      goto leave;
      <D.17923>:
      D.17926 = mono_string_chars (path_with_pattern);
      find_handle = FindFirstFile (D.17926, &data);
      if (find_handle == -1B) goto <D.17927>; else goto <D.17928>;
      <D.17927>:
      {
        gint32 find_error;

        D.17929 = GetLastError ();
        find_error = (gint32) D.17929;
        if (find_error == 2) goto leave; else goto <D.17930>;
        <D.17930>:
        if (find_error == 18) goto leave; else goto <D.17931>;
        <D.17931>:
        *error = find_error;
        goto leave;
      }
      <D.17928>:
      utf8_path = get_search_dir (path_with_pattern);
      names = monoeg_g_ptr_array_new ();
      <D.17640>:
      D.17934 = BIT_FIELD_REF <data, 32, 352>;
      D.17935 = D.17934;
      if (D.17935 == 3014656) goto <D.17932>; else goto <D.17936>;
      <D.17936>:
      D.17934 = BIT_FIELD_REF <data, 32, 352>;
      D.17935 = D.17934;
      if (D.17935 == 3014702) goto <D.17937>; else goto <D.17933>;
      <D.17937>:
      D.17938 = data.cFileName[2];
      if (D.17938 == 0) goto <D.17932>; else goto <D.17933>;
      <D.17932>:
      // predicted unlikely by continue predictor.
      goto <D.17639>;
      <D.17933>:
      D.17939 = data.dwFileAttributes;
      mask.0 = (unsigned int) mask;
      D.17941 = D.17939 & mask.0;
      attrs.1 = (unsigned int) attrs;
      if (D.17941 == attrs.1) goto <D.17943>; else goto <D.17944>;
      <D.17943>:
      utf8_result = monoeg_g_utf16_to_utf8 (&data.cFileName, -1, 0B, 0B, 0B);
      if (utf8_result == 0B) goto <D.17945>; else goto <D.17946>;
      <D.17945>:
      // predicted unlikely by continue predictor.
      goto <D.17639>;
      <D.17946>:
      full_name = monoeg_g_build_path ("/", utf8_path, utf8_result, 0B);
      monoeg_g_ptr_array_add (names, full_name);
      monoeg_g_free (utf8_result);
      <D.17944>:
      <D.17639>:
      D.17947 = FindNextFile (find_handle, &data);
      if (D.17947 != 0) goto <D.17640>; else goto <D.17641>;
      <D.17641>:
      D.17948 = FindClose (find_handle);
      if (D.17948 == 0) goto <D.17949>; else goto <D.17950>;
      <D.17949>:
      D.17951 = GetLastError ();
      D.17952 = (int) D.17951;
      *error = D.17952;
      result = 0B;
      goto <D.17953>;
      <D.17950>:
      D.17954 = mono_defaults.string_class;
      D.17955 = names->len;
      D.17956 = (long unsigned int) D.17955;
      result = mono_array_new (domain, D.17954, D.17956);
      i = 0;
      goto <D.17644>;
      <D.17643>:
      {
        void * * __p;

        D.17957 = (long unsigned int) i;
        __p = mono_array_addr_with_size (result, 8, D.17957);
        D.17958 = names->pdata;
        D.17959 = (long unsigned int) i;
        D.17960 = D.17959 * 8;
        D.17961 = D.17958 + D.17960;
        D.17962 = *D.17961;
        D.17963 = mono_string_new (domain, D.17962);
        mono_gc_wbarrier_set_arrayref (result, __p, D.17963);
      }
      i = i + 1;
      <D.17644>:
      D.17955 = names->len;
      i.2 = (unsigned int) i;
      if (D.17955 > i.2) goto <D.17643>; else goto <D.17645>;
      <D.17645>:
      <D.17953>:
      i = 0;
      goto <D.17647>;
      <D.17646>:
      D.17958 = names->pdata;
      D.17959 = (long unsigned int) i;
      D.17960 = D.17959 * 8;
      D.17961 = D.17958 + D.17960;
      D.17962 = *D.17961;
      monoeg_g_free (D.17962);
      i = i + 1;
      <D.17647>:
      D.17955 = names->len;
      i.2 = (unsigned int) i;
      if (D.17955 > i.2) goto <D.17646>; else goto <D.17648>;
      <D.17648>:
      monoeg_g_ptr_array_free (names, 1);
      monoeg_g_free (utf8_path);
      leave:
      if (result == 0B) goto <D.17965>; else goto <D.17966>;
      <D.17965>:
      D.17967 = *error;
      if (D.17967 == 0) goto <D.17968>; else goto <D.17969>;
      <D.17968>:
      D.17954 = mono_defaults.string_class;
      result = mono_array_new (domain, D.17954, 0);
      <D.17969>:
      <D.17966>:
      D.17970 = result;
      return D.17970;
    }
  finally
    {
      data = {CLOBBER};
    }
}


convert_attrs (MonoFileAttributes attrs)
{
  int D.17973;
  guint32 D.17976;

  D.17973 = attrs & 16384;
  if (D.17973 != 0) goto <D.17974>; else goto <D.17975>;
  <D.17974>:
  attrs = attrs | 64;
  <D.17975>:
  D.17976 = (guint32) attrs;
  return D.17976;
}


get_file_attributes (const gunichar2 * path)
{
  guint32 D.17980;
  unsigned int D.17981;
  guint32 res;
  struct WIN32_FIND_DATA find_data;
  void * find_handle;
  gint32 error;

  try
    {
      res = GetFileAttributes (path);
      if (res != 4294967295) goto <D.17978>; else goto <D.17979>;
      <D.17978>:
      D.17980 = res;
      return D.17980;
      <D.17979>:
      D.17981 = GetLastError ();
      error = (gint32) D.17981;
      if (error != 32) goto <D.17982>; else goto <D.17983>;
      <D.17982>:
      D.17980 = res;
      return D.17980;
      <D.17983>:
      find_handle = FindFirstFile (path, &find_data);
      if (find_handle == -1B) goto <D.17984>; else goto <D.17985>;
      <D.17984>:
      D.17980 = res;
      return D.17980;
      <D.17985>:
      FindClose (find_handle);
      D.17980 = find_data.dwFileAttributes;
      return D.17980;
    }
  finally
    {
      find_data = {CLOBBER};
    }
}


get_search_dir (struct MonoString * pattern)
{
  gchar * D.17988;
  gchar * p;
  gchar * result;

  p = mono_string_to_utf8 (pattern);
  result = monoeg_g_path_get_dirname (p);
  monoeg_g_free (p);
  D.17988 = result;
  return D.17988;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_FindFirst (struct MonoString * path, struct MonoString * path_with_pattern, gint32 * result_attr, gint32 * error, void * * handle)
{
  mono_unichar2 * D.17990;
  unsigned int D.17993;
  struct MonoString * D.17996;
  char * D.17997;
  struct MonoDomain * D.17998;
  int D.17999;
  unsigned int D.18002;
  int D.18005;
  unsigned int D.18006;
  int D.18007;
  struct WIN32_FIND_DATA data;
  void * find_handle;
  struct IncrementalFind * ifh;
  struct MonoString * result;

  try
    {
      *error = 0;
      D.17990 = mono_string_chars (path_with_pattern);
      find_handle = FindFirstFile (D.17990, &data);
      if (find_handle == -1B) goto <D.17991>; else goto <D.17992>;
      <D.17991>:
      {
        gint32 find_error;

        D.17993 = GetLastError ();
        find_error = (gint32) D.17993;
        *handle = 0B;
        if (find_error == 2) goto <D.17994>; else goto <D.17995>;
        <D.17994>:
        D.17996 = 0B;
        return D.17996;
        <D.17995>:
        *error = find_error;
        D.17996 = 0B;
        return D.17996;
      }
      <D.17992>:
      ifh = monoeg_malloc (24);
      ifh->find_handle = find_handle;
      D.17997 = mono_string_to_utf8 (path);
      ifh->utf8_path = D.17997;
      D.17998 = mono_domain_get ();
      ifh->domain = D.17998;
      *handle = ifh;
      goto <D.17675>;
      <D.17674>:
      D.17999 = FindNextFile (find_handle, &data);
      if (D.17999 == 0) goto <D.18000>; else goto <D.18001>;
      <D.18000>:
      {
        int e;

        D.18002 = GetLastError ();
        e = (int) D.18002;
        if (e != 18) goto <D.18003>; else goto <D.18004>;
        <D.18003>:
        *error = e;
        <D.18004>:
        D.17996 = 0B;
        return D.17996;
      }
      <D.18001>:
      <D.17675>:
      D.18005 = incremental_find_check_match (ifh, &data, &result);
      if (D.18005 == 0) goto <D.17674>; else goto <D.17676>;
      <D.17676>:
      D.18006 = data.dwFileAttributes;
      D.18007 = (int) D.18006;
      *result_attr = D.18007;
      D.17996 = result;
      return D.17996;
    }
  finally
    {
      data = {CLOBBER};
      result = {CLOBBER};
    }
}


incremental_find_check_match (struct IncrementalFind * handle, struct WIN32_FIND_DATA * data, struct MonoString * * result)
{
  unsigned int D.18012;
  unsigned int D.18013;
  short unsigned int D.18016;
  gboolean D.18017;
  gunichar2[260] * D.18018;
  gchar * D.18021;
  struct MonoDomain * D.18022;
  struct MonoString * D.18023;
  gchar * utf8_result;
  gchar * full_name;

  D.18012 = BIT_FIELD_REF <*data, 32, 352>;
  D.18013 = D.18012;
  if (D.18013 == 3014656) goto <D.18010>; else goto <D.18014>;
  <D.18014>:
  D.18012 = BIT_FIELD_REF <*data, 32, 352>;
  D.18013 = D.18012;
  if (D.18013 == 3014702) goto <D.18015>; else goto <D.18011>;
  <D.18015>:
  D.18016 = data->cFileName[2];
  if (D.18016 == 0) goto <D.18010>; else goto <D.18011>;
  <D.18010>:
  D.18017 = 0;
  return D.18017;
  <D.18011>:
  D.18018 = &data->cFileName;
  utf8_result = monoeg_g_utf16_to_utf8 (D.18018, -1, 0B, 0B, 0B);
  if (utf8_result == 0B) goto <D.18019>; else goto <D.18020>;
  <D.18019>:
  D.18017 = 0;
  return D.18017;
  <D.18020>:
  D.18021 = handle->utf8_path;
  full_name = monoeg_g_build_path ("/", D.18021, utf8_result, 0B);
  monoeg_g_free (utf8_result);
  D.18022 = mono_domain_get ();
  D.18023 = mono_string_new (D.18022, full_name);
  *result = D.18023;
  monoeg_g_free (full_name);
  D.18017 = 1;
  return D.18017;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_FindNext (void * handle, gint32 * result_attr, gint32 * error)
{
  void * D.18025;
  int D.18026;
  unsigned int D.18029;
  struct MonoString * D.18032;
  int D.18033;
  unsigned int D.18034;
  int D.18035;
  struct IncrementalFind * ifh;
  struct WIN32_FIND_DATA data;
  struct MonoString * result;

  try
    {
      ifh = handle;
      *error = 0;
      <D.17686>:
      D.18025 = ifh->find_handle;
      D.18026 = FindNextFile (D.18025, &data);
      if (D.18026 == 0) goto <D.18027>; else goto <D.18028>;
      <D.18027>:
      {
        int e;

        D.18029 = GetLastError ();
        e = (int) D.18029;
        if (e != 18) goto <D.18030>; else goto <D.18031>;
        <D.18030>:
        *error = e;
        <D.18031>:
        D.18032 = 0B;
        return D.18032;
      }
      <D.18028>:
      D.18033 = incremental_find_check_match (ifh, &data, &result);
      if (D.18033 == 0) goto <D.17686>; else goto <D.17687>;
      <D.17687>:
      D.18034 = data.dwFileAttributes;
      D.18035 = (int) D.18034;
      *result_attr = D.18035;
      D.18032 = result;
      return D.18032;
    }
  finally
    {
      data = {CLOBBER};
      result = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_FindClose (void * handle)
{
  void * D.18038;
  int D.18039;
  unsigned int D.18042;
  gchar * D.18044;
  int D.18045;
  struct IncrementalFind * ifh;
  gint32 error;

  ifh = handle;
  D.18038 = ifh->find_handle;
  D.18039 = FindClose (D.18038);
  if (D.18039 == 0) goto <D.18040>; else goto <D.18041>;
  <D.18040>:
  D.18042 = GetLastError ();
  error = (gint32) D.18042;
  goto <D.18043>;
  <D.18041>:
  error = 0;
  <D.18043>:
  D.18044 = ifh->utf8_path;
  monoeg_g_free (D.18044);
  monoeg_g_free (ifh);
  D.18045 = error;
  return D.18045;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 * error)
{
  long unsigned int D.18047;
  long unsigned int D.18048;
  unsigned int len.3;
  unsigned int D.18050;
  long unsigned int D.18053;
  long unsigned int D.18054;
  unsigned int res_len.4;
  unsigned int D.18056;
  unsigned int old_res_len.5;
  _Bool D.18058;
  gunichar2 * D.18061;
  short unsigned int D.18062;
  struct MonoDomain * D.18063;
  unsigned int D.18065;
  int D.18066;
  struct MonoString * D.18067;
  struct MonoString * result;
  gunichar2 * buf;
  int len;
  int res_len;

  len = 261;
  D.18047 = (long unsigned int) len;
  D.18048 = D.18047 * 2;
  buf = monoeg_malloc (D.18048);
  *error = 0;
  result = 0B;
  len.3 = (unsigned int) len;
  D.18050 = GetCurrentDirectory (len.3, buf);
  res_len = (int) D.18050;
  if (res_len > len) goto <D.18051>; else goto <D.18052>;
  <D.18051>:
  {
    int old_res_len;

    old_res_len = res_len;
    monoeg_g_free (buf);
    D.18053 = (long unsigned int) res_len;
    D.18054 = D.18053 * 2;
    buf = monoeg_malloc (D.18054);
    res_len.4 = (unsigned int) res_len;
    D.18056 = GetCurrentDirectory (res_len.4, buf);
    old_res_len.5 = (unsigned int) old_res_len;
    D.18058 = D.18056 == old_res_len.5;
    res_len = (int) D.18058;
  }
  <D.18052>:
  if (res_len != 0) goto <D.18059>; else goto <D.18060>;
  <D.18059>:
  len = 0;
  goto <D.17702>;
  <D.17701>:
  len = len + 1;
  <D.17702>:
  D.18047 = (long unsigned int) len;
  D.18048 = D.18047 * 2;
  D.18061 = buf + D.18048;
  D.18062 = *D.18061;
  if (D.18062 != 0) goto <D.17701>; else goto <D.17703>;
  <D.17703>:
  D.18063 = mono_domain_get ();
  result = mono_string_new_utf16 (D.18063, buf, len);
  goto <D.18064>;
  <D.18060>:
  D.18065 = GetLastError ();
  D.18066 = (int) D.18065;
  *error = D.18066;
  <D.18064>:
  monoeg_g_free (buf);
  D.18067 = result;
  return D.18067;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_SetCurrentDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18069;
  unsigned int D.18072;
  int D.18073;
  MonoBoolean D.18074;
  gboolean ret;

  *error = 0;
  D.18069 = mono_string_chars (path);
  ret = SetCurrentDirectory (D.18069);
  if (ret == 0) goto <D.18070>; else goto <D.18071>;
  <D.18070>:
  D.18072 = GetLastError ();
  D.18073 = (int) D.18072;
  *error = D.18073;
  <D.18071>:
  D.18074 = (MonoBoolean) ret;
  return D.18074;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_MoveFile (struct MonoString * path, struct MonoString * dest, gint32 * error)
{
  mono_unichar2 * D.18076;
  mono_unichar2 * D.18077;
  unsigned int D.18080;
  int D.18081;
  MonoBoolean D.18082;
  gboolean ret;

  *error = 0;
  D.18076 = mono_string_chars (path);
  D.18077 = mono_string_chars (dest);
  ret = MoveFile (D.18076, D.18077);
  if (ret == 0) goto <D.18078>; else goto <D.18079>;
  <D.18078>:
  D.18080 = GetLastError ();
  D.18081 = (int) D.18080;
  *error = D.18081;
  <D.18079>:
  D.18082 = (MonoBoolean) ret;
  return D.18082;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_ReplaceFile (struct MonoString * sourceFileName, struct MonoString * destinationFileName, struct MonoString * destinationBackupFileName, MonoBoolean ignoreMetadataErrors, gint32 * error)
{
  unsigned int D.18094;
  int D.18095;
  MonoBoolean D.18096;
  gboolean ret;
  gunichar2 * utf16_sourceFileName;
  gunichar2 * utf16_destinationFileName;
  gunichar2 * utf16_destinationBackupFileName;
  guint32 replaceFlags;

  utf16_sourceFileName = 0B;
  utf16_destinationFileName = 0B;
  utf16_destinationBackupFileName = 0B;
  replaceFlags = 1;
  if (sourceFileName != 0B) goto <D.18084>; else goto <D.18085>;
  <D.18084>:
  utf16_sourceFileName = mono_string_chars (sourceFileName);
  <D.18085>:
  if (destinationFileName != 0B) goto <D.18086>; else goto <D.18087>;
  <D.18086>:
  utf16_destinationFileName = mono_string_chars (destinationFileName);
  <D.18087>:
  if (destinationBackupFileName != 0B) goto <D.18088>; else goto <D.18089>;
  <D.18088>:
  utf16_destinationBackupFileName = mono_string_chars (destinationBackupFileName);
  <D.18089>:
  *error = 0;
  if (ignoreMetadataErrors != 0) goto <D.18090>; else goto <D.18091>;
  <D.18090>:
  replaceFlags = replaceFlags | 2;
  <D.18091>:
  ret = ReplaceFile (utf16_destinationFileName, utf16_sourceFileName, utf16_destinationBackupFileName, replaceFlags, 0B, 0B);
  if (ret == 0) goto <D.18092>; else goto <D.18093>;
  <D.18092>:
  D.18094 = GetLastError ();
  D.18095 = (int) D.18094;
  *error = D.18095;
  <D.18093>:
  D.18096 = (MonoBoolean) ret;
  return D.18096;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_CopyFile (struct MonoString * path, struct MonoString * dest, MonoBoolean overwrite, gint32 * error)
{
  mono_unichar2 * D.18098;
  mono_unichar2 * D.18099;
  _Bool D.18100;
  int D.18101;
  unsigned int D.18104;
  int D.18105;
  MonoBoolean D.18106;
  gboolean ret;

  *error = 0;
  D.18098 = mono_string_chars (path);
  D.18099 = mono_string_chars (dest);
  D.18100 = overwrite == 0;
  D.18101 = (int) D.18100;
  ret = CopyFile (D.18098, D.18099, D.18101);
  if (ret == 0) goto <D.18102>; else goto <D.18103>;
  <D.18102>:
  D.18104 = GetLastError ();
  D.18105 = (int) D.18104;
  *error = D.18105;
  <D.18103>:
  D.18106 = (MonoBoolean) ret;
  return D.18106;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_DeleteFile (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18108;
  unsigned int D.18111;
  int D.18112;
  MonoBoolean D.18113;
  gboolean ret;

  *error = 0;
  D.18108 = mono_string_chars (path);
  ret = DeleteFile (D.18108);
  if (ret == 0) goto <D.18109>; else goto <D.18110>;
  <D.18109>:
  D.18111 = GetLastError ();
  D.18112 = (int) D.18111;
  *error = D.18112;
  <D.18110>:
  D.18113 = (MonoBoolean) ret;
  return D.18113;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetFileAttributes (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18115;
  unsigned int D.18116;
  unsigned int D.18119;
  int D.18120;
  gint32 D.18121;
  gint32 ret;

  *error = 0;
  D.18115 = mono_string_chars (path);
  D.18116 = get_file_attributes (D.18115);
  ret = (gint32) D.18116;
  if (ret == -1) goto <D.18117>; else goto <D.18118>;
  <D.18117>:
  D.18119 = GetLastError ();
  D.18120 = (int) D.18119;
  *error = D.18120;
  <D.18118>:
  D.18121 = ret;
  return D.18121;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_SetFileAttributes (struct MonoString * path, gint32 attrs, gint32 * error)
{
  mono_unichar2 * D.18123;
  unsigned int D.18124;
  unsigned int D.18127;
  int D.18128;
  MonoBoolean D.18129;
  gboolean ret;

  *error = 0;
  D.18123 = mono_string_chars (path);
  D.18124 = convert_attrs (attrs);
  ret = SetFileAttributes (D.18123, D.18124);
  if (ret == 0) goto <D.18125>; else goto <D.18126>;
  <D.18125>:
  D.18127 = GetLastError ();
  D.18128 = (int) D.18127;
  *error = D.18128;
  <D.18126>:
  D.18129 = (MonoBoolean) ret;
  return D.18129;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetFileType (void * handle, gint32 * error)
{
  <unnamed type> D.18131;
  unsigned int D.18134;
  int D.18135;
  gint32 D.18136;
  gboolean ret;

  *error = 0;
  D.18131 = GetFileType (handle);
  ret = (gboolean) D.18131;
  if (ret == 0) goto <D.18132>; else goto <D.18133>;
  <D.18132>:
  D.18134 = GetLastError ();
  D.18135 = (int) D.18134;
  *error = D.18135;
  <D.18133>:
  D.18136 = ret;
  return D.18136;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetFileStat (struct MonoString * path, struct MonoIOStat * stat, gint32 * error)
{
  mono_unichar2 * D.18138;
  unsigned int D.18142;
  int D.18143;
  MonoBoolean D.18144;
  gboolean result;
  struct WIN32_FILE_ATTRIBUTE_DATA data;

  try
    {
      *error = 0;
      D.18138 = mono_string_chars (path);
      result = get_file_attributes_ex (D.18138, &data);
      if (result != 0) goto <D.18139>; else goto <D.18140>;
      <D.18139>:
      convert_win32_file_attribute_data (&data, stat);
      goto <D.18141>;
      <D.18140>:
      D.18142 = GetLastError ();
      D.18143 = (int) D.18142;
      *error = D.18143;
      memset (stat, 0, 40);
      <D.18141>:
      D.18144 = (MonoBoolean) result;
      return D.18144;
    }
  finally
    {
      data = {CLOBBER};
    }
}


get_file_attributes_ex (const gunichar2 * path, struct WIN32_FILE_ATTRIBUTE_DATA * data)
{
  gboolean D.18149;
  unsigned int D.18150;
  unsigned int D.18155;
  unsigned int D.18156;
  unsigned int D.18157;
  gboolean res;
  struct WIN32_FIND_DATA find_data;
  void * find_handle;
  gint32 error;

  try
    {
      res = GetFileAttributesEx (path, 0, data);
      if (res != 0) goto <D.18147>; else goto <D.18148>;
      <D.18147>:
      D.18149 = 1;
      return D.18149;
      <D.18148>:
      D.18150 = GetLastError ();
      error = (gint32) D.18150;
      if (error != 32) goto <D.18151>; else goto <D.18152>;
      <D.18151>:
      D.18149 = 0;
      return D.18149;
      <D.18152>:
      find_handle = FindFirstFile (path, &find_data);
      if (find_handle == -1B) goto <D.18153>; else goto <D.18154>;
      <D.18153>:
      D.18149 = 0;
      return D.18149;
      <D.18154>:
      FindClose (find_handle);
      D.18155 = find_data.dwFileAttributes;
      data->dwFileAttributes = D.18155;
      data->ftCreationTime = find_data.ftCreationTime;
      data->ftLastAccessTime = find_data.ftLastAccessTime;
      data->ftLastWriteTime = find_data.ftLastWriteTime;
      D.18156 = find_data.nFileSizeHigh;
      data->nFileSizeHigh = D.18156;
      D.18157 = find_data.nFileSizeLow;
      data->nFileSizeLow = D.18157;
      D.18149 = 1;
      return D.18149;
    }
  finally
    {
      find_data = {CLOBBER};
    }
}


convert_win32_file_attribute_data (const struct WIN32_FILE_ATTRIBUTE_DATA * data, struct MonoIOStat * stat)
{
  unsigned int D.18160;
  int D.18161;
  const struct WapiFileTime * D.18162;
  long int D.18163;
  const struct WapiFileTime * D.18164;
  long int D.18165;
  const struct WapiFileTime * D.18166;
  long int D.18167;
  unsigned int D.18168;
  long int D.18169;
  long int D.18170;
  unsigned int D.18171;
  long int D.18172;
  long int D.18173;

  D.18160 = data->dwFileAttributes;
  D.18161 = (int) D.18160;
  stat->attributes = D.18161;
  D.18162 = &data->ftCreationTime;
  D.18163 = convert_filetime (D.18162);
  stat->creation_time = D.18163;
  D.18164 = &data->ftLastAccessTime;
  D.18165 = convert_filetime (D.18164);
  stat->last_access_time = D.18165;
  D.18166 = &data->ftLastWriteTime;
  D.18167 = convert_filetime (D.18166);
  stat->last_write_time = D.18167;
  D.18168 = data->nFileSizeHigh;
  D.18169 = (long int) D.18168;
  D.18170 = D.18169 << 32;
  D.18171 = data->nFileSizeLow;
  D.18172 = (long int) D.18171;
  D.18173 = D.18170 | D.18172;
  stat->length = D.18173;
}


convert_filetime (const struct FILETIME * filetime)
{
  unsigned int D.18174;
  unsigned int D.18175;
  long unsigned int D.18176;
  gint64 D.18177;
  guint64 ticks;

  D.18174 = filetime->dwHighDateTime;
  ticks = (guint64) D.18174;
  ticks = ticks << 32;
  D.18175 = filetime->dwLowDateTime;
  D.18176 = (long unsigned int) D.18175;
  ticks = D.18176 + ticks;
  D.18177 = (gint64) ticks;
  return D.18177;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memset (void * __dest, int __ch, size_t __len)
{
  void * D.18179;
  long unsigned int D.18180;

  D.18180 = __builtin_object_size (__dest, 0);
  D.18179 = __builtin___memset_chk (__dest, __ch, __len, D.18180);
  return D.18179;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Open (struct MonoString * filename, gint32 mode, gint32 access_mode, gint32 share, gint32 options, gint32 * error)
{
  int D.18184;
  int D.18188;
  int D.18191;
  int D.18194;
  int D.18197;
  int D.18200;
  unsigned int attributes.6;
  unsigned int D.18206;
  unsigned int D.18208;
  int D.18211;
  <unnamed type> access_mode.7;
  unsigned int D.18215;
  <unnamed type> share.8;
  unsigned int D.18217;
  <unnamed type> mode.9;
  unsigned int D.18219;
  unsigned int attributes.10;
  unsigned int D.18223;
  int D.18224;
  void * D.18225;
  void * ret;
  int attributes;
  int attrs;
  gunichar2 * chars;

  chars = mono_string_chars (filename);
  *error = 0;
  if (options != 0) goto <D.18182>; else goto <D.18183>;
  <D.18182>:
  D.18184 = options & 16384;
  if (D.18184 != 0) goto <D.18185>; else goto <D.18186>;
  <D.18185>:
  attributes = 64;
  goto <D.18187>;
  <D.18186>:
  attributes = 128;
  <D.18187>:
  D.18188 = options & 67108864;
  if (D.18188 != 0) goto <D.18189>; else goto <D.18190>;
  <D.18189>:
  attributes = attributes | 67108864;
  <D.18190>:
  D.18191 = options & 134217728;
  if (D.18191 != 0) goto <D.18192>; else goto <D.18193>;
  <D.18192>:
  attributes = attributes | 134217728;
  <D.18193>:
  D.18194 = options & 268435456;
  if (D.18194 != 0) goto <D.18195>; else goto <D.18196>;
  <D.18195>:
  attributes = attributes | 268435456;
  <D.18196>:
  D.18197 = options & 1;
  if (D.18197 != 0) goto <D.18198>; else goto <D.18199>;
  <D.18198>:
  attributes = attributes | 256;
  <D.18199>:
  D.18200 = options & 1073741824;
  if (D.18200 != 0) goto <D.18201>; else goto <D.18202>;
  <D.18201>:
  attributes = attributes | 1073741824;
  <D.18202>:
  if (options < 0) goto <D.18203>; else goto <D.18204>;
  <D.18203>:
  attributes.6 = (unsigned int) attributes;
  D.18206 = attributes.6 | 2147483648;
  attributes = (int) D.18206;
  <D.18204>:
  goto <D.18207>;
  <D.18183>:
  attributes = 128;
  <D.18207>:
  D.18208 = get_file_attributes (chars);
  attrs = (int) D.18208;
  if (attrs != -1) goto <D.18209>; else goto <D.18210>;
  <D.18209>:
  D.18211 = attrs & 16;
  if (D.18211 != 0) goto <D.18212>; else goto <D.18213>;
  <D.18212>:
  attributes = attributes | 33554432;
  <D.18213>:
  <D.18210>:
  access_mode.7 = (<unnamed type>) access_mode;
  D.18215 = convert_access (access_mode.7);
  share.8 = (<unnamed type>) share;
  D.18217 = convert_share (share.8);
  mode.9 = (<unnamed type>) mode;
  D.18219 = convert_mode (mode.9);
  attributes.10 = (unsigned int) attributes;
  ret = CreateFile (chars, D.18215, D.18217, 0B, D.18219, attributes.10, 0B);
  if (ret == -1B) goto <D.18221>; else goto <D.18222>;
  <D.18221>:
  D.18223 = GetLastError ();
  D.18224 = (int) D.18223;
  *error = D.18224;
  <D.18222>:
  D.18225 = ret;
  return D.18225;
}


convert_access (MonoFileAccess mono_access)
{
  guint32 D.18227;
  guint32 access;

  switch (mono_access) <default: <D.17565>, case 1: <D.17561>, case 2: <D.17563>, case 3: <D.17564>>
  <D.17561>:
  access = 2147483648;
  goto <D.17562>;
  <D.17563>:
  access = 1073741824;
  goto <D.17562>;
  <D.17564>:
  access = 3221225472;
  goto <D.17562>;
  <D.17565>:
  monoeg_g_log (0B, 16, "System.IO.FileAccess has unknown value 0x%x", mono_access);
  access = 2147483648;
  <D.17562>:
  D.18227 = access;
  return D.18227;
}


convert_share (MonoFileShare mono_share)
{
  unsigned int D.18229;
  unsigned int D.18232;
  unsigned int D.18235;
  unsigned int D.18238;
  guint32 D.18241;
  guint32 share;

  share = 0;
  D.18229 = mono_share & 1;
  if (D.18229 != 0) goto <D.18230>; else goto <D.18231>;
  <D.18230>:
  share = share | 1;
  <D.18231>:
  D.18232 = mono_share & 2;
  if (D.18232 != 0) goto <D.18233>; else goto <D.18234>;
  <D.18233>:
  share = share | 2;
  <D.18234>:
  D.18235 = mono_share & 4;
  if (D.18235 != 0) goto <D.18236>; else goto <D.18237>;
  <D.18236>:
  share = share | 4;
  <D.18237>:
  D.18238 = mono_share & 4294967288;
  if (D.18238 != 0) goto <D.18239>; else goto <D.18240>;
  <D.18239>:
  monoeg_g_log (0B, 16, "System.IO.FileShare has unknown value 0x%x", mono_share);
  share = 0;
  <D.18240>:
  D.18241 = share;
  return D.18241;
}


convert_mode (MonoFileMode mono_mode)
{
  guint32 D.18243;
  guint32 mode;

  switch (mono_mode) <default: <D.17556>, case 1: <D.17549>, case 2: <D.17551>, case 3: <D.17552>, case 4: <D.17553>, case 5: <D.17554>, case 6: <D.17555>>
  <D.17549>:
  mode = 1;
  goto <D.17550>;
  <D.17551>:
  mode = 2;
  goto <D.17550>;
  <D.17552>:
  mode = 3;
  goto <D.17550>;
  <D.17553>:
  mode = 4;
  goto <D.17550>;
  <D.17554>:
  mode = 5;
  goto <D.17550>;
  <D.17555>:
  mode = 4;
  goto <D.17550>;
  <D.17556>:
  monoeg_g_log (0B, 16, "System.IO.FileMode has unknown value 0x%x", mono_mode);
  mode = 3;
  <D.17550>:
  D.18243 = mode;
  return D.18243;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Close (void * handle, gint32 * error)
{
  unsigned int D.18247;
  int D.18248;
  MonoBoolean D.18249;
  gboolean ret;

  *error = 0;
  ret = CloseHandle (handle);
  if (ret == 0) goto <D.18245>; else goto <D.18246>;
  <D.18245>:
  D.18247 = GetLastError ();
  D.18248 = (int) D.18247;
  *error = D.18248;
  <D.18246>:
  D.18249 = (MonoBoolean) ret;
  return D.18249;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Read (void * handle, struct MonoArray * dest, gint32 dest_offset, gint32 count, gint32 * error)
{
  _Bool D.18251;
  long int D.18252;
  long int D.18253;
  long unsigned int D.18258;
  long unsigned int D.18259;
  long unsigned int D.18260;
  long unsigned int D.18261;
  struct MonoException * D.18264;
  unsigned int count.11;
  unsigned int D.18268;
  int D.18269;
  gint32 D.18270;
  unsigned int n.12;
  guchar * buffer;
  gboolean result;
  guint32 n;

  try
    {
      *error = 0;
      D.18251 = dest == 0B;
      D.18252 = (long int) D.18251;
      D.18253 = __builtin_expect (D.18252, 0);
      if (D.18253 != 0) goto <D.18254>; else goto <D.18255>;
      <D.18254>:
      {
        struct MonoException * ex;

        if (dest != 0B) goto <D.18256>; else goto <D.18257>;
        <D.18256>:
        <D.18257>:
        ex = mono_get_exception_argument_null ("dest");
        mono_raise_exception (ex);
      }
      <D.18255>:
      D.18258 = (long unsigned int) dest_offset;
      D.18259 = mono_array_length (dest);
      D.18260 = (long unsigned int) count;
      D.18261 = D.18259 - D.18260;
      if (D.18258 > D.18261) goto <D.18262>; else goto <D.18263>;
      <D.18262>:
      D.18264 = mono_get_exception_argument ("array", "array too small. numBytes/offset wrong.");
      mono_raise_exception (D.18264);
      <D.18263>:
      D.18258 = (long unsigned int) dest_offset;
      buffer = mono_array_addr_with_size (dest, 1, D.18258);
      count.11 = (unsigned int) count;
      result = ReadFile (handle, buffer, count.11, &n, 0B);
      if (result == 0) goto <D.18266>; else goto <D.18267>;
      <D.18266>:
      D.18268 = GetLastError ();
      D.18269 = (int) D.18268;
      *error = D.18269;
      D.18270 = -1;
      return D.18270;
      <D.18267>:
      n.12 = n;
      D.18270 = (gint32) n.12;
      return D.18270;
    }
  finally
    {
      n = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Write (void * handle, struct MonoArray * src, gint32 src_offset, gint32 count, gint32 * error)
{
  _Bool D.18274;
  long int D.18275;
  long int D.18276;
  long unsigned int D.18281;
  long unsigned int D.18282;
  long unsigned int D.18283;
  long unsigned int D.18284;
  struct MonoException * D.18287;
  unsigned int count.13;
  unsigned int D.18291;
  int D.18292;
  gint32 D.18293;
  unsigned int n.14;
  guchar * buffer;
  gboolean result;
  guint32 n;

  try
    {
      *error = 0;
      D.18274 = src == 0B;
      D.18275 = (long int) D.18274;
      D.18276 = __builtin_expect (D.18275, 0);
      if (D.18276 != 0) goto <D.18277>; else goto <D.18278>;
      <D.18277>:
      {
        struct MonoException * ex;

        if (src != 0B) goto <D.18279>; else goto <D.18280>;
        <D.18279>:
        <D.18280>:
        ex = mono_get_exception_argument_null ("src");
        mono_raise_exception (ex);
      }
      <D.18278>:
      D.18281 = (long unsigned int) src_offset;
      D.18282 = mono_array_length (src);
      D.18283 = (long unsigned int) count;
      D.18284 = D.18282 - D.18283;
      if (D.18281 > D.18284) goto <D.18285>; else goto <D.18286>;
      <D.18285>:
      D.18287 = mono_get_exception_argument ("array", "array too small. numBytes/offset wrong.");
      mono_raise_exception (D.18287);
      <D.18286>:
      D.18281 = (long unsigned int) src_offset;
      buffer = mono_array_addr_with_size (src, 1, D.18281);
      count.13 = (unsigned int) count;
      result = WriteFile (handle, buffer, count.13, &n, 0B);
      if (result == 0) goto <D.18289>; else goto <D.18290>;
      <D.18289>:
      D.18291 = GetLastError ();
      D.18292 = (int) D.18291;
      *error = D.18292;
      D.18293 = -1;
      return D.18293;
      <D.18290>:
      n.14 = n;
      D.18293 = (gint32) n.14;
      return D.18293;
    }
  finally
    {
      n = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Seek (void * handle, gint64 offset, gint32 origin, gint32 * error)
{
  long int D.18297;
  int offset_hi.15;
  int D.18299;
  <unnamed type> origin.16;
  unsigned int D.18301;
  unsigned int D.18302;
  unsigned int D.18305;
  int D.18306;
  gint64 D.18307;
  int offset_hi.17;
  long int D.18309;
  long int D.18310;
  gint32 offset_hi;

  try
    {
      *error = 0;
      D.18297 = offset >> 32;
      offset_hi.15 = (int) D.18297;
      offset_hi = offset_hi.15;
      D.18299 = (int) offset;
      origin.16 = (<unnamed type>) origin;
      D.18301 = convert_seekorigin (origin.16);
      D.18302 = SetFilePointer (handle, D.18299, &offset_hi, D.18301);
      offset = (gint64) D.18302;
      if (offset == 4294967295) goto <D.18303>; else goto <D.18304>;
      <D.18303>:
      D.18305 = GetLastError ();
      D.18306 = (int) D.18305;
      *error = D.18306;
      <D.18304>:
      offset_hi.17 = offset_hi;
      D.18309 = (long int) offset_hi.17;
      D.18310 = D.18309 << 32;
      D.18307 = D.18310 | offset;
      return D.18307;
    }
  finally
    {
      offset_hi = {CLOBBER};
    }
}


convert_seekorigin (MonoSeekOrigin origin)
{
  guint32 D.18313;
  guint32 w32origin;

  switch (origin) <default: <D.17578>, case 0: <D.17574>, case 1: <D.17576>, case 2: <D.17577>>
  <D.17574>:
  w32origin = 0;
  goto <D.17575>;
  <D.17576>:
  w32origin = 1;
  goto <D.17575>;
  <D.17577>:
  w32origin = 2;
  goto <D.17575>;
  <D.17578>:
  monoeg_g_log (0B, 16, "System.IO.SeekOrigin has unknown value 0x%x", origin);
  w32origin = 1;
  <D.17575>:
  D.18313 = w32origin;
  return D.18313;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Flush (void * handle, gint32 * error)
{
  unsigned int D.18317;
  int D.18318;
  MonoBoolean D.18319;
  gboolean ret;

  *error = 0;
  ret = FlushFileBuffers (handle);
  if (ret == 0) goto <D.18315>; else goto <D.18316>;
  <D.18315>:
  D.18317 = GetLastError ();
  D.18318 = (int) D.18317;
  *error = D.18318;
  <D.18316>:
  D.18319 = (MonoBoolean) ret;
  return D.18319;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetLength (void * handle, gint32 * error)
{
  unsigned int D.18321;
  unsigned int D.18324;
  int D.18325;
  gint64 D.18326;
  unsigned int length_hi.18;
  long int D.18328;
  long int D.18329;
  gint64 length;
  guint32 length_hi;

  try
    {
      *error = 0;
      D.18321 = GetFileSize (handle, &length_hi);
      length = (gint64) D.18321;
      if (length == 4294967295) goto <D.18322>; else goto <D.18323>;
      <D.18322>:
      D.18324 = GetLastError ();
      D.18325 = (int) D.18324;
      *error = D.18325;
      <D.18323>:
      length_hi.18 = length_hi;
      D.18328 = (long int) length_hi.18;
      D.18329 = D.18328 << 32;
      D.18326 = D.18329 | length;
      return D.18326;
    }
  finally
    {
      length_hi = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_SetLength (void * handle, gint64 length, gint32 * error)
{
  unsigned int D.18332;
  unsigned int D.18335;
  int D.18336;
  MonoBoolean D.18337;
  long int D.18338;
  int length_hi.19;
  int D.18340;
  unsigned int D.18341;
  unsigned int D.18344;
  int D.18345;
  unsigned int D.18348;
  int D.18349;
  int D.18350;
  unsigned int D.18351;
  unsigned int D.18354;
  int D.18355;
  gint64 offset;
  gint64 offset_set;
  gint32 offset_hi;
  gint32 length_hi;
  gboolean result;

  try
    {
      *error = 0;
      offset_hi = 0;
      D.18332 = SetFilePointer (handle, 0, &offset_hi, 1);
      offset = (gint64) D.18332;
      if (offset == 4294967295) goto <D.18333>; else goto <D.18334>;
      <D.18333>:
      D.18335 = GetLastError ();
      D.18336 = (int) D.18335;
      *error = D.18336;
      D.18337 = 0;
      return D.18337;
      <D.18334>:
      D.18338 = length >> 32;
      length_hi.19 = (int) D.18338;
      length_hi = length_hi.19;
      D.18340 = (int) length;
      D.18341 = SetFilePointer (handle, D.18340, &length_hi, 0);
      offset_set = (gint64) D.18341;
      if (offset_set == 4294967295) goto <D.18342>; else goto <D.18343>;
      <D.18342>:
      D.18344 = GetLastError ();
      D.18345 = (int) D.18344;
      *error = D.18345;
      D.18337 = 0;
      return D.18337;
      <D.18343>:
      result = SetEndOfFile (handle);
      if (result == 0) goto <D.18346>; else goto <D.18347>;
      <D.18346>:
      D.18348 = GetLastError ();
      D.18349 = (int) D.18348;
      *error = D.18349;
      D.18337 = 0;
      return D.18337;
      <D.18347>:
      D.18350 = (int) offset;
      D.18351 = SetFilePointer (handle, D.18350, &offset_hi, 0);
      offset_set = (gint64) D.18351;
      if (offset_set == 4294967295) goto <D.18352>; else goto <D.18353>;
      <D.18352>:
      D.18354 = GetLastError ();
      D.18355 = (int) D.18354;
      *error = D.18355;
      D.18337 = 0;
      return D.18337;
      <D.18353>:
      D.18337 = (MonoBoolean) result;
      return D.18337;
    }
  finally
    {
      offset_hi = {CLOBBER};
      length_hi = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_SetFileTime (void * handle, gint64 creation_time, gint64 last_access_time, gint64 last_write_time, gint32 * error)
{
  long int creation_time.20;
  long int last_access_time.21;
  long int last_write_time.22;
  unsigned int D.18372;
  int D.18373;
  MonoBoolean D.18374;
  gboolean ret;
  const struct FILETIME * creation_filetime;
  const struct FILETIME * last_access_filetime;
  const struct FILETIME * last_write_filetime;

  *error = 0;
  creation_time.20 = creation_time;
  if (creation_time.20 < 0) goto <D.18359>; else goto <D.18360>;
  <D.18359>:
  creation_filetime = 0B;
  goto <D.18361>;
  <D.18360>:
  creation_filetime = &creation_time;
  <D.18361>:
  last_access_time.21 = last_access_time;
  if (last_access_time.21 < 0) goto <D.18363>; else goto <D.18364>;
  <D.18363>:
  last_access_filetime = 0B;
  goto <D.18365>;
  <D.18364>:
  last_access_filetime = &last_access_time;
  <D.18365>:
  last_write_time.22 = last_write_time;
  if (last_write_time.22 < 0) goto <D.18367>; else goto <D.18368>;
  <D.18367>:
  last_write_filetime = 0B;
  goto <D.18369>;
  <D.18368>:
  last_write_filetime = &last_write_time;
  <D.18369>:
  ret = SetFileTime (handle, creation_filetime, last_access_filetime, last_write_filetime);
  if (ret == 0) goto <D.18370>; else goto <D.18371>;
  <D.18370>:
  D.18372 = GetLastError ();
  D.18373 = (int) D.18372;
  *error = D.18373;
  <D.18371>:
  D.18374 = (MonoBoolean) ret;
  return D.18374;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
{
  void * D.18376;

  D.18376 = GetStdHandle (-11);
  return D.18376;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_ConsoleInput ()
{
  void * D.18378;

  D.18378 = GetStdHandle (-10);
  return D.18378;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_ConsoleError ()
{
  void * D.18380;

  D.18380 = GetStdHandle (-12);
  return D.18380;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_CreatePipe (void * * read_handle, void * * write_handle)
{
  MonoBoolean D.18384;
  struct SECURITY_ATTRIBUTES attr;
  gboolean ret;

  try
    {
      attr.nLength = 24;
      attr.bInheritHandle = 1;
      attr.lpSecurityDescriptor = 0B;
      ret = CreatePipe (read_handle, write_handle, &attr, 0);
      if (ret == 0) goto <D.18382>; else goto <D.18383>;
      <D.18382>:
      D.18384 = 0;
      return D.18384;
      <D.18383>:
      D.18384 = 1;
      return D.18384;
    }
  finally
    {
      attr = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_DuplicateHandle (void * source_process_handle, void * source_handle, void * target_process_handle, void * * target_handle, gint32 access, gint32 inherit, gint32 options)
{
  unsigned int access.23;
  unsigned int options.24;
  MonoBoolean D.18391;
  gboolean ret;

  access.23 = (unsigned int) access;
  options.24 = (unsigned int) options;
  ret = DuplicateHandle (source_process_handle, source_handle, target_process_handle, target_handle, access.23, inherit, options.24);
  if (ret == 0) goto <D.18389>; else goto <D.18390>;
  <D.18389>:
  D.18391 = 0;
  return D.18391;
  <D.18390>:
  D.18391 = 1;
  return D.18391;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
{
  gunichar2 D.18393;

  D.18393 = 47;
  return D.18393;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
{
  gunichar2 D.18395;

  D.18395 = 47;
  return D.18395;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
{
  int __mono_io_portability_helpers.25;
  gunichar2 D.18400;

  __mono_io_portability_helpers.25 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.25 > 0) goto <D.18398>; else goto <D.18399>;
  <D.18398>:
  D.18400 = 92;
  return D.18400;
  <D.18399>:
  D.18400 = 47;
  return D.18400;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_PathSeparator ()
{
  gunichar2 D.18402;

  D.18402 = 58;
  return D.18402;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
{
  struct MonoClass * D.18404;
  long unsigned int D.18405;
  long unsigned int D.18406;
  short unsigned int D.18407;
  struct MonoArray * D.18408;
  struct MonoArray * chars;
  struct MonoDomain * domain;
  int i;
  int n;

  domain = mono_domain_get ();
  n = 1;
  D.18404 = mono_defaults.char_class;
  D.18405 = (long unsigned int) n;
  chars = mono_array_new (domain, D.18404, D.18405);
  i = 0;
  goto <D.17879>;
  <D.17878>:
  {
    gunichar2 * __p;

    D.18406 = (long unsigned int) i;
    __p = mono_array_addr_with_size (chars, 2, D.18406);
    D.18407 = 0;
    *__p = D.18407;
  }
  i = i + 1;
  <D.17879>:
  if (i < n) goto <D.17878>; else goto <D.17880>;
  <D.17880>:
  D.18408 = chars;
  return D.18408;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_GetTempPath (struct MonoString * * mono_name)
{
  unsigned int D.18410;
  int D.18413;
  long unsigned int D.18414;
  long unsigned int D.18415;
  unsigned int ret.26;
  unsigned int D.18417;
  struct MonoDomain * D.18420;
  struct MonoString * D.18421;
  gint32 D.18422;
  gunichar2 * name;
  int ret;

  name = monoeg_malloc0 (512);
  D.18410 = GetTempPath (256, name);
  ret = (int) D.18410;
  if (ret > 255) goto <D.18411>; else goto <D.18412>;
  <D.18411>:
  monoeg_g_free (name);
  D.18413 = ret + 2;
  D.18414 = (long unsigned int) D.18413;
  D.18415 = D.18414 * 2;
  name = monoeg_malloc0 (D.18415);
  ret.26 = (unsigned int) ret;
  D.18417 = GetTempPath (ret.26, name);
  ret = (int) D.18417;
  <D.18412>:
  if (ret > 0) goto <D.18418>; else goto <D.18419>;
  <D.18418>:
  D.18420 = mono_domain_get ();
  D.18421 = mono_string_new_utf16 (D.18420, name, ret);
  mono_gc_wbarrier_generic_store (mono_name, D.18421);
  <D.18419>:
  monoeg_g_free (name);
  D.18422 = ret;
  return D.18422;
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Lock (void * handle, gint64 position, gint64 length, gint32 * error)
{
  unsigned int D.18424;
  long int D.18425;
  unsigned int D.18426;
  unsigned int D.18427;
  long int D.18428;
  unsigned int D.18429;
  unsigned int D.18432;
  int D.18433;
  gboolean ret;

  *error = 0;
  D.18424 = (unsigned int) position;
  D.18425 = position >> 32;
  D.18426 = (unsigned int) D.18425;
  D.18427 = (unsigned int) length;
  D.18428 = length >> 32;
  D.18429 = (unsigned int) D.18428;
  ret = LockFile (handle, D.18424, D.18426, D.18427, D.18429);
  if (ret == 0) goto <D.18430>; else goto <D.18431>;
  <D.18430>:
  D.18432 = GetLastError ();
  D.18433 = (int) D.18432;
  *error = D.18433;
  <D.18431>:
}


__attribute__((visibility ("hidden")))
ves_icall_System_IO_MonoIO_Unlock (void * handle, gint64 position, gint64 length, gint32 * error)
{
  unsigned int D.18434;
  long int D.18435;
  unsigned int D.18436;
  unsigned int D.18437;
  long int D.18438;
  unsigned int D.18439;
  unsigned int D.18442;
  int D.18443;
  gboolean ret;

  *error = 0;
  D.18434 = (unsigned int) position;
  D.18435 = position >> 32;
  D.18436 = (unsigned int) D.18435;
  D.18437 = (unsigned int) length;
  D.18438 = length >> 32;
  D.18439 = (unsigned int) D.18438;
  ret = UnlockFile (handle, D.18434, D.18436, D.18437, D.18439);
  if (ret == 0) goto <D.18440>; else goto <D.18441>;
  <D.18440>:
  D.18442 = GetLastError ();
  D.18443 = (int) D.18442;
  *error = D.18443;
  <D.18441>:
}


