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.18599>; else goto <D.18600>;
  <D.18599>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 75, "func != NULL");
  return;
  <D.18600>:
  hook = monoeg_malloc0 (8);
  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 (*<T1ab4>) (struct MonoImage *, void *) D.18604;
  void * D.18607;
  struct GSList * image_unload_hooks.2;
  struct GSList * image_unload_hooks.3;
  struct GSList * l;
  struct ImageUnloadHook * hook;

  l = image_unload_hooks;
  goto <D.17961>;
  <D.17960>:
  hook = l->data;
  D.18604 = hook->func;
  if (D.18604 == func) goto <D.18605>; else goto <D.18606>;
  <D.18605>:
  D.18607 = hook->user_data;
  if (D.18607 == user_data) goto <D.18608>; else goto <D.18609>;
  <D.18608>:
  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.17959>;
  <D.18609>:
  <D.18606>:
  l = l->next;
  <D.17961>:
  if (l != 0B) goto <D.17960>; else goto <D.17959>;
  <D.17959>:
}


mono_cli_rva_image_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.18612;
  unsigned int D.18615;
  unsigned int D.18616;
  guint32 D.18619;
  unsigned int D.18620;
  unsigned int D.18621;
  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.17979>;
  <D.17978>:
  D.18612 = tables->st_virtual_address;
  if (D.18612 <= addr) goto <D.18613>; else goto <D.18614>;
  <D.18613>:
  D.18612 = tables->st_virtual_address;
  D.18615 = tables->st_raw_data_size;
  D.18616 = D.18612 + D.18615;
  if (D.18616 > addr) goto <D.18617>; else goto <D.18618>;
  <D.18617>:
  D.18612 = tables->st_virtual_address;
  D.18620 = addr - D.18612;
  D.18621 = tables->st_raw_data_ptr;
  D.18619 = D.18620 + D.18621;
  return D.18619;
  <D.18618>:
  <D.18614>:
  tables = tables + 40;
  i = i + 1;
  <D.17979>:
  if (i < top) goto <D.17978>; else goto <D.17980>;
  <D.17980>:
  D.18619 = 4294967295;
  return D.18619;
}


mono_image_rva_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.18623;
  unsigned int D.18626;
  unsigned int D.18627;
  void * * D.18630;
  unsigned int i.4;
  unsigned int D.18632;
  void * * D.18633;
  void * D.18634;
  int D.18637;
  char * D.18640;
  unsigned int D.18641;
  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.17990>;
  <D.17989>:
  D.18623 = tables->st_virtual_address;
  if (D.18623 <= addr) goto <D.18624>; else goto <D.18625>;
  <D.18624>:
  D.18623 = tables->st_virtual_address;
  D.18626 = tables->st_raw_data_size;
  D.18627 = D.18623 + D.18626;
  if (D.18627 > addr) goto <D.18628>; else goto <D.18629>;
  <D.18628>:
  D.18630 = iinfo->cli_sections;
  i.4 = (unsigned int) i;
  D.18632 = i.4 * 4;
  D.18633 = D.18630 + D.18632;
  D.18634 = *D.18633;
  if (D.18634 == 0B) goto <D.18635>; else goto <D.18636>;
  <D.18635>:
  D.18637 = mono_image_ensure_section_idx (image, i);
  if (D.18637 == 0) goto <D.18638>; else goto <D.18639>;
  <D.18638>:
  D.18640 = 0B;
  return D.18640;
  <D.18639>:
  <D.18636>:
  D.18630 = iinfo->cli_sections;
  i.4 = (unsigned int) i;
  D.18632 = i.4 * 4;
  D.18633 = D.18630 + D.18632;
  D.18634 = *D.18633;
  D.18623 = tables->st_virtual_address;
  D.18641 = addr - D.18623;
  D.18640 = D.18634 + D.18641;
  return D.18640;
  <D.18629>:
  <D.18625>:
  tables = tables + 40;
  i = i + 1;
  <D.17990>:
  if (i < top) goto <D.17989>; else goto <D.17991>;
  <D.17991>:
  D.18640 = 0B;
  return D.18640;
}


mono_images_init ()
{
  struct GHashTable * loaded_images_hash.5;
  struct GHashTable * loaded_images_refonly_hash.6;
  const gchar * D.18645;
  _Bool D.18646;
  int debug_assembly_unload.7;

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


mono_images_cleanup ()
{
  struct GHashTable * loaded_images_hash.8;
  struct MonoImage * image.9;
  char * D.18650;
  int D.18651;
  struct GHashTable * loaded_images_refonly_hash.10;
  struct GHashTableIter iter;
  struct MonoImage * image;

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


mono_image_ensure_section_idx (struct MonoImage * image, int section)
{
  int D.18653;
  int D.18656;
  void * * D.18657;
  unsigned int section.11;
  unsigned int D.18659;
  void * * D.18660;
  void * D.18661;
  struct MonoSectionTable * D.18664;
  unsigned int D.18665;
  unsigned int D.18666;
  int D.18667;
  unsigned int D.18668;
  unsigned int D.18669;
  unsigned int D.18670;
  unsigned int D.18671;
  char * D.18674;
  void * D.18675;
  struct MonoCLIImageInfo * iinfo;
  struct MonoSectionTable * sect;
  gboolean writable;

  iinfo = image->image_info;
  D.18653 = iinfo->cli_section_count;
  if (D.18653 <= section) goto <D.18654>; else goto <D.18655>;
  <D.18654>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 237, "section < iinfo->cli_section_count");
  D.18656 = 0;
  return D.18656;
  <D.18655>:
  D.18657 = iinfo->cli_sections;
  section.11 = (unsigned int) section;
  D.18659 = section.11 * 4;
  D.18660 = D.18657 + D.18659;
  D.18661 = *D.18660;
  if (D.18661 != 0B) goto <D.18662>; else goto <D.18663>;
  <D.18662>:
  D.18656 = 1;
  return D.18656;
  <D.18663>:
  D.18664 = iinfo->cli_section_tables;
  section.11 = (unsigned int) section;
  D.18665 = section.11 * 40;
  sect = D.18664 + D.18665;
  D.18666 = sect->st_flags;
  D.18667 = (int) D.18666;
  writable = D.18667 & -2147483648;
  D.18668 = sect->st_raw_data_ptr;
  D.18669 = sect->st_raw_data_size;
  D.18670 = D.18668 + D.18669;
  D.18671 = image->raw_data_len;
  if (D.18670 > D.18671) goto <D.18672>; else goto <D.18673>;
  <D.18672>:
  D.18656 = 0;
  return D.18656;
  <D.18673>:
  D.18657 = iinfo->cli_sections;
  section.11 = (unsigned int) section;
  D.18659 = section.11 * 4;
  D.18660 = D.18657 + D.18659;
  D.18674 = image->raw_data;
  D.18668 = sect->st_raw_data_ptr;
  D.18675 = D.18674 + D.18668;
  *D.18660 = D.18675;
  D.18656 = 1;
  return D.18656;
}


mono_image_ensure_section (struct MonoImage * image, const char * section)
{
  struct MonoSectionTable * D.18677;
  unsigned int i.12;
  unsigned int D.18679;
  struct MonoSectionTable * D.18680;
  char[8] * D.18681;
  int D.18682;
  int D.18685;
  int D.18686;
  struct MonoCLIImageInfo * ii;
  int i;

  ii = image->image_info;
  i = 0;
  goto <D.18027>;
  <D.18026>:
  D.18677 = ii->cli_section_tables;
  i.12 = (unsigned int) i;
  D.18679 = i.12 * 40;
  D.18680 = D.18677 + D.18679;
  D.18681 = &D.18680->st_name;
  D.18682 = strncmp (D.18681, section, 8);
  if (D.18682 != 0) goto <D.18683>; else goto <D.18684>;
  <D.18683>:
  // predicted unlikely by continue predictor.
  goto <D.18025>;
  <D.18684>:
  D.18685 = mono_image_ensure_section_idx (image, i);
  return D.18685;
  <D.18025>:
  i = i + 1;
  <D.18027>:
  D.18686 = ii->cli_section_count;
  if (D.18686 > i) goto <D.18026>; else goto <D.18028>;
  <D.18028>:
  D.18685 = 0;
  return D.18685;
}


mono_image_check_for_module_cctor (struct MonoImage * image)
{
  unsigned char D.18688;
  unsigned char D.18689;
  <unnamed-unsigned:24> D.18692;
  int D.18693;
  int D.18155;
  int iftmp.13;
  int D.18154;
  const char[9] * D.18699;
  unsigned char D.18700;
  int D.18701;
  unsigned char D.18702;
  int D.18703;
  _Bool D.18704;
  _Bool D.18705;
  _Bool D.18706;
  const unsigned char * D.18709;
  unsigned char D.18710;
  int D.18711;
  const unsigned char * D.18712;
  unsigned char D.18713;
  int D.18714;
  _Bool D.18715;
  _Bool D.18716;
  const unsigned char * D.18719;
  unsigned char D.18720;
  int D.18721;
  const unsigned char * D.18722;
  unsigned char D.18723;
  int D.18724;
  _Bool D.18725;
  _Bool D.18726;
  const unsigned char * D.18729;
  unsigned char D.18730;
  int D.18731;
  const unsigned char * D.18732;
  unsigned char D.18733;
  int D.18734;
  unsigned int D.18738;
  unsigned int D.18741;
  <unnamed-unsigned:24> D.18743;
  int first_method.14;
  int D.18166;
  int iftmp.15;
  int D.18165;
  const char[7] * D.18748;
  unsigned char D.18749;
  int D.18750;
  unsigned char D.18751;
  int D.18752;
  _Bool D.18753;
  _Bool D.18754;
  _Bool D.18755;
  const unsigned char * D.18758;
  unsigned char D.18759;
  int D.18760;
  const unsigned char * D.18761;
  unsigned char D.18762;
  int D.18763;
  _Bool D.18764;
  _Bool D.18765;
  const unsigned char * D.18768;
  unsigned char D.18769;
  int D.18770;
  const unsigned char * D.18771;
  unsigned char D.18772;
  int D.18773;
  _Bool D.18774;
  _Bool D.18775;
  const unsigned char * D.18778;
  unsigned char D.18779;
  int D.18780;
  const unsigned char * D.18781;
  unsigned char D.18782;
  int D.18783;
  struct MonoTableInfo * t;
  struct MonoTableInfo * mt;

  t = &image->tables[2];
  mt = &image->tables[6];
  D.18688 = BIT_FIELD_REF <*image, 8, 128>;
  D.18689 = D.18688 & 8;
  if (D.18689 != 0) goto <D.18690>; else goto <D.18691>;
  <D.18690>:
  image->checked_module_cctor = 1;
  return;
  <D.18691>:
  D.18692 = t->rows;
  D.18693 = (int) D.18692;
  if (D.18693 > 0) goto <D.18694>; else goto <D.18695>;
  <D.18694>:
  {
    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.18697>; else goto <D.18698>;
      <D.18697>:
      {
        const unsigned char * __s2;
        int __result;

        __s2 = name;
        D.18699 = "<Module>";
        D.18700 = MEM[(const unsigned char *)D.18699];
        D.18701 = (int) D.18700;
        D.18702 = *__s2;
        D.18703 = (int) D.18702;
        __result = D.18701 - D.18703;
        {
          D.18704 = __s2_len != 0;
          D.18705 = __result == 0;
          D.18706 = D.18704 & D.18705;
          if (D.18706 != 0) goto <D.18707>; else goto <D.18708>;
          <D.18707>:
          D.18709 = &MEM[(void *)"<Module>" + 1B];
          D.18710 = *D.18709;
          D.18711 = (int) D.18710;
          D.18712 = __s2 + 1;
          D.18713 = *D.18712;
          D.18714 = (int) D.18713;
          __result = D.18711 - D.18714;
          D.18715 = __s2_len > 1;
          D.18705 = __result == 0;
          D.18716 = D.18715 & D.18705;
          if (D.18716 != 0) goto <D.18717>; else goto <D.18718>;
          <D.18717>:
          D.18719 = &MEM[(void *)"<Module>" + 2B];
          D.18720 = *D.18719;
          D.18721 = (int) D.18720;
          D.18722 = __s2 + 2;
          D.18723 = *D.18722;
          D.18724 = (int) D.18723;
          __result = D.18721 - D.18724;
          D.18725 = __s2_len > 2;
          D.18705 = __result == 0;
          D.18726 = D.18725 & D.18705;
          if (D.18726 != 0) goto <D.18727>; else goto <D.18728>;
          <D.18727>:
          D.18729 = &MEM[(void *)"<Module>" + 3B];
          D.18730 = *D.18729;
          D.18731 = (int) D.18730;
          D.18732 = __s2 + 3;
          D.18733 = *D.18732;
          D.18734 = (int) D.18733;
          __result = D.18731 - D.18734;
          <D.18728>:
          <D.18718>:
          <D.18708>:
        }
        D.18154 = __result;
      }
      iftmp.13 = -D.18154;
      goto <D.18735>;
      <D.18698>:
      iftmp.13 = __builtin_strcmp (name, "<Module>");
      <D.18735>:
      D.18155 = iftmp.13;
    }
    if (D.18155 == 0) goto <D.18736>; else goto <D.18737>;
    <D.18736>:
    {
      guint32 first_method;
      guint32 last_method;

      D.18738 = mono_metadata_decode_row_col (t, 0, 5);
      first_method = D.18738 + 4294967295;
      D.18692 = t->rows;
      D.18693 = (int) D.18692;
      if (D.18693 > 1) goto <D.18739>; else goto <D.18740>;
      <D.18739>:
      D.18741 = mono_metadata_decode_row_col (t, 1, 5);
      last_method = D.18741 + 4294967295;
      goto <D.18742>;
      <D.18740>:
      D.18743 = mt->rows;
      last_method = (guint32) D.18743;
      <D.18742>:
      goto <D.18168>;
      <D.18167>:
      first_method.14 = (int) first_method;
      nameidx = mono_metadata_decode_row_col (mt, first_method.14, 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.18746>; else goto <D.18747>;
        <D.18746>:
        {
          const unsigned char * __s2;
          int __result;

          __s2 = name;
          D.18748 = ".cctor";
          D.18749 = MEM[(const unsigned char *)D.18748];
          D.18750 = (int) D.18749;
          D.18751 = *__s2;
          D.18752 = (int) D.18751;
          __result = D.18750 - D.18752;
          {
            D.18753 = __s2_len != 0;
            D.18754 = __result == 0;
            D.18755 = D.18753 & D.18754;
            if (D.18755 != 0) goto <D.18756>; else goto <D.18757>;
            <D.18756>:
            D.18758 = &MEM[(void *)".cctor" + 1B];
            D.18759 = *D.18758;
            D.18760 = (int) D.18759;
            D.18761 = __s2 + 1;
            D.18762 = *D.18761;
            D.18763 = (int) D.18762;
            __result = D.18760 - D.18763;
            D.18764 = __s2_len > 1;
            D.18754 = __result == 0;
            D.18765 = D.18764 & D.18754;
            if (D.18765 != 0) goto <D.18766>; else goto <D.18767>;
            <D.18766>:
            D.18768 = &MEM[(void *)".cctor" + 2B];
            D.18769 = *D.18768;
            D.18770 = (int) D.18769;
            D.18771 = __s2 + 2;
            D.18772 = *D.18771;
            D.18773 = (int) D.18772;
            __result = D.18770 - D.18773;
            D.18774 = __s2_len > 2;
            D.18754 = __result == 0;
            D.18775 = D.18774 & D.18754;
            if (D.18775 != 0) goto <D.18776>; else goto <D.18777>;
            <D.18776>:
            D.18778 = &MEM[(void *)".cctor" + 3B];
            D.18779 = *D.18778;
            D.18780 = (int) D.18779;
            D.18781 = __s2 + 3;
            D.18782 = *D.18781;
            D.18783 = (int) D.18782;
            __result = D.18780 - D.18783;
            <D.18777>:
            <D.18767>:
            <D.18757>:
          }
          D.18165 = __result;
        }
        iftmp.15 = -D.18165;
        goto <D.18784>;
        <D.18747>:
        iftmp.15 = __builtin_strcmp (name, ".cctor");
        <D.18784>:
        D.18166 = iftmp.15;
      }
      if (D.18166 == 0) goto <D.18785>; else goto <D.18786>;
      <D.18785>:
      image->has_module_cctor = 1;
      image->checked_module_cctor = 1;
      return;
      <D.18786>:
      first_method = first_method + 1;
      <D.18168>:
      if (first_method < last_method) goto <D.18167>; else goto <D.18169>;
      <D.18169>:
    }
    <D.18737>:
  }
  <D.18695>:
  image->has_module_cctor = 0;
  image->checked_module_cctor = 1;
}


mono_image_load_module (struct MonoImage * image, int idx)
{
  <unnamed-unsigned:1> D.18788;
  unsigned int D.18791;
  unsigned int idx.16;
  struct MonoImage * D.18795;
  gboolean * D.18796;
  sizetype idx.17;
  sizetype D.18798;
  sizetype D.18799;
  gboolean * D.18800;
  int D.18801;
  struct MonoImage * * D.18804;
  struct MonoImage * * D.18805;
  unsigned int D.18806;
  unsigned int D.18809;
  const char * D.18810;
  <unnamed-unsigned:24> D.18811;
  int D.18812;
  char * D.18813;
  unsigned int D.18814;
  unsigned int D.18815;
  _Bool D.18816;
  int D.18817;
  unsigned int D.18818;
  int D.18203;
  void * D.18819;
  struct MonoImage * D.18824;
  struct MonoImage * D.18825;
  struct MonoAssembly * D.18828;
  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.18788 = image->ref_only;
      refonly = (gboolean) D.18788;
      valid_modules = 0B;
      D.18791 = image->module_count;
      if (D.18791 == 0) goto <D.18789>; else goto <D.18792>;
      <D.18792>:
      idx.16 = (unsigned int) idx;
      D.18791 = image->module_count;
      if (idx.16 > D.18791) goto <D.18789>; else goto <D.18794>;
      <D.18794>:
      if (idx <= 0) goto <D.18789>; else goto <D.18790>;
      <D.18789>:
      D.18795 = 0B;
      return D.18795;
      <D.18790>:
      D.18796 = image->modules_loaded;
      idx.17 = (sizetype) idx;
      D.18798 = idx.17 + 1073741823;
      D.18799 = D.18798 * 4;
      D.18800 = D.18796 + D.18799;
      D.18801 = *D.18800;
      if (D.18801 != 0) goto <D.18802>; else goto <D.18803>;
      <D.18802>:
      D.18804 = image->modules;
      idx.17 = (sizetype) idx;
      D.18798 = idx.17 + 1073741823;
      D.18799 = D.18798 * 4;
      D.18805 = D.18804 + D.18799;
      D.18795 = *D.18805;
      return D.18795;
      <D.18803>:
      file_table = &image->tables[38];
      i = 0;
      goto <D.18189>;
      <D.18188>:
      {
        guint32 cols[3];

        try
          {
            mono_metadata_decode_row (file_table, i, &cols, 3);
            D.18806 = cols[0];
            if (D.18806 == 1) goto <D.18807>; else goto <D.18808>;
            <D.18807>:
            // predicted unlikely by continue predictor.
            goto <D.18187>;
            <D.18808>:
            D.18809 = cols[1];
            D.18810 = mono_metadata_string_heap (image, D.18809);
            valid_modules = monoeg_g_list_prepend (valid_modules, D.18810);
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      <D.18187>:
      i = i + 1;
      <D.18189>:
      D.18811 = file_table->rows;
      D.18812 = (int) D.18811;
      if (D.18812 > i) goto <D.18188>; else goto <D.18190>;
      <D.18190>:
      t = &image->tables[26];
      D.18813 = image->name;
      base_dir = monoeg_g_path_get_dirname (D.18813);
      {
        char * module_ref;
        const char * name;
        guint32 cols[1];
        int valid;

        try
          {
            D.18814 = BIT_FIELD_REF <*file_table, 32, 32>;
            D.18815 = D.18814 & 16777215;
            D.18816 = D.18815 == 0;
            valid = (int) D.18816;
            D.18817 = idx + -1;
            mono_metadata_decode_row (t, D.18817, &cols, 1);
            D.18818 = cols[0];
            name = mono_metadata_string_heap (image, D.18818);
            list_iter = valid_modules;
            goto <D.18206>;
            <D.18205>:
            {
              size_t __s1_len;
              size_t __s2_len;

              D.18819 = list_iter->data;
              D.18203 = __builtin_strcmp (D.18819, name);
            }
            if (D.18203 == 0) goto <D.18820>; else goto <D.18821>;
            <D.18820>:
            valid = 1;
            goto <D.18204>;
            <D.18821>:
            list_iter = list_iter->next;
            <D.18206>:
            if (list_iter != 0B) goto <D.18205>; else goto <D.18204>;
            <D.18204>:
            if (valid != 0) goto <D.18822>; else goto <D.18823>;
            <D.18822>:
            module_ref = monoeg_g_build_path ("/", base_dir, name, 0B);
            D.18804 = image->modules;
            idx.17 = (sizetype) idx;
            D.18798 = idx.17 + 1073741823;
            D.18799 = D.18798 * 4;
            D.18805 = D.18804 + D.18799;
            D.18824 = mono_image_open_full (module_ref, &status, refonly);
            *D.18805 = D.18824;
            D.18804 = image->modules;
            idx.17 = (sizetype) idx;
            D.18798 = idx.17 + 1073741823;
            D.18799 = D.18798 * 4;
            D.18805 = D.18804 + D.18799;
            D.18825 = *D.18805;
            if (D.18825 != 0B) goto <D.18826>; else goto <D.18827>;
            <D.18826>:
            D.18804 = image->modules;
            idx.17 = (sizetype) idx;
            D.18798 = idx.17 + 1073741823;
            D.18799 = D.18798 * 4;
            D.18805 = D.18804 + D.18799;
            D.18825 = *D.18805;
            mono_image_addref (D.18825);
            D.18804 = image->modules;
            idx.17 = (sizetype) idx;
            D.18798 = idx.17 + 1073741823;
            D.18799 = D.18798 * 4;
            D.18805 = D.18804 + D.18799;
            D.18825 = *D.18805;
            D.18828 = image->assembly;
            D.18825->assembly = D.18828;
            <D.18827>:
            monoeg_g_free (module_ref);
            <D.18823>:
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      D.18796 = image->modules_loaded;
      idx.17 = (sizetype) idx;
      D.18798 = idx.17 + 1073741823;
      D.18799 = D.18798 * 4;
      D.18800 = D.18796 + D.18799;
      *D.18800 = 1;
      monoeg_g_free (base_dir);
      monoeg_g_list_free (valid_modules);
      D.18804 = image->modules;
      idx.17 = (sizetype) idx;
      D.18798 = idx.17 + 1073741823;
      D.18799 = D.18798 * 4;
      D.18805 = D.18804 + D.18799;
      D.18795 = *D.18805;
      return D.18795;
    }
  finally
    {
      status = {CLOBBER};
    }
}


mono_image_init (struct MonoImage * image)
{
  struct MonoMemPool * D.18833;
  struct MonoInternalHashTable * D.18834;
  struct GHashTable * D.18835;
  struct GHashTable * D.18836;
  struct GHashTable * D.18837;
  struct GHashTable * D.18838;
  struct GHashTable * D.18839;
  struct MonoPropertyHash * D.18840;
  struct CRITICAL_SECTION * D.18841;
  struct CRITICAL_SECTION * D.18842;

  D.18833 = mono_mempool_new_size (512);
  image->mempool = D.18833;
  D.18834 = &image->class_cache;
  mono_internal_hash_table_init (D.18834, monoeg_g_direct_hash, class_key_extract, class_next_value);
  D.18835 = monoeg_g_hash_table_new (0B, 0B);
  image->field_cache = D.18835;
  D.18836 = monoeg_g_hash_table_new (0B, 0B);
  image->typespec_cache = D.18836;
  D.18837 = monoeg_g_hash_table_new (0B, 0B);
  image->memberref_signatures = D.18837;
  D.18838 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  image->helper_signatures = D.18838;
  D.18839 = monoeg_g_hash_table_new (0B, 0B);
  image->method_signatures = D.18839;
  D.18840 = mono_property_hash_new ();
  image->property_hash = D.18840;
  D.18841 = &image->lock;
  InitializeCriticalSection (D.18841);
  D.18842 = &image->szarray_cache_lock;
  InitializeCriticalSection (D.18842);
}


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

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


class_key_extract (void * value)
{
  void * D.18845;
  unsigned int D.18846;
  struct MonoClass * class;

  class = value;
  D.18846 = class->type_token;
  D.18845 = (void *) D.18846;
  return D.18845;
}


mono_image_load_pe_data (struct MonoImage * image)
{
  unsigned int offset.18;
  unsigned int D.18849;
  unsigned int D.18850;
  char * D.18852;
  sizetype offset.19;
  char * D.18854;
  signed short D.18855;
  short unsigned int D.18856;
  short unsigned int D.18857;
  unsigned int D.18859;
  unsigned int offset.20;
  int D.18862;
  gboolean D.18864;
  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;
      offset.18 = (unsigned int) offset;
      D.18849 = offset.18 + 128;
      D.18850 = image->raw_data_len;
      if (D.18849 > D.18850) goto invalid_image; else goto <D.18851>;
      <D.18851>:
      D.18852 = image->raw_data;
      offset.19 = (sizetype) offset;
      D.18854 = D.18852 + offset.19;
      memcpy (&msdos, D.18854, 128);
      D.18855 = BIT_FIELD_REF <msdos, 16, 0>;
      D.18856 = (short unsigned int) D.18855;
      D.18857 = D.18856;
      if (D.18857 != 23117) goto invalid_image; else goto <D.18858>;
      <D.18858>:
      D.18859 = msdos.pe_offset;
      msdos.pe_offset = D.18859;
      D.18859 = msdos.pe_offset;
      offset = (gint32) D.18859;
      offset = do_load_header (image, header, offset);
      if (offset < 0) goto invalid_image; else goto <D.18860>;
      <D.18860>:
      offset.20 = (unsigned int) offset;
      D.18862 = load_section_tables (image, iinfo, offset.20);
      if (D.18862 == 0) goto invalid_image; else goto <D.18863>;
      <D.18863>:
      D.18864 = 1;
      return D.18864;
      invalid_image:
      D.18864 = 0;
      return D.18864;
    }
  finally
    {
      msdos = {CLOBBER};
    }
}


memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.18867;
  unsigned int D.18868;

  D.18868 = __builtin_object_size (__dest, 0);
  D.18867 = __builtin___memcpy_chk (__dest, __src, __len, D.18868);
  return D.18867;
}


do_load_header (struct MonoImage * image, struct MonoDotNetHeader * header, int offset)
{
  unsigned int offset.21;
  unsigned int D.18871;
  unsigned int D.18872;
  int D.18875;
  char * D.18876;
  sizetype offset.22;
  char * D.18878;
  signed short D.18879;
  short unsigned int D.18880;
  short unsigned int D.18881;
  short unsigned int D.18884;
  short unsigned int D.18887;
  unsigned int D.18895;
  long long unsigned int D.18896;
  unsigned int D.18897;
  long long unsigned int D.18898;
  unsigned int D.18899;
  long long unsigned int D.18900;
  unsigned int D.18901;
  long long unsigned int D.18902;
  unsigned int D.18903;
  long long unsigned int D.18904;
  unsigned int D.18905;
  unsigned int D.18906;
  unsigned int D.18907;
  short unsigned int D.18908;
  short unsigned int D.18909;
  short unsigned int D.18910;
  short unsigned int D.18911;
  short unsigned int D.18912;
  short unsigned int D.18913;
  unsigned int D.18914;
  unsigned int D.18915;
  unsigned int D.18916;
  unsigned int D.18917;
  short unsigned int D.18918;
  short unsigned int D.18919;
  unsigned int D.18920;
  unsigned int D.18921;
  struct MonoPEDatadir * D.18922;
  struct MonoDotNetHeader64 header64;

  try
    {
      offset.21 = (unsigned int) offset;
      D.18871 = offset.21 + 248;
      D.18872 = image->raw_data_len;
      if (D.18871 > D.18872) goto <D.18873>; else goto <D.18874>;
      <D.18873>:
      D.18875 = -1;
      return D.18875;
      <D.18874>:
      D.18876 = image->raw_data;
      offset.22 = (sizetype) offset;
      D.18878 = D.18876 + offset.22;
      memcpy (header, D.18878, 248);
      D.18879 = BIT_FIELD_REF <*header, 16, 0>;
      D.18880 = (short unsigned int) D.18879;
      D.18881 = D.18880;
      if (D.18881 != 17744) goto <D.18882>; else goto <D.18883>;
      <D.18882>:
      D.18875 = -1;
      return D.18875;
      <D.18883>:
      D.18884 = header->pe.pe_magic;
      if (D.18884 == 267) goto <D.18885>; else goto <D.18886>;
      <D.18885>:
      offset.21 = (unsigned int) offset;
      D.18871 = offset.21 + 248;
      offset = (int) D.18871;
      D.18887 = header->coff.coff_opt_header_size;
      if (D.18887 != 224) goto <D.18888>; else goto <D.18889>;
      <D.18888>:
      D.18875 = -1;
      return D.18875;
      <D.18889>:
      goto <D.18890>;
      <D.18886>:
      D.18884 = header->pe.pe_magic;
      if (D.18884 == 523) goto <D.18891>; else goto <D.18892>;
      <D.18891>:
      D.18887 = header->coff.coff_opt_header_size;
      if (D.18887 != 240) goto <D.18893>; else goto <D.18894>;
      <D.18893>:
      D.18875 = -1;
      return D.18875;
      <D.18894>:
      D.18876 = image->raw_data;
      offset.22 = (sizetype) offset;
      D.18878 = D.18876 + offset.22;
      memcpy (&header64, D.18878, 264);
      offset.21 = (unsigned int) offset;
      D.18895 = offset.21 + 264;
      offset = (int) D.18895;
      memcpy (&header64, header, 244);
      D.18896 = header64.nt.pe_image_base;
      D.18897 = (unsigned int) D.18896;
      header->nt.pe_image_base = D.18897;
      D.18898 = header64.nt.pe_stack_reserve;
      D.18899 = (unsigned int) D.18898;
      header->nt.pe_stack_reserve = D.18899;
      D.18900 = header64.nt.pe_stack_commit;
      D.18901 = (unsigned int) D.18900;
      header->nt.pe_stack_commit = D.18901;
      D.18902 = header64.nt.pe_heap_reserve;
      D.18903 = (unsigned int) D.18902;
      header->nt.pe_heap_reserve = D.18903;
      D.18904 = header64.nt.pe_heap_commit;
      D.18905 = (unsigned int) D.18904;
      header->nt.pe_heap_commit = D.18905;
      D.18906 = header64.nt.pe_section_align;
      header->nt.pe_section_align = D.18906;
      D.18907 = header64.nt.pe_file_alignment;
      header->nt.pe_file_alignment = D.18907;
      D.18908 = header64.nt.pe_os_major;
      header->nt.pe_os_major = D.18908;
      D.18909 = header64.nt.pe_os_minor;
      header->nt.pe_os_minor = D.18909;
      D.18910 = header64.nt.pe_user_major;
      header->nt.pe_user_major = D.18910;
      D.18911 = header64.nt.pe_user_minor;
      header->nt.pe_user_minor = D.18911;
      D.18912 = header64.nt.pe_subsys_major;
      header->nt.pe_subsys_major = D.18912;
      D.18913 = header64.nt.pe_subsys_minor;
      header->nt.pe_subsys_minor = D.18913;
      D.18914 = header64.nt.pe_reserved_1;
      header->nt.pe_reserved_1 = D.18914;
      D.18915 = header64.nt.pe_image_size;
      header->nt.pe_image_size = D.18915;
      D.18916 = header64.nt.pe_header_size;
      header->nt.pe_header_size = D.18916;
      D.18917 = header64.nt.pe_checksum;
      header->nt.pe_checksum = D.18917;
      D.18918 = header64.nt.pe_subsys_required;
      header->nt.pe_subsys_required = D.18918;
      D.18919 = header64.nt.pe_dll_flags;
      header->nt.pe_dll_flags = D.18919;
      D.18920 = header64.nt.pe_loader_flags;
      header->nt.pe_loader_flags = D.18920;
      D.18921 = header64.nt.pe_data_dir_count;
      header->nt.pe_data_dir_count = D.18921;
      D.18922 = &header->datadir;
      memcpy (D.18922, &header64.datadir, 128);
      goto <D.18923>;
      <D.18892>:
      D.18875 = -1;
      return D.18875;
      <D.18923>:
      <D.18890>:
      D.18875 = offset;
      return D.18875;
    }
  finally
    {
      header64 = {CLOBBER};
    }
}


load_section_tables (struct MonoImage * image, struct MonoCLIImageInfo * iinfo, guint32 offset)
{
  short unsigned int D.18926;
  unsigned int top.23;
  unsigned int D.18928;
  void * D.18929;
  unsigned int D.18930;
  void * D.18931;
  struct MonoSectionTable * D.18932;
  unsigned int i.24;
  unsigned int D.18934;
  unsigned int D.18935;
  unsigned int D.18936;
  int D.18939;
  char * D.18940;
  char * D.18941;
  const int top;
  int i;

  D.18926 = iinfo->cli_header.coff.coff_sections;
  top = (const int) D.18926;
  iinfo->cli_section_count = top;
  top.23 = (unsigned int) top;
  D.18928 = top.23 * 40;
  D.18929 = monoeg_malloc0 (D.18928);
  iinfo->cli_section_tables = D.18929;
  top.23 = (unsigned int) top;
  D.18930 = top.23 * 4;
  D.18931 = monoeg_malloc0 (D.18930);
  iinfo->cli_sections = D.18931;
  i = 0;
  goto <D.18038>;
  <D.18037>:
  {
    struct MonoSectionTable * t;

    D.18932 = iinfo->cli_section_tables;
    i.24 = (unsigned int) i;
    D.18934 = i.24 * 40;
    t = D.18932 + D.18934;
    D.18935 = offset + 40;
    D.18936 = image->raw_data_len;
    if (D.18935 > D.18936) goto <D.18937>; else goto <D.18938>;
    <D.18937>:
    D.18939 = 0;
    return D.18939;
    <D.18938>:
    D.18940 = image->raw_data;
    D.18941 = D.18940 + offset;
    memcpy (t, D.18941, 40);
    offset = offset + 40;
  }
  i = i + 1;
  <D.18038>:
  if (i < top) goto <D.18037>; else goto <D.18039>;
  <D.18039>:
  D.18939 = 1;
  return D.18939;
}


mono_image_load_cli_data (struct MonoImage * image)
{
  int D.18943;
  gboolean D.18946;
  int D.18947;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  D.18943 = load_cli_header (image, iinfo);
  if (D.18943 == 0) goto <D.18944>; else goto <D.18945>;
  <D.18944>:
  D.18946 = 0;
  return D.18946;
  <D.18945>:
  D.18947 = load_metadata (image, iinfo);
  if (D.18947 == 0) goto <D.18948>; else goto <D.18949>;
  <D.18948>:
  D.18946 = 0;
  return D.18946;
  <D.18949>:
  D.18946 = 1;
  return D.18946;
}


load_cli_header (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.18951;
  gboolean D.18954;
  unsigned int D.18955;
  unsigned int D.18956;
  char * D.18959;
  char * D.18960;
  struct MonoCLIHeader * D.18961;
  unsigned int D.18962;
  unsigned int D.18965;
  unsigned int D.18968;
  unsigned int D.18971;
  unsigned int D.18974;
  unsigned int D.18977;
  unsigned int D.18980;
  unsigned int D.18983;
  unsigned int D.18986;
  guint32 offset;

  D.18951 = iinfo->cli_header.datadir.pe_cli_header.rva;
  offset = mono_cli_rva_image_map (image, D.18951);
  if (offset == 4294967295) goto <D.18952>; else goto <D.18953>;
  <D.18952>:
  D.18954 = 0;
  return D.18954;
  <D.18953>:
  D.18955 = offset + 136;
  D.18956 = image->raw_data_len;
  if (D.18955 > D.18956) goto <D.18957>; else goto <D.18958>;
  <D.18957>:
  D.18954 = 0;
  return D.18954;
  <D.18958>:
  D.18959 = image->raw_data;
  D.18960 = D.18959 + offset;
  D.18961 = &iinfo->cli_cli_header;
  memcpy (D.18961, D.18960, 136);
  D.18962 = iinfo->cli_cli_header.ch_eeinfo_table.rva;
  if (D.18962 != 0) goto <D.18963>; else goto <D.18964>;
  <D.18964>:
  D.18965 = iinfo->cli_cli_header.ch_helper_table.rva;
  if (D.18965 != 0) goto <D.18966>; else goto <D.18967>;
  <D.18967>:
  D.18968 = iinfo->cli_cli_header.ch_dynamic_info.rva;
  if (D.18968 != 0) goto <D.18969>; else goto <D.18970>;
  <D.18970>:
  D.18971 = iinfo->cli_cli_header.ch_delay_load_info.rva;
  if (D.18971 != 0) goto <D.18972>; else goto <D.18973>;
  <D.18973>:
  D.18974 = iinfo->cli_cli_header.ch_module_image.rva;
  if (D.18974 != 0) goto <D.18975>; else goto <D.18976>;
  <D.18976>:
  D.18977 = iinfo->cli_cli_header.ch_external_fixups.rva;
  if (D.18977 != 0) goto <D.18978>; else goto <D.18979>;
  <D.18979>:
  D.18980 = iinfo->cli_cli_header.ch_ridmap.rva;
  if (D.18980 != 0) goto <D.18981>; else goto <D.18982>;
  <D.18982>:
  D.18983 = iinfo->cli_cli_header.ch_debug_map.rva;
  if (D.18983 != 0) goto <D.18984>; else goto <D.18985>;
  <D.18985>:
  D.18986 = iinfo->cli_cli_header.ch_ip_map.rva;
  if (D.18986 != 0) goto <D.18987>; else goto <D.18988>;
  <D.18987>:
  <D.18988>:
  <D.18984>:
  <D.18981>:
  <D.18978>:
  <D.18975>:
  <D.18972>:
  <D.18969>:
  <D.18966>:
  <D.18963>:
  D.18954 = 1;
  return D.18954;
}


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

  D.18990 = load_metadata_ptrs (image, iinfo);
  if (D.18990 == 0) goto <D.18991>; else goto <D.18992>;
  <D.18991>:
  D.18993 = 0;
  return D.18993;
  <D.18992>:
  D.18993 = load_tables (image);
  return D.18993;
}


load_metadata_ptrs (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.18995;
  gboolean D.18998;
  unsigned int D.18999;
  unsigned int D.19000;
  char * D.19003;
  char * D.19004;
  int D.19005;
  short unsigned int D.19008;
  short int D.19009;
  gchar * D.19010;
  int ptr.25;
  char * D.19012;
  int D.19013;
  int D.19014;
  unsigned int D.19015;
  unsigned int D.19018;
  int D.18073;
  int iftmp.26;
  int D.18072;
  const char[3] * D.19023;
  unsigned char D.19024;
  int D.19025;
  unsigned char D.19026;
  int D.19027;
  _Bool D.19028;
  _Bool D.19029;
  _Bool D.19030;
  const unsigned char * D.19033;
  unsigned char D.19034;
  int D.19035;
  const unsigned char * D.19036;
  unsigned char D.19037;
  int D.19038;
  _Bool D.19039;
  _Bool D.19040;
  const unsigned char * D.19043;
  unsigned char D.19044;
  int D.19045;
  const unsigned char * D.19046;
  unsigned char D.19047;
  int D.19048;
  _Bool D.19049;
  _Bool D.19050;
  const unsigned char * D.19053;
  unsigned char D.19054;
  int D.19055;
  const unsigned char * D.19056;
  unsigned char D.19057;
  int D.19058;
  const char * D.19060;
  unsigned int D.19063;
  const char * D.19064;
  unsigned int D.19065;
  int D.18082;
  int iftmp.27;
  int D.18081;
  const char[9] * D.19070;
  unsigned char D.19071;
  int D.19072;
  unsigned char D.19073;
  int D.19074;
  _Bool D.19075;
  _Bool D.19076;
  _Bool D.19077;
  const unsigned char * D.19080;
  unsigned char D.19081;
  int D.19082;
  const unsigned char * D.19083;
  unsigned char D.19084;
  int D.19085;
  _Bool D.19086;
  _Bool D.19087;
  const unsigned char * D.19090;
  unsigned char D.19091;
  int D.19092;
  const unsigned char * D.19093;
  unsigned char D.19094;
  int D.19095;
  _Bool D.19096;
  _Bool D.19097;
  const unsigned char * D.19100;
  unsigned char D.19101;
  int D.19102;
  const unsigned char * D.19103;
  unsigned char D.19104;
  int D.19105;
  int D.18091;
  int iftmp.28;
  int D.18090;
  const char[4] * D.19113;
  unsigned char D.19114;
  int D.19115;
  unsigned char D.19116;
  int D.19117;
  _Bool D.19118;
  _Bool D.19119;
  _Bool D.19120;
  const unsigned char * D.19123;
  unsigned char D.19124;
  int D.19125;
  const unsigned char * D.19126;
  unsigned char D.19127;
  int D.19128;
  _Bool D.19129;
  _Bool D.19130;
  const unsigned char * D.19133;
  unsigned char D.19134;
  int D.19135;
  const unsigned char * D.19136;
  unsigned char D.19137;
  int D.19138;
  _Bool D.19139;
  _Bool D.19140;
  const unsigned char * D.19143;
  unsigned char D.19144;
  int D.19145;
  const unsigned char * D.19146;
  unsigned char D.19147;
  int D.19148;
  int D.18100;
  int iftmp.29;
  int D.18099;
  const char[6] * D.19156;
  unsigned char D.19157;
  int D.19158;
  unsigned char D.19159;
  int D.19160;
  _Bool D.19161;
  _Bool D.19162;
  _Bool D.19163;
  const unsigned char * D.19166;
  unsigned char D.19167;
  int D.19168;
  const unsigned char * D.19169;
  unsigned char D.19170;
  int D.19171;
  _Bool D.19172;
  _Bool D.19173;
  const unsigned char * D.19176;
  unsigned char D.19177;
  int D.19178;
  const unsigned char * D.19179;
  unsigned char D.19180;
  int D.19181;
  _Bool D.19182;
  _Bool D.19183;
  const unsigned char * D.19186;
  unsigned char D.19187;
  int D.19188;
  const unsigned char * D.19189;
  unsigned char D.19190;
  int D.19191;
  int D.18109;
  int iftmp.30;
  int D.18108;
  const char[6] * D.19199;
  unsigned char D.19200;
  int D.19201;
  unsigned char D.19202;
  int D.19203;
  _Bool D.19204;
  _Bool D.19205;
  _Bool D.19206;
  const unsigned char * D.19209;
  unsigned char D.19210;
  int D.19211;
  const unsigned char * D.19212;
  unsigned char D.19213;
  int D.19214;
  _Bool D.19215;
  _Bool D.19216;
  const unsigned char * D.19219;
  unsigned char D.19220;
  int D.19221;
  const unsigned char * D.19222;
  unsigned char D.19223;
  int D.19224;
  _Bool D.19225;
  _Bool D.19226;
  const unsigned char * D.19229;
  unsigned char D.19230;
  int D.19231;
  const unsigned char * D.19232;
  unsigned char D.19233;
  int D.19234;
  int D.18118;
  int iftmp.31;
  int D.18117;
  const char[3] * D.19242;
  unsigned char D.19243;
  int D.19244;
  unsigned char D.19245;
  int D.19246;
  _Bool D.19247;
  _Bool D.19248;
  _Bool D.19249;
  const unsigned char * D.19252;
  unsigned char D.19253;
  int D.19254;
  const unsigned char * D.19255;
  unsigned char D.19256;
  int D.19257;
  _Bool D.19258;
  _Bool D.19259;
  const unsigned char * D.19262;
  unsigned char D.19263;
  int D.19264;
  const unsigned char * D.19265;
  unsigned char D.19266;
  int D.19267;
  _Bool D.19268;
  _Bool D.19269;
  const unsigned char * D.19272;
  unsigned char D.19273;
  int D.19274;
  const unsigned char * D.19275;
  unsigned char D.19276;
  int D.19277;
  char * D.19281;
  char * D.19283;
  unsigned int D.19284;
  sizetype D.19285;
  int D.19288;
  const char * D.19289;
  _Bool D.19290;
  long int D.19291;
  long int D.19292;
  unsigned int D.19295;
  _Bool D.19296;
  long int D.19297;
  long int D.19298;
  char * D.19301;
  guint32 offset;
  guint32 size;
  guint16 streams;
  int i;
  guint32 pad;
  char * ptr;

  D.18995 = iinfo->cli_cli_header.ch_metadata.rva;
  offset = mono_cli_rva_image_map (image, D.18995);
  if (offset == 4294967295) goto <D.18996>; else goto <D.18997>;
  <D.18996>:
  D.18998 = 0;
  return D.18998;
  <D.18997>:
  size = iinfo->cli_cli_header.ch_metadata.size;
  D.18999 = offset + size;
  D.19000 = image->raw_data_len;
  if (D.18999 > D.19000) goto <D.19001>; else goto <D.19002>;
  <D.19001>:
  D.18998 = 0;
  return D.18998;
  <D.19002>:
  D.19003 = image->raw_data;
  D.19004 = D.19003 + offset;
  image->raw_metadata = D.19004;
  ptr = image->raw_metadata;
  D.19005 = strncmp (ptr, "BSJB", 4);
  if (D.19005 == 0) goto <D.19006>; else goto <D.19007>;
  <D.19006>:
  {
    guint32 version_string_len;

    ptr = ptr + 4;
    D.19008 = MEM[(const guint16 *)ptr];
    D.19009 = (short int) D.19008;
    image->md_version_major = D.19009;
    ptr = ptr + 2;
    D.19008 = MEM[(const guint16 *)ptr];
    D.19009 = (short int) D.19008;
    image->md_version_minor = D.19009;
    ptr = ptr + 6;
    version_string_len = MEM[(const guint32 *)ptr];
    ptr = ptr + 4;
    D.19010 = monoeg_g_strndup (ptr, version_string_len);
    image->version = D.19010;
    ptr = ptr + version_string_len;
    ptr.25 = (int) ptr;
    D.19012 = image->raw_metadata;
    D.19013 = (int) D.19012;
    D.19014 = ptr.25 - D.19013;
    pad = (guint32) D.19014;
    D.19015 = pad & 3;
    if (D.19015 != 0) goto <D.19016>; else goto <D.19017>;
    <D.19016>:
    D.19015 = pad & 3;
    D.19018 = 4 - D.19015;
    ptr = ptr + D.19018;
    <D.19017>:
  }
  goto <D.19019>;
  <D.19007>:
  D.18998 = 0;
  return D.18998;
  <D.19019>:
  ptr = ptr + 2;
  streams = MEM[(const guint16 *)ptr];
  ptr = ptr + 2;
  i = 0;
  goto <D.18120>;
  <D.18119>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19023 = "#~";
      D.19024 = MEM[(const unsigned char *)D.19023];
      D.19025 = (int) D.19024;
      D.19026 = *__s2;
      D.19027 = (int) D.19026;
      __result = D.19025 - D.19027;
      {
        D.19028 = __s2_len != 0;
        D.19029 = __result == 0;
        D.19030 = D.19028 & D.19029;
        if (D.19030 != 0) goto <D.19031>; else goto <D.19032>;
        <D.19031>:
        D.19033 = &MEM[(void *)"#~" + 1B];
        D.19034 = *D.19033;
        D.19035 = (int) D.19034;
        D.19036 = __s2 + 1;
        D.19037 = *D.19036;
        D.19038 = (int) D.19037;
        __result = D.19035 - D.19038;
        D.19039 = __s2_len > 1;
        D.19029 = __result == 0;
        D.19040 = D.19039 & D.19029;
        if (D.19040 != 0) goto <D.19041>; else goto <D.19042>;
        <D.19041>:
        D.19043 = &MEM[(void *)"#~" + 2B];
        D.19044 = *D.19043;
        D.19045 = (int) D.19044;
        D.19046 = __s2 + 2;
        D.19047 = *D.19046;
        D.19048 = (int) D.19047;
        __result = D.19045 - D.19048;
        D.19049 = __s2_len > 2;
        D.19029 = __result == 0;
        D.19050 = D.19049 & D.19029;
        if (D.19050 != 0) goto <D.19051>; else goto <D.19052>;
        <D.19051>:
        D.19053 = &MEM[(void *)"#~" + 3B];
        D.19054 = *D.19053;
        D.19055 = (int) D.19054;
        D.19056 = __s2 + 3;
        D.19057 = *D.19056;
        D.19058 = (int) D.19057;
        __result = D.19055 - D.19058;
        <D.19052>:
        <D.19042>:
        <D.19032>:
      }
      D.18072 = __result;
    }
    iftmp.26 = -D.18072;
    goto <D.19059>;
    <D.19022>:
    D.19060 = ptr + 8;
    iftmp.26 = __builtin_strcmp (D.19060, "#~");
    <D.19059>:
    D.18073 = iftmp.26;
  }
  if (D.18073 == 0) goto <D.19061>; else goto <D.19062>;
  <D.19061>:
  D.19012 = image->raw_metadata;
  D.19063 = MEM[(const guint32 *)ptr];
  D.19064 = D.19012 + D.19063;
  image->heap_tables.data = D.19064;
  D.19065 = MEM[(const guint32 *)ptr + 4B];
  image->heap_tables.size = D.19065;
  ptr = ptr + 11;
  goto <D.19066>;
  <D.19062>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19070 = "#Strings";
      D.19071 = MEM[(const unsigned char *)D.19070];
      D.19072 = (int) D.19071;
      D.19073 = *__s2;
      D.19074 = (int) D.19073;
      __result = D.19072 - D.19074;
      {
        D.19075 = __s2_len != 0;
        D.19076 = __result == 0;
        D.19077 = D.19075 & D.19076;
        if (D.19077 != 0) goto <D.19078>; else goto <D.19079>;
        <D.19078>:
        D.19080 = &MEM[(void *)"#Strings" + 1B];
        D.19081 = *D.19080;
        D.19082 = (int) D.19081;
        D.19083 = __s2 + 1;
        D.19084 = *D.19083;
        D.19085 = (int) D.19084;
        __result = D.19082 - D.19085;
        D.19086 = __s2_len > 1;
        D.19076 = __result == 0;
        D.19087 = D.19086 & D.19076;
        if (D.19087 != 0) goto <D.19088>; else goto <D.19089>;
        <D.19088>:
        D.19090 = &MEM[(void *)"#Strings" + 2B];
        D.19091 = *D.19090;
        D.19092 = (int) D.19091;
        D.19093 = __s2 + 2;
        D.19094 = *D.19093;
        D.19095 = (int) D.19094;
        __result = D.19092 - D.19095;
        D.19096 = __s2_len > 2;
        D.19076 = __result == 0;
        D.19097 = D.19096 & D.19076;
        if (D.19097 != 0) goto <D.19098>; else goto <D.19099>;
        <D.19098>:
        D.19100 = &MEM[(void *)"#Strings" + 3B];
        D.19101 = *D.19100;
        D.19102 = (int) D.19101;
        D.19103 = __s2 + 3;
        D.19104 = *D.19103;
        D.19105 = (int) D.19104;
        __result = D.19102 - D.19105;
        <D.19099>:
        <D.19089>:
        <D.19079>:
      }
      D.18081 = __result;
    }
    iftmp.27 = -D.18081;
    goto <D.19106>;
    <D.19069>:
    D.19060 = ptr + 8;
    iftmp.27 = __builtin_strcmp (D.19060, "#Strings");
    <D.19106>:
    D.18082 = iftmp.27;
  }
  if (D.18082 == 0) goto <D.19107>; else goto <D.19108>;
  <D.19107>:
  D.19012 = image->raw_metadata;
  D.19063 = MEM[(const guint32 *)ptr];
  D.19064 = D.19012 + D.19063;
  image->heap_strings.data = D.19064;
  D.19065 = MEM[(const guint32 *)ptr + 4B];
  image->heap_strings.size = D.19065;
  ptr = ptr + 17;
  goto <D.19109>;
  <D.19108>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19113 = "#US";
      D.19114 = MEM[(const unsigned char *)D.19113];
      D.19115 = (int) D.19114;
      D.19116 = *__s2;
      D.19117 = (int) D.19116;
      __result = D.19115 - D.19117;
      {
        D.19118 = __s2_len != 0;
        D.19119 = __result == 0;
        D.19120 = D.19118 & D.19119;
        if (D.19120 != 0) goto <D.19121>; else goto <D.19122>;
        <D.19121>:
        D.19123 = &MEM[(void *)"#US" + 1B];
        D.19124 = *D.19123;
        D.19125 = (int) D.19124;
        D.19126 = __s2 + 1;
        D.19127 = *D.19126;
        D.19128 = (int) D.19127;
        __result = D.19125 - D.19128;
        D.19129 = __s2_len > 1;
        D.19119 = __result == 0;
        D.19130 = D.19129 & D.19119;
        if (D.19130 != 0) goto <D.19131>; else goto <D.19132>;
        <D.19131>:
        D.19133 = &MEM[(void *)"#US" + 2B];
        D.19134 = *D.19133;
        D.19135 = (int) D.19134;
        D.19136 = __s2 + 2;
        D.19137 = *D.19136;
        D.19138 = (int) D.19137;
        __result = D.19135 - D.19138;
        D.19139 = __s2_len > 2;
        D.19119 = __result == 0;
        D.19140 = D.19139 & D.19119;
        if (D.19140 != 0) goto <D.19141>; else goto <D.19142>;
        <D.19141>:
        D.19143 = &MEM[(void *)"#US" + 3B];
        D.19144 = *D.19143;
        D.19145 = (int) D.19144;
        D.19146 = __s2 + 3;
        D.19147 = *D.19146;
        D.19148 = (int) D.19147;
        __result = D.19145 - D.19148;
        <D.19142>:
        <D.19132>:
        <D.19122>:
      }
      D.18090 = __result;
    }
    iftmp.28 = -D.18090;
    goto <D.19149>;
    <D.19112>:
    D.19060 = ptr + 8;
    iftmp.28 = __builtin_strcmp (D.19060, "#US");
    <D.19149>:
    D.18091 = iftmp.28;
  }
  if (D.18091 == 0) goto <D.19150>; else goto <D.19151>;
  <D.19150>:
  D.19012 = image->raw_metadata;
  D.19063 = MEM[(const guint32 *)ptr];
  D.19064 = D.19012 + D.19063;
  image->heap_us.data = D.19064;
  D.19065 = MEM[(const guint32 *)ptr + 4B];
  image->heap_us.size = D.19065;
  ptr = ptr + 12;
  goto <D.19152>;
  <D.19151>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19156 = "#Blob";
      D.19157 = MEM[(const unsigned char *)D.19156];
      D.19158 = (int) D.19157;
      D.19159 = *__s2;
      D.19160 = (int) D.19159;
      __result = D.19158 - D.19160;
      {
        D.19161 = __s2_len != 0;
        D.19162 = __result == 0;
        D.19163 = D.19161 & D.19162;
        if (D.19163 != 0) goto <D.19164>; else goto <D.19165>;
        <D.19164>:
        D.19166 = &MEM[(void *)"#Blob" + 1B];
        D.19167 = *D.19166;
        D.19168 = (int) D.19167;
        D.19169 = __s2 + 1;
        D.19170 = *D.19169;
        D.19171 = (int) D.19170;
        __result = D.19168 - D.19171;
        D.19172 = __s2_len > 1;
        D.19162 = __result == 0;
        D.19173 = D.19172 & D.19162;
        if (D.19173 != 0) goto <D.19174>; else goto <D.19175>;
        <D.19174>:
        D.19176 = &MEM[(void *)"#Blob" + 2B];
        D.19177 = *D.19176;
        D.19178 = (int) D.19177;
        D.19179 = __s2 + 2;
        D.19180 = *D.19179;
        D.19181 = (int) D.19180;
        __result = D.19178 - D.19181;
        D.19182 = __s2_len > 2;
        D.19162 = __result == 0;
        D.19183 = D.19182 & D.19162;
        if (D.19183 != 0) goto <D.19184>; else goto <D.19185>;
        <D.19184>:
        D.19186 = &MEM[(void *)"#Blob" + 3B];
        D.19187 = *D.19186;
        D.19188 = (int) D.19187;
        D.19189 = __s2 + 3;
        D.19190 = *D.19189;
        D.19191 = (int) D.19190;
        __result = D.19188 - D.19191;
        <D.19185>:
        <D.19175>:
        <D.19165>:
      }
      D.18099 = __result;
    }
    iftmp.29 = -D.18099;
    goto <D.19192>;
    <D.19155>:
    D.19060 = ptr + 8;
    iftmp.29 = __builtin_strcmp (D.19060, "#Blob");
    <D.19192>:
    D.18100 = iftmp.29;
  }
  if (D.18100 == 0) goto <D.19193>; else goto <D.19194>;
  <D.19193>:
  D.19012 = image->raw_metadata;
  D.19063 = MEM[(const guint32 *)ptr];
  D.19064 = D.19012 + D.19063;
  image->heap_blob.data = D.19064;
  D.19065 = MEM[(const guint32 *)ptr + 4B];
  image->heap_blob.size = D.19065;
  ptr = ptr + 14;
  goto <D.19195>;
  <D.19194>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19199 = "#GUID";
      D.19200 = MEM[(const unsigned char *)D.19199];
      D.19201 = (int) D.19200;
      D.19202 = *__s2;
      D.19203 = (int) D.19202;
      __result = D.19201 - D.19203;
      {
        D.19204 = __s2_len != 0;
        D.19205 = __result == 0;
        D.19206 = D.19204 & D.19205;
        if (D.19206 != 0) goto <D.19207>; else goto <D.19208>;
        <D.19207>:
        D.19209 = &MEM[(void *)"#GUID" + 1B];
        D.19210 = *D.19209;
        D.19211 = (int) D.19210;
        D.19212 = __s2 + 1;
        D.19213 = *D.19212;
        D.19214 = (int) D.19213;
        __result = D.19211 - D.19214;
        D.19215 = __s2_len > 1;
        D.19205 = __result == 0;
        D.19216 = D.19215 & D.19205;
        if (D.19216 != 0) goto <D.19217>; else goto <D.19218>;
        <D.19217>:
        D.19219 = &MEM[(void *)"#GUID" + 2B];
        D.19220 = *D.19219;
        D.19221 = (int) D.19220;
        D.19222 = __s2 + 2;
        D.19223 = *D.19222;
        D.19224 = (int) D.19223;
        __result = D.19221 - D.19224;
        D.19225 = __s2_len > 2;
        D.19205 = __result == 0;
        D.19226 = D.19225 & D.19205;
        if (D.19226 != 0) goto <D.19227>; else goto <D.19228>;
        <D.19227>:
        D.19229 = &MEM[(void *)"#GUID" + 3B];
        D.19230 = *D.19229;
        D.19231 = (int) D.19230;
        D.19232 = __s2 + 3;
        D.19233 = *D.19232;
        D.19234 = (int) D.19233;
        __result = D.19231 - D.19234;
        <D.19228>:
        <D.19218>:
        <D.19208>:
      }
      D.18108 = __result;
    }
    iftmp.30 = -D.18108;
    goto <D.19235>;
    <D.19198>:
    D.19060 = ptr + 8;
    iftmp.30 = __builtin_strcmp (D.19060, "#GUID");
    <D.19235>:
    D.18109 = iftmp.30;
  }
  if (D.18109 == 0) goto <D.19236>; else goto <D.19237>;
  <D.19236>:
  D.19012 = image->raw_metadata;
  D.19063 = MEM[(const guint32 *)ptr];
  D.19064 = D.19012 + D.19063;
  image->heap_guid.data = D.19064;
  D.19065 = MEM[(const guint32 *)ptr + 4B];
  image->heap_guid.size = D.19065;
  ptr = ptr + 14;
  goto <D.19238>;
  <D.19237>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19242 = "#-";
      D.19243 = MEM[(const unsigned char *)D.19242];
      D.19244 = (int) D.19243;
      D.19245 = *__s2;
      D.19246 = (int) D.19245;
      __result = D.19244 - D.19246;
      {
        D.19247 = __s2_len != 0;
        D.19248 = __result == 0;
        D.19249 = D.19247 & D.19248;
        if (D.19249 != 0) goto <D.19250>; else goto <D.19251>;
        <D.19250>:
        D.19252 = &MEM[(void *)"#-" + 1B];
        D.19253 = *D.19252;
        D.19254 = (int) D.19253;
        D.19255 = __s2 + 1;
        D.19256 = *D.19255;
        D.19257 = (int) D.19256;
        __result = D.19254 - D.19257;
        D.19258 = __s2_len > 1;
        D.19248 = __result == 0;
        D.19259 = D.19258 & D.19248;
        if (D.19259 != 0) goto <D.19260>; else goto <D.19261>;
        <D.19260>:
        D.19262 = &MEM[(void *)"#-" + 2B];
        D.19263 = *D.19262;
        D.19264 = (int) D.19263;
        D.19265 = __s2 + 2;
        D.19266 = *D.19265;
        D.19267 = (int) D.19266;
        __result = D.19264 - D.19267;
        D.19268 = __s2_len > 2;
        D.19248 = __result == 0;
        D.19269 = D.19268 & D.19248;
        if (D.19269 != 0) goto <D.19270>; else goto <D.19271>;
        <D.19270>:
        D.19272 = &MEM[(void *)"#-" + 3B];
        D.19273 = *D.19272;
        D.19274 = (int) D.19273;
        D.19275 = __s2 + 3;
        D.19276 = *D.19275;
        D.19277 = (int) D.19276;
        __result = D.19274 - D.19277;
        <D.19271>:
        <D.19261>:
        <D.19251>:
      }
      D.18117 = __result;
    }
    iftmp.31 = -D.18117;
    goto <D.19278>;
    <D.19241>:
    D.19060 = ptr + 8;
    iftmp.31 = __builtin_strcmp (D.19060, "#-");
    <D.19278>:
    D.18118 = iftmp.31;
  }
  if (D.18118 == 0) goto <D.19279>; else goto <D.19280>;
  <D.19279>:
  D.19012 = image->raw_metadata;
  D.19063 = MEM[(const guint32 *)ptr];
  D.19064 = D.19012 + D.19063;
  image->heap_tables.data = D.19064;
  D.19065 = MEM[(const guint32 *)ptr + 4B];
  image->heap_tables.size = D.19065;
  ptr = ptr + 11;
  image->uncompressed_metadata = 1;
  D.19281 = 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.19281);
  goto <D.19282>;
  <D.19280>:
  D.19283 = ptr + 8;
  monoeg_g_log (0B, 32, "Unknown heap type: %s\n", D.19283);
  D.19060 = ptr + 8;
  D.19284 = strlen (D.19060);
  D.19285 = D.19284 + 9;
  ptr = ptr + D.19285;
  <D.19282>:
  <D.19238>:
  <D.19195>:
  <D.19152>:
  <D.19109>:
  <D.19066>:
  ptr.25 = (int) ptr;
  D.19012 = image->raw_metadata;
  D.19013 = (int) D.19012;
  D.19014 = ptr.25 - D.19013;
  pad = (guint32) D.19014;
  D.19015 = pad & 3;
  if (D.19015 != 0) goto <D.19286>; else goto <D.19287>;
  <D.19286>:
  D.19015 = pad & 3;
  D.19018 = 4 - D.19015;
  ptr = ptr + D.19018;
  <D.19287>:
  i = i + 1;
  <D.18120>:
  D.19288 = (int) streams;
  if (D.19288 > i) goto <D.18119>; else goto <D.18121>;
  <D.18121>:
  D.19289 = image->heap_guid.data;
  D.19290 = D.19289 == 0B;
  D.19291 = (long int) D.19290;
  D.19292 = __builtin_expect (D.19291, 0);
  if (D.19292 != 0) goto <D.19293>; else goto <D.19294>;
  <D.19293>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 465, "image->heap_guid.data");
  <D.19294>:
  D.19295 = image->heap_guid.size;
  D.19296 = D.19295 <= 15;
  D.19297 = (long int) D.19296;
  D.19298 = __builtin_expect (D.19297, 0);
  if (D.19298 != 0) goto <D.19299>; else goto <D.19300>;
  <D.19299>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 466, "image->heap_guid.size >= 16");
  <D.19300>:
  D.19289 = image->heap_guid.data;
  D.19301 = mono_guid_to_string (D.19289);
  image->guid = D.19301;
  D.18998 = 1;
  return D.18998;
}


load_tables (struct MonoImage * image)
{
  const char * D.19303;
  char D.19304;
  int D.19305;
  _Bool D.19306;
  int D.19307;
  _Bool D.19308;
  int D.19309;
  _Bool D.19310;
  long long unsigned int D.19311;
  long long unsigned int D.19312;
  unsigned int D.19320;
  <unnamed-unsigned:24> D.19321;
  int D.19322;
  sizetype D.19323;
  sizetype D.19324;
  const char * D.19325;
  const char * D.19326;
  _Bool D.19327;
  long int D.19328;
  long int D.19329;
  gboolean D.19332;
  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.19303 = heap_tables + 6;
  D.19304 = *D.19303;
  heap_sizes = (int) D.19304;
  D.19305 = heap_sizes & 1;
  D.19306 = D.19305 != 0;
  image->idx_string_wide = D.19306;
  D.19307 = heap_sizes & 2;
  D.19308 = D.19307 != 0;
  image->idx_guid_wide = D.19308;
  D.19309 = heap_sizes & 4;
  D.19310 = D.19309 != 0;
  image->idx_blob_wide = D.19310;
  valid_mask = MEM[(const guint64 *)heap_tables + 8B];
  sorted_mask = MEM[(const guint64 *)heap_tables + 16B];
  rows = heap_tables + 24;
  table = 0;
  goto <D.18134>;
  <D.18133>:
  D.19311 = valid_mask >> table;
  D.19312 = D.19311 & 1;
  if (D.19312 == 0) goto <D.19313>; else goto <D.19314>;
  <D.19313>:
  if (table > 44) goto <D.19315>; else goto <D.19316>;
  <D.19315>:
  // predicted unlikely by continue predictor.
  goto <D.18132>;
  <D.19316>:
  image->tables[table].rows = 0;
  // predicted unlikely by continue predictor.
  goto <D.18132>;
  <D.19314>:
  if (table > 44) goto <D.19317>; else goto <D.19318>;
  <D.19317>:
  monoeg_g_log (0B, 16, "bits in valid must be zero above 0x2d (II - 23.1.6)");
  goto <D.19319>;
  <D.19318>:
  D.19320 = *rows;
  D.19321 = (<unnamed-unsigned:24>) D.19320;
  image->tables[table].rows = D.19321;
  <D.19319>:
  rows = rows + 4;
  valid = valid + 1;
  <D.18132>:
  table = table + 1;
  <D.18134>:
  if (table <= 63) goto <D.18133>; else goto <D.18135>;
  <D.18135>:
  D.19322 = valid * 4;
  D.19323 = (sizetype) D.19322;
  D.19324 = D.19323 + 24;
  D.19325 = heap_tables + D.19324;
  image->tables_base = D.19325;
  D.19326 = image->tables_base;
  D.19327 = D.19326 != rows;
  D.19328 = (long int) D.19327;
  D.19329 = __builtin_expect (D.19328, 0);
  if (D.19329 != 0) goto <D.19330>; else goto <D.19331>;
  <D.19330>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 516, "(const void *) image->tables_base == (const void *) rows");
  <D.19331>:
  mono_metadata_compute_table_bases (image);
  D.19332 = 1;
  return D.19332;
}


mono_image_load_names (struct MonoImage * image)
{
  unsigned int D.19334;
  unsigned int D.19335;
  struct MonoTableInfo * D.19338;
  unsigned int D.19339;
  const char * D.19340;
  struct MonoTableInfo * D.19341;
  unsigned int D.19342;
  const char * D.19343;

  D.19334 = BIT_FIELD_REF <*image, 32, 3904>;
  D.19335 = D.19334 & 16777215;
  if (D.19335 != 0) goto <D.19336>; else goto <D.19337>;
  <D.19336>:
  D.19338 = &image->tables[32];
  D.19339 = mono_metadata_decode_row_col (D.19338, 0, 7);
  D.19340 = mono_metadata_string_heap (image, D.19339);
  image->assembly_name = D.19340;
  <D.19337>:
  D.19341 = &image->tables[0];
  D.19342 = mono_metadata_decode_row_col (D.19341, 0, 1);
  D.19343 = mono_metadata_string_heap (image, D.19342);
  image->module_name = D.19343;
}


mono_image_loaded_full (const char * name, gboolean refonly)
{
  struct GHashTable * iftmp.32;
  int mutex_inited.33;
  _Bool D.19353;
  long int D.19354;
  long int D.19355;
  _Bool D.19362;
  long int D.19363;
  long int D.19364;
  struct MonoImage * D.19367;
  struct MonoImage * res;
  struct GHashTable * loaded_images;

  if (refonly != 0) goto <D.19345>; else goto <D.19346>;
  <D.19345>:
  iftmp.32 = loaded_images_refonly_hash;
  goto <D.19347>;
  <D.19346>:
  iftmp.32 = loaded_images_hash;
  <D.19347>:
  loaded_images = iftmp.32;
  mutex_inited.33 = mutex_inited;
  if (mutex_inited.33 != 0) goto <D.19349>; else goto <D.19350>;
  <D.19349>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19351>; else goto <D.19352>;
    <D.19351>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19352>:
    D.19353 = ret != 0;
    D.19354 = (long int) D.19353;
    D.19355 = __builtin_expect (D.19354, 0);
    if (D.19355 != 0) goto <D.19356>; else goto <D.19357>;
    <D.19356>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1060, "ret == 0");
    <D.19357>:
  }
  <D.19350>:
  res = monoeg_g_hash_table_lookup (loaded_images, name);
  mutex_inited.33 = mutex_inited;
  if (mutex_inited.33 != 0) goto <D.19358>; else goto <D.19359>;
  <D.19358>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19360>; else goto <D.19361>;
    <D.19360>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19361>:
    D.19362 = ret != 0;
    D.19363 = (long int) D.19362;
    D.19364 = __builtin_expect (D.19363, 0);
    if (D.19364 != 0) goto <D.19365>; else goto <D.19366>;
    <D.19365>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1062, "ret == 0");
    <D.19366>:
  }
  <D.19359>:
  D.19367 = res;
  return D.19367;
}


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

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


mono_image_loaded_by_guid_full (const char * guid, gboolean refonly)
{
  struct GHashTable * iftmp.34;
  int mutex_inited.35;
  _Bool D.19380;
  long int D.19381;
  long int D.19382;
  _Bool D.19389;
  long int D.19390;
  long int D.19391;
  struct MonoImage * D.19394;
  struct GuidData data;
  struct GHashTable * loaded_images;

  try
    {
      if (refonly != 0) goto <D.19372>; else goto <D.19373>;
      <D.19372>:
      iftmp.34 = loaded_images_refonly_hash;
      goto <D.19374>;
      <D.19373>:
      iftmp.34 = loaded_images_hash;
      <D.19374>:
      loaded_images = iftmp.34;
      data.res = 0B;
      data.guid = guid;
      mutex_inited.35 = mutex_inited;
      if (mutex_inited.35 != 0) goto <D.19376>; else goto <D.19377>;
      <D.19376>:
      {
        int ret;

        ret = pthread_mutex_lock (&images_mutex.mutex);
        if (ret != 0) goto <D.19378>; else goto <D.19379>;
        <D.19378>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.19379>:
        D.19380 = ret != 0;
        D.19381 = (long int) D.19380;
        D.19382 = __builtin_expect (D.19381, 0);
        if (D.19382 != 0) goto <D.19383>; else goto <D.19384>;
        <D.19383>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1106, "ret == 0");
        <D.19384>:
      }
      <D.19377>:
      monoeg_g_hash_table_foreach (loaded_images, find_by_guid, &data);
      mutex_inited.35 = mutex_inited;
      if (mutex_inited.35 != 0) goto <D.19385>; else goto <D.19386>;
      <D.19385>:
      {
        int ret;

        ret = pthread_mutex_unlock (&images_mutex.mutex);
        if (ret != 0) goto <D.19387>; else goto <D.19388>;
        <D.19387>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19388>:
        D.19389 = ret != 0;
        D.19390 = (long int) D.19389;
        D.19391 = __builtin_expect (D.19390, 0);
        if (D.19391 != 0) goto <D.19392>; else goto <D.19393>;
        <D.19392>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1108, "ret == 0");
        <D.19393>:
      }
      <D.19386>:
      D.19394 = data.res;
      return D.19394;
    }
  finally
    {
      data = {CLOBBER};
    }
}


find_by_guid (void * key, void * val, void * user_data)
{
  struct MonoImage * D.19397;
  int D.18293;
  const char * D.19400;
  const char * D.19401;
  struct GuidData * data;
  struct MonoImage * image;

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

    D.19400 = mono_image_get_guid (image);
    D.19401 = data->guid;
    D.18293 = __builtin_strcmp (D.19401, D.19400);
  }
  if (D.18293 == 0) goto <D.19402>; else goto <D.19403>;
  <D.19402>:
  data->res = image;
  <D.19403>:
}


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

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


mono_image_open_from_data_with_name (char * data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus * status, gboolean refonly, const char * name)
{
  _Bool D.19407;
  _Bool D.19408;
  _Bool D.19409;
  struct MonoImage * D.19414;
  unsigned char D.19421;
  <unnamed-unsigned:1> D.19422;
  gchar * iftmp.36;
  unsigned char D.19427;
  <unnamed-unsigned:1> D.19428;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  char * datac;

  D.19407 = data == 0B;
  D.19408 = data_len == 0;
  D.19409 = D.19407 | D.19408;
  if (D.19409 != 0) goto <D.19410>; else goto <D.19411>;
  <D.19410>:
  if (status != 0B) goto <D.19412>; else goto <D.19413>;
  <D.19412>:
  *status = 3;
  <D.19413>:
  D.19414 = 0B;
  return D.19414;
  <D.19411>:
  datac = data;
  if (need_copy != 0) goto <D.19415>; else goto <D.19416>;
  <D.19415>:
  datac = monoeg_try_malloc (data_len);
  if (datac == 0B) goto <D.19417>; else goto <D.19418>;
  <D.19417>:
  if (status != 0B) goto <D.19419>; else goto <D.19420>;
  <D.19419>:
  *status = 1;
  <D.19420>:
  D.19414 = 0B;
  return D.19414;
  <D.19418>:
  memcpy (datac, data, data_len);
  <D.19416>:
  image = monoeg_malloc0 (980);
  image->raw_data = datac;
  image->raw_data_len = data_len;
  D.19421 = (unsigned char) need_copy;
  D.19422 = (<unnamed-unsigned:1>) D.19421;
  image->raw_data_allocated = D.19422;
  if (name == 0B) goto <D.19424>; else goto <D.19425>;
  <D.19424>:
  iftmp.36 = monoeg_g_strdup_printf ("data-%p", datac);
  goto <D.19426>;
  <D.19425>:
  iftmp.36 = monoeg_strdup (name);
  <D.19426>:
  image->name = iftmp.36;
  iinfo = monoeg_malloc0 (396);
  image->image_info = iinfo;
  D.19427 = (unsigned char) refonly;
  D.19428 = (<unnamed-unsigned:1>) D.19427;
  image->ref_only = D.19428;
  image = do_mono_image_load (image, status, 1, 1);
  if (image == 0B) goto <D.19429>; else goto <D.19430>;
  <D.19429>:
  D.19414 = 0B;
  return D.19414;
  <D.19430>:
  D.19414 = register_image (image);
  return D.19414;
}


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

  if (str != 0B) goto <D.19432>; else goto <D.19433>;
  <D.19432>:
  D.19434 = __strdup (str);
  return D.19434;
  <D.19433>:
  D.19434 = 0B;
  return D.19434;
}


do_mono_image_load (struct MonoImage * image, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff)
{
  int D.19439;
  int D.19441;
  int D.19444;
  int D.19446;
  int D.19448;
  struct MonoImage * D.19452;
  struct GSList * errors.37;
  char * D.19456;
  char * D.19457;
  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.19436>; else goto <D.19437>;
      <D.19436>:
      *status = 3;
      <D.19437>:
      if (care_about_pecoff == 0) goto done; else goto <D.19438>;
      <D.19438>:
      D.19439 = mono_verifier_verify_pe_data (image, &errors);
      if (D.19439 == 0) goto invalid_image; else goto <D.19440>;
      <D.19440>:
      D.19441 = mono_image_load_pe_data (image);
      if (D.19441 == 0) goto invalid_image; else goto <D.19442>;
      <D.19442>:
      if (care_about_cli == 0) goto done; else goto <D.19443>;
      <D.19443>:
      D.19444 = mono_verifier_verify_cli_data (image, &errors);
      if (D.19444 == 0) goto invalid_image; else goto <D.19445>;
      <D.19445>:
      D.19446 = mono_image_load_cli_data (image);
      if (D.19446 == 0) goto invalid_image; else goto <D.19447>;
      <D.19447>:
      D.19448 = mono_verifier_verify_table_data (image, &errors);
      if (D.19448 == 0) goto invalid_image; else goto <D.19449>;
      <D.19449>:
      mono_image_load_names (image);
      load_modules (image);
      done:
      mono_profiler_module_loaded (image, 0);
      if (status != 0B) goto <D.19450>; else goto <D.19451>;
      <D.19450>:
      *status = 0;
      <D.19451>:
      D.19452 = image;
      return D.19452;
      invalid_image:
      errors.37 = errors;
      if (errors.37 != 0B) goto <D.19454>; else goto <D.19455>;
      <D.19454>:
      {
        struct MonoVerifyInfo * info;

        errors.37 = errors;
        info = errors.37->data;
        D.19456 = info->message;
        D.19457 = image->name;
        monoeg_g_log (0B, 16, "Could not load image %s due to %s", D.19457, D.19456);
        errors.37 = errors;
        mono_free_verify_list (errors.37);
      }
      <D.19455>:
      mono_profiler_module_loaded (image, 1);
      mono_image_close (image);
      D.19452 = 0B;
      return D.19452;
    }
  finally
    {
      errors = {CLOBBER};
    }
}


load_modules (struct MonoImage * image)
{
  struct MonoImage * * D.19460;
  <unnamed-unsigned:24> D.19463;
  unsigned int D.19464;
  unsigned int D.19465;
  void * D.19466;
  void * D.19467;
  unsigned int D.19468;
  struct MonoTableInfo * t;

  D.19460 = image->modules;
  if (D.19460 != 0B) goto <D.19461>; else goto <D.19462>;
  <D.19461>:
  return;
  <D.19462>:
  t = &image->tables[26];
  D.19463 = t->rows;
  D.19464 = (unsigned int) D.19463;
  D.19465 = D.19464 * 4;
  D.19466 = monoeg_malloc0 (D.19465);
  image->modules = D.19466;
  D.19463 = t->rows;
  D.19464 = (unsigned int) D.19463;
  D.19465 = D.19464 * 4;
  D.19467 = monoeg_malloc0 (D.19465);
  image->modules_loaded = D.19467;
  D.19463 = t->rows;
  D.19468 = (unsigned int) D.19463;
  image->module_count = D.19468;
}


register_image (struct MonoImage * image)
{
  struct GHashTable * iftmp.38;
  unsigned char D.19471;
  unsigned char D.19472;
  int mutex_inited.39;
  _Bool D.19481;
  long int D.19482;
  long int D.19483;
  char * D.19486;
  _Bool D.19493;
  long int D.19494;
  long int D.19495;
  struct MonoImage * D.19498;
  const char * D.19499;
  void * D.19502;
  _Bool D.19509;
  long int D.19510;
  long int D.19511;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;

  D.19471 = BIT_FIELD_REF <*image, 8, 128>;
  D.19472 = D.19471 & 16;
  if (D.19472 != 0) goto <D.19473>; else goto <D.19474>;
  <D.19473>:
  iftmp.38 = loaded_images_refonly_hash;
  goto <D.19475>;
  <D.19474>:
  iftmp.38 = loaded_images_hash;
  <D.19475>:
  loaded_images = iftmp.38;
  mutex_inited.39 = mutex_inited;
  if (mutex_inited.39 != 0) goto <D.19477>; else goto <D.19478>;
  <D.19477>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19479>; else goto <D.19480>;
    <D.19479>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19480>:
    D.19481 = ret != 0;
    D.19482 = (long int) D.19481;
    D.19483 = __builtin_expect (D.19482, 0);
    if (D.19483 != 0) goto <D.19484>; else goto <D.19485>;
    <D.19484>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1124, "ret == 0");
    <D.19485>:
  }
  <D.19478>:
  D.19486 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.19486);
  if (image2 != 0B) goto <D.19487>; else goto <D.19488>;
  <D.19487>:
  mono_image_addref (image2);
  mutex_inited.39 = mutex_inited;
  if (mutex_inited.39 != 0) goto <D.19489>; else goto <D.19490>;
  <D.19489>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19491>; else goto <D.19492>;
    <D.19491>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19492>:
    D.19493 = ret != 0;
    D.19494 = (long int) D.19493;
    D.19495 = __builtin_expect (D.19494, 0);
    if (D.19495 != 0) goto <D.19496>; else goto <D.19497>;
    <D.19496>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1130, "ret == 0");
    <D.19497>:
  }
  <D.19490>:
  mono_image_close (image);
  D.19498 = image2;
  return D.19498;
  <D.19488>:
  D.19486 = image->name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.19486, image, 0);
  D.19499 = image->assembly_name;
  if (D.19499 != 0B) goto <D.19500>; else goto <D.19501>;
  <D.19500>:
  D.19499 = image->assembly_name;
  D.19502 = monoeg_g_hash_table_lookup (loaded_images, D.19499);
  if (D.19502 == 0B) goto <D.19503>; else goto <D.19504>;
  <D.19503>:
  D.19499 = image->assembly_name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.19499, image, 0);
  <D.19504>:
  <D.19501>:
  mutex_inited.39 = mutex_inited;
  if (mutex_inited.39 != 0) goto <D.19505>; else goto <D.19506>;
  <D.19505>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19507>; else goto <D.19508>;
    <D.19507>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19508>:
    D.19509 = ret != 0;
    D.19510 = (long int) D.19509;
    D.19511 = __builtin_expect (D.19510, 0);
    if (D.19511 != 0) goto <D.19512>; else goto <D.19513>;
    <D.19512>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1137, "ret == 0");
    <D.19513>:
  }
  <D.19506>:
  D.19498 = image;
  return D.19498;
}


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

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


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

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


mono_image_open_full (const char * fname, MonoImageOpenStatus * status, gboolean refonly)
{
  struct MonoImage * D.19521;
  int mutex_inited.40;
  _Bool D.19527;
  long int D.19528;
  long int D.19529;
  struct GHashTable * iftmp.41;
  _Bool D.19542;
  long int D.19543;
  long int D.19544;
  _Bool D.19551;
  long int D.19552;
  long int D.19553;
  struct MonoImage * image;
  struct GHashTable * loaded_images;
  char * absfname;

  if (fname == 0B) goto <D.19519>; else goto <D.19520>;
  <D.19519>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1225, "fname != NULL");
  D.19521 = 0B;
  return D.19521;
  <D.19520>:
  absfname = mono_path_canonicalize (fname);
  mutex_inited.40 = mutex_inited;
  if (mutex_inited.40 != 0) goto <D.19523>; else goto <D.19524>;
  <D.19523>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19525>; else goto <D.19526>;
    <D.19525>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19526>:
    D.19527 = ret != 0;
    D.19528 = (long int) D.19527;
    D.19529 = __builtin_expect (D.19528, 0);
    if (D.19529 != 0) goto <D.19530>; else goto <D.19531>;
    <D.19530>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1305, "ret == 0");
    <D.19531>:
  }
  <D.19524>:
  if (refonly != 0) goto <D.19533>; else goto <D.19534>;
  <D.19533>:
  iftmp.41 = loaded_images_refonly_hash;
  goto <D.19535>;
  <D.19534>:
  iftmp.41 = loaded_images_hash;
  <D.19535>:
  loaded_images = iftmp.41;
  image = monoeg_g_hash_table_lookup (loaded_images, absfname);
  monoeg_g_free (absfname);
  if (image != 0B) goto <D.19536>; else goto <D.19537>;
  <D.19536>:
  mono_image_addref (image);
  mutex_inited.40 = mutex_inited;
  if (mutex_inited.40 != 0) goto <D.19538>; else goto <D.19539>;
  <D.19538>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19540>; else goto <D.19541>;
    <D.19540>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19541>:
    D.19542 = ret != 0;
    D.19543 = (long int) D.19542;
    D.19544 = __builtin_expect (D.19543, 0);
    if (D.19544 != 0) goto <D.19545>; else goto <D.19546>;
    <D.19545>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1312, "ret == 0");
    <D.19546>:
  }
  <D.19539>:
  D.19521 = image;
  return D.19521;
  <D.19537>:
  mutex_inited.40 = mutex_inited;
  if (mutex_inited.40 != 0) goto <D.19547>; else goto <D.19548>;
  <D.19547>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19549>; else goto <D.19550>;
    <D.19549>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19550>:
    D.19551 = ret != 0;
    D.19552 = (long int) D.19551;
    D.19553 = __builtin_expect (D.19552, 0);
    if (D.19553 != 0) goto <D.19554>; else goto <D.19555>;
    <D.19554>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1315, "ret == 0");
    <D.19555>:
  }
  <D.19548>:
  image = do_mono_image_open (fname, status, 1, 1, refonly);
  if (image == 0B) goto <D.19556>; else goto <D.19557>;
  <D.19556>:
  D.19521 = 0B;
  return D.19521;
  <D.19557>:
  D.19521 = register_image (image);
  return D.19521;
}


do_mono_image_open (const char * fname, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly)
{
  int __mono_io_portability_helpers.42;
  struct MonoImage * D.19570;
  long long unsigned int D.19571;
  unsigned int D.19572;
  void * * D.19573;
  int D.19574;
  unsigned int D.19575;
  void * D.19576;
  char * D.19577;
  int D.19580;
  void * D.19581;
  gchar * D.19586;
  unsigned char D.19587;
  <unnamed-unsigned:1> D.19588;
  int D.19589;
  unsigned char D.19590;
  <unnamed-unsigned:1> D.19591;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  struct MonoFileMap * filed;

  filed = mono_file_map_open (fname);
  if (filed == 0B) goto <D.19559>; else goto <D.19560>;
  <D.19559>:
  __mono_io_portability_helpers.42 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.42 > 0) goto <D.19562>; else goto <D.19563>;
  <D.19562>:
  {
    gchar * ffname;

    ffname = mono_portability_find_file (fname, 1);
    if (ffname != 0B) goto <D.19564>; else goto <D.19565>;
    <D.19564>:
    filed = mono_file_map_open (ffname);
    monoeg_g_free (ffname);
    <D.19565>:
  }
  <D.19563>:
  if (filed == 0B) goto <D.19566>; else goto <D.19567>;
  <D.19566>:
  if (status != 0B) goto <D.19568>; else goto <D.19569>;
  <D.19568>:
  *status = 1;
  <D.19569>:
  D.19570 = 0B;
  return D.19570;
  <D.19567>:
  <D.19560>:
  image = monoeg_malloc0 (980);
  image->raw_buffer_used = 1;
  D.19571 = mono_file_map_size (filed);
  D.19572 = (unsigned int) D.19571;
  image->raw_data_len = D.19572;
  D.19573 = &image->raw_data_handle;
  D.19574 = mono_file_map_fd (filed);
  D.19575 = image->raw_data_len;
  D.19576 = mono_file_map (D.19575, 17, D.19574, 0, D.19573);
  image->raw_data = D.19576;
  D.19577 = image->raw_data;
  if (D.19577 == 0B) goto <D.19578>; else goto <D.19579>;
  <D.19578>:
  image->fileio_used = 1;
  D.19573 = &image->raw_data_handle;
  D.19580 = mono_file_map_fd (filed);
  D.19575 = image->raw_data_len;
  D.19581 = mono_file_map_fileio (D.19575, 17, D.19580, 0, D.19573);
  image->raw_data = D.19581;
  <D.19579>:
  D.19577 = image->raw_data;
  if (D.19577 == 0B) goto <D.19582>; else goto <D.19583>;
  <D.19582>:
  mono_file_map_close (filed);
  monoeg_g_free (image);
  if (status != 0B) goto <D.19584>; else goto <D.19585>;
  <D.19584>:
  *status = 3;
  <D.19585>:
  D.19570 = 0B;
  return D.19570;
  <D.19583>:
  iinfo = monoeg_malloc0 (396);
  image->image_info = iinfo;
  D.19586 = mono_path_resolve_symlinks (fname);
  image->name = D.19586;
  D.19587 = (unsigned char) refonly;
  D.19588 = (<unnamed-unsigned:1>) D.19587;
  image->ref_only = D.19588;
  image->ref_count = 1;
  D.19589 = mono_security_core_clr_determine_platform_image (image);
  D.19590 = (unsigned char) D.19589;
  D.19591 = (<unnamed-unsigned:1>) D.19590;
  image->core_clr_platform_code = D.19591;
  mono_file_map_close (filed);
  D.19570 = do_mono_image_load (image, status, care_about_cli, care_about_pecoff);
  return D.19570;
}


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

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


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

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


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

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


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.19603;

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


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.19604;
  unsigned int D.19605;

  D.19605 = __sync_add_and_fetch_4 (val, 1);
  D.19604 = (gint32) D.19605;
  return D.19604;
}


mono_dynamic_stream_reset (struct MonoDynamicStream * stream)
{
  unsigned int D.19607;
  unsigned int D.19608;
  char * D.19609;
  struct GHashTable * D.19610;

  stream->offset = 0;
  D.19607 = stream->offset;
  stream->index = D.19607;
  D.19608 = stream->index;
  stream->alloc_size = D.19608;
  D.19609 = stream->data;
  monoeg_g_free (D.19609);
  stream->data = 0B;
  D.19610 = stream->hash;
  if (D.19610 != 0B) goto <D.19611>; else goto <D.19612>;
  <D.19611>:
  D.19610 = stream->hash;
  monoeg_g_hash_table_destroy (D.19610);
  stream->hash = 0B;
  <D.19612>:
}


mono_image_close_except_pools (struct MonoImage * image)
{
  gboolean D.19615;
  int mutex_inited.43;
  _Bool D.19621;
  long int D.19622;
  long int D.19623;
  int * D.19626;
  int D.19627;
  _Bool D.19634;
  long int D.19635;
  long int D.19636;
  struct GHashTable * iftmp.44;
  unsigned char D.19640;
  unsigned char D.19641;
  char * D.19645;
  const char * D.19648;
  void * D.19651;
  _Bool D.19658;
  long int D.19659;
  long int D.19660;
  struct MonoAssembly * * D.19665;
  unsigned char D.19667;
  unsigned int i.45;
  unsigned int D.19670;
  struct MonoAssembly * * D.19671;
  struct MonoAssembly * D.19672;
  struct MonoAssembly * D.19673;
  int D.19676;
  int D.19679;
  unsigned char D.19682;
  char * D.19685;
  unsigned char D.19688;
  void * D.19691;
  unsigned char D.19693;
  char * D.19696;
  unsigned int D.19699;
  char * D.19700;
  void * * D.19703;
  void * * D.19704;
  void * D.19705;
  int D.19710;
  int debug_assembly_unload.46;
  gchar * D.19714;
  char * D.19716;
  char * D.19717;
  struct MonoImage * * D.19718;
  struct GHashTable * D.19719;
  struct GHashTable * D.19722;
  struct MonoInternalHashTable * D.19725;
  struct GHashTable * D.19726;
  struct GHashTable * D.19727;
  struct GHashTable * D.19730;
  struct GHashTable * D.19733;
  struct GHashTable * D.19736;
  struct GHashTable * D.19739;
  struct GHashTable * D.19740;
  struct GHashTable * D.19741;
  struct GHashTable * D.19742;
  struct GHashTable * D.19743;
  struct GHashTable * D.19744;
  struct GHashTable * D.19745;
  struct GHashTable * D.19746;
  struct GHashTable * D.19747;
  struct GHashTable * D.19748;
  struct GHashTable * D.19749;
  struct GHashTable * D.19750;
  struct GHashTable * D.19751;
  struct GHashTable * D.19752;
  struct GHashTable * D.19753;
  struct GHashTable * D.19754;
  struct GHashTable * D.19755;
  struct GHashTable * D.19756;
  struct GHashTable * D.19757;
  struct GHashTable * D.19758;
  struct GHashTable * D.19759;
  struct GHashTable * D.19760;
  struct GHashTable * D.19761;
  struct GHashTable * D.19762;
  struct GHashTable * D.19763;
  struct GHashTable * D.19764;
  struct GHashTable * D.19765;
  struct GHashTable * D.19766;
  struct GHashTable * D.19767;
  struct GHashTable * D.19768;
  struct GHashTable * D.19769;
  struct GHashTable * D.19770;
  struct GHashTable * D.19771;
  struct GHashTable * D.19772;
  struct GHashTable * D.19773;
  struct GHashTable * D.19774;
  struct GHashTable * D.19775;
  struct GHashTable * D.19776;
  struct GHashTable * D.19777;
  struct MonoPropertyHash * D.19780;
  int iftmp.47;
  struct GSList * D.19786;
  int D.19788;
  _Bool D.19790;
  long int D.19791;
  long int D.19792;
  struct MonoBitSet * D.19795;
  void * D.19798;
  struct MonoSectionTable * D.19801;
  void * * D.19804;
  struct MonoImage * * D.19807;
  struct MonoImage * * D.19808;
  struct MonoImage * D.19809;
  int D.19812;
  unsigned int i.48;
  unsigned int D.19816;
  gboolean * D.19817;
  struct CRITICAL_SECTION * D.19820;
  struct CRITICAL_SECTION * D.19821;
  const char * D.19824;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;
  int i;

  if (image == 0B) goto <D.19613>; else goto <D.19614>;
  <D.19613>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1492, "image != NULL");
  D.19615 = 0;
  return D.19615;
  <D.19614>:
  mutex_inited.43 = mutex_inited;
  if (mutex_inited.43 != 0) goto <D.19617>; else goto <D.19618>;
  <D.19617>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.19619>; else goto <D.19620>;
    <D.19619>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19620>:
    D.19621 = ret != 0;
    D.19622 = (long int) D.19621;
    D.19623 = __builtin_expect (D.19622, 0);
    if (D.19623 != 0) goto <D.19624>; else goto <D.19625>;
    <D.19624>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1498, "ret == 0");
    <D.19625>:
  }
  <D.19618>:
  D.19626 = &image->ref_count;
  D.19627 = InterlockedDecrement (D.19626);
  if (D.19627 > 0) goto <D.19628>; else goto <D.19629>;
  <D.19628>:
  mutex_inited.43 = mutex_inited;
  if (mutex_inited.43 != 0) goto <D.19630>; else goto <D.19631>;
  <D.19630>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19632>; else goto <D.19633>;
    <D.19632>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19633>:
    D.19634 = ret != 0;
    D.19635 = (long int) D.19634;
    D.19636 = __builtin_expect (D.19635, 0);
    if (D.19636 != 0) goto <D.19637>; else goto <D.19638>;
    <D.19637>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1501, "ret == 0");
    <D.19638>:
  }
  <D.19631>:
  D.19615 = 0;
  return D.19615;
  <D.19629>:
  D.19640 = BIT_FIELD_REF <*image, 8, 128>;
  D.19641 = D.19640 & 16;
  if (D.19641 != 0) goto <D.19642>; else goto <D.19643>;
  <D.19642>:
  iftmp.44 = loaded_images_refonly_hash;
  goto <D.19644>;
  <D.19643>:
  iftmp.44 = loaded_images_hash;
  <D.19644>:
  loaded_images = iftmp.44;
  D.19645 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.19645);
  if (image == image2) goto <D.19646>; else goto <D.19647>;
  <D.19646>:
  D.19645 = image->name;
  monoeg_g_hash_table_remove (loaded_images, D.19645);
  <D.19647>:
  D.19648 = image->assembly_name;
  if (D.19648 != 0B) goto <D.19649>; else goto <D.19650>;
  <D.19649>:
  D.19648 = image->assembly_name;
  D.19651 = monoeg_g_hash_table_lookup (loaded_images, D.19648);
  if (D.19651 == image) goto <D.19652>; else goto <D.19653>;
  <D.19652>:
  D.19648 = image->assembly_name;
  monoeg_g_hash_table_remove (loaded_images, D.19648);
  <D.19653>:
  <D.19650>:
  mutex_inited.43 = mutex_inited;
  if (mutex_inited.43 != 0) goto <D.19654>; else goto <D.19655>;
  <D.19654>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.19656>; else goto <D.19657>;
    <D.19656>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19657>:
    D.19658 = ret != 0;
    D.19659 = (long int) D.19658;
    D.19660 = __builtin_expect (D.19659, 0);
    if (D.19660 != 0) goto <D.19661>; else goto <D.19662>;
    <D.19661>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1514, "ret == 0");
    <D.19662>:
  }
  <D.19655>:
  mono_profiler_module_event (image, 2);
  D.19645 = image->name;
  mono_trace (64, 1, "Unloading image %s [%p].", D.19645, image);
  mono_image_invoke_unload_hook (image);
  mono_metadata_clean_for_image (image);
  D.19665 = image->references;
  if (D.19665 != 0B) goto <D.19666>; else goto <D.19663>;
  <D.19666>:
  D.19640 = BIT_FIELD_REF <*image, 8, 128>;
  D.19667 = D.19640 & 8;
  if (D.19667 == 0) goto <D.19668>; else goto <D.19663>;
  <D.19668>:
  i = 0;
  goto <D.18392>;
  <D.18391>:
  D.19665 = image->references;
  i.45 = (unsigned int) i;
  D.19670 = i.45 * 4;
  D.19671 = D.19665 + D.19670;
  D.19672 = *D.19671;
  D.19673 = D.19672 + 4294967295;
  if (D.19673 <= 4294967293B) goto <D.19674>; else goto <D.19675>;
  <D.19674>:
  D.19665 = image->references;
  i.45 = (unsigned int) i;
  D.19670 = i.45 * 4;
  D.19671 = D.19665 + D.19670;
  D.19672 = *D.19671;
  D.19676 = mono_assembly_close_except_image_pools (D.19672);
  if (D.19676 == 0) goto <D.19677>; else goto <D.19678>;
  <D.19677>:
  D.19665 = image->references;
  i.45 = (unsigned int) i;
  D.19670 = i.45 * 4;
  D.19671 = D.19665 + D.19670;
  *D.19671 = 0B;
  <D.19678>:
  <D.19675>:
  i = i + 1;
  <D.18392>:
  D.19679 = image->nreferences;
  if (D.19679 > i) goto <D.18391>; else goto <D.18393>;
  <D.18393>:
  goto <D.19664>;
  <D.19663>:
  D.19665 = image->references;
  if (D.19665 != 0B) goto <D.19680>; else goto <D.19681>;
  <D.19680>:
  D.19665 = image->references;
  monoeg_g_free (D.19665);
  image->references = 0B;
  <D.19681>:
  <D.19664>:
  D.19640 = BIT_FIELD_REF <*image, 8, 128>;
  D.19682 = D.19640 & 1;
  if (D.19682 != 0) goto <D.19683>; else goto <D.19684>;
  <D.19683>:
  D.19685 = image->raw_data;
  if (D.19685 != 0B) goto <D.19686>; else goto <D.19687>;
  <D.19686>:
  D.19640 = BIT_FIELD_REF <*image, 8, 128>;
  D.19688 = D.19640 & 4;
  if (D.19688 != 0) goto <D.19689>; else goto <D.19690>;
  <D.19689>:
  D.19691 = image->raw_data_handle;
  D.19685 = image->raw_data;
  mono_file_unmap_fileio (D.19685, D.19691);
  goto <D.19692>;
  <D.19690>:
  D.19691 = image->raw_data_handle;
  D.19685 = image->raw_data;
  mono_file_unmap (D.19685, D.19691);
  <D.19692>:
  <D.19687>:
  <D.19684>:
  D.19640 = BIT_FIELD_REF <*image, 8, 128>;
  D.19693 = D.19640 & 2;
  if (D.19693 != 0) goto <D.19694>; else goto <D.19695>;
  <D.19694>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.19696 = image->raw_metadata;
    D.19685 = image->raw_data;
    if (D.19696 > D.19685) goto <D.19697>; else goto <D.19698>;
    <D.19697>:
    D.19696 = image->raw_metadata;
    D.19685 = image->raw_data;
    D.19699 = image->raw_data_len;
    D.19700 = D.19685 + D.19699;
    if (D.19696 <= D.19700) goto <D.19701>; else goto <D.19702>;
    <D.19701>:
    image->raw_metadata = 0B;
    <D.19702>:
    <D.19698>:
    i = 0;
    goto <D.18396>;
    <D.18395>:
    D.19703 = ii->cli_sections;
    i.45 = (unsigned int) i;
    D.19670 = i.45 * 4;
    D.19704 = D.19703 + D.19670;
    D.19705 = *D.19704;
    D.19685 = image->raw_data;
    if (D.19705 > D.19685) goto <D.19706>; else goto <D.19707>;
    <D.19706>:
    D.19703 = ii->cli_sections;
    i.45 = (unsigned int) i;
    D.19670 = i.45 * 4;
    D.19704 = D.19703 + D.19670;
    D.19705 = *D.19704;
    D.19685 = image->raw_data;
    D.19699 = image->raw_data_len;
    D.19700 = D.19685 + D.19699;
    if (D.19705 <= D.19700) goto <D.19708>; else goto <D.19709>;
    <D.19708>:
    D.19703 = ii->cli_sections;
    i.45 = (unsigned int) i;
    D.19670 = i.45 * 4;
    D.19704 = D.19703 + D.19670;
    *D.19704 = 0B;
    <D.19709>:
    <D.19707>:
    i = i + 1;
    <D.18396>:
    D.19710 = ii->cli_section_count;
    if (D.19710 > i) goto <D.18395>; else goto <D.18397>;
    <D.18397>:
    D.19685 = image->raw_data;
    monoeg_g_free (D.19685);
  }
  <D.19695>:
  debug_assembly_unload.46 = debug_assembly_unload;
  if (debug_assembly_unload.46 != 0) goto <D.19712>; else goto <D.19713>;
  <D.19712>:
  D.19645 = image->name;
  D.19714 = monoeg_g_strdup_printf ("%s - UNLOADED", D.19645);
  image->name = D.19714;
  goto <D.19715>;
  <D.19713>:
  D.19645 = image->name;
  monoeg_g_free (D.19645);
  D.19716 = image->guid;
  monoeg_g_free (D.19716);
  D.19717 = image->version;
  monoeg_g_free (D.19717);
  D.19718 = image->files;
  monoeg_g_free (D.19718);
  <D.19715>:
  D.19719 = image->method_cache;
  if (D.19719 != 0B) goto <D.19720>; else goto <D.19721>;
  <D.19720>:
  D.19719 = image->method_cache;
  monoeg_g_hash_table_destroy (D.19719);
  <D.19721>:
  D.19722 = image->methodref_cache;
  if (D.19722 != 0B) goto <D.19723>; else goto <D.19724>;
  <D.19723>:
  D.19722 = image->methodref_cache;
  monoeg_g_hash_table_destroy (D.19722);
  <D.19724>:
  D.19725 = &image->class_cache;
  mono_internal_hash_table_destroy (D.19725);
  D.19726 = image->field_cache;
  monoeg_g_hash_table_destroy (D.19726);
  D.19727 = image->array_cache;
  if (D.19727 != 0B) goto <D.19728>; else goto <D.19729>;
  <D.19728>:
  D.19727 = image->array_cache;
  monoeg_g_hash_table_foreach (D.19727, free_array_cache_entry, 0B);
  D.19727 = image->array_cache;
  monoeg_g_hash_table_destroy (D.19727);
  <D.19729>:
  D.19730 = image->szarray_cache;
  if (D.19730 != 0B) goto <D.19731>; else goto <D.19732>;
  <D.19731>:
  D.19730 = image->szarray_cache;
  monoeg_g_hash_table_destroy (D.19730);
  <D.19732>:
  D.19733 = image->ptr_cache;
  if (D.19733 != 0B) goto <D.19734>; else goto <D.19735>;
  <D.19734>:
  D.19733 = image->ptr_cache;
  monoeg_g_hash_table_destroy (D.19733);
  <D.19735>:
  D.19736 = image->name_cache;
  if (D.19736 != 0B) goto <D.19737>; else goto <D.19738>;
  <D.19737>:
  D.19736 = image->name_cache;
  monoeg_g_hash_table_foreach (D.19736, free_hash_table, 0B);
  D.19736 = image->name_cache;
  monoeg_g_hash_table_destroy (D.19736);
  <D.19738>:
  D.19739 = image->native_wrapper_cache;
  free_hash (D.19739);
  D.19740 = image->managed_wrapper_cache;
  free_hash (D.19740);
  D.19741 = image->delegate_begin_invoke_cache;
  free_hash (D.19741);
  D.19742 = image->delegate_end_invoke_cache;
  free_hash (D.19742);
  D.19743 = image->delegate_invoke_cache;
  free_hash (D.19743);
  D.19744 = image->delegate_abstract_invoke_cache;
  free_hash (D.19744);
  D.19745 = image->delegate_bound_static_invoke_cache;
  free_hash (D.19745);
  D.19746 = image->delegate_invoke_generic_cache;
  free_hash (D.19746);
  D.19747 = image->delegate_begin_invoke_generic_cache;
  free_hash (D.19747);
  D.19748 = image->delegate_end_invoke_generic_cache;
  free_hash (D.19748);
  D.19749 = image->synchronized_generic_cache;
  free_hash (D.19749);
  D.19750 = image->remoting_invoke_cache;
  free_hash (D.19750);
  D.19751 = image->runtime_invoke_cache;
  free_hash (D.19751);
  D.19752 = image->runtime_invoke_vtype_cache;
  free_hash (D.19752);
  D.19753 = image->runtime_invoke_direct_cache;
  free_hash (D.19753);
  D.19754 = image->runtime_invoke_vcall_cache;
  free_hash (D.19754);
  D.19755 = image->synchronized_cache;
  free_hash (D.19755);
  D.19756 = image->unbox_wrapper_cache;
  free_hash (D.19756);
  D.19757 = image->cominterop_invoke_cache;
  free_hash (D.19757);
  D.19758 = image->cominterop_wrapper_cache;
  free_hash (D.19758);
  D.19759 = image->typespec_cache;
  free_hash (D.19759);
  D.19760 = image->ldfld_wrapper_cache;
  free_hash (D.19760);
  D.19761 = image->ldflda_wrapper_cache;
  free_hash (D.19761);
  D.19762 = image->stfld_wrapper_cache;
  free_hash (D.19762);
  D.19763 = image->isinst_cache;
  free_hash (D.19763);
  D.19764 = image->castclass_cache;
  free_hash (D.19764);
  D.19765 = image->proxy_isinst_cache;
  free_hash (D.19765);
  D.19766 = image->thunk_invoke_cache;
  free_hash (D.19766);
  D.19767 = image->var_cache_slow;
  free_hash (D.19767);
  D.19768 = image->mvar_cache_slow;
  free_hash (D.19768);
  D.19769 = image->wrapper_param_names;
  free_hash (D.19769);
  D.19770 = image->native_wrapper_aot_cache;
  free_hash (D.19770);
  D.19771 = image->pinvoke_scopes;
  free_hash (D.19771);
  D.19772 = image->pinvoke_scope_filenames;
  free_hash (D.19772);
  D.19773 = image->gsharedvt_types;
  free_hash (D.19773);
  D.19774 = image->memberref_signatures;
  monoeg_g_hash_table_destroy (D.19774);
  D.19775 = image->helper_signatures;
  monoeg_g_hash_table_destroy (D.19775);
  D.19776 = image->method_signatures;
  monoeg_g_hash_table_destroy (D.19776);
  D.19777 = image->rgctx_template_hash;
  if (D.19777 != 0B) goto <D.19778>; else goto <D.19779>;
  <D.19778>:
  D.19777 = image->rgctx_template_hash;
  monoeg_g_hash_table_destroy (D.19777);
  <D.19779>:
  D.19780 = image->property_hash;
  if (D.19780 != 0B) goto <D.19781>; else goto <D.19782>;
  <D.19781>:
  D.19780 = image->property_hash;
  mono_property_hash_destroy (D.19780);
  <D.19782>:
  D.19786 = image->reflection_info_unregister_classes;
  if (D.19786 != 0B) goto <D.19787>; else goto <D.19784>;
  <D.19787>:
  D.19788 = mono_runtime_is_shutting_down ();
  if (D.19788 == 0) goto <D.19789>; else goto <D.19784>;
  <D.19789>:
  iftmp.47 = 1;
  goto <D.19785>;
  <D.19784>:
  iftmp.47 = 0;
  <D.19785>:
  D.19790 = iftmp.47 != 0;
  D.19791 = (long int) D.19790;
  D.19792 = __builtin_expect (D.19791, 0);
  if (D.19792 != 0) goto <D.19793>; else goto <D.19794>;
  <D.19793>:
  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.19794>:
  image->reflection_info_unregister_classes = 0B;
  D.19795 = image->interface_bitset;
  if (D.19795 != 0B) goto <D.19796>; else goto <D.19797>;
  <D.19796>:
  D.19795 = image->interface_bitset;
  mono_unload_interface_ids (D.19795);
  D.19795 = image->interface_bitset;
  mono_bitset_free (D.19795);
  <D.19797>:
  D.19798 = image->image_info;
  if (D.19798 != 0B) goto <D.19799>; else goto <D.19800>;
  <D.19799>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.19801 = ii->cli_section_tables;
    if (D.19801 != 0B) goto <D.19802>; else goto <D.19803>;
    <D.19802>:
    D.19801 = ii->cli_section_tables;
    monoeg_g_free (D.19801);
    <D.19803>:
    D.19804 = ii->cli_sections;
    if (D.19804 != 0B) goto <D.19805>; else goto <D.19806>;
    <D.19805>:
    D.19804 = ii->cli_sections;
    monoeg_g_free (D.19804);
    <D.19806>:
    D.19798 = image->image_info;
    monoeg_g_free (D.19798);
  }
  <D.19800>:
  i = 0;
  goto <D.18400>;
  <D.18399>:
  D.19807 = image->modules;
  i.45 = (unsigned int) i;
  D.19670 = i.45 * 4;
  D.19808 = D.19807 + D.19670;
  D.19809 = *D.19808;
  if (D.19809 != 0B) goto <D.19810>; else goto <D.19811>;
  <D.19810>:
  D.19807 = image->modules;
  i.45 = (unsigned int) i;
  D.19670 = i.45 * 4;
  D.19808 = D.19807 + D.19670;
  D.19809 = *D.19808;
  D.19812 = mono_image_close_except_pools (D.19809);
  if (D.19812 == 0) goto <D.19813>; else goto <D.19814>;
  <D.19813>:
  D.19807 = image->modules;
  i.45 = (unsigned int) i;
  D.19670 = i.45 * 4;
  D.19808 = D.19807 + D.19670;
  *D.19808 = 0B;
  <D.19814>:
  <D.19811>:
  i = i + 1;
  <D.18400>:
  i.48 = (unsigned int) i;
  D.19816 = image->module_count;
  if (i.48 < D.19816) goto <D.18399>; else goto <D.18401>;
  <D.18401>:
  D.19817 = image->modules_loaded;
  if (D.19817 != 0B) goto <D.19818>; else goto <D.19819>;
  <D.19818>:
  D.19817 = image->modules_loaded;
  monoeg_g_free (D.19817);
  <D.19819>:
  D.19820 = &image->szarray_cache_lock;
  DeleteCriticalSection (D.19820);
  D.19821 = &image->lock;
  DeleteCriticalSection (D.19821);
  D.19640 = BIT_FIELD_REF <*image, 8, 128>;
  D.19667 = D.19640 & 8;
  if (D.19667 != 0) goto <D.19822>; else goto <D.19823>;
  <D.19822>:
  D.19824 = image->module_name;
  monoeg_g_free (D.19824);
  mono_dynamic_image_free (image);
  <D.19823>:
  mono_profiler_module_event (image, 3);
  D.19615 = 1;
  return D.19615;
}


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.19826;
  unsigned int D.19827;

  D.19827 = __sync_sub_and_fetch_4 (val, 1);
  D.19826 = (gint32) D.19827;
  return D.19826;
}


mono_image_invoke_unload_hook (struct MonoImage * image)
{
  void (*<T1ab4>) (struct MonoImage *, void *) D.19829;
  void * D.19830;
  struct GSList * l;
  struct ImageUnloadHook * hook;

  l = image_unload_hooks;
  goto <D.17968>;
  <D.17967>:
  hook = l->data;
  D.19829 = hook->func;
  D.19830 = hook->user_data;
  D.19829 (image, D.19830);
  l = l->next;
  <D.17968>:
  if (l != 0B) goto <D.17967>; else goto <D.17969>;
  <D.17969>:
}


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


mono_image_close_finish (struct MonoImage * image)
{
  struct MonoAssembly * * D.19833;
  unsigned char D.19836;
  unsigned char D.19837;
  unsigned int i.49;
  unsigned int D.19841;
  struct MonoAssembly * * D.19842;
  struct MonoAssembly * D.19843;
  struct MonoAssembly * D.19844;
  int D.19847;
  struct MonoImage * * D.19848;
  struct MonoImage * * D.19849;
  struct MonoImage * D.19850;
  unsigned int i.50;
  unsigned int D.19854;
  struct MonoMemPool * D.19857;
  unsigned int D.19858;
  struct MonoPerfCounters * mono_perfcounters.51;
  unsigned int D.19860;
  unsigned int D.19861;
  int debug_assembly_unload.52;
  int i;

  D.19833 = image->references;
  if (D.19833 != 0B) goto <D.19834>; else goto <D.19835>;
  <D.19834>:
  D.19836 = BIT_FIELD_REF <*image, 8, 128>;
  D.19837 = D.19836 & 8;
  if (D.19837 == 0) goto <D.19838>; else goto <D.19839>;
  <D.19838>:
  i = 0;
  goto <D.18407>;
  <D.18406>:
  D.19833 = image->references;
  i.49 = (unsigned int) i;
  D.19841 = i.49 * 4;
  D.19842 = D.19833 + D.19841;
  D.19843 = *D.19842;
  D.19844 = D.19843 + 4294967295;
  if (D.19844 <= 4294967293B) goto <D.19845>; else goto <D.19846>;
  <D.19845>:
  D.19833 = image->references;
  i.49 = (unsigned int) i;
  D.19841 = i.49 * 4;
  D.19842 = D.19833 + D.19841;
  D.19843 = *D.19842;
  mono_assembly_close_finish (D.19843);
  <D.19846>:
  i = i + 1;
  <D.18407>:
  D.19847 = image->nreferences;
  if (D.19847 > i) goto <D.18406>; else goto <D.18408>;
  <D.18408>:
  D.19833 = image->references;
  monoeg_g_free (D.19833);
  image->references = 0B;
  <D.19839>:
  <D.19835>:
  i = 0;
  goto <D.18410>;
  <D.18409>:
  D.19848 = image->modules;
  i.49 = (unsigned int) i;
  D.19841 = i.49 * 4;
  D.19849 = D.19848 + D.19841;
  D.19850 = *D.19849;
  if (D.19850 != 0B) goto <D.19851>; else goto <D.19852>;
  <D.19851>:
  D.19848 = image->modules;
  i.49 = (unsigned int) i;
  D.19841 = i.49 * 4;
  D.19849 = D.19848 + D.19841;
  D.19850 = *D.19849;
  mono_image_close_finish (D.19850);
  <D.19852>:
  i = i + 1;
  <D.18410>:
  i.50 = (unsigned int) i;
  D.19854 = image->module_count;
  if (i.50 < D.19854) goto <D.18409>; else goto <D.18411>;
  <D.18411>:
  D.19848 = image->modules;
  if (D.19848 != 0B) goto <D.19855>; else goto <D.19856>;
  <D.19855>:
  D.19848 = image->modules;
  monoeg_g_free (D.19848);
  <D.19856>:
  D.19857 = image->mempool;
  D.19858 = mono_mempool_get_allocated (D.19857);
  mono_perfcounters.51 = mono_perfcounters;
  mono_perfcounters.51 = mono_perfcounters;
  D.19860 = mono_perfcounters.51->loader_bytes;
  D.19861 = D.19860 - D.19858;
  mono_perfcounters.51->loader_bytes = D.19861;
  D.19836 = BIT_FIELD_REF <*image, 8, 128>;
  D.19837 = D.19836 & 8;
  if (D.19837 == 0) goto <D.19862>; else goto <D.19863>;
  <D.19862>:
  debug_assembly_unload.52 = debug_assembly_unload;
  if (debug_assembly_unload.52 != 0) goto <D.19865>; else goto <D.19866>;
  <D.19865>:
  D.19857 = image->mempool;
  mono_mempool_invalidate (D.19857);
  goto <D.19867>;
  <D.19866>:
  D.19857 = image->mempool;
  mono_mempool_destroy (D.19857);
  monoeg_g_free (image);
  <D.19867>:
  goto <D.19868>;
  <D.19863>:
  debug_assembly_unload.52 = debug_assembly_unload;
  if (debug_assembly_unload.52 != 0) goto <D.19869>; else goto <D.19870>;
  <D.19869>:
  D.19857 = image->mempool;
  mono_mempool_invalidate (D.19857);
  goto <D.19871>;
  <D.19870>:
  D.19857 = image->mempool;
  mono_mempool_destroy (D.19857);
  <D.19871>:
  <D.19868>:
}


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

  D.19872 = mono_image_close_except_pools (image);
  if (D.19872 != 0) goto <D.19873>; else goto <D.19874>;
  <D.19873>:
  mono_image_close_finish (image);
  <D.19874>:
}


mono_image_strerror (MonoImageOpenStatus status)
{
  const char * D.19875;
  int * D.19876;
  int D.19877;

  switch (status) <default: <D.19878>, case 0: <D.18418>, case 1: <D.18419>, case 2: <D.18421>, case 3: <D.18420>>
  <D.18418>:
  D.19875 = "success";
  return D.19875;
  <D.18419>:
  D.19876 = __errno_location ();
  D.19877 = *D.19876;
  D.19875 = strerror (D.19877);
  return D.19875;
  <D.18420>:
  D.19875 = "File does not contain a valid CIL image";
  return D.19875;
  <D.18421>:
  D.19875 = "An assembly was referenced, but could not be found";
  return D.19875;
  <D.19878>:
  D.19875 = "Internal error";
  return D.19875;
}


mono_image_lookup_resource (struct MonoImage * image, guint32 res_id, guint32 lang_id, gunichar2 * name)
{
  void * D.19882;
  unsigned int D.19891;
  short unsigned int D.19894;
  int D.19895;
  short unsigned int D.19896;
  int D.19897;
  int D.19898;
  unsigned int D.19899;
  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.19880>; else goto <D.19881>;
  <D.19880>:
  D.19882 = 0B;
  return D.19882;
  <D.19881>:
  mono_image_ensure_section_idx (image, 1);
  info = image->image_info;
  if (info == 0B) goto <D.19883>; else goto <D.19884>;
  <D.19883>:
  D.19882 = 0B;
  return D.19882;
  <D.19884>:
  header = &info->cli_header;
  if (header == 0B) goto <D.19885>; else goto <D.19886>;
  <D.19885>:
  D.19882 = 0B;
  return D.19882;
  <D.19886>:
  datadir = &header->datadir;
  if (datadir == 0B) goto <D.19887>; else goto <D.19888>;
  <D.19887>:
  D.19882 = 0B;
  return D.19882;
  <D.19888>:
  rsrc = &datadir->pe_resource_table;
  if (rsrc == 0B) goto <D.19889>; else goto <D.19890>;
  <D.19889>:
  D.19882 = 0B;
  return D.19882;
  <D.19890>:
  D.19891 = rsrc->rva;
  resource_dir = mono_image_rva_map (image, D.19891);
  if (resource_dir == 0B) goto <D.19892>; else goto <D.19893>;
  <D.19892>:
  D.19882 = 0B;
  return D.19882;
  <D.19893>:
  D.19894 = resource_dir->res_named_entries;
  D.19895 = (int) D.19894;
  D.19896 = resource_dir->res_id_entries;
  D.19897 = (int) D.19896;
  D.19898 = D.19895 + D.19897;
  entries = (guint32) D.19898;
  res_entries = resource_dir + 16;
  i = 0;
  goto <D.18463>;
  <D.18462>:
  {
    struct MonoPEResourceDirEntry * entry;
    void * ret;

    D.19899 = i * 8;
    entry = res_entries + D.19899;
    ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, entry, resource_dir, 0);
    if (ret != 0B) goto <D.19900>; else goto <D.19901>;
    <D.19900>:
    D.19882 = ret;
    return D.19882;
    <D.19901>:
  }
  i = i + 1;
  <D.18463>:
  if (i < entries) goto <D.18462>; else goto <D.18464>;
  <D.18464>:
  D.19882 = 0B;
  return D.19882;
}


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.19903;
  unsigned int D.19904;
  unsigned int D.19905;
  unsigned int D.19906;
  void * D.19911;
  _Bool D.19923;
  _Bool D.19924;
  _Bool D.19925;
  short unsigned int D.19930;
  int D.19931;
  short unsigned int D.19932;
  int D.19933;
  int D.19934;
  unsigned int D.19935;
  unsigned int D.19936;
  unsigned int D.19939;
  unsigned int D.19940;
  unsigned int D.19941;
  unsigned int D.19942;
  gboolean is_string;
  gboolean is_dir;
  guint32 name_offset;
  guint32 dir_offset;

  D.19903 = entry->name;
  D.19904 = D.19903 >> 31;
  is_string = (gboolean) D.19904;
  D.19903 = entry->name;
  name_offset = D.19903 & 2147483647;
  D.19905 = entry->dir;
  D.19906 = D.19905 >> 31;
  is_dir = (gboolean) D.19906;
  D.19905 = entry->dir;
  dir_offset = D.19905 & 2147483647;
  if (level == 0) goto <D.19907>; else goto <D.19908>;
  <D.19907>:
  if (is_string != 0) goto <D.19909>; else goto <D.19910>;
  <D.19909>:
  D.19911 = 0B;
  return D.19911;
  <D.19910>:
  goto <D.19912>;
  <D.19908>:
  if (level == 1) goto <D.19913>; else goto <D.19914>;
  <D.19913>:
  if (res_id != name_offset) goto <D.19915>; else goto <D.19916>;
  <D.19915>:
  D.19911 = 0B;
  return D.19911;
  <D.19916>:
  goto <D.19917>;
  <D.19914>:
  if (level == 2) goto <D.19918>; else goto <D.19919>;
  <D.19918>:
  if (is_string == 1) goto <D.19920>; else goto <D.19922>;
  <D.19922>:
  D.19923 = is_string == 0;
  D.19924 = lang_id != 0;
  D.19925 = D.19923 & D.19924;
  if (D.19925 != 0) goto <D.19926>; else goto <D.19921>;
  <D.19926>:
  if (name_offset != lang_id) goto <D.19920>; else goto <D.19921>;
  <D.19920>:
  D.19911 = 0B;
  return D.19911;
  <D.19921>:
  goto <D.19927>;
  <D.19919>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image.c", 1829);
  <D.19927>:
  <D.19917>:
  <D.19912>:
  if (is_dir == 1) goto <D.19928>; else goto <D.19929>;
  <D.19928>:
  {
    struct MonoPEResourceDir * res_dir;
    struct MonoPEResourceDirEntry * sub_entries;
    guint32 entries;
    guint32 i;

    res_dir = root + dir_offset;
    sub_entries = res_dir + 16;
    D.19930 = res_dir->res_named_entries;
    D.19931 = (int) D.19930;
    D.19932 = res_dir->res_id_entries;
    D.19933 = (int) D.19932;
    D.19934 = D.19931 + D.19933;
    entries = (guint32) D.19934;
    i = 0;
    goto <D.18442>;
    <D.18441>:
    {
      struct MonoPEResourceDirEntry * sub_entry;
      void * ret;

      D.19935 = i * 8;
      sub_entry = sub_entries + D.19935;
      D.19936 = level + 1;
      ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, sub_entry, root, D.19936);
      if (ret != 0B) goto <D.19937>; else goto <D.19938>;
      <D.19937>:
      D.19911 = ret;
      return D.19911;
      <D.19938>:
    }
    i = i + 1;
    <D.18442>:
    if (i < entries) goto <D.18441>; else goto <D.18443>;
    <D.18443>:
    D.19911 = 0B;
    return D.19911;
  }
  <D.19929>:
  {
    struct MonoPEResourceDataEntry * data_entry;
    struct MonoPEResourceDataEntry * res;

    data_entry = root + dir_offset;
    res = monoeg_malloc0 (16);
    D.19939 = data_entry->rde_data_offset;
    res->rde_data_offset = D.19939;
    D.19940 = data_entry->rde_size;
    res->rde_size = D.19940;
    D.19941 = data_entry->rde_codepage;
    res->rde_codepage = D.19941;
    D.19942 = data_entry->rde_reserved;
    res->rde_reserved = D.19942;
    D.19911 = res;
    return D.19911;
  }
}


mono_image_get_entry_point (struct MonoImage * image)
{
  uint32_t D.19944;
  void * D.19945;

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


mono_image_get_resource (struct MonoImage * image, guint32 offset, guint32 * size)
{
  unsigned int D.19949;
  unsigned int D.19951;
  unsigned int D.19952;
  const char * D.19953;
  unsigned int D.19958;
  struct MonoCLIImageInfo * iinfo;
  struct MonoCLIHeader * ch;
  const char * data;

  iinfo = image->image_info;
  ch = &iinfo->cli_cli_header;
  D.19949 = ch->ch_resources.rva;
  if (D.19949 == 0) goto <D.19947>; else goto <D.19950>;
  <D.19950>:
  D.19951 = offset + 4;
  D.19952 = ch->ch_resources.size;
  if (D.19951 > D.19952) goto <D.19947>; else goto <D.19948>;
  <D.19947>:
  D.19953 = 0B;
  return D.19953;
  <D.19948>:
  D.19949 = ch->ch_resources.rva;
  data = mono_image_rva_map (image, D.19949);
  if (data == 0B) goto <D.19954>; else goto <D.19955>;
  <D.19954>:
  D.19953 = 0B;
  return D.19953;
  <D.19955>:
  data = data + offset;
  if (size != 0B) goto <D.19956>; else goto <D.19957>;
  <D.19956>:
  D.19958 = MEM[(const guint32 *)data];
  *size = D.19958;
  <D.19957>:
  data = data + 4;
  D.19953 = data;
  return D.19953;
}


mono_image_load_file_for_image (struct MonoImage * image, int fileidx)
{
  <unnamed-unsigned:24> D.19963;
  int D.19964;
  struct MonoImage * D.19965;
  struct MonoImage * * D.19966;
  sizetype fileidx.53;
  sizetype D.19970;
  sizetype D.19971;
  struct MonoImage * * D.19972;
  struct MonoImage * D.19973;
  unsigned int D.19978;
  unsigned int D.19979;
  void * D.19980;
  int D.19981;
  char * D.19982;
  struct MonoAssembly * D.19985;
  struct MonoImage * * D.19986;
  unsigned int i.54;
  unsigned int D.19988;
  struct MonoImage * * D.19989;
  struct MonoImage * D.19990;
  struct MonoAssembly * D.19993;
  unsigned int i.55;
  unsigned int D.19997;
  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.19960>; else goto <D.19962>;
  <D.19962>:
  D.19963 = t->rows;
  D.19964 = (int) D.19963;
  if (D.19964 < fileidx) goto <D.19960>; else goto <D.19961>;
  <D.19960>:
  D.19965 = 0B;
  return D.19965;
  <D.19961>:
  mono_loader_lock ();
  D.19966 = image->files;
  if (D.19966 != 0B) goto <D.19967>; else goto <D.19968>;
  <D.19967>:
  D.19966 = image->files;
  fileidx.53 = (sizetype) fileidx;
  D.19970 = fileidx.53 + 1073741823;
  D.19971 = D.19970 * 4;
  D.19972 = D.19966 + D.19971;
  D.19973 = *D.19972;
  if (D.19973 != 0B) goto <D.19974>; else goto <D.19975>;
  <D.19974>:
  mono_loader_unlock ();
  D.19966 = image->files;
  fileidx.53 = (sizetype) fileidx;
  D.19970 = fileidx.53 + 1073741823;
  D.19971 = D.19970 * 4;
  D.19972 = D.19966 + D.19971;
  D.19965 = *D.19972;
  return D.19965;
  <D.19975>:
  <D.19968>:
  D.19966 = image->files;
  if (D.19966 == 0B) goto <D.19976>; else goto <D.19977>;
  <D.19976>:
  D.19963 = t->rows;
  D.19978 = (unsigned int) D.19963;
  D.19979 = D.19978 * 4;
  D.19980 = monoeg_malloc0 (D.19979);
  image->files = D.19980;
  <D.19977>:
  D.19981 = fileidx + -1;
  fname_id = mono_metadata_decode_row_col (t, D.19981, 1);
  fname = mono_metadata_string_heap (image, fname_id);
  D.19982 = image->name;
  base_dir = monoeg_g_path_get_dirname (D.19982);
  name = monoeg_g_build_path ("/", base_dir, fname, 0B);
  res = mono_image_open (name, 0B);
  if (res != 0B) goto <D.19983>; else goto <D.19984>;
  <D.19983>:
  {
    int i;

    D.19985 = image->assembly;
    res->assembly = D.19985;
    i = 0;
    goto <D.18488>;
    <D.18487>:
    D.19986 = res->modules;
    i.54 = (unsigned int) i;
    D.19988 = i.54 * 4;
    D.19989 = D.19986 + D.19988;
    D.19990 = *D.19989;
    if (D.19990 != 0B) goto <D.19991>; else goto <D.19992>;
    <D.19991>:
    D.19986 = res->modules;
    i.54 = (unsigned int) i;
    D.19988 = i.54 * 4;
    D.19989 = D.19986 + D.19988;
    D.19990 = *D.19989;
    D.19993 = D.19990->assembly;
    if (D.19993 == 0B) goto <D.19994>; else goto <D.19995>;
    <D.19994>:
    D.19986 = res->modules;
    i.54 = (unsigned int) i;
    D.19988 = i.54 * 4;
    D.19989 = D.19986 + D.19988;
    D.19990 = *D.19989;
    D.19985 = image->assembly;
    D.19990->assembly = D.19985;
    <D.19995>:
    <D.19992>:
    i = i + 1;
    <D.18488>:
    i.55 = (unsigned int) i;
    D.19997 = res->module_count;
    if (i.55 < D.19997) goto <D.18487>; else goto <D.18489>;
    <D.18489>:
    D.19966 = image->files;
    fileidx.53 = (sizetype) fileidx;
    D.19970 = fileidx.53 + 1073741823;
    D.19971 = D.19970 * 4;
    D.19972 = D.19966 + D.19971;
    *D.19972 = res;
  }
  <D.19984>:
  mono_loader_unlock ();
  monoeg_g_free (name);
  monoeg_g_free (base_dir);
  D.19965 = res;
  return D.19965;
}


mono_image_get_strong_name (struct MonoImage * image, guint32 * size)
{
  unsigned int D.20001;
  unsigned int D.20003;
  const char * D.20004;
  struct MonoCLIImageInfo * iinfo;
  struct MonoPEDirEntry * de;
  const char * data;

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  D.20001 = de->size;
  if (D.20001 == 0) goto <D.19999>; else goto <D.20002>;
  <D.20002>:
  D.20003 = de->rva;
  if (D.20003 == 0) goto <D.19999>; else goto <D.20000>;
  <D.19999>:
  D.20004 = 0B;
  return D.20004;
  <D.20000>:
  D.20003 = de->rva;
  data = mono_image_rva_map (image, D.20003);
  if (data == 0B) goto <D.20005>; else goto <D.20006>;
  <D.20005>:
  D.20004 = 0B;
  return D.20004;
  <D.20006>:
  if (size != 0B) goto <D.20007>; else goto <D.20008>;
  <D.20007>:
  D.20001 = de->size;
  *size = D.20001;
  <D.20008>:
  D.20004 = data;
  return D.20004;
}


mono_image_strong_name_position (struct MonoImage * image, guint32 * size)
{
  unsigned int D.20012;
  unsigned int D.20016;
  uint32_t D.20017;
  uint32_t iftmp.56;
  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.20010>; else goto <D.20011>;
  <D.20010>:
  D.20012 = de->size;
  *size = D.20012;
  <D.20011>:
  D.20012 = de->size;
  if (D.20012 == 0) goto <D.20013>; else goto <D.20015>;
  <D.20015>:
  D.20016 = de->rva;
  if (D.20016 == 0) goto <D.20013>; else goto <D.20014>;
  <D.20013>:
  D.20017 = 0;
  return D.20017;
  <D.20014>:
  D.20016 = de->rva;
  pos = mono_cli_rva_image_map (image, D.20016);
  if (pos != 4294967295) goto <D.20019>; else goto <D.20020>;
  <D.20019>:
  iftmp.56 = pos;
  goto <D.20021>;
  <D.20020>:
  iftmp.56 = 0;
  <D.20021>:
  D.20017 = iftmp.56;
  return D.20017;
}


mono_image_get_public_key (struct MonoImage * image, guint32 * size)
{
  unsigned char D.20023;
  unsigned char D.20024;
  int D.20029;
  unsigned int D.20030;
  const char * D.20031;
  unsigned int D.20032;
  unsigned int D.20033;
  struct MonoTableInfo * D.20036;
  const char * pubkey.57;
  const char * pubkey.58;
  const char * pubkey;
  guint32 len;
  guint32 tok;

  try
    {
      D.20023 = BIT_FIELD_REF <*image, 8, 128>;
      D.20024 = D.20023 & 8;
      if (D.20024 != 0) goto <D.20025>; else goto <D.20026>;
      <D.20025>:
      if (size != 0B) goto <D.20027>; else goto <D.20028>;
      <D.20027>:
      D.20029 = MEM[(struct MonoDynamicImage *)image].public_key_len;
      D.20030 = (unsigned int) D.20029;
      *size = D.20030;
      <D.20028>:
      D.20031 = MEM[(struct MonoDynamicImage *)image].public_key;
      return D.20031;
      <D.20026>:
      D.20032 = BIT_FIELD_REF <*image, 32, 3904>;
      D.20033 = D.20032 & 16777215;
      if (D.20033 != 1) goto <D.20034>; else goto <D.20035>;
      <D.20034>:
      D.20031 = 0B;
      return D.20031;
      <D.20035>:
      D.20036 = &image->tables[32];
      tok = mono_metadata_decode_row_col (D.20036, 0, 6);
      if (tok == 0) goto <D.20037>; else goto <D.20038>;
      <D.20037>:
      D.20031 = 0B;
      return D.20031;
      <D.20038>:
      pubkey.57 = mono_metadata_blob_heap (image, tok);
      pubkey = pubkey.57;
      pubkey.58 = pubkey;
      len = mono_metadata_decode_blob_size (pubkey.58, &pubkey);
      if (size != 0B) goto <D.20041>; else goto <D.20042>;
      <D.20041>:
      *size = len;
      <D.20042>:
      D.20031 = pubkey;
      return D.20031;
    }
  finally
    {
      pubkey = {CLOBBER};
    }
}


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

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


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

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


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

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


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

  table_id.59 = (unsigned int) table_id;
  if (table_id.59 > 44) goto <D.20052>; else goto <D.20053>;
  <D.20052>:
  D.20054 = 0B;
  return D.20054;
  <D.20053>:
  D.20054 = &image->tables[table_id];
  return D.20054;
}


mono_image_get_table_rows (struct MonoImage * image, int table_id)
{
  unsigned int table_id.60;
  int D.20059;
  <unnamed-unsigned:24> D.20060;

  table_id.60 = (unsigned int) table_id;
  if (table_id.60 > 44) goto <D.20057>; else goto <D.20058>;
  <D.20057>:
  D.20059 = 0;
  return D.20059;
  <D.20058>:
  D.20060 = image->tables[table_id].rows;
  D.20059 = (int) D.20060;
  return D.20059;
}


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

  D.20063 = table->rows;
  D.20062 = (int) D.20063;
  return D.20062;
}


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

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


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

  D.20068 = image->dynamic;
  D.20067 = (mono_bool) D.20068;
  return D.20067;
}


mono_image_has_authenticode_entry (struct MonoImage * image)
{
  mono_bool D.20070;
  int iftmp.61;
  unsigned int D.20074;
  unsigned int D.20076;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoPEDirEntry * de;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  de = &header->datadir.pe_certificate_table;
  D.20074 = de->rva;
  if (D.20074 != 0) goto <D.20075>; else goto <D.20072>;
  <D.20075>:
  D.20076 = de->size;
  if (D.20076 > 8) goto <D.20077>; else goto <D.20072>;
  <D.20077>:
  iftmp.61 = 1;
  goto <D.20073>;
  <D.20072>:
  iftmp.61 = 0;
  <D.20073>:
  D.20070 = iftmp.61;
  return D.20070;
}


mono_image_alloc (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.62;
  unsigned int D.20080;
  unsigned int D.20081;
  struct MonoMemPool * D.20082;
  void * D.20083;
  void * res;

  mono_perfcounters.62 = mono_perfcounters;
  mono_perfcounters.62 = mono_perfcounters;
  D.20080 = mono_perfcounters.62->loader_bytes;
  D.20081 = D.20080 + size;
  mono_perfcounters.62->loader_bytes = D.20081;
  mono_image_lock (image);
  D.20082 = image->mempool;
  res = mono_mempool_alloc (D.20082, size);
  mono_image_unlock (image);
  D.20083 = res;
  return D.20083;
}


mono_image_alloc0 (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.63;
  unsigned int D.20086;
  unsigned int D.20087;
  struct MonoMemPool * D.20088;
  void * D.20089;
  void * res;

  mono_perfcounters.63 = mono_perfcounters;
  mono_perfcounters.63 = mono_perfcounters;
  D.20086 = mono_perfcounters.63->loader_bytes;
  D.20087 = D.20086 + size;
  mono_perfcounters.63->loader_bytes = D.20087;
  mono_image_lock (image);
  D.20088 = image->mempool;
  res = mono_mempool_alloc0 (D.20088, size);
  mono_image_unlock (image);
  D.20089 = res;
  return D.20089;
}


mono_image_strdup (struct MonoImage * image, const char * s)
{
  struct MonoPerfCounters * mono_perfcounters.64;
  unsigned int D.20092;
  unsigned int D.20093;
  unsigned int D.20094;
  struct MonoMemPool * D.20095;
  char * D.20096;
  char * res;

  mono_perfcounters.64 = mono_perfcounters;
  mono_perfcounters.64 = mono_perfcounters;
  D.20092 = mono_perfcounters.64->loader_bytes;
  D.20093 = strlen (s);
  D.20094 = D.20092 + D.20093;
  mono_perfcounters.64->loader_bytes = D.20094;
  mono_image_lock (image);
  D.20095 = image->mempool;
  res = mono_mempool_strdup (D.20095, s);
  mono_image_unlock (image);
  D.20096 = res;
  return D.20096;
}


g_list_prepend_image (struct MonoImage * image, struct GList * list, void * data)
{
  struct GList * iftmp.65;
  struct GList * D.20102;
  struct GList * D.20107;
  struct GList * new_list;

  new_list = mono_image_alloc (image, 12);
  new_list->data = data;
  if (list != 0B) goto <D.20099>; else goto <D.20100>;
  <D.20099>:
  iftmp.65 = list->prev;
  goto <D.20101>;
  <D.20100>:
  iftmp.65 = 0B;
  <D.20101>:
  new_list->prev = iftmp.65;
  new_list->next = list;
  D.20102 = new_list->prev;
  if (D.20102 != 0B) goto <D.20103>; else goto <D.20104>;
  <D.20103>:
  D.20102 = new_list->prev;
  D.20102->next = new_list;
  <D.20104>:
  if (list != 0B) goto <D.20105>; else goto <D.20106>;
  <D.20105>:
  list->prev = new_list;
  <D.20106>:
  D.20107 = new_list;
  return D.20107;
}


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

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


mono_image_lock (struct MonoImage * image)
{
  union mono_mutex_t * D.20111;
  _Bool D.20114;
  long int D.20115;
  long int D.20116;

  {
    int ret;

    D.20111 = &image->lock.mutex;
    ret = pthread_mutex_lock (D.20111);
    if (ret != 0) goto <D.20112>; else goto <D.20113>;
    <D.20112>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20113>:
    D.20114 = ret != 0;
    D.20115 = (long int) D.20114;
    D.20116 = __builtin_expect (D.20115, 0);
    if (D.20116 != 0) goto <D.20117>; else goto <D.20118>;
    <D.20117>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2304, "ret == 0");
    <D.20118>:
  }
}


mono_image_unlock (struct MonoImage * image)
{
  union mono_mutex_t * D.20119;
  _Bool D.20122;
  long int D.20123;
  long int D.20124;

  {
    int ret;

    D.20119 = &image->lock.mutex;
    ret = pthread_mutex_unlock (D.20119);
    if (ret != 0) goto <D.20120>; else goto <D.20121>;
    <D.20120>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20121>:
    D.20122 = ret != 0;
    D.20123 = (long int) D.20122;
    D.20124 = __builtin_expect (D.20123, 0);
    if (D.20124 != 0) goto <D.20125>; else goto <D.20126>;
    <D.20125>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2310, "ret == 0");
    <D.20126>:
  }
}


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

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


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

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


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

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


mono_image_append_class_to_reflection_info_set (struct MonoClass * class)
{
  unsigned char D.20132;
  unsigned char D.20133;
  _Bool D.20134;
  long int D.20135;
  long int D.20136;
  struct GSList * D.20139;
  struct MonoMemPool * D.20140;
  struct GSList * D.20141;
  struct MonoImage * image;

  image = class->image;
  D.20132 = BIT_FIELD_REF <*image, 8, 128>;
  D.20133 = D.20132 & 8;
  D.20134 = D.20133 == 0;
  D.20135 = (long int) D.20134;
  D.20136 = __builtin_expect (D.20135, 0);
  if (D.20136 != 0) goto <D.20137>; else goto <D.20138>;
  <D.20137>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2367, "image->dynamic");
  <D.20138>:
  mono_image_lock (image);
  D.20139 = image->reflection_info_unregister_classes;
  D.20140 = image->mempool;
  D.20141 = g_slist_prepend_mempool (D.20140, D.20139, class);
  image->reflection_info_unregister_classes = D.20141;
  mono_image_unlock (image);
}


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

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


