_wapi_open (const char * pathname, int flags, mode_t mode)
{
  int D.9187;
  int * D.9198;
  int D.9199;
  int __mono_io_portability_helpers.0;
  int D.9206;
  int fd;
  gchar * located_filename;

  D.9187 = flags & 64;
  if (D.9187 != 0) goto <D.9188>; else goto <D.9189>;
  <D.9188>:
  located_filename = mono_portability_find_file (pathname, 0);
  if (located_filename == 0B) goto <D.9190>; else goto <D.9191>;
  <D.9190>:
  fd = open (pathname, flags, mode);
  goto <D.9192>;
  <D.9191>:
  fd = open (located_filename, flags, mode);
  monoeg_g_free (located_filename);
  <D.9192>:
  goto <D.9193>;
  <D.9189>:
  fd = open (pathname, flags, mode);
  if (fd == -1) goto <D.9196>; else goto <D.9197>;
  <D.9196>:
  D.9198 = __errno_location ();
  D.9199 = *D.9198;
  if (D.9199 == 2) goto <D.9194>; else goto <D.9200>;
  <D.9200>:
  D.9198 = __errno_location ();
  D.9199 = *D.9198;
  if (D.9199 == 20) goto <D.9194>; else goto <D.9195>;
  <D.9194>:
  __mono_io_portability_helpers.0 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.0 > 0) goto <D.9202>; else goto <D.9203>;
  <D.9202>:
  {
    int saved_errno;

    D.9198 = __errno_location ();
    saved_errno = *D.9198;
    located_filename = mono_portability_find_file (pathname, 1);
    if (located_filename == 0B) goto <D.9204>; else goto <D.9205>;
    <D.9204>:
    D.9198 = __errno_location ();
    *D.9198 = saved_errno;
    D.9206 = -1;
    return D.9206;
    <D.9205>:
    fd = open (located_filename, flags, mode);
    monoeg_g_free (located_filename);
  }
  <D.9203>:
  <D.9195>:
  <D.9197>:
  <D.9193>:
  D.9206 = fd;
  return D.9206;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__))
open (const char * __path, int __oflag)
{
  int D.9208;
  int D.9211;
  int D.9216;
  int D.9218;
  int D.9219;
  int D.9222;
  int D.9223;

  D.9208 = __builtin_va_arg_pack_len ();
  if (D.9208 > 1) goto <D.9209>; else goto <D.9210>;
  <D.9209>:
  __open_too_many_args ();
  <D.9210>:
  D.9211 = __builtin_constant_p (__oflag);
  if (D.9211 != 0) goto <D.9212>; else goto <D.9213>;
  <D.9212>:
  D.9216 = __oflag & 64;
  if (D.9216 != 0) goto <D.9214>; else goto <D.9217>;
  <D.9217>:
  D.9218 = __oflag & 4259840;
  if (D.9218 == 4259840) goto <D.9214>; else goto <D.9215>;
  <D.9214>:
  D.9219 = __builtin_va_arg_pack_len ();
  if (D.9219 <= 0) goto <D.9220>; else goto <D.9221>;
  <D.9220>:
  __open_missing_mode ();
  D.9222 = __open_2 (__path, __oflag);
  return D.9222;
  <D.9221>:
  <D.9215>:
  D.9222 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.9222;
  <D.9213>:
  D.9223 = __builtin_va_arg_pack_len ();
  if (D.9223 <= 0) goto <D.9224>; else goto <D.9225>;
  <D.9224>:
  D.9222 = __open_2 (__path, __oflag);
  return D.9222;
  <D.9225>:
  D.9222 = __open_alias (__path, __oflag, __builtin_va_arg_pack ());
  return D.9222;
}


_wapi_access (const char * pathname, int mode)
{
  int * D.9231;
  int D.9232;
  int __mono_io_portability_helpers.1;
  int D.9239;
  int ret;

  ret = access (pathname, mode);
  if (ret == -1) goto <D.9229>; else goto <D.9230>;
  <D.9229>:
  D.9231 = __errno_location ();
  D.9232 = *D.9231;
  if (D.9232 == 2) goto <D.9227>; else goto <D.9233>;
  <D.9233>:
  D.9231 = __errno_location ();
  D.9232 = *D.9231;
  if (D.9232 == 20) goto <D.9227>; else goto <D.9228>;
  <D.9227>:
  __mono_io_portability_helpers.1 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.1 > 0) goto <D.9235>; else goto <D.9236>;
  <D.9235>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9231 = __errno_location ();
    saved_errno = *D.9231;
    located_filename = mono_portability_find_file (pathname, 1);
    if (located_filename == 0B) goto <D.9237>; else goto <D.9238>;
    <D.9237>:
    D.9231 = __errno_location ();
    *D.9231 = saved_errno;
    D.9239 = -1;
    return D.9239;
    <D.9238>:
    ret = access (located_filename, mode);
    monoeg_g_free (located_filename);
  }
  <D.9236>:
  <D.9228>:
  <D.9230>:
  D.9239 = ret;
  return D.9239;
}


_wapi_chmod (const char * pathname, mode_t mode)
{
  int * D.9245;
  int D.9246;
  int __mono_io_portability_helpers.2;
  int D.9253;
  int ret;

  ret = chmod (pathname, mode);
  if (ret == -1) goto <D.9243>; else goto <D.9244>;
  <D.9243>:
  D.9245 = __errno_location ();
  D.9246 = *D.9245;
  if (D.9246 == 2) goto <D.9241>; else goto <D.9247>;
  <D.9247>:
  D.9245 = __errno_location ();
  D.9246 = *D.9245;
  if (D.9246 == 20) goto <D.9241>; else goto <D.9242>;
  <D.9241>:
  __mono_io_portability_helpers.2 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.2 > 0) goto <D.9249>; else goto <D.9250>;
  <D.9249>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9245 = __errno_location ();
    saved_errno = *D.9245;
    located_filename = mono_portability_find_file (pathname, 1);
    if (located_filename == 0B) goto <D.9251>; else goto <D.9252>;
    <D.9251>:
    D.9245 = __errno_location ();
    *D.9245 = saved_errno;
    D.9253 = -1;
    return D.9253;
    <D.9252>:
    ret = chmod (located_filename, mode);
    monoeg_g_free (located_filename);
  }
  <D.9250>:
  <D.9242>:
  <D.9244>:
  D.9253 = ret;
  return D.9253;
}


_wapi_utime (const char * filename, const struct utimbuf * buf)
{
  int * D.9257;
  int D.9258;
  int __mono_io_portability_helpers.3;
  int D.9266;
  int ret;

  ret = utime (filename, buf);
  if (ret == -1) goto <D.9255>; else goto <D.9256>;
  <D.9255>:
  D.9257 = __errno_location ();
  D.9258 = *D.9257;
  if (D.9258 == 2) goto <D.9259>; else goto <D.9260>;
  <D.9259>:
  __mono_io_portability_helpers.3 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.3 > 0) goto <D.9262>; else goto <D.9263>;
  <D.9262>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9257 = __errno_location ();
    saved_errno = *D.9257;
    located_filename = mono_portability_find_file (filename, 1);
    if (located_filename == 0B) goto <D.9264>; else goto <D.9265>;
    <D.9264>:
    D.9257 = __errno_location ();
    *D.9257 = saved_errno;
    D.9266 = -1;
    return D.9266;
    <D.9265>:
    ret = utime (located_filename, buf);
    monoeg_g_free (located_filename);
  }
  <D.9263>:
  <D.9260>:
  <D.9256>:
  D.9266 = ret;
  return D.9266;
}


_wapi_unlink (const char * pathname)
{
  int * D.9272;
  int D.9273;
  int __mono_io_portability_helpers.4;
  int D.9281;
  int ret;

  ret = unlink (pathname);
  if (ret == -1) goto <D.9270>; else goto <D.9271>;
  <D.9270>:
  D.9272 = __errno_location ();
  D.9273 = *D.9272;
  if (D.9273 == 2) goto <D.9268>; else goto <D.9274>;
  <D.9274>:
  D.9272 = __errno_location ();
  D.9273 = *D.9272;
  if (D.9273 == 20) goto <D.9268>; else goto <D.9275>;
  <D.9275>:
  D.9272 = __errno_location ();
  D.9273 = *D.9272;
  if (D.9273 == 21) goto <D.9268>; else goto <D.9269>;
  <D.9268>:
  __mono_io_portability_helpers.4 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.4 > 0) goto <D.9277>; else goto <D.9278>;
  <D.9277>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9272 = __errno_location ();
    saved_errno = *D.9272;
    located_filename = mono_portability_find_file (pathname, 1);
    if (located_filename == 0B) goto <D.9279>; else goto <D.9280>;
    <D.9279>:
    D.9272 = __errno_location ();
    *D.9272 = saved_errno;
    D.9281 = -1;
    return D.9281;
    <D.9280>:
    ret = unlink (located_filename);
    monoeg_g_free (located_filename);
  }
  <D.9278>:
  <D.9269>:
  <D.9271>:
  D.9281 = ret;
  return D.9281;
}


_wapi_rename (const char * oldpath, const char * newpath)
{
  int * D.9290;
  int D.9291;
  int __mono_io_portability_helpers.5;
  int D.9301;
  int ret;
  gchar * located_newpath;

  located_newpath = mono_portability_find_file (newpath, 0);
  if (located_newpath == 0B) goto <D.9283>; else goto <D.9284>;
  <D.9283>:
  ret = rename (oldpath, newpath);
  goto <D.9285>;
  <D.9284>:
  ret = rename (oldpath, located_newpath);
  if (ret == -1) goto <D.9288>; else goto <D.9289>;
  <D.9288>:
  D.9290 = __errno_location ();
  D.9291 = *D.9290;
  if (D.9291 == 21) goto <D.9286>; else goto <D.9292>;
  <D.9292>:
  D.9290 = __errno_location ();
  D.9291 = *D.9290;
  if (D.9291 == 36) goto <D.9286>; else goto <D.9293>;
  <D.9293>:
  D.9290 = __errno_location ();
  D.9291 = *D.9290;
  if (D.9291 == 2) goto <D.9286>; else goto <D.9294>;
  <D.9294>:
  D.9290 = __errno_location ();
  D.9291 = *D.9290;
  if (D.9291 == 20) goto <D.9286>; else goto <D.9295>;
  <D.9295>:
  D.9290 = __errno_location ();
  D.9291 = *D.9290;
  if (D.9291 == 18) goto <D.9286>; else goto <D.9287>;
  <D.9286>:
  __mono_io_portability_helpers.5 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.5 > 0) goto <D.9297>; else goto <D.9298>;
  <D.9297>:
  {
    int saved_errno;
    gchar * located_oldpath;

    D.9290 = __errno_location ();
    saved_errno = *D.9290;
    located_oldpath = mono_portability_find_file (oldpath, 1);
    if (located_oldpath == 0B) goto <D.9299>; else goto <D.9300>;
    <D.9299>:
    monoeg_g_free (located_oldpath);
    monoeg_g_free (located_newpath);
    D.9290 = __errno_location ();
    *D.9290 = saved_errno;
    D.9301 = -1;
    return D.9301;
    <D.9300>:
    ret = rename (located_oldpath, located_newpath);
    monoeg_g_free (located_oldpath);
  }
  <D.9298>:
  <D.9287>:
  <D.9289>:
  monoeg_g_free (located_newpath);
  <D.9285>:
  D.9301 = ret;
  return D.9301;
}


_wapi_stat (const char * path, struct stat * buf)
{
  int * D.9307;
  int D.9308;
  int __mono_io_portability_helpers.6;
  int D.9315;
  int ret;

  ret = stat (path, buf);
  if (ret == -1) goto <D.9305>; else goto <D.9306>;
  <D.9305>:
  D.9307 = __errno_location ();
  D.9308 = *D.9307;
  if (D.9308 == 2) goto <D.9303>; else goto <D.9309>;
  <D.9309>:
  D.9307 = __errno_location ();
  D.9308 = *D.9307;
  if (D.9308 == 20) goto <D.9303>; else goto <D.9304>;
  <D.9303>:
  __mono_io_portability_helpers.6 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.6 > 0) goto <D.9311>; else goto <D.9312>;
  <D.9311>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9307 = __errno_location ();
    saved_errno = *D.9307;
    located_filename = mono_portability_find_file (path, 1);
    if (located_filename == 0B) goto <D.9313>; else goto <D.9314>;
    <D.9313>:
    D.9307 = __errno_location ();
    *D.9307 = saved_errno;
    D.9315 = -1;
    return D.9315;
    <D.9314>:
    ret = stat (located_filename, buf);
    monoeg_g_free (located_filename);
  }
  <D.9312>:
  <D.9304>:
  <D.9306>:
  D.9315 = ret;
  return D.9315;
}


__attribute__((__gnu_inline__, __leaf__, __nothrow__))
stat (const char * __path, struct stat * __statbuf)
{
  int D.9317;

  D.9317 = __xstat (1, __path, __statbuf);
  return D.9317;
}


_wapi_lstat (const char * path, struct stat * buf)
{
  int * D.9323;
  int D.9324;
  int __mono_io_portability_helpers.7;
  int D.9331;
  int ret;

  ret = lstat (path, buf);
  if (ret == -1) goto <D.9321>; else goto <D.9322>;
  <D.9321>:
  D.9323 = __errno_location ();
  D.9324 = *D.9323;
  if (D.9324 == 2) goto <D.9319>; else goto <D.9325>;
  <D.9325>:
  D.9323 = __errno_location ();
  D.9324 = *D.9323;
  if (D.9324 == 20) goto <D.9319>; else goto <D.9320>;
  <D.9319>:
  __mono_io_portability_helpers.7 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.7 > 0) goto <D.9327>; else goto <D.9328>;
  <D.9327>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9323 = __errno_location ();
    saved_errno = *D.9323;
    located_filename = mono_portability_find_file (path, 1);
    if (located_filename == 0B) goto <D.9329>; else goto <D.9330>;
    <D.9329>:
    D.9323 = __errno_location ();
    *D.9323 = saved_errno;
    D.9331 = -1;
    return D.9331;
    <D.9330>:
    ret = lstat (located_filename, buf);
    monoeg_g_free (located_filename);
  }
  <D.9328>:
  <D.9320>:
  <D.9322>:
  D.9331 = ret;
  return D.9331;
}


__attribute__((__gnu_inline__, __leaf__, __nothrow__))
lstat (const char * __path, struct stat * __statbuf)
{
  int D.9333;

  D.9333 = __lxstat (1, __path, __statbuf);
  return D.9333;
}


_wapi_mkdir (const char * pathname, mode_t mode)
{
  int D.9338;
  int ret;
  gchar * located_filename;

  located_filename = mono_portability_find_file (pathname, 0);
  if (located_filename == 0B) goto <D.9335>; else goto <D.9336>;
  <D.9335>:
  ret = mkdir (pathname, mode);
  goto <D.9337>;
  <D.9336>:
  ret = mkdir (located_filename, mode);
  monoeg_g_free (located_filename);
  <D.9337>:
  D.9338 = ret;
  return D.9338;
}


_wapi_rmdir (const char * pathname)
{
  int * D.9344;
  int D.9345;
  int __mono_io_portability_helpers.8;
  int D.9353;
  int ret;

  ret = rmdir (pathname);
  if (ret == -1) goto <D.9342>; else goto <D.9343>;
  <D.9342>:
  D.9344 = __errno_location ();
  D.9345 = *D.9344;
  if (D.9345 == 2) goto <D.9340>; else goto <D.9346>;
  <D.9346>:
  D.9344 = __errno_location ();
  D.9345 = *D.9344;
  if (D.9345 == 20) goto <D.9340>; else goto <D.9347>;
  <D.9347>:
  D.9344 = __errno_location ();
  D.9345 = *D.9344;
  if (D.9345 == 36) goto <D.9340>; else goto <D.9341>;
  <D.9340>:
  __mono_io_portability_helpers.8 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.8 > 0) goto <D.9349>; else goto <D.9350>;
  <D.9349>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9344 = __errno_location ();
    saved_errno = *D.9344;
    located_filename = mono_portability_find_file (pathname, 1);
    if (located_filename == 0B) goto <D.9351>; else goto <D.9352>;
    <D.9351>:
    D.9344 = __errno_location ();
    *D.9344 = saved_errno;
    D.9353 = -1;
    return D.9353;
    <D.9352>:
    ret = rmdir (located_filename);
    monoeg_g_free (located_filename);
  }
  <D.9350>:
  <D.9341>:
  <D.9343>:
  D.9353 = ret;
  return D.9353;
}


_wapi_chdir (const char * path)
{
  int * D.9359;
  int D.9360;
  int __mono_io_portability_helpers.9;
  int D.9368;
  int ret;

  ret = chdir (path);
  if (ret == -1) goto <D.9357>; else goto <D.9358>;
  <D.9357>:
  D.9359 = __errno_location ();
  D.9360 = *D.9359;
  if (D.9360 == 2) goto <D.9355>; else goto <D.9361>;
  <D.9361>:
  D.9359 = __errno_location ();
  D.9360 = *D.9359;
  if (D.9360 == 20) goto <D.9355>; else goto <D.9362>;
  <D.9362>:
  D.9359 = __errno_location ();
  D.9360 = *D.9359;
  if (D.9360 == 36) goto <D.9355>; else goto <D.9356>;
  <D.9355>:
  __mono_io_portability_helpers.9 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.9 > 0) goto <D.9364>; else goto <D.9365>;
  <D.9364>:
  {
    int saved_errno;
    gchar * located_filename;

    D.9359 = __errno_location ();
    saved_errno = *D.9359;
    located_filename = mono_portability_find_file (path, 1);
    if (located_filename == 0B) goto <D.9366>; else goto <D.9367>;
    <D.9366>:
    D.9359 = __errno_location ();
    *D.9359 = saved_errno;
    D.9368 = -1;
    return D.9368;
    <D.9367>:
    ret = chdir (located_filename);
    monoeg_g_free (located_filename);
  }
  <D.9365>:
  <D.9356>:
  <D.9358>:
  D.9368 = ret;
  return D.9368;
}


_wapi_basename (const gchar * filename)
{
  int __mono_io_portability_helpers.10;
  int D.9373;
  const short unsigned int * * D.9376;
  const short unsigned int * D.9377;
  char D.9378;
  long unsigned int D.9379;
  long unsigned int D.9380;
  const short unsigned int * D.9381;
  short unsigned int D.9382;
  int D.9383;
  int D.9384;
  gchar * D.9387;
  char D.9388;
  long unsigned int D.9391;
  gchar * D.9392;
  int D.9393;
  long unsigned int D.9394;
  sizetype D.9395;
  sizetype D.9396;
  gchar * D.9397;
  gchar * D.9398;
  gchar * new_filename;
  gchar * ret;

  new_filename = monoeg_strdup (filename);
  __mono_io_portability_helpers.10 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.10 > 0) goto <D.9371>; else goto <D.9372>;
  <D.9371>:
  monoeg_g_strdelimit (new_filename, "\\", 47);
  <D.9372>:
  __mono_io_portability_helpers.10 = __mono_io_portability_helpers;
  D.9373 = __mono_io_portability_helpers.10 & 2;
  if (D.9373 != 0) goto <D.9374>; else goto <D.9375>;
  <D.9374>:
  D.9376 = __ctype_b_loc ();
  D.9377 = *D.9376;
  D.9378 = *new_filename;
  D.9379 = (long unsigned int) D.9378;
  D.9380 = D.9379 * 2;
  D.9381 = D.9377 + D.9380;
  D.9382 = *D.9381;
  D.9383 = (int) D.9382;
  D.9384 = D.9383 & 4;
  if (D.9384 != 0) goto <D.9385>; else goto <D.9386>;
  <D.9385>:
  D.9387 = new_filename + 1;
  D.9388 = *D.9387;
  if (D.9388 == 58) goto <D.9389>; else goto <D.9390>;
  <D.9389>:
  {
    int len;

    D.9391 = __strlen_g (new_filename);
    len = (int) D.9391;
    D.9392 = new_filename + 2;
    D.9393 = len + -2;
    D.9394 = (long unsigned int) D.9393;
    memmove (new_filename, D.9392, D.9394);
    D.9395 = (sizetype) len;
    D.9396 = D.9395 + 18446744073709551614;
    D.9397 = new_filename + D.9396;
    *D.9397 = 0;
  }
  <D.9390>:
  <D.9386>:
  <D.9375>:
  ret = monoeg_g_path_get_basename (new_filename);
  monoeg_g_free (new_filename);
  D.9398 = ret;
  return D.9398;
}


monoeg_strdup (const gchar * str)
{
  gchar * D.9402;

  if (str != 0B) goto <D.9400>; else goto <D.9401>;
  <D.9400>:
  D.9402 = __strdup (str);
  return D.9402;
  <D.9401>:
  D.9402 = 0B;
  return D.9402;
}


__attribute__((__gnu_inline__))
__strlen_g (const char * __str)
{
  size_t D.9404;
  long int __ptr.11;
  long int __str.12;
  long int D.9407;
  char * __ptr;
  char * __tmp;

  __ptr = 0B;
  __tmp = __str;
  __asm__ __volatile__("   la    0,0
0: srst  %0,%1
   jo    0b
" : "=&a" __ptr, "=&a" __tmp : "0" __ptr, "1" __tmp : "0", "memory", "cc");
  __ptr.11 = (long int) __ptr;
  __str.12 = (long int) __str;
  D.9407 = __ptr.11 - __str.12;
  D.9404 = (size_t) D.9407;
  return D.9404;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memmove (void * __dest, const void * __src, size_t __len)
{
  void * D.9409;
  long unsigned int D.9410;

  D.9410 = __builtin_object_size (__dest, 0);
  D.9409 = __builtin___memmove_chk (__dest, __src, __len, D.9410);
  return D.9409;
}


_wapi_dirname (const gchar * filename)
{
  int __mono_io_portability_helpers.13;
  int D.9415;
  const short unsigned int * * D.9418;
  const short unsigned int * D.9419;
  char D.9420;
  long unsigned int D.9421;
  long unsigned int D.9422;
  const short unsigned int * D.9423;
  short unsigned int D.9424;
  int D.9425;
  int D.9426;
  gchar * D.9429;
  char D.9430;
  long unsigned int D.9433;
  gchar * D.9434;
  int D.9435;
  long unsigned int D.9436;
  sizetype D.9437;
  sizetype D.9438;
  gchar * D.9439;
  gchar * D.9440;
  gchar * new_filename;
  gchar * ret;

  new_filename = monoeg_strdup (filename);
  __mono_io_portability_helpers.13 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.13 > 0) goto <D.9413>; else goto <D.9414>;
  <D.9413>:
  monoeg_g_strdelimit (new_filename, "\\", 47);
  <D.9414>:
  __mono_io_portability_helpers.13 = __mono_io_portability_helpers;
  D.9415 = __mono_io_portability_helpers.13 & 2;
  if (D.9415 != 0) goto <D.9416>; else goto <D.9417>;
  <D.9416>:
  D.9418 = __ctype_b_loc ();
  D.9419 = *D.9418;
  D.9420 = *new_filename;
  D.9421 = (long unsigned int) D.9420;
  D.9422 = D.9421 * 2;
  D.9423 = D.9419 + D.9422;
  D.9424 = *D.9423;
  D.9425 = (int) D.9424;
  D.9426 = D.9425 & 4;
  if (D.9426 != 0) goto <D.9427>; else goto <D.9428>;
  <D.9427>:
  D.9429 = new_filename + 1;
  D.9430 = *D.9429;
  if (D.9430 == 58) goto <D.9431>; else goto <D.9432>;
  <D.9431>:
  {
    int len;

    D.9433 = __strlen_g (new_filename);
    len = (int) D.9433;
    D.9434 = new_filename + 2;
    D.9435 = len + -2;
    D.9436 = (long unsigned int) D.9435;
    memmove (new_filename, D.9434, D.9436);
    D.9437 = (sizetype) len;
    D.9438 = D.9437 + 18446744073709551614;
    D.9439 = new_filename + D.9438;
    *D.9439 = 0;
  }
  <D.9432>:
  <D.9428>:
  <D.9417>:
  ret = monoeg_g_path_get_dirname (new_filename);
  monoeg_g_free (new_filename);
  D.9440 = ret;
  return D.9440;
}


_wapi_g_dir_open (const gchar * path, guint flags, struct GError * * error)
{
  struct GError * D.9444;
  int D.9445;
  unsigned int D.9446;
  unsigned int D.9447;
  int __mono_io_portability_helpers.14;
  struct GDir * D.9455;
  struct GError * tmp_error.15;
  struct GDir * ret;

  ret = monoeg_g_dir_open (path, flags, error);
  if (ret == 0B) goto <D.9442>; else goto <D.9443>;
  <D.9442>:
  D.9444 = *error;
  D.9445 = D.9444->code;
  D.9446 = (unsigned int) D.9445;
  D.9447 = D.9446 + 4294967293;
  if (D.9447 <= 2) goto <D.9448>; else goto <D.9449>;
  <D.9448>:
  __mono_io_portability_helpers.14 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.14 > 0) goto <D.9451>; else goto <D.9452>;
  <D.9451>:
  {
    gchar * located_filename;
    struct GError * tmp_error;

    try
      {
        located_filename = mono_portability_find_file (path, 1);
        tmp_error = 0B;
        if (located_filename == 0B) goto <D.9453>; else goto <D.9454>;
        <D.9453>:
        D.9455 = 0B;
        return D.9455;
        <D.9454>:
        ret = monoeg_g_dir_open (located_filename, flags, &tmp_error);
        monoeg_g_free (located_filename);
        tmp_error.15 = tmp_error;
        if (tmp_error.15 == 0B) goto <D.9457>; else goto <D.9458>;
        <D.9457>:
        monoeg_g_clear_error (error);
        <D.9458>:
      }
    finally
      {
        tmp_error = {CLOBBER};
      }
  }
  <D.9452>:
  <D.9449>:
  <D.9443>:
  D.9455 = ret;
  return D.9455;
}


_wapi_io_scandir (const gchar * dirname, const gchar * pattern, gchar * * * namelist)
{
  struct GError * error.16;
  int D.9465;
  int D.9468;
  int D.9471;
  int * D.9474;
  gint D.9475;
  int __mono_io_portability_helpers.17;
  int D.9477;
  int D.9480;
  long unsigned int D.9483;
  long unsigned int D.9484;
  int D.9485;
  int D.9488;
  char * * D.9493;
  long unsigned int D.9494;
  long unsigned int D.9495;
  char * * D.9496;
  char * D.9497;
  gchar * D.9498;
  unsigned int D.9499;
  int D.9502;
  void * * D.9503;
  struct GError * error;
  struct GDir * dir;
  struct GPtrArray * names;
  gint result;
  struct wapi_glob_t glob_buf;
  int flags;
  int i;

  try
    {
      error = 0B;
      flags = 0;
      dir = _wapi_g_dir_open (dirname, 0, &error);
      if (dir == 0B) goto <D.9462>; else goto <D.9463>;
      <D.9462>:
      {
        gint errnum;

        error.16 = error;
        D.9465 = error.16->code;
        errnum = get_errno_from_g_file_error (D.9465);
        error.16 = error;
        monoeg_g_error_free (error.16);
        if (errnum == 2) goto <D.9466>; else goto <D.9467>;
        <D.9466>:
        D.9468 = _wapi_access (dirname, 0);
        if (D.9468 == 0) goto <D.9469>; else goto <D.9470>;
        <D.9469>:
        D.9471 = _wapi_access (dirname, 5);
        if (D.9471 != 0) goto <D.9472>; else goto <D.9473>;
        <D.9472>:
        errnum = 13;
        <D.9473>:
        <D.9470>:
        <D.9467>:
        D.9474 = __errno_location ();
        *D.9474 = errnum;
        D.9475 = -1;
        return D.9475;
      }
      <D.9463>:
      __mono_io_portability_helpers.17 = __mono_io_portability_helpers;
      D.9477 = __mono_io_portability_helpers.17 & 4;
      if (D.9477 != 0) goto <D.9478>; else goto <D.9479>;
      <D.9478>:
      flags = 16384;
      <D.9479>:
      result = _wapi_glob (dir, pattern, flags, &glob_buf);
      D.9480 = monoeg_g_str_has_suffix (pattern, ".*");
      if (D.9480 != 0) goto <D.9481>; else goto <D.9482>;
      <D.9481>:
      {
        gchar * pattern2;
        gint result2;

        D.9483 = __strlen_g (pattern);
        D.9484 = D.9483 + 18446744073709551614;
        pattern2 = monoeg_g_strndup (pattern, D.9484);
        monoeg_g_dir_rewind (dir);
        D.9485 = flags | 65;
        result2 = _wapi_glob (dir, pattern2, D.9485, &glob_buf);
        monoeg_g_free (pattern2);
        if (result != 0) goto <D.9486>; else goto <D.9487>;
        <D.9486>:
        result = result2;
        <D.9487>:
      }
      <D.9482>:
      monoeg_g_dir_close (dir);
      D.9488 = glob_buf.gl_pathc;
      if (D.9488 == 0) goto <D.9489>; else goto <D.9490>;
      <D.9489>:
      D.9475 = 0;
      return D.9475;
      <D.9490>:
      if (result != 0) goto <D.9491>; else goto <D.9492>;
      <D.9491>:
      D.9475 = -1;
      return D.9475;
      <D.9492>:
      names = monoeg_g_ptr_array_new ();
      i = 0;
      goto <D.9184>;
      <D.9183>:
      D.9493 = glob_buf.gl_pathv;
      D.9494 = (long unsigned int) i;
      D.9495 = D.9494 * 8;
      D.9496 = D.9493 + D.9495;
      D.9497 = *D.9496;
      D.9498 = monoeg_strdup (D.9497);
      monoeg_g_ptr_array_add (names, D.9498);
      i = i + 1;
      <D.9184>:
      D.9488 = glob_buf.gl_pathc;
      if (D.9488 > i) goto <D.9183>; else goto <D.9185>;
      <D.9185>:
      _wapi_globfree (&glob_buf);
      D.9499 = names->len;
      result = (gint) D.9499;
      if (result > 0) goto <D.9500>; else goto <D.9501>;
      <D.9500>:
      monoeg_g_ptr_array_sort (names, file_compare);
      D.9502 = result + 1;
      monoeg_g_ptr_array_set_size (names, D.9502);
      D.9503 = monoeg_g_ptr_array_free (names, 0);
      *namelist = D.9503;
      goto <D.9504>;
      <D.9501>:
      monoeg_g_ptr_array_free (names, 1);
      <D.9504>:
      D.9475 = result;
      return D.9475;
    }
  finally
    {
      error = {CLOBBER};
      glob_buf = {CLOBBER};
    }
}


file_compare (const void * a, const void * b)
{
  gint D.9507;
  gchar * astr;
  gchar * bstr;

  astr = MEM[(gchar * *)a];
  bstr = MEM[(gchar * *)b];
  D.9507 = strcmp (astr, bstr);
  return D.9507;
}


__attribute__((__gnu_inline__, nothrow, leaf, pure))
strcmp (const char * __s1, const char * __s2)
{
  int iftmp.18;
  int iftmp.19;
  int D.9517;
  char * __p1;
  char * __p2;
  int __ret;

  __p1 = __s1;
  __p2 = __s2;
  __asm__ __volatile__("   slr   0,0
0: clst  %1,%2
   jo    0b
   ipm   %0
   srl   %0,28" : "=d" __ret, "=&a" __p1, "=&a" __p2 : "1" __p1, "2" __p2 : "0", "memory", "cc");
  if (__ret != 0) goto <D.9510>; else goto <D.9511>;
  <D.9510>:
  if (__ret == 1) goto <D.9513>; else goto <D.9514>;
  <D.9513>:
  iftmp.19 = -1;
  goto <D.9515>;
  <D.9514>:
  iftmp.19 = 1;
  <D.9515>:
  iftmp.18 = iftmp.19;
  goto <D.9516>;
  <D.9511>:
  iftmp.18 = 0;
  <D.9516>:
  __ret = iftmp.18;
  D.9517 = __ret;
  return D.9517;
}


get_errno_from_g_file_error (gint error)
{
  gint D.9520;

  switch (error) <default: <D.9519>, case 3: <D.9147>, case 4: <D.9149>, case 5: <D.9150>, case 6: <D.9151>, case 7: <D.9152>, case 8: <D.9153>, case 9: <D.9154>, case 10: <D.9155>, case 11: <D.9156>, case 12: <D.9157>, case 13: <D.9158>, case 14: <D.9159>, case 15: <D.9160>, case 16: <D.9161>, case 17: <D.9162>, case 18: <D.9163>, case 19: <D.9164>, case 20: <D.9165>, case 22: <D.9166>, case 24: <D.9167>>
  <D.9147>:
  error = 36;
  goto <D.9148>;
  <D.9149>:
  error = 2;
  goto <D.9148>;
  <D.9150>:
  error = 20;
  goto <D.9148>;
  <D.9151>:
  error = 6;
  goto <D.9148>;
  <D.9152>:
  error = 19;
  goto <D.9148>;
  <D.9153>:
  error = 30;
  goto <D.9148>;
  <D.9154>:
  error = 26;
  goto <D.9148>;
  <D.9155>:
  error = 14;
  goto <D.9148>;
  <D.9156>:
  error = 40;
  goto <D.9148>;
  <D.9157>:
  error = 28;
  goto <D.9148>;
  <D.9158>:
  error = 12;
  goto <D.9148>;
  <D.9159>:
  error = 24;
  goto <D.9148>;
  <D.9160>:
  error = 23;
  goto <D.9148>;
  <D.9161>:
  error = 9;
  goto <D.9148>;
  <D.9162>:
  error = 22;
  goto <D.9148>;
  <D.9163>:
  error = 32;
  goto <D.9148>;
  <D.9164>:
  error = 11;
  goto <D.9148>;
  <D.9165>:
  error = 4;
  goto <D.9148>;
  <D.9166>:
  error = 1;
  goto <D.9148>;
  <D.9167>:
  error = 87;
  goto <D.9148>;
  <D.9519>:
  <D.9148>:
  D.9520 = error;
  return D.9520;
}


