mono_install_image_unload_hook (void (*MonoImageUnloadFunc) (struct MonoImage *, void *) func, void * user_data)
{
  struct GSList * image_unload_hooks.0;
  struct GSList * image_unload_hooks.1;
  struct ImageUnloadHook * hook;

  if (func == 0B) goto <D.18961>; else goto <D.18962>;
  <D.18961>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 75, "func != NULL");
  return;
  <D.18962>:
  hook = monoeg_malloc0 (16);
  hook->func = func;
  hook->user_data = user_data;
  image_unload_hooks.0 = image_unload_hooks;
  image_unload_hooks.1 = monoeg_g_slist_prepend (image_unload_hooks.0, hook);
  image_unload_hooks = image_unload_hooks.1;
}


mono_remove_image_unload_hook (void (*MonoImageUnloadFunc) (struct MonoImage *, void *) func, void * user_data)
{
  void (*<T1b5f>) (struct MonoImage *, void *) D.18966;
  void * D.18969;
  struct GSList * image_unload_hooks.2;
  struct GSList * image_unload_hooks.3;
  struct GSList * l;
  struct ImageUnloadHook * hook;

  l = image_unload_hooks;
  goto <D.18323>;
  <D.18322>:
  hook = l->data;
  D.18966 = hook->func;
  if (D.18966 == func) goto <D.18967>; else goto <D.18968>;
  <D.18967>:
  D.18969 = hook->user_data;
  if (D.18969 == user_data) goto <D.18970>; else goto <D.18971>;
  <D.18970>:
  monoeg_g_free (hook);
  image_unload_hooks.2 = image_unload_hooks;
  image_unload_hooks.3 = monoeg_g_slist_delete_link (image_unload_hooks.2, l);
  image_unload_hooks = image_unload_hooks.3;
  goto <D.18321>;
  <D.18971>:
  <D.18968>:
  l = l->next;
  <D.18323>:
  if (l != 0B) goto <D.18322>; else goto <D.18321>;
  <D.18321>:
}


mono_cli_rva_image_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.18974;
  unsigned int D.18977;
  unsigned int D.18978;
  guint32 D.18981;
  unsigned int D.18982;
  unsigned int D.18983;
  struct MonoCLIImageInfo * iinfo;
  const int top;
  struct MonoSectionTable * tables;
  int i;

  iinfo = image->image_info;
  top = iinfo->cli_section_count;
  tables = iinfo->cli_section_tables;
  i = 0;
  goto <D.18341>;
  <D.18340>:
  D.18974 = tables->st_virtual_address;
  if (D.18974 <= addr) goto <D.18975>; else goto <D.18976>;
  <D.18975>:
  D.18974 = tables->st_virtual_address;
  D.18977 = tables->st_raw_data_size;
  D.18978 = D.18974 + D.18977;
  if (D.18978 > addr) goto <D.18979>; else goto <D.18980>;
  <D.18979>:
  D.18974 = tables->st_virtual_address;
  D.18982 = addr - D.18974;
  D.18983 = tables->st_raw_data_ptr;
  D.18981 = D.18982 + D.18983;
  return D.18981;
  <D.18980>:
  <D.18976>:
  tables = tables + 40;
  i = i + 1;
  <D.18341>:
  if (i < top) goto <D.18340>; else goto <D.18342>;
  <D.18342>:
  D.18981 = 4294967295;
  return D.18981;
}


mono_image_rva_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.18985;
  unsigned int D.18988;
  unsigned int D.18989;
  void * * D.18992;
  long unsigned int D.18993;
  long unsigned int D.18994;
  void * * D.18995;
  void * D.18996;
  int D.18999;
  char * D.19002;
  unsigned int D.19003;
  sizetype D.19004;
  struct MonoCLIImageInfo * iinfo;
  const int top;
  struct MonoSectionTable * tables;
  int i;

  iinfo = image->image_info;
  top = iinfo->cli_section_count;
  tables = iinfo->cli_section_tables;
  i = 0;
  goto <D.18352>;
  <D.18351>:
  D.18985 = tables->st_virtual_address;
  if (D.18985 <= addr) goto <D.18986>; else goto <D.18987>;
  <D.18986>:
  D.18985 = tables->st_virtual_address;
  D.18988 = tables->st_raw_data_size;
  D.18989 = D.18985 + D.18988;
  if (D.18989 > addr) goto <D.18990>; else goto <D.18991>;
  <D.18990>:
  D.18992 = iinfo->cli_sections;
  D.18993 = (long unsigned int) i;
  D.18994 = D.18993 * 8;
  D.18995 = D.18992 + D.18994;
  D.18996 = *D.18995;
  if (D.18996 == 0B) goto <D.18997>; else goto <D.18998>;
  <D.18997>:
  D.18999 = mono_image_ensure_section_idx (image, i);
  if (D.18999 == 0) goto <D.19000>; else goto <D.19001>;
  <D.19000>:
  D.19002 = 0B;
  return D.19002;
  <D.19001>:
  <D.18998>:
  D.18992 = iinfo->cli_sections;
  D.18993 = (long unsigned int) i;
  D.18994 = D.18993 * 8;
  D.18995 = D.18992 + D.18994;
  D.18996 = *D.18995;
  D.18985 = tables->st_virtual_address;
  D.19003 = addr - D.18985;
  D.19004 = (sizetype) D.19003;
  D.19002 = D.18996 + D.19004;
  return D.19002;
  <D.18991>:
  <D.18987>:
  tables = tables + 40;
  i = i + 1;
  <D.18352>:
  if (i < top) goto <D.18351>; else goto <D.18353>;
  <D.18353>:
  D.19002 = 0B;
  return D.19002;
}


mono_images_init ()
{
  struct GHashTable * loaded_images_hash.4;
  struct GHashTable * loaded_images_refonly_hash.5;
  const gchar * D.19008;
  _Bool D.19009;
  int debug_assembly_unload.6;

  InitializeCriticalSection (&images_mutex);
  loaded_images_hash.4 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  loaded_images_hash = loaded_images_hash.4;
  loaded_images_refonly_hash.5 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  loaded_images_refonly_hash = loaded_images_refonly_hash.5;
  D.19008 = monoeg_g_getenv ("MONO_DEBUG_ASSEMBLY_UNLOAD");
  D.19009 = D.19008 != 0B;
  debug_assembly_unload.6 = (int) D.19009;
  debug_assembly_unload = debug_assembly_unload.6;
  mutex_inited = 1;
}


mono_images_cleanup ()
{
  struct GHashTable * loaded_images_hash.7;
  struct MonoImage * image.8;
  char * D.19013;
  int D.19014;
  struct GHashTable * loaded_images_refonly_hash.9;
  struct GHashTableIter iter;
  struct MonoImage * image;

  try
    {
      DeleteCriticalSection (&images_mutex);
      loaded_images_hash.7 = loaded_images_hash;
      monoeg_g_hash_table_iter_init (&iter, loaded_images_hash.7);
      goto <D.18363>;
      <D.18362>:
      image.8 = image;
      D.19013 = image.8->name;
      mono_trace (64, 1, "Assembly image \'%s\' still loaded at shutdown.", D.19013);
      <D.18363>:
      D.19014 = monoeg_g_hash_table_iter_next (&iter, 0B, &image);
      if (D.19014 != 0) goto <D.18362>; else goto <D.18364>;
      <D.18364>:
      loaded_images_hash.7 = loaded_images_hash;
      monoeg_g_hash_table_destroy (loaded_images_hash.7);
      loaded_images_refonly_hash.9 = loaded_images_refonly_hash;
      monoeg_g_hash_table_destroy (loaded_images_refonly_hash.9);
      mutex_inited = 0;
    }
  finally
    {
      iter = {CLOBBER};
      image = {CLOBBER};
    }
}


mono_image_ensure_section_idx (struct MonoImage * image, int section)
{
  int D.19016;
  int D.19019;
  void * * D.19020;
  long unsigned int D.19021;
  long unsigned int D.19022;
  void * * D.19023;
  void * D.19024;
  struct MonoSectionTable * D.19027;
  long unsigned int D.19028;
  unsigned int D.19029;
  int D.19030;
  unsigned int D.19031;
  unsigned int D.19032;
  unsigned int D.19033;
  unsigned int D.19034;
  char * D.19037;
  sizetype D.19038;
  void * D.19039;
  struct MonoCLIImageInfo * iinfo;
  struct MonoSectionTable * sect;
  gboolean writable;

  iinfo = image->image_info;
  D.19016 = iinfo->cli_section_count;
  if (D.19016 <= section) goto <D.19017>; else goto <D.19018>;
  <D.19017>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 237, "section < iinfo->cli_section_count");
  D.19019 = 0;
  return D.19019;
  <D.19018>:
  D.19020 = iinfo->cli_sections;
  D.19021 = (long unsigned int) section;
  D.19022 = D.19021 * 8;
  D.19023 = D.19020 + D.19022;
  D.19024 = *D.19023;
  if (D.19024 != 0B) goto <D.19025>; else goto <D.19026>;
  <D.19025>:
  D.19019 = 1;
  return D.19019;
  <D.19026>:
  D.19027 = iinfo->cli_section_tables;
  D.19021 = (long unsigned int) section;
  D.19028 = D.19021 * 40;
  sect = D.19027 + D.19028;
  D.19029 = sect->st_flags;
  D.19030 = (int) D.19029;
  writable = D.19030 & -2147483648;
  D.19031 = sect->st_raw_data_ptr;
  D.19032 = sect->st_raw_data_size;
  D.19033 = D.19031 + D.19032;
  D.19034 = image->raw_data_len;
  if (D.19033 > D.19034) goto <D.19035>; else goto <D.19036>;
  <D.19035>:
  D.19019 = 0;
  return D.19019;
  <D.19036>:
  D.19020 = iinfo->cli_sections;
  D.19021 = (long unsigned int) section;
  D.19022 = D.19021 * 8;
  D.19023 = D.19020 + D.19022;
  D.19037 = image->raw_data;
  D.19031 = sect->st_raw_data_ptr;
  D.19038 = (sizetype) D.19031;
  D.19039 = D.19037 + D.19038;
  *D.19023 = D.19039;
  D.19019 = 1;
  return D.19019;
}


mono_image_ensure_section (struct MonoImage * image, const char * section)
{
  struct MonoSectionTable * D.19041;
  long unsigned int D.19042;
  long unsigned int D.19043;
  struct MonoSectionTable * D.19044;
  char[8] * D.19045;
  int D.19046;
  int D.19049;
  int D.19050;
  struct MonoCLIImageInfo * ii;
  int i;

  ii = image->image_info;
  i = 0;
  goto <D.18389>;
  <D.18388>:
  D.19041 = ii->cli_section_tables;
  D.19042 = (long unsigned int) i;
  D.19043 = D.19042 * 40;
  D.19044 = D.19041 + D.19043;
  D.19045 = &D.19044->st_name;
  D.19046 = strncmp (D.19045, section, 8);
  if (D.19046 != 0) goto <D.19047>; else goto <D.19048>;
  <D.19047>:
  // predicted unlikely by continue predictor.
  goto <D.18387>;
  <D.19048>:
  D.19049 = mono_image_ensure_section_idx (image, i);
  return D.19049;
  <D.18387>:
  i = i + 1;
  <D.18389>:
  D.19050 = ii->cli_section_count;
  if (D.19050 > i) goto <D.18388>; else goto <D.18390>;
  <D.18390>:
  D.19049 = 0;
  return D.19049;
}


mono_image_check_for_module_cctor (struct MonoImage * image)
{
  unsigned char D.19052;
  unsigned char D.19053;
  <unnamed-unsigned:24> D.19056;
  int D.19057;
  int D.18517;
  int iftmp.10;
  int D.18516;
  const char[9] * D.19063;
  unsigned char D.19064;
  int D.19065;
  unsigned char D.19066;
  int D.19067;
  _Bool D.19068;
  _Bool D.19069;
  _Bool D.19070;
  const unsigned char * D.19073;
  unsigned char D.19074;
  int D.19075;
  const unsigned char * D.19076;
  unsigned char D.19077;
  int D.19078;
  _Bool D.19079;
  _Bool D.19080;
  const unsigned char * D.19083;
  unsigned char D.19084;
  int D.19085;
  const unsigned char * D.19086;
  unsigned char D.19087;
  int D.19088;
  _Bool D.19089;
  _Bool D.19090;
  const unsigned char * D.19093;
  unsigned char D.19094;
  int D.19095;
  const unsigned char * D.19096;
  unsigned char D.19097;
  int D.19098;
  unsigned int D.19102;
  unsigned int D.19105;
  <unnamed-unsigned:24> D.19107;
  int first_method.11;
  int D.18528;
  int iftmp.12;
  int D.18527;
  const char[7] * D.19112;
  unsigned char D.19113;
  int D.19114;
  unsigned char D.19115;
  int D.19116;
  _Bool D.19117;
  _Bool D.19118;
  _Bool D.19119;
  const unsigned char * D.19122;
  unsigned char D.19123;
  int D.19124;
  const unsigned char * D.19125;
  unsigned char D.19126;
  int D.19127;
  _Bool D.19128;
  _Bool D.19129;
  const unsigned char * D.19132;
  unsigned char D.19133;
  int D.19134;
  const unsigned char * D.19135;
  unsigned char D.19136;
  int D.19137;
  _Bool D.19138;
  _Bool D.19139;
  const unsigned char * D.19142;
  unsigned char D.19143;
  int D.19144;
  const unsigned char * D.19145;
  unsigned char D.19146;
  int D.19147;
  struct MonoTableInfo * t;
  struct MonoTableInfo * mt;

  t = &image->tables[2];
  mt = &image->tables[6];
  D.19052 = BIT_FIELD_REF <*image, 8, 224>;
  D.19053 = D.19052 & 8;
  if (D.19053 != 0) goto <D.19054>; else goto <D.19055>;
  <D.19054>:
  image->checked_module_cctor = 1;
  return;
  <D.19055>:
  D.19056 = t->rows;
  D.19057 = (int) D.19056;
  if (D.19057 > 0) goto <D.19058>; else goto <D.19059>;
  <D.19058>:
  {
    guint32 nameidx;
    const char * name;

    nameidx = mono_metadata_decode_row_col (t, 0, 1);
    name = mono_metadata_string_heap (image, nameidx);
    {
      size_t __s1_len;
      size_t __s2_len;

      __s2_len = 8;
      if (__s2_len <= 3) goto <D.19061>; else goto <D.19062>;
      <D.19061>:
      {
        const unsigned char * __s2;
        int __result;

        __s2 = name;
        D.19063 = "<Module>";
        D.19064 = MEM[(const unsigned char *)D.19063];
        D.19065 = (int) D.19064;
        D.19066 = *__s2;
        D.19067 = (int) D.19066;
        __result = D.19065 - D.19067;
        {
          D.19068 = __s2_len != 0;
          D.19069 = __result == 0;
          D.19070 = D.19068 & D.19069;
          if (D.19070 != 0) goto <D.19071>; else goto <D.19072>;
          <D.19071>:
          D.19073 = &MEM[(void *)"<Module>" + 1B];
          D.19074 = *D.19073;
          D.19075 = (int) D.19074;
          D.19076 = __s2 + 1;
          D.19077 = *D.19076;
          D.19078 = (int) D.19077;
          __result = D.19075 - D.19078;
          D.19079 = __s2_len > 1;
          D.19069 = __result == 0;
          D.19080 = D.19079 & D.19069;
          if (D.19080 != 0) goto <D.19081>; else goto <D.19082>;
          <D.19081>:
          D.19083 = &MEM[(void *)"<Module>" + 2B];
          D.19084 = *D.19083;
          D.19085 = (int) D.19084;
          D.19086 = __s2 + 2;
          D.19087 = *D.19086;
          D.19088 = (int) D.19087;
          __result = D.19085 - D.19088;
          D.19089 = __s2_len > 2;
          D.19069 = __result == 0;
          D.19090 = D.19089 & D.19069;
          if (D.19090 != 0) goto <D.19091>; else goto <D.19092>;
          <D.19091>:
          D.19093 = &MEM[(void *)"<Module>" + 3B];
          D.19094 = *D.19093;
          D.19095 = (int) D.19094;
          D.19096 = __s2 + 3;
          D.19097 = *D.19096;
          D.19098 = (int) D.19097;
          __result = D.19095 - D.19098;
          <D.19092>:
          <D.19082>:
          <D.19072>:
        }
        D.18516 = __result;
      }
      iftmp.10 = -D.18516;
      goto <D.19099>;
      <D.19062>:
      iftmp.10 = __builtin_strcmp (name, "<Module>");
      <D.19099>:
      D.18517 = iftmp.10;
    }
    if (D.18517 == 0) goto <D.19100>; else goto <D.19101>;
    <D.19100>:
    {
      guint32 first_method;
      guint32 last_method;

      D.19102 = mono_metadata_decode_row_col (t, 0, 5);
      first_method = D.19102 + 4294967295;
      D.19056 = t->rows;
      D.19057 = (int) D.19056;
      if (D.19057 > 1) goto <D.19103>; else goto <D.19104>;
      <D.19103>:
      D.19105 = mono_metadata_decode_row_col (t, 1, 5);
      last_method = D.19105 + 4294967295;
      goto <D.19106>;
      <D.19104>:
      D.19107 = mt->rows;
      last_method = (guint32) D.19107;
      <D.19106>:
      goto <D.18530>;
      <D.18529>:
      first_method.11 = (int) first_method;
      nameidx = mono_metadata_decode_row_col (mt, first_method.11, 3);
      name = mono_metadata_string_heap (image, nameidx);
      {
        size_t __s1_len;
        size_t __s2_len;

        __s2_len = 6;
        if (__s2_len <= 3) goto <D.19110>; else goto <D.19111>;
        <D.19110>:
        {
          const unsigned char * __s2;
          int __result;

          __s2 = name;
          D.19112 = ".cctor";
          D.19113 = MEM[(const unsigned char *)D.19112];
          D.19114 = (int) D.19113;
          D.19115 = *__s2;
          D.19116 = (int) D.19115;
          __result = D.19114 - D.19116;
          {
            D.19117 = __s2_len != 0;
            D.19118 = __result == 0;
            D.19119 = D.19117 & D.19118;
            if (D.19119 != 0) goto <D.19120>; else goto <D.19121>;
            <D.19120>:
            D.19122 = &MEM[(void *)".cctor" + 1B];
            D.19123 = *D.19122;
            D.19124 = (int) D.19123;
            D.19125 = __s2 + 1;
            D.19126 = *D.19125;
            D.19127 = (int) D.19126;
            __result = D.19124 - D.19127;
            D.19128 = __s2_len > 1;
            D.19118 = __result == 0;
            D.19129 = D.19128 & D.19118;
            if (D.19129 != 0) goto <D.19130>; else goto <D.19131>;
            <D.19130>:
            D.19132 = &MEM[(void *)".cctor" + 2B];
            D.19133 = *D.19132;
            D.19134 = (int) D.19133;
            D.19135 = __s2 + 2;
            D.19136 = *D.19135;
            D.19137 = (int) D.19136;
            __result = D.19134 - D.19137;
            D.19138 = __s2_len > 2;
            D.19118 = __result == 0;
            D.19139 = D.19138 & D.19118;
            if (D.19139 != 0) goto <D.19140>; else goto <D.19141>;
            <D.19140>:
            D.19142 = &MEM[(void *)".cctor" + 3B];
            D.19143 = *D.19142;
            D.19144 = (int) D.19143;
            D.19145 = __s2 + 3;
            D.19146 = *D.19145;
            D.19147 = (int) D.19146;
            __result = D.19144 - D.19147;
            <D.19141>:
            <D.19131>:
            <D.19121>:
          }
          D.18527 = __result;
        }
        iftmp.12 = -D.18527;
        goto <D.19148>;
        <D.19111>:
        iftmp.12 = __builtin_strcmp (name, ".cctor");
        <D.19148>:
        D.18528 = iftmp.12;
      }
      if (D.18528 == 0) goto <D.19149>; else goto <D.19150>;
      <D.19149>:
      image->has_module_cctor = 1;
      image->checked_module_cctor = 1;
      return;
      <D.19150>:
      first_method = first_method + 1;
      <D.18530>:
      if (first_method < last_method) goto <D.18529>; else goto <D.18531>;
      <D.18531>:
    }
    <D.19101>:
  }
  <D.19059>:
  image->has_module_cctor = 0;
  image->checked_module_cctor = 1;
}


mono_image_load_module (struct MonoImage * image, int idx)
{
  <unnamed-unsigned:1> D.19152;
  unsigned int D.19155;
  unsigned int idx.13;
  struct MonoImage * D.19159;
  gboolean * D.19160;
  long unsigned int D.19161;
  long unsigned int D.19162;
  sizetype D.19163;
  gboolean * D.19164;
  int D.19165;
  struct MonoImage * * D.19168;
  long unsigned int D.19169;
  sizetype D.19170;
  struct MonoImage * * D.19171;
  unsigned int D.19172;
  unsigned int D.19175;
  const char * D.19176;
  <unnamed-unsigned:24> D.19177;
  int D.19178;
  char * D.19179;
  unsigned int D.19180;
  unsigned int D.19181;
  _Bool D.19182;
  int D.19183;
  unsigned int D.19184;
  int D.18565;
  void * D.19185;
  struct MonoImage * D.19190;
  struct MonoImage * D.19191;
  struct MonoAssembly * D.19194;
  struct MonoTableInfo * t;
  struct MonoTableInfo * file_table;
  int i;
  char * base_dir;
  gboolean refonly;
  struct GList * list_iter;
  struct GList * valid_modules;
  MonoImageOpenStatus status;

  try
    {
      D.19152 = image->ref_only;
      refonly = (gboolean) D.19152;
      valid_modules = 0B;
      D.19155 = image->module_count;
      if (D.19155 == 0) goto <D.19153>; else goto <D.19156>;
      <D.19156>:
      idx.13 = (unsigned int) idx;
      D.19155 = image->module_count;
      if (idx.13 > D.19155) goto <D.19153>; else goto <D.19158>;
      <D.19158>:
      if (idx <= 0) goto <D.19153>; else goto <D.19154>;
      <D.19153>:
      D.19159 = 0B;
      return D.19159;
      <D.19154>:
      D.19160 = image->modules_loaded;
      D.19161 = (long unsigned int) idx;
      D.19162 = D.19161 * 4;
      D.19163 = D.19162 + 18446744073709551612;
      D.19164 = D.19160 + D.19163;
      D.19165 = *D.19164;
      if (D.19165 != 0) goto <D.19166>; else goto <D.19167>;
      <D.19166>:
      D.19168 = image->modules;
      D.19161 = (long unsigned int) idx;
      D.19169 = D.19161 * 8;
      D.19170 = D.19169 + 18446744073709551608;
      D.19171 = D.19168 + D.19170;
      D.19159 = *D.19171;
      return D.19159;
      <D.19167>:
      file_table = &image->tables[38];
      i = 0;
      goto <D.18551>;
      <D.18550>:
      {
        guint32 cols[3];

        try
          {
            mono_metadata_decode_row (file_table, i, &cols, 3);
            D.19172 = cols[0];
            if (D.19172 == 1) goto <D.19173>; else goto <D.19174>;
            <D.19173>:
            // predicted unlikely by continue predictor.
            goto <D.18549>;
            <D.19174>:
            D.19175 = cols[1];
            D.19176 = mono_metadata_string_heap (image, D.19175);
            valid_modules = monoeg_g_list_prepend (valid_modules, D.19176);
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      <D.18549>:
      i = i + 1;
      <D.18551>:
      D.19177 = file_table->rows;
      D.19178 = (int) D.19177;
      if (D.19178 > i) goto <D.18550>; else goto <D.18552>;
      <D.18552>:
      t = &image->tables[26];
      D.19179 = image->name;
      base_dir = monoeg_g_path_get_dirname (D.19179);
      {
        char * module_ref;
        const char * name;
        guint32 cols[1];
        int valid;

        try
          {
            D.19180 = BIT_FIELD_REF <*file_table, 32, 64>;
            D.19181 = D.19180 & 16777215;
            D.19182 = D.19181 == 0;
            valid = (int) D.19182;
            D.19183 = idx + -1;
            mono_metadata_decode_row (t, D.19183, &cols, 1);
            D.19184 = cols[0];
            name = mono_metadata_string_heap (image, D.19184);
            list_iter = valid_modules;
            goto <D.18568>;
            <D.18567>:
            {
              size_t __s1_len;
              size_t __s2_len;

              D.19185 = list_iter->data;
              D.18565 = __builtin_strcmp (D.19185, name);
            }
            if (D.18565 == 0) goto <D.19186>; else goto <D.19187>;
            <D.19186>:
            valid = 1;
            goto <D.18566>;
            <D.19187>:
            list_iter = list_iter->next;
            <D.18568>:
            if (list_iter != 0B) goto <D.18567>; else goto <D.18566>;
            <D.18566>:
            if (valid != 0) goto <D.19188>; else goto <D.19189>;
            <D.19188>:
            module_ref = monoeg_g_build_path ("/", base_dir, name, 0B);
            D.19168 = image->modules;
            D.19161 = (long unsigned int) idx;
            D.19169 = D.19161 * 8;
            D.19170 = D.19169 + 18446744073709551608;
            D.19171 = D.19168 + D.19170;
            D.19190 = mono_image_open_full (module_ref, &status, refonly);
            *D.19171 = D.19190;
            D.19168 = image->modules;
            D.19161 = (long unsigned int) idx;
            D.19169 = D.19161 * 8;
            D.19170 = D.19169 + 18446744073709551608;
            D.19171 = D.19168 + D.19170;
            D.19191 = *D.19171;
            if (D.19191 != 0B) goto <D.19192>; else goto <D.19193>;
            <D.19192>:
            D.19168 = image->modules;
            D.19161 = (long unsigned int) idx;
            D.19169 = D.19161 * 8;
            D.19170 = D.19169 + 18446744073709551608;
            D.19171 = D.19168 + D.19170;
            D.19191 = *D.19171;
            mono_image_addref (D.19191);
            D.19168 = image->modules;
            D.19161 = (long unsigned int) idx;
            D.19169 = D.19161 * 8;
            D.19170 = D.19169 + 18446744073709551608;
            D.19171 = D.19168 + D.19170;
            D.19191 = *D.19171;
            D.19194 = image->assembly;
            D.19191->assembly = D.19194;
            <D.19193>:
            monoeg_g_free (module_ref);
            <D.19189>:
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      D.19160 = image->modules_loaded;
      D.19161 = (long unsigned int) idx;
      D.19162 = D.19161 * 4;
      D.19163 = D.19162 + 18446744073709551612;
      D.19164 = D.19160 + D.19163;
      *D.19164 = 1;
      monoeg_g_free (base_dir);
      monoeg_g_list_free (valid_modules);
      D.19168 = image->modules;
      D.19161 = (long unsigned int) idx;
      D.19169 = D.19161 * 8;
      D.19170 = D.19169 + 18446744073709551608;
      D.19171 = D.19168 + D.19170;
      D.19159 = *D.19171;
      return D.19159;
    }
  finally
    {
      status = {CLOBBER};
    }
}


mono_image_init (struct MonoImage * image)
{
  struct MonoMemPool * D.19199;
  struct MonoInternalHashTable * D.19200;
  struct GHashTable * D.19201;
  struct GHashTable * D.19202;
  struct GHashTable * D.19203;
  struct GHashTable * D.19204;
  struct GHashTable * D.19205;
  struct MonoPropertyHash * D.19206;
  struct CRITICAL_SECTION * D.19207;
  struct CRITICAL_SECTION * D.19208;

  D.19199 = mono_mempool_new_size (512);
  image->mempool = D.19199;
  D.19200 = &image->class_cache;
  mono_internal_hash_table_init (D.19200, monoeg_g_direct_hash, class_key_extract, class_next_value);
  D.19201 = monoeg_g_hash_table_new (0B, 0B);
  image->field_cache = D.19201;
  D.19202 = monoeg_g_hash_table_new (0B, 0B);
  image->typespec_cache = D.19202;
  D.19203 = monoeg_g_hash_table_new (0B, 0B);
  image->memberref_signatures = D.19203;
  D.19204 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  image->helper_signatures = D.19204;
  D.19205 = monoeg_g_hash_table_new (0B, 0B);
  image->method_signatures = D.19205;
  D.19206 = mono_property_hash_new ();
  image->property_hash = D.19206;
  D.19207 = &image->lock;
  InitializeCriticalSection (D.19207);
  D.19208 = &image->szarray_cache_lock;
  InitializeCriticalSection (D.19208);
}


class_next_value (void * value)
{
  void * * D.19209;
  struct MonoClass * class;

  class = value;
  D.19209 = &class->next_class_cache;
  return D.19209;
}


class_key_extract (void * value)
{
  void * D.19211;
  unsigned int D.19212;
  long unsigned int D.19213;
  struct MonoClass * class;

  class = value;
  D.19212 = class->type_token;
  D.19213 = (long unsigned int) D.19212;
  D.19211 = (void *) D.19213;
  return D.19211;
}


mono_image_load_pe_data (struct MonoImage * image)
{
  long unsigned int D.19215;
  long unsigned int D.19216;
  unsigned int D.19217;
  long unsigned int D.19218;
  char * D.19220;
  sizetype D.19221;
  char * D.19222;
  signed short D.19223;
  short unsigned int D.19224;
  short unsigned int D.19225;
  unsigned int D.19227;
  unsigned int offset.14;
  int D.19230;
  gboolean D.19232;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoMSDOSHeader msdos;
  gint32 offset;
  void invalid_image = <<< error >>>;

  try
    {
      offset = 0;
      iinfo = image->image_info;
      header = &iinfo->cli_header;
      D.19215 = (long unsigned int) offset;
      D.19216 = D.19215 + 128;
      D.19217 = image->raw_data_len;
      D.19218 = (long unsigned int) D.19217;
      if (D.19216 > D.19218) goto invalid_image; else goto <D.19219>;
      <D.19219>:
      D.19220 = image->raw_data;
      D.19221 = (sizetype) offset;
      D.19222 = D.19220 + D.19221;
      memcpy (&msdos, D.19222, 128);
      D.19223 = BIT_FIELD_REF <msdos, 16, 0>;
      D.19224 = (short unsigned int) D.19223;
      D.19225 = D.19224;
      if (D.19225 != 23117) goto invalid_image; else goto <D.19226>;
      <D.19226>:
      D.19227 = msdos.pe_offset;
      msdos.pe_offset = D.19227;
      D.19227 = msdos.pe_offset;
      offset = (gint32) D.19227;
      offset = do_load_header (image, header, offset);
      if (offset < 0) goto invalid_image; else goto <D.19228>;
      <D.19228>:
      offset.14 = (unsigned int) offset;
      D.19230 = load_section_tables (image, iinfo, offset.14);
      if (D.19230 == 0) goto invalid_image; else goto <D.19231>;
      <D.19231>:
      D.19232 = 1;
      return D.19232;
      invalid_image:
      D.19232 = 0;
      return D.19232;
    }
  finally
    {
      msdos = {CLOBBER};
    }
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.19235;
  long unsigned int D.19236;

  D.19236 = __builtin_object_size (__dest, 0);
  D.19235 = __builtin___memcpy_chk (__dest, __src, __len, D.19236);
  return D.19235;
}


do_load_header (struct MonoImage * image, struct MonoDotNetHeader * header, int offset)
{
  long unsigned int D.19238;
  long unsigned int D.19239;
  unsigned int D.19240;
  long unsigned int D.19241;
  int D.19244;
  char * D.19245;
  sizetype D.19246;
  char * D.19247;
  signed short D.19248;
  short unsigned int D.19249;
  short unsigned int D.19250;
  short unsigned int D.19253;
  unsigned int offset.15;
  unsigned int D.19257;
  short unsigned int D.19258;
  unsigned int D.19266;
  long unsigned int D.19267;
  unsigned int D.19268;
  long unsigned int D.19269;
  unsigned int D.19270;
  long unsigned int D.19271;
  unsigned int D.19272;
  long unsigned int D.19273;
  unsigned int D.19274;
  long unsigned int D.19275;
  unsigned int D.19276;
  unsigned int D.19277;
  unsigned int D.19278;
  short unsigned int D.19279;
  short unsigned int D.19280;
  short unsigned int D.19281;
  short unsigned int D.19282;
  short unsigned int D.19283;
  short unsigned int D.19284;
  unsigned int D.19285;
  unsigned int D.19286;
  unsigned int D.19287;
  unsigned int D.19288;
  short unsigned int D.19289;
  short unsigned int D.19290;
  unsigned int D.19291;
  unsigned int D.19292;
  struct MonoPEDatadir * D.19293;
  struct MonoDotNetHeader64 header64;

  try
    {
      D.19238 = (long unsigned int) offset;
      D.19239 = D.19238 + 248;
      D.19240 = image->raw_data_len;
      D.19241 = (long unsigned int) D.19240;
      if (D.19239 > D.19241) goto <D.19242>; else goto <D.19243>;
      <D.19242>:
      D.19244 = -1;
      return D.19244;
      <D.19243>:
      D.19245 = image->raw_data;
      D.19246 = (sizetype) offset;
      D.19247 = D.19245 + D.19246;
      memcpy (header, D.19247, 248);
      D.19248 = BIT_FIELD_REF <*header, 16, 0>;
      D.19249 = (short unsigned int) D.19248;
      D.19250 = D.19249;
      if (D.19250 != 17744) goto <D.19251>; else goto <D.19252>;
      <D.19251>:
      D.19244 = -1;
      return D.19244;
      <D.19252>:
      D.19253 = header->pe.pe_magic;
      if (D.19253 == 267) goto <D.19254>; else goto <D.19255>;
      <D.19254>:
      offset.15 = (unsigned int) offset;
      D.19257 = offset.15 + 248;
      offset = (int) D.19257;
      D.19258 = header->coff.coff_opt_header_size;
      if (D.19258 != 224) goto <D.19259>; else goto <D.19260>;
      <D.19259>:
      D.19244 = -1;
      return D.19244;
      <D.19260>:
      goto <D.19261>;
      <D.19255>:
      D.19253 = header->pe.pe_magic;
      if (D.19253 == 523) goto <D.19262>; else goto <D.19263>;
      <D.19262>:
      D.19258 = header->coff.coff_opt_header_size;
      if (D.19258 != 240) goto <D.19264>; else goto <D.19265>;
      <D.19264>:
      D.19244 = -1;
      return D.19244;
      <D.19265>:
      D.19245 = image->raw_data;
      D.19246 = (sizetype) offset;
      D.19247 = D.19245 + D.19246;
      memcpy (&header64, D.19247, 264);
      offset.15 = (unsigned int) offset;
      D.19266 = offset.15 + 264;
      offset = (int) D.19266;
      memcpy (&header64, header, 244);
      D.19267 = header64.nt.pe_image_base;
      D.19268 = (unsigned int) D.19267;
      header->nt.pe_image_base = D.19268;
      D.19269 = header64.nt.pe_stack_reserve;
      D.19270 = (unsigned int) D.19269;
      header->nt.pe_stack_reserve = D.19270;
      D.19271 = header64.nt.pe_stack_commit;
      D.19272 = (unsigned int) D.19271;
      header->nt.pe_stack_commit = D.19272;
      D.19273 = header64.nt.pe_heap_reserve;
      D.19274 = (unsigned int) D.19273;
      header->nt.pe_heap_reserve = D.19274;
      D.19275 = header64.nt.pe_heap_commit;
      D.19276 = (unsigned int) D.19275;
      header->nt.pe_heap_commit = D.19276;
      D.19277 = header64.nt.pe_section_align;
      header->nt.pe_section_align = D.19277;
      D.19278 = header64.nt.pe_file_alignment;
      header->nt.pe_file_alignment = D.19278;
      D.19279 = header64.nt.pe_os_major;
      header->nt.pe_os_major = D.19279;
      D.19280 = header64.nt.pe_os_minor;
      header->nt.pe_os_minor = D.19280;
      D.19281 = header64.nt.pe_user_major;
      header->nt.pe_user_major = D.19281;
      D.19282 = header64.nt.pe_user_minor;
      header->nt.pe_user_minor = D.19282;
      D.19283 = header64.nt.pe_subsys_major;
      header->nt.pe_subsys_major = D.19283;
      D.19284 = header64.nt.pe_subsys_minor;
      header->nt.pe_subsys_minor = D.19284;
      D.19285 = header64.nt.pe_reserved_1;
      header->nt.pe_reserved_1 = D.19285;
      D.19286 = header64.nt.pe_image_size;
      header->nt.pe_image_size = D.19286;
      D.19287 = header64.nt.pe_header_size;
      header->nt.pe_header_size = D.19287;
      D.19288 = header64.nt.pe_checksum;
      header->nt.pe_checksum = D.19288;
      D.19289 = header64.nt.pe_subsys_required;
      header->nt.pe_subsys_required = D.19289;
      D.19290 = header64.nt.pe_dll_flags;
      header->nt.pe_dll_flags = D.19290;
      D.19291 = header64.nt.pe_loader_flags;
      header->nt.pe_loader_flags = D.19291;
      D.19292 = header64.nt.pe_data_dir_count;
      header->nt.pe_data_dir_count = D.19292;
      D.19293 = &header->datadir;
      memcpy (D.19293, &header64.datadir, 128);
      goto <D.19294>;
      <D.19263>:
      D.19244 = -1;
      return D.19244;
      <D.19294>:
      <D.19261>:
      D.19244 = offset;
      return D.19244;
    }
  finally
    {
      header64 = {CLOBBER};
    }
}


load_section_tables (struct MonoImage * image, struct MonoCLIImageInfo * iinfo, guint32 offset)
{
  short unsigned int D.19297;
  long unsigned int D.19298;
  long unsigned int D.19299;
  void * D.19300;
  long unsigned int D.19301;
  void * D.19302;
  struct MonoSectionTable * D.19303;
  long unsigned int D.19304;
  long unsigned int D.19305;
  long unsigned int D.19306;
  long unsigned int D.19307;
  unsigned int D.19308;
  long unsigned int D.19309;
  int D.19312;
  char * D.19313;
  sizetype D.19314;
  char * D.19315;
  const int top;
  int i;

  D.19297 = iinfo->cli_header.coff.coff_sections;
  top = (const int) D.19297;
  iinfo->cli_section_count = top;
  D.19298 = (long unsigned int) top;
  D.19299 = D.19298 * 40;
  D.19300 = monoeg_malloc0 (D.19299);
  iinfo->cli_section_tables = D.19300;
  D.19298 = (long unsigned int) top;
  D.19301 = D.19298 * 8;
  D.19302 = monoeg_malloc0 (D.19301);
  iinfo->cli_sections = D.19302;
  i = 0;
  goto <D.18400>;
  <D.18399>:
  {
    struct MonoSectionTable * t;

    D.19303 = iinfo->cli_section_tables;
    D.19304 = (long unsigned int) i;
    D.19305 = D.19304 * 40;
    t = D.19303 + D.19305;
    D.19306 = (long unsigned int) offset;
    D.19307 = D.19306 + 40;
    D.19308 = image->raw_data_len;
    D.19309 = (long unsigned int) D.19308;
    if (D.19307 > D.19309) goto <D.19310>; else goto <D.19311>;
    <D.19310>:
    D.19312 = 0;
    return D.19312;
    <D.19311>:
    D.19313 = image->raw_data;
    D.19314 = (sizetype) offset;
    D.19315 = D.19313 + D.19314;
    memcpy (t, D.19315, 40);
    offset = offset + 40;
  }
  i = i + 1;
  <D.18400>:
  if (i < top) goto <D.18399>; else goto <D.18401>;
  <D.18401>:
  D.19312 = 1;
  return D.19312;
}


mono_image_load_cli_data (struct MonoImage * image)
{
  int D.19317;
  gboolean D.19320;
  int D.19321;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  D.19317 = load_cli_header (image, iinfo);
  if (D.19317 == 0) goto <D.19318>; else goto <D.19319>;
  <D.19318>:
  D.19320 = 0;
  return D.19320;
  <D.19319>:
  D.19321 = load_metadata (image, iinfo);
  if (D.19321 == 0) goto <D.19322>; else goto <D.19323>;
  <D.19322>:
  D.19320 = 0;
  return D.19320;
  <D.19323>:
  D.19320 = 1;
  return D.19320;
}


load_cli_header (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.19325;
  gboolean D.19328;
  long unsigned int D.19329;
  long unsigned int D.19330;
  unsigned int D.19331;
  long unsigned int D.19332;
  char * D.19335;
  sizetype D.19336;
  char * D.19337;
  struct MonoCLIHeader * D.19338;
  unsigned int D.19339;
  unsigned int D.19342;
  unsigned int D.19345;
  unsigned int D.19348;
  unsigned int D.19351;
  unsigned int D.19354;
  unsigned int D.19357;
  unsigned int D.19360;
  unsigned int D.19363;
  guint32 offset;

  D.19325 = iinfo->cli_header.datadir.pe_cli_header.rva;
  offset = mono_cli_rva_image_map (image, D.19325);
  if (offset == 4294967295) goto <D.19326>; else goto <D.19327>;
  <D.19326>:
  D.19328 = 0;
  return D.19328;
  <D.19327>:
  D.19329 = (long unsigned int) offset;
  D.19330 = D.19329 + 136;
  D.19331 = image->raw_data_len;
  D.19332 = (long unsigned int) D.19331;
  if (D.19330 > D.19332) goto <D.19333>; else goto <D.19334>;
  <D.19333>:
  D.19328 = 0;
  return D.19328;
  <D.19334>:
  D.19335 = image->raw_data;
  D.19336 = (sizetype) offset;
  D.19337 = D.19335 + D.19336;
  D.19338 = &iinfo->cli_cli_header;
  memcpy (D.19338, D.19337, 136);
  D.19339 = iinfo->cli_cli_header.ch_eeinfo_table.rva;
  if (D.19339 != 0) goto <D.19340>; else goto <D.19341>;
  <D.19341>:
  D.19342 = iinfo->cli_cli_header.ch_helper_table.rva;
  if (D.19342 != 0) goto <D.19343>; else goto <D.19344>;
  <D.19344>:
  D.19345 = iinfo->cli_cli_header.ch_dynamic_info.rva;
  if (D.19345 != 0) goto <D.19346>; else goto <D.19347>;
  <D.19347>:
  D.19348 = iinfo->cli_cli_header.ch_delay_load_info.rva;
  if (D.19348 != 0) goto <D.19349>; else goto <D.19350>;
  <D.19350>:
  D.19351 = iinfo->cli_cli_header.ch_module_image.rva;
  if (D.19351 != 0) goto <D.19352>; else goto <D.19353>;
  <D.19353>:
  D.19354 = iinfo->cli_cli_header.ch_external_fixups.rva;
  if (D.19354 != 0) goto <D.19355>; else goto <D.19356>;
  <D.19356>:
  D.19357 = iinfo->cli_cli_header.ch_ridmap.rva;
  if (D.19357 != 0) goto <D.19358>; else goto <D.19359>;
  <D.19359>:
  D.19360 = iinfo->cli_cli_header.ch_debug_map.rva;
  if (D.19360 != 0) goto <D.19361>; else goto <D.19362>;
  <D.19362>:
  D.19363 = iinfo->cli_cli_header.ch_ip_map.rva;
  if (D.19363 != 0) goto <D.19364>; else goto <D.19365>;
  <D.19364>:
  <D.19365>:
  <D.19361>:
  <D.19358>:
  <D.19355>:
  <D.19352>:
  <D.19349>:
  <D.19346>:
  <D.19343>:
  <D.19340>:
  D.19328 = 1;
  return D.19328;
}


load_metadata (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  int D.19367;
  gboolean D.19370;

  D.19367 = load_metadata_ptrs (image, iinfo);
  if (D.19367 == 0) goto <D.19368>; else goto <D.19369>;
  <D.19368>:
  D.19370 = 0;
  return D.19370;
  <D.19369>:
  D.19370 = load_tables (image);
  return D.19370;
}


load_metadata_ptrs (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.19372;
  gboolean D.19375;
  unsigned int D.19376;
  unsigned int D.19377;
  char * D.19380;
  sizetype D.19381;
  char * D.19382;
  int D.19383;
  short unsigned int D.19386;
  short int D.19387;
  long unsigned int D.19388;
  gchar * D.19389;
  sizetype D.19390;
  long int ptr.16;
  char * D.19392;
  long int D.19393;
  long int D.19394;
  unsigned int D.19395;
  unsigned int D.19398;
  sizetype D.19399;
  int D.18435;
  int iftmp.17;
  int D.18434;
  const char[3] * D.19404;
  unsigned char D.19405;
  int D.19406;
  unsigned char D.19407;
  int D.19408;
  _Bool D.19409;
  _Bool D.19410;
  _Bool D.19411;
  const unsigned char * D.19414;
  unsigned char D.19415;
  int D.19416;
  const unsigned char * D.19417;
  unsigned char D.19418;
  int D.19419;
  _Bool D.19420;
  _Bool D.19421;
  const unsigned char * D.19424;
  unsigned char D.19425;
  int D.19426;
  const unsigned char * D.19427;
  unsigned char D.19428;
  int D.19429;
  _Bool D.19430;
  _Bool D.19431;
  const unsigned char * D.19434;
  unsigned char D.19435;
  int D.19436;
  const unsigned char * D.19437;
  unsigned char D.19438;
  int D.19439;
  const char * D.19441;
  unsigned int D.19444;
  sizetype D.19445;
  const char * D.19446;
  unsigned int D.19447;
  int D.18444;
  int iftmp.18;
  int D.18443;
  const char[9] * D.19452;
  unsigned char D.19453;
  int D.19454;
  unsigned char D.19455;
  int D.19456;
  _Bool D.19457;
  _Bool D.19458;
  _Bool D.19459;
  const unsigned char * D.19462;
  unsigned char D.19463;
  int D.19464;
  const unsigned char * D.19465;
  unsigned char D.19466;
  int D.19467;
  _Bool D.19468;
  _Bool D.19469;
  const unsigned char * D.19472;
  unsigned char D.19473;
  int D.19474;
  const unsigned char * D.19475;
  unsigned char D.19476;
  int D.19477;
  _Bool D.19478;
  _Bool D.19479;
  const unsigned char * D.19482;
  unsigned char D.19483;
  int D.19484;
  const unsigned char * D.19485;
  unsigned char D.19486;
  int D.19487;
  int D.18453;
  int iftmp.19;
  int D.18452;
  const char[4] * D.19495;
  unsigned char D.19496;
  int D.19497;
  unsigned char D.19498;
  int D.19499;
  _Bool D.19500;
  _Bool D.19501;
  _Bool D.19502;
  const unsigned char * D.19505;
  unsigned char D.19506;
  int D.19507;
  const unsigned char * D.19508;
  unsigned char D.19509;
  int D.19510;
  _Bool D.19511;
  _Bool D.19512;
  const unsigned char * D.19515;
  unsigned char D.19516;
  int D.19517;
  const unsigned char * D.19518;
  unsigned char D.19519;
  int D.19520;
  _Bool D.19521;
  _Bool D.19522;
  const unsigned char * D.19525;
  unsigned char D.19526;
  int D.19527;
  const unsigned char * D.19528;
  unsigned char D.19529;
  int D.19530;
  int D.18462;
  int iftmp.20;
  int D.18461;
  const char[6] * D.19538;
  unsigned char D.19539;
  int D.19540;
  unsigned char D.19541;
  int D.19542;
  _Bool D.19543;
  _Bool D.19544;
  _Bool D.19545;
  const unsigned char * D.19548;
  unsigned char D.19549;
  int D.19550;
  const unsigned char * D.19551;
  unsigned char D.19552;
  int D.19553;
  _Bool D.19554;
  _Bool D.19555;
  const unsigned char * D.19558;
  unsigned char D.19559;
  int D.19560;
  const unsigned char * D.19561;
  unsigned char D.19562;
  int D.19563;
  _Bool D.19564;
  _Bool D.19565;
  const unsigned char * D.19568;
  unsigned char D.19569;
  int D.19570;
  const unsigned char * D.19571;
  unsigned char D.19572;
  int D.19573;
  int D.18471;
  int iftmp.21;
  int D.18470;
  const char[6] * D.19581;
  unsigned char D.19582;
  int D.19583;
  unsigned char D.19584;
  int D.19585;
  _Bool D.19586;
  _Bool D.19587;
  _Bool D.19588;
  const unsigned char * D.19591;
  unsigned char D.19592;
  int D.19593;
  const unsigned char * D.19594;
  unsigned char D.19595;
  int D.19596;
  _Bool D.19597;
  _Bool D.19598;
  const unsigned char * D.19601;
  unsigned char D.19602;
  int D.19603;
  const unsigned char * D.19604;
  unsigned char D.19605;
  int D.19606;
  _Bool D.19607;
  _Bool D.19608;
  const unsigned char * D.19611;
  unsigned char D.19612;
  int D.19613;
  const unsigned char * D.19614;
  unsigned char D.19615;
  int D.19616;
  int D.18480;
  int iftmp.22;
  int D.18479;
  const char[3] * D.19624;
  unsigned char D.19625;
  int D.19626;
  unsigned char D.19627;
  int D.19628;
  _Bool D.19629;
  _Bool D.19630;
  _Bool D.19631;
  const unsigned char * D.19634;
  unsigned char D.19635;
  int D.19636;
  const unsigned char * D.19637;
  unsigned char D.19638;
  int D.19639;
  _Bool D.19640;
  _Bool D.19641;
  const unsigned char * D.19644;
  unsigned char D.19645;
  int D.19646;
  const unsigned char * D.19647;
  unsigned char D.19648;
  int D.19649;
  _Bool D.19650;
  _Bool D.19651;
  const unsigned char * D.19654;
  unsigned char D.19655;
  int D.19656;
  const unsigned char * D.19657;
  unsigned char D.19658;
  int D.19659;
  char * D.19663;
  char * D.19665;
  long unsigned int D.19666;
  sizetype D.19667;
  int D.19670;
  const char * D.19671;
  _Bool D.19672;
  long int D.19673;
  long int D.19674;
  unsigned int D.19677;
  _Bool D.19678;
  long int D.19679;
  long int D.19680;
  char * D.19683;
  guint32 offset;
  guint32 size;
  guint16 streams;
  int i;
  guint32 pad;
  char * ptr;

  D.19372 = iinfo->cli_cli_header.ch_metadata.rva;
  offset = mono_cli_rva_image_map (image, D.19372);
  if (offset == 4294967295) goto <D.19373>; else goto <D.19374>;
  <D.19373>:
  D.19375 = 0;
  return D.19375;
  <D.19374>:
  size = iinfo->cli_cli_header.ch_metadata.size;
  D.19376 = offset + size;
  D.19377 = image->raw_data_len;
  if (D.19376 > D.19377) goto <D.19378>; else goto <D.19379>;
  <D.19378>:
  D.19375 = 0;
  return D.19375;
  <D.19379>:
  D.19380 = image->raw_data;
  D.19381 = (sizetype) offset;
  D.19382 = D.19380 + D.19381;
  image->raw_metadata = D.19382;
  ptr = image->raw_metadata;
  D.19383 = strncmp (ptr, "BSJB", 4);
  if (D.19383 == 0) goto <D.19384>; else goto <D.19385>;
  <D.19384>:
  {
    guint32 version_string_len;

    ptr = ptr + 4;
    D.19386 = MEM[(const guint16 *)ptr];
    D.19387 = (short int) D.19386;
    image->md_version_major = D.19387;
    ptr = ptr + 2;
    D.19386 = MEM[(const guint16 *)ptr];
    D.19387 = (short int) D.19386;
    image->md_version_minor = D.19387;
    ptr = ptr + 6;
    version_string_len = MEM[(const guint32 *)ptr];
    ptr = ptr + 4;
    D.19388 = (long unsigned int) version_string_len;
    D.19389 = monoeg_g_strndup (ptr, D.19388);
    image->version = D.19389;
    D.19390 = (sizetype) version_string_len;
    ptr = ptr + D.19390;
    ptr.16 = (long int) ptr;
    D.19392 = image->raw_metadata;
    D.19393 = (long int) D.19392;
    D.19394 = ptr.16 - D.19393;
    pad = (guint32) D.19394;
    D.19395 = pad & 3;
    if (D.19395 != 0) goto <D.19396>; else goto <D.19397>;
    <D.19396>:
    D.19395 = pad & 3;
    D.19398 = 4 - D.19395;
    D.19399 = (sizetype) D.19398;
    ptr = ptr + D.19399;
    <D.19397>:
  }
  goto <D.19400>;
  <D.19385>:
  D.19375 = 0;
  return D.19375;
  <D.19400>:
  ptr = ptr + 2;
  streams = MEM[(const guint16 *)ptr];
  ptr = ptr + 2;
  i = 0;
  goto <D.18482>;
  <D.18481>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 2;
    if (__s2_len <= 3) goto <D.19402>; else goto <D.19403>;
    <D.19402>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = ptr + 8;
      D.19404 = "#~";
      D.19405 = MEM[(const unsigned char *)D.19404];
      D.19406 = (int) D.19405;
      D.19407 = *__s2;
      D.19408 = (int) D.19407;
      __result = D.19406 - D.19408;
      {
        D.19409 = __s2_len != 0;
        D.19410 = __result == 0;
        D.19411 = D.19409 & D.19410;
        if (D.19411 != 0) goto <D.19412>; else goto <D.19413>;
        <D.19412>:
        D.19414 = &MEM[(void *)"#~" + 1B];
        D.19415 = *D.19414;
        D.19416 = (int) D.19415;
        D.19417 = __s2 + 1;
        D.19418 = *D.19417;
        D.19419 = (int) D.19418;
        __result = D.19416 - D.19419;
        D.19420 = __s2_len > 1;
        D.19410 = __result == 0;
        D.19421 = D.19420 & D.19410;
        if (D.19421 != 0) goto <D.19422>; else goto <D.19423>;
        <D.19422>:
        D.19424 = &MEM[(void *)"#~" + 2B];
        D.19425 = *D.19424;
        D.19426 = (int) D.19425;
        D.19427 = __s2 + 2;
        D.19428 = *D.19427;
        D.19429 = (int) D.19428;
        __result = D.19426 - D.19429;
        D.19430 = __s2_len > 2;
        D.19410 = __result == 0;
        D.19431 = D.19430 & D.19410;
        if (D.19431 != 0) goto <D.19432>; else goto <D.19433>;
        <D.19432>:
        D.19434 = &MEM[(void *)"#~" + 3B];
        D.19435 = *D.19434;
        D.19436 = (int) D.19435;
        D.19437 = __s2 + 3;
        D.19438 = *D.19437;
        D.19439 = (int) D.19438;
        __result = D.19436 - D.19439;
        <D.19433>:
        <D.19423>:
        <D.19413>:
      }
      D.18434 = __result;
    }
    iftmp.17 = -D.18434;
    goto <D.19440>;
    <D.19403>:
    D.19441 = ptr + 8;
    iftmp.17 = __builtin_strcmp (D.19441, "#~");
    <D.19440>:
    D.18435 = iftmp.17;
  }
  if (D.18435 == 0) goto <D.19442>; else goto <D.19443>;
  <D.19442>:
  D.19392 = image->raw_metadata;
  D.19444 = MEM[(const guint32 *)ptr];
  D.19445 = (sizetype) D.19444;
  D.19446 = D.19392 + D.19445;
  image->heap_tables.data = D.19446;
  D.19447 = MEM[(const guint32 *)ptr + 4B];
  image->heap_tables.size = D.19447;
  ptr = ptr + 11;
  goto <D.19448>;
  <D.19443>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 8;
    if (__s2_len <= 3) goto <D.19450>; else goto <D.19451>;
    <D.19450>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = ptr + 8;
      D.19452 = "#Strings";
      D.19453 = MEM[(const unsigned char *)D.19452];
      D.19454 = (int) D.19453;
      D.19455 = *__s2;
      D.19456 = (int) D.19455;
      __result = D.19454 - D.19456;
      {
        D.19457 = __s2_len != 0;
        D.19458 = __result == 0;
        D.19459 = D.19457 & D.19458;
        if (D.19459 != 0) goto <D.19460>; else goto <D.19461>;
        <D.19460>:
        D.19462 = &MEM[(void *)"#Strings" + 1B];
        D.19463 = *D.19462;
        D.19464 = (int) D.19463;
        D.19465 = __s2 + 1;
        D.19466 = *D.19465;
        D.19467 = (int) D.19466;
        __result = D.19464 - D.19467;
        D.19468 = __s2_len > 1;
        D.19458 = __result == 0;
        D.19469 = D.19468 & D.19458;
        if (D.19469 != 0) goto <D.19470>; else goto <D.19471>;
        <D.19470>:
        D.19472 = &MEM[(void *)"#Strings" + 2B];
        D.19473 = *D.19472;
        D.19474 = (int) D.19473;
        D.19475 = __s2 + 2;
        D.19476 = *D.19475;
        D.19477 = (int) D.19476;
        __result = D.19474 - D.19477;
        D.19478 = __s2_len > 2;
        D.19458 = __result == 0;
        D.19479 = D.19478 & D.19458;
        if (D.19479 != 0) goto <D.19480>; else goto <D.19481>;
        <D.19480>:
        D.19482 = &MEM[(void *)"#Strings" + 3B];
        D.19483 = *D.19482;
        D.19484 = (int) D.19483;
        D.19485 = __s2 + 3;
        D.19486 = *D.19485;
        D.19487 = (int) D.19486;
        __result = D.19484 - D.19487;
        <D.19481>:
        <D.19471>:
        <D.19461>:
      }
      D.18443 = __result;
    }
    iftmp.18 = -D.18443;
    goto <D.19488>;
    <D.19451>:
    D.19441 = ptr + 8;
    iftmp.18 = __builtin_strcmp (D.19441, "#Strings");
    <D.19488>:
    D.18444 = iftmp.18;
  }
  if (D.18444 == 0) goto <D.19489>; else goto <D.19490>;
  <D.19489>:
  D.19392 = image->raw_metadata;
  D.19444 = MEM[(const guint32 *)ptr];
  D.19445 = (sizetype) D.19444;
  D.19446 = D.19392 + D.19445;
  image->heap_strings.data = D.19446;
  D.19447 = MEM[(const guint32 *)ptr + 4B];
  image->heap_strings.size = D.19447;
  ptr = ptr + 17;
  goto <D.19491>;
  <D.19490>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 3;
    if (__s2_len <= 3) goto <D.19493>; else goto <D.19494>;
    <D.19493>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = ptr + 8;
      D.19495 = "#US";
      D.19496 = MEM[(const unsigned char *)D.19495];
      D.19497 = (int) D.19496;
      D.19498 = *__s2;
      D.19499 = (int) D.19498;
      __result = D.19497 - D.19499;
      {
        D.19500 = __s2_len != 0;
        D.19501 = __result == 0;
        D.19502 = D.19500 & D.19501;
        if (D.19502 != 0) goto <D.19503>; else goto <D.19504>;
        <D.19503>:
        D.19505 = &MEM[(void *)"#US" + 1B];
        D.19506 = *D.19505;
        D.19507 = (int) D.19506;
        D.19508 = __s2 + 1;
        D.19509 = *D.19508;
        D.19510 = (int) D.19509;
        __result = D.19507 - D.19510;
        D.19511 = __s2_len > 1;
        D.19501 = __result == 0;
        D.19512 = D.19511 & D.19501;
        if (D.19512 != 0) goto <D.19513>; else goto <D.19514>;
        <D.19513>:
        D.19515 = &MEM[(void *)"#US" + 2B];
        D.19516 = *D.19515;
        D.19517 = (int) D.19516;
        D.19518 = __s2 + 2;
        D.19519 = *D.19518;
        D.19520 = (int) D.19519;
        __result = D.19517 - D.19520;
        D.19521 = __s2_len > 2;
        D.19501 = __result == 0;
        D.19522 = D.19521 & D.19501;
        if (D.19522 != 0) goto <D.19523>; else goto <D.19524>;
        <D.19523>:
        D.19525 = &MEM[(void *)"#US" + 3B];
        D.19526 = *D.19525;
        D.19527 = (int) D.19526;
        D.19528 = __s2 + 3;
        D.19529 = *D.19528;
        D.19530 = (int) D.19529;
        __result = D.19527 - D.19530;
        <D.19524>:
        <D.19514>:
        <D.19504>:
      }
      D.18452 = __result;
    }
    iftmp.19 = -D.18452;
    goto <D.19531>;
    <D.19494>:
    D.19441 = ptr + 8;
    iftmp.19 = __builtin_strcmp (D.19441, "#US");
    <D.19531>:
    D.18453 = iftmp.19;
  }
  if (D.18453 == 0) goto <D.19532>; else goto <D.19533>;
  <D.19532>:
  D.19392 = image->raw_metadata;
  D.19444 = MEM[(const guint32 *)ptr];
  D.19445 = (sizetype) D.19444;
  D.19446 = D.19392 + D.19445;
  image->heap_us.data = D.19446;
  D.19447 = MEM[(const guint32 *)ptr + 4B];
  image->heap_us.size = D.19447;
  ptr = ptr + 12;
  goto <D.19534>;
  <D.19533>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.19536>; else goto <D.19537>;
    <D.19536>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = ptr + 8;
      D.19538 = "#Blob";
      D.19539 = MEM[(const unsigned char *)D.19538];
      D.19540 = (int) D.19539;
      D.19541 = *__s2;
      D.19542 = (int) D.19541;
      __result = D.19540 - D.19542;
      {
        D.19543 = __s2_len != 0;
        D.19544 = __result == 0;
        D.19545 = D.19543 & D.19544;
        if (D.19545 != 0) goto <D.19546>; else goto <D.19547>;
        <D.19546>:
        D.19548 = &MEM[(void *)"#Blob" + 1B];
        D.19549 = *D.19548;
        D.19550 = (int) D.19549;
        D.19551 = __s2 + 1;
        D.19552 = *D.19551;
        D.19553 = (int) D.19552;
        __result = D.19550 - D.19553;
        D.19554 = __s2_len > 1;
        D.19544 = __result == 0;
        D.19555 = D.19554 & D.19544;
        if (D.19555 != 0) goto <D.19556>; else goto <D.19557>;
        <D.19556>:
        D.19558 = &MEM[(void *)"#Blob" + 2B];
        D.19559 = *D.19558;
        D.19560 = (int) D.19559;
        D.19561 = __s2 + 2;
        D.19562 = *D.19561;
        D.19563 = (int) D.19562;
        __result = D.19560 - D.19563;
        D.19564 = __s2_len > 2;
        D.19544 = __result == 0;
        D.19565 = D.19564 & D.19544;
        if (D.19565 != 0) goto <D.19566>; else goto <D.19567>;
        <D.19566>:
        D.19568 = &MEM[(void *)"#Blob" + 3B];
        D.19569 = *D.19568;
        D.19570 = (int) D.19569;
        D.19571 = __s2 + 3;
        D.19572 = *D.19571;
        D.19573 = (int) D.19572;
        __result = D.19570 - D.19573;
        <D.19567>:
        <D.19557>:
        <D.19547>:
      }
      D.18461 = __result;
    }
    iftmp.20 = -D.18461;
    goto <D.19574>;
    <D.19537>:
    D.19441 = ptr + 8;
    iftmp.20 = __builtin_strcmp (D.19441, "#Blob");
    <D.19574>:
    D.18462 = iftmp.20;
  }
  if (D.18462 == 0) goto <D.19575>; else goto <D.19576>;
  <D.19575>:
  D.19392 = image->raw_metadata;
  D.19444 = MEM[(const guint32 *)ptr];
  D.19445 = (sizetype) D.19444;
  D.19446 = D.19392 + D.19445;
  image->heap_blob.data = D.19446;
  D.19447 = MEM[(const guint32 *)ptr + 4B];
  image->heap_blob.size = D.19447;
  ptr = ptr + 14;
  goto <D.19577>;
  <D.19576>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 5;
    if (__s2_len <= 3) goto <D.19579>; else goto <D.19580>;
    <D.19579>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = ptr + 8;
      D.19581 = "#GUID";
      D.19582 = MEM[(const unsigned char *)D.19581];
      D.19583 = (int) D.19582;
      D.19584 = *__s2;
      D.19585 = (int) D.19584;
      __result = D.19583 - D.19585;
      {
        D.19586 = __s2_len != 0;
        D.19587 = __result == 0;
        D.19588 = D.19586 & D.19587;
        if (D.19588 != 0) goto <D.19589>; else goto <D.19590>;
        <D.19589>:
        D.19591 = &MEM[(void *)"#GUID" + 1B];
        D.19592 = *D.19591;
        D.19593 = (int) D.19592;
        D.19594 = __s2 + 1;
        D.19595 = *D.19594;
        D.19596 = (int) D.19595;
        __result = D.19593 - D.19596;
        D.19597 = __s2_len > 1;
        D.19587 = __result == 0;
        D.19598 = D.19597 & D.19587;
        if (D.19598 != 0) goto <D.19599>; else goto <D.19600>;
        <D.19599>:
        D.19601 = &MEM[(void *)"#GUID" + 2B];
        D.19602 = *D.19601;
        D.19603 = (int) D.19602;
        D.19604 = __s2 + 2;
        D.19605 = *D.19604;
        D.19606 = (int) D.19605;
        __result = D.19603 - D.19606;
        D.19607 = __s2_len > 2;
        D.19587 = __result == 0;
        D.19608 = D.19607 & D.19587;
        if (D.19608 != 0) goto <D.19609>; else goto <D.19610>;
        <D.19609>:
        D.19611 = &MEM[(void *)"#GUID" + 3B];
        D.19612 = *D.19611;
        D.19613 = (int) D.19612;
        D.19614 = __s2 + 3;
        D.19615 = *D.19614;
        D.19616 = (int) D.19615;
        __result = D.19613 - D.19616;
        <D.19610>:
        <D.19600>:
        <D.19590>:
      }
      D.18470 = __result;
    }
    iftmp.21 = -D.18470;
    goto <D.19617>;
    <D.19580>:
    D.19441 = ptr + 8;
    iftmp.21 = __builtin_strcmp (D.19441, "#GUID");
    <D.19617>:
    D.18471 = iftmp.21;
  }
  if (D.18471 == 0) goto <D.19618>; else goto <D.19619>;
  <D.19618>:
  D.19392 = image->raw_metadata;
  D.19444 = MEM[(const guint32 *)ptr];
  D.19445 = (sizetype) D.19444;
  D.19446 = D.19392 + D.19445;
  image->heap_guid.data = D.19446;
  D.19447 = MEM[(const guint32 *)ptr + 4B];
  image->heap_guid.size = D.19447;
  ptr = ptr + 14;
  goto <D.19620>;
  <D.19619>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 2;
    if (__s2_len <= 3) goto <D.19622>; else goto <D.19623>;
    <D.19622>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = ptr + 8;
      D.19624 = "#-";
      D.19625 = MEM[(const unsigned char *)D.19624];
      D.19626 = (int) D.19625;
      D.19627 = *__s2;
      D.19628 = (int) D.19627;
      __result = D.19626 - D.19628;
      {
        D.19629 = __s2_len != 0;
        D.19630 = __result == 0;
        D.19631 = D.19629 & D.19630;
        if (D.19631 != 0) goto <D.19632>; else goto <D.19633>;
        <D.19632>:
        D.19634 = &MEM[(void *)"#-" + 1B];
        D.19635 = *D.19634;
        D.19636 = (int) D.19635;
        D.19637 = __s2 + 1;
        D.19638 = *D.19637;
        D.19639 = (int) D.19638;
        __result = D.19636 - D.19639;
        D.19640 = __s2_len > 1;
        D.19630 = __result == 0;
        D.19641 = D.19640 & D.19630;
        if (D.19641 != 0) goto <D.19642>; else goto <D.19643>;
        <D.19642>:
        D.19644 = &MEM[(void *)"#-" + 2B];
        D.19645 = *D.19644;
        D.19646 = (int) D.19645;
        D.19647 = __s2 + 2;
        D.19648 = *D.19647;
        D.19649 = (int) D.19648;
        __result = D.19646 - D.19649;
        D.19650 = __s2_len > 2;
        D.19630 = __result == 0;
        D.19651 = D.19650 & D.19630;
        if (D.19651 != 0) goto <D.19652>; else goto <D.19653>;
        <D.19652>:
        D.19654 = &MEM[(void *)"#-" + 3B];
        D.19655 = *D.19654;
        D.19656 = (int) D.19655;
        D.19657 = __s2 + 3;
        D.19658 = *D.19657;
        D.19659 = (int) D.19658;
        __result = D.19656 - D.19659;
        <D.19653>:
        <D.19643>:
        <D.19633>:
      }
      D.18479 = __result;
    }
    iftmp.22 = -D.18479;
    goto <D.19660>;
    <D.19623>:
    D.19441 = ptr + 8;
    iftmp.22 = __builtin_strcmp (D.19441, "#-");
    <D.19660>:
    D.18480 = iftmp.22;
  }
  if (D.18480 == 0) goto <D.19661>; else goto <D.19662>;
  <D.19661>:
  D.19392 = image->raw_metadata;
  D.19444 = MEM[(const guint32 *)ptr];
  D.19445 = (sizetype) D.19444;
  D.19446 = D.19392 + D.19445;
  image->heap_tables.data = D.19446;
  D.19447 = MEM[(const guint32 *)ptr + 4B];
  image->heap_tables.size = D.19447;
  ptr = ptr + 11;
  image->uncompressed_metadata = 1;
  D.19663 = image->name;
  mono_trace (64, 1, "Assembly \'%s\' has the non-standard metadata heap #-.\nRecompile it correctly (without the /incremental switch or in Release mode).\n", D.19663);
  goto <D.19664>;
  <D.19662>:
  D.19665 = ptr + 8;
  monoeg_g_log (0B, 32, "Unknown heap type: %s\n", D.19665);
  D.19441 = ptr + 8;
  D.19666 = strlen (D.19441);
  D.19667 = D.19666 + 9;
  ptr = ptr + D.19667;
  <D.19664>:
  <D.19620>:
  <D.19577>:
  <D.19534>:
  <D.19491>:
  <D.19448>:
  ptr.16 = (long int) ptr;
  D.19392 = image->raw_metadata;
  D.19393 = (long int) D.19392;
  D.19394 = ptr.16 - D.19393;
  pad = (guint32) D.19394;
  D.19395 = pad & 3;
  if (D.19395 != 0) goto <D.19668>; else goto <D.19669>;
  <D.19668>:
  D.19395 = pad & 3;
  D.19398 = 4 - D.19395;
  D.19399 = (sizetype) D.19398;
  ptr = ptr + D.19399;
  <D.19669>:
  i = i + 1;
  <D.18482>:
  D.19670 = (int) streams;
  if (D.19670 > i) goto <D.18481>; else goto <D.18483>;
  <D.18483>:
  D.19671 = image->heap_guid.data;
  D.19672 = D.19671 == 0B;
  D.19673 = (long int) D.19672;
  D.19674 = __builtin_expect (D.19673, 0);
  if (D.19674 != 0) goto <D.19675>; else goto <D.19676>;
  <D.19675>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 465, "image->heap_guid.data");
  <D.19676>:
  D.19677 = image->heap_guid.size;
  D.19678 = D.19677 <= 15;
  D.19679 = (long int) D.19678;
  D.19680 = __builtin_expect (D.19679, 0);
  if (D.19680 != 0) goto <D.19681>; else goto <D.19682>;
  <D.19681>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 466, "image->heap_guid.size >= 16");
  <D.19682>:
  D.19671 = image->heap_guid.data;
  D.19683 = mono_guid_to_string (D.19671);
  image->guid = D.19683;
  D.19375 = 1;
  return D.19375;
}


load_tables (struct MonoImage * image)
{
  const char * D.19685;
  char D.19686;
  int D.19687;
  _Bool D.19688;
  int D.19689;
  _Bool D.19690;
  int D.19691;
  _Bool D.19692;
  long unsigned int D.19693;
  long unsigned int D.19694;
  unsigned int D.19702;
  <unnamed-unsigned:24> D.19703;
  int D.19704;
  sizetype D.19705;
  sizetype D.19706;
  const char * D.19707;
  const char * D.19708;
  _Bool D.19709;
  long int D.19710;
  long int D.19711;
  gboolean D.19714;
  const char * heap_tables;
  const guint32 * rows;
  guint64 valid_mask;
  guint64 sorted_mask;
  int valid;
  int table;
  int heap_sizes;

  heap_tables = image->heap_tables.data;
  valid = 0;
  D.19685 = heap_tables + 6;
  D.19686 = *D.19685;
  heap_sizes = (int) D.19686;
  D.19687 = heap_sizes & 1;
  D.19688 = D.19687 != 0;
  image->idx_string_wide = D.19688;
  D.19689 = heap_sizes & 2;
  D.19690 = D.19689 != 0;
  image->idx_guid_wide = D.19690;
  D.19691 = heap_sizes & 4;
  D.19692 = D.19691 != 0;
  image->idx_blob_wide = D.19692;
  valid_mask = MEM[(const guint64 *)heap_tables + 8B];
  sorted_mask = MEM[(const guint64 *)heap_tables + 16B];
  rows = heap_tables + 24;
  table = 0;
  goto <D.18496>;
  <D.18495>:
  D.19693 = valid_mask >> table;
  D.19694 = D.19693 & 1;
  if (D.19694 == 0) goto <D.19695>; else goto <D.19696>;
  <D.19695>:
  if (table > 44) goto <D.19697>; else goto <D.19698>;
  <D.19697>:
  // predicted unlikely by continue predictor.
  goto <D.18494>;
  <D.19698>:
  image->tables[table].rows = 0;
  // predicted unlikely by continue predictor.
  goto <D.18494>;
  <D.19696>:
  if (table > 44) goto <D.19699>; else goto <D.19700>;
  <D.19699>:
  monoeg_g_log (0B, 16, "bits in valid must be zero above 0x2d (II - 23.1.6)");
  goto <D.19701>;
  <D.19700>:
  D.19702 = *rows;
  D.19703 = (<unnamed-unsigned:24>) D.19702;
  image->tables[table].rows = D.19703;
  <D.19701>:
  rows = rows + 4;
  valid = valid + 1;
  <D.18494>:
  table = table + 1;
  <D.18496>:
  if (table <= 63) goto <D.18495>; else goto <D.18497>;
  <D.18497>:
  D.19704 = valid * 4;
  D.19705 = (sizetype) D.19704;
  D.19706 = D.19705 + 24;
  D.19707 = heap_tables + D.19706;
  image->tables_base = D.19707;
  D.19708 = image->tables_base;
  D.19709 = D.19708 != rows;
  D.19710 = (long int) D.19709;
  D.19711 = __builtin_expect (D.19710, 0);
  if (D.19711 != 0) goto <D.19712>; else goto <D.19713>;
  <D.19712>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 516, "(const void *) image->tables_base == (const void *) rows");
  <D.19713>:
  mono_metadata_compute_table_bases (image);
  D.19714 = 1;
  return D.19714;
}


mono_image_load_names (struct MonoImage * image)
{
  unsigned int D.19716;
  unsigned int D.19717;
  struct MonoTableInfo * D.19720;
  unsigned int D.19721;
  const char * D.19722;
  struct MonoTableInfo * D.19723;
  unsigned int D.19724;
  const char * D.19725;

  D.19716 = BIT_FIELD_REF <*image, 32, 5696>;
  D.19717 = D.19716 & 16777215;
  if (D.19717 != 0) goto <D.19718>; else goto <D.19719>;
  <D.19718>:
  D.19720 = &image->tables[32];
  D.19721 = mono_metadata_decode_row_col (D.19720, 0, 7);
  D.19722 = mono_metadata_string_heap (image, D.19721);
  image->assembly_name = D.19722;
  <D.19719>:
  D.19723 = &image->tables[0];
  D.19724 = mono_metadata_decode_row_col (D.19723, 0, 1);
  D.19725 = mono_metadata_string_heap (image, D.19724);
  image->module_name = D.19725;
}


mono_image_loaded_full (const char * name, gboolean refonly)
{
  struct GHashTable * iftmp.23;
  int mutex_inited.24;
  _Bool D.19735;
  long int D.19736;
  long int D.19737;
  _Bool D.19744;
  long int D.19745;
  long int D.19746;
  struct MonoImage * D.19749;
  struct MonoImage * res;
  struct GHashTable * loaded_images;

  if (refonly != 0) goto <D.19727>; else goto <D.19728>;
  <D.19727>:
  iftmp.23 = loaded_images_refonly_hash;
  goto <D.19729>;
  <D.19728>:
  iftmp.23 = loaded_images_hash;
  <D.19729>:
  loaded_images = iftmp.23;
  mutex_inited.24 = mutex_inited;
  if (mutex_inited.24 != 0) goto <D.19731>; else goto <D.19732>;
  <D.19731>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19733>; else goto <D.19734>;
    <D.19733>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19734>:
    D.19735 = ret != 0;
    D.19736 = (long int) D.19735;
    D.19737 = __builtin_expect (D.19736, 0);
    if (D.19737 != 0) goto <D.19738>; else goto <D.19739>;
    <D.19738>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1060, "ret == 0");
    <D.19739>:
  }
  <D.19732>:
  res = monoeg_g_hash_table_lookup (loaded_images, name);
  mutex_inited.24 = mutex_inited;
  if (mutex_inited.24 != 0) goto <D.19740>; else goto <D.19741>;
  <D.19740>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19742>; else goto <D.19743>;
    <D.19742>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19743>:
    D.19744 = ret != 0;
    D.19745 = (long int) D.19744;
    D.19746 = __builtin_expect (D.19745, 0);
    if (D.19746 != 0) goto <D.19747>; else goto <D.19748>;
    <D.19747>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1062, "ret == 0");
    <D.19748>:
  }
  <D.19741>:
  D.19749 = res;
  return D.19749;
}


mono_image_loaded (const char * name)
{
  struct MonoImage * D.19751;

  D.19751 = mono_image_loaded_full (name, 0);
  return D.19751;
}


mono_image_loaded_by_guid_full (const char * guid, gboolean refonly)
{
  struct GHashTable * iftmp.25;
  int mutex_inited.26;
  _Bool D.19762;
  long int D.19763;
  long int D.19764;
  _Bool D.19771;
  long int D.19772;
  long int D.19773;
  struct MonoImage * D.19776;
  struct GuidData data;
  struct GHashTable * loaded_images;

  try
    {
      if (refonly != 0) goto <D.19754>; else goto <D.19755>;
      <D.19754>:
      iftmp.25 = loaded_images_refonly_hash;
      goto <D.19756>;
      <D.19755>:
      iftmp.25 = loaded_images_hash;
      <D.19756>:
      loaded_images = iftmp.25;
      data.res = 0B;
      data.guid = guid;
      mutex_inited.26 = mutex_inited;
      if (mutex_inited.26 != 0) goto <D.19758>; else goto <D.19759>;
      <D.19758>:
      {
        int ret;

        ret = pthread_mutex_lock (&images_mutex.mutex);
        if (ret != 0) goto <D.19760>; else goto <D.19761>;
        <D.19760>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.19761>:
        D.19762 = ret != 0;
        D.19763 = (long int) D.19762;
        D.19764 = __builtin_expect (D.19763, 0);
        if (D.19764 != 0) goto <D.19765>; else goto <D.19766>;
        <D.19765>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1106, "ret == 0");
        <D.19766>:
      }
      <D.19759>:
      monoeg_g_hash_table_foreach (loaded_images, find_by_guid, &data);
      mutex_inited.26 = mutex_inited;
      if (mutex_inited.26 != 0) goto <D.19767>; else goto <D.19768>;
      <D.19767>:
      {
        int ret;

        ret = pthread_mutex_unlock (&images_mutex.mutex);
        if (ret != 0) goto <D.19769>; else goto <D.19770>;
        <D.19769>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19770>:
        D.19771 = ret != 0;
        D.19772 = (long int) D.19771;
        D.19773 = __builtin_expect (D.19772, 0);
        if (D.19773 != 0) goto <D.19774>; else goto <D.19775>;
        <D.19774>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1108, "ret == 0");
        <D.19775>:
      }
      <D.19768>:
      D.19776 = data.res;
      return D.19776;
    }
  finally
    {
      data = {CLOBBER};
    }
}


find_by_guid (void * key, void * val, void * user_data)
{
  struct MonoImage * D.19779;
  int D.18655;
  const char * D.19782;
  const char * D.19783;
  struct GuidData * data;
  struct MonoImage * image;

  data = user_data;
  D.19779 = data->res;
  if (D.19779 != 0B) goto <D.19780>; else goto <D.19781>;
  <D.19780>:
  return;
  <D.19781>:
  image = val;
  {
    size_t __s1_len;
    size_t __s2_len;

    D.19782 = mono_image_get_guid (image);
    D.19783 = data->guid;
    D.18655 = __builtin_strcmp (D.19783, D.19782);
  }
  if (D.18655 == 0) goto <D.19784>; else goto <D.19785>;
  <D.19784>:
  data->res = image;
  <D.19785>:
}


mono_image_loaded_by_guid (const char * guid)
{
  struct MonoImage * D.19787;

  D.19787 = mono_image_loaded_by_guid_full (guid, 0);
  return D.19787;
}


mono_image_open_from_data_with_name (char * data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus * status, gboolean refonly, const char * name)
{
  _Bool D.19789;
  _Bool D.19790;
  _Bool D.19791;
  struct MonoImage * D.19796;
  long unsigned int D.19799;
  long unsigned int D.19804;
  unsigned char D.19805;
  <unnamed-unsigned:1> D.19806;
  gchar * iftmp.27;
  unsigned char D.19811;
  <unnamed-unsigned:1> D.19812;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  char * datac;

  D.19789 = data == 0B;
  D.19790 = data_len == 0;
  D.19791 = D.19789 | D.19790;
  if (D.19791 != 0) goto <D.19792>; else goto <D.19793>;
  <D.19792>:
  if (status != 0B) goto <D.19794>; else goto <D.19795>;
  <D.19794>:
  *status = 3;
  <D.19795>:
  D.19796 = 0B;
  return D.19796;
  <D.19793>:
  datac = data;
  if (need_copy != 0) goto <D.19797>; else goto <D.19798>;
  <D.19797>:
  D.19799 = (long unsigned int) data_len;
  datac = monoeg_try_malloc (D.19799);
  if (datac == 0B) goto <D.19800>; else goto <D.19801>;
  <D.19800>:
  if (status != 0B) goto <D.19802>; else goto <D.19803>;
  <D.19802>:
  *status = 1;
  <D.19803>:
  D.19796 = 0B;
  return D.19796;
  <D.19801>:
  D.19804 = (long unsigned int) data_len;
  memcpy (datac, data, D.19804);
  <D.19798>:
  image = monoeg_malloc0 (1568);
  image->raw_data = datac;
  image->raw_data_len = data_len;
  D.19805 = (unsigned char) need_copy;
  D.19806 = (<unnamed-unsigned:1>) D.19805;
  image->raw_data_allocated = D.19806;
  if (name == 0B) goto <D.19808>; else goto <D.19809>;
  <D.19808>:
  iftmp.27 = monoeg_g_strdup_printf ("data-%p", datac);
  goto <D.19810>;
  <D.19809>:
  iftmp.27 = monoeg_strdup (name);
  <D.19810>:
  image->name = iftmp.27;
  iinfo = monoeg_malloc0 (408);
  image->image_info = iinfo;
  D.19811 = (unsigned char) refonly;
  D.19812 = (<unnamed-unsigned:1>) D.19811;
  image->ref_only = D.19812;
  image = do_mono_image_load (image, status, 1, 1);
  if (image == 0B) goto <D.19813>; else goto <D.19814>;
  <D.19813>:
  D.19796 = 0B;
  return D.19796;
  <D.19814>:
  D.19796 = register_image (image);
  return D.19796;
}


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

  if (str != 0B) goto <D.19816>; else goto <D.19817>;
  <D.19816>:
  D.19818 = __strdup (str);
  return D.19818;
  <D.19817>:
  D.19818 = 0B;
  return D.19818;
}


do_mono_image_load (struct MonoImage * image, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff)
{
  int D.19823;
  int D.19825;
  int D.19828;
  int D.19830;
  int D.19832;
  struct MonoImage * D.19836;
  struct GSList * errors.28;
  char * D.19840;
  char * D.19841;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct GSList * errors;
  void done = <<< error >>>;
  void invalid_image = <<< error >>>;

  try
    {
      errors = 0B;
      mono_profiler_module_event (image, 0);
      mono_image_init (image);
      iinfo = image->image_info;
      header = &iinfo->cli_header;
      if (status != 0B) goto <D.19820>; else goto <D.19821>;
      <D.19820>:
      *status = 3;
      <D.19821>:
      if (care_about_pecoff == 0) goto done; else goto <D.19822>;
      <D.19822>:
      D.19823 = mono_verifier_verify_pe_data (image, &errors);
      if (D.19823 == 0) goto invalid_image; else goto <D.19824>;
      <D.19824>:
      D.19825 = mono_image_load_pe_data (image);
      if (D.19825 == 0) goto invalid_image; else goto <D.19826>;
      <D.19826>:
      if (care_about_cli == 0) goto done; else goto <D.19827>;
      <D.19827>:
      D.19828 = mono_verifier_verify_cli_data (image, &errors);
      if (D.19828 == 0) goto invalid_image; else goto <D.19829>;
      <D.19829>:
      D.19830 = mono_image_load_cli_data (image);
      if (D.19830 == 0) goto invalid_image; else goto <D.19831>;
      <D.19831>:
      D.19832 = mono_verifier_verify_table_data (image, &errors);
      if (D.19832 == 0) goto invalid_image; else goto <D.19833>;
      <D.19833>:
      mono_image_load_names (image);
      load_modules (image);
      done:
      mono_profiler_module_loaded (image, 0);
      if (status != 0B) goto <D.19834>; else goto <D.19835>;
      <D.19834>:
      *status = 0;
      <D.19835>:
      D.19836 = image;
      return D.19836;
      invalid_image:
      errors.28 = errors;
      if (errors.28 != 0B) goto <D.19838>; else goto <D.19839>;
      <D.19838>:
      {
        struct MonoVerifyInfo * info;

        errors.28 = errors;
        info = errors.28->data;
        D.19840 = info->message;
        D.19841 = image->name;
        monoeg_g_log (0B, 16, "Could not load image %s due to %s", D.19841, D.19840);
        errors.28 = errors;
        mono_free_verify_list (errors.28);
      }
      <D.19839>:
      mono_profiler_module_loaded (image, 1);
      mono_image_close (image);
      D.19836 = 0B;
      return D.19836;
    }
  finally
    {
      errors = {CLOBBER};
    }
}


load_modules (struct MonoImage * image)
{
  struct MonoImage * * D.19844;
  <unnamed-unsigned:24> D.19847;
  long unsigned int D.19848;
  long unsigned int D.19849;
  void * D.19850;
  long unsigned int D.19851;
  void * D.19852;
  unsigned int D.19853;
  struct MonoTableInfo * t;

  D.19844 = image->modules;
  if (D.19844 != 0B) goto <D.19845>; else goto <D.19846>;
  <D.19845>:
  return;
  <D.19846>:
  t = &image->tables[26];
  D.19847 = t->rows;
  D.19848 = (long unsigned int) D.19847;
  D.19849 = D.19848 * 8;
  D.19850 = monoeg_malloc0 (D.19849);
  image->modules = D.19850;
  D.19847 = t->rows;
  D.19848 = (long unsigned int) D.19847;
  D.19851 = D.19848 * 4;
  D.19852 = monoeg_malloc0 (D.19851);
  image->modules_loaded = D.19852;
  D.19847 = t->rows;
  D.19853 = (unsigned int) D.19847;
  image->module_count = D.19853;
}


register_image (struct MonoImage * image)
{
  struct GHashTable * iftmp.29;
  unsigned char D.19856;
  unsigned char D.19857;
  int mutex_inited.30;
  _Bool D.19866;
  long int D.19867;
  long int D.19868;
  char * D.19871;
  _Bool D.19878;
  long int D.19879;
  long int D.19880;
  struct MonoImage * D.19883;
  const char * D.19884;
  void * D.19887;
  _Bool D.19894;
  long int D.19895;
  long int D.19896;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;

  D.19856 = BIT_FIELD_REF <*image, 8, 224>;
  D.19857 = D.19856 & 16;
  if (D.19857 != 0) goto <D.19858>; else goto <D.19859>;
  <D.19858>:
  iftmp.29 = loaded_images_refonly_hash;
  goto <D.19860>;
  <D.19859>:
  iftmp.29 = loaded_images_hash;
  <D.19860>:
  loaded_images = iftmp.29;
  mutex_inited.30 = mutex_inited;
  if (mutex_inited.30 != 0) goto <D.19862>; else goto <D.19863>;
  <D.19862>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19864>; else goto <D.19865>;
    <D.19864>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19865>:
    D.19866 = ret != 0;
    D.19867 = (long int) D.19866;
    D.19868 = __builtin_expect (D.19867, 0);
    if (D.19868 != 0) goto <D.19869>; else goto <D.19870>;
    <D.19869>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1124, "ret == 0");
    <D.19870>:
  }
  <D.19863>:
  D.19871 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.19871);
  if (image2 != 0B) goto <D.19872>; else goto <D.19873>;
  <D.19872>:
  mono_image_addref (image2);
  mutex_inited.30 = mutex_inited;
  if (mutex_inited.30 != 0) goto <D.19874>; else goto <D.19875>;
  <D.19874>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19876>; else goto <D.19877>;
    <D.19876>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19877>:
    D.19878 = ret != 0;
    D.19879 = (long int) D.19878;
    D.19880 = __builtin_expect (D.19879, 0);
    if (D.19880 != 0) goto <D.19881>; else goto <D.19882>;
    <D.19881>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1130, "ret == 0");
    <D.19882>:
  }
  <D.19875>:
  mono_image_close (image);
  D.19883 = image2;
  return D.19883;
  <D.19873>:
  D.19871 = image->name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.19871, image, 0);
  D.19884 = image->assembly_name;
  if (D.19884 != 0B) goto <D.19885>; else goto <D.19886>;
  <D.19885>:
  D.19884 = image->assembly_name;
  D.19887 = monoeg_g_hash_table_lookup (loaded_images, D.19884);
  if (D.19887 == 0B) goto <D.19888>; else goto <D.19889>;
  <D.19888>:
  D.19884 = image->assembly_name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.19884, image, 0);
  <D.19889>:
  <D.19886>:
  mutex_inited.30 = mutex_inited;
  if (mutex_inited.30 != 0) goto <D.19890>; else goto <D.19891>;
  <D.19890>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19892>; else goto <D.19893>;
    <D.19892>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19893>:
    D.19894 = ret != 0;
    D.19895 = (long int) D.19894;
    D.19896 = __builtin_expect (D.19895, 0);
    if (D.19896 != 0) goto <D.19897>; else goto <D.19898>;
    <D.19897>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1137, "ret == 0");
    <D.19898>:
  }
  <D.19891>:
  D.19883 = image;
  return D.19883;
}


mono_image_open_from_data_full (char * data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus * status, gboolean refonly)
{
  struct MonoImage * D.19900;

  D.19900 = mono_image_open_from_data_with_name (data, data_len, need_copy, status, refonly, 0B);
  return D.19900;
}


mono_image_open_from_data (char * data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus * status)
{
  struct MonoImage * D.19902;

  D.19902 = mono_image_open_from_data_full (data, data_len, need_copy, status, 0);
  return D.19902;
}


mono_image_open_full (const char * fname, MonoImageOpenStatus * status, gboolean refonly)
{
  struct MonoImage * D.19906;
  int mutex_inited.31;
  _Bool D.19912;
  long int D.19913;
  long int D.19914;
  struct GHashTable * iftmp.32;
  _Bool D.19927;
  long int D.19928;
  long int D.19929;
  _Bool D.19936;
  long int D.19937;
  long int D.19938;
  struct MonoImage * image;
  struct GHashTable * loaded_images;
  char * absfname;

  if (fname == 0B) goto <D.19904>; else goto <D.19905>;
  <D.19904>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1225, "fname != NULL");
  D.19906 = 0B;
  return D.19906;
  <D.19905>:
  absfname = mono_path_canonicalize (fname);
  mutex_inited.31 = mutex_inited;
  if (mutex_inited.31 != 0) goto <D.19908>; else goto <D.19909>;
  <D.19908>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19910>; else goto <D.19911>;
    <D.19910>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19911>:
    D.19912 = ret != 0;
    D.19913 = (long int) D.19912;
    D.19914 = __builtin_expect (D.19913, 0);
    if (D.19914 != 0) goto <D.19915>; else goto <D.19916>;
    <D.19915>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1305, "ret == 0");
    <D.19916>:
  }
  <D.19909>:
  if (refonly != 0) goto <D.19918>; else goto <D.19919>;
  <D.19918>:
  iftmp.32 = loaded_images_refonly_hash;
  goto <D.19920>;
  <D.19919>:
  iftmp.32 = loaded_images_hash;
  <D.19920>:
  loaded_images = iftmp.32;
  image = monoeg_g_hash_table_lookup (loaded_images, absfname);
  monoeg_g_free (absfname);
  if (image != 0B) goto <D.19921>; else goto <D.19922>;
  <D.19921>:
  mono_image_addref (image);
  mutex_inited.31 = mutex_inited;
  if (mutex_inited.31 != 0) goto <D.19923>; else goto <D.19924>;
  <D.19923>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19925>; else goto <D.19926>;
    <D.19925>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19926>:
    D.19927 = ret != 0;
    D.19928 = (long int) D.19927;
    D.19929 = __builtin_expect (D.19928, 0);
    if (D.19929 != 0) goto <D.19930>; else goto <D.19931>;
    <D.19930>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1312, "ret == 0");
    <D.19931>:
  }
  <D.19924>:
  D.19906 = image;
  return D.19906;
  <D.19922>:
  mutex_inited.31 = mutex_inited;
  if (mutex_inited.31 != 0) goto <D.19932>; else goto <D.19933>;
  <D.19932>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19934>; else goto <D.19935>;
    <D.19934>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19935>:
    D.19936 = ret != 0;
    D.19937 = (long int) D.19936;
    D.19938 = __builtin_expect (D.19937, 0);
    if (D.19938 != 0) goto <D.19939>; else goto <D.19940>;
    <D.19939>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1315, "ret == 0");
    <D.19940>:
  }
  <D.19933>:
  image = do_mono_image_open (fname, status, 1, 1, refonly);
  if (image == 0B) goto <D.19941>; else goto <D.19942>;
  <D.19941>:
  D.19906 = 0B;
  return D.19906;
  <D.19942>:
  D.19906 = register_image (image);
  return D.19906;
}


do_mono_image_open (const char * fname, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly)
{
  int __mono_io_portability_helpers.33;
  struct MonoImage * D.19955;
  long unsigned int D.19956;
  unsigned int D.19957;
  void * * D.19958;
  int D.19959;
  unsigned int D.19960;
  long unsigned int D.19961;
  void * D.19962;
  char * D.19963;
  int D.19966;
  void * D.19967;
  gchar * D.19972;
  unsigned char D.19973;
  <unnamed-unsigned:1> D.19974;
  int D.19975;
  unsigned char D.19976;
  <unnamed-unsigned:1> D.19977;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  struct MonoFileMap * filed;

  filed = mono_file_map_open (fname);
  if (filed == 0B) goto <D.19944>; else goto <D.19945>;
  <D.19944>:
  __mono_io_portability_helpers.33 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.33 > 0) goto <D.19947>; else goto <D.19948>;
  <D.19947>:
  {
    gchar * ffname;

    ffname = mono_portability_find_file (fname, 1);
    if (ffname != 0B) goto <D.19949>; else goto <D.19950>;
    <D.19949>:
    filed = mono_file_map_open (ffname);
    monoeg_g_free (ffname);
    <D.19950>:
  }
  <D.19948>:
  if (filed == 0B) goto <D.19951>; else goto <D.19952>;
  <D.19951>:
  if (status != 0B) goto <D.19953>; else goto <D.19954>;
  <D.19953>:
  *status = 1;
  <D.19954>:
  D.19955 = 0B;
  return D.19955;
  <D.19952>:
  <D.19945>:
  image = monoeg_malloc0 (1568);
  image->raw_buffer_used = 1;
  D.19956 = mono_file_map_size (filed);
  D.19957 = (unsigned int) D.19956;
  image->raw_data_len = D.19957;
  D.19958 = &image->raw_data_handle;
  D.19959 = mono_file_map_fd (filed);
  D.19960 = image->raw_data_len;
  D.19961 = (long unsigned int) D.19960;
  D.19962 = mono_file_map (D.19961, 17, D.19959, 0, D.19958);
  image->raw_data = D.19962;
  D.19963 = image->raw_data;
  if (D.19963 == 0B) goto <D.19964>; else goto <D.19965>;
  <D.19964>:
  image->fileio_used = 1;
  D.19958 = &image->raw_data_handle;
  D.19966 = mono_file_map_fd (filed);
  D.19960 = image->raw_data_len;
  D.19961 = (long unsigned int) D.19960;
  D.19967 = mono_file_map_fileio (D.19961, 17, D.19966, 0, D.19958);
  image->raw_data = D.19967;
  <D.19965>:
  D.19963 = image->raw_data;
  if (D.19963 == 0B) goto <D.19968>; else goto <D.19969>;
  <D.19968>:
  mono_file_map_close (filed);
  monoeg_g_free (image);
  if (status != 0B) goto <D.19970>; else goto <D.19971>;
  <D.19970>:
  *status = 3;
  <D.19971>:
  D.19955 = 0B;
  return D.19955;
  <D.19969>:
  iinfo = monoeg_malloc0 (408);
  image->image_info = iinfo;
  D.19972 = mono_path_resolve_symlinks (fname);
  image->name = D.19972;
  D.19973 = (unsigned char) refonly;
  D.19974 = (<unnamed-unsigned:1>) D.19973;
  image->ref_only = D.19974;
  image->ref_count = 1;
  D.19975 = mono_security_core_clr_determine_platform_image (image);
  D.19976 = (unsigned char) D.19975;
  D.19977 = (<unnamed-unsigned:1>) D.19976;
  image->core_clr_platform_code = D.19977;
  mono_file_map_close (filed);
  D.19955 = do_mono_image_load (image, status, care_about_cli, care_about_pecoff);
  return D.19955;
}


mono_image_open (const char * fname, MonoImageOpenStatus * status)
{
  struct MonoImage * D.19979;

  D.19979 = mono_image_open_full (fname, status, 0);
  return D.19979;
}


mono_pe_file_open (const char * fname, MonoImageOpenStatus * status)
{
  struct MonoImage * D.19983;

  if (fname == 0B) goto <D.19981>; else goto <D.19982>;
  <D.19981>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1354, "fname != NULL");
  D.19983 = 0B;
  return D.19983;
  <D.19982>:
  D.19983 = do_mono_image_open (fname, status, 0, 1, 0);
  return D.19983;
}


mono_image_open_raw (const char * fname, MonoImageOpenStatus * status)
{
  struct MonoImage * D.19987;

  if (fname == 0B) goto <D.19985>; else goto <D.19986>;
  <D.19985>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1371, "fname != NULL");
  D.19987 = 0B;
  return D.19987;
  <D.19986>:
  D.19987 = do_mono_image_open (fname, status, 0, 0, 0);
  return D.19987;
}


mono_image_fixup_vtable (struct MonoImage * image)
{
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image.c", 1423);
}


mono_image_addref (struct MonoImage * image)
{
  int * D.19989;

  D.19989 = &image->ref_count;
  InterlockedIncrement (D.19989);
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.19990;
  unsigned int D.19991;

  D.19991 = __sync_add_and_fetch_4 (val, 1);
  D.19990 = (gint32) D.19991;
  return D.19990;
}


mono_dynamic_stream_reset (struct MonoDynamicStream * stream)
{
  unsigned int D.19993;
  unsigned int D.19994;
  char * D.19995;
  struct GHashTable * D.19996;

  stream->offset = 0;
  D.19993 = stream->offset;
  stream->index = D.19993;
  D.19994 = stream->index;
  stream->alloc_size = D.19994;
  D.19995 = stream->data;
  monoeg_g_free (D.19995);
  stream->data = 0B;
  D.19996 = stream->hash;
  if (D.19996 != 0B) goto <D.19997>; else goto <D.19998>;
  <D.19997>:
  D.19996 = stream->hash;
  monoeg_g_hash_table_destroy (D.19996);
  stream->hash = 0B;
  <D.19998>:
}


mono_image_close_except_pools (struct MonoImage * image)
{
  gboolean D.20001;
  int mutex_inited.34;
  _Bool D.20007;
  long int D.20008;
  long int D.20009;
  int * D.20012;
  int D.20013;
  _Bool D.20020;
  long int D.20021;
  long int D.20022;
  struct GHashTable * iftmp.35;
  unsigned char D.20026;
  unsigned char D.20027;
  char * D.20031;
  const char * D.20034;
  void * D.20037;
  _Bool D.20044;
  long int D.20045;
  long int D.20046;
  struct MonoAssembly * * D.20051;
  unsigned char D.20053;
  long unsigned int D.20055;
  long unsigned int D.20056;
  struct MonoAssembly * * D.20057;
  struct MonoAssembly * D.20058;
  struct MonoAssembly * D.20059;
  int D.20062;
  int D.20065;
  unsigned char D.20068;
  char * D.20071;
  unsigned char D.20074;
  void * D.20077;
  unsigned char D.20079;
  char * D.20082;
  unsigned int D.20085;
  sizetype D.20086;
  char * D.20087;
  void * * D.20090;
  void * * D.20091;
  void * D.20092;
  int D.20097;
  int debug_assembly_unload.36;
  gchar * D.20101;
  char * D.20103;
  char * D.20104;
  struct MonoImage * * D.20105;
  struct GHashTable * D.20106;
  struct GHashTable * D.20109;
  struct MonoInternalHashTable * D.20112;
  struct GHashTable * D.20113;
  struct GHashTable * D.20114;
  struct GHashTable * D.20117;
  struct GHashTable * D.20120;
  struct GHashTable * D.20123;
  struct GHashTable * D.20126;
  struct GHashTable * D.20127;
  struct GHashTable * D.20128;
  struct GHashTable * D.20129;
  struct GHashTable * D.20130;
  struct GHashTable * D.20131;
  struct GHashTable * D.20132;
  struct GHashTable * D.20133;
  struct GHashTable * D.20134;
  struct GHashTable * D.20135;
  struct GHashTable * D.20136;
  struct GHashTable * D.20137;
  struct GHashTable * D.20138;
  struct GHashTable * D.20139;
  struct GHashTable * D.20140;
  struct GHashTable * D.20141;
  struct GHashTable * D.20142;
  struct GHashTable * D.20143;
  struct GHashTable * D.20144;
  struct GHashTable * D.20145;
  struct GHashTable * D.20146;
  struct GHashTable * D.20147;
  struct GHashTable * D.20148;
  struct GHashTable * D.20149;
  struct GHashTable * D.20150;
  struct GHashTable * D.20151;
  struct GHashTable * D.20152;
  struct GHashTable * D.20153;
  struct GHashTable * D.20154;
  struct GHashTable * D.20155;
  struct GHashTable * D.20156;
  struct GHashTable * D.20157;
  struct GHashTable * D.20158;
  struct GHashTable * D.20159;
  struct GHashTable * D.20160;
  struct GHashTable * D.20161;
  struct GHashTable * D.20162;
  struct GHashTable * D.20163;
  struct GHashTable * D.20164;
  struct MonoPropertyHash * D.20167;
  int iftmp.37;
  struct GSList * D.20173;
  int D.20175;
  _Bool D.20177;
  long int D.20178;
  long int D.20179;
  struct MonoBitSet * D.20182;
  void * D.20185;
  struct MonoSectionTable * D.20188;
  void * * D.20191;
  struct MonoImage * * D.20194;
  struct MonoImage * * D.20195;
  struct MonoImage * D.20196;
  int D.20199;
  unsigned int i.38;
  unsigned int D.20203;
  gboolean * D.20204;
  struct CRITICAL_SECTION * D.20207;
  struct CRITICAL_SECTION * D.20208;
  const char * D.20211;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;
  int i;

  if (image == 0B) goto <D.19999>; else goto <D.20000>;
  <D.19999>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1492, "image != NULL");
  D.20001 = 0;
  return D.20001;
  <D.20000>:
  mutex_inited.34 = mutex_inited;
  if (mutex_inited.34 != 0) goto <D.20003>; else goto <D.20004>;
  <D.20003>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.20005>; else goto <D.20006>;
    <D.20005>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20006>:
    D.20007 = ret != 0;
    D.20008 = (long int) D.20007;
    D.20009 = __builtin_expect (D.20008, 0);
    if (D.20009 != 0) goto <D.20010>; else goto <D.20011>;
    <D.20010>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1498, "ret == 0");
    <D.20011>:
  }
  <D.20004>:
  D.20012 = &image->ref_count;
  D.20013 = InterlockedDecrement (D.20012);
  if (D.20013 > 0) goto <D.20014>; else goto <D.20015>;
  <D.20014>:
  mutex_inited.34 = mutex_inited;
  if (mutex_inited.34 != 0) goto <D.20016>; else goto <D.20017>;
  <D.20016>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20018>; else goto <D.20019>;
    <D.20018>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20019>:
    D.20020 = ret != 0;
    D.20021 = (long int) D.20020;
    D.20022 = __builtin_expect (D.20021, 0);
    if (D.20022 != 0) goto <D.20023>; else goto <D.20024>;
    <D.20023>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1501, "ret == 0");
    <D.20024>:
  }
  <D.20017>:
  D.20001 = 0;
  return D.20001;
  <D.20015>:
  D.20026 = BIT_FIELD_REF <*image, 8, 224>;
  D.20027 = D.20026 & 16;
  if (D.20027 != 0) goto <D.20028>; else goto <D.20029>;
  <D.20028>:
  iftmp.35 = loaded_images_refonly_hash;
  goto <D.20030>;
  <D.20029>:
  iftmp.35 = loaded_images_hash;
  <D.20030>:
  loaded_images = iftmp.35;
  D.20031 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.20031);
  if (image == image2) goto <D.20032>; else goto <D.20033>;
  <D.20032>:
  D.20031 = image->name;
  monoeg_g_hash_table_remove (loaded_images, D.20031);
  <D.20033>:
  D.20034 = image->assembly_name;
  if (D.20034 != 0B) goto <D.20035>; else goto <D.20036>;
  <D.20035>:
  D.20034 = image->assembly_name;
  D.20037 = monoeg_g_hash_table_lookup (loaded_images, D.20034);
  if (D.20037 == image) goto <D.20038>; else goto <D.20039>;
  <D.20038>:
  D.20034 = image->assembly_name;
  monoeg_g_hash_table_remove (loaded_images, D.20034);
  <D.20039>:
  <D.20036>:
  mutex_inited.34 = mutex_inited;
  if (mutex_inited.34 != 0) goto <D.20040>; else goto <D.20041>;
  <D.20040>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20042>; else goto <D.20043>;
    <D.20042>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20043>:
    D.20044 = ret != 0;
    D.20045 = (long int) D.20044;
    D.20046 = __builtin_expect (D.20045, 0);
    if (D.20046 != 0) goto <D.20047>; else goto <D.20048>;
    <D.20047>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1514, "ret == 0");
    <D.20048>:
  }
  <D.20041>:
  mono_profiler_module_event (image, 2);
  D.20031 = image->name;
  mono_trace (64, 1, "Unloading image %s [%p].", D.20031, image);
  mono_image_invoke_unload_hook (image);
  mono_metadata_clean_for_image (image);
  D.20051 = image->references;
  if (D.20051 != 0B) goto <D.20052>; else goto <D.20049>;
  <D.20052>:
  D.20026 = BIT_FIELD_REF <*image, 8, 224>;
  D.20053 = D.20026 & 8;
  if (D.20053 == 0) goto <D.20054>; else goto <D.20049>;
  <D.20054>:
  i = 0;
  goto <D.18754>;
  <D.18753>:
  D.20051 = image->references;
  D.20055 = (long unsigned int) i;
  D.20056 = D.20055 * 8;
  D.20057 = D.20051 + D.20056;
  D.20058 = *D.20057;
  D.20059 = D.20058 + 18446744073709551615;
  if (D.20059 <= -3B) goto <D.20060>; else goto <D.20061>;
  <D.20060>:
  D.20051 = image->references;
  D.20055 = (long unsigned int) i;
  D.20056 = D.20055 * 8;
  D.20057 = D.20051 + D.20056;
  D.20058 = *D.20057;
  D.20062 = mono_assembly_close_except_image_pools (D.20058);
  if (D.20062 == 0) goto <D.20063>; else goto <D.20064>;
  <D.20063>:
  D.20051 = image->references;
  D.20055 = (long unsigned int) i;
  D.20056 = D.20055 * 8;
  D.20057 = D.20051 + D.20056;
  *D.20057 = 0B;
  <D.20064>:
  <D.20061>:
  i = i + 1;
  <D.18754>:
  D.20065 = image->nreferences;
  if (D.20065 > i) goto <D.18753>; else goto <D.18755>;
  <D.18755>:
  goto <D.20050>;
  <D.20049>:
  D.20051 = image->references;
  if (D.20051 != 0B) goto <D.20066>; else goto <D.20067>;
  <D.20066>:
  D.20051 = image->references;
  monoeg_g_free (D.20051);
  image->references = 0B;
  <D.20067>:
  <D.20050>:
  D.20026 = BIT_FIELD_REF <*image, 8, 224>;
  D.20068 = D.20026 & 1;
  if (D.20068 != 0) goto <D.20069>; else goto <D.20070>;
  <D.20069>:
  D.20071 = image->raw_data;
  if (D.20071 != 0B) goto <D.20072>; else goto <D.20073>;
  <D.20072>:
  D.20026 = BIT_FIELD_REF <*image, 8, 224>;
  D.20074 = D.20026 & 4;
  if (D.20074 != 0) goto <D.20075>; else goto <D.20076>;
  <D.20075>:
  D.20077 = image->raw_data_handle;
  D.20071 = image->raw_data;
  mono_file_unmap_fileio (D.20071, D.20077);
  goto <D.20078>;
  <D.20076>:
  D.20077 = image->raw_data_handle;
  D.20071 = image->raw_data;
  mono_file_unmap (D.20071, D.20077);
  <D.20078>:
  <D.20073>:
  <D.20070>:
  D.20026 = BIT_FIELD_REF <*image, 8, 224>;
  D.20079 = D.20026 & 2;
  if (D.20079 != 0) goto <D.20080>; else goto <D.20081>;
  <D.20080>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.20082 = image->raw_metadata;
    D.20071 = image->raw_data;
    if (D.20082 > D.20071) goto <D.20083>; else goto <D.20084>;
    <D.20083>:
    D.20082 = image->raw_metadata;
    D.20071 = image->raw_data;
    D.20085 = image->raw_data_len;
    D.20086 = (sizetype) D.20085;
    D.20087 = D.20071 + D.20086;
    if (D.20082 <= D.20087) goto <D.20088>; else goto <D.20089>;
    <D.20088>:
    image->raw_metadata = 0B;
    <D.20089>:
    <D.20084>:
    i = 0;
    goto <D.18758>;
    <D.18757>:
    D.20090 = ii->cli_sections;
    D.20055 = (long unsigned int) i;
    D.20056 = D.20055 * 8;
    D.20091 = D.20090 + D.20056;
    D.20092 = *D.20091;
    D.20071 = image->raw_data;
    if (D.20092 > D.20071) goto <D.20093>; else goto <D.20094>;
    <D.20093>:
    D.20090 = ii->cli_sections;
    D.20055 = (long unsigned int) i;
    D.20056 = D.20055 * 8;
    D.20091 = D.20090 + D.20056;
    D.20092 = *D.20091;
    D.20071 = image->raw_data;
    D.20085 = image->raw_data_len;
    D.20086 = (sizetype) D.20085;
    D.20087 = D.20071 + D.20086;
    if (D.20092 <= D.20087) goto <D.20095>; else goto <D.20096>;
    <D.20095>:
    D.20090 = ii->cli_sections;
    D.20055 = (long unsigned int) i;
    D.20056 = D.20055 * 8;
    D.20091 = D.20090 + D.20056;
    *D.20091 = 0B;
    <D.20096>:
    <D.20094>:
    i = i + 1;
    <D.18758>:
    D.20097 = ii->cli_section_count;
    if (D.20097 > i) goto <D.18757>; else goto <D.18759>;
    <D.18759>:
    D.20071 = image->raw_data;
    monoeg_g_free (D.20071);
  }
  <D.20081>:
  debug_assembly_unload.36 = debug_assembly_unload;
  if (debug_assembly_unload.36 != 0) goto <D.20099>; else goto <D.20100>;
  <D.20099>:
  D.20031 = image->name;
  D.20101 = monoeg_g_strdup_printf ("%s - UNLOADED", D.20031);
  image->name = D.20101;
  goto <D.20102>;
  <D.20100>:
  D.20031 = image->name;
  monoeg_g_free (D.20031);
  D.20103 = image->guid;
  monoeg_g_free (D.20103);
  D.20104 = image->version;
  monoeg_g_free (D.20104);
  D.20105 = image->files;
  monoeg_g_free (D.20105);
  <D.20102>:
  D.20106 = image->method_cache;
  if (D.20106 != 0B) goto <D.20107>; else goto <D.20108>;
  <D.20107>:
  D.20106 = image->method_cache;
  monoeg_g_hash_table_destroy (D.20106);
  <D.20108>:
  D.20109 = image->methodref_cache;
  if (D.20109 != 0B) goto <D.20110>; else goto <D.20111>;
  <D.20110>:
  D.20109 = image->methodref_cache;
  monoeg_g_hash_table_destroy (D.20109);
  <D.20111>:
  D.20112 = &image->class_cache;
  mono_internal_hash_table_destroy (D.20112);
  D.20113 = image->field_cache;
  monoeg_g_hash_table_destroy (D.20113);
  D.20114 = image->array_cache;
  if (D.20114 != 0B) goto <D.20115>; else goto <D.20116>;
  <D.20115>:
  D.20114 = image->array_cache;
  monoeg_g_hash_table_foreach (D.20114, free_array_cache_entry, 0B);
  D.20114 = image->array_cache;
  monoeg_g_hash_table_destroy (D.20114);
  <D.20116>:
  D.20117 = image->szarray_cache;
  if (D.20117 != 0B) goto <D.20118>; else goto <D.20119>;
  <D.20118>:
  D.20117 = image->szarray_cache;
  monoeg_g_hash_table_destroy (D.20117);
  <D.20119>:
  D.20120 = image->ptr_cache;
  if (D.20120 != 0B) goto <D.20121>; else goto <D.20122>;
  <D.20121>:
  D.20120 = image->ptr_cache;
  monoeg_g_hash_table_destroy (D.20120);
  <D.20122>:
  D.20123 = image->name_cache;
  if (D.20123 != 0B) goto <D.20124>; else goto <D.20125>;
  <D.20124>:
  D.20123 = image->name_cache;
  monoeg_g_hash_table_foreach (D.20123, free_hash_table, 0B);
  D.20123 = image->name_cache;
  monoeg_g_hash_table_destroy (D.20123);
  <D.20125>:
  D.20126 = image->native_wrapper_cache;
  free_hash (D.20126);
  D.20127 = image->managed_wrapper_cache;
  free_hash (D.20127);
  D.20128 = image->delegate_begin_invoke_cache;
  free_hash (D.20128);
  D.20129 = image->delegate_end_invoke_cache;
  free_hash (D.20129);
  D.20130 = image->delegate_invoke_cache;
  free_hash (D.20130);
  D.20131 = image->delegate_abstract_invoke_cache;
  free_hash (D.20131);
  D.20132 = image->delegate_bound_static_invoke_cache;
  free_hash (D.20132);
  D.20133 = image->delegate_invoke_generic_cache;
  free_hash (D.20133);
  D.20134 = image->delegate_begin_invoke_generic_cache;
  free_hash (D.20134);
  D.20135 = image->delegate_end_invoke_generic_cache;
  free_hash (D.20135);
  D.20136 = image->synchronized_generic_cache;
  free_hash (D.20136);
  D.20137 = image->remoting_invoke_cache;
  free_hash (D.20137);
  D.20138 = image->runtime_invoke_cache;
  free_hash (D.20138);
  D.20139 = image->runtime_invoke_vtype_cache;
  free_hash (D.20139);
  D.20140 = image->runtime_invoke_direct_cache;
  free_hash (D.20140);
  D.20141 = image->runtime_invoke_vcall_cache;
  free_hash (D.20141);
  D.20142 = image->synchronized_cache;
  free_hash (D.20142);
  D.20143 = image->unbox_wrapper_cache;
  free_hash (D.20143);
  D.20144 = image->cominterop_invoke_cache;
  free_hash (D.20144);
  D.20145 = image->cominterop_wrapper_cache;
  free_hash (D.20145);
  D.20146 = image->typespec_cache;
  free_hash (D.20146);
  D.20147 = image->ldfld_wrapper_cache;
  free_hash (D.20147);
  D.20148 = image->ldflda_wrapper_cache;
  free_hash (D.20148);
  D.20149 = image->stfld_wrapper_cache;
  free_hash (D.20149);
  D.20150 = image->isinst_cache;
  free_hash (D.20150);
  D.20151 = image->castclass_cache;
  free_hash (D.20151);
  D.20152 = image->proxy_isinst_cache;
  free_hash (D.20152);
  D.20153 = image->thunk_invoke_cache;
  free_hash (D.20153);
  D.20154 = image->var_cache_slow;
  free_hash (D.20154);
  D.20155 = image->mvar_cache_slow;
  free_hash (D.20155);
  D.20156 = image->wrapper_param_names;
  free_hash (D.20156);
  D.20157 = image->native_wrapper_aot_cache;
  free_hash (D.20157);
  D.20158 = image->pinvoke_scopes;
  free_hash (D.20158);
  D.20159 = image->pinvoke_scope_filenames;
  free_hash (D.20159);
  D.20160 = image->gsharedvt_types;
  free_hash (D.20160);
  D.20161 = image->memberref_signatures;
  monoeg_g_hash_table_destroy (D.20161);
  D.20162 = image->helper_signatures;
  monoeg_g_hash_table_destroy (D.20162);
  D.20163 = image->method_signatures;
  monoeg_g_hash_table_destroy (D.20163);
  D.20164 = image->rgctx_template_hash;
  if (D.20164 != 0B) goto <D.20165>; else goto <D.20166>;
  <D.20165>:
  D.20164 = image->rgctx_template_hash;
  monoeg_g_hash_table_destroy (D.20164);
  <D.20166>:
  D.20167 = image->property_hash;
  if (D.20167 != 0B) goto <D.20168>; else goto <D.20169>;
  <D.20168>:
  D.20167 = image->property_hash;
  mono_property_hash_destroy (D.20167);
  <D.20169>:
  D.20173 = image->reflection_info_unregister_classes;
  if (D.20173 != 0B) goto <D.20174>; else goto <D.20171>;
  <D.20174>:
  D.20175 = mono_runtime_is_shutting_down ();
  if (D.20175 == 0) goto <D.20176>; else goto <D.20171>;
  <D.20176>:
  iftmp.37 = 1;
  goto <D.20172>;
  <D.20171>:
  iftmp.37 = 0;
  <D.20172>:
  D.20177 = iftmp.37 != 0;
  D.20178 = (long int) D.20177;
  D.20179 = __builtin_expect (D.20178, 0);
  if (D.20179 != 0) goto <D.20180>; else goto <D.20181>;
  <D.20180>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1670, "!image->reflection_info_unregister_classes || mono_runtime_is_shutting_down ()");
  <D.20181>:
  image->reflection_info_unregister_classes = 0B;
  D.20182 = image->interface_bitset;
  if (D.20182 != 0B) goto <D.20183>; else goto <D.20184>;
  <D.20183>:
  D.20182 = image->interface_bitset;
  mono_unload_interface_ids (D.20182);
  D.20182 = image->interface_bitset;
  mono_bitset_free (D.20182);
  <D.20184>:
  D.20185 = image->image_info;
  if (D.20185 != 0B) goto <D.20186>; else goto <D.20187>;
  <D.20186>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.20188 = ii->cli_section_tables;
    if (D.20188 != 0B) goto <D.20189>; else goto <D.20190>;
    <D.20189>:
    D.20188 = ii->cli_section_tables;
    monoeg_g_free (D.20188);
    <D.20190>:
    D.20191 = ii->cli_sections;
    if (D.20191 != 0B) goto <D.20192>; else goto <D.20193>;
    <D.20192>:
    D.20191 = ii->cli_sections;
    monoeg_g_free (D.20191);
    <D.20193>:
    D.20185 = image->image_info;
    monoeg_g_free (D.20185);
  }
  <D.20187>:
  i = 0;
  goto <D.18762>;
  <D.18761>:
  D.20194 = image->modules;
  D.20055 = (long unsigned int) i;
  D.20056 = D.20055 * 8;
  D.20195 = D.20194 + D.20056;
  D.20196 = *D.20195;
  if (D.20196 != 0B) goto <D.20197>; else goto <D.20198>;
  <D.20197>:
  D.20194 = image->modules;
  D.20055 = (long unsigned int) i;
  D.20056 = D.20055 * 8;
  D.20195 = D.20194 + D.20056;
  D.20196 = *D.20195;
  D.20199 = mono_image_close_except_pools (D.20196);
  if (D.20199 == 0) goto <D.20200>; else goto <D.20201>;
  <D.20200>:
  D.20194 = image->modules;
  D.20055 = (long unsigned int) i;
  D.20056 = D.20055 * 8;
  D.20195 = D.20194 + D.20056;
  *D.20195 = 0B;
  <D.20201>:
  <D.20198>:
  i = i + 1;
  <D.18762>:
  i.38 = (unsigned int) i;
  D.20203 = image->module_count;
  if (i.38 < D.20203) goto <D.18761>; else goto <D.18763>;
  <D.18763>:
  D.20204 = image->modules_loaded;
  if (D.20204 != 0B) goto <D.20205>; else goto <D.20206>;
  <D.20205>:
  D.20204 = image->modules_loaded;
  monoeg_g_free (D.20204);
  <D.20206>:
  D.20207 = &image->szarray_cache_lock;
  DeleteCriticalSection (D.20207);
  D.20208 = &image->lock;
  DeleteCriticalSection (D.20208);
  D.20026 = BIT_FIELD_REF <*image, 8, 224>;
  D.20053 = D.20026 & 8;
  if (D.20053 != 0) goto <D.20209>; else goto <D.20210>;
  <D.20209>:
  D.20211 = image->module_name;
  monoeg_g_free (D.20211);
  mono_dynamic_image_free (image);
  <D.20210>:
  mono_profiler_module_event (image, 3);
  D.20001 = 1;
  return D.20001;
}


free_hash_table (void * key, void * val, void * user_data)
{
  monoeg_g_hash_table_destroy (val);
}


free_array_cache_entry (void * key, void * val, void * user_data)
{
  monoeg_g_slist_free (val);
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.20213;
  unsigned int D.20214;

  D.20214 = __sync_sub_and_fetch_4 (val, 1);
  D.20213 = (gint32) D.20214;
  return D.20213;
}


mono_image_invoke_unload_hook (struct MonoImage * image)
{
  void (*<T1b5f>) (struct MonoImage *, void *) D.20216;
  void * D.20217;
  struct GSList * l;
  struct ImageUnloadHook * hook;

  l = image_unload_hooks;
  goto <D.18330>;
  <D.18329>:
  hook = l->data;
  D.20216 = hook->func;
  D.20217 = hook->user_data;
  D.20216 (image, D.20217);
  l = l->next;
  <D.18330>:
  if (l != 0B) goto <D.18329>; else goto <D.18331>;
  <D.18331>:
}


free_hash (struct GHashTable * hash)
{
  if (hash != 0B) goto <D.20218>; else goto <D.20219>;
  <D.20218>:
  monoeg_g_hash_table_destroy (hash);
  <D.20219>:
}


mono_image_close_finish (struct MonoImage * image)
{
  struct MonoAssembly * * D.20220;
  unsigned char D.20223;
  unsigned char D.20224;
  long unsigned int D.20227;
  long unsigned int D.20228;
  struct MonoAssembly * * D.20229;
  struct MonoAssembly * D.20230;
  struct MonoAssembly * D.20231;
  int D.20234;
  struct MonoImage * * D.20235;
  struct MonoImage * * D.20236;
  struct MonoImage * D.20237;
  unsigned int i.39;
  unsigned int D.20241;
  struct MonoMemPool * D.20244;
  unsigned int D.20245;
  struct MonoPerfCounters * mono_perfcounters.40;
  unsigned int D.20247;
  unsigned int D.20248;
  int debug_assembly_unload.41;
  int i;

  D.20220 = image->references;
  if (D.20220 != 0B) goto <D.20221>; else goto <D.20222>;
  <D.20221>:
  D.20223 = BIT_FIELD_REF <*image, 8, 224>;
  D.20224 = D.20223 & 8;
  if (D.20224 == 0) goto <D.20225>; else goto <D.20226>;
  <D.20225>:
  i = 0;
  goto <D.18769>;
  <D.18768>:
  D.20220 = image->references;
  D.20227 = (long unsigned int) i;
  D.20228 = D.20227 * 8;
  D.20229 = D.20220 + D.20228;
  D.20230 = *D.20229;
  D.20231 = D.20230 + 18446744073709551615;
  if (D.20231 <= -3B) goto <D.20232>; else goto <D.20233>;
  <D.20232>:
  D.20220 = image->references;
  D.20227 = (long unsigned int) i;
  D.20228 = D.20227 * 8;
  D.20229 = D.20220 + D.20228;
  D.20230 = *D.20229;
  mono_assembly_close_finish (D.20230);
  <D.20233>:
  i = i + 1;
  <D.18769>:
  D.20234 = image->nreferences;
  if (D.20234 > i) goto <D.18768>; else goto <D.18770>;
  <D.18770>:
  D.20220 = image->references;
  monoeg_g_free (D.20220);
  image->references = 0B;
  <D.20226>:
  <D.20222>:
  i = 0;
  goto <D.18772>;
  <D.18771>:
  D.20235 = image->modules;
  D.20227 = (long unsigned int) i;
  D.20228 = D.20227 * 8;
  D.20236 = D.20235 + D.20228;
  D.20237 = *D.20236;
  if (D.20237 != 0B) goto <D.20238>; else goto <D.20239>;
  <D.20238>:
  D.20235 = image->modules;
  D.20227 = (long unsigned int) i;
  D.20228 = D.20227 * 8;
  D.20236 = D.20235 + D.20228;
  D.20237 = *D.20236;
  mono_image_close_finish (D.20237);
  <D.20239>:
  i = i + 1;
  <D.18772>:
  i.39 = (unsigned int) i;
  D.20241 = image->module_count;
  if (i.39 < D.20241) goto <D.18771>; else goto <D.18773>;
  <D.18773>:
  D.20235 = image->modules;
  if (D.20235 != 0B) goto <D.20242>; else goto <D.20243>;
  <D.20242>:
  D.20235 = image->modules;
  monoeg_g_free (D.20235);
  <D.20243>:
  D.20244 = image->mempool;
  D.20245 = mono_mempool_get_allocated (D.20244);
  mono_perfcounters.40 = mono_perfcounters;
  mono_perfcounters.40 = mono_perfcounters;
  D.20247 = mono_perfcounters.40->loader_bytes;
  D.20248 = D.20247 - D.20245;
  mono_perfcounters.40->loader_bytes = D.20248;
  D.20223 = BIT_FIELD_REF <*image, 8, 224>;
  D.20224 = D.20223 & 8;
  if (D.20224 == 0) goto <D.20249>; else goto <D.20250>;
  <D.20249>:
  debug_assembly_unload.41 = debug_assembly_unload;
  if (debug_assembly_unload.41 != 0) goto <D.20252>; else goto <D.20253>;
  <D.20252>:
  D.20244 = image->mempool;
  mono_mempool_invalidate (D.20244);
  goto <D.20254>;
  <D.20253>:
  D.20244 = image->mempool;
  mono_mempool_destroy (D.20244);
  monoeg_g_free (image);
  <D.20254>:
  goto <D.20255>;
  <D.20250>:
  debug_assembly_unload.41 = debug_assembly_unload;
  if (debug_assembly_unload.41 != 0) goto <D.20256>; else goto <D.20257>;
  <D.20256>:
  D.20244 = image->mempool;
  mono_mempool_invalidate (D.20244);
  goto <D.20258>;
  <D.20257>:
  D.20244 = image->mempool;
  mono_mempool_destroy (D.20244);
  <D.20258>:
  <D.20255>:
}


mono_image_close (struct MonoImage * image)
{
  int D.20259;

  D.20259 = mono_image_close_except_pools (image);
  if (D.20259 != 0) goto <D.20260>; else goto <D.20261>;
  <D.20260>:
  mono_image_close_finish (image);
  <D.20261>:
}


mono_image_strerror (MonoImageOpenStatus status)
{
  const char * D.20262;
  int * D.20263;
  int D.20264;

  switch (status) <default: <D.20265>, case 0: <D.18780>, case 1: <D.18781>, case 2: <D.18783>, case 3: <D.18782>>
  <D.18780>:
  D.20262 = "success";
  return D.20262;
  <D.18781>:
  D.20263 = __errno_location ();
  D.20264 = *D.20263;
  D.20262 = strerror (D.20264);
  return D.20262;
  <D.18782>:
  D.20262 = "File does not contain a valid CIL image";
  return D.20262;
  <D.18783>:
  D.20262 = "An assembly was referenced, but could not be found";
  return D.20262;
  <D.20265>:
  D.20262 = "Internal error";
  return D.20262;
}


mono_image_lookup_resource (struct MonoImage * image, guint32 res_id, guint32 lang_id, gunichar2 * name)
{
  void * D.20269;
  unsigned int D.20278;
  short unsigned int D.20281;
  int D.20282;
  short unsigned int D.20283;
  int D.20284;
  int D.20285;
  long unsigned int D.20286;
  long unsigned int D.20287;
  struct MonoCLIImageInfo * info;
  struct MonoDotNetHeader * header;
  struct MonoPEDatadir * datadir;
  struct MonoPEDirEntry * rsrc;
  struct MonoPEResourceDir * resource_dir;
  struct MonoPEResourceDirEntry * res_entries;
  guint32 entries;
  guint32 i;

  if (image == 0B) goto <D.20267>; else goto <D.20268>;
  <D.20267>:
  D.20269 = 0B;
  return D.20269;
  <D.20268>:
  mono_image_ensure_section_idx (image, 1);
  info = image->image_info;
  if (info == 0B) goto <D.20270>; else goto <D.20271>;
  <D.20270>:
  D.20269 = 0B;
  return D.20269;
  <D.20271>:
  header = &info->cli_header;
  if (header == 0B) goto <D.20272>; else goto <D.20273>;
  <D.20272>:
  D.20269 = 0B;
  return D.20269;
  <D.20273>:
  datadir = &header->datadir;
  if (datadir == 0B) goto <D.20274>; else goto <D.20275>;
  <D.20274>:
  D.20269 = 0B;
  return D.20269;
  <D.20275>:
  rsrc = &datadir->pe_resource_table;
  if (rsrc == 0B) goto <D.20276>; else goto <D.20277>;
  <D.20276>:
  D.20269 = 0B;
  return D.20269;
  <D.20277>:
  D.20278 = rsrc->rva;
  resource_dir = mono_image_rva_map (image, D.20278);
  if (resource_dir == 0B) goto <D.20279>; else goto <D.20280>;
  <D.20279>:
  D.20269 = 0B;
  return D.20269;
  <D.20280>:
  D.20281 = resource_dir->res_named_entries;
  D.20282 = (int) D.20281;
  D.20283 = resource_dir->res_id_entries;
  D.20284 = (int) D.20283;
  D.20285 = D.20282 + D.20284;
  entries = (guint32) D.20285;
  res_entries = resource_dir + 16;
  i = 0;
  goto <D.18825>;
  <D.18824>:
  {
    struct MonoPEResourceDirEntry * entry;
    void * ret;

    D.20286 = (long unsigned int) i;
    D.20287 = D.20286 * 8;
    entry = res_entries + D.20287;
    ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, entry, resource_dir, 0);
    if (ret != 0B) goto <D.20288>; else goto <D.20289>;
    <D.20288>:
    D.20269 = ret;
    return D.20269;
    <D.20289>:
  }
  i = i + 1;
  <D.18825>:
  if (i < entries) goto <D.18824>; else goto <D.18826>;
  <D.18826>:
  D.20269 = 0B;
  return D.20269;
}


mono_image_walk_resource_tree (struct MonoCLIImageInfo * info, guint32 res_id, guint32 lang_id, gunichar2 * name, struct MonoPEResourceDirEntry * entry, struct MonoPEResourceDir * root, guint32 level)
{
  unsigned int D.20291;
  unsigned int D.20292;
  unsigned int D.20293;
  unsigned int D.20294;
  void * D.20299;
  _Bool D.20311;
  _Bool D.20312;
  _Bool D.20313;
  sizetype D.20318;
  short unsigned int D.20319;
  int D.20320;
  short unsigned int D.20321;
  int D.20322;
  int D.20323;
  long unsigned int D.20324;
  long unsigned int D.20325;
  unsigned int D.20326;
  unsigned int D.20329;
  unsigned int D.20330;
  unsigned int D.20331;
  unsigned int D.20332;
  gboolean is_string;
  gboolean is_dir;
  guint32 name_offset;
  guint32 dir_offset;

  D.20291 = entry->name;
  D.20292 = D.20291 >> 31;
  is_string = (gboolean) D.20292;
  D.20291 = entry->name;
  name_offset = D.20291 & 2147483647;
  D.20293 = entry->dir;
  D.20294 = D.20293 >> 31;
  is_dir = (gboolean) D.20294;
  D.20293 = entry->dir;
  dir_offset = D.20293 & 2147483647;
  if (level == 0) goto <D.20295>; else goto <D.20296>;
  <D.20295>:
  if (is_string != 0) goto <D.20297>; else goto <D.20298>;
  <D.20297>:
  D.20299 = 0B;
  return D.20299;
  <D.20298>:
  goto <D.20300>;
  <D.20296>:
  if (level == 1) goto <D.20301>; else goto <D.20302>;
  <D.20301>:
  if (res_id != name_offset) goto <D.20303>; else goto <D.20304>;
  <D.20303>:
  D.20299 = 0B;
  return D.20299;
  <D.20304>:
  goto <D.20305>;
  <D.20302>:
  if (level == 2) goto <D.20306>; else goto <D.20307>;
  <D.20306>:
  if (is_string == 1) goto <D.20308>; else goto <D.20310>;
  <D.20310>:
  D.20311 = is_string == 0;
  D.20312 = lang_id != 0;
  D.20313 = D.20311 & D.20312;
  if (D.20313 != 0) goto <D.20314>; else goto <D.20309>;
  <D.20314>:
  if (name_offset != lang_id) goto <D.20308>; else goto <D.20309>;
  <D.20308>:
  D.20299 = 0B;
  return D.20299;
  <D.20309>:
  goto <D.20315>;
  <D.20307>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image.c", 1829);
  <D.20315>:
  <D.20305>:
  <D.20300>:
  if (is_dir == 1) goto <D.20316>; else goto <D.20317>;
  <D.20316>:
  {
    struct MonoPEResourceDir * res_dir;
    struct MonoPEResourceDirEntry * sub_entries;
    guint32 entries;
    guint32 i;

    D.20318 = (sizetype) dir_offset;
    res_dir = root + D.20318;
    sub_entries = res_dir + 16;
    D.20319 = res_dir->res_named_entries;
    D.20320 = (int) D.20319;
    D.20321 = res_dir->res_id_entries;
    D.20322 = (int) D.20321;
    D.20323 = D.20320 + D.20322;
    entries = (guint32) D.20323;
    i = 0;
    goto <D.18804>;
    <D.18803>:
    {
      struct MonoPEResourceDirEntry * sub_entry;
      void * ret;

      D.20324 = (long unsigned int) i;
      D.20325 = D.20324 * 8;
      sub_entry = sub_entries + D.20325;
      D.20326 = level + 1;
      ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, sub_entry, root, D.20326);
      if (ret != 0B) goto <D.20327>; else goto <D.20328>;
      <D.20327>:
      D.20299 = ret;
      return D.20299;
      <D.20328>:
    }
    i = i + 1;
    <D.18804>:
    if (i < entries) goto <D.18803>; else goto <D.18805>;
    <D.18805>:
    D.20299 = 0B;
    return D.20299;
  }
  <D.20317>:
  {
    struct MonoPEResourceDataEntry * data_entry;
    struct MonoPEResourceDataEntry * res;

    D.20318 = (sizetype) dir_offset;
    data_entry = root + D.20318;
    res = monoeg_malloc0 (16);
    D.20329 = data_entry->rde_data_offset;
    res->rde_data_offset = D.20329;
    D.20330 = data_entry->rde_size;
    res->rde_size = D.20330;
    D.20331 = data_entry->rde_codepage;
    res->rde_codepage = D.20331;
    D.20332 = data_entry->rde_reserved;
    res->rde_reserved = D.20332;
    D.20299 = res;
    return D.20299;
  }
}


mono_image_get_entry_point (struct MonoImage * image)
{
  uint32_t D.20334;
  void * D.20335;

  D.20335 = image->image_info;
  D.20334 = MEM[(struct MonoCLIImageInfo *)D.20335].cli_cli_header.ch_entry_point;
  return D.20334;
}


mono_image_get_resource (struct MonoImage * image, guint32 offset, guint32 * size)
{
  unsigned int D.20339;
  unsigned int D.20341;
  unsigned int D.20342;
  const char * D.20343;
  sizetype D.20346;
  unsigned int D.20349;
  struct MonoCLIImageInfo * iinfo;
  struct MonoCLIHeader * ch;
  const char * data;

  iinfo = image->image_info;
  ch = &iinfo->cli_cli_header;
  D.20339 = ch->ch_resources.rva;
  if (D.20339 == 0) goto <D.20337>; else goto <D.20340>;
  <D.20340>:
  D.20341 = offset + 4;
  D.20342 = ch->ch_resources.size;
  if (D.20341 > D.20342) goto <D.20337>; else goto <D.20338>;
  <D.20337>:
  D.20343 = 0B;
  return D.20343;
  <D.20338>:
  D.20339 = ch->ch_resources.rva;
  data = mono_image_rva_map (image, D.20339);
  if (data == 0B) goto <D.20344>; else goto <D.20345>;
  <D.20344>:
  D.20343 = 0B;
  return D.20343;
  <D.20345>:
  D.20346 = (sizetype) offset;
  data = data + D.20346;
  if (size != 0B) goto <D.20347>; else goto <D.20348>;
  <D.20347>:
  D.20349 = MEM[(const guint32 *)data];
  *size = D.20349;
  <D.20348>:
  data = data + 4;
  D.20343 = data;
  return D.20343;
}


mono_image_load_file_for_image (struct MonoImage * image, int fileidx)
{
  <unnamed-unsigned:24> D.20354;
  int D.20355;
  struct MonoImage * D.20356;
  struct MonoImage * * D.20357;
  long unsigned int D.20360;
  long unsigned int D.20361;
  sizetype D.20362;
  struct MonoImage * * D.20363;
  struct MonoImage * D.20364;
  long unsigned int D.20369;
  long unsigned int D.20370;
  void * D.20371;
  int D.20372;
  char * D.20373;
  struct MonoAssembly * D.20376;
  struct MonoImage * * D.20377;
  long unsigned int D.20378;
  long unsigned int D.20379;
  struct MonoImage * * D.20380;
  struct MonoImage * D.20381;
  struct MonoAssembly * D.20384;
  unsigned int i.42;
  unsigned int D.20388;
  char * base_dir;
  char * name;
  struct MonoImage * res;
  struct MonoTableInfo * t;
  const char * fname;
  guint32 fname_id;

  t = &image->tables[38];
  if (fileidx <= 0) goto <D.20351>; else goto <D.20353>;
  <D.20353>:
  D.20354 = t->rows;
  D.20355 = (int) D.20354;
  if (D.20355 < fileidx) goto <D.20351>; else goto <D.20352>;
  <D.20351>:
  D.20356 = 0B;
  return D.20356;
  <D.20352>:
  mono_loader_lock ();
  D.20357 = image->files;
  if (D.20357 != 0B) goto <D.20358>; else goto <D.20359>;
  <D.20358>:
  D.20357 = image->files;
  D.20360 = (long unsigned int) fileidx;
  D.20361 = D.20360 * 8;
  D.20362 = D.20361 + 18446744073709551608;
  D.20363 = D.20357 + D.20362;
  D.20364 = *D.20363;
  if (D.20364 != 0B) goto <D.20365>; else goto <D.20366>;
  <D.20365>:
  mono_loader_unlock ();
  D.20357 = image->files;
  D.20360 = (long unsigned int) fileidx;
  D.20361 = D.20360 * 8;
  D.20362 = D.20361 + 18446744073709551608;
  D.20363 = D.20357 + D.20362;
  D.20356 = *D.20363;
  return D.20356;
  <D.20366>:
  <D.20359>:
  D.20357 = image->files;
  if (D.20357 == 0B) goto <D.20367>; else goto <D.20368>;
  <D.20367>:
  D.20354 = t->rows;
  D.20369 = (long unsigned int) D.20354;
  D.20370 = D.20369 * 8;
  D.20371 = monoeg_malloc0 (D.20370);
  image->files = D.20371;
  <D.20368>:
  D.20372 = fileidx + -1;
  fname_id = mono_metadata_decode_row_col (t, D.20372, 1);
  fname = mono_metadata_string_heap (image, fname_id);
  D.20373 = image->name;
  base_dir = monoeg_g_path_get_dirname (D.20373);
  name = monoeg_g_build_path ("/", base_dir, fname, 0B);
  res = mono_image_open (name, 0B);
  if (res != 0B) goto <D.20374>; else goto <D.20375>;
  <D.20374>:
  {
    int i;

    D.20376 = image->assembly;
    res->assembly = D.20376;
    i = 0;
    goto <D.18850>;
    <D.18849>:
    D.20377 = res->modules;
    D.20378 = (long unsigned int) i;
    D.20379 = D.20378 * 8;
    D.20380 = D.20377 + D.20379;
    D.20381 = *D.20380;
    if (D.20381 != 0B) goto <D.20382>; else goto <D.20383>;
    <D.20382>:
    D.20377 = res->modules;
    D.20378 = (long unsigned int) i;
    D.20379 = D.20378 * 8;
    D.20380 = D.20377 + D.20379;
    D.20381 = *D.20380;
    D.20384 = D.20381->assembly;
    if (D.20384 == 0B) goto <D.20385>; else goto <D.20386>;
    <D.20385>:
    D.20377 = res->modules;
    D.20378 = (long unsigned int) i;
    D.20379 = D.20378 * 8;
    D.20380 = D.20377 + D.20379;
    D.20381 = *D.20380;
    D.20376 = image->assembly;
    D.20381->assembly = D.20376;
    <D.20386>:
    <D.20383>:
    i = i + 1;
    <D.18850>:
    i.42 = (unsigned int) i;
    D.20388 = res->module_count;
    if (i.42 < D.20388) goto <D.18849>; else goto <D.18851>;
    <D.18851>:
    D.20357 = image->files;
    D.20360 = (long unsigned int) fileidx;
    D.20361 = D.20360 * 8;
    D.20362 = D.20361 + 18446744073709551608;
    D.20363 = D.20357 + D.20362;
    *D.20363 = res;
  }
  <D.20375>:
  mono_loader_unlock ();
  monoeg_g_free (name);
  monoeg_g_free (base_dir);
  D.20356 = res;
  return D.20356;
}


mono_image_get_strong_name (struct MonoImage * image, guint32 * size)
{
  unsigned int D.20392;
  unsigned int D.20394;
  const char * D.20395;
  struct MonoCLIImageInfo * iinfo;
  struct MonoPEDirEntry * de;
  const char * data;

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  D.20392 = de->size;
  if (D.20392 == 0) goto <D.20390>; else goto <D.20393>;
  <D.20393>:
  D.20394 = de->rva;
  if (D.20394 == 0) goto <D.20390>; else goto <D.20391>;
  <D.20390>:
  D.20395 = 0B;
  return D.20395;
  <D.20391>:
  D.20394 = de->rva;
  data = mono_image_rva_map (image, D.20394);
  if (data == 0B) goto <D.20396>; else goto <D.20397>;
  <D.20396>:
  D.20395 = 0B;
  return D.20395;
  <D.20397>:
  if (size != 0B) goto <D.20398>; else goto <D.20399>;
  <D.20398>:
  D.20392 = de->size;
  *size = D.20392;
  <D.20399>:
  D.20395 = data;
  return D.20395;
}


mono_image_strong_name_position (struct MonoImage * image, guint32 * size)
{
  unsigned int D.20403;
  unsigned int D.20407;
  uint32_t D.20408;
  uint32_t iftmp.43;
  struct MonoCLIImageInfo * iinfo;
  struct MonoPEDirEntry * de;
  guint32 pos;

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  if (size != 0B) goto <D.20401>; else goto <D.20402>;
  <D.20401>:
  D.20403 = de->size;
  *size = D.20403;
  <D.20402>:
  D.20403 = de->size;
  if (D.20403 == 0) goto <D.20404>; else goto <D.20406>;
  <D.20406>:
  D.20407 = de->rva;
  if (D.20407 == 0) goto <D.20404>; else goto <D.20405>;
  <D.20404>:
  D.20408 = 0;
  return D.20408;
  <D.20405>:
  D.20407 = de->rva;
  pos = mono_cli_rva_image_map (image, D.20407);
  if (pos != 4294967295) goto <D.20410>; else goto <D.20411>;
  <D.20410>:
  iftmp.43 = pos;
  goto <D.20412>;
  <D.20411>:
  iftmp.43 = 0;
  <D.20412>:
  D.20408 = iftmp.43;
  return D.20408;
}


mono_image_get_public_key (struct MonoImage * image, guint32 * size)
{
  unsigned char D.20414;
  unsigned char D.20415;
  int D.20420;
  unsigned int D.20421;
  const char * D.20422;
  unsigned int D.20423;
  unsigned int D.20424;
  struct MonoTableInfo * D.20427;
  const char * pubkey.44;
  const char * pubkey.45;
  const char * pubkey;
  guint32 len;
  guint32 tok;

  try
    {
      D.20414 = BIT_FIELD_REF <*image, 8, 224>;
      D.20415 = D.20414 & 8;
      if (D.20415 != 0) goto <D.20416>; else goto <D.20417>;
      <D.20416>:
      if (size != 0B) goto <D.20418>; else goto <D.20419>;
      <D.20418>:
      D.20420 = MEM[(struct MonoDynamicImage *)image].public_key_len;
      D.20421 = (unsigned int) D.20420;
      *size = D.20421;
      <D.20419>:
      D.20422 = MEM[(struct MonoDynamicImage *)image].public_key;
      return D.20422;
      <D.20417>:
      D.20423 = BIT_FIELD_REF <*image, 32, 5696>;
      D.20424 = D.20423 & 16777215;
      if (D.20424 != 1) goto <D.20425>; else goto <D.20426>;
      <D.20425>:
      D.20422 = 0B;
      return D.20422;
      <D.20426>:
      D.20427 = &image->tables[32];
      tok = mono_metadata_decode_row_col (D.20427, 0, 6);
      if (tok == 0) goto <D.20428>; else goto <D.20429>;
      <D.20428>:
      D.20422 = 0B;
      return D.20422;
      <D.20429>:
      pubkey.44 = mono_metadata_blob_heap (image, tok);
      pubkey = pubkey.44;
      pubkey.45 = pubkey;
      len = mono_metadata_decode_blob_size (pubkey.45, &pubkey);
      if (size != 0B) goto <D.20432>; else goto <D.20433>;
      <D.20432>:
      *size = len;
      <D.20433>:
      D.20422 = pubkey;
      return D.20422;
    }
  finally
    {
      pubkey = {CLOBBER};
    }
}


mono_image_get_name (struct MonoImage * image)
{
  const char * D.20436;

  D.20436 = image->assembly_name;
  return D.20436;
}


mono_image_get_filename (struct MonoImage * image)
{
  const char * D.20438;

  D.20438 = image->name;
  return D.20438;
}


mono_image_get_guid (struct MonoImage * image)
{
  const char * D.20440;

  D.20440 = image->guid;
  return D.20440;
}


mono_image_get_table_info (struct MonoImage * image, int table_id)
{
  unsigned int table_id.46;
  const struct MonoTableInfo * D.20445;

  table_id.46 = (unsigned int) table_id;
  if (table_id.46 > 44) goto <D.20443>; else goto <D.20444>;
  <D.20443>:
  D.20445 = 0B;
  return D.20445;
  <D.20444>:
  D.20445 = &image->tables[table_id];
  return D.20445;
}


mono_image_get_table_rows (struct MonoImage * image, int table_id)
{
  unsigned int table_id.47;
  int D.20450;
  <unnamed-unsigned:24> D.20451;

  table_id.47 = (unsigned int) table_id;
  if (table_id.47 > 44) goto <D.20448>; else goto <D.20449>;
  <D.20448>:
  D.20450 = 0;
  return D.20450;
  <D.20449>:
  D.20451 = image->tables[table_id].rows;
  D.20450 = (int) D.20451;
  return D.20450;
}


mono_table_info_get_rows (const struct MonoTableInfo * table)
{
  int D.20453;
  <unnamed-unsigned:24> D.20454;

  D.20454 = table->rows;
  D.20453 = (int) D.20454;
  return D.20453;
}


mono_image_get_assembly (struct MonoImage * image)
{
  struct MonoAssembly * D.20456;

  D.20456 = image->assembly;
  return D.20456;
}


mono_image_is_dynamic (struct MonoImage * image)
{
  mono_bool D.20458;
  <unnamed-unsigned:1> D.20459;

  D.20459 = image->dynamic;
  D.20458 = (mono_bool) D.20459;
  return D.20458;
}


mono_image_has_authenticode_entry (struct MonoImage * image)
{
  mono_bool D.20461;
  int iftmp.48;
  unsigned int D.20465;
  unsigned int D.20467;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoPEDirEntry * de;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  de = &header->datadir.pe_certificate_table;
  D.20465 = de->rva;
  if (D.20465 != 0) goto <D.20466>; else goto <D.20463>;
  <D.20466>:
  D.20467 = de->size;
  if (D.20467 > 8) goto <D.20468>; else goto <D.20463>;
  <D.20468>:
  iftmp.48 = 1;
  goto <D.20464>;
  <D.20463>:
  iftmp.48 = 0;
  <D.20464>:
  D.20461 = iftmp.48;
  return D.20461;
}


mono_image_alloc (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.49;
  unsigned int D.20471;
  unsigned int D.20472;
  struct MonoMemPool * D.20473;
  void * D.20474;
  void * res;

  mono_perfcounters.49 = mono_perfcounters;
  mono_perfcounters.49 = mono_perfcounters;
  D.20471 = mono_perfcounters.49->loader_bytes;
  D.20472 = D.20471 + size;
  mono_perfcounters.49->loader_bytes = D.20472;
  mono_image_lock (image);
  D.20473 = image->mempool;
  res = mono_mempool_alloc (D.20473, size);
  mono_image_unlock (image);
  D.20474 = res;
  return D.20474;
}


mono_image_alloc0 (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.50;
  unsigned int D.20477;
  unsigned int D.20478;
  struct MonoMemPool * D.20479;
  void * D.20480;
  void * res;

  mono_perfcounters.50 = mono_perfcounters;
  mono_perfcounters.50 = mono_perfcounters;
  D.20477 = mono_perfcounters.50->loader_bytes;
  D.20478 = D.20477 + size;
  mono_perfcounters.50->loader_bytes = D.20478;
  mono_image_lock (image);
  D.20479 = image->mempool;
  res = mono_mempool_alloc0 (D.20479, size);
  mono_image_unlock (image);
  D.20480 = res;
  return D.20480;
}


mono_image_strdup (struct MonoImage * image, const char * s)
{
  struct MonoPerfCounters * mono_perfcounters.51;
  unsigned int D.20483;
  long unsigned int D.20484;
  unsigned int D.20485;
  unsigned int D.20486;
  struct MonoMemPool * D.20487;
  char * D.20488;
  char * res;

  mono_perfcounters.51 = mono_perfcounters;
  mono_perfcounters.51 = mono_perfcounters;
  D.20483 = mono_perfcounters.51->loader_bytes;
  D.20484 = strlen (s);
  D.20485 = (unsigned int) D.20484;
  D.20486 = D.20483 + D.20485;
  mono_perfcounters.51->loader_bytes = D.20486;
  mono_image_lock (image);
  D.20487 = image->mempool;
  res = mono_mempool_strdup (D.20487, s);
  mono_image_unlock (image);
  D.20488 = res;
  return D.20488;
}


g_list_prepend_image (struct MonoImage * image, struct GList * list, void * data)
{
  struct GList * iftmp.52;
  struct GList * D.20494;
  struct GList * D.20499;
  struct GList * new_list;

  new_list = mono_image_alloc (image, 24);
  new_list->data = data;
  if (list != 0B) goto <D.20491>; else goto <D.20492>;
  <D.20491>:
  iftmp.52 = list->prev;
  goto <D.20493>;
  <D.20492>:
  iftmp.52 = 0B;
  <D.20493>:
  new_list->prev = iftmp.52;
  new_list->next = list;
  D.20494 = new_list->prev;
  if (D.20494 != 0B) goto <D.20495>; else goto <D.20496>;
  <D.20495>:
  D.20494 = new_list->prev;
  D.20494->next = new_list;
  <D.20496>:
  if (list != 0B) goto <D.20497>; else goto <D.20498>;
  <D.20497>:
  list->prev = new_list;
  <D.20498>:
  D.20499 = new_list;
  return D.20499;
}


g_slist_append_image (struct MonoImage * image, struct GSList * list, void * data)
{
  struct GSList * D.20501;
  struct GSList * new_list;

  new_list = mono_image_alloc (image, 16);
  new_list->data = data;
  new_list->next = 0B;
  D.20501 = monoeg_g_slist_concat (list, new_list);
  return D.20501;
}


mono_image_lock (struct MonoImage * image)
{
  union mono_mutex_t * D.20503;
  _Bool D.20506;
  long int D.20507;
  long int D.20508;

  {
    int ret;

    D.20503 = &image->lock.mutex;
    ret = pthread_mutex_lock (D.20503);
    if (ret != 0) goto <D.20504>; else goto <D.20505>;
    <D.20504>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20505>:
    D.20506 = ret != 0;
    D.20507 = (long int) D.20506;
    D.20508 = __builtin_expect (D.20507, 0);
    if (D.20508 != 0) goto <D.20509>; else goto <D.20510>;
    <D.20509>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2304, "ret == 0");
    <D.20510>:
  }
}


mono_image_unlock (struct MonoImage * image)
{
  union mono_mutex_t * D.20511;
  _Bool D.20514;
  long int D.20515;
  long int D.20516;

  {
    int ret;

    D.20511 = &image->lock.mutex;
    ret = pthread_mutex_unlock (D.20511);
    if (ret != 0) goto <D.20512>; else goto <D.20513>;
    <D.20512>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20513>:
    D.20514 = ret != 0;
    D.20515 = (long int) D.20514;
    D.20516 = __builtin_expect (D.20515, 0);
    if (D.20516 != 0) goto <D.20517>; else goto <D.20518>;
    <D.20517>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2310, "ret == 0");
    <D.20518>:
  }
}


mono_image_property_lookup (struct MonoImage * image, void * subject, guint32 property)
{
  struct MonoPropertyHash * D.20519;
  void * D.20520;
  void * res;

  mono_image_lock (image);
  D.20519 = image->property_hash;
  res = mono_property_hash_lookup (D.20519, subject, property);
  mono_image_unlock (image);
  D.20520 = res;
  return D.20520;
}


mono_image_property_insert (struct MonoImage * image, void * subject, guint32 property, void * value)
{
  struct MonoPropertyHash * D.20522;

  mono_image_lock (image);
  D.20522 = image->property_hash;
  mono_property_hash_insert (D.20522, subject, property, value);
  mono_image_unlock (image);
}


mono_image_property_remove (struct MonoImage * image, void * subject)
{
  struct MonoPropertyHash * D.20523;

  mono_image_lock (image);
  D.20523 = image->property_hash;
  mono_property_hash_remove_object (D.20523, subject);
  mono_image_unlock (image);
}


mono_image_append_class_to_reflection_info_set (struct MonoClass * class)
{
  unsigned char D.20524;
  unsigned char D.20525;
  _Bool D.20526;
  long int D.20527;
  long int D.20528;
  struct GSList * D.20531;
  struct MonoMemPool * D.20532;
  struct GSList * D.20533;
  struct MonoImage * image;

  image = class->image;
  D.20524 = BIT_FIELD_REF <*image, 8, 224>;
  D.20525 = D.20524 & 8;
  D.20526 = D.20525 == 0;
  D.20527 = (long int) D.20526;
  D.20528 = __builtin_expect (D.20527, 0);
  if (D.20528 != 0) goto <D.20529>; else goto <D.20530>;
  <D.20529>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2367, "image->dynamic");
  <D.20530>:
  mono_image_lock (image);
  D.20531 = image->reflection_info_unregister_classes;
  D.20532 = image->mempool;
  D.20533 = g_slist_prepend_mempool (D.20532, D.20531, class);
  image->reflection_info_unregister_classes = D.20533;
  mono_image_unlock (image);
}


g_slist_prepend_mempool (struct MonoMemPool * mp, struct GSList * list, void * data)
{
  struct GSList * D.20534;
  struct GSList * new_list;

  new_list = mono_mempool_alloc (mp, 16);
  new_list->data = data;
  new_list->next = list;
  D.20534 = new_list;
  return D.20534;
}


