ves_icall_System_IO_MonoIO_CreateDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18291;
  unsigned int D.18294;
  int D.18295;
  MonoBoolean D.18296;
  gboolean ret;

  *error = 0;
  D.18291 = mono_string_chars (path);
  ret = CreateDirectory (D.18291, 0B);
  if (ret == 0) goto <D.18292>; else goto <D.18293>;
  <D.18292>:
  D.18294 = GetLastError ();
  D.18295 = (int) D.18294;
  *error = D.18295;
  <D.18293>:
  D.18296 = (MonoBoolean) ret;
  return D.18296;
}


ves_icall_System_IO_MonoIO_RemoveDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18298;
  unsigned int D.18301;
  int D.18302;
  MonoBoolean D.18303;
  gboolean ret;

  *error = 0;
  D.18298 = mono_string_chars (path);
  ret = RemoveDirectory (D.18298);
  if (ret == 0) goto <D.18299>; else goto <D.18300>;
  <D.18299>:
  D.18301 = GetLastError ();
  D.18302 = (int) D.18301;
  *error = D.18302;
  <D.18300>:
  D.18303 = (MonoBoolean) ret;
  return D.18303;
}


ves_icall_System_IO_MonoIO_GetFileSystemEntries (struct MonoString * path, struct MonoString * path_with_pattern, gint attrs, gint mask, gint32 * error)
{
  unsigned int D.18305;
  mono_unichar2 * D.18306;
  unsigned int D.18307;
  int D.18310;
  unsigned int D.18314;
  int D.18315;
  mono_unichar2 * D.18316;
  unsigned int D.18319;
  unsigned int D.18324;
  unsigned int D.18325;
  short unsigned int D.18328;
  unsigned int D.18329;
  unsigned int mask.0;
  unsigned int D.18331;
  unsigned int attrs.1;
  int D.18337;
  int D.18338;
  unsigned int D.18341;
  int D.18342;
  struct MonoClass * D.18344;
  unsigned int D.18345;
  long unsigned int D.18346;
  long unsigned int D.18347;
  void * * D.18348;
  long unsigned int D.18349;
  long unsigned int D.18350;
  void * * D.18351;
  void * D.18352;
  struct MonoString * D.18353;
  unsigned int i.2;
  int D.18357;
  struct MonoArray * D.18360;
  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.18305 = convert_attrs (mask);
      mask = (gint) D.18305;
      D.18306 = mono_string_chars (path);
      D.18307 = get_file_attributes (D.18306);
      attributes = (gint32) D.18307;
      if (attributes != -1) goto <D.18308>; else goto <D.18309>;
      <D.18308>:
      D.18310 = attributes & 16;
      if (D.18310 == 0) goto <D.18311>; else goto <D.18312>;
      <D.18311>:
      *error = 123;
      goto leave;
      <D.18312>:
      goto <D.18313>;
      <D.18309>:
      D.18314 = GetLastError ();
      D.18315 = (int) D.18314;
      *error = D.18315;
      goto leave;
      <D.18313>:
      D.18316 = mono_string_chars (path_with_pattern);
      find_handle = FindFirstFile (D.18316, &data);
      if (find_handle == -1B) goto <D.18317>; else goto <D.18318>;
      <D.18317>:
      {
        gint32 find_error;

        D.18319 = GetLastError ();
        find_error = (gint32) D.18319;
        if (find_error == 2) goto leave; else goto <D.18320>;
        <D.18320>:
        if (find_error == 18) goto leave; else goto <D.18321>;
        <D.18321>:
        *error = find_error;
        goto leave;
      }
      <D.18318>:
      utf8_path = get_search_dir (path_with_pattern);
      names = monoeg_g_ptr_array_new ();
      <D.18030>:
      D.18324 = BIT_FIELD_REF <data, 32, 352>;
      D.18325 = D.18324;
      if (D.18325 == 46) goto <D.18322>; else goto <D.18326>;
      <D.18326>:
      D.18324 = BIT_FIELD_REF <data, 32, 352>;
      D.18325 = D.18324;
      if (D.18325 == 3014702) goto <D.18327>; else goto <D.18323>;
      <D.18327>:
      D.18328 = data.cFileName[2];
      if (D.18328 == 0) goto <D.18322>; else goto <D.18323>;
      <D.18322>:
      // predicted unlikely by continue predictor.
      goto <D.18029>;
      <D.18323>:
      D.18329 = data.dwFileAttributes;
      mask.0 = (unsigned int) mask;
      D.18331 = D.18329 & mask.0;
      attrs.1 = (unsigned int) attrs;
      if (D.18331 == attrs.1) goto <D.18333>; else goto <D.18334>;
      <D.18333>:
      utf8_result = monoeg_g_utf16_to_utf8 (&data.cFileName, -1, 0B, 0B, 0B);
      if (utf8_result == 0B) goto <D.18335>; else goto <D.18336>;
      <D.18335>:
      // predicted unlikely by continue predictor.
      goto <D.18029>;
      <D.18336>:
      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.18334>:
      <D.18029>:
      D.18337 = FindNextFile (find_handle, &data);
      if (D.18337 != 0) goto <D.18030>; else goto <D.18031>;
      <D.18031>:
      D.18338 = FindClose (find_handle);
      if (D.18338 == 0) goto <D.18339>; else goto <D.18340>;
      <D.18339>:
      D.18341 = GetLastError ();
      D.18342 = (int) D.18341;
      *error = D.18342;
      result = 0B;
      goto <D.18343>;
      <D.18340>:
      D.18344 = mono_defaults.string_class;
      D.18345 = names->len;
      D.18346 = (long unsigned int) D.18345;
      result = mono_array_new (domain, D.18344, D.18346);
      i = 0;
      goto <D.18034>;
      <D.18033>:
      {
        void * * __p;

        D.18347 = (long unsigned int) i;
        __p = mono_array_addr_with_size (result, 8, D.18347);
        D.18348 = names->pdata;
        D.18349 = (long unsigned int) i;
        D.18350 = D.18349 * 8;
        D.18351 = D.18348 + D.18350;
        D.18352 = *D.18351;
        D.18353 = mono_string_new (domain, D.18352);
        mono_gc_wbarrier_set_arrayref (result, __p, D.18353);
      }
      i = i + 1;
      <D.18034>:
      i.2 = (unsigned int) i;
      D.18345 = names->len;
      if (i.2 < D.18345) goto <D.18033>; else goto <D.18035>;
      <D.18035>:
      <D.18343>:
      i = 0;
      goto <D.18037>;
      <D.18036>:
      D.18348 = names->pdata;
      D.18349 = (long unsigned int) i;
      D.18350 = D.18349 * 8;
      D.18351 = D.18348 + D.18350;
      D.18352 = *D.18351;
      monoeg_g_free (D.18352);
      i = i + 1;
      <D.18037>:
      i.2 = (unsigned int) i;
      D.18345 = names->len;
      if (i.2 < D.18345) goto <D.18036>; else goto <D.18038>;
      <D.18038>:
      monoeg_g_ptr_array_free (names, 1);
      monoeg_g_free (utf8_path);
      leave:
      if (result == 0B) goto <D.18355>; else goto <D.18356>;
      <D.18355>:
      D.18357 = *error;
      if (D.18357 == 0) goto <D.18358>; else goto <D.18359>;
      <D.18358>:
      D.18344 = mono_defaults.string_class;
      result = mono_array_new (domain, D.18344, 0);
      <D.18359>:
      <D.18356>:
      D.18360 = result;
      return D.18360;
    }
  finally
    {
      data = {CLOBBER};
    }
}


convert_attrs (MonoFileAttributes attrs)
{
  int D.18363;
  guint32 D.18366;

  D.18363 = attrs & 16384;
  if (D.18363 != 0) goto <D.18364>; else goto <D.18365>;
  <D.18364>:
  attrs = attrs | 64;
  <D.18365>:
  D.18366 = (guint32) attrs;
  return D.18366;
}


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

  try
    {
      res = GetFileAttributes (path);
      if (res != 4294967295) goto <D.18368>; else goto <D.18369>;
      <D.18368>:
      D.18370 = res;
      return D.18370;
      <D.18369>:
      D.18371 = GetLastError ();
      error = (gint32) D.18371;
      if (error != 32) goto <D.18372>; else goto <D.18373>;
      <D.18372>:
      D.18370 = res;
      return D.18370;
      <D.18373>:
      find_handle = FindFirstFile (path, &find_data);
      if (find_handle == -1B) goto <D.18374>; else goto <D.18375>;
      <D.18374>:
      D.18370 = res;
      return D.18370;
      <D.18375>:
      FindClose (find_handle);
      D.18370 = find_data.dwFileAttributes;
      return D.18370;
    }
  finally
    {
      find_data = {CLOBBER};
    }
}


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

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


ves_icall_System_IO_MonoIO_FindFirst (struct MonoString * path, struct MonoString * path_with_pattern, gint32 * result_attr, gint32 * error, void * * handle)
{
  mono_unichar2 * D.18380;
  unsigned int D.18383;
  struct MonoString * D.18386;
  char * D.18387;
  struct MonoDomain * D.18388;
  int D.18389;
  unsigned int D.18392;
  int D.18395;
  unsigned int D.18396;
  int D.18397;
  struct WIN32_FIND_DATA data;
  void * find_handle;
  struct IncrementalFind * ifh;
  struct MonoString * result;

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

        D.18383 = GetLastError ();
        find_error = (gint32) D.18383;
        *handle = 0B;
        if (find_error == 2) goto <D.18384>; else goto <D.18385>;
        <D.18384>:
        D.18386 = 0B;
        return D.18386;
        <D.18385>:
        *error = find_error;
        D.18386 = 0B;
        return D.18386;
      }
      <D.18382>:
      ifh = monoeg_malloc (24);
      ifh->find_handle = find_handle;
      D.18387 = mono_string_to_utf8 (path);
      ifh->utf8_path = D.18387;
      D.18388 = mono_domain_get ();
      ifh->domain = D.18388;
      *handle = ifh;
      goto <D.18065>;
      <D.18064>:
      D.18389 = FindNextFile (find_handle, &data);
      if (D.18389 == 0) goto <D.18390>; else goto <D.18391>;
      <D.18390>:
      {
        int e;

        D.18392 = GetLastError ();
        e = (int) D.18392;
        if (e != 18) goto <D.18393>; else goto <D.18394>;
        <D.18393>:
        *error = e;
        <D.18394>:
        D.18386 = 0B;
        return D.18386;
      }
      <D.18391>:
      <D.18065>:
      D.18395 = incremental_find_check_match (ifh, &data, &result);
      if (D.18395 == 0) goto <D.18064>; else goto <D.18066>;
      <D.18066>:
      D.18396 = data.dwFileAttributes;
      D.18397 = (int) D.18396;
      *result_attr = D.18397;
      D.18386 = result;
      return D.18386;
    }
  finally
    {
      data = {CLOBBER};
      result = {CLOBBER};
    }
}


incremental_find_check_match (struct IncrementalFind * handle, struct WIN32_FIND_DATA * data, struct MonoString * * result)
{
  unsigned int D.18402;
  unsigned int D.18403;
  short unsigned int D.18406;
  gboolean D.18407;
  gunichar2[260] * D.18408;
  gchar * D.18411;
  struct MonoDomain * D.18412;
  struct MonoString * D.18413;
  gchar * utf8_result;
  gchar * full_name;

  D.18402 = BIT_FIELD_REF <*data, 32, 352>;
  D.18403 = D.18402;
  if (D.18403 == 46) goto <D.18400>; else goto <D.18404>;
  <D.18404>:
  D.18402 = BIT_FIELD_REF <*data, 32, 352>;
  D.18403 = D.18402;
  if (D.18403 == 3014702) goto <D.18405>; else goto <D.18401>;
  <D.18405>:
  D.18406 = data->cFileName[2];
  if (D.18406 == 0) goto <D.18400>; else goto <D.18401>;
  <D.18400>:
  D.18407 = 0;
  return D.18407;
  <D.18401>:
  D.18408 = &data->cFileName;
  utf8_result = monoeg_g_utf16_to_utf8 (D.18408, -1, 0B, 0B, 0B);
  if (utf8_result == 0B) goto <D.18409>; else goto <D.18410>;
  <D.18409>:
  D.18407 = 0;
  return D.18407;
  <D.18410>:
  D.18411 = handle->utf8_path;
  full_name = monoeg_g_build_path ("/", D.18411, utf8_result, 0B);
  monoeg_g_free (utf8_result);
  D.18412 = mono_domain_get ();
  D.18413 = mono_string_new (D.18412, full_name);
  *result = D.18413;
  monoeg_g_free (full_name);
  D.18407 = 1;
  return D.18407;
}


ves_icall_System_IO_MonoIO_FindNext (void * handle, gint32 * result_attr, gint32 * error)
{
  void * D.18415;
  int D.18416;
  unsigned int D.18419;
  struct MonoString * D.18422;
  int D.18423;
  unsigned int D.18424;
  int D.18425;
  struct IncrementalFind * ifh;
  struct WIN32_FIND_DATA data;
  struct MonoString * result;

  try
    {
      ifh = handle;
      *error = 0;
      <D.18076>:
      D.18415 = ifh->find_handle;
      D.18416 = FindNextFile (D.18415, &data);
      if (D.18416 == 0) goto <D.18417>; else goto <D.18418>;
      <D.18417>:
      {
        int e;

        D.18419 = GetLastError ();
        e = (int) D.18419;
        if (e != 18) goto <D.18420>; else goto <D.18421>;
        <D.18420>:
        *error = e;
        <D.18421>:
        D.18422 = 0B;
        return D.18422;
      }
      <D.18418>:
      D.18423 = incremental_find_check_match (ifh, &data, &result);
      if (D.18423 == 0) goto <D.18076>; else goto <D.18077>;
      <D.18077>:
      D.18424 = data.dwFileAttributes;
      D.18425 = (int) D.18424;
      *result_attr = D.18425;
      D.18422 = result;
      return D.18422;
    }
  finally
    {
      data = {CLOBBER};
      result = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_FindClose (void * handle)
{
  void * D.18428;
  int D.18429;
  unsigned int D.18432;
  gchar * D.18434;
  int D.18435;
  struct IncrementalFind * ifh;
  gint32 error;

  ifh = handle;
  D.18428 = ifh->find_handle;
  D.18429 = FindClose (D.18428);
  if (D.18429 == 0) goto <D.18430>; else goto <D.18431>;
  <D.18430>:
  D.18432 = GetLastError ();
  error = (gint32) D.18432;
  goto <D.18433>;
  <D.18431>:
  error = 0;
  <D.18433>:
  D.18434 = ifh->utf8_path;
  monoeg_g_free (D.18434);
  monoeg_g_free (ifh);
  D.18435 = error;
  return D.18435;
}


ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 * error)
{
  long unsigned int D.18437;
  long unsigned int D.18438;
  unsigned int len.3;
  unsigned int D.18440;
  long unsigned int D.18443;
  long unsigned int D.18444;
  unsigned int res_len.4;
  unsigned int D.18446;
  unsigned int old_res_len.5;
  _Bool D.18448;
  gunichar2 * D.18451;
  short unsigned int D.18452;
  struct MonoDomain * D.18453;
  unsigned int D.18455;
  int D.18456;
  struct MonoString * D.18457;
  struct MonoString * result;
  gunichar2 * buf;
  int len;
  int res_len;

  len = 261;
  D.18437 = (long unsigned int) len;
  D.18438 = D.18437 * 2;
  buf = monoeg_malloc (D.18438);
  *error = 0;
  result = 0B;
  len.3 = (unsigned int) len;
  D.18440 = GetCurrentDirectory (len.3, buf);
  res_len = (int) D.18440;
  if (res_len > len) goto <D.18441>; else goto <D.18442>;
  <D.18441>:
  {
    int old_res_len;

    old_res_len = res_len;
    monoeg_g_free (buf);
    D.18443 = (long unsigned int) res_len;
    D.18444 = D.18443 * 2;
    buf = monoeg_malloc (D.18444);
    res_len.4 = (unsigned int) res_len;
    D.18446 = GetCurrentDirectory (res_len.4, buf);
    old_res_len.5 = (unsigned int) old_res_len;
    D.18448 = D.18446 == old_res_len.5;
    res_len = (int) D.18448;
  }
  <D.18442>:
  if (res_len != 0) goto <D.18449>; else goto <D.18450>;
  <D.18449>:
  len = 0;
  goto <D.18092>;
  <D.18091>:
  len = len + 1;
  <D.18092>:
  D.18437 = (long unsigned int) len;
  D.18438 = D.18437 * 2;
  D.18451 = buf + D.18438;
  D.18452 = *D.18451;
  if (D.18452 != 0) goto <D.18091>; else goto <D.18093>;
  <D.18093>:
  D.18453 = mono_domain_get ();
  result = mono_string_new_utf16 (D.18453, buf, len);
  goto <D.18454>;
  <D.18450>:
  D.18455 = GetLastError ();
  D.18456 = (int) D.18455;
  *error = D.18456;
  <D.18454>:
  monoeg_g_free (buf);
  D.18457 = result;
  return D.18457;
}


ves_icall_System_IO_MonoIO_SetCurrentDirectory (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18459;
  unsigned int D.18462;
  int D.18463;
  MonoBoolean D.18464;
  gboolean ret;

  *error = 0;
  D.18459 = mono_string_chars (path);
  ret = SetCurrentDirectory (D.18459);
  if (ret == 0) goto <D.18460>; else goto <D.18461>;
  <D.18460>:
  D.18462 = GetLastError ();
  D.18463 = (int) D.18462;
  *error = D.18463;
  <D.18461>:
  D.18464 = (MonoBoolean) ret;
  return D.18464;
}


ves_icall_System_IO_MonoIO_MoveFile (struct MonoString * path, struct MonoString * dest, gint32 * error)
{
  mono_unichar2 * D.18466;
  mono_unichar2 * D.18467;
  unsigned int D.18470;
  int D.18471;
  MonoBoolean D.18472;
  gboolean ret;

  *error = 0;
  D.18466 = mono_string_chars (path);
  D.18467 = mono_string_chars (dest);
  ret = MoveFile (D.18466, D.18467);
  if (ret == 0) goto <D.18468>; else goto <D.18469>;
  <D.18468>:
  D.18470 = GetLastError ();
  D.18471 = (int) D.18470;
  *error = D.18471;
  <D.18469>:
  D.18472 = (MonoBoolean) ret;
  return D.18472;
}


ves_icall_System_IO_MonoIO_ReplaceFile (struct MonoString * sourceFileName, struct MonoString * destinationFileName, struct MonoString * destinationBackupFileName, MonoBoolean ignoreMetadataErrors, gint32 * error)
{
  unsigned int D.18484;
  int D.18485;
  MonoBoolean D.18486;
  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.18474>; else goto <D.18475>;
  <D.18474>:
  utf16_sourceFileName = mono_string_chars (sourceFileName);
  <D.18475>:
  if (destinationFileName != 0B) goto <D.18476>; else goto <D.18477>;
  <D.18476>:
  utf16_destinationFileName = mono_string_chars (destinationFileName);
  <D.18477>:
  if (destinationBackupFileName != 0B) goto <D.18478>; else goto <D.18479>;
  <D.18478>:
  utf16_destinationBackupFileName = mono_string_chars (destinationBackupFileName);
  <D.18479>:
  *error = 0;
  if (ignoreMetadataErrors != 0) goto <D.18480>; else goto <D.18481>;
  <D.18480>:
  replaceFlags = replaceFlags | 2;
  <D.18481>:
  ret = ReplaceFile (utf16_destinationFileName, utf16_sourceFileName, utf16_destinationBackupFileName, replaceFlags, 0B, 0B);
  if (ret == 0) goto <D.18482>; else goto <D.18483>;
  <D.18482>:
  D.18484 = GetLastError ();
  D.18485 = (int) D.18484;
  *error = D.18485;
  <D.18483>:
  D.18486 = (MonoBoolean) ret;
  return D.18486;
}


ves_icall_System_IO_MonoIO_CopyFile (struct MonoString * path, struct MonoString * dest, MonoBoolean overwrite, gint32 * error)
{
  mono_unichar2 * D.18488;
  mono_unichar2 * D.18489;
  _Bool D.18490;
  int D.18491;
  unsigned int D.18494;
  int D.18495;
  MonoBoolean D.18496;
  gboolean ret;

  *error = 0;
  D.18488 = mono_string_chars (path);
  D.18489 = mono_string_chars (dest);
  D.18490 = overwrite == 0;
  D.18491 = (int) D.18490;
  ret = CopyFile (D.18488, D.18489, D.18491);
  if (ret == 0) goto <D.18492>; else goto <D.18493>;
  <D.18492>:
  D.18494 = GetLastError ();
  D.18495 = (int) D.18494;
  *error = D.18495;
  <D.18493>:
  D.18496 = (MonoBoolean) ret;
  return D.18496;
}


ves_icall_System_IO_MonoIO_DeleteFile (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18498;
  unsigned int D.18501;
  int D.18502;
  MonoBoolean D.18503;
  gboolean ret;

  *error = 0;
  D.18498 = mono_string_chars (path);
  ret = DeleteFile (D.18498);
  if (ret == 0) goto <D.18499>; else goto <D.18500>;
  <D.18499>:
  D.18501 = GetLastError ();
  D.18502 = (int) D.18501;
  *error = D.18502;
  <D.18500>:
  D.18503 = (MonoBoolean) ret;
  return D.18503;
}


ves_icall_System_IO_MonoIO_GetFileAttributes (struct MonoString * path, gint32 * error)
{
  mono_unichar2 * D.18505;
  unsigned int D.18506;
  unsigned int D.18509;
  int D.18510;
  gint32 D.18511;
  gint32 ret;

  *error = 0;
  D.18505 = mono_string_chars (path);
  D.18506 = get_file_attributes (D.18505);
  ret = (gint32) D.18506;
  if (ret == -1) goto <D.18507>; else goto <D.18508>;
  <D.18507>:
  D.18509 = GetLastError ();
  D.18510 = (int) D.18509;
  *error = D.18510;
  <D.18508>:
  D.18511 = ret;
  return D.18511;
}


ves_icall_System_IO_MonoIO_SetFileAttributes (struct MonoString * path, gint32 attrs, gint32 * error)
{
  mono_unichar2 * D.18513;
  unsigned int D.18514;
  unsigned int D.18517;
  int D.18518;
  MonoBoolean D.18519;
  gboolean ret;

  *error = 0;
  D.18513 = mono_string_chars (path);
  D.18514 = convert_attrs (attrs);
  ret = SetFileAttributes (D.18513, D.18514);
  if (ret == 0) goto <D.18515>; else goto <D.18516>;
  <D.18515>:
  D.18517 = GetLastError ();
  D.18518 = (int) D.18517;
  *error = D.18518;
  <D.18516>:
  D.18519 = (MonoBoolean) ret;
  return D.18519;
}


ves_icall_System_IO_MonoIO_GetFileType (void * handle, gint32 * error)
{
  <unnamed type> D.18521;
  unsigned int D.18524;
  int D.18525;
  gint32 D.18526;
  gboolean ret;

  *error = 0;
  D.18521 = GetFileType (handle);
  ret = (gboolean) D.18521;
  if (ret == 0) goto <D.18522>; else goto <D.18523>;
  <D.18522>:
  D.18524 = GetLastError ();
  D.18525 = (int) D.18524;
  *error = D.18525;
  <D.18523>:
  D.18526 = ret;
  return D.18526;
}


ves_icall_System_IO_MonoIO_GetFileStat (struct MonoString * path, struct MonoIOStat * stat, gint32 * error)
{
  mono_unichar2 * D.18528;
  unsigned int D.18532;
  int D.18533;
  MonoBoolean D.18534;
  gboolean result;
  struct WIN32_FILE_ATTRIBUTE_DATA data;

  try
    {
      *error = 0;
      D.18528 = mono_string_chars (path);
      result = get_file_attributes_ex (D.18528, &data);
      if (result != 0) goto <D.18529>; else goto <D.18530>;
      <D.18529>:
      convert_win32_file_attribute_data (&data, stat);
      goto <D.18531>;
      <D.18530>:
      D.18532 = GetLastError ();
      D.18533 = (int) D.18532;
      *error = D.18533;
      memset (stat, 0, 40);
      <D.18531>:
      D.18534 = (MonoBoolean) result;
      return D.18534;
    }
  finally
    {
      data = {CLOBBER};
    }
}


get_file_attributes_ex (const gunichar2 * path, struct WIN32_FILE_ATTRIBUTE_DATA * data)
{
  gboolean D.18539;
  unsigned int D.18540;
  unsigned int D.18545;
  unsigned int D.18546;
  unsigned int D.18547;
  gboolean res;
  struct WIN32_FIND_DATA find_data;
  void * find_handle;
  gint32 error;

  try
    {
      res = GetFileAttributesEx (path, 0, data);
      if (res != 0) goto <D.18537>; else goto <D.18538>;
      <D.18537>:
      D.18539 = 1;
      return D.18539;
      <D.18538>:
      D.18540 = GetLastError ();
      error = (gint32) D.18540;
      if (error != 32) goto <D.18541>; else goto <D.18542>;
      <D.18541>:
      D.18539 = 0;
      return D.18539;
      <D.18542>:
      find_handle = FindFirstFile (path, &find_data);
      if (find_handle == -1B) goto <D.18543>; else goto <D.18544>;
      <D.18543>:
      D.18539 = 0;
      return D.18539;
      <D.18544>:
      FindClose (find_handle);
      D.18545 = find_data.dwFileAttributes;
      data->dwFileAttributes = D.18545;
      data->ftCreationTime = find_data.ftCreationTime;
      data->ftLastAccessTime = find_data.ftLastAccessTime;
      data->ftLastWriteTime = find_data.ftLastWriteTime;
      D.18546 = find_data.nFileSizeHigh;
      data->nFileSizeHigh = D.18546;
      D.18547 = find_data.nFileSizeLow;
      data->nFileSizeLow = D.18547;
      D.18539 = 1;
      return D.18539;
    }
  finally
    {
      find_data = {CLOBBER};
    }
}


convert_win32_file_attribute_data (const struct WIN32_FILE_ATTRIBUTE_DATA * data, struct MonoIOStat * stat)
{
  unsigned int D.18550;
  int D.18551;
  const struct WapiFileTime * D.18552;
  long int D.18553;
  const struct WapiFileTime * D.18554;
  long int D.18555;
  const struct WapiFileTime * D.18556;
  long int D.18557;
  unsigned int D.18558;
  long int D.18559;
  long int D.18560;
  unsigned int D.18561;
  long int D.18562;
  long int D.18563;

  D.18550 = data->dwFileAttributes;
  D.18551 = (int) D.18550;
  stat->attributes = D.18551;
  D.18552 = &data->ftCreationTime;
  D.18553 = convert_filetime (D.18552);
  stat->creation_time = D.18553;
  D.18554 = &data->ftLastAccessTime;
  D.18555 = convert_filetime (D.18554);
  stat->last_access_time = D.18555;
  D.18556 = &data->ftLastWriteTime;
  D.18557 = convert_filetime (D.18556);
  stat->last_write_time = D.18557;
  D.18558 = data->nFileSizeHigh;
  D.18559 = (long int) D.18558;
  D.18560 = D.18559 << 32;
  D.18561 = data->nFileSizeLow;
  D.18562 = (long int) D.18561;
  D.18563 = D.18560 | D.18562;
  stat->length = D.18563;
}


convert_filetime (const struct FILETIME * filetime)
{
  unsigned int D.18564;
  unsigned int D.18565;
  long unsigned int D.18566;
  gint64 D.18567;
  guint64 ticks;

  D.18564 = filetime->dwHighDateTime;
  ticks = (guint64) D.18564;
  ticks = ticks << 32;
  D.18565 = filetime->dwLowDateTime;
  D.18566 = (long unsigned int) D.18565;
  ticks = D.18566 + ticks;
  D.18567 = (gint64) ticks;
  return D.18567;
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.18571;
  int D.18576;
  void * D.18578;
  long unsigned int D.18579;

  D.18571 = __builtin_constant_p (__len);
  if (D.18571 != 0) goto <D.18572>; else goto <D.18573>;
  <D.18572>:
  if (__len == 0) goto <D.18574>; else goto <D.18575>;
  <D.18574>:
  D.18576 = __builtin_constant_p (__ch);
  if (D.18576 == 0) goto <D.18569>; else goto <D.18577>;
  <D.18577>:
  if (__ch != 0) goto <D.18569>; else goto <D.18570>;
  <D.18569>:
  __warn_memset_zero_len ();
  D.18578 = __dest;
  return D.18578;
  <D.18570>:
  <D.18575>:
  <D.18573>:
  D.18579 = __builtin_object_size (__dest, 0);
  D.18578 = __builtin___memset_chk (__dest, __ch, __len, D.18579);
  return D.18578;
}


ves_icall_System_IO_MonoIO_Open (struct MonoString * filename, gint32 mode, gint32 access_mode, gint32 share, gint32 options, gint32 * error)
{
  int D.18583;
  int D.18587;
  int D.18590;
  int D.18593;
  int D.18596;
  int D.18599;
  unsigned int attributes.6;
  unsigned int D.18605;
  unsigned int D.18607;
  int D.18610;
  <unnamed type> access_mode.7;
  unsigned int D.18614;
  <unnamed type> share.8;
  unsigned int D.18616;
  <unnamed type> mode.9;
  unsigned int D.18618;
  unsigned int attributes.10;
  unsigned int D.18622;
  int D.18623;
  void * D.18624;
  void * ret;
  int attributes;
  int attrs;
  gunichar2 * chars;

  chars = mono_string_chars (filename);
  *error = 0;
  if (options != 0) goto <D.18581>; else goto <D.18582>;
  <D.18581>:
  D.18583 = options & 16384;
  if (D.18583 != 0) goto <D.18584>; else goto <D.18585>;
  <D.18584>:
  attributes = 64;
  goto <D.18586>;
  <D.18585>:
  attributes = 128;
  <D.18586>:
  D.18587 = options & 67108864;
  if (D.18587 != 0) goto <D.18588>; else goto <D.18589>;
  <D.18588>:
  attributes = attributes | 67108864;
  <D.18589>:
  D.18590 = options & 134217728;
  if (D.18590 != 0) goto <D.18591>; else goto <D.18592>;
  <D.18591>:
  attributes = attributes | 134217728;
  <D.18592>:
  D.18593 = options & 268435456;
  if (D.18593 != 0) goto <D.18594>; else goto <D.18595>;
  <D.18594>:
  attributes = attributes | 268435456;
  <D.18595>:
  D.18596 = options & 1;
  if (D.18596 != 0) goto <D.18597>; else goto <D.18598>;
  <D.18597>:
  attributes = attributes | 256;
  <D.18598>:
  D.18599 = options & 1073741824;
  if (D.18599 != 0) goto <D.18600>; else goto <D.18601>;
  <D.18600>:
  attributes = attributes | 1073741824;
  <D.18601>:
  if (options < 0) goto <D.18602>; else goto <D.18603>;
  <D.18602>:
  attributes.6 = (unsigned int) attributes;
  D.18605 = attributes.6 | 2147483648;
  attributes = (int) D.18605;
  <D.18603>:
  goto <D.18606>;
  <D.18582>:
  attributes = 128;
  <D.18606>:
  D.18607 = get_file_attributes (chars);
  attrs = (int) D.18607;
  if (attrs != -1) goto <D.18608>; else goto <D.18609>;
  <D.18608>:
  D.18610 = attrs & 16;
  if (D.18610 != 0) goto <D.18611>; else goto <D.18612>;
  <D.18611>:
  attributes = attributes | 33554432;
  <D.18612>:
  <D.18609>:
  access_mode.7 = (<unnamed type>) access_mode;
  D.18614 = convert_access (access_mode.7);
  share.8 = (<unnamed type>) share;
  D.18616 = convert_share (share.8);
  mode.9 = (<unnamed type>) mode;
  D.18618 = convert_mode (mode.9);
  attributes.10 = (unsigned int) attributes;
  ret = CreateFile (chars, D.18614, D.18616, 0B, D.18618, attributes.10, 0B);
  if (ret == -1B) goto <D.18620>; else goto <D.18621>;
  <D.18620>:
  D.18622 = GetLastError ();
  D.18623 = (int) D.18622;
  *error = D.18623;
  <D.18621>:
  D.18624 = ret;
  return D.18624;
}


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

  switch (mono_access) <default: <D.17955>, case 1: <D.17951>, case 2: <D.17953>, case 3: <D.17954>>
  <D.17951>:
  access = 2147483648;
  goto <D.17952>;
  <D.17953>:
  access = 1073741824;
  goto <D.17952>;
  <D.17954>:
  access = 3221225472;
  goto <D.17952>;
  <D.17955>:
  monoeg_g_log (0B, 16, "System.IO.FileAccess has unknown value 0x%x", mono_access);
  access = 2147483648;
  <D.17952>:
  D.18626 = access;
  return D.18626;
}


convert_share (MonoFileShare mono_share)
{
  unsigned int D.18628;
  unsigned int D.18631;
  unsigned int D.18634;
  unsigned int D.18637;
  guint32 D.18640;
  guint32 share;

  share = 0;
  D.18628 = mono_share & 1;
  if (D.18628 != 0) goto <D.18629>; else goto <D.18630>;
  <D.18629>:
  share = share | 1;
  <D.18630>:
  D.18631 = mono_share & 2;
  if (D.18631 != 0) goto <D.18632>; else goto <D.18633>;
  <D.18632>:
  share = share | 2;
  <D.18633>:
  D.18634 = mono_share & 4;
  if (D.18634 != 0) goto <D.18635>; else goto <D.18636>;
  <D.18635>:
  share = share | 4;
  <D.18636>:
  D.18637 = mono_share & 4294967288;
  if (D.18637 != 0) goto <D.18638>; else goto <D.18639>;
  <D.18638>:
  monoeg_g_log (0B, 16, "System.IO.FileShare has unknown value 0x%x", mono_share);
  share = 0;
  <D.18639>:
  D.18640 = share;
  return D.18640;
}


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

  switch (mono_mode) <default: <D.17946>, case 1: <D.17939>, case 2: <D.17941>, case 3: <D.17942>, case 4: <D.17943>, case 5: <D.17944>, case 6: <D.17945>>
  <D.17939>:
  mode = 1;
  goto <D.17940>;
  <D.17941>:
  mode = 2;
  goto <D.17940>;
  <D.17942>:
  mode = 3;
  goto <D.17940>;
  <D.17943>:
  mode = 4;
  goto <D.17940>;
  <D.17944>:
  mode = 5;
  goto <D.17940>;
  <D.17945>:
  mode = 4;
  goto <D.17940>;
  <D.17946>:
  monoeg_g_log (0B, 16, "System.IO.FileMode has unknown value 0x%x", mono_mode);
  mode = 3;
  <D.17940>:
  D.18642 = mode;
  return D.18642;
}


ves_icall_System_IO_MonoIO_Close (void * handle, gint32 * error)
{
  unsigned int D.18646;
  int D.18647;
  MonoBoolean D.18648;
  gboolean ret;

  *error = 0;
  ret = CloseHandle (handle);
  if (ret == 0) goto <D.18644>; else goto <D.18645>;
  <D.18644>:
  D.18646 = GetLastError ();
  D.18647 = (int) D.18646;
  *error = D.18647;
  <D.18645>:
  D.18648 = (MonoBoolean) ret;
  return D.18648;
}


ves_icall_System_IO_MonoIO_Read (void * handle, struct MonoArray * dest, gint32 dest_offset, gint32 count, gint32 * error)
{
  _Bool D.18650;
  long int D.18651;
  long int D.18652;
  long unsigned int D.18657;
  long unsigned int D.18658;
  long unsigned int D.18659;
  long unsigned int D.18660;
  struct MonoException * D.18663;
  unsigned int count.11;
  unsigned int D.18667;
  int D.18668;
  gint32 D.18669;
  unsigned int n.12;
  guchar * buffer;
  gboolean result;
  guint32 n;

  try
    {
      *error = 0;
      D.18650 = dest == 0B;
      D.18651 = (long int) D.18650;
      D.18652 = __builtin_expect (D.18651, 0);
      if (D.18652 != 0) goto <D.18653>; else goto <D.18654>;
      <D.18653>:
      {
        struct MonoException * ex;

        if (dest != 0B) goto <D.18655>; else goto <D.18656>;
        <D.18655>:
        <D.18656>:
        ex = mono_get_exception_argument_null ("dest");
        mono_raise_exception (ex);
      }
      <D.18654>:
      D.18657 = (long unsigned int) dest_offset;
      D.18658 = mono_array_length (dest);
      D.18659 = (long unsigned int) count;
      D.18660 = D.18658 - D.18659;
      if (D.18657 > D.18660) goto <D.18661>; else goto <D.18662>;
      <D.18661>:
      D.18663 = mono_get_exception_argument ("array", "array too small. numBytes/offset wrong.");
      mono_raise_exception (D.18663);
      <D.18662>:
      D.18657 = (long unsigned int) dest_offset;
      buffer = mono_array_addr_with_size (dest, 1, D.18657);
      count.11 = (unsigned int) count;
      result = ReadFile (handle, buffer, count.11, &n, 0B);
      if (result == 0) goto <D.18665>; else goto <D.18666>;
      <D.18665>:
      D.18667 = GetLastError ();
      D.18668 = (int) D.18667;
      *error = D.18668;
      D.18669 = -1;
      return D.18669;
      <D.18666>:
      n.12 = n;
      D.18669 = (gint32) n.12;
      return D.18669;
    }
  finally
    {
      n = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_Write (void * handle, struct MonoArray * src, gint32 src_offset, gint32 count, gint32 * error)
{
  _Bool D.18673;
  long int D.18674;
  long int D.18675;
  long unsigned int D.18680;
  long unsigned int D.18681;
  long unsigned int D.18682;
  long unsigned int D.18683;
  struct MonoException * D.18686;
  unsigned int count.13;
  unsigned int D.18690;
  int D.18691;
  gint32 D.18692;
  unsigned int n.14;
  guchar * buffer;
  gboolean result;
  guint32 n;

  try
    {
      *error = 0;
      D.18673 = src == 0B;
      D.18674 = (long int) D.18673;
      D.18675 = __builtin_expect (D.18674, 0);
      if (D.18675 != 0) goto <D.18676>; else goto <D.18677>;
      <D.18676>:
      {
        struct MonoException * ex;

        if (src != 0B) goto <D.18678>; else goto <D.18679>;
        <D.18678>:
        <D.18679>:
        ex = mono_get_exception_argument_null ("src");
        mono_raise_exception (ex);
      }
      <D.18677>:
      D.18680 = (long unsigned int) src_offset;
      D.18681 = mono_array_length (src);
      D.18682 = (long unsigned int) count;
      D.18683 = D.18681 - D.18682;
      if (D.18680 > D.18683) goto <D.18684>; else goto <D.18685>;
      <D.18684>:
      D.18686 = mono_get_exception_argument ("array", "array too small. numBytes/offset wrong.");
      mono_raise_exception (D.18686);
      <D.18685>:
      D.18680 = (long unsigned int) src_offset;
      buffer = mono_array_addr_with_size (src, 1, D.18680);
      count.13 = (unsigned int) count;
      result = WriteFile (handle, buffer, count.13, &n, 0B);
      if (result == 0) goto <D.18688>; else goto <D.18689>;
      <D.18688>:
      D.18690 = GetLastError ();
      D.18691 = (int) D.18690;
      *error = D.18691;
      D.18692 = -1;
      return D.18692;
      <D.18689>:
      n.14 = n;
      D.18692 = (gint32) n.14;
      return D.18692;
    }
  finally
    {
      n = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_Seek (void * handle, gint64 offset, gint32 origin, gint32 * error)
{
  long int D.18696;
  int offset_hi.15;
  int D.18698;
  <unnamed type> origin.16;
  unsigned int D.18700;
  unsigned int D.18701;
  unsigned int D.18704;
  int D.18705;
  gint64 D.18706;
  int offset_hi.17;
  long int D.18708;
  long int D.18709;
  gint32 offset_hi;

  try
    {
      *error = 0;
      D.18696 = offset >> 32;
      offset_hi.15 = (int) D.18696;
      offset_hi = offset_hi.15;
      D.18698 = (int) offset;
      origin.16 = (<unnamed type>) origin;
      D.18700 = convert_seekorigin (origin.16);
      D.18701 = SetFilePointer (handle, D.18698, &offset_hi, D.18700);
      offset = (gint64) D.18701;
      if (offset == 4294967295) goto <D.18702>; else goto <D.18703>;
      <D.18702>:
      D.18704 = GetLastError ();
      D.18705 = (int) D.18704;
      *error = D.18705;
      <D.18703>:
      offset_hi.17 = offset_hi;
      D.18708 = (long int) offset_hi.17;
      D.18709 = D.18708 << 32;
      D.18706 = D.18709 | offset;
      return D.18706;
    }
  finally
    {
      offset_hi = {CLOBBER};
    }
}


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

  switch (origin) <default: <D.17968>, case 0: <D.17964>, case 1: <D.17966>, case 2: <D.17967>>
  <D.17964>:
  w32origin = 0;
  goto <D.17965>;
  <D.17966>:
  w32origin = 1;
  goto <D.17965>;
  <D.17967>:
  w32origin = 2;
  goto <D.17965>;
  <D.17968>:
  monoeg_g_log (0B, 16, "System.IO.SeekOrigin has unknown value 0x%x", origin);
  w32origin = 1;
  <D.17965>:
  D.18712 = w32origin;
  return D.18712;
}


ves_icall_System_IO_MonoIO_Flush (void * handle, gint32 * error)
{
  unsigned int D.18716;
  int D.18717;
  MonoBoolean D.18718;
  gboolean ret;

  *error = 0;
  ret = FlushFileBuffers (handle);
  if (ret == 0) goto <D.18714>; else goto <D.18715>;
  <D.18714>:
  D.18716 = GetLastError ();
  D.18717 = (int) D.18716;
  *error = D.18717;
  <D.18715>:
  D.18718 = (MonoBoolean) ret;
  return D.18718;
}


ves_icall_System_IO_MonoIO_GetLength (void * handle, gint32 * error)
{
  unsigned int D.18720;
  unsigned int D.18723;
  int D.18724;
  gint64 D.18725;
  unsigned int length_hi.18;
  long int D.18727;
  long int D.18728;
  gint64 length;
  guint32 length_hi;

  try
    {
      *error = 0;
      D.18720 = GetFileSize (handle, &length_hi);
      length = (gint64) D.18720;
      if (length == 4294967295) goto <D.18721>; else goto <D.18722>;
      <D.18721>:
      D.18723 = GetLastError ();
      D.18724 = (int) D.18723;
      *error = D.18724;
      <D.18722>:
      length_hi.18 = length_hi;
      D.18727 = (long int) length_hi.18;
      D.18728 = D.18727 << 32;
      D.18725 = D.18728 | length;
      return D.18725;
    }
  finally
    {
      length_hi = {CLOBBER};
    }
}


ves_icall_System_IO_MonoIO_SetLength (void * handle, gint64 length, gint32 * error)
{
  unsigned int D.18731;
  unsigned int D.18734;
  int D.18735;
  MonoBoolean D.18736;
  long int D.18737;
  int length_hi.19;
  int D.18739;
  unsigned int D.18740;
  unsigned int D.18743;
  int D.18744;
  unsigned int D.18747;
  int D.18748;
  int D.18749;
  unsigned int D.18750;
  unsigned int D.18753;
  int D.18754;
  gint64 offset;
  gint64 offset_set;
  gint32 offset_hi;
  gint32 length_hi;
  gboolean result;

  try
    {
      *error = 0;
      offset_hi = 0;
      D.18731 = SetFilePointer (handle, 0, &offset_hi, 1);
      offset = (gint64) D.18731;
      if (offset == 4294967295) goto <D.18732>; else goto <D.18733>;
      <D.18732>:
      D.18734 = GetLastError ();
      D.18735 = (int) D.18734;
      *error = D.18735;
      D.18736 = 0;
      return D.18736;
      <D.18733>:
      D.18737 = length >> 32;
      length_hi.19 = (int) D.18737;
      length_hi = length_hi.19;
      D.18739 = (int) length;
      D.18740 = SetFilePointer (handle, D.18739, &length_hi, 0);
      offset_set = (gint64) D.18740;
      if (offset_set == 4294967295) goto <D.18741>; else goto <D.18742>;
      <D.18741>:
      D.18743 = GetLastError ();
      D.18744 = (int) D.18743;
      *error = D.18744;
      D.18736 = 0;
      return D.18736;
      <D.18742>:
      result = SetEndOfFile (handle);
      if (result == 0) goto <D.18745>; else goto <D.18746>;
      <D.18745>:
      D.18747 = GetLastError ();
      D.18748 = (int) D.18747;
      *error = D.18748;
      D.18736 = 0;
      return D.18736;
      <D.18746>:
      D.18749 = (int) offset;
      D.18750 = SetFilePointer (handle, D.18749, &offset_hi, 0);
      offset_set = (gint64) D.18750;
      if (offset_set == 4294967295) goto <D.18751>; else goto <D.18752>;
      <D.18751>:
      D.18753 = GetLastError ();
      D.18754 = (int) D.18753;
      *error = D.18754;
      D.18736 = 0;
      return D.18736;
      <D.18752>:
      D.18736 = (MonoBoolean) result;
      return D.18736;
    }
  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.18771;
  int D.18772;
  MonoBoolean D.18773;
  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.18758>; else goto <D.18759>;
  <D.18758>:
  creation_filetime = 0B;
  goto <D.18760>;
  <D.18759>:
  creation_filetime = &creation_time;
  <D.18760>:
  last_access_time.21 = last_access_time;
  if (last_access_time.21 < 0) goto <D.18762>; else goto <D.18763>;
  <D.18762>:
  last_access_filetime = 0B;
  goto <D.18764>;
  <D.18763>:
  last_access_filetime = &last_access_time;
  <D.18764>:
  last_write_time.22 = last_write_time;
  if (last_write_time.22 < 0) goto <D.18766>; else goto <D.18767>;
  <D.18766>:
  last_write_filetime = 0B;
  goto <D.18768>;
  <D.18767>:
  last_write_filetime = &last_write_time;
  <D.18768>:
  ret = SetFileTime (handle, creation_filetime, last_access_filetime, last_write_filetime);
  if (ret == 0) goto <D.18769>; else goto <D.18770>;
  <D.18769>:
  D.18771 = GetLastError ();
  D.18772 = (int) D.18771;
  *error = D.18772;
  <D.18770>:
  D.18773 = (MonoBoolean) ret;
  return D.18773;
}


ves_icall_System_IO_MonoIO_get_ConsoleOutput ()
{
  void * D.18775;

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


ves_icall_System_IO_MonoIO_get_ConsoleInput ()
{
  void * D.18777;

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


ves_icall_System_IO_MonoIO_get_ConsoleError ()
{
  void * D.18779;

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


ves_icall_System_IO_MonoIO_CreatePipe (void * * read_handle, void * * write_handle)
{
  MonoBoolean D.18783;
  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.18781>; else goto <D.18782>;
      <D.18781>:
      D.18783 = 0;
      return D.18783;
      <D.18782>:
      D.18783 = 1;
      return D.18783;
    }
  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 access.23;
  unsigned int options.24;
  MonoBoolean D.18790;
  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.18788>; else goto <D.18789>;
  <D.18788>:
  D.18790 = 0;
  return D.18790;
  <D.18789>:
  D.18790 = 1;
  return D.18790;
}


ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar ()
{
  gunichar2 D.18792;

  D.18792 = 47;
  return D.18792;
}


ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar ()
{
  gunichar2 D.18794;

  D.18794 = 47;
  return D.18794;
}


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

  __mono_io_portability_helpers.25 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.25 > 0) goto <D.18797>; else goto <D.18798>;
  <D.18797>:
  D.18799 = 92;
  return D.18799;
  <D.18798>:
  D.18799 = 47;
  return D.18799;
}


ves_icall_System_IO_MonoIO_get_PathSeparator ()
{
  gunichar2 D.18801;

  D.18801 = 58;
  return D.18801;
}


ves_icall_System_IO_MonoIO_get_InvalidPathChars ()
{
  struct MonoClass * D.18803;
  long unsigned int D.18804;
  long unsigned int D.18805;
  short unsigned int D.18806;
  struct MonoArray * D.18807;
  struct MonoArray * chars;
  struct MonoDomain * domain;
  int i;
  int n;

  domain = mono_domain_get ();
  n = 1;
  D.18803 = mono_defaults.char_class;
  D.18804 = (long unsigned int) n;
  chars = mono_array_new (domain, D.18803, D.18804);
  i = 0;
  goto <D.18269>;
  <D.18268>:
  {
    gunichar2 * __p;

    D.18805 = (long unsigned int) i;
    __p = mono_array_addr_with_size (chars, 2, D.18805);
    D.18806 = 0;
    *__p = D.18806;
  }
  i = i + 1;
  <D.18269>:
  if (i < n) goto <D.18268>; else goto <D.18270>;
  <D.18270>:
  D.18807 = chars;
  return D.18807;
}


ves_icall_System_IO_MonoIO_GetTempPath (struct MonoString * * mono_name)
{
  unsigned int D.18809;
  int D.18812;
  long unsigned int D.18813;
  long unsigned int D.18814;
  unsigned int ret.26;
  unsigned int D.18816;
  struct MonoDomain * D.18819;
  struct MonoString * D.18820;
  gint32 D.18821;
  gunichar2 * name;
  int ret;

  name = monoeg_malloc0 (512);
  D.18809 = GetTempPath (256, name);
  ret = (int) D.18809;
  if (ret > 255) goto <D.18810>; else goto <D.18811>;
  <D.18810>:
  monoeg_g_free (name);
  D.18812 = ret + 2;
  D.18813 = (long unsigned int) D.18812;
  D.18814 = D.18813 * 2;
  name = monoeg_malloc0 (D.18814);
  ret.26 = (unsigned int) ret;
  D.18816 = GetTempPath (ret.26, name);
  ret = (int) D.18816;
  <D.18811>:
  if (ret > 0) goto <D.18817>; else goto <D.18818>;
  <D.18817>:
  D.18819 = mono_domain_get ();
  D.18820 = mono_string_new_utf16 (D.18819, name, ret);
  mono_gc_wbarrier_generic_store (mono_name, D.18820);
  <D.18818>:
  monoeg_g_free (name);
  D.18821 = ret;
  return D.18821;
}


ves_icall_System_IO_MonoIO_Lock (void * handle, gint64 position, gint64 length, gint32 * error)
{
  unsigned int D.18823;
  long int D.18824;
  unsigned int D.18825;
  unsigned int D.18826;
  long int D.18827;
  unsigned int D.18828;
  unsigned int D.18831;
  int D.18832;
  gboolean ret;

  *error = 0;
  D.18823 = (unsigned int) position;
  D.18824 = position >> 32;
  D.18825 = (unsigned int) D.18824;
  D.18826 = (unsigned int) length;
  D.18827 = length >> 32;
  D.18828 = (unsigned int) D.18827;
  ret = LockFile (handle, D.18823, D.18825, D.18826, D.18828);
  if (ret == 0) goto <D.18829>; else goto <D.18830>;
  <D.18829>:
  D.18831 = GetLastError ();
  D.18832 = (int) D.18831;
  *error = D.18832;
  <D.18830>:
}


ves_icall_System_IO_MonoIO_Unlock (void * handle, gint64 position, gint64 length, gint32 * error)
{
  unsigned int D.18833;
  long int D.18834;
  unsigned int D.18835;
  unsigned int D.18836;
  long int D.18837;
  unsigned int D.18838;
  unsigned int D.18841;
  int D.18842;
  gboolean ret;

  *error = 0;
  D.18833 = (unsigned int) position;
  D.18834 = position >> 32;
  D.18835 = (unsigned int) D.18834;
  D.18836 = (unsigned int) length;
  D.18837 = length >> 32;
  D.18838 = (unsigned int) D.18837;
  ret = UnlockFile (handle, D.18833, D.18835, D.18836, D.18838);
  if (ret == 0) goto <D.18839>; else goto <D.18840>;
  <D.18839>:
  D.18841 = GetLastError ();
  D.18842 = (int) D.18841;
  *error = D.18842;
  <D.18840>:
}


