__attribute__((visibility ("hidden")))
mono_portability_helpers_init ()
{
  int __mono_io_portability_helpers.0;
  long unsigned int D.16966;
  long unsigned int D.16967;
  gchar * * D.16968;
  gchar * D.16969;
  int D.16970;
  int D.16973;
  int D.16975;
  int D.16978;
  int D.16980;
  int D.16983;
  const gchar * env;

  __mono_io_portability_helpers.0 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.0 != 1) goto <D.16960>; else goto <D.16961>;
  <D.16960>:
  return;
  <D.16961>:
  __mono_io_portability_helpers = 0;
  env = monoeg_g_getenv ("MONO_IOMAP");
  if (env != 0B) goto <D.16962>; else goto <D.16963>;
  <D.16962>:
  {
    gchar * * options;
    int i;

    options = monoeg_g_strsplit (env, ":", 0);
    if (options == 0B) goto <D.16964>; else goto <D.16965>;
    <D.16964>:
    return;
    <D.16965>:
    i = 0;
    goto <D.16902>;
    <D.16901>:
    D.16966 = (long unsigned int) i;
    D.16967 = D.16966 * 8;
    D.16968 = options + D.16967;
    D.16969 = *D.16968;
    D.16970 = strncasecmp (D.16969, "drive", 5);
    if (D.16970 == 0) goto <D.16971>; else goto <D.16972>;
    <D.16971>:
    __mono_io_portability_helpers.0 = __mono_io_portability_helpers;
    D.16973 = __mono_io_portability_helpers.0 | 2;
    __mono_io_portability_helpers = D.16973;
    goto <D.16974>;
    <D.16972>:
    D.16966 = (long unsigned int) i;
    D.16967 = D.16966 * 8;
    D.16968 = options + D.16967;
    D.16969 = *D.16968;
    D.16975 = strncasecmp (D.16969, "case", 4);
    if (D.16975 == 0) goto <D.16976>; else goto <D.16977>;
    <D.16976>:
    __mono_io_portability_helpers.0 = __mono_io_portability_helpers;
    D.16978 = __mono_io_portability_helpers.0 | 4;
    __mono_io_portability_helpers = D.16978;
    goto <D.16979>;
    <D.16977>:
    D.16966 = (long unsigned int) i;
    D.16967 = D.16966 * 8;
    D.16968 = options + D.16967;
    D.16969 = *D.16968;
    D.16980 = strncasecmp (D.16969, "all", 3);
    if (D.16980 == 0) goto <D.16981>; else goto <D.16982>;
    <D.16981>:
    __mono_io_portability_helpers.0 = __mono_io_portability_helpers;
    D.16983 = __mono_io_portability_helpers.0 | 6;
    __mono_io_portability_helpers = D.16983;
    <D.16982>:
    <D.16979>:
    <D.16974>:
    i = i + 1;
    <D.16902>:
    D.16966 = (long unsigned int) i;
    D.16967 = D.16966 * 8;
    D.16968 = options + D.16967;
    D.16969 = *D.16968;
    if (D.16969 != 0B) goto <D.16901>; else goto <D.16903>;
    <D.16903>:
  }
  <D.16963>:
}


__attribute__((visibility ("hidden")))
mono_portability_find_file (const gchar * pathname, gboolean last_exists)
{
  char D.16988;
  gchar * D.16989;
  struct GString * report.1;
  struct GString * report;
  gchar * ret;

  try
    {
      report = 0B;
      if (pathname == 0B) goto <D.16985>; else goto <D.16987>;
      <D.16987>:
      D.16988 = *pathname;
      if (D.16988 == 0) goto <D.16985>; else goto <D.16986>;
      <D.16985>:
      D.16989 = 0B;
      return D.16989;
      <D.16986>:
      ret = mono_portability_find_file_internal (&report, pathname, last_exists);
      report.1 = report;
      if (report.1 != 0B) goto <D.16991>; else goto <D.16992>;
      <D.16991>:
      report.1 = report;
      monoeg_g_string_free (report.1, 1);
      <D.16992>:
      D.16989 = ret;
      return D.16989;
    }
  finally
    {
      report = {CLOBBER};
    }
}


mono_portability_find_file_internal (struct GString * * report, const gchar * pathname, gboolean last_exists)
{
  <unnamed type> D.16995;
  unsigned int D.16996;
  _Bool D.16997;
  gchar * D.17000;
  int D.17005;
  int __mono_io_portability_helpers.2;
  int D.17009;
  const short unsigned int * * D.17012;
  const short unsigned int * D.17013;
  char D.17014;
  long unsigned int D.17015;
  long unsigned int D.17016;
  const short unsigned int * D.17017;
  short unsigned int D.17018;
  int D.17019;
  int D.17020;
  gchar * D.17023;
  char D.17024;
  long unsigned int D.17027;
  gchar * D.17028;
  int D.17029;
  long unsigned int D.17030;
  sizetype D.17031;
  sizetype D.17032;
  gchar * D.17033;
  sizetype D.17038;
  gchar * D.17039;
  char D.17040;
  int D.17045;
  int D.17052;
  long unsigned int D.17057;
  long unsigned int D.17058;
  gchar * * D.17059;
  gchar * D.17060;
  int D.17063;
  long unsigned int D.17064;
  long unsigned int D.17065;
  gchar * D.17068;
  unsigned char D.17069;
  int component.3;
  long unsigned int D.17075;
  long unsigned int D.17076;
  gchar * * D.17077;
  gchar * D.17078;
  int component.4;
  long unsigned int D.17087;
  long unsigned int D.17088;
  gchar * * D.17089;
  int component.5;
  long unsigned int D.17096;
  long unsigned int D.17097;
  gchar * * D.17098;
  gchar * D.17099;
  int component.6;
  long unsigned int D.17106;
  long unsigned int D.17107;
  gchar * * D.17108;
  int component.7;
  long unsigned int D.17111;
  long unsigned int D.17112;
  gchar * * D.17113;
  gchar * D.17114;
  _Bool D.17115;
  long int D.17116;
  long int D.17117;
  int D.17123;
  long unsigned int D.17125;
  long unsigned int D.17126;
  gchar * * D.17127;
  gchar * D.17128;
  gchar * * D.17131;
  int D.17140;
  int D.17143;
  gchar * new_pathname;
  gchar * * components;
  gchar * * new_components;
  int num_components;
  int component;
  struct DIR * scanning;
  size_t len;
  gboolean drive_stripped;
  gboolean do_report;

  num_components = 0;
  component = 0;
  scanning = 0B;
  drive_stripped = 0;
  D.16995 = mono_profiler_get_events ();
  D.16996 = D.16995 & 262144;
  D.16997 = D.16996 != 0;
  do_report = (gboolean) D.16997;
  if (0 != 0) goto <D.16998>; else goto <D.16999>;
  <D.16998>:
  D.17000 = 0B;
  return D.17000;
  <D.16999>:
  if (do_report != 0) goto <D.17001>; else goto <D.17002>;
  <D.17001>:
  append_report (report, " - Requested file path: \'%s\'\n", pathname);
  <D.17002>:
  new_pathname = monoeg_strdup (pathname);
  if (last_exists != 0) goto <D.17003>; else goto <D.17004>;
  <D.17003>:
  D.17005 = access (new_pathname, 0);
  if (D.17005 == 0) goto <D.17006>; else goto <D.17007>;
  <D.17006>:
  D.17000 = new_pathname;
  return D.17000;
  <D.17007>:
  <D.17004>:
  monoeg_g_strdelimit (new_pathname, "\\", 47);
  __mono_io_portability_helpers.2 = __mono_io_portability_helpers;
  D.17009 = __mono_io_portability_helpers.2 & 2;
  if (D.17009 != 0) goto <D.17010>; else goto <D.17011>;
  <D.17010>:
  D.17012 = __ctype_b_loc ();
  D.17013 = *D.17012;
  D.17014 = *new_pathname;
  D.17015 = (long unsigned int) D.17014;
  D.17016 = D.17015 * 2;
  D.17017 = D.17013 + D.17016;
  D.17018 = *D.17017;
  D.17019 = (int) D.17018;
  D.17020 = D.17019 & 4;
  if (D.17020 != 0) goto <D.17021>; else goto <D.17022>;
  <D.17021>:
  D.17023 = new_pathname + 1;
  D.17024 = *D.17023;
  if (D.17024 == 58) goto <D.17025>; else goto <D.17026>;
  <D.17025>:
  {
    int len;

    D.17027 = __strlen_g (new_pathname);
    len = (int) D.17027;
    D.17028 = new_pathname + 2;
    D.17029 = len + -2;
    D.17030 = (long unsigned int) D.17029;
    memmove (new_pathname, D.17028, D.17030);
    D.17031 = (sizetype) len;
    D.17032 = D.17031 + 18446744073709551614;
    D.17033 = new_pathname + D.17032;
    *D.17033 = 0;
    if (do_report != 0) goto <D.17034>; else goto <D.17035>;
    <D.17034>:
    append_report (report, " - Stripped drive letter.\n");
    drive_stripped = 1;
    <D.17035>:
  }
  <D.17026>:
  <D.17022>:
  <D.17011>:
  len = __strlen_g (new_pathname);
  if (len > 1) goto <D.17036>; else goto <D.17037>;
  <D.17036>:
  D.17038 = len + 18446744073709551615;
  D.17039 = new_pathname + D.17038;
  D.17040 = *D.17039;
  if (D.17040 == 47) goto <D.17041>; else goto <D.17042>;
  <D.17041>:
  D.17038 = len + 18446744073709551615;
  D.17039 = new_pathname + D.17038;
  *D.17039 = 0;
  <D.17042>:
  <D.17037>:
  if (last_exists != 0) goto <D.17043>; else goto <D.17044>;
  <D.17043>:
  D.17045 = access (new_pathname, 0);
  if (D.17045 == 0) goto <D.17046>; else goto <D.17047>;
  <D.17046>:
  if (do_report != 0) goto <D.17048>; else goto <D.17049>;
  <D.17048>:
  if (drive_stripped != 0) goto <D.17050>; else goto <D.17051>;
  <D.17050>:
  do_mono_profiler_iomap (report, pathname, new_pathname);
  <D.17051>:
  <D.17049>:
  D.17000 = new_pathname;
  return D.17000;
  <D.17047>:
  <D.17044>:
  __mono_io_portability_helpers.2 = __mono_io_portability_helpers;
  D.17052 = __mono_io_portability_helpers.2 & 4;
  if (D.17052 == 0) goto <D.17053>; else goto <D.17054>;
  <D.17053>:
  monoeg_g_free (new_pathname);
  D.17000 = 0B;
  return D.17000;
  <D.17054>:
  components = monoeg_g_strsplit (new_pathname, "/", 0);
  if (components == 0B) goto <D.17055>; else goto <D.17056>;
  <D.17055>:
  monoeg_g_free (new_pathname);
  D.17000 = 0B;
  return D.17000;
  <D.17056>:
  goto <D.16947>;
  <D.16946>:
  num_components = num_components + 1;
  <D.16947>:
  D.17057 = (long unsigned int) num_components;
  D.17058 = D.17057 * 8;
  D.17059 = components + D.17058;
  D.17060 = *D.17059;
  if (D.17060 != 0B) goto <D.16946>; else goto <D.16948>;
  <D.16948>:
  monoeg_g_free (new_pathname);
  if (num_components == 0) goto <D.17061>; else goto <D.17062>;
  <D.17061>:
  D.17000 = 0B;
  return D.17000;
  <D.17062>:
  D.17063 = num_components + 1;
  D.17064 = (long unsigned int) D.17063;
  D.17065 = D.17064 * 8;
  new_components = monoeg_malloc0 (D.17065);
  if (num_components > 1) goto <D.17066>; else goto <D.17067>;
  <D.17066>:
  D.17068 = *components;
  D.17069 = MEM[(const unsigned char * {ref-all})D.17068];
  if (D.17069 == 0) goto <D.17070>; else goto <D.17071>;
  <D.17070>:
  scanning = opendir ("/");
  if (scanning == 0B) goto <D.17072>; else goto <D.17073>;
  <D.17072>:
  monoeg_g_strfreev (new_components);
  monoeg_g_strfreev (components);
  D.17000 = 0B;
  return D.17000;
  <D.17073>:
  component.3 = component;
  component = component.3 + 1;
  D.17075 = (long unsigned int) component.3;
  D.17076 = D.17075 * 8;
  D.17077 = new_components + D.17076;
  D.17078 = monoeg_strdup ("");
  *D.17077 = D.17078;
  goto <D.17079>;
  <D.17071>:
  {
    struct DIR * current;
    gchar * entry;

    current = opendir (".");
    if (current == 0B) goto <D.17080>; else goto <D.17081>;
    <D.17080>:
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17081>:
    D.17068 = *components;
    entry = find_in_dir (current, D.17068);
    if (entry == 0B) goto <D.17082>; else goto <D.17083>;
    <D.17082>:
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17083>:
    scanning = opendir (entry);
    if (scanning == 0B) goto <D.17084>; else goto <D.17085>;
    <D.17084>:
    monoeg_g_free (entry);
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17085>:
    component.4 = component;
    component = component.4 + 1;
    D.17087 = (long unsigned int) component.4;
    D.17088 = D.17087 * 8;
    D.17089 = new_components + D.17088;
    *D.17089 = entry;
  }
  <D.17079>:
  goto <D.17090>;
  <D.17067>:
  if (last_exists != 0) goto <D.17091>; else goto <D.17092>;
  <D.17091>:
  D.17068 = *components;
  D.17069 = MEM[(const unsigned char * {ref-all})D.17068];
  if (D.17069 == 0) goto <D.17093>; else goto <D.17094>;
  <D.17093>:
  component.5 = component;
  component = component.5 + 1;
  D.17096 = (long unsigned int) component.5;
  D.17097 = D.17096 * 8;
  D.17098 = new_components + D.17097;
  D.17099 = monoeg_strdup ("");
  *D.17098 = D.17099;
  goto <D.17100>;
  <D.17094>:
  {
    struct DIR * current;
    gchar * entry;

    current = opendir (".");
    if (current == 0B) goto <D.17101>; else goto <D.17102>;
    <D.17101>:
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17102>:
    D.17068 = *components;
    entry = find_in_dir (current, D.17068);
    if (entry == 0B) goto <D.17103>; else goto <D.17104>;
    <D.17103>:
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17104>:
    component.6 = component;
    component = component.6 + 1;
    D.17106 = (long unsigned int) component.6;
    D.17107 = D.17106 * 8;
    D.17108 = new_components + D.17107;
    *D.17108 = entry;
  }
  <D.17100>:
  goto <D.17109>;
  <D.17092>:
  component.7 = component;
  component = component.7 + 1;
  D.17111 = (long unsigned int) component.7;
  D.17112 = D.17111 * 8;
  D.17113 = new_components + D.17112;
  D.17068 = *components;
  D.17114 = monoeg_strdup (D.17068);
  *D.17113 = D.17114;
  <D.17109>:
  <D.17090>:
  D.17115 = component != 1;
  D.17116 = (long int) D.17115;
  D.17117 = __builtin_expect (D.17116, 0);
  if (D.17117 != 0) goto <D.17118>; else goto <D.17119>;
  <D.17118>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-io-portability.c", 343, "component == 1");
  <D.17119>:
  goto <D.16956>;
  <D.16955>:
  {
    gchar * entry;
    gchar * path_so_far;

    if (last_exists == 0) goto <D.17122>; else goto <D.17120>;
    <D.17122>:
    D.17123 = num_components + -1;
    if (D.17123 == component) goto <D.17124>; else goto <D.17120>;
    <D.17124>:
    D.17125 = (long unsigned int) component;
    D.17126 = D.17125 * 8;
    D.17127 = components + D.17126;
    D.17128 = *D.17127;
    entry = monoeg_strdup (D.17128);
    closedir (scanning);
    goto <D.17121>;
    <D.17120>:
    D.17125 = (long unsigned int) component;
    D.17126 = D.17125 * 8;
    D.17127 = components + D.17126;
    D.17128 = *D.17127;
    entry = find_in_dir (scanning, D.17128);
    if (entry == 0B) goto <D.17129>; else goto <D.17130>;
    <D.17129>:
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17130>:
    <D.17121>:
    D.17125 = (long unsigned int) component;
    D.17126 = D.17125 * 8;
    D.17131 = new_components + D.17126;
    *D.17131 = entry;
    D.17123 = num_components + -1;
    if (D.17123 > component) goto <D.17132>; else goto <D.17133>;
    <D.17132>:
    path_so_far = monoeg_g_strjoinv ("/", new_components);
    scanning = opendir (path_so_far);
    monoeg_g_free (path_so_far);
    if (scanning == 0B) goto <D.17134>; else goto <D.17135>;
    <D.17134>:
    monoeg_g_strfreev (new_components);
    monoeg_g_strfreev (components);
    D.17000 = 0B;
    return D.17000;
    <D.17135>:
    <D.17133>:
  }
  component = component + 1;
  <D.16956>:
  if (component < num_components) goto <D.16955>; else goto <D.16957>;
  <D.16957>:
  monoeg_g_strfreev (components);
  new_pathname = monoeg_g_strjoinv ("/", new_components);
  monoeg_g_strfreev (new_components);
  if (last_exists != 0) goto <D.17139>; else goto <D.17136>;
  <D.17139>:
  D.17140 = access (new_pathname, 0);
  if (D.17140 == 0) goto <D.17137>; else goto <D.17136>;
  <D.17136>:
  if (last_exists == 0) goto <D.17137>; else goto <D.17138>;
  <D.17137>:
  if (do_report != 0) goto <D.17141>; else goto <D.17142>;
  <D.17141>:
  D.17143 = strcmp (pathname, new_pathname);
  if (D.17143 != 0) goto <D.17144>; else goto <D.17145>;
  <D.17144>:
  do_mono_profiler_iomap (report, pathname, new_pathname);
  <D.17145>:
  <D.17142>:
  D.17000 = new_pathname;
  return D.17000;
  <D.17138>:
  monoeg_g_free (new_pathname);
  D.17000 = 0B;
  return D.17000;
}


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

  D.17148 = __builtin_object_size (__dest, 0);
  D.17147 = __builtin___memmove_chk (__dest, __src, __len, D.17148);
  return D.17147;
}


append_report (struct GString * * report, const gchar * format)
{
  struct GString * D.17150;
  struct GString * D.17153;
  struct  ap[1];

  try
    {
      D.17150 = *report;
      if (D.17150 == 0B) goto <D.17151>; else goto <D.17152>;
      <D.17151>:
      D.17153 = monoeg_g_string_new ("");
      *report = D.17153;
      <D.17152>:
      __builtin_va_start (&ap, 0);
      D.17150 = *report;
      monoeg_g_string_append_vprintf (D.17150, format, &ap);
      __builtin_va_end (&ap);
    }
  finally
    {
      ap = {CLOBBER};
    }
}


__attribute__((__gnu_inline__))
__strlen_g (const char * __str)
{
  size_t D.17154;
  long int __ptr.8;
  long int __str.9;
  long int D.17157;
  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.8 = (long int) __ptr;
  __str.9 = (long int) __str;
  D.17157 = __ptr.8 - __str.9;
  D.17154 = (size_t) D.17157;
  return D.17154;
}


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

  if (str != 0B) goto <D.17159>; else goto <D.17160>;
  <D.17159>:
  D.17161 = __strdup (str);
  return D.17161;
  <D.17160>:
  D.17161 = 0B;
  return D.17161;
}


find_in_dir (struct DIR * current, const gchar * name)
{
  char[256] * D.17163;
  int D.17164;
  gchar * D.17167;
  struct dirent * entry;

  goto <D.16911>;
  <D.16910>:
  D.17163 = &entry->d_name;
  D.17164 = monoeg_ascii_strcasecmp (name, D.17163);
  if (D.17164 == 0) goto <D.17165>; else goto <D.17166>;
  <D.17165>:
  {
    char * ret;

    D.17163 = &entry->d_name;
    ret = monoeg_strdup (D.17163);
    closedir (current);
    D.17167 = ret;
    return D.17167;
  }
  <D.17166>:
  <D.16911>:
  entry = readdir (current);
  if (entry != 0B) goto <D.16910>; else goto <D.16912>;
  <D.16912>:
  closedir (current);
  D.17167 = 0B;
  return D.17167;
}


__attribute__((__gnu_inline__, nothrow, leaf, pure))
strcmp (const char * __s1, const char * __s2)
{
  int iftmp.10;
  int iftmp.11;
  int D.17177;
  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.17170>; else goto <D.17171>;
  <D.17170>:
  if (__ret == 1) goto <D.17173>; else goto <D.17174>;
  <D.17173>:
  iftmp.11 = -1;
  goto <D.17175>;
  <D.17174>:
  iftmp.11 = 1;
  <D.17175>:
  iftmp.10 = iftmp.11;
  goto <D.17176>;
  <D.17171>:
  iftmp.10 = 0;
  <D.17176>:
  __ret = iftmp.10;
  D.17177 = __ret;
  return D.17177;
}


do_mono_profiler_iomap (struct GString * * report, const char * pathname, const char * new_pathname)
{
  struct GString * iftmp.12;
  long unsigned int D.17185;
  char * rep;
  struct GString * tmp;

  rep = 0B;
  if (report != 0B) goto <D.17180>; else goto <D.17181>;
  <D.17180>:
  iftmp.12 = *report;
  goto <D.17182>;
  <D.17181>:
  iftmp.12 = 0B;
  <D.17182>:
  tmp = iftmp.12;
  if (tmp != 0B) goto <D.17183>; else goto <D.17184>;
  <D.17183>:
  D.17185 = tmp->len;
  if (D.17185 != 0) goto <D.17186>; else goto <D.17187>;
  <D.17186>:
  rep = monoeg_g_string_free (tmp, 0);
  goto <D.17188>;
  <D.17187>:
  monoeg_g_string_free (tmp, 1);
  <D.17188>:
  *report = 0B;
  <D.17184>:
  mono_profiler_iomap (rep, pathname, new_pathname);
  monoeg_g_free (rep);
}


