ves_icall_System_IO_MonoIO_CreateDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17757;
  unsigned int D.17760;
  int D.17761;
  MonoBoolean D.17762;
  gboolean ret;

  *error = 0;
  D.17757 = mono_string_chars (path);
  ret = CreateDirectory (D.17757, 0B);
  if (ret == 0) goto <D.17758>; else goto <D.17759>;
  <D.17758>:
  D.17760 = GetLastError ();
  D.17761 = (int) D.17760;
  *error = D.17761;
  <D.17759>:
  D.17762 = (MonoBoolean) ret;
  return D.17762;
}


ves_icall_System_IO_MonoIO_RemoveDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17764;
  unsigned int D.17767;
  int D.17768;
  MonoBoolean D.17769;
  gboolean ret;

  *error = 0;
  D.17764 = mono_string_chars (path);
  ret = RemoveDirectory (D.17764);
  if (ret == 0) goto <D.17765>; else goto <D.17766>;
  <D.17765>:
  D.17767 = GetLastError ();
  D.17768 = (int) D.17767;
  *error = D.17768;
  <D.17766>:
  D.17769 = (MonoBoolean) ret;
  return D.17769;
}


ves_icall_System_IO_MonoIO_GetFileSystemEntries (struct MonoString * path, struct MonoString * path_with_pattern, gint attrs, gint mask, gint32 * error)
{
  unsigned int D.17771;
  mono_unichar2 * D.17772;
  unsigned int D.17773;
  int D.17776;
  unsigned int D.17780;
  int D.17781;
  mono_unichar2 * D.17782;
  unsigned int D.17785;
  _Bool D.17786;
  _Bool D.17787;
  _Bool D.17788;
  unsigned int D.17792;
  unsigned int D.17793;
  short unsigned int D.17796;
  unsigned int D.17797;
  unsigned int mask.0;
  unsigned int D.17799;
  unsigned int attrs.1;
  int D.17805;
  int D.17806;
  unsigned int D.17809;
  int D.17810;
  unsigned int D.17812;
  long unsigned int D.17813;
  struct MonoClass * D.17814;
  long unsigned int D.17815;
  void * * D.17816;
  long unsigned int D.17817;
  long unsigned int D.17818;
  void * * D.17819;
  void * D.17820;
  struct MonoString * D.17821;
  unsigned int i.2;
  int D.17825;
  struct MonoArray * D.17828;
  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.17771 = convert_attrs (mask);
      mask = (gint) D.17771;
      D.17772 = mono_string_chars (path);
      D.17773 = get_file_attributes (D.17772);
      attributes = (gint32) D.17773;
      if (attributes != -1) goto <D.17774>; else goto <D.17775>;
      <D.17774>:
      D.17776 = attributes & 16;
      if (D.17776 == 0) goto <D.17777>; else goto <D.17778>;
      <D.17777>:
      *error = 123;
      goto leave;
      <D.17778>:
      goto <D.17779>;
      <D.17775>:
      D.17780 = GetLastError ();
      D.17781 = (int) D.17780;
      *error = D.17781;
      goto leave;
      <D.17779>:
      D.17782 = mono_string_chars (path_with_pattern);
      find_handle = FindFirstFile (D.17782, &data);
      if (find_handle == -1B) goto <D.17783>; else goto <D.17784>;
      <D.17783>:
      {
        gint32 find_error;

        D.17785 = GetLastError ();
        find_error = (gint32) D.17785;
        D.17786 = find_error == 2;
        D.17787 = find_error == 18;
        D.17788 = D.17786 | D.17787;
        if (D.17788 != 0) goto leave; else goto <D.17789>;
        <D.17789>:
        *error = find_error;
        goto leave;
      }
      <D.17784>:
      utf8_path = get_search_dir (path_with_pattern);
      names = monoeg_g_ptr_array_new ();
      <D.17496>:
      D.17792 = BIT_FIELD_REF <data, 32, 352>;
      D.17793 = D.17792;
      if (D.17793 == 46) goto <D.17790>; else goto <D.17794>;
      <D.17794>:
      D.17792 = BIT_FIELD_REF <data, 32, 352>;
      D.17793 = D.17792;
      if (D.17793 == 3014702) goto <D.17795>; else goto <D.17791>;
      <D.17795>:
      D.17796 = data.cFileName[2];
      if (D.17796 == 0) goto <D.17790>; else goto <D.17791>;
      <D.17790>:
      // predicted unlikely by continue predictor.
      goto <D.17495>;
      <D.17791>:
      D.17797 = data.dwFileAttributes;
      mask.0 = (unsigned int) mask;
      D.17799 = D.17797 & mask.0;
      attrs.1 = (unsigned int) attrs;
      if (D.17799 == attrs.1) goto <D.17801>; else goto <D.17802>;
      <D.17801>:
      utf8_result = monoeg_g_utf16_to_utf8 (&data.cFileName, -1, 0B, 0B, 0B);
      if (utf8_result == 0B) goto <D.17803>; else goto <D.17804>;
      <D.17803>:
      // predicted unlikely by continue predictor.
      goto <D.17495>;
      <D.17804>:
      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.17802>:
      <D.17495>:
      D.17805 = FindNextFile (find_handle, &data);
      if (D.17805 != 0) goto <D.17496>; else goto <D.17497>;
      <D.17497>:
      D.17806 = FindClose (find_handle);
      if (D.17806 == 0) goto <D.17807>; else goto <D.17808>;
      <D.17807>:
      D.17809 = GetLastError ();
      D.17810 = (int) D.17809;
      *error = D.17810;
      result = 0B;
      goto <D.17811>;
      <D.17808>:
      D.17812 = names->len;
      D.17813 = (long unsigned int) D.17812;
      D.17814 = mono_defaults.string_class;
      result = mono_array_new (domain, D.17814, D.17813);
      i = 0;
      goto <D.17500>;
      <D.17499>:
      {
        void * * __p;

        D.17815 = (long unsigned int) i;
        __p = mono_array_addr_with_size (result, 8, D.17815);
        D.17816 = names->pdata;
        D.17817 = (long unsigned int) i;
        D.17818 = D.17817 * 8;
        D.17819 = D.17816 + D.17818;
        D.17820 = *D.17819;
        D.17821 = mono_string_new (domain, D.17820);
        mono_gc_wbarrier_set_arrayref (result, __p, D.17821);
      }
      i = i + 1;
      <D.17500>:
      i.2 = (unsigned int) i;
      D.17812 = names->len;
      if (i.2 < D.17812) goto <D.17499>; else goto <D.17501>;
      <D.17501>:
      <D.17811>:
      i = 0;
      goto <D.17503>;
      <D.17502>:
      D.17816 = names->pdata;
      D.17817 = (long unsigned int) i;
      D.17818 = D.17817 * 8;
      D.17819 = D.17816 + D.17818;
      D.17820 = *D.17819;
      monoeg_g_free (D.17820);
      i = i + 1;
      <D.17503>:
      i.2 = (unsigned int) i;
      D.17812 = names->len;
      if (i.2 < D.17812) goto <D.17502>; else goto <D.17504>;
      <D.17504>:
      monoeg_g_ptr_array_free (names, 1);
      monoeg_g_free (utf8_path);
      leave:
      if (result == 0B) goto <D.17823>; else goto <D.17824>;
      <D.17823>:
      D.17825 = *error;
      if (D.17825 == 0) goto <D.17826>; else goto <D.17827>;
      <D.17826>:
      D.17814 = mono_defaults.string_class;
      result = mono_array_new (domain, D.17814, 0);
      <D.17827>:
      <D.17824>:
      D.17828 = result;
      return D.17828;
    }
  finally
    {
      data = {CLOBBER};
    }
}


convert_attrs (MonoFileAttributes attrs)
{
  int D.17831;
  guint32 D.17834;

  D.17831 = attrs & 16384;
  if (D.17831 != 0) goto <D.17832>; else goto <D.17833>;
  <D.17832>:
  attrs = attrs | 64;
  <D.17833>:
  D.17834 = (guint32) attrs;
  return D.17834;
}


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

  try
    {
      res = GetFileAttributes (path);
      if (res != 4294967295) goto <D.17836>; else goto <D.17837>;
      <D.17836>:
      D.17838 = res;
      return D.17838;
      <D.17837>:
      D.17839 = GetLastError ();
      error = (gint32) D.17839;
      if (error != 32) goto <D.17840>; else goto <D.17841>;
      <D.17840>:
      D.17838 = res;
      return D.17838;
      <D.17841>:
      find_handle = FindFirstFile (path, &find_data);
      if (find_handle == -1B) goto <D.17842>; else goto <D.17843>;
      <D.17842>:
      D.17838 = res;
      return D.17838;
      <D.17843>:
      FindClose (find_handle);
      D.17838 = find_data.dwFileAttributes;
      return D.17838;
    }
  finally
    {
      find_data = {CLOBBER};
    }
}


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

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


ves_icall_System_IO_MonoIO_FindFirst (struct MonoString * path, struct MonoString * path_with_pattern, gint32 * result_attr, gint32 * error, void * * handle)
{
  mono_unichar2 * D.17848;
  unsigned int D.17851;
  struct MonoString * D.17854;
  char * D.17855;
  struct MonoDomain * D.17856;
  int D.17857;
  unsigned int D.17860;
  int D.17863;
  unsigned int D.17864;
  int D.17865;
  struct WIN32_FIND_DATA data;
  void * find_handle;
  struct IncrementalFind * ifh;
  struct MonoString * result;

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

        D.17851 = GetLastError ();
        find_error = (gint32) D.17851;
        *handle = 0B;
        if (find_error == 2) goto <D.17852>; else goto <D.17853>;
        <D.17852>:
        D.17854 = 0B;
        return D.17854;
        <D.17853>:
        *error = find_error;
        D.17854 = 0B;
        return D.17854;
      }
      <D.17850>:
      ifh = monoeg_malloc (24);
      ifh->find_handle = find_handle;
      D.17855 = mono_string_to_utf8 (path);
      ifh->utf8_path = D.17855;
      D.17856 = mono_domain_get ();
      ifh->domain = D.17856;
      *handle = ifh;
      goto <D.17531>;
      <D.17530>:
      D.17857 = FindNextFile (find_handle, &data);
      if (D.17857 == 0) goto <D.17858>; else goto <D.17859>;
      <D.17858>:
      {
        int e;

        D.17860 = GetLastError ();
        e = (int) D.17860;
        if (e != 18) goto <D.17861>; else goto <D.17862>;
        <D.17861>:
        *error = e;
        <D.17862>:
        D.17854 = 0B;
        return D.17854;
      }
      <D.17859>:
      <D.17531>:
      D.17863 = incremental_find_check_match (ifh, &data, &result);
      if (D.17863 == 0) goto <D.17530>; else goto <D.17532>;
      <D.17532>:
      D.17864 = data.dwFileAttributes;
      D.17865 = (int) D.17864;
      *result_attr = D.17865;
      D.17854 = result;
      return D.17854;
    }
  finally
    {
      data = {CLOBBER};
      result = {CLOBBER};
    }
}


incremental_find_check_match (struct IncrementalFind * handle, struct WIN32_FIND_DATA * data, struct MonoString * * result)
{
  unsigned int D.17870;
  unsigned int D.17871;
  short unsigned int D.17874;
  gboolean D.17875;
  gunichar2[260] * D.17876;
  gchar * D.17879;
  struct MonoDomain * D.17880;
  struct MonoString * D.17881;
  gchar * utf8_result;
  gchar * full_name;

  D.17870 = BIT_FIELD_REF <*data, 32, 352>;
  D.17871 = D.17870;
  if (D.17871 == 46) goto <D.17868>; else goto <D.17872>;
  <D.17872>:
  D.17870 = BIT_FIELD_REF <*data, 32, 352>;
  D.17871 = D.17870;
  if (D.17871 == 3014702) goto <D.17873>; else goto <D.17869>;
  <D.17873>:
  D.17874 = data->cFileName[2];
  if (D.17874 == 0) goto <D.17868>; else goto <D.17869>;
  <D.17868>:
  D.17875 = 0;
  return D.17875;
  <D.17869>:
  D.17876 = &data->cFileName;
  utf8_result = monoeg_g_utf16_to_utf8 (D.17876, -1, 0B, 0B, 0B);
  if (utf8_result == 0B) goto <D.17877>; else goto <D.17878>;
  <D.17877>:
  D.17875 = 0;
  return D.17875;
  <D.17878>:
  D.17879 = handle->utf8_path;
  full_name = monoeg_g_build_path ("/", D.17879, utf8_result, 0B);
  monoeg_g_free (utf8_result);
  D.17880 = mono_domain_get ();
  D.17881 = mono_string_new (D.17880, full_name);
  *result = D.17881;
  monoeg_g_free (full_name);
  D.17875 = 1;
  return D.17875;
}


ves_icall_System_IO_MonoIO_FindNext (void * handle, gint32 * result_attr, gint32 * error)
{
  void * D.17883;
  int D.17884;
  unsigned int D.17887;
  struct MonoString * D.17890;
  int D.17891;
  unsigned int D.17892;
  int D.17893;
  struct IncrementalFind * ifh;
  struct WIN32_FIND_DATA data;
  struct MonoString * result;

  try
    {
      ifh = handle;
      *error = 0;
      <D.17542>:
      D.17883 = ifh->find_handle;
      D.17884 = FindNextFile (D.17883, &data);
      if (D.17884 == 0) goto <D.17885>; else goto <D.17886>;
      <D.17885>:
      {
        int e;

        D.17887 = GetLastError ();
        e = (int) D.17887;
        if (e != 18) goto <D.17888>; else goto <D.17889>;
        <D.17888>:
        *error = e;
        <D.17889>:
        D.17890 = 0B;
        return D.17890;
      }
      <D.17886>:
      D.17891 = incremental_find_check_match (ifh, &data, &result);
      if (D.17891 == 0) goto <D.17542>; else goto <D.17543>;
      <D.17543>:
      D.17892 = data.dwFileAttributes;
      D.17893 = (int) D.17892;
      *result_attr = D.17893;
      D.17890 = result;
      return D.17890;
    }
  finally
    {
      data = {CLOBBER};
      result = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_FindClose (void * handle)
{
  void * D.17896;
  int D.17897;
  unsigned int D.17900;
  gchar * D.17902;
  int D.17903;
  struct IncrementalFind * ifh;
  gint32 error;

  ifh = handle;
  D.17896 = ifh->find_handle;
  D.17897 = FindClose (D.17896);
  if (D.17897 == 0) goto <D.17898>; else goto <D.17899>;
  <D.17898>:
  D.17900 = GetLastError ();
  error = (gint32) D.17900;
  goto <D.17901>;
  <D.17899>:
  error = 0;
  <D.17901>:
  D.17902 = ifh->utf8_path;
  monoeg_g_free (D.17902);
  monoeg_g_free (ifh);
  D.17903 = error;
  return D.17903;
}


ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 * error)
{
  long unsigned int D.17905;
  long unsigned int D.17906;
  unsigned int len.3;
  unsigned int D.17908;
  long unsigned int D.17911;
  long unsigned int D.17912;
  unsigned int res_len.4;
  unsigned int D.17914;
  unsigned int old_res_len.5;
  _Bool D.17916;
  gunichar2 * D.17919;
  short unsigned int D.17920;
  struct MonoDomain * D.17921;
  unsigned int D.17923;
  int D.17924;
  struct MonoString * D.17925;
  struct MonoString * result;
  gunichar2 * buf;
  int len;
  int res_len;

  len = 261;
  D.17905 = (long unsigned int) len;
  D.17906 = D.17905 * 2;
  buf = monoeg_malloc (D.17906);
  *error = 0;
  result = 0B;
  len.3 = (unsigned int) len;
  D.17908 = GetCurrentDirectory (len.3, buf);
  res_len = (int) D.17908;
  if (res_len > len) goto <D.17909>; else goto <D.17910>;
  <D.17909>:
  {
    int old_res_len;

    old_res_len = res_len;
    monoeg_g_free (buf);
    D.17911 = (long unsigned int) res_len;
    D.17912 = D.17911 * 2;
    buf = monoeg_malloc (D.17912);
    res_len.4 = (unsigned int) res_len;
    D.17914 = GetCurrentDirectory (res_len.4, buf);
    old_res_len.5 = (unsigned int) old_res_len;
    D.17916 = D.17914 == old_res_len.5;
    res_len = (int) D.17916;
  }
  <D.17910>:
  if (res_len != 0) goto <D.17917>; else goto <D.17918>;
  <D.17917>:
  len = 0;
  goto <D.17558>;
  <D.17557>:
  len = len + 1;
  <D.17558>:
  D.17905 = (long unsigned int) len;
  D.17906 = D.17905 * 2;
  D.17919 = buf + D.17906;
  D.17920 = *D.17919;
  if (D.17920 != 0) goto <D.17557>; else goto <D.17559>;
  <D.17559>:
  D.17921 = mono_domain_get ();
  result = mono_string_new_utf16 (D.17921, buf, len);
  goto <D.17922>;
  <D.17918>:
  D.17923 = GetLastError ();
  D.17924 = (int) D.17923;
  *error = D.17924;
  <D.17922>:
  monoeg_g_free (buf);
  D.17925 = result;
  return D.17925;
}


ves_icall_System_IO_MonoIO_SetCurrentDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17927;
  unsigned int D.17930;
  int D.17931;
  MonoBoolean D.17932;
  gboolean ret;

  *error = 0;
  D.17927 = mono_string_chars (path);
  ret = SetCurrentDirectory (D.17927);
  if (ret == 0) goto <D.17928>; else goto <D.17929>;
  <D.17928>:
  D.17930 = GetLastError ();
  D.17931 = (int) D.17930;
  *error = D.17931;
  <D.17929>:
  D.17932 = (MonoBoolean) ret;
  return D.17932;
}


ves_icall_System_IO_MonoIO_MoveFile (struct MonoString * path, struct MonoString * dest, gint32 * error)
{
  mono_unichar2 * D.17934;
  mono_unichar2 * D.17935;
  unsigned int D.17938;
  int D.17939;
  MonoBoolean D.17940;
  gboolean ret;

  *error = 0;
  D.17934 = mono_string_chars (dest);
  D.17935 = mono_string_chars (path);
  ret = MoveFile (D.17935, D.17934);
  if (ret == 0) goto <D.17936>; else goto <D.17937>;
  <D.17936>:
  D.17938 = GetLastError ();
  D.17939 = (int) D.17938;
  *error = D.17939;
  <D.17937>:
  D.17940 = (MonoBoolean) ret;
  return D.17940;
}


ves_icall_System_IO_MonoIO_ReplaceFile (struct MonoString * sourceFileName, struct MonoString * destinationFileName, struct MonoString * destinationBackupFileName, MonoBoolean ignoreMetadataErrors, gint32 * error)
{
  unsigned int D.17952;
  int D.17953;
  MonoBoolean D.17954;
  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.17942>; else goto <D.17943>;
  <D.17942>:
  utf16_sourceFileName = mono_string_chars (sourceFileName);
  <D.17943>:
  if (destinationFileName != 0B) goto <D.17944>; else goto <D.17945>;
  <D.17944>:
  utf16_destinationFileName = mono_string_chars (destinationFileName);
  <D.17945>:
  if (destinationBackupFileName != 0B) goto <D.17946>; else goto <D.17947>;
  <D.17946>:
  utf16_destinationBackupFileName = mono_string_chars (destinationBackupFileName);
  <D.17947>:
  *error = 0;
  if (ignoreMetadataErrors != 0) goto <D.17948>; else goto <D.17949>;
  <D.17948>:
  replaceFlags = replaceFlags | 2;
  <D.17949>:
  ret = ReplaceFile (utf16_destinationFileName, utf16_sourceFileName, utf16_destinationBackupFileName, replaceFlags, 0B, 0B);
  if (ret == 0) goto <D.17950>; else goto <D.17951>;
  <D.17950>:
  D.17952 = GetLastError ();
  D.17953 = (int) D.17952;
  *error = D.17953;
  <D.17951>:
  D.17954 = (MonoBoolean) ret;
  return D.17954;
}


ves_icall_System_IO_MonoIO_CopyFile (struct MonoString * path, struct MonoString * dest, MonoBoolean overwrite, gint32 * error)
{
  _Bool D.17956;
  int D.17957;
  mono_unichar2 * D.17958;
  mono_unichar2 * D.17959;
  unsigned int D.17962;
  int D.17963;
  MonoBoolean D.17964;
  gboolean ret;

  *error = 0;
  D.17956 = overwrite == 0;
  D.17957 = (int) D.17956;
  D.17958 = mono_string_chars (dest);
  D.17959 = mono_string_chars (path);
  ret = CopyFile (D.17959, D.17958, D.17957);
  if (ret == 0) goto <D.17960>; else goto <D.17961>;
  <D.17960>:
  D.17962 = GetLastError ();
  D.17963 = (int) D.17962;
  *error = D.17963;
  <D.17961>:
  D.17964 = (MonoBoolean) ret;
  return D.17964;
}


ves_icall_System_IO_MonoIO_DeleteFile (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17966;
  unsigned int D.17969;
  int D.17970;
  MonoBoolean D.17971;
  gboolean ret;

  *error = 0;
  D.17966 = mono_string_chars (path);
  ret = DeleteFile (D.17966);
  if (ret == 0) goto <D.17967>; else goto <D.17968>;
  <D.17967>:
  D.17969 = GetLastError ();
  D.17970 = (int) D.17969;
  *error = D.17970;
  <D.17968>:
  D.17971 = (MonoBoolean) ret;
  return D.17971;
}


ves_icall_System_IO_MonoIO_GetFileAttributes (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.17973;
  unsigned int D.17974;
  unsigned int D.17977;
  int D.17978;
  gint32 D.17979;
  gint32 ret;

  *error = 0;
  D.17973 = mono_string_chars (path);
  D.17974 = get_file_attributes (D.17973);
  ret = (gint32) D.17974;
  if (ret == -1) goto <D.17975>; else goto <D.17976>;
  <D.17975>:
  D.17977 = GetLastError ();
  D.17978 = (int) D.17977;
  *error = D.17978;
  <D.17976>:
  D.17979 = ret;
  return D.17979;
}


ves_icall_System_IO_MonoIO_SetFileAttributes (struct MonoString * path, gint32 attrs, gint32 * error)
{
  unsigned int D.17981;
  mono_unichar2 * D.17982;
  unsigned int D.17985;
  int D.17986;
  MonoBoolean D.17987;
  gboolean ret;

  *error = 0;
  D.17981 = convert_attrs (attrs);
  D.17982 = mono_string_chars (path);
  ret = SetFileAttributes (D.17982, D.17981);
  if (ret == 0) goto <D.17983>; else goto <D.17984>;
  <D.17983>:
  D.17985 = GetLastError ();
  D.17986 = (int) D.17985;
  *error = D.17986;
  <D.17984>:
  D.17987 = (MonoBoolean) ret;
  return D.17987;
}


ves_icall_System_IO_MonoIO_GetFileType (void * handle, gint32 * error)
{
  <unnamed type> D.17989;
  unsigned int D.17992;
  int D.17993;
  gint32 D.17994;
  gboolean ret;

  *error = 0;
  D.17989 = GetFileType (handle);
  ret = (gboolean) D.17989;
  if (ret == 0) goto <D.17990>; else goto <D.17991>;
  <D.17990>:
  D.17992 = GetLastError ();
  D.17993 = (int) D.17992;
  *error = D.17993;
  <D.17991>:
  D.17994 = ret;
  return D.17994;
}


ves_icall_System_IO_MonoIO_GetFileStat (struct MonoString * path, struct MonoIOStat * stat, gint32 * error)
{
  mono_unichar2 * D.17996;
  unsigned int D.18000;
  int D.18001;
  MonoBoolean D.18002;
  gboolean result;
  struct WIN32_FILE_ATTRIBUTE_DATA data;

  try
    {
      *error = 0;
      D.17996 = mono_string_chars (path);
      result = get_file_attributes_ex (D.17996, &data);
      if (result != 0) goto <D.17997>; else goto <D.17998>;
      <D.17997>:
      convert_win32_file_attribute_data (&data, stat);
      goto <D.17999>;
      <D.17998>:
      D.18000 = GetLastError ();
      D.18001 = (int) D.18000;
      *error = D.18001;
      memset (stat, 0, 40);
      <D.17999>:
      D.18002 = (MonoBoolean) result;
      return D.18002;
    }
  finally
    {
      data = {CLOBBER};
    }
}


get_file_attributes_ex (const gunichar2 * path, struct WIN32_FILE_ATTRIBUTE_DATA * data)
{
  gboolean D.18007;
  unsigned int D.18008;
  unsigned int D.18013;
  unsigned int D.18014;
  unsigned int D.18015;
  gboolean res;
  struct WIN32_FIND_DATA find_data;
  void * find_handle;
  gint32 error;

  try
    {
      res = GetFileAttributesEx (path, 0, data);
      if (res != 0) goto <D.18005>; else goto <D.18006>;
      <D.18005>:
      D.18007 = 1;
      return D.18007;
      <D.18006>:
      D.18008 = GetLastError ();
      error = (gint32) D.18008;
      if (error != 32) goto <D.18009>; else goto <D.18010>;
      <D.18009>:
      D.18007 = 0;
      return D.18007;
      <D.18010>:
      find_handle = FindFirstFile (path, &find_data);
      if (find_handle == -1B) goto <D.18011>; else goto <D.18012>;
      <D.18011>:
      D.18007 = 0;
      return D.18007;
      <D.18012>:
      FindClose (find_handle);
      D.18013 = find_data.dwFileAttributes;
      data->dwFileAttributes = D.18013;
      data->ftCreationTime = find_data.ftCreationTime;
      data->ftLastAccessTime = find_data.ftLastAccessTime;
      data->ftLastWriteTime = find_data.ftLastWriteTime;
      D.18014 = find_data.nFileSizeHigh;
      data->nFileSizeHigh = D.18014;
      D.18015 = find_data.nFileSizeLow;
      data->nFileSizeLow = D.18015;
      D.18007 = 1;
      return D.18007;
    }
  finally
    {
      find_data = {CLOBBER};
    }
}


convert_win32_file_attribute_data (const struct WIN32_FILE_ATTRIBUTE_DATA * data, struct MonoIOStat * stat)
{
  unsigned int D.18018;
  int D.18019;
  const struct WapiFileTime * D.18020;
  long int D.18021;
  const struct WapiFileTime * D.18022;
  long int D.18023;
  const struct WapiFileTime * D.18024;
  long int D.18025;
  unsigned int D.18026;
  long int D.18027;
  long int D.18028;
  unsigned int D.18029;
  long int D.18030;
  long int D.18031;

  D.18018 = data->dwFileAttributes;
  D.18019 = (int) D.18018;
  stat->attributes = D.18019;
  D.18020 = &data->ftCreationTime;
  D.18021 = convert_filetime (D.18020);
  stat->creation_time = D.18021;
  D.18022 = &data->ftLastAccessTime;
  D.18023 = convert_filetime (D.18022);
  stat->last_access_time = D.18023;
  D.18024 = &data->ftLastWriteTime;
  D.18025 = convert_filetime (D.18024);
  stat->last_write_time = D.18025;
  D.18026 = data->nFileSizeHigh;
  D.18027 = (long int) D.18026;
  D.18028 = D.18027 << 32;
  D.18029 = data->nFileSizeLow;
  D.18030 = (long int) D.18029;
  D.18031 = D.18028 | D.18030;
  stat->length = D.18031;
}


convert_filetime (const struct FILETIME * filetime)
{
  unsigned int D.18032;
  unsigned int D.18033;
  long unsigned int D.18034;
  gint64 D.18035;
  guint64 ticks;

  D.18032 = filetime->dwHighDateTime;
  ticks = (guint64) D.18032;
  ticks = ticks << 32;
  D.18033 = filetime->dwLowDateTime;
  D.18034 = (long unsigned int) D.18033;
  ticks = D.18034 + ticks;
  D.18035 = (gint64) ticks;
  return D.18035;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.18039;
  int D.18044;
  void * D.18046;
  long unsigned int D.18047;

  D.18039 = __builtin_constant_p (__len);
  if (D.18039 != 0) goto <D.18040>; else goto <D.18041>;
  <D.18040>:
  if (__len == 0) goto <D.18042>; else goto <D.18043>;
  <D.18042>:
  D.18044 = __builtin_constant_p (__ch);
  if (D.18044 == 0) goto <D.18037>; else goto <D.18045>;
  <D.18045>:
  if (__ch != 0) goto <D.18037>; else goto <D.18038>;
  <D.18037>:
  __warn_memset_zero_len ();
  D.18046 = __dest;
  return D.18046;
  <D.18038>:
  <D.18043>:
  <D.18041>:
  D.18047 = __builtin_object_size (__dest, 0);
  D.18046 = __builtin___memset_chk (__dest, __ch, __len, D.18047);
  return D.18046;
}


ves_icall_System_IO_MonoIO_Open (struct MonoString * filename, gint32 mode, gint32 access_mode, gint32 share, gint32 options, gint32 * error)
{
  int D.18051;
  int D.18055;
  int D.18058;
  int D.18061;
  int D.18064;
  int D.18067;
  unsigned int attributes.6;
  unsigned int D.18073;
  unsigned int D.18075;
  int D.18078;
  unsigned int attributes.7;
  <unnamed type> mode.8;
  unsigned int D.18083;
  <unnamed type> share.9;
  unsigned int D.18085;
  <unnamed type> access_mode.10;
  unsigned int D.18087;
  unsigned int D.18090;
  int D.18091;
  void * D.18092;
  void * ret;
  int attributes;
  int attrs;
  gunichar2 * chars;

  chars = mono_string_chars (filename);
  *error = 0;
  if (options != 0) goto <D.18049>; else goto <D.18050>;
  <D.18049>:
  D.18051 = options & 16384;
  if (D.18051 != 0) goto <D.18052>; else goto <D.18053>;
  <D.18052>:
  attributes = 64;
  goto <D.18054>;
  <D.18053>:
  attributes = 128;
  <D.18054>:
  D.18055 = options & 67108864;
  if (D.18055 != 0) goto <D.18056>; else goto <D.18057>;
  <D.18056>:
  attributes = attributes | 67108864;
  <D.18057>:
  D.18058 = options & 134217728;
  if (D.18058 != 0) goto <D.18059>; else goto <D.18060>;
  <D.18059>:
  attributes = attributes | 134217728;
  <D.18060>:
  D.18061 = options & 268435456;
  if (D.18061 != 0) goto <D.18062>; else goto <D.18063>;
  <D.18062>:
  attributes = attributes | 268435456;
  <D.18063>:
  D.18064 = options & 1;
  if (D.18064 != 0) goto <D.18065>; else goto <D.18066>;
  <D.18065>:
  attributes = attributes | 256;
  <D.18066>:
  D.18067 = options & 1073741824;
  if (D.18067 != 0) goto <D.18068>; else goto <D.18069>;
  <D.18068>:
  attributes = attributes | 1073741824;
  <D.18069>:
  if (options < 0) goto <D.18070>; else goto <D.18071>;
  <D.18070>:
  attributes.6 = (unsigned int) attributes;
  D.18073 = attributes.6 | 2147483648;
  attributes = (int) D.18073;
  <D.18071>:
  goto <D.18074>;
  <D.18050>:
  attributes = 128;
  <D.18074>:
  D.18075 = get_file_attributes (chars);
  attrs = (int) D.18075;
  if (attrs != -1) goto <D.18076>; else goto <D.18077>;
  <D.18076>:
  D.18078 = attrs & 16;
  if (D.18078 != 0) goto <D.18079>; else goto <D.18080>;
  <D.18079>:
  attributes = attributes | 33554432;
  <D.18080>:
  <D.18077>:
  attributes.7 = (unsigned int) attributes;
  mode.8 = (<unnamed type>) mode;
  D.18083 = convert_mode (mode.8);
  share.9 = (<unnamed type>) share;
  D.18085 = convert_share (share.9);
  access_mode.10 = (<unnamed type>) access_mode;
  D.18087 = convert_access (access_mode.10);
  ret = CreateFile (chars, D.18087, D.18085, 0B, D.18083, attributes.7, 0B);
  if (ret == -1B) goto <D.18088>; else goto <D.18089>;
  <D.18088>:
  D.18090 = GetLastError ();
  D.18091 = (int) D.18090;
  *error = D.18091;
  <D.18089>:
  D.18092 = ret;
  return D.18092;
}


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

  switch (mono_mode) <default: <D.17412>, case 1: <D.17405>, case 2: <D.17407>, case 3: <D.17408>, case 4: <D.17409>, case 5: <D.17410>, case 6: <D.17411>>
  <D.17405>:
  mode = 1;
  goto <D.17406>;
  <D.17407>:
  mode = 2;
  goto <D.17406>;
  <D.17408>:
  mode = 3;
  goto <D.17406>;
  <D.17409>:
  mode = 4;
  goto <D.17406>;
  <D.17410>:
  mode = 5;
  goto <D.17406>;
  <D.17411>:
  mode = 4;
  goto <D.17406>;
  <D.17412>:
  monoeg_g_log (0B, 16, "System.IO.FileMode has unknown value 0x%x", mono_mode);
  mode = 3;
  <D.17406>:
  D.18094 = mode;
  return D.18094;
}


convert_share (MonoFileShare mono_share)
{
  unsigned int D.18096;
  unsigned int D.18099;
  unsigned int D.18102;
  unsigned int D.18105;
  guint32 D.18108;
  guint32 share;

  share = 0;
  D.18096 = mono_share & 1;
  if (D.18096 != 0) goto <D.18097>; else goto <D.18098>;
  <D.18097>:
  share = share | 1;
  <D.18098>:
  D.18099 = mono_share & 2;
  if (D.18099 != 0) goto <D.18100>; else goto <D.18101>;
  <D.18100>:
  share = share | 2;
  <D.18101>:
  D.18102 = mono_share & 4;
  if (D.18102 != 0) goto <D.18103>; else goto <D.18104>;
  <D.18103>:
  share = share | 4;
  <D.18104>:
  D.18105 = mono_share & 4294967288;
  if (D.18105 != 0) goto <D.18106>; else goto <D.18107>;
  <D.18106>:
  monoeg_g_log (0B, 16, "System.IO.FileShare has unknown value 0x%x", mono_share);
  share = 0;
  <D.18107>:
  D.18108 = share;
  return D.18108;
}


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

  switch (mono_access) <default: <D.17421>, case 1: <D.17417>, case 2: <D.17419>, case 3: <D.17420>>
  <D.17417>:
  access = 2147483648;
  goto <D.17418>;
  <D.17419>:
  access = 1073741824;
  goto <D.17418>;
  <D.17420>:
  access = 3221225472;
  goto <D.17418>;
  <D.17421>:
  monoeg_g_log (0B, 16, "System.IO.FileAccess has unknown value 0x%x", mono_access);
  access = 2147483648;
  <D.17418>:
  D.18110 = access;
  return D.18110;
}


ves_icall_System_IO_MonoIO_Close (void * handle, gint32 * error)
{
  unsigned int D.18114;
  int D.18115;
  MonoBoolean D.18116;
  gboolean ret;

  *error = 0;
  ret = CloseHandle (handle);
  if (ret == 0) goto <D.18112>; else goto <D.18113>;
  <D.18112>:
  D.18114 = GetLastError ();
  D.18115 = (int) D.18114;
  *error = D.18115;
  <D.18113>:
  D.18116 = (MonoBoolean) ret;
  return D.18116;
}


ves_icall_System_IO_MonoIO_Read (void * handle, struct MonoArray * dest, gint32 dest_offset, gint32 count, gint32 * error)
{
  _Bool D.18118;
  long int D.18119;
  long int D.18120;
  long unsigned int D.18125;
  long unsigned int D.18126;
  long unsigned int D.18127;
  long unsigned int D.18128;
  struct MonoException * D.18131;
  unsigned int count.11;
  unsigned int D.18135;
  int D.18136;
  gint32 D.18137;
  unsigned int n.12;
  guchar * buffer;
  gboolean result;
  guint32 n;

  try
    {
      *error = 0;
      D.18118 = dest == 0B;
      D.18119 = (long int) D.18118;
      D.18120 = __builtin_expect (D.18119, 0);
      if (D.18120 != 0) goto <D.18121>; else goto <D.18122>;
      <D.18121>:
      {
        struct MonoException * ex;

        if (dest != 0B) goto <D.18123>; else goto <D.18124>;
        <D.18123>:
        <D.18124>:
        ex = mono_get_exception_argument_null ("dest");
        mono_raise_exception (ex);
      }
      <D.18122>:
      D.18125 = (long unsigned int) dest_offset;
      D.18126 = mono_array_length (dest);
      D.18127 = (long unsigned int) count;
      D.18128 = D.18126 - D.18127;
      if (D.18125 > D.18128) goto <D.18129>; else goto <D.18130>;
      <D.18129>:
      D.18131 = mono_get_exception_argument ("array", "array too small. numBytes/offset wrong.");
      mono_raise_exception (D.18131);
      <D.18130>:
      D.18125 = (long unsigned int) dest_offset;
      buffer = mono_array_addr_with_size (dest, 1, D.18125);
      count.11 = (unsigned int) count;
      result = ReadFile (handle, buffer, count.11, &n, 0B);
      if (result == 0) goto <D.18133>; else goto <D.18134>;
      <D.18133>:
      D.18135 = GetLastError ();
      D.18136 = (int) D.18135;
      *error = D.18136;
      D.18137 = -1;
      return D.18137;
      <D.18134>:
      n.12 = n;
      D.18137 = (gint32) n.12;
      return D.18137;
    }
  finally
    {
      n = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_Write (void * handle, struct MonoArray * src, gint32 src_offset, gint32 count, gint32 * error)
{
  _Bool D.18141;
  long int D.18142;
  long int D.18143;
  long unsigned int D.18148;
  long unsigned int D.18149;
  long unsigned int D.18150;
  long unsigned int D.18151;
  struct MonoException * D.18154;
  unsigned int count.13;
  unsigned int D.18158;
  int D.18159;
  gint32 D.18160;
  unsigned int n.14;
  guchar * buffer;
  gboolean result;
  guint32 n;

  try
    {
      *error = 0;
      D.18141 = src == 0B;
      D.18142 = (long int) D.18141;
      D.18143 = __builtin_expect (D.18142, 0);
      if (D.18143 != 0) goto <D.18144>; else goto <D.18145>;
      <D.18144>:
      {
        struct MonoException * ex;

        if (src != 0B) goto <D.18146>; else goto <D.18147>;
        <D.18146>:
        <D.18147>:
        ex = mono_get_exception_argument_null ("src");
        mono_raise_exception (ex);
      }
      <D.18145>:
      D.18148 = (long unsigned int) src_offset;
      D.18149 = mono_array_length (src);
      D.18150 = (long unsigned int) count;
      D.18151 = D.18149 - D.18150;
      if (D.18148 > D.18151) goto <D.18152>; else goto <D.18153>;
      <D.18152>:
      D.18154 = mono_get_exception_argument ("array", "array too small. numBytes/offset wrong.");
      mono_raise_exception (D.18154);
      <D.18153>:
      D.18148 = (long unsigned int) src_offset;
      buffer = mono_array_addr_with_size (src, 1, D.18148);
      count.13 = (unsigned int) count;
      result = WriteFile (handle, buffer, count.13, &n, 0B);
      if (result == 0) goto <D.18156>; else goto <D.18157>;
      <D.18156>:
      D.18158 = GetLastError ();
      D.18159 = (int) D.18158;
      *error = D.18159;
      D.18160 = -1;
      return D.18160;
      <D.18157>:
      n.14 = n;
      D.18160 = (gint32) n.14;
      return D.18160;
    }
  finally
    {
      n = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_Seek (void * handle, gint64 offset, gint32 origin, gint32 * error)
{
  long int D.18164;
  int offset_hi.15;
  <unnamed type> origin.16;
  unsigned int D.18167;
  int D.18168;
  unsigned int D.18169;
  unsigned int D.18172;
  int D.18173;
  gint64 D.18174;
  int offset_hi.17;
  long int D.18176;
  long int D.18177;
  gint32 offset_hi;

  try
    {
      *error = 0;
      D.18164 = offset >> 32;
      offset_hi.15 = (int) D.18164;
      offset_hi = offset_hi.15;
      origin.16 = (<unnamed type>) origin;
      D.18167 = convert_seekorigin (origin.16);
      D.18168 = (int) offset;
      D.18169 = SetFilePointer (handle, D.18168, &offset_hi, D.18167);
      offset = (gint64) D.18169;
      if (offset == 4294967295) goto <D.18170>; else goto <D.18171>;
      <D.18170>:
      D.18172 = GetLastError ();
      D.18173 = (int) D.18172;
      *error = D.18173;
      <D.18171>:
      offset_hi.17 = offset_hi;
      D.18176 = (long int) offset_hi.17;
      D.18177 = D.18176 << 32;
      D.18174 = D.18177 | offset;
      return D.18174;
    }
  finally
    {
      offset_hi = {CLOBBER};
    }
}


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

  switch (origin) <default: <D.17434>, case 0: <D.17430>, case 1: <D.17432>, case 2: <D.17433>>
  <D.17430>:
  w32origin = 0;
  goto <D.17431>;
  <D.17432>:
  w32origin = 1;
  goto <D.17431>;
  <D.17433>:
  w32origin = 2;
  goto <D.17431>;
  <D.17434>:
  monoeg_g_log (0B, 16, "System.IO.SeekOrigin has unknown value 0x%x", origin);
  w32origin = 1;
  <D.17431>:
  D.18180 = w32origin;
  return D.18180;
}


ves_icall_System_IO_MonoIO_Flush (void * handle, gint32 * error)
{
  unsigned int D.18184;
  int D.18185;
  MonoBoolean D.18186;
  gboolean ret;

  *error = 0;
  ret = FlushFileBuffers (handle);
  if (ret == 0) goto <D.18182>; else goto <D.18183>;
  <D.18182>:
  D.18184 = GetLastError ();
  D.18185 = (int) D.18184;
  *error = D.18185;
  <D.18183>:
  D.18186 = (MonoBoolean) ret;
  return D.18186;
}


ves_icall_System_IO_MonoIO_GetLength (void * handle, gint32 * error)
{
  unsigned int D.18188;
  unsigned int D.18191;
  int D.18192;
  gint64 D.18193;
  unsigned int length_hi.18;
  long int D.18195;
  long int D.18196;
  gint64 length;
  guint32 length_hi;

  try
    {
      *error = 0;
      D.18188 = GetFileSize (handle, &length_hi);
      length = (gint64) D.18188;
      if (length == 4294967295) goto <D.18189>; else goto <D.18190>;
      <D.18189>:
      D.18191 = GetLastError ();
      D.18192 = (int) D.18191;
      *error = D.18192;
      <D.18190>:
      length_hi.18 = length_hi;
      D.18195 = (long int) length_hi.18;
      D.18196 = D.18195 << 32;
      D.18193 = D.18196 | length;
      return D.18193;
    }
  finally
    {
      length_hi = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_SetLength (void * handle, gint64 length, gint32 * error)
{
  unsigned int D.18199;
  unsigned int D.18202;
  int D.18203;
  MonoBoolean D.18204;
  long int D.18205;
  int length_hi.19;
  int D.18207;
  unsigned int D.18208;
  unsigned int D.18211;
  int D.18212;
  unsigned int D.18215;
  int D.18216;
  int D.18217;
  unsigned int D.18218;
  unsigned int D.18221;
  int D.18222;
  gint64 offset;
  gint64 offset_set;
  gint32 offset_hi;
  gint32 length_hi;
  gboolean result;

  try
    {
      *error = 0;
      offset_hi = 0;
      D.18199 = SetFilePointer (handle, 0, &offset_hi, 1);
      offset = (gint64) D.18199;
      if (offset == 4294967295) goto <D.18200>; else goto <D.18201>;
      <D.18200>:
      D.18202 = GetLastError ();
      D.18203 = (int) D.18202;
      *error = D.18203;
      D.18204 = 0;
      return D.18204;
      <D.18201>:
      D.18205 = length >> 32;
      length_hi.19 = (int) D.18205;
      length_hi = length_hi.19;
      D.18207 = (int) length;
      D.18208 = SetFilePointer (handle, D.18207, &length_hi, 0);
      offset_set = (gint64) D.18208;
      if (offset_set == 4294967295) goto <D.18209>; else goto <D.18210>;
      <D.18209>:
      D.18211 = GetLastError ();
      D.18212 = (int) D.18211;
      *error = D.18212;
      D.18204 = 0;
      return D.18204;
      <D.18210>:
      result = SetEndOfFile (handle);
      if (result == 0) goto <D.18213>; else goto <D.18214>;
      <D.18213>:
      D.18215 = GetLastError ();
      D.18216 = (int) D.18215;
      *error = D.18216;
      D.18204 = 0;
      return D.18204;
      <D.18214>:
      D.18217 = (int) offset;
      D.18218 = SetFilePointer (handle, D.18217, &offset_hi, 0);
      offset_set = (gint64) D.18218;
      if (offset_set == 4294967295) goto <D.18219>; else goto <D.18220>;
      <D.18219>:
      D.18221 = GetLastError ();
      D.18222 = (int) D.18221;
      *error = D.18222;
      D.18204 = 0;
      return D.18204;
      <D.18220>:
      D.18204 = (MonoBoolean) result;
      return D.18204;
    }
  finally
    {
      offset_hi = {CLOBBER};
      length_hi = {CLOBBER};
    }
}


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.18239;
  int D.18240;
  MonoBoolean D.18241;
  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.18226>; else goto <D.18227>;
  <D.18226>:
  creation_filetime = 0B;
  goto <D.18228>;
  <D.18227>:
  creation_filetime = &creation_time;
  <D.18228>:
  last_access_time.21 = last_access_time;
  if (last_access_time.21 < 0) goto <D.18230>; else goto <D.18231>;
  <D.18230>:
  last_access_filetime = 0B;
  goto <D.18232>;
  <D.18231>:
  last_access_filetime = &last_access_time;
  <D.18232>:
  last_write_time.22 = last_write_time;
  if (last_write_time.22 < 0) goto <D.18234>; else goto <D.18235>;
  <D.18234>:
  last_write_filetime = 0B;
  goto <D.18236>;
  <D.18235>:
  last_write_filetime = &last_write_time;
  <D.18236>:
  ret = SetFileTime (handle, creation_filetime, last_access_filetime, last_write_filetime);
  if (ret == 0) goto <D.18237>; else goto <D.18238>;
  <D.18237>:
  D.18239 = GetLastError ();
  D.18240 = (int) D.18239;
  *error = D.18240;
  <D.18238>:
  D.18241 = (MonoBoolean) ret;
  return D.18241;
}


ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
{
  void * D.18243;

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


ves_icall_System_IO_MonoIO_get_ConsoleInput ()
{
  void * D.18245;

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


ves_icall_System_IO_MonoIO_get_ConsoleError ()
{
  void * D.18247;

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


ves_icall_System_IO_MonoIO_CreatePipe (void * * read_handle, void * * write_handle)
{
  MonoBoolean D.18251;
  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.18249>; else goto <D.18250>;
      <D.18249>:
      D.18251 = 0;
      return D.18251;
      <D.18250>:
      D.18251 = 1;
      return D.18251;
    }
  finally
    {
      attr = {CLOBBER};
    }
}


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 options.23;
  unsigned int access.24;
  MonoBoolean D.18258;
  gboolean ret;

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


ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
{
  gunichar2 D.18260;

  D.18260 = 47;
  return D.18260;
}


ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
{
  gunichar2 D.18262;

  D.18262 = 47;
  return D.18262;
}


ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar ()
{
  int __mono_io_portability_helpers.25;
  gunichar2 D.18267;

  __mono_io_portability_helpers.25 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.25 > 0) goto <D.18265>; else goto <D.18266>;
  <D.18265>:
  D.18267 = 92;
  return D.18267;
  <D.18266>:
  D.18267 = 47;
  return D.18267;
}


ves_icall_System_IO_MonoIO_get_PathSeparator ()
{
  gunichar2 D.18269;

  D.18269 = 58;
  return D.18269;
}


ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
{
  long unsigned int D.18271;
  struct MonoClass * D.18272;
  long unsigned int D.18273;
  short unsigned int D.18274;
  struct MonoArray * D.18275;
  struct MonoArray * chars;
  struct MonoDomain * domain;
  int i;
  int n;

  domain = mono_domain_get ();
  n = 1;
  D.18271 = (long unsigned int) n;
  D.18272 = mono_defaults.char_class;
  chars = mono_array_new (domain, D.18272, D.18271);
  i = 0;
  goto <D.17735>;
  <D.17734>:
  {
    gunichar2 * __p;

    D.18273 = (long unsigned int) i;
    __p = mono_array_addr_with_size (chars, 2, D.18273);
    D.18274 = 0;
    *__p = D.18274;
  }
  i = i + 1;
  <D.17735>:
  if (i < n) goto <D.17734>; else goto <D.17736>;
  <D.17736>:
  D.18275 = chars;
  return D.18275;
}


ves_icall_System_IO_MonoIO_GetTempPath (struct MonoString * * mono_name)
{
  unsigned int D.18277;
  int D.18280;
  long unsigned int D.18281;
  long unsigned int D.18282;
  unsigned int ret.26;
  unsigned int D.18284;
  struct MonoDomain * D.18287;
  struct MonoString * D.18288;
  gint32 D.18289;
  gunichar2 * name;
  int ret;

  name = monoeg_malloc0 (512);
  D.18277 = GetTempPath (256, name);
  ret = (int) D.18277;
  if (ret > 255) goto <D.18278>; else goto <D.18279>;
  <D.18278>:
  monoeg_g_free (name);
  D.18280 = ret + 2;
  D.18281 = (long unsigned int) D.18280;
  D.18282 = D.18281 * 2;
  name = monoeg_malloc0 (D.18282);
  ret.26 = (unsigned int) ret;
  D.18284 = GetTempPath (ret.26, name);
  ret = (int) D.18284;
  <D.18279>:
  if (ret > 0) goto <D.18285>; else goto <D.18286>;
  <D.18285>:
  D.18287 = mono_domain_get ();
  D.18288 = mono_string_new_utf16 (D.18287, name, ret);
  mono_gc_wbarrier_generic_store (mono_name, D.18288);
  <D.18286>:
  monoeg_g_free (name);
  D.18289 = ret;
  return D.18289;
}


ves_icall_System_IO_MonoIO_Lock (void * handle, gint64 position, gint64 length, gint32 * error)
{
  long int D.18291;
  unsigned int D.18292;
  unsigned int D.18293;
  long int D.18294;
  unsigned int D.18295;
  unsigned int D.18296;
  unsigned int D.18299;
  int D.18300;
  gboolean ret;

  *error = 0;
  D.18291 = length >> 32;
  D.18292 = (unsigned int) D.18291;
  D.18293 = (unsigned int) length;
  D.18294 = position >> 32;
  D.18295 = (unsigned int) D.18294;
  D.18296 = (unsigned int) position;
  ret = LockFile (handle, D.18296, D.18295, D.18293, D.18292);
  if (ret == 0) goto <D.18297>; else goto <D.18298>;
  <D.18297>:
  D.18299 = GetLastError ();
  D.18300 = (int) D.18299;
  *error = D.18300;
  <D.18298>:
}


ves_icall_System_IO_MonoIO_Unlock (void * handle, gint64 position, gint64 length, gint32 * error)
{
  long int D.18301;
  unsigned int D.18302;
  unsigned int D.18303;
  long int D.18304;
  unsigned int D.18305;
  unsigned int D.18306;
  unsigned int D.18309;
  int D.18310;
  gboolean ret;

  *error = 0;
  D.18301 = length >> 32;
  D.18302 = (unsigned int) D.18301;
  D.18303 = (unsigned int) length;
  D.18304 = position >> 32;
  D.18305 = (unsigned int) D.18304;
  D.18306 = (unsigned int) position;
  ret = UnlockFile (handle, D.18306, D.18305, D.18303, D.18302);
  if (ret == 0) goto <D.18307>; else goto <D.18308>;
  <D.18307>:
  D.18309 = GetLastError ();
  D.18310 = (int) D.18309;
  *error = D.18310;
  <D.18308>:
}


