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


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

  l = image_unload_hooks;
  goto <D.18857>;
  <D.18856>:
  hook = l->data;
  D.19500 = hook->func;
  if (D.19500 == func) goto <D.19501>; else goto <D.19502>;
  <D.19501>:
  D.19503 = hook->user_data;
  if (D.19503 == user_data) goto <D.19504>; else goto <D.19505>;
  <D.19504>:
  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.18855>;
  <D.19505>:
  <D.19502>:
  l = l->next;
  <D.18857>:
  if (l != 0B) goto <D.18856>; else goto <D.18855>;
  <D.18855>:
}


mono_cli_rva_image_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.19508;
  unsigned int D.19511;
  unsigned int D.19512;
  guint32 D.19515;
  unsigned int D.19516;
  unsigned int D.19517;
  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.18875>;
  <D.18874>:
  D.19508 = tables->st_virtual_address;
  if (D.19508 <= addr) goto <D.19509>; else goto <D.19510>;
  <D.19509>:
  D.19508 = tables->st_virtual_address;
  D.19511 = tables->st_raw_data_size;
  D.19512 = D.19508 + D.19511;
  if (D.19512 > addr) goto <D.19513>; else goto <D.19514>;
  <D.19513>:
  D.19508 = tables->st_virtual_address;
  D.19516 = addr - D.19508;
  D.19517 = tables->st_raw_data_ptr;
  D.19515 = D.19516 + D.19517;
  return D.19515;
  <D.19514>:
  <D.19510>:
  tables = tables + 40;
  i = i + 1;
  <D.18875>:
  if (i < top) goto <D.18874>; else goto <D.18876>;
  <D.18876>:
  D.19515 = 4294967295;
  return D.19515;
}


mono_image_rva_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.19519;
  unsigned int D.19522;
  unsigned int D.19523;
  void * * D.19526;
  long unsigned int D.19527;
  long unsigned int D.19528;
  void * * D.19529;
  void * D.19530;
  int D.19533;
  char * D.19536;
  unsigned int D.19537;
  sizetype D.19538;
  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.18886>;
  <D.18885>:
  D.19519 = tables->st_virtual_address;
  if (D.19519 <= addr) goto <D.19520>; else goto <D.19521>;
  <D.19520>:
  D.19519 = tables->st_virtual_address;
  D.19522 = tables->st_raw_data_size;
  D.19523 = D.19519 + D.19522;
  if (D.19523 > addr) goto <D.19524>; else goto <D.19525>;
  <D.19524>:
  D.19526 = iinfo->cli_sections;
  D.19527 = (long unsigned int) i;
  D.19528 = D.19527 * 8;
  D.19529 = D.19526 + D.19528;
  D.19530 = *D.19529;
  if (D.19530 == 0B) goto <D.19531>; else goto <D.19532>;
  <D.19531>:
  D.19533 = mono_image_ensure_section_idx (image, i);
  if (D.19533 == 0) goto <D.19534>; else goto <D.19535>;
  <D.19534>:
  D.19536 = 0B;
  return D.19536;
  <D.19535>:
  <D.19532>:
  D.19526 = iinfo->cli_sections;
  D.19527 = (long unsigned int) i;
  D.19528 = D.19527 * 8;
  D.19529 = D.19526 + D.19528;
  D.19530 = *D.19529;
  D.19519 = tables->st_virtual_address;
  D.19537 = addr - D.19519;
  D.19538 = (sizetype) D.19537;
  D.19536 = D.19530 + D.19538;
  return D.19536;
  <D.19525>:
  <D.19521>:
  tables = tables + 40;
  i = i + 1;
  <D.18886>:
  if (i < top) goto <D.18885>; else goto <D.18887>;
  <D.18887>:
  D.19536 = 0B;
  return D.19536;
}


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

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


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

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


mono_image_ensure_section_idx (struct MonoImage * image, int section)
{
  int D.19550;
  int D.19553;
  void * * D.19554;
  long unsigned int D.19555;
  long unsigned int D.19556;
  void * * D.19557;
  void * D.19558;
  struct MonoSectionTable * D.19561;
  long unsigned int D.19562;
  unsigned int D.19563;
  int D.19564;
  unsigned int D.19565;
  unsigned int D.19566;
  unsigned int D.19567;
  unsigned int D.19568;
  char * D.19571;
  sizetype D.19572;
  void * D.19573;
  struct MonoCLIImageInfo * iinfo;
  struct MonoSectionTable * sect;
  gboolean writable;

  iinfo = image->image_info;
  D.19550 = iinfo->cli_section_count;
  if (D.19550 <= section) goto <D.19551>; else goto <D.19552>;
  <D.19551>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 237, "section < iinfo->cli_section_count");
  D.19553 = 0;
  return D.19553;
  <D.19552>:
  D.19554 = iinfo->cli_sections;
  D.19555 = (long unsigned int) section;
  D.19556 = D.19555 * 8;
  D.19557 = D.19554 + D.19556;
  D.19558 = *D.19557;
  if (D.19558 != 0B) goto <D.19559>; else goto <D.19560>;
  <D.19559>:
  D.19553 = 1;
  return D.19553;
  <D.19560>:
  D.19561 = iinfo->cli_section_tables;
  D.19555 = (long unsigned int) section;
  D.19562 = D.19555 * 40;
  sect = D.19561 + D.19562;
  D.19563 = sect->st_flags;
  D.19564 = (int) D.19563;
  writable = D.19564 & -2147483648;
  D.19565 = sect->st_raw_data_ptr;
  D.19566 = sect->st_raw_data_size;
  D.19567 = D.19565 + D.19566;
  D.19568 = image->raw_data_len;
  if (D.19567 > D.19568) goto <D.19569>; else goto <D.19570>;
  <D.19569>:
  D.19553 = 0;
  return D.19553;
  <D.19570>:
  D.19554 = iinfo->cli_sections;
  D.19555 = (long unsigned int) section;
  D.19556 = D.19555 * 8;
  D.19557 = D.19554 + D.19556;
  D.19571 = image->raw_data;
  D.19565 = sect->st_raw_data_ptr;
  D.19572 = (sizetype) D.19565;
  D.19573 = D.19571 + D.19572;
  *D.19557 = D.19573;
  D.19553 = 1;
  return D.19553;
}


mono_image_ensure_section (struct MonoImage * image, const char * section)
{
  struct MonoSectionTable * D.19575;
  long unsigned int D.19576;
  long unsigned int D.19577;
  struct MonoSectionTable * D.19578;
  char[8] * D.19579;
  int D.19580;
  int D.19583;
  int D.19584;
  struct MonoCLIImageInfo * ii;
  int i;

  ii = image->image_info;
  i = 0;
  goto <D.18923>;
  <D.18922>:
  D.19575 = ii->cli_section_tables;
  D.19576 = (long unsigned int) i;
  D.19577 = D.19576 * 40;
  D.19578 = D.19575 + D.19577;
  D.19579 = &D.19578->st_name;
  D.19580 = strncmp (D.19579, section, 8);
  if (D.19580 != 0) goto <D.19581>; else goto <D.19582>;
  <D.19581>:
  // predicted unlikely by continue predictor.
  goto <D.18921>;
  <D.19582>:
  D.19583 = mono_image_ensure_section_idx (image, i);
  return D.19583;
  <D.18921>:
  i = i + 1;
  <D.18923>:
  D.19584 = ii->cli_section_count;
  if (D.19584 > i) goto <D.18922>; else goto <D.18924>;
  <D.18924>:
  D.19583 = 0;
  return D.19583;
}


mono_image_check_for_module_cctor (struct MonoImage * image)
{
  long unsigned int D.19586;
  long unsigned int D.19587;
  <unnamed-unsigned:24> D.19590;
  int D.19591;
  int D.19051;
  int iftmp.10;
  int D.19050;
  const char[9] * D.19597;
  unsigned char D.19598;
  int D.19599;
  unsigned char D.19600;
  int D.19601;
  const unsigned char * D.19606;
  unsigned char D.19607;
  int D.19608;
  const unsigned char * D.19609;
  unsigned char D.19610;
  int D.19611;
  const unsigned char * D.19616;
  unsigned char D.19617;
  int D.19618;
  const unsigned char * D.19619;
  unsigned char D.19620;
  int D.19621;
  const unsigned char * D.19626;
  unsigned char D.19627;
  int D.19628;
  const unsigned char * D.19629;
  unsigned char D.19630;
  int D.19631;
  unsigned int D.19635;
  unsigned int D.19638;
  <unnamed-unsigned:24> D.19640;
  int first_method.11;
  int D.19062;
  int iftmp.12;
  int D.19061;
  const char[7] * D.19645;
  unsigned char D.19646;
  int D.19647;
  unsigned char D.19648;
  int D.19649;
  const unsigned char * D.19654;
  unsigned char D.19655;
  int D.19656;
  const unsigned char * D.19657;
  unsigned char D.19658;
  int D.19659;
  const unsigned char * D.19664;
  unsigned char D.19665;
  int D.19666;
  const unsigned char * D.19667;
  unsigned char D.19668;
  int D.19669;
  const unsigned char * D.19674;
  unsigned char D.19675;
  int D.19676;
  const unsigned char * D.19677;
  unsigned char D.19678;
  int D.19679;
  struct MonoTableInfo * t;
  struct MonoTableInfo * mt;

  t = &image->tables[2];
  mt = &image->tables[6];
  D.19586 = BIT_FIELD_REF <*image, 64, 192>;
  D.19587 = D.19586 & 34359738368;
  if (D.19587 != 0) goto <D.19588>; else goto <D.19589>;
  <D.19588>:
  image->checked_module_cctor = 1;
  return;
  <D.19589>:
  D.19590 = t->rows;
  D.19591 = (int) D.19590;
  if (D.19591 > 0) goto <D.19592>; else goto <D.19593>;
  <D.19592>:
  {
    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.19595>; else goto <D.19596>;
      <D.19595>:
      {
        const unsigned char * __s2;
        int __result;

        __s2 = name;
        D.19597 = "<Module>";
        D.19598 = MEM[(const unsigned char *)D.19597];
        D.19599 = (int) D.19598;
        D.19600 = *__s2;
        D.19601 = (int) D.19600;
        __result = D.19599 - D.19601;
        {
          if (__s2_len != 0) goto <D.19602>; else goto <D.19603>;
          <D.19602>:
          if (__result == 0) goto <D.19604>; else goto <D.19605>;
          <D.19604>:
          D.19606 = &MEM[(void *)"<Module>" + 1B];
          D.19607 = *D.19606;
          D.19608 = (int) D.19607;
          D.19609 = __s2 + 1;
          D.19610 = *D.19609;
          D.19611 = (int) D.19610;
          __result = D.19608 - D.19611;
          if (__s2_len > 1) goto <D.19612>; else goto <D.19613>;
          <D.19612>:
          if (__result == 0) goto <D.19614>; else goto <D.19615>;
          <D.19614>:
          D.19616 = &MEM[(void *)"<Module>" + 2B];
          D.19617 = *D.19616;
          D.19618 = (int) D.19617;
          D.19619 = __s2 + 2;
          D.19620 = *D.19619;
          D.19621 = (int) D.19620;
          __result = D.19618 - D.19621;
          if (__s2_len > 2) goto <D.19622>; else goto <D.19623>;
          <D.19622>:
          if (__result == 0) goto <D.19624>; else goto <D.19625>;
          <D.19624>:
          D.19626 = &MEM[(void *)"<Module>" + 3B];
          D.19627 = *D.19626;
          D.19628 = (int) D.19627;
          D.19629 = __s2 + 3;
          D.19630 = *D.19629;
          D.19631 = (int) D.19630;
          __result = D.19628 - D.19631;
          <D.19625>:
          <D.19623>:
          <D.19615>:
          <D.19613>:
          <D.19605>:
          <D.19603>:
        }
        D.19050 = __result;
      }
      iftmp.10 = -D.19050;
      goto <D.19632>;
      <D.19596>:
      iftmp.10 = __builtin_strcmp (name, "<Module>");
      <D.19632>:
      D.19051 = iftmp.10;
    }
    if (D.19051 == 0) goto <D.19633>; else goto <D.19634>;
    <D.19633>:
    {
      guint32 first_method;
      guint32 last_method;

      D.19635 = mono_metadata_decode_row_col (t, 0, 5);
      first_method = D.19635 + 4294967295;
      D.19590 = t->rows;
      D.19591 = (int) D.19590;
      if (D.19591 > 1) goto <D.19636>; else goto <D.19637>;
      <D.19636>:
      D.19638 = mono_metadata_decode_row_col (t, 1, 5);
      last_method = D.19638 + 4294967295;
      goto <D.19639>;
      <D.19637>:
      D.19640 = mt->rows;
      last_method = (guint32) D.19640;
      <D.19639>:
      goto <D.19064>;
      <D.19063>:
      first_method.11 = (int) first_method;
      nameidx = mono_metadata_decode_row_col (mt, first_method.11, 3);
      name = mono_metadata_string_heap (image, nameidx);
      {
        size_t __s1_len;
        size_t __s2_len;

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

          __s2 = name;
          D.19645 = ".cctor";
          D.19646 = MEM[(const unsigned char *)D.19645];
          D.19647 = (int) D.19646;
          D.19648 = *__s2;
          D.19649 = (int) D.19648;
          __result = D.19647 - D.19649;
          {
            if (__s2_len != 0) goto <D.19650>; else goto <D.19651>;
            <D.19650>:
            if (__result == 0) goto <D.19652>; else goto <D.19653>;
            <D.19652>:
            D.19654 = &MEM[(void *)".cctor" + 1B];
            D.19655 = *D.19654;
            D.19656 = (int) D.19655;
            D.19657 = __s2 + 1;
            D.19658 = *D.19657;
            D.19659 = (int) D.19658;
            __result = D.19656 - D.19659;
            if (__s2_len > 1) goto <D.19660>; else goto <D.19661>;
            <D.19660>:
            if (__result == 0) goto <D.19662>; else goto <D.19663>;
            <D.19662>:
            D.19664 = &MEM[(void *)".cctor" + 2B];
            D.19665 = *D.19664;
            D.19666 = (int) D.19665;
            D.19667 = __s2 + 2;
            D.19668 = *D.19667;
            D.19669 = (int) D.19668;
            __result = D.19666 - D.19669;
            if (__s2_len > 2) goto <D.19670>; else goto <D.19671>;
            <D.19670>:
            if (__result == 0) goto <D.19672>; else goto <D.19673>;
            <D.19672>:
            D.19674 = &MEM[(void *)".cctor" + 3B];
            D.19675 = *D.19674;
            D.19676 = (int) D.19675;
            D.19677 = __s2 + 3;
            D.19678 = *D.19677;
            D.19679 = (int) D.19678;
            __result = D.19676 - D.19679;
            <D.19673>:
            <D.19671>:
            <D.19663>:
            <D.19661>:
            <D.19653>:
            <D.19651>:
          }
          D.19061 = __result;
        }
        iftmp.12 = -D.19061;
        goto <D.19680>;
        <D.19644>:
        iftmp.12 = __builtin_strcmp (name, ".cctor");
        <D.19680>:
        D.19062 = iftmp.12;
      }
      if (D.19062 == 0) goto <D.19681>; else goto <D.19682>;
      <D.19681>:
      image->has_module_cctor = 1;
      image->checked_module_cctor = 1;
      return;
      <D.19682>:
      first_method = first_method + 1;
      <D.19064>:
      if (first_method < last_method) goto <D.19063>; else goto <D.19065>;
      <D.19065>:
    }
    <D.19634>:
  }
  <D.19593>:
  image->has_module_cctor = 0;
  image->checked_module_cctor = 1;
}


mono_image_load_module (struct MonoImage * image, int idx)
{
  <unnamed-unsigned:1> D.19684;
  unsigned int D.19687;
  unsigned int idx.13;
  struct MonoImage * D.19691;
  gboolean * D.19692;
  long unsigned int D.19693;
  long unsigned int D.19694;
  sizetype D.19695;
  gboolean * D.19696;
  int D.19697;
  struct MonoImage * * D.19700;
  long unsigned int D.19701;
  sizetype D.19702;
  struct MonoImage * * D.19703;
  unsigned int D.19704;
  unsigned int D.19707;
  const char * D.19708;
  <unnamed-unsigned:24> D.19709;
  int D.19710;
  char * D.19711;
  long unsigned int D.19712;
  long unsigned int D.19713;
  _Bool D.19714;
  int D.19715;
  unsigned int D.19716;
  int D.19099;
  void * D.19717;
  struct MonoImage * D.19722;
  struct MonoImage * D.19723;
  struct MonoAssembly * D.19726;
  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.19684 = image->ref_only;
      refonly = (gboolean) D.19684;
      valid_modules = 0B;
      D.19687 = image->module_count;
      if (D.19687 == 0) goto <D.19685>; else goto <D.19688>;
      <D.19688>:
      idx.13 = (unsigned int) idx;
      D.19687 = image->module_count;
      if (idx.13 > D.19687) goto <D.19685>; else goto <D.19690>;
      <D.19690>:
      if (idx <= 0) goto <D.19685>; else goto <D.19686>;
      <D.19685>:
      D.19691 = 0B;
      return D.19691;
      <D.19686>:
      D.19692 = image->modules_loaded;
      D.19693 = (long unsigned int) idx;
      D.19694 = D.19693 * 4;
      D.19695 = D.19694 + 18446744073709551612;
      D.19696 = D.19692 + D.19695;
      D.19697 = *D.19696;
      if (D.19697 != 0) goto <D.19698>; else goto <D.19699>;
      <D.19698>:
      D.19700 = image->modules;
      D.19693 = (long unsigned int) idx;
      D.19701 = D.19693 * 8;
      D.19702 = D.19701 + 18446744073709551608;
      D.19703 = D.19700 + D.19702;
      D.19691 = *D.19703;
      return D.19691;
      <D.19699>:
      file_table = &image->tables[38];
      i = 0;
      goto <D.19085>;
      <D.19084>:
      {
        guint32 cols[3];

        try
          {
            mono_metadata_decode_row (file_table, i, &cols, 3);
            D.19704 = cols[0];
            if (D.19704 == 1) goto <D.19705>; else goto <D.19706>;
            <D.19705>:
            // predicted unlikely by continue predictor.
            goto <D.19083>;
            <D.19706>:
            D.19707 = cols[1];
            D.19708 = mono_metadata_string_heap (image, D.19707);
            valid_modules = monoeg_g_list_prepend (valid_modules, D.19708);
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      <D.19083>:
      i = i + 1;
      <D.19085>:
      D.19709 = file_table->rows;
      D.19710 = (int) D.19709;
      if (D.19710 > i) goto <D.19084>; else goto <D.19086>;
      <D.19086>:
      t = &image->tables[26];
      D.19711 = image->name;
      base_dir = monoeg_g_path_get_dirname (D.19711);
      {
        char * module_ref;
        const char * name;
        guint32 cols[1];
        int valid;

        try
          {
            D.19712 = BIT_FIELD_REF <*file_table, 64, 64>;
            D.19713 = D.19712 & 16777215;
            D.19714 = D.19713 == 0;
            valid = (int) D.19714;
            D.19715 = idx + -1;
            mono_metadata_decode_row (t, D.19715, &cols, 1);
            D.19716 = cols[0];
            name = mono_metadata_string_heap (image, D.19716);
            list_iter = valid_modules;
            goto <D.19102>;
            <D.19101>:
            {
              size_t __s1_len;
              size_t __s2_len;

              D.19717 = list_iter->data;
              D.19099 = __builtin_strcmp (D.19717, name);
            }
            if (D.19099 == 0) goto <D.19718>; else goto <D.19719>;
            <D.19718>:
            valid = 1;
            goto <D.19100>;
            <D.19719>:
            list_iter = list_iter->next;
            <D.19102>:
            if (list_iter != 0B) goto <D.19101>; else goto <D.19100>;
            <D.19100>:
            if (valid != 0) goto <D.19720>; else goto <D.19721>;
            <D.19720>:
            module_ref = monoeg_g_build_path ("/", base_dir, name, 0B);
            D.19700 = image->modules;
            D.19693 = (long unsigned int) idx;
            D.19701 = D.19693 * 8;
            D.19702 = D.19701 + 18446744073709551608;
            D.19703 = D.19700 + D.19702;
            D.19722 = mono_image_open_full (module_ref, &status, refonly);
            *D.19703 = D.19722;
            D.19700 = image->modules;
            D.19693 = (long unsigned int) idx;
            D.19701 = D.19693 * 8;
            D.19702 = D.19701 + 18446744073709551608;
            D.19703 = D.19700 + D.19702;
            D.19723 = *D.19703;
            if (D.19723 != 0B) goto <D.19724>; else goto <D.19725>;
            <D.19724>:
            D.19700 = image->modules;
            D.19693 = (long unsigned int) idx;
            D.19701 = D.19693 * 8;
            D.19702 = D.19701 + 18446744073709551608;
            D.19703 = D.19700 + D.19702;
            D.19723 = *D.19703;
            mono_image_addref (D.19723);
            D.19700 = image->modules;
            D.19693 = (long unsigned int) idx;
            D.19701 = D.19693 * 8;
            D.19702 = D.19701 + 18446744073709551608;
            D.19703 = D.19700 + D.19702;
            D.19723 = *D.19703;
            D.19726 = image->assembly;
            D.19723->assembly = D.19726;
            <D.19725>:
            monoeg_g_free (module_ref);
            <D.19721>:
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      D.19692 = image->modules_loaded;
      D.19693 = (long unsigned int) idx;
      D.19694 = D.19693 * 4;
      D.19695 = D.19694 + 18446744073709551612;
      D.19696 = D.19692 + D.19695;
      *D.19696 = 1;
      monoeg_g_free (base_dir);
      monoeg_g_list_free (valid_modules);
      D.19700 = image->modules;
      D.19693 = (long unsigned int) idx;
      D.19701 = D.19693 * 8;
      D.19702 = D.19701 + 18446744073709551608;
      D.19703 = D.19700 + D.19702;
      D.19691 = *D.19703;
      return D.19691;
    }
  finally
    {
      status = {CLOBBER};
    }
}


mono_image_init (struct MonoImage * image)
{
  struct MonoMemPool * D.19731;
  struct MonoInternalHashTable * D.19732;
  struct GHashTable * D.19733;
  struct GHashTable * D.19734;
  struct GHashTable * D.19735;
  struct GHashTable * D.19736;
  struct GHashTable * D.19737;
  struct MonoPropertyHash * D.19738;
  struct CRITICAL_SECTION * D.19739;
  struct CRITICAL_SECTION * D.19740;

  D.19731 = mono_mempool_new_size (512);
  image->mempool = D.19731;
  D.19732 = &image->class_cache;
  mono_internal_hash_table_init (D.19732, monoeg_g_direct_hash, class_key_extract, class_next_value);
  D.19733 = monoeg_g_hash_table_new (0B, 0B);
  image->field_cache = D.19733;
  D.19734 = monoeg_g_hash_table_new (0B, 0B);
  image->typespec_cache = D.19734;
  D.19735 = monoeg_g_hash_table_new (0B, 0B);
  image->memberref_signatures = D.19735;
  D.19736 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  image->helper_signatures = D.19736;
  D.19737 = monoeg_g_hash_table_new (0B, 0B);
  image->method_signatures = D.19737;
  D.19738 = mono_property_hash_new ();
  image->property_hash = D.19738;
  D.19739 = &image->lock;
  InitializeCriticalSection (D.19739);
  D.19740 = &image->szarray_cache_lock;
  InitializeCriticalSection (D.19740);
}


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

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


class_key_extract (void * value)
{
  void * D.19743;
  unsigned int D.19744;
  long unsigned int D.19745;
  struct MonoClass * class;

  class = value;
  D.19744 = class->type_token;
  D.19745 = (long unsigned int) D.19744;
  D.19743 = (void *) D.19745;
  return D.19743;
}


mono_image_load_pe_data (struct MonoImage * image)
{
  long unsigned int D.19747;
  long unsigned int D.19748;
  unsigned int D.19749;
  long unsigned int D.19750;
  char * D.19752;
  sizetype D.19753;
  char * D.19754;
  unsigned int D.19755;
  unsigned int D.19756;
  unsigned int D.19758;
  unsigned int offset.14;
  int D.19761;
  gboolean D.19763;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoMSDOSHeader msdos;
  gint32 offset;
  void invalid_image = <<< error >>>;

  try
    {
      offset = 0;
      iinfo = image->image_info;
      header = &iinfo->cli_header;
      D.19747 = (long unsigned int) offset;
      D.19748 = D.19747 + 128;
      D.19749 = image->raw_data_len;
      D.19750 = (long unsigned int) D.19749;
      if (D.19748 > D.19750) goto invalid_image; else goto <D.19751>;
      <D.19751>:
      D.19752 = image->raw_data;
      D.19753 = (sizetype) offset;
      D.19754 = D.19752 + D.19753;
      memcpy (&msdos, D.19754, 128);
      D.19755 = BIT_FIELD_REF <msdos, 32, 0>;
      D.19756 = D.19755 & 65535;
      if (D.19756 != 23117) goto invalid_image; else goto <D.19757>;
      <D.19757>:
      D.19758 = msdos.pe_offset;
      msdos.pe_offset = D.19758;
      D.19758 = msdos.pe_offset;
      offset = (gint32) D.19758;
      offset = do_load_header (image, header, offset);
      if (offset < 0) goto invalid_image; else goto <D.19759>;
      <D.19759>:
      offset.14 = (unsigned int) offset;
      D.19761 = load_section_tables (image, iinfo, offset.14);
      if (D.19761 == 0) goto invalid_image; else goto <D.19762>;
      <D.19762>:
      D.19763 = 1;
      return D.19763;
      invalid_image:
      D.19763 = 0;
      return D.19763;
    }
  finally
    {
      msdos = {CLOBBER};
    }
}


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

  D.19767 = __builtin_object_size (__dest, 0);
  D.19766 = __builtin___memcpy_chk (__dest, __src, __len, D.19767);
  return D.19766;
}


do_load_header (struct MonoImage * image, struct MonoDotNetHeader * header, int offset)
{
  long unsigned int D.19769;
  long unsigned int D.19770;
  unsigned int D.19771;
  long unsigned int D.19772;
  int D.19775;
  char * D.19776;
  sizetype D.19777;
  char * D.19778;
  unsigned int D.19779;
  unsigned int D.19780;
  short unsigned int D.19783;
  unsigned int offset.15;
  unsigned int D.19787;
  short unsigned int D.19788;
  unsigned int D.19796;
  long unsigned int D.19797;
  unsigned int D.19798;
  long unsigned int D.19799;
  unsigned int D.19800;
  long unsigned int D.19801;
  unsigned int D.19802;
  long unsigned int D.19803;
  unsigned int D.19804;
  long unsigned int D.19805;
  unsigned int D.19806;
  unsigned int D.19807;
  unsigned int D.19808;
  short unsigned int D.19809;
  short unsigned int D.19810;
  short unsigned int D.19811;
  short unsigned int D.19812;
  short unsigned int D.19813;
  short unsigned int D.19814;
  unsigned int D.19815;
  unsigned int D.19816;
  unsigned int D.19817;
  unsigned int D.19818;
  short unsigned int D.19819;
  short unsigned int D.19820;
  unsigned int D.19821;
  unsigned int D.19822;
  struct MonoPEDatadir * D.19823;
  struct MonoDotNetHeader64 header64;

  try
    {
      D.19769 = (long unsigned int) offset;
      D.19770 = D.19769 + 248;
      D.19771 = image->raw_data_len;
      D.19772 = (long unsigned int) D.19771;
      if (D.19770 > D.19772) goto <D.19773>; else goto <D.19774>;
      <D.19773>:
      D.19775 = -1;
      return D.19775;
      <D.19774>:
      D.19776 = image->raw_data;
      D.19777 = (sizetype) offset;
      D.19778 = D.19776 + D.19777;
      memcpy (header, D.19778, 248);
      D.19779 = BIT_FIELD_REF <*header, 32, 0>;
      D.19780 = D.19779 & 65535;
      if (D.19780 != 17744) goto <D.19781>; else goto <D.19782>;
      <D.19781>:
      D.19775 = -1;
      return D.19775;
      <D.19782>:
      D.19783 = header->pe.pe_magic;
      if (D.19783 == 267) goto <D.19784>; else goto <D.19785>;
      <D.19784>:
      offset.15 = (unsigned int) offset;
      D.19787 = offset.15 + 248;
      offset = (int) D.19787;
      D.19788 = header->coff.coff_opt_header_size;
      if (D.19788 != 224) goto <D.19789>; else goto <D.19790>;
      <D.19789>:
      D.19775 = -1;
      return D.19775;
      <D.19790>:
      goto <D.19791>;
      <D.19785>:
      D.19783 = header->pe.pe_magic;
      if (D.19783 == 523) goto <D.19792>; else goto <D.19793>;
      <D.19792>:
      D.19788 = header->coff.coff_opt_header_size;
      if (D.19788 != 240) goto <D.19794>; else goto <D.19795>;
      <D.19794>:
      D.19775 = -1;
      return D.19775;
      <D.19795>:
      D.19776 = image->raw_data;
      D.19777 = (sizetype) offset;
      D.19778 = D.19776 + D.19777;
      memcpy (&header64, D.19778, 264);
      offset.15 = (unsigned int) offset;
      D.19796 = offset.15 + 264;
      offset = (int) D.19796;
      memcpy (&header64, header, 244);
      D.19797 = header64.nt.pe_image_base;
      D.19798 = (unsigned int) D.19797;
      header->nt.pe_image_base = D.19798;
      D.19799 = header64.nt.pe_stack_reserve;
      D.19800 = (unsigned int) D.19799;
      header->nt.pe_stack_reserve = D.19800;
      D.19801 = header64.nt.pe_stack_commit;
      D.19802 = (unsigned int) D.19801;
      header->nt.pe_stack_commit = D.19802;
      D.19803 = header64.nt.pe_heap_reserve;
      D.19804 = (unsigned int) D.19803;
      header->nt.pe_heap_reserve = D.19804;
      D.19805 = header64.nt.pe_heap_commit;
      D.19806 = (unsigned int) D.19805;
      header->nt.pe_heap_commit = D.19806;
      D.19807 = header64.nt.pe_section_align;
      header->nt.pe_section_align = D.19807;
      D.19808 = header64.nt.pe_file_alignment;
      header->nt.pe_file_alignment = D.19808;
      D.19809 = header64.nt.pe_os_major;
      header->nt.pe_os_major = D.19809;
      D.19810 = header64.nt.pe_os_minor;
      header->nt.pe_os_minor = D.19810;
      D.19811 = header64.nt.pe_user_major;
      header->nt.pe_user_major = D.19811;
      D.19812 = header64.nt.pe_user_minor;
      header->nt.pe_user_minor = D.19812;
      D.19813 = header64.nt.pe_subsys_major;
      header->nt.pe_subsys_major = D.19813;
      D.19814 = header64.nt.pe_subsys_minor;
      header->nt.pe_subsys_minor = D.19814;
      D.19815 = header64.nt.pe_reserved_1;
      header->nt.pe_reserved_1 = D.19815;
      D.19816 = header64.nt.pe_image_size;
      header->nt.pe_image_size = D.19816;
      D.19817 = header64.nt.pe_header_size;
      header->nt.pe_header_size = D.19817;
      D.19818 = header64.nt.pe_checksum;
      header->nt.pe_checksum = D.19818;
      D.19819 = header64.nt.pe_subsys_required;
      header->nt.pe_subsys_required = D.19819;
      D.19820 = header64.nt.pe_dll_flags;
      header->nt.pe_dll_flags = D.19820;
      D.19821 = header64.nt.pe_loader_flags;
      header->nt.pe_loader_flags = D.19821;
      D.19822 = header64.nt.pe_data_dir_count;
      header->nt.pe_data_dir_count = D.19822;
      D.19823 = &header->datadir;
      memcpy (D.19823, &header64.datadir, 128);
      goto <D.19824>;
      <D.19793>:
      D.19775 = -1;
      return D.19775;
      <D.19824>:
      <D.19791>:
      D.19775 = offset;
      return D.19775;
    }
  finally
    {
      header64 = {CLOBBER};
    }
}


load_section_tables (struct MonoImage * image, struct MonoCLIImageInfo * iinfo, guint32 offset)
{
  short unsigned int D.19827;
  long unsigned int D.19828;
  long unsigned int D.19829;
  void * D.19830;
  long unsigned int D.19831;
  void * D.19832;
  struct MonoSectionTable * D.19833;
  long unsigned int D.19834;
  long unsigned int D.19835;
  long unsigned int D.19836;
  long unsigned int D.19837;
  unsigned int D.19838;
  long unsigned int D.19839;
  int D.19842;
  char * D.19843;
  sizetype D.19844;
  char * D.19845;
  const int top;
  int i;

  D.19827 = iinfo->cli_header.coff.coff_sections;
  top = (const int) D.19827;
  iinfo->cli_section_count = top;
  D.19828 = (long unsigned int) top;
  D.19829 = D.19828 * 40;
  D.19830 = monoeg_malloc0 (D.19829);
  iinfo->cli_section_tables = D.19830;
  D.19828 = (long unsigned int) top;
  D.19831 = D.19828 * 8;
  D.19832 = monoeg_malloc0 (D.19831);
  iinfo->cli_sections = D.19832;
  i = 0;
  goto <D.18934>;
  <D.18933>:
  {
    struct MonoSectionTable * t;

    D.19833 = iinfo->cli_section_tables;
    D.19834 = (long unsigned int) i;
    D.19835 = D.19834 * 40;
    t = D.19833 + D.19835;
    D.19836 = (long unsigned int) offset;
    D.19837 = D.19836 + 40;
    D.19838 = image->raw_data_len;
    D.19839 = (long unsigned int) D.19838;
    if (D.19837 > D.19839) goto <D.19840>; else goto <D.19841>;
    <D.19840>:
    D.19842 = 0;
    return D.19842;
    <D.19841>:
    D.19843 = image->raw_data;
    D.19844 = (sizetype) offset;
    D.19845 = D.19843 + D.19844;
    memcpy (t, D.19845, 40);
    offset = offset + 40;
  }
  i = i + 1;
  <D.18934>:
  if (i < top) goto <D.18933>; else goto <D.18935>;
  <D.18935>:
  D.19842 = 1;
  return D.19842;
}


mono_image_load_cli_data (struct MonoImage * image)
{
  int D.19847;
  gboolean D.19850;
  int D.19851;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  D.19847 = load_cli_header (image, iinfo);
  if (D.19847 == 0) goto <D.19848>; else goto <D.19849>;
  <D.19848>:
  D.19850 = 0;
  return D.19850;
  <D.19849>:
  D.19851 = load_metadata (image, iinfo);
  if (D.19851 == 0) goto <D.19852>; else goto <D.19853>;
  <D.19852>:
  D.19850 = 0;
  return D.19850;
  <D.19853>:
  D.19850 = 1;
  return D.19850;
}


load_cli_header (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.19855;
  gboolean D.19858;
  long unsigned int D.19859;
  long unsigned int D.19860;
  unsigned int D.19861;
  long unsigned int D.19862;
  struct MonoCLIHeader * D.19865;
  char * D.19866;
  sizetype D.19867;
  char * D.19868;
  unsigned int D.19869;
  unsigned int D.19872;
  unsigned int D.19875;
  unsigned int D.19878;
  unsigned int D.19881;
  unsigned int D.19884;
  unsigned int D.19887;
  unsigned int D.19890;
  unsigned int D.19893;
  guint32 offset;

  D.19855 = iinfo->cli_header.datadir.pe_cli_header.rva;
  offset = mono_cli_rva_image_map (image, D.19855);
  if (offset == 4294967295) goto <D.19856>; else goto <D.19857>;
  <D.19856>:
  D.19858 = 0;
  return D.19858;
  <D.19857>:
  D.19859 = (long unsigned int) offset;
  D.19860 = D.19859 + 136;
  D.19861 = image->raw_data_len;
  D.19862 = (long unsigned int) D.19861;
  if (D.19860 > D.19862) goto <D.19863>; else goto <D.19864>;
  <D.19863>:
  D.19858 = 0;
  return D.19858;
  <D.19864>:
  D.19865 = &iinfo->cli_cli_header;
  D.19866 = image->raw_data;
  D.19867 = (sizetype) offset;
  D.19868 = D.19866 + D.19867;
  memcpy (D.19865, D.19868, 136);
  D.19869 = iinfo->cli_cli_header.ch_eeinfo_table.rva;
  if (D.19869 != 0) goto <D.19870>; else goto <D.19871>;
  <D.19871>:
  D.19872 = iinfo->cli_cli_header.ch_helper_table.rva;
  if (D.19872 != 0) goto <D.19873>; else goto <D.19874>;
  <D.19874>:
  D.19875 = iinfo->cli_cli_header.ch_dynamic_info.rva;
  if (D.19875 != 0) goto <D.19876>; else goto <D.19877>;
  <D.19877>:
  D.19878 = iinfo->cli_cli_header.ch_delay_load_info.rva;
  if (D.19878 != 0) goto <D.19879>; else goto <D.19880>;
  <D.19880>:
  D.19881 = iinfo->cli_cli_header.ch_module_image.rva;
  if (D.19881 != 0) goto <D.19882>; else goto <D.19883>;
  <D.19883>:
  D.19884 = iinfo->cli_cli_header.ch_external_fixups.rva;
  if (D.19884 != 0) goto <D.19885>; else goto <D.19886>;
  <D.19886>:
  D.19887 = iinfo->cli_cli_header.ch_ridmap.rva;
  if (D.19887 != 0) goto <D.19888>; else goto <D.19889>;
  <D.19889>:
  D.19890 = iinfo->cli_cli_header.ch_debug_map.rva;
  if (D.19890 != 0) goto <D.19891>; else goto <D.19892>;
  <D.19892>:
  D.19893 = iinfo->cli_cli_header.ch_ip_map.rva;
  if (D.19893 != 0) goto <D.19894>; else goto <D.19895>;
  <D.19894>:
  <D.19895>:
  <D.19891>:
  <D.19888>:
  <D.19885>:
  <D.19882>:
  <D.19879>:
  <D.19876>:
  <D.19873>:
  <D.19870>:
  D.19858 = 1;
  return D.19858;
}


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

  D.19897 = load_metadata_ptrs (image, iinfo);
  if (D.19897 == 0) goto <D.19898>; else goto <D.19899>;
  <D.19898>:
  D.19900 = 0;
  return D.19900;
  <D.19899>:
  D.19900 = load_tables (image);
  return D.19900;
}


load_metadata_ptrs (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.19902;
  gboolean D.19905;
  unsigned int D.19906;
  unsigned int D.19907;
  char * D.19910;
  sizetype D.19911;
  char * D.19912;
  int D.19913;
  short unsigned int D.19916;
  short int D.19917;
  long unsigned int D.19918;
  gchar * D.19919;
  sizetype D.19920;
  long int ptr.16;
  char * D.19922;
  long int D.19923;
  long int D.19924;
  unsigned int D.19925;
  unsigned int D.19928;
  sizetype D.19929;
  int D.18969;
  int iftmp.17;
  int D.18968;
  const char[3] * D.19934;
  unsigned char D.19935;
  int D.19936;
  unsigned char D.19937;
  int D.19938;
  const unsigned char * D.19943;
  unsigned char D.19944;
  int D.19945;
  const unsigned char * D.19946;
  unsigned char D.19947;
  int D.19948;
  const unsigned char * D.19953;
  unsigned char D.19954;
  int D.19955;
  const unsigned char * D.19956;
  unsigned char D.19957;
  int D.19958;
  const unsigned char * D.19963;
  unsigned char D.19964;
  int D.19965;
  const unsigned char * D.19966;
  unsigned char D.19967;
  int D.19968;
  const char * D.19970;
  unsigned int D.19973;
  sizetype D.19974;
  const char * D.19975;
  unsigned int D.19976;
  int D.18978;
  int iftmp.18;
  int D.18977;
  const char[9] * D.19981;
  unsigned char D.19982;
  int D.19983;
  unsigned char D.19984;
  int D.19985;
  const unsigned char * D.19990;
  unsigned char D.19991;
  int D.19992;
  const unsigned char * D.19993;
  unsigned char D.19994;
  int D.19995;
  const unsigned char * D.20000;
  unsigned char D.20001;
  int D.20002;
  const unsigned char * D.20003;
  unsigned char D.20004;
  int D.20005;
  const unsigned char * D.20010;
  unsigned char D.20011;
  int D.20012;
  const unsigned char * D.20013;
  unsigned char D.20014;
  int D.20015;
  int D.18987;
  int iftmp.19;
  int D.18986;
  const char[4] * D.20023;
  unsigned char D.20024;
  int D.20025;
  unsigned char D.20026;
  int D.20027;
  const unsigned char * D.20032;
  unsigned char D.20033;
  int D.20034;
  const unsigned char * D.20035;
  unsigned char D.20036;
  int D.20037;
  const unsigned char * D.20042;
  unsigned char D.20043;
  int D.20044;
  const unsigned char * D.20045;
  unsigned char D.20046;
  int D.20047;
  const unsigned char * D.20052;
  unsigned char D.20053;
  int D.20054;
  const unsigned char * D.20055;
  unsigned char D.20056;
  int D.20057;
  int D.18996;
  int iftmp.20;
  int D.18995;
  const char[6] * D.20065;
  unsigned char D.20066;
  int D.20067;
  unsigned char D.20068;
  int D.20069;
  const unsigned char * D.20074;
  unsigned char D.20075;
  int D.20076;
  const unsigned char * D.20077;
  unsigned char D.20078;
  int D.20079;
  const unsigned char * D.20084;
  unsigned char D.20085;
  int D.20086;
  const unsigned char * D.20087;
  unsigned char D.20088;
  int D.20089;
  const unsigned char * D.20094;
  unsigned char D.20095;
  int D.20096;
  const unsigned char * D.20097;
  unsigned char D.20098;
  int D.20099;
  int D.19005;
  int iftmp.21;
  int D.19004;
  const char[6] * D.20107;
  unsigned char D.20108;
  int D.20109;
  unsigned char D.20110;
  int D.20111;
  const unsigned char * D.20116;
  unsigned char D.20117;
  int D.20118;
  const unsigned char * D.20119;
  unsigned char D.20120;
  int D.20121;
  const unsigned char * D.20126;
  unsigned char D.20127;
  int D.20128;
  const unsigned char * D.20129;
  unsigned char D.20130;
  int D.20131;
  const unsigned char * D.20136;
  unsigned char D.20137;
  int D.20138;
  const unsigned char * D.20139;
  unsigned char D.20140;
  int D.20141;
  int D.19014;
  int iftmp.22;
  int D.19013;
  const char[3] * D.20149;
  unsigned char D.20150;
  int D.20151;
  unsigned char D.20152;
  int D.20153;
  const unsigned char * D.20158;
  unsigned char D.20159;
  int D.20160;
  const unsigned char * D.20161;
  unsigned char D.20162;
  int D.20163;
  const unsigned char * D.20168;
  unsigned char D.20169;
  int D.20170;
  const unsigned char * D.20171;
  unsigned char D.20172;
  int D.20173;
  const unsigned char * D.20178;
  unsigned char D.20179;
  int D.20180;
  const unsigned char * D.20181;
  unsigned char D.20182;
  int D.20183;
  char * D.20187;
  char * D.20189;
  long unsigned int D.20190;
  sizetype D.20191;
  int D.20194;
  const char * D.20195;
  _Bool D.20196;
  long int D.20197;
  long int D.20198;
  unsigned int D.20201;
  _Bool D.20202;
  long int D.20203;
  long int D.20204;
  char * D.20207;
  guint32 offset;
  guint32 size;
  guint16 streams;
  int i;
  guint32 pad;
  char * ptr;

  D.19902 = iinfo->cli_cli_header.ch_metadata.rva;
  offset = mono_cli_rva_image_map (image, D.19902);
  if (offset == 4294967295) goto <D.19903>; else goto <D.19904>;
  <D.19903>:
  D.19905 = 0;
  return D.19905;
  <D.19904>:
  size = iinfo->cli_cli_header.ch_metadata.size;
  D.19906 = offset + size;
  D.19907 = image->raw_data_len;
  if (D.19906 > D.19907) goto <D.19908>; else goto <D.19909>;
  <D.19908>:
  D.19905 = 0;
  return D.19905;
  <D.19909>:
  D.19910 = image->raw_data;
  D.19911 = (sizetype) offset;
  D.19912 = D.19910 + D.19911;
  image->raw_metadata = D.19912;
  ptr = image->raw_metadata;
  D.19913 = strncmp (ptr, "BSJB", 4);
  if (D.19913 == 0) goto <D.19914>; else goto <D.19915>;
  <D.19914>:
  {
    guint32 version_string_len;

    ptr = ptr + 4;
    D.19916 = MEM[(const guint16 *)ptr];
    D.19917 = (short int) D.19916;
    image->md_version_major = D.19917;
    ptr = ptr + 2;
    D.19916 = MEM[(const guint16 *)ptr];
    D.19917 = (short int) D.19916;
    image->md_version_minor = D.19917;
    ptr = ptr + 6;
    version_string_len = MEM[(const guint32 *)ptr];
    ptr = ptr + 4;
    D.19918 = (long unsigned int) version_string_len;
    D.19919 = monoeg_g_strndup (ptr, D.19918);
    image->version = D.19919;
    D.19920 = (sizetype) version_string_len;
    ptr = ptr + D.19920;
    ptr.16 = (long int) ptr;
    D.19922 = image->raw_metadata;
    D.19923 = (long int) D.19922;
    D.19924 = ptr.16 - D.19923;
    pad = (guint32) D.19924;
    D.19925 = pad & 3;
    if (D.19925 != 0) goto <D.19926>; else goto <D.19927>;
    <D.19926>:
    D.19925 = pad & 3;
    D.19928 = 4 - D.19925;
    D.19929 = (sizetype) D.19928;
    ptr = ptr + D.19929;
    <D.19927>:
  }
  goto <D.19930>;
  <D.19915>:
  D.19905 = 0;
  return D.19905;
  <D.19930>:
  ptr = ptr + 2;
  streams = MEM[(const guint16 *)ptr];
  ptr = ptr + 2;
  i = 0;
  goto <D.19016>;
  <D.19015>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19934 = "#~";
      D.19935 = MEM[(const unsigned char *)D.19934];
      D.19936 = (int) D.19935;
      D.19937 = *__s2;
      D.19938 = (int) D.19937;
      __result = D.19936 - D.19938;
      {
        if (__s2_len != 0) goto <D.19939>; else goto <D.19940>;
        <D.19939>:
        if (__result == 0) goto <D.19941>; else goto <D.19942>;
        <D.19941>:
        D.19943 = &MEM[(void *)"#~" + 1B];
        D.19944 = *D.19943;
        D.19945 = (int) D.19944;
        D.19946 = __s2 + 1;
        D.19947 = *D.19946;
        D.19948 = (int) D.19947;
        __result = D.19945 - D.19948;
        if (__s2_len > 1) goto <D.19949>; else goto <D.19950>;
        <D.19949>:
        if (__result == 0) goto <D.19951>; else goto <D.19952>;
        <D.19951>:
        D.19953 = &MEM[(void *)"#~" + 2B];
        D.19954 = *D.19953;
        D.19955 = (int) D.19954;
        D.19956 = __s2 + 2;
        D.19957 = *D.19956;
        D.19958 = (int) D.19957;
        __result = D.19955 - D.19958;
        if (__s2_len > 2) goto <D.19959>; else goto <D.19960>;
        <D.19959>:
        if (__result == 0) goto <D.19961>; else goto <D.19962>;
        <D.19961>:
        D.19963 = &MEM[(void *)"#~" + 3B];
        D.19964 = *D.19963;
        D.19965 = (int) D.19964;
        D.19966 = __s2 + 3;
        D.19967 = *D.19966;
        D.19968 = (int) D.19967;
        __result = D.19965 - D.19968;
        <D.19962>:
        <D.19960>:
        <D.19952>:
        <D.19950>:
        <D.19942>:
        <D.19940>:
      }
      D.18968 = __result;
    }
    iftmp.17 = -D.18968;
    goto <D.19969>;
    <D.19933>:
    D.19970 = ptr + 8;
    iftmp.17 = __builtin_strcmp (D.19970, "#~");
    <D.19969>:
    D.18969 = iftmp.17;
  }
  if (D.18969 == 0) goto <D.19971>; else goto <D.19972>;
  <D.19971>:
  D.19922 = image->raw_metadata;
  D.19973 = MEM[(const guint32 *)ptr];
  D.19974 = (sizetype) D.19973;
  D.19975 = D.19922 + D.19974;
  image->heap_tables.data = D.19975;
  D.19976 = MEM[(const guint32 *)ptr + 4B];
  image->heap_tables.size = D.19976;
  ptr = ptr + 11;
  goto <D.19977>;
  <D.19972>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.19981 = "#Strings";
      D.19982 = MEM[(const unsigned char *)D.19981];
      D.19983 = (int) D.19982;
      D.19984 = *__s2;
      D.19985 = (int) D.19984;
      __result = D.19983 - D.19985;
      {
        if (__s2_len != 0) goto <D.19986>; else goto <D.19987>;
        <D.19986>:
        if (__result == 0) goto <D.19988>; else goto <D.19989>;
        <D.19988>:
        D.19990 = &MEM[(void *)"#Strings" + 1B];
        D.19991 = *D.19990;
        D.19992 = (int) D.19991;
        D.19993 = __s2 + 1;
        D.19994 = *D.19993;
        D.19995 = (int) D.19994;
        __result = D.19992 - D.19995;
        if (__s2_len > 1) goto <D.19996>; else goto <D.19997>;
        <D.19996>:
        if (__result == 0) goto <D.19998>; else goto <D.19999>;
        <D.19998>:
        D.20000 = &MEM[(void *)"#Strings" + 2B];
        D.20001 = *D.20000;
        D.20002 = (int) D.20001;
        D.20003 = __s2 + 2;
        D.20004 = *D.20003;
        D.20005 = (int) D.20004;
        __result = D.20002 - D.20005;
        if (__s2_len > 2) goto <D.20006>; else goto <D.20007>;
        <D.20006>:
        if (__result == 0) goto <D.20008>; else goto <D.20009>;
        <D.20008>:
        D.20010 = &MEM[(void *)"#Strings" + 3B];
        D.20011 = *D.20010;
        D.20012 = (int) D.20011;
        D.20013 = __s2 + 3;
        D.20014 = *D.20013;
        D.20015 = (int) D.20014;
        __result = D.20012 - D.20015;
        <D.20009>:
        <D.20007>:
        <D.19999>:
        <D.19997>:
        <D.19989>:
        <D.19987>:
      }
      D.18977 = __result;
    }
    iftmp.18 = -D.18977;
    goto <D.20016>;
    <D.19980>:
    D.19970 = ptr + 8;
    iftmp.18 = __builtin_strcmp (D.19970, "#Strings");
    <D.20016>:
    D.18978 = iftmp.18;
  }
  if (D.18978 == 0) goto <D.20017>; else goto <D.20018>;
  <D.20017>:
  D.19922 = image->raw_metadata;
  D.19973 = MEM[(const guint32 *)ptr];
  D.19974 = (sizetype) D.19973;
  D.19975 = D.19922 + D.19974;
  image->heap_strings.data = D.19975;
  D.19976 = MEM[(const guint32 *)ptr + 4B];
  image->heap_strings.size = D.19976;
  ptr = ptr + 17;
  goto <D.20019>;
  <D.20018>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.20023 = "#US";
      D.20024 = MEM[(const unsigned char *)D.20023];
      D.20025 = (int) D.20024;
      D.20026 = *__s2;
      D.20027 = (int) D.20026;
      __result = D.20025 - D.20027;
      {
        if (__s2_len != 0) goto <D.20028>; else goto <D.20029>;
        <D.20028>:
        if (__result == 0) goto <D.20030>; else goto <D.20031>;
        <D.20030>:
        D.20032 = &MEM[(void *)"#US" + 1B];
        D.20033 = *D.20032;
        D.20034 = (int) D.20033;
        D.20035 = __s2 + 1;
        D.20036 = *D.20035;
        D.20037 = (int) D.20036;
        __result = D.20034 - D.20037;
        if (__s2_len > 1) goto <D.20038>; else goto <D.20039>;
        <D.20038>:
        if (__result == 0) goto <D.20040>; else goto <D.20041>;
        <D.20040>:
        D.20042 = &MEM[(void *)"#US" + 2B];
        D.20043 = *D.20042;
        D.20044 = (int) D.20043;
        D.20045 = __s2 + 2;
        D.20046 = *D.20045;
        D.20047 = (int) D.20046;
        __result = D.20044 - D.20047;
        if (__s2_len > 2) goto <D.20048>; else goto <D.20049>;
        <D.20048>:
        if (__result == 0) goto <D.20050>; else goto <D.20051>;
        <D.20050>:
        D.20052 = &MEM[(void *)"#US" + 3B];
        D.20053 = *D.20052;
        D.20054 = (int) D.20053;
        D.20055 = __s2 + 3;
        D.20056 = *D.20055;
        D.20057 = (int) D.20056;
        __result = D.20054 - D.20057;
        <D.20051>:
        <D.20049>:
        <D.20041>:
        <D.20039>:
        <D.20031>:
        <D.20029>:
      }
      D.18986 = __result;
    }
    iftmp.19 = -D.18986;
    goto <D.20058>;
    <D.20022>:
    D.19970 = ptr + 8;
    iftmp.19 = __builtin_strcmp (D.19970, "#US");
    <D.20058>:
    D.18987 = iftmp.19;
  }
  if (D.18987 == 0) goto <D.20059>; else goto <D.20060>;
  <D.20059>:
  D.19922 = image->raw_metadata;
  D.19973 = MEM[(const guint32 *)ptr];
  D.19974 = (sizetype) D.19973;
  D.19975 = D.19922 + D.19974;
  image->heap_us.data = D.19975;
  D.19976 = MEM[(const guint32 *)ptr + 4B];
  image->heap_us.size = D.19976;
  ptr = ptr + 12;
  goto <D.20061>;
  <D.20060>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.20065 = "#Blob";
      D.20066 = MEM[(const unsigned char *)D.20065];
      D.20067 = (int) D.20066;
      D.20068 = *__s2;
      D.20069 = (int) D.20068;
      __result = D.20067 - D.20069;
      {
        if (__s2_len != 0) goto <D.20070>; else goto <D.20071>;
        <D.20070>:
        if (__result == 0) goto <D.20072>; else goto <D.20073>;
        <D.20072>:
        D.20074 = &MEM[(void *)"#Blob" + 1B];
        D.20075 = *D.20074;
        D.20076 = (int) D.20075;
        D.20077 = __s2 + 1;
        D.20078 = *D.20077;
        D.20079 = (int) D.20078;
        __result = D.20076 - D.20079;
        if (__s2_len > 1) goto <D.20080>; else goto <D.20081>;
        <D.20080>:
        if (__result == 0) goto <D.20082>; else goto <D.20083>;
        <D.20082>:
        D.20084 = &MEM[(void *)"#Blob" + 2B];
        D.20085 = *D.20084;
        D.20086 = (int) D.20085;
        D.20087 = __s2 + 2;
        D.20088 = *D.20087;
        D.20089 = (int) D.20088;
        __result = D.20086 - D.20089;
        if (__s2_len > 2) goto <D.20090>; else goto <D.20091>;
        <D.20090>:
        if (__result == 0) goto <D.20092>; else goto <D.20093>;
        <D.20092>:
        D.20094 = &MEM[(void *)"#Blob" + 3B];
        D.20095 = *D.20094;
        D.20096 = (int) D.20095;
        D.20097 = __s2 + 3;
        D.20098 = *D.20097;
        D.20099 = (int) D.20098;
        __result = D.20096 - D.20099;
        <D.20093>:
        <D.20091>:
        <D.20083>:
        <D.20081>:
        <D.20073>:
        <D.20071>:
      }
      D.18995 = __result;
    }
    iftmp.20 = -D.18995;
    goto <D.20100>;
    <D.20064>:
    D.19970 = ptr + 8;
    iftmp.20 = __builtin_strcmp (D.19970, "#Blob");
    <D.20100>:
    D.18996 = iftmp.20;
  }
  if (D.18996 == 0) goto <D.20101>; else goto <D.20102>;
  <D.20101>:
  D.19922 = image->raw_metadata;
  D.19973 = MEM[(const guint32 *)ptr];
  D.19974 = (sizetype) D.19973;
  D.19975 = D.19922 + D.19974;
  image->heap_blob.data = D.19975;
  D.19976 = MEM[(const guint32 *)ptr + 4B];
  image->heap_blob.size = D.19976;
  ptr = ptr + 14;
  goto <D.20103>;
  <D.20102>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.20107 = "#GUID";
      D.20108 = MEM[(const unsigned char *)D.20107];
      D.20109 = (int) D.20108;
      D.20110 = *__s2;
      D.20111 = (int) D.20110;
      __result = D.20109 - D.20111;
      {
        if (__s2_len != 0) goto <D.20112>; else goto <D.20113>;
        <D.20112>:
        if (__result == 0) goto <D.20114>; else goto <D.20115>;
        <D.20114>:
        D.20116 = &MEM[(void *)"#GUID" + 1B];
        D.20117 = *D.20116;
        D.20118 = (int) D.20117;
        D.20119 = __s2 + 1;
        D.20120 = *D.20119;
        D.20121 = (int) D.20120;
        __result = D.20118 - D.20121;
        if (__s2_len > 1) goto <D.20122>; else goto <D.20123>;
        <D.20122>:
        if (__result == 0) goto <D.20124>; else goto <D.20125>;
        <D.20124>:
        D.20126 = &MEM[(void *)"#GUID" + 2B];
        D.20127 = *D.20126;
        D.20128 = (int) D.20127;
        D.20129 = __s2 + 2;
        D.20130 = *D.20129;
        D.20131 = (int) D.20130;
        __result = D.20128 - D.20131;
        if (__s2_len > 2) goto <D.20132>; else goto <D.20133>;
        <D.20132>:
        if (__result == 0) goto <D.20134>; else goto <D.20135>;
        <D.20134>:
        D.20136 = &MEM[(void *)"#GUID" + 3B];
        D.20137 = *D.20136;
        D.20138 = (int) D.20137;
        D.20139 = __s2 + 3;
        D.20140 = *D.20139;
        D.20141 = (int) D.20140;
        __result = D.20138 - D.20141;
        <D.20135>:
        <D.20133>:
        <D.20125>:
        <D.20123>:
        <D.20115>:
        <D.20113>:
      }
      D.19004 = __result;
    }
    iftmp.21 = -D.19004;
    goto <D.20142>;
    <D.20106>:
    D.19970 = ptr + 8;
    iftmp.21 = __builtin_strcmp (D.19970, "#GUID");
    <D.20142>:
    D.19005 = iftmp.21;
  }
  if (D.19005 == 0) goto <D.20143>; else goto <D.20144>;
  <D.20143>:
  D.19922 = image->raw_metadata;
  D.19973 = MEM[(const guint32 *)ptr];
  D.19974 = (sizetype) D.19973;
  D.19975 = D.19922 + D.19974;
  image->heap_guid.data = D.19975;
  D.19976 = MEM[(const guint32 *)ptr + 4B];
  image->heap_guid.size = D.19976;
  ptr = ptr + 14;
  goto <D.20145>;
  <D.20144>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.20149 = "#-";
      D.20150 = MEM[(const unsigned char *)D.20149];
      D.20151 = (int) D.20150;
      D.20152 = *__s2;
      D.20153 = (int) D.20152;
      __result = D.20151 - D.20153;
      {
        if (__s2_len != 0) goto <D.20154>; else goto <D.20155>;
        <D.20154>:
        if (__result == 0) goto <D.20156>; else goto <D.20157>;
        <D.20156>:
        D.20158 = &MEM[(void *)"#-" + 1B];
        D.20159 = *D.20158;
        D.20160 = (int) D.20159;
        D.20161 = __s2 + 1;
        D.20162 = *D.20161;
        D.20163 = (int) D.20162;
        __result = D.20160 - D.20163;
        if (__s2_len > 1) goto <D.20164>; else goto <D.20165>;
        <D.20164>:
        if (__result == 0) goto <D.20166>; else goto <D.20167>;
        <D.20166>:
        D.20168 = &MEM[(void *)"#-" + 2B];
        D.20169 = *D.20168;
        D.20170 = (int) D.20169;
        D.20171 = __s2 + 2;
        D.20172 = *D.20171;
        D.20173 = (int) D.20172;
        __result = D.20170 - D.20173;
        if (__s2_len > 2) goto <D.20174>; else goto <D.20175>;
        <D.20174>:
        if (__result == 0) goto <D.20176>; else goto <D.20177>;
        <D.20176>:
        D.20178 = &MEM[(void *)"#-" + 3B];
        D.20179 = *D.20178;
        D.20180 = (int) D.20179;
        D.20181 = __s2 + 3;
        D.20182 = *D.20181;
        D.20183 = (int) D.20182;
        __result = D.20180 - D.20183;
        <D.20177>:
        <D.20175>:
        <D.20167>:
        <D.20165>:
        <D.20157>:
        <D.20155>:
      }
      D.19013 = __result;
    }
    iftmp.22 = -D.19013;
    goto <D.20184>;
    <D.20148>:
    D.19970 = ptr + 8;
    iftmp.22 = __builtin_strcmp (D.19970, "#-");
    <D.20184>:
    D.19014 = iftmp.22;
  }
  if (D.19014 == 0) goto <D.20185>; else goto <D.20186>;
  <D.20185>:
  D.19922 = image->raw_metadata;
  D.19973 = MEM[(const guint32 *)ptr];
  D.19974 = (sizetype) D.19973;
  D.19975 = D.19922 + D.19974;
  image->heap_tables.data = D.19975;
  D.19976 = MEM[(const guint32 *)ptr + 4B];
  image->heap_tables.size = D.19976;
  ptr = ptr + 11;
  image->uncompressed_metadata = 1;
  D.20187 = 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.20187);
  goto <D.20188>;
  <D.20186>:
  D.20189 = ptr + 8;
  monoeg_g_log (0B, 32, "Unknown heap type: %s\n", D.20189);
  D.19970 = ptr + 8;
  D.20190 = strlen (D.19970);
  D.20191 = D.20190 + 9;
  ptr = ptr + D.20191;
  <D.20188>:
  <D.20145>:
  <D.20103>:
  <D.20061>:
  <D.20019>:
  <D.19977>:
  ptr.16 = (long int) ptr;
  D.19922 = image->raw_metadata;
  D.19923 = (long int) D.19922;
  D.19924 = ptr.16 - D.19923;
  pad = (guint32) D.19924;
  D.19925 = pad & 3;
  if (D.19925 != 0) goto <D.20192>; else goto <D.20193>;
  <D.20192>:
  D.19925 = pad & 3;
  D.19928 = 4 - D.19925;
  D.19929 = (sizetype) D.19928;
  ptr = ptr + D.19929;
  <D.20193>:
  i = i + 1;
  <D.19016>:
  D.20194 = (int) streams;
  if (D.20194 > i) goto <D.19015>; else goto <D.19017>;
  <D.19017>:
  D.20195 = image->heap_guid.data;
  D.20196 = D.20195 == 0B;
  D.20197 = (long int) D.20196;
  D.20198 = __builtin_expect (D.20197, 0);
  if (D.20198 != 0) goto <D.20199>; else goto <D.20200>;
  <D.20199>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 465, "image->heap_guid.data");
  <D.20200>:
  D.20201 = image->heap_guid.size;
  D.20202 = D.20201 <= 15;
  D.20203 = (long int) D.20202;
  D.20204 = __builtin_expect (D.20203, 0);
  if (D.20204 != 0) goto <D.20205>; else goto <D.20206>;
  <D.20205>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 466, "image->heap_guid.size >= 16");
  <D.20206>:
  D.20195 = image->heap_guid.data;
  D.20207 = mono_guid_to_string (D.20195);
  image->guid = D.20207;
  D.19905 = 1;
  return D.19905;
}


load_tables (struct MonoImage * image)
{
  const char * D.20209;
  char D.20210;
  int D.20211;
  _Bool D.20212;
  int D.20213;
  _Bool D.20214;
  int D.20215;
  _Bool D.20216;
  long unsigned int D.20217;
  long unsigned int D.20218;
  unsigned int D.20226;
  <unnamed-unsigned:24> D.20227;
  int D.20228;
  sizetype D.20229;
  sizetype D.20230;
  const char * D.20231;
  const char * D.20232;
  _Bool D.20233;
  long int D.20234;
  long int D.20235;
  gboolean D.20238;
  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.20209 = heap_tables + 6;
  D.20210 = *D.20209;
  heap_sizes = (int) D.20210;
  D.20211 = heap_sizes & 1;
  D.20212 = D.20211 != 0;
  image->idx_string_wide = D.20212;
  D.20213 = heap_sizes & 2;
  D.20214 = D.20213 != 0;
  image->idx_guid_wide = D.20214;
  D.20215 = heap_sizes & 4;
  D.20216 = D.20215 != 0;
  image->idx_blob_wide = D.20216;
  valid_mask = MEM[(const guint64 *)heap_tables + 8B];
  sorted_mask = MEM[(const guint64 *)heap_tables + 16B];
  rows = heap_tables + 24;
  table = 0;
  goto <D.19030>;
  <D.19029>:
  D.20217 = valid_mask >> table;
  D.20218 = D.20217 & 1;
  if (D.20218 == 0) goto <D.20219>; else goto <D.20220>;
  <D.20219>:
  if (table > 44) goto <D.20221>; else goto <D.20222>;
  <D.20221>:
  // predicted unlikely by continue predictor.
  goto <D.19028>;
  <D.20222>:
  image->tables[table].rows = 0;
  // predicted unlikely by continue predictor.
  goto <D.19028>;
  <D.20220>:
  if (table > 44) goto <D.20223>; else goto <D.20224>;
  <D.20223>:
  monoeg_g_log (0B, 16, "bits in valid must be zero above 0x2d (II - 23.1.6)");
  goto <D.20225>;
  <D.20224>:
  D.20226 = *rows;
  D.20227 = (<unnamed-unsigned:24>) D.20226;
  image->tables[table].rows = D.20227;
  <D.20225>:
  rows = rows + 4;
  valid = valid + 1;
  <D.19028>:
  table = table + 1;
  <D.19030>:
  if (table <= 63) goto <D.19029>; else goto <D.19031>;
  <D.19031>:
  D.20228 = valid * 4;
  D.20229 = (sizetype) D.20228;
  D.20230 = D.20229 + 24;
  D.20231 = heap_tables + D.20230;
  image->tables_base = D.20231;
  D.20232 = image->tables_base;
  D.20233 = D.20232 != rows;
  D.20234 = (long int) D.20233;
  D.20235 = __builtin_expect (D.20234, 0);
  if (D.20235 != 0) goto <D.20236>; else goto <D.20237>;
  <D.20236>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 516, "(const void *) image->tables_base == (const void *) rows");
  <D.20237>:
  mono_metadata_compute_table_bases (image);
  D.20238 = 1;
  return D.20238;
}


mono_image_load_names (struct MonoImage * image)
{
  long unsigned int D.20240;
  long unsigned int D.20241;
  struct MonoTableInfo * D.20244;
  unsigned int D.20245;
  const char * D.20246;
  struct MonoTableInfo * D.20247;
  unsigned int D.20248;
  const char * D.20249;

  D.20240 = BIT_FIELD_REF <*image, 64, 5696>;
  D.20241 = D.20240 & 16777215;
  if (D.20241 != 0) goto <D.20242>; else goto <D.20243>;
  <D.20242>:
  D.20244 = &image->tables[32];
  D.20245 = mono_metadata_decode_row_col (D.20244, 0, 7);
  D.20246 = mono_metadata_string_heap (image, D.20245);
  image->assembly_name = D.20246;
  <D.20243>:
  D.20247 = &image->tables[0];
  D.20248 = mono_metadata_decode_row_col (D.20247, 0, 1);
  D.20249 = mono_metadata_string_heap (image, D.20248);
  image->module_name = D.20249;
}


mono_image_loaded_full (const char * name, gboolean refonly)
{
  struct GHashTable * iftmp.23;
  int mutex_inited.24;
  _Bool D.20259;
  long int D.20260;
  long int D.20261;
  _Bool D.20268;
  long int D.20269;
  long int D.20270;
  struct MonoImage * D.20273;
  struct MonoImage * res;
  struct GHashTable * loaded_images;

  if (refonly != 0) goto <D.20251>; else goto <D.20252>;
  <D.20251>:
  iftmp.23 = loaded_images_refonly_hash;
  goto <D.20253>;
  <D.20252>:
  iftmp.23 = loaded_images_hash;
  <D.20253>:
  loaded_images = iftmp.23;
  mutex_inited.24 = mutex_inited;
  if (mutex_inited.24 != 0) goto <D.20255>; else goto <D.20256>;
  <D.20255>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.20257>; else goto <D.20258>;
    <D.20257>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20258>:
    D.20259 = ret != 0;
    D.20260 = (long int) D.20259;
    D.20261 = __builtin_expect (D.20260, 0);
    if (D.20261 != 0) goto <D.20262>; else goto <D.20263>;
    <D.20262>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1060, "ret == 0");
    <D.20263>:
  }
  <D.20256>:
  res = monoeg_g_hash_table_lookup (loaded_images, name);
  mutex_inited.24 = mutex_inited;
  if (mutex_inited.24 != 0) goto <D.20264>; else goto <D.20265>;
  <D.20264>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20266>; else goto <D.20267>;
    <D.20266>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20267>:
    D.20268 = ret != 0;
    D.20269 = (long int) D.20268;
    D.20270 = __builtin_expect (D.20269, 0);
    if (D.20270 != 0) goto <D.20271>; else goto <D.20272>;
    <D.20271>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1062, "ret == 0");
    <D.20272>:
  }
  <D.20265>:
  D.20273 = res;
  return D.20273;
}


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

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


mono_image_loaded_by_guid_full (const char * guid, gboolean refonly)
{
  struct GHashTable * iftmp.25;
  int mutex_inited.26;
  _Bool D.20286;
  long int D.20287;
  long int D.20288;
  _Bool D.20295;
  long int D.20296;
  long int D.20297;
  struct MonoImage * D.20300;
  struct GuidData data;
  struct GHashTable * loaded_images;

  try
    {
      if (refonly != 0) goto <D.20278>; else goto <D.20279>;
      <D.20278>:
      iftmp.25 = loaded_images_refonly_hash;
      goto <D.20280>;
      <D.20279>:
      iftmp.25 = loaded_images_hash;
      <D.20280>:
      loaded_images = iftmp.25;
      data.res = 0B;
      data.guid = guid;
      mutex_inited.26 = mutex_inited;
      if (mutex_inited.26 != 0) goto <D.20282>; else goto <D.20283>;
      <D.20282>:
      {
        int ret;

        ret = pthread_mutex_lock (&images_mutex.mutex);
        if (ret != 0) goto <D.20284>; else goto <D.20285>;
        <D.20284>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20285>:
        D.20286 = ret != 0;
        D.20287 = (long int) D.20286;
        D.20288 = __builtin_expect (D.20287, 0);
        if (D.20288 != 0) goto <D.20289>; else goto <D.20290>;
        <D.20289>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1106, "ret == 0");
        <D.20290>:
      }
      <D.20283>:
      monoeg_g_hash_table_foreach (loaded_images, find_by_guid, &data);
      mutex_inited.26 = mutex_inited;
      if (mutex_inited.26 != 0) goto <D.20291>; else goto <D.20292>;
      <D.20291>:
      {
        int ret;

        ret = pthread_mutex_unlock (&images_mutex.mutex);
        if (ret != 0) goto <D.20293>; else goto <D.20294>;
        <D.20293>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20294>:
        D.20295 = ret != 0;
        D.20296 = (long int) D.20295;
        D.20297 = __builtin_expect (D.20296, 0);
        if (D.20297 != 0) goto <D.20298>; else goto <D.20299>;
        <D.20298>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1108, "ret == 0");
        <D.20299>:
      }
      <D.20292>:
      D.20300 = data.res;
      return D.20300;
    }
  finally
    {
      data = {CLOBBER};
    }
}


find_by_guid (void * key, void * val, void * user_data)
{
  struct MonoImage * D.20303;
  int D.19189;
  const char * D.20306;
  const char * D.20307;
  struct GuidData * data;
  struct MonoImage * image;

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

    D.20306 = data->guid;
    D.20307 = mono_image_get_guid (image);
    D.19189 = __builtin_strcmp (D.20306, D.20307);
  }
  if (D.19189 == 0) goto <D.20308>; else goto <D.20309>;
  <D.20308>:
  data->res = image;
  <D.20309>:
}


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

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


mono_image_open_from_data_with_name (char * data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus * status, gboolean refonly, const char * name)
{
  struct MonoImage * D.20318;
  long unsigned int D.20321;
  long unsigned int D.20326;
  unsigned char D.20327;
  <unnamed-unsigned:1> D.20328;
  gchar * iftmp.27;
  unsigned char D.20333;
  <unnamed-unsigned:1> D.20334;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  char * datac;

  if (data == 0B) goto <D.20313>; else goto <D.20315>;
  <D.20315>:
  if (data_len == 0) goto <D.20313>; else goto <D.20314>;
  <D.20313>:
  if (status != 0B) goto <D.20316>; else goto <D.20317>;
  <D.20316>:
  *status = 3;
  <D.20317>:
  D.20318 = 0B;
  return D.20318;
  <D.20314>:
  datac = data;
  if (need_copy != 0) goto <D.20319>; else goto <D.20320>;
  <D.20319>:
  D.20321 = (long unsigned int) data_len;
  datac = monoeg_try_malloc (D.20321);
  if (datac == 0B) goto <D.20322>; else goto <D.20323>;
  <D.20322>:
  if (status != 0B) goto <D.20324>; else goto <D.20325>;
  <D.20324>:
  *status = 1;
  <D.20325>:
  D.20318 = 0B;
  return D.20318;
  <D.20323>:
  D.20326 = (long unsigned int) data_len;
  memcpy (datac, data, D.20326);
  <D.20320>:
  image = monoeg_malloc0 (1568);
  image->raw_data = datac;
  image->raw_data_len = data_len;
  D.20327 = (unsigned char) need_copy;
  D.20328 = (<unnamed-unsigned:1>) D.20327;
  image->raw_data_allocated = D.20328;
  if (name == 0B) goto <D.20330>; else goto <D.20331>;
  <D.20330>:
  iftmp.27 = monoeg_g_strdup_printf ("data-%p", datac);
  goto <D.20332>;
  <D.20331>:
  iftmp.27 = monoeg_strdup (name);
  <D.20332>:
  image->name = iftmp.27;
  iinfo = monoeg_malloc0 (408);
  image->image_info = iinfo;
  D.20333 = (unsigned char) refonly;
  D.20334 = (<unnamed-unsigned:1>) D.20333;
  image->ref_only = D.20334;
  image = do_mono_image_load (image, status, 1, 1);
  if (image == 0B) goto <D.20335>; else goto <D.20336>;
  <D.20335>:
  D.20318 = 0B;
  return D.20318;
  <D.20336>:
  D.20318 = register_image (image);
  return D.20318;
}


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

  if (str != 0B) goto <D.20338>; else goto <D.20339>;
  <D.20338>:
  D.20340 = __strdup (str);
  return D.20340;
  <D.20339>:
  D.20340 = 0B;
  return D.20340;
}


do_mono_image_load (struct MonoImage * image, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff)
{
  int D.20345;
  int D.20347;
  int D.20350;
  int D.20352;
  int D.20354;
  struct MonoImage * D.20358;
  struct GSList * errors.28;
  char * D.20362;
  char * D.20363;
  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.20342>; else goto <D.20343>;
      <D.20342>:
      *status = 3;
      <D.20343>:
      if (care_about_pecoff == 0) goto done; else goto <D.20344>;
      <D.20344>:
      D.20345 = mono_verifier_verify_pe_data (image, &errors);
      if (D.20345 == 0) goto invalid_image; else goto <D.20346>;
      <D.20346>:
      D.20347 = mono_image_load_pe_data (image);
      if (D.20347 == 0) goto invalid_image; else goto <D.20348>;
      <D.20348>:
      if (care_about_cli == 0) goto done; else goto <D.20349>;
      <D.20349>:
      D.20350 = mono_verifier_verify_cli_data (image, &errors);
      if (D.20350 == 0) goto invalid_image; else goto <D.20351>;
      <D.20351>:
      D.20352 = mono_image_load_cli_data (image);
      if (D.20352 == 0) goto invalid_image; else goto <D.20353>;
      <D.20353>:
      D.20354 = mono_verifier_verify_table_data (image, &errors);
      if (D.20354 == 0) goto invalid_image; else goto <D.20355>;
      <D.20355>:
      mono_image_load_names (image);
      load_modules (image);
      done:
      mono_profiler_module_loaded (image, 0);
      if (status != 0B) goto <D.20356>; else goto <D.20357>;
      <D.20356>:
      *status = 0;
      <D.20357>:
      D.20358 = image;
      return D.20358;
      invalid_image:
      errors.28 = errors;
      if (errors.28 != 0B) goto <D.20360>; else goto <D.20361>;
      <D.20360>:
      {
        struct MonoVerifyInfo * info;

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


load_modules (struct MonoImage * image)
{
  struct MonoImage * * D.20366;
  <unnamed-unsigned:24> D.20369;
  long unsigned int D.20370;
  long unsigned int D.20371;
  void * D.20372;
  long unsigned int D.20373;
  void * D.20374;
  unsigned int D.20375;
  struct MonoTableInfo * t;

  D.20366 = image->modules;
  if (D.20366 != 0B) goto <D.20367>; else goto <D.20368>;
  <D.20367>:
  return;
  <D.20368>:
  t = &image->tables[26];
  D.20369 = t->rows;
  D.20370 = (long unsigned int) D.20369;
  D.20371 = D.20370 * 8;
  D.20372 = monoeg_malloc0 (D.20371);
  image->modules = D.20372;
  D.20369 = t->rows;
  D.20370 = (long unsigned int) D.20369;
  D.20373 = D.20370 * 4;
  D.20374 = monoeg_malloc0 (D.20373);
  image->modules_loaded = D.20374;
  D.20369 = t->rows;
  D.20375 = (unsigned int) D.20369;
  image->module_count = D.20375;
}


register_image (struct MonoImage * image)
{
  struct GHashTable * iftmp.29;
  long unsigned int D.20378;
  long unsigned int D.20379;
  int mutex_inited.30;
  _Bool D.20388;
  long int D.20389;
  long int D.20390;
  char * D.20393;
  _Bool D.20400;
  long int D.20401;
  long int D.20402;
  struct MonoImage * D.20405;
  const char * D.20406;
  void * D.20409;
  _Bool D.20416;
  long int D.20417;
  long int D.20418;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;

  D.20378 = BIT_FIELD_REF <*image, 64, 192>;
  D.20379 = D.20378 & 68719476736;
  if (D.20379 != 0) goto <D.20380>; else goto <D.20381>;
  <D.20380>:
  iftmp.29 = loaded_images_refonly_hash;
  goto <D.20382>;
  <D.20381>:
  iftmp.29 = loaded_images_hash;
  <D.20382>:
  loaded_images = iftmp.29;
  mutex_inited.30 = mutex_inited;
  if (mutex_inited.30 != 0) goto <D.20384>; else goto <D.20385>;
  <D.20384>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.20386>; else goto <D.20387>;
    <D.20386>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20387>:
    D.20388 = ret != 0;
    D.20389 = (long int) D.20388;
    D.20390 = __builtin_expect (D.20389, 0);
    if (D.20390 != 0) goto <D.20391>; else goto <D.20392>;
    <D.20391>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1124, "ret == 0");
    <D.20392>:
  }
  <D.20385>:
  D.20393 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.20393);
  if (image2 != 0B) goto <D.20394>; else goto <D.20395>;
  <D.20394>:
  mono_image_addref (image2);
  mutex_inited.30 = mutex_inited;
  if (mutex_inited.30 != 0) goto <D.20396>; else goto <D.20397>;
  <D.20396>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20398>; else goto <D.20399>;
    <D.20398>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20399>:
    D.20400 = ret != 0;
    D.20401 = (long int) D.20400;
    D.20402 = __builtin_expect (D.20401, 0);
    if (D.20402 != 0) goto <D.20403>; else goto <D.20404>;
    <D.20403>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1130, "ret == 0");
    <D.20404>:
  }
  <D.20397>:
  mono_image_close (image);
  D.20405 = image2;
  return D.20405;
  <D.20395>:
  D.20393 = image->name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.20393, image, 0);
  D.20406 = image->assembly_name;
  if (D.20406 != 0B) goto <D.20407>; else goto <D.20408>;
  <D.20407>:
  D.20406 = image->assembly_name;
  D.20409 = monoeg_g_hash_table_lookup (loaded_images, D.20406);
  if (D.20409 == 0B) goto <D.20410>; else goto <D.20411>;
  <D.20410>:
  D.20406 = image->assembly_name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.20406, image, 0);
  <D.20411>:
  <D.20408>:
  mutex_inited.30 = mutex_inited;
  if (mutex_inited.30 != 0) goto <D.20412>; else goto <D.20413>;
  <D.20412>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20414>; else goto <D.20415>;
    <D.20414>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20415>:
    D.20416 = ret != 0;
    D.20417 = (long int) D.20416;
    D.20418 = __builtin_expect (D.20417, 0);
    if (D.20418 != 0) goto <D.20419>; else goto <D.20420>;
    <D.20419>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1137, "ret == 0");
    <D.20420>:
  }
  <D.20413>:
  D.20405 = image;
  return D.20405;
}


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

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


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

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


mono_image_open_full (const char * fname, MonoImageOpenStatus * status, gboolean refonly)
{
  struct MonoImage * D.20428;
  int mutex_inited.31;
  _Bool D.20434;
  long int D.20435;
  long int D.20436;
  struct GHashTable * iftmp.32;
  _Bool D.20449;
  long int D.20450;
  long int D.20451;
  _Bool D.20458;
  long int D.20459;
  long int D.20460;
  struct MonoImage * image;
  struct GHashTable * loaded_images;
  char * absfname;

  if (fname == 0B) goto <D.20426>; else goto <D.20427>;
  <D.20426>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1225, "fname != NULL");
  D.20428 = 0B;
  return D.20428;
  <D.20427>:
  absfname = mono_path_canonicalize (fname);
  mutex_inited.31 = mutex_inited;
  if (mutex_inited.31 != 0) goto <D.20430>; else goto <D.20431>;
  <D.20430>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.20432>; else goto <D.20433>;
    <D.20432>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20433>:
    D.20434 = ret != 0;
    D.20435 = (long int) D.20434;
    D.20436 = __builtin_expect (D.20435, 0);
    if (D.20436 != 0) goto <D.20437>; else goto <D.20438>;
    <D.20437>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1305, "ret == 0");
    <D.20438>:
  }
  <D.20431>:
  if (refonly != 0) goto <D.20440>; else goto <D.20441>;
  <D.20440>:
  iftmp.32 = loaded_images_refonly_hash;
  goto <D.20442>;
  <D.20441>:
  iftmp.32 = loaded_images_hash;
  <D.20442>:
  loaded_images = iftmp.32;
  image = monoeg_g_hash_table_lookup (loaded_images, absfname);
  monoeg_g_free (absfname);
  if (image != 0B) goto <D.20443>; else goto <D.20444>;
  <D.20443>:
  mono_image_addref (image);
  mutex_inited.31 = mutex_inited;
  if (mutex_inited.31 != 0) goto <D.20445>; else goto <D.20446>;
  <D.20445>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20447>; else goto <D.20448>;
    <D.20447>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20448>:
    D.20449 = ret != 0;
    D.20450 = (long int) D.20449;
    D.20451 = __builtin_expect (D.20450, 0);
    if (D.20451 != 0) goto <D.20452>; else goto <D.20453>;
    <D.20452>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1312, "ret == 0");
    <D.20453>:
  }
  <D.20446>:
  D.20428 = image;
  return D.20428;
  <D.20444>:
  mutex_inited.31 = mutex_inited;
  if (mutex_inited.31 != 0) goto <D.20454>; else goto <D.20455>;
  <D.20454>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20456>; else goto <D.20457>;
    <D.20456>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20457>:
    D.20458 = ret != 0;
    D.20459 = (long int) D.20458;
    D.20460 = __builtin_expect (D.20459, 0);
    if (D.20460 != 0) goto <D.20461>; else goto <D.20462>;
    <D.20461>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1315, "ret == 0");
    <D.20462>:
  }
  <D.20455>:
  image = do_mono_image_open (fname, status, 1, 1, refonly);
  if (image == 0B) goto <D.20463>; else goto <D.20464>;
  <D.20463>:
  D.20428 = 0B;
  return D.20428;
  <D.20464>:
  D.20428 = register_image (image);
  return D.20428;
}


do_mono_image_open (const char * fname, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly)
{
  int __mono_io_portability_helpers.33;
  struct MonoImage * D.20477;
  long unsigned int D.20478;
  unsigned int D.20479;
  unsigned int D.20480;
  long unsigned int D.20481;
  int D.20482;
  void * * D.20483;
  void * D.20484;
  char * D.20485;
  int D.20488;
  void * D.20489;
  gchar * D.20494;
  unsigned char D.20495;
  <unnamed-unsigned:1> D.20496;
  int D.20497;
  unsigned char D.20498;
  <unnamed-unsigned:1> D.20499;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  struct MonoFileMap * filed;

  filed = mono_file_map_open (fname);
  if (filed == 0B) goto <D.20466>; else goto <D.20467>;
  <D.20466>:
  __mono_io_portability_helpers.33 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.33 > 0) goto <D.20469>; else goto <D.20470>;
  <D.20469>:
  {
    gchar * ffname;

    ffname = mono_portability_find_file (fname, 1);
    if (ffname != 0B) goto <D.20471>; else goto <D.20472>;
    <D.20471>:
    filed = mono_file_map_open (ffname);
    monoeg_g_free (ffname);
    <D.20472>:
  }
  <D.20470>:
  if (filed == 0B) goto <D.20473>; else goto <D.20474>;
  <D.20473>:
  if (status != 0B) goto <D.20475>; else goto <D.20476>;
  <D.20475>:
  *status = 1;
  <D.20476>:
  D.20477 = 0B;
  return D.20477;
  <D.20474>:
  <D.20467>:
  image = monoeg_malloc0 (1568);
  image->raw_buffer_used = 1;
  D.20478 = mono_file_map_size (filed);
  D.20479 = (unsigned int) D.20478;
  image->raw_data_len = D.20479;
  D.20480 = image->raw_data_len;
  D.20481 = (long unsigned int) D.20480;
  D.20482 = mono_file_map_fd (filed);
  D.20483 = &image->raw_data_handle;
  D.20484 = mono_file_map (D.20481, 17, D.20482, 0, D.20483);
  image->raw_data = D.20484;
  D.20485 = image->raw_data;
  if (D.20485 == 0B) goto <D.20486>; else goto <D.20487>;
  <D.20486>:
  image->fileio_used = 1;
  D.20480 = image->raw_data_len;
  D.20481 = (long unsigned int) D.20480;
  D.20488 = mono_file_map_fd (filed);
  D.20483 = &image->raw_data_handle;
  D.20489 = mono_file_map_fileio (D.20481, 17, D.20488, 0, D.20483);
  image->raw_data = D.20489;
  <D.20487>:
  D.20485 = image->raw_data;
  if (D.20485 == 0B) goto <D.20490>; else goto <D.20491>;
  <D.20490>:
  mono_file_map_close (filed);
  monoeg_g_free (image);
  if (status != 0B) goto <D.20492>; else goto <D.20493>;
  <D.20492>:
  *status = 3;
  <D.20493>:
  D.20477 = 0B;
  return D.20477;
  <D.20491>:
  iinfo = monoeg_malloc0 (408);
  image->image_info = iinfo;
  D.20494 = mono_path_resolve_symlinks (fname);
  image->name = D.20494;
  D.20495 = (unsigned char) refonly;
  D.20496 = (<unnamed-unsigned:1>) D.20495;
  image->ref_only = D.20496;
  image->ref_count = 1;
  D.20497 = mono_security_core_clr_determine_platform_image (image);
  D.20498 = (unsigned char) D.20497;
  D.20499 = (<unnamed-unsigned:1>) D.20498;
  image->core_clr_platform_code = D.20499;
  mono_file_map_close (filed);
  D.20477 = do_mono_image_load (image, status, care_about_cli, care_about_pecoff);
  return D.20477;
}


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

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


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

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


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

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


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

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


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.20512;
  unsigned int D.20513;

  D.20513 = __sync_add_and_fetch_4 (val, 1);
  D.20512 = (gint32) D.20513;
  return D.20512;
}


mono_dynamic_stream_reset (struct MonoDynamicStream * stream)
{
  unsigned int D.20515;
  unsigned int D.20516;
  char * D.20517;
  struct GHashTable * D.20518;

  stream->offset = 0;
  D.20515 = stream->offset;
  stream->index = D.20515;
  D.20516 = stream->index;
  stream->alloc_size = D.20516;
  D.20517 = stream->data;
  monoeg_g_free (D.20517);
  stream->data = 0B;
  D.20518 = stream->hash;
  if (D.20518 != 0B) goto <D.20519>; else goto <D.20520>;
  <D.20519>:
  D.20518 = stream->hash;
  monoeg_g_hash_table_destroy (D.20518);
  stream->hash = 0B;
  <D.20520>:
}


mono_image_close_except_pools (struct MonoImage * image)
{
  gboolean D.20523;
  int mutex_inited.34;
  _Bool D.20529;
  long int D.20530;
  long int D.20531;
  int * D.20534;
  int D.20535;
  _Bool D.20542;
  long int D.20543;
  long int D.20544;
  struct GHashTable * iftmp.35;
  long unsigned int D.20548;
  long unsigned int D.20549;
  char * D.20553;
  const char * D.20556;
  void * D.20559;
  _Bool D.20566;
  long int D.20567;
  long int D.20568;
  struct MonoAssembly * * D.20573;
  long unsigned int D.20575;
  long unsigned int D.20577;
  long unsigned int D.20578;
  struct MonoAssembly * * D.20579;
  struct MonoAssembly * D.20580;
  struct MonoAssembly * D.20581;
  int D.20584;
  int D.20587;
  long unsigned int D.20590;
  char * D.20593;
  long unsigned int D.20596;
  void * D.20599;
  long unsigned int D.20601;
  char * D.20604;
  unsigned int D.20607;
  sizetype D.20608;
  char * D.20609;
  void * * D.20612;
  void * * D.20613;
  void * D.20614;
  int D.20619;
  int debug_assembly_unload.36;
  gchar * D.20623;
  char * D.20625;
  char * D.20626;
  struct MonoImage * * D.20627;
  struct GHashTable * D.20628;
  struct GHashTable * D.20631;
  struct MonoInternalHashTable * D.20634;
  struct GHashTable * D.20635;
  struct GHashTable * D.20636;
  struct GHashTable * D.20639;
  struct GHashTable * D.20642;
  struct GHashTable * D.20645;
  struct GHashTable * D.20648;
  struct GHashTable * D.20649;
  struct GHashTable * D.20650;
  struct GHashTable * D.20651;
  struct GHashTable * D.20652;
  struct GHashTable * D.20653;
  struct GHashTable * D.20654;
  struct GHashTable * D.20655;
  struct GHashTable * D.20656;
  struct GHashTable * D.20657;
  struct GHashTable * D.20658;
  struct GHashTable * D.20659;
  struct GHashTable * D.20660;
  struct GHashTable * D.20661;
  struct GHashTable * D.20662;
  struct GHashTable * D.20663;
  struct GHashTable * D.20664;
  struct GHashTable * D.20665;
  struct GHashTable * D.20666;
  struct GHashTable * D.20667;
  struct GHashTable * D.20668;
  struct GHashTable * D.20669;
  struct GHashTable * D.20670;
  struct GHashTable * D.20671;
  struct GHashTable * D.20672;
  struct GHashTable * D.20673;
  struct GHashTable * D.20674;
  struct GHashTable * D.20675;
  struct GHashTable * D.20676;
  struct GHashTable * D.20677;
  struct GHashTable * D.20678;
  struct GHashTable * D.20679;
  struct GHashTable * D.20680;
  struct GHashTable * D.20681;
  struct GHashTable * D.20682;
  struct GHashTable * D.20683;
  struct GHashTable * D.20684;
  struct GHashTable * D.20685;
  struct GHashTable * D.20686;
  struct MonoPropertyHash * D.20689;
  int iftmp.37;
  struct GSList * D.20695;
  int D.20697;
  _Bool D.20699;
  long int D.20700;
  long int D.20701;
  struct MonoBitSet * D.20704;
  void * D.20707;
  struct MonoSectionTable * D.20710;
  void * * D.20713;
  struct MonoImage * * D.20716;
  struct MonoImage * * D.20717;
  struct MonoImage * D.20718;
  int D.20721;
  unsigned int i.38;
  unsigned int D.20725;
  gboolean * D.20726;
  struct CRITICAL_SECTION * D.20729;
  struct CRITICAL_SECTION * D.20730;
  const char * D.20733;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;
  int i;

  if (image == 0B) goto <D.20521>; else goto <D.20522>;
  <D.20521>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1492, "image != NULL");
  D.20523 = 0;
  return D.20523;
  <D.20522>:
  mutex_inited.34 = mutex_inited;
  if (mutex_inited.34 != 0) goto <D.20525>; else goto <D.20526>;
  <D.20525>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.20527>; else goto <D.20528>;
    <D.20527>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20528>:
    D.20529 = ret != 0;
    D.20530 = (long int) D.20529;
    D.20531 = __builtin_expect (D.20530, 0);
    if (D.20531 != 0) goto <D.20532>; else goto <D.20533>;
    <D.20532>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1498, "ret == 0");
    <D.20533>:
  }
  <D.20526>:
  D.20534 = &image->ref_count;
  D.20535 = InterlockedDecrement (D.20534);
  if (D.20535 > 0) goto <D.20536>; else goto <D.20537>;
  <D.20536>:
  mutex_inited.34 = mutex_inited;
  if (mutex_inited.34 != 0) goto <D.20538>; else goto <D.20539>;
  <D.20538>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20540>; else goto <D.20541>;
    <D.20540>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20541>:
    D.20542 = ret != 0;
    D.20543 = (long int) D.20542;
    D.20544 = __builtin_expect (D.20543, 0);
    if (D.20544 != 0) goto <D.20545>; else goto <D.20546>;
    <D.20545>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1501, "ret == 0");
    <D.20546>:
  }
  <D.20539>:
  D.20523 = 0;
  return D.20523;
  <D.20537>:
  D.20548 = BIT_FIELD_REF <*image, 64, 192>;
  D.20549 = D.20548 & 68719476736;
  if (D.20549 != 0) goto <D.20550>; else goto <D.20551>;
  <D.20550>:
  iftmp.35 = loaded_images_refonly_hash;
  goto <D.20552>;
  <D.20551>:
  iftmp.35 = loaded_images_hash;
  <D.20552>:
  loaded_images = iftmp.35;
  D.20553 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.20553);
  if (image == image2) goto <D.20554>; else goto <D.20555>;
  <D.20554>:
  D.20553 = image->name;
  monoeg_g_hash_table_remove (loaded_images, D.20553);
  <D.20555>:
  D.20556 = image->assembly_name;
  if (D.20556 != 0B) goto <D.20557>; else goto <D.20558>;
  <D.20557>:
  D.20556 = image->assembly_name;
  D.20559 = monoeg_g_hash_table_lookup (loaded_images, D.20556);
  if (D.20559 == image) goto <D.20560>; else goto <D.20561>;
  <D.20560>:
  D.20556 = image->assembly_name;
  monoeg_g_hash_table_remove (loaded_images, D.20556);
  <D.20561>:
  <D.20558>:
  mutex_inited.34 = mutex_inited;
  if (mutex_inited.34 != 0) goto <D.20562>; else goto <D.20563>;
  <D.20562>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.20564>; else goto <D.20565>;
    <D.20564>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20565>:
    D.20566 = ret != 0;
    D.20567 = (long int) D.20566;
    D.20568 = __builtin_expect (D.20567, 0);
    if (D.20568 != 0) goto <D.20569>; else goto <D.20570>;
    <D.20569>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1514, "ret == 0");
    <D.20570>:
  }
  <D.20563>:
  mono_profiler_module_event (image, 2);
  D.20553 = image->name;
  mono_trace (64, 1, "Unloading image %s [%p].", D.20553, image);
  mono_image_invoke_unload_hook (image);
  mono_metadata_clean_for_image (image);
  D.20573 = image->references;
  if (D.20573 != 0B) goto <D.20574>; else goto <D.20571>;
  <D.20574>:
  D.20548 = BIT_FIELD_REF <*image, 64, 192>;
  D.20575 = D.20548 & 34359738368;
  if (D.20575 == 0) goto <D.20576>; else goto <D.20571>;
  <D.20576>:
  i = 0;
  goto <D.19288>;
  <D.19287>:
  D.20573 = image->references;
  D.20577 = (long unsigned int) i;
  D.20578 = D.20577 * 8;
  D.20579 = D.20573 + D.20578;
  D.20580 = *D.20579;
  D.20581 = D.20580 + 18446744073709551615;
  if (D.20581 <= -3B) goto <D.20582>; else goto <D.20583>;
  <D.20582>:
  D.20573 = image->references;
  D.20577 = (long unsigned int) i;
  D.20578 = D.20577 * 8;
  D.20579 = D.20573 + D.20578;
  D.20580 = *D.20579;
  D.20584 = mono_assembly_close_except_image_pools (D.20580);
  if (D.20584 == 0) goto <D.20585>; else goto <D.20586>;
  <D.20585>:
  D.20573 = image->references;
  D.20577 = (long unsigned int) i;
  D.20578 = D.20577 * 8;
  D.20579 = D.20573 + D.20578;
  *D.20579 = 0B;
  <D.20586>:
  <D.20583>:
  i = i + 1;
  <D.19288>:
  D.20587 = image->nreferences;
  if (D.20587 > i) goto <D.19287>; else goto <D.19289>;
  <D.19289>:
  goto <D.20572>;
  <D.20571>:
  D.20573 = image->references;
  if (D.20573 != 0B) goto <D.20588>; else goto <D.20589>;
  <D.20588>:
  D.20573 = image->references;
  monoeg_g_free (D.20573);
  image->references = 0B;
  <D.20589>:
  <D.20572>:
  D.20548 = BIT_FIELD_REF <*image, 64, 192>;
  D.20590 = D.20548 & 4294967296;
  if (D.20590 != 0) goto <D.20591>; else goto <D.20592>;
  <D.20591>:
  D.20593 = image->raw_data;
  if (D.20593 != 0B) goto <D.20594>; else goto <D.20595>;
  <D.20594>:
  D.20548 = BIT_FIELD_REF <*image, 64, 192>;
  D.20596 = D.20548 & 17179869184;
  if (D.20596 != 0) goto <D.20597>; else goto <D.20598>;
  <D.20597>:
  D.20593 = image->raw_data;
  D.20599 = image->raw_data_handle;
  mono_file_unmap_fileio (D.20593, D.20599);
  goto <D.20600>;
  <D.20598>:
  D.20593 = image->raw_data;
  D.20599 = image->raw_data_handle;
  mono_file_unmap (D.20593, D.20599);
  <D.20600>:
  <D.20595>:
  <D.20592>:
  D.20548 = BIT_FIELD_REF <*image, 64, 192>;
  D.20601 = D.20548 & 8589934592;
  if (D.20601 != 0) goto <D.20602>; else goto <D.20603>;
  <D.20602>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.20604 = image->raw_metadata;
    D.20593 = image->raw_data;
    if (D.20604 > D.20593) goto <D.20605>; else goto <D.20606>;
    <D.20605>:
    D.20604 = image->raw_metadata;
    D.20593 = image->raw_data;
    D.20607 = image->raw_data_len;
    D.20608 = (sizetype) D.20607;
    D.20609 = D.20593 + D.20608;
    if (D.20604 <= D.20609) goto <D.20610>; else goto <D.20611>;
    <D.20610>:
    image->raw_metadata = 0B;
    <D.20611>:
    <D.20606>:
    i = 0;
    goto <D.19292>;
    <D.19291>:
    D.20612 = ii->cli_sections;
    D.20577 = (long unsigned int) i;
    D.20578 = D.20577 * 8;
    D.20613 = D.20612 + D.20578;
    D.20614 = *D.20613;
    D.20593 = image->raw_data;
    if (D.20614 > D.20593) goto <D.20615>; else goto <D.20616>;
    <D.20615>:
    D.20612 = ii->cli_sections;
    D.20577 = (long unsigned int) i;
    D.20578 = D.20577 * 8;
    D.20613 = D.20612 + D.20578;
    D.20614 = *D.20613;
    D.20593 = image->raw_data;
    D.20607 = image->raw_data_len;
    D.20608 = (sizetype) D.20607;
    D.20609 = D.20593 + D.20608;
    if (D.20614 <= D.20609) goto <D.20617>; else goto <D.20618>;
    <D.20617>:
    D.20612 = ii->cli_sections;
    D.20577 = (long unsigned int) i;
    D.20578 = D.20577 * 8;
    D.20613 = D.20612 + D.20578;
    *D.20613 = 0B;
    <D.20618>:
    <D.20616>:
    i = i + 1;
    <D.19292>:
    D.20619 = ii->cli_section_count;
    if (D.20619 > i) goto <D.19291>; else goto <D.19293>;
    <D.19293>:
    D.20593 = image->raw_data;
    monoeg_g_free (D.20593);
  }
  <D.20603>:
  debug_assembly_unload.36 = debug_assembly_unload;
  if (debug_assembly_unload.36 != 0) goto <D.20621>; else goto <D.20622>;
  <D.20621>:
  D.20553 = image->name;
  D.20623 = monoeg_g_strdup_printf ("%s - UNLOADED", D.20553);
  image->name = D.20623;
  goto <D.20624>;
  <D.20622>:
  D.20553 = image->name;
  monoeg_g_free (D.20553);
  D.20625 = image->guid;
  monoeg_g_free (D.20625);
  D.20626 = image->version;
  monoeg_g_free (D.20626);
  D.20627 = image->files;
  monoeg_g_free (D.20627);
  <D.20624>:
  D.20628 = image->method_cache;
  if (D.20628 != 0B) goto <D.20629>; else goto <D.20630>;
  <D.20629>:
  D.20628 = image->method_cache;
  monoeg_g_hash_table_destroy (D.20628);
  <D.20630>:
  D.20631 = image->methodref_cache;
  if (D.20631 != 0B) goto <D.20632>; else goto <D.20633>;
  <D.20632>:
  D.20631 = image->methodref_cache;
  monoeg_g_hash_table_destroy (D.20631);
  <D.20633>:
  D.20634 = &image->class_cache;
  mono_internal_hash_table_destroy (D.20634);
  D.20635 = image->field_cache;
  monoeg_g_hash_table_destroy (D.20635);
  D.20636 = image->array_cache;
  if (D.20636 != 0B) goto <D.20637>; else goto <D.20638>;
  <D.20637>:
  D.20636 = image->array_cache;
  monoeg_g_hash_table_foreach (D.20636, free_array_cache_entry, 0B);
  D.20636 = image->array_cache;
  monoeg_g_hash_table_destroy (D.20636);
  <D.20638>:
  D.20639 = image->szarray_cache;
  if (D.20639 != 0B) goto <D.20640>; else goto <D.20641>;
  <D.20640>:
  D.20639 = image->szarray_cache;
  monoeg_g_hash_table_destroy (D.20639);
  <D.20641>:
  D.20642 = image->ptr_cache;
  if (D.20642 != 0B) goto <D.20643>; else goto <D.20644>;
  <D.20643>:
  D.20642 = image->ptr_cache;
  monoeg_g_hash_table_destroy (D.20642);
  <D.20644>:
  D.20645 = image->name_cache;
  if (D.20645 != 0B) goto <D.20646>; else goto <D.20647>;
  <D.20646>:
  D.20645 = image->name_cache;
  monoeg_g_hash_table_foreach (D.20645, free_hash_table, 0B);
  D.20645 = image->name_cache;
  monoeg_g_hash_table_destroy (D.20645);
  <D.20647>:
  D.20648 = image->native_wrapper_cache;
  free_hash (D.20648);
  D.20649 = image->managed_wrapper_cache;
  free_hash (D.20649);
  D.20650 = image->delegate_begin_invoke_cache;
  free_hash (D.20650);
  D.20651 = image->delegate_end_invoke_cache;
  free_hash (D.20651);
  D.20652 = image->delegate_invoke_cache;
  free_hash (D.20652);
  D.20653 = image->delegate_abstract_invoke_cache;
  free_hash (D.20653);
  D.20654 = image->delegate_bound_static_invoke_cache;
  free_hash (D.20654);
  D.20655 = image->delegate_invoke_generic_cache;
  free_hash (D.20655);
  D.20656 = image->delegate_begin_invoke_generic_cache;
  free_hash (D.20656);
  D.20657 = image->delegate_end_invoke_generic_cache;
  free_hash (D.20657);
  D.20658 = image->synchronized_generic_cache;
  free_hash (D.20658);
  D.20659 = image->remoting_invoke_cache;
  free_hash (D.20659);
  D.20660 = image->runtime_invoke_cache;
  free_hash (D.20660);
  D.20661 = image->runtime_invoke_vtype_cache;
  free_hash (D.20661);
  D.20662 = image->runtime_invoke_direct_cache;
  free_hash (D.20662);
  D.20663 = image->runtime_invoke_vcall_cache;
  free_hash (D.20663);
  D.20664 = image->synchronized_cache;
  free_hash (D.20664);
  D.20665 = image->unbox_wrapper_cache;
  free_hash (D.20665);
  D.20666 = image->cominterop_invoke_cache;
  free_hash (D.20666);
  D.20667 = image->cominterop_wrapper_cache;
  free_hash (D.20667);
  D.20668 = image->typespec_cache;
  free_hash (D.20668);
  D.20669 = image->ldfld_wrapper_cache;
  free_hash (D.20669);
  D.20670 = image->ldflda_wrapper_cache;
  free_hash (D.20670);
  D.20671 = image->stfld_wrapper_cache;
  free_hash (D.20671);
  D.20672 = image->isinst_cache;
  free_hash (D.20672);
  D.20673 = image->castclass_cache;
  free_hash (D.20673);
  D.20674 = image->proxy_isinst_cache;
  free_hash (D.20674);
  D.20675 = image->thunk_invoke_cache;
  free_hash (D.20675);
  D.20676 = image->var_cache_slow;
  free_hash (D.20676);
  D.20677 = image->mvar_cache_slow;
  free_hash (D.20677);
  D.20678 = image->wrapper_param_names;
  free_hash (D.20678);
  D.20679 = image->native_wrapper_aot_cache;
  free_hash (D.20679);
  D.20680 = image->pinvoke_scopes;
  free_hash (D.20680);
  D.20681 = image->pinvoke_scope_filenames;
  free_hash (D.20681);
  D.20682 = image->gsharedvt_types;
  free_hash (D.20682);
  D.20683 = image->memberref_signatures;
  monoeg_g_hash_table_destroy (D.20683);
  D.20684 = image->helper_signatures;
  monoeg_g_hash_table_destroy (D.20684);
  D.20685 = image->method_signatures;
  monoeg_g_hash_table_destroy (D.20685);
  D.20686 = image->rgctx_template_hash;
  if (D.20686 != 0B) goto <D.20687>; else goto <D.20688>;
  <D.20687>:
  D.20686 = image->rgctx_template_hash;
  monoeg_g_hash_table_destroy (D.20686);
  <D.20688>:
  D.20689 = image->property_hash;
  if (D.20689 != 0B) goto <D.20690>; else goto <D.20691>;
  <D.20690>:
  D.20689 = image->property_hash;
  mono_property_hash_destroy (D.20689);
  <D.20691>:
  D.20695 = image->reflection_info_unregister_classes;
  if (D.20695 != 0B) goto <D.20696>; else goto <D.20693>;
  <D.20696>:
  D.20697 = mono_runtime_is_shutting_down ();
  if (D.20697 == 0) goto <D.20698>; else goto <D.20693>;
  <D.20698>:
  iftmp.37 = 1;
  goto <D.20694>;
  <D.20693>:
  iftmp.37 = 0;
  <D.20694>:
  D.20699 = iftmp.37 != 0;
  D.20700 = (long int) D.20699;
  D.20701 = __builtin_expect (D.20700, 0);
  if (D.20701 != 0) goto <D.20702>; else goto <D.20703>;
  <D.20702>:
  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.20703>:
  image->reflection_info_unregister_classes = 0B;
  D.20704 = image->interface_bitset;
  if (D.20704 != 0B) goto <D.20705>; else goto <D.20706>;
  <D.20705>:
  D.20704 = image->interface_bitset;
  mono_unload_interface_ids (D.20704);
  D.20704 = image->interface_bitset;
  mono_bitset_free (D.20704);
  <D.20706>:
  D.20707 = image->image_info;
  if (D.20707 != 0B) goto <D.20708>; else goto <D.20709>;
  <D.20708>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.20710 = ii->cli_section_tables;
    if (D.20710 != 0B) goto <D.20711>; else goto <D.20712>;
    <D.20711>:
    D.20710 = ii->cli_section_tables;
    monoeg_g_free (D.20710);
    <D.20712>:
    D.20713 = ii->cli_sections;
    if (D.20713 != 0B) goto <D.20714>; else goto <D.20715>;
    <D.20714>:
    D.20713 = ii->cli_sections;
    monoeg_g_free (D.20713);
    <D.20715>:
    D.20707 = image->image_info;
    monoeg_g_free (D.20707);
  }
  <D.20709>:
  i = 0;
  goto <D.19296>;
  <D.19295>:
  D.20716 = image->modules;
  D.20577 = (long unsigned int) i;
  D.20578 = D.20577 * 8;
  D.20717 = D.20716 + D.20578;
  D.20718 = *D.20717;
  if (D.20718 != 0B) goto <D.20719>; else goto <D.20720>;
  <D.20719>:
  D.20716 = image->modules;
  D.20577 = (long unsigned int) i;
  D.20578 = D.20577 * 8;
  D.20717 = D.20716 + D.20578;
  D.20718 = *D.20717;
  D.20721 = mono_image_close_except_pools (D.20718);
  if (D.20721 == 0) goto <D.20722>; else goto <D.20723>;
  <D.20722>:
  D.20716 = image->modules;
  D.20577 = (long unsigned int) i;
  D.20578 = D.20577 * 8;
  D.20717 = D.20716 + D.20578;
  *D.20717 = 0B;
  <D.20723>:
  <D.20720>:
  i = i + 1;
  <D.19296>:
  i.38 = (unsigned int) i;
  D.20725 = image->module_count;
  if (i.38 < D.20725) goto <D.19295>; else goto <D.19297>;
  <D.19297>:
  D.20726 = image->modules_loaded;
  if (D.20726 != 0B) goto <D.20727>; else goto <D.20728>;
  <D.20727>:
  D.20726 = image->modules_loaded;
  monoeg_g_free (D.20726);
  <D.20728>:
  D.20729 = &image->szarray_cache_lock;
  DeleteCriticalSection (D.20729);
  D.20730 = &image->lock;
  DeleteCriticalSection (D.20730);
  D.20548 = BIT_FIELD_REF <*image, 64, 192>;
  D.20575 = D.20548 & 34359738368;
  if (D.20575 != 0) goto <D.20731>; else goto <D.20732>;
  <D.20731>:
  D.20733 = image->module_name;
  monoeg_g_free (D.20733);
  mono_dynamic_image_free (image);
  <D.20732>:
  mono_profiler_module_event (image, 3);
  D.20523 = 1;
  return D.20523;
}


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.20735;
  unsigned int D.20736;

  D.20736 = __sync_sub_and_fetch_4 (val, 1);
  D.20735 = (gint32) D.20736;
  return D.20735;
}


mono_image_invoke_unload_hook (struct MonoImage * image)
{
  void (*<T1b94>) (struct MonoImage *, void *) D.20738;
  void * D.20739;
  struct GSList * l;
  struct ImageUnloadHook * hook;

  l = image_unload_hooks;
  goto <D.18864>;
  <D.18863>:
  hook = l->data;
  D.20738 = hook->func;
  D.20739 = hook->user_data;
  D.20738 (image, D.20739);
  l = l->next;
  <D.18864>:
  if (l != 0B) goto <D.18863>; else goto <D.18865>;
  <D.18865>:
}


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


mono_image_close_finish (struct MonoImage * image)
{
  struct MonoAssembly * * D.20742;
  long unsigned int D.20745;
  long unsigned int D.20746;
  long unsigned int D.20749;
  long unsigned int D.20750;
  struct MonoAssembly * * D.20751;
  struct MonoAssembly * D.20752;
  struct MonoAssembly * D.20753;
  int D.20756;
  struct MonoImage * * D.20757;
  struct MonoImage * * D.20758;
  struct MonoImage * D.20759;
  unsigned int i.39;
  unsigned int D.20763;
  struct MonoMemPool * D.20766;
  unsigned int D.20767;
  struct MonoPerfCounters * mono_perfcounters.40;
  unsigned int D.20769;
  unsigned int D.20770;
  int debug_assembly_unload.41;
  int i;

  D.20742 = image->references;
  if (D.20742 != 0B) goto <D.20743>; else goto <D.20744>;
  <D.20743>:
  D.20745 = BIT_FIELD_REF <*image, 64, 192>;
  D.20746 = D.20745 & 34359738368;
  if (D.20746 == 0) goto <D.20747>; else goto <D.20748>;
  <D.20747>:
  i = 0;
  goto <D.19303>;
  <D.19302>:
  D.20742 = image->references;
  D.20749 = (long unsigned int) i;
  D.20750 = D.20749 * 8;
  D.20751 = D.20742 + D.20750;
  D.20752 = *D.20751;
  D.20753 = D.20752 + 18446744073709551615;
  if (D.20753 <= -3B) goto <D.20754>; else goto <D.20755>;
  <D.20754>:
  D.20742 = image->references;
  D.20749 = (long unsigned int) i;
  D.20750 = D.20749 * 8;
  D.20751 = D.20742 + D.20750;
  D.20752 = *D.20751;
  mono_assembly_close_finish (D.20752);
  <D.20755>:
  i = i + 1;
  <D.19303>:
  D.20756 = image->nreferences;
  if (D.20756 > i) goto <D.19302>; else goto <D.19304>;
  <D.19304>:
  D.20742 = image->references;
  monoeg_g_free (D.20742);
  image->references = 0B;
  <D.20748>:
  <D.20744>:
  i = 0;
  goto <D.19306>;
  <D.19305>:
  D.20757 = image->modules;
  D.20749 = (long unsigned int) i;
  D.20750 = D.20749 * 8;
  D.20758 = D.20757 + D.20750;
  D.20759 = *D.20758;
  if (D.20759 != 0B) goto <D.20760>; else goto <D.20761>;
  <D.20760>:
  D.20757 = image->modules;
  D.20749 = (long unsigned int) i;
  D.20750 = D.20749 * 8;
  D.20758 = D.20757 + D.20750;
  D.20759 = *D.20758;
  mono_image_close_finish (D.20759);
  <D.20761>:
  i = i + 1;
  <D.19306>:
  i.39 = (unsigned int) i;
  D.20763 = image->module_count;
  if (i.39 < D.20763) goto <D.19305>; else goto <D.19307>;
  <D.19307>:
  D.20757 = image->modules;
  if (D.20757 != 0B) goto <D.20764>; else goto <D.20765>;
  <D.20764>:
  D.20757 = image->modules;
  monoeg_g_free (D.20757);
  <D.20765>:
  D.20766 = image->mempool;
  D.20767 = mono_mempool_get_allocated (D.20766);
  mono_perfcounters.40 = mono_perfcounters;
  mono_perfcounters.40 = mono_perfcounters;
  D.20769 = mono_perfcounters.40->loader_bytes;
  D.20770 = D.20769 - D.20767;
  mono_perfcounters.40->loader_bytes = D.20770;
  D.20745 = BIT_FIELD_REF <*image, 64, 192>;
  D.20746 = D.20745 & 34359738368;
  if (D.20746 == 0) goto <D.20771>; else goto <D.20772>;
  <D.20771>:
  debug_assembly_unload.41 = debug_assembly_unload;
  if (debug_assembly_unload.41 != 0) goto <D.20774>; else goto <D.20775>;
  <D.20774>:
  D.20766 = image->mempool;
  mono_mempool_invalidate (D.20766);
  goto <D.20776>;
  <D.20775>:
  D.20766 = image->mempool;
  mono_mempool_destroy (D.20766);
  monoeg_g_free (image);
  <D.20776>:
  goto <D.20777>;
  <D.20772>:
  debug_assembly_unload.41 = debug_assembly_unload;
  if (debug_assembly_unload.41 != 0) goto <D.20778>; else goto <D.20779>;
  <D.20778>:
  D.20766 = image->mempool;
  mono_mempool_invalidate (D.20766);
  goto <D.20780>;
  <D.20779>:
  D.20766 = image->mempool;
  mono_mempool_destroy (D.20766);
  <D.20780>:
  <D.20777>:
}


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

  D.20781 = mono_image_close_except_pools (image);
  if (D.20781 != 0) goto <D.20782>; else goto <D.20783>;
  <D.20782>:
  mono_image_close_finish (image);
  <D.20783>:
}


mono_image_strerror (MonoImageOpenStatus status)
{
  const char * D.20784;
  int * D.20785;
  int D.20786;

  switch (status) <default: <D.20787>, case 0: <D.19314>, case 1: <D.19315>, case 2: <D.19317>, case 3: <D.19316>>
  <D.19314>:
  D.20784 = "success";
  return D.20784;
  <D.19315>:
  D.20785 = __errno_location ();
  D.20786 = *D.20785;
  D.20784 = strerror (D.20786);
  return D.20784;
  <D.19316>:
  D.20784 = "File does not contain a valid CIL image";
  return D.20784;
  <D.19317>:
  D.20784 = "An assembly was referenced, but could not be found";
  return D.20784;
  <D.20787>:
  D.20784 = "Internal error";
  return D.20784;
}


mono_image_lookup_resource (struct MonoImage * image, guint32 res_id, guint32 lang_id, gunichar2 * name)
{
  void * D.20791;
  unsigned int D.20800;
  short unsigned int D.20803;
  int D.20804;
  short unsigned int D.20805;
  int D.20806;
  int D.20807;
  long unsigned int D.20808;
  long unsigned int D.20809;
  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.20789>; else goto <D.20790>;
  <D.20789>:
  D.20791 = 0B;
  return D.20791;
  <D.20790>:
  mono_image_ensure_section_idx (image, 1);
  info = image->image_info;
  if (info == 0B) goto <D.20792>; else goto <D.20793>;
  <D.20792>:
  D.20791 = 0B;
  return D.20791;
  <D.20793>:
  header = &info->cli_header;
  if (header == 0B) goto <D.20794>; else goto <D.20795>;
  <D.20794>:
  D.20791 = 0B;
  return D.20791;
  <D.20795>:
  datadir = &header->datadir;
  if (datadir == 0B) goto <D.20796>; else goto <D.20797>;
  <D.20796>:
  D.20791 = 0B;
  return D.20791;
  <D.20797>:
  rsrc = &datadir->pe_resource_table;
  if (rsrc == 0B) goto <D.20798>; else goto <D.20799>;
  <D.20798>:
  D.20791 = 0B;
  return D.20791;
  <D.20799>:
  D.20800 = rsrc->rva;
  resource_dir = mono_image_rva_map (image, D.20800);
  if (resource_dir == 0B) goto <D.20801>; else goto <D.20802>;
  <D.20801>:
  D.20791 = 0B;
  return D.20791;
  <D.20802>:
  D.20803 = resource_dir->res_named_entries;
  D.20804 = (int) D.20803;
  D.20805 = resource_dir->res_id_entries;
  D.20806 = (int) D.20805;
  D.20807 = D.20804 + D.20806;
  entries = (guint32) D.20807;
  res_entries = resource_dir + 16;
  i = 0;
  goto <D.19359>;
  <D.19358>:
  {
    struct MonoPEResourceDirEntry * entry;
    void * ret;

    D.20808 = (long unsigned int) i;
    D.20809 = D.20808 * 8;
    entry = res_entries + D.20809;
    ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, entry, resource_dir, 0);
    if (ret != 0B) goto <D.20810>; else goto <D.20811>;
    <D.20810>:
    D.20791 = ret;
    return D.20791;
    <D.20811>:
  }
  i = i + 1;
  <D.19359>:
  if (i < entries) goto <D.19358>; else goto <D.19360>;
  <D.19360>:
  D.20791 = 0B;
  return D.20791;
}


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.20813;
  unsigned int D.20814;
  unsigned int D.20815;
  unsigned int D.20816;
  void * D.20821;
  sizetype D.20838;
  short unsigned int D.20839;
  int D.20840;
  short unsigned int D.20841;
  int D.20842;
  int D.20843;
  long unsigned int D.20844;
  long unsigned int D.20845;
  unsigned int D.20846;
  unsigned int D.20849;
  unsigned int D.20850;
  unsigned int D.20851;
  unsigned int D.20852;
  gboolean is_string;
  gboolean is_dir;
  guint32 name_offset;
  guint32 dir_offset;

  D.20813 = entry->name;
  D.20814 = D.20813 >> 31;
  is_string = (gboolean) D.20814;
  D.20813 = entry->name;
  name_offset = D.20813 & 2147483647;
  D.20815 = entry->dir;
  D.20816 = D.20815 >> 31;
  is_dir = (gboolean) D.20816;
  D.20815 = entry->dir;
  dir_offset = D.20815 & 2147483647;
  if (level == 0) goto <D.20817>; else goto <D.20818>;
  <D.20817>:
  if (is_string != 0) goto <D.20819>; else goto <D.20820>;
  <D.20819>:
  D.20821 = 0B;
  return D.20821;
  <D.20820>:
  goto <D.20822>;
  <D.20818>:
  if (level == 1) goto <D.20823>; else goto <D.20824>;
  <D.20823>:
  if (res_id != name_offset) goto <D.20825>; else goto <D.20826>;
  <D.20825>:
  D.20821 = 0B;
  return D.20821;
  <D.20826>:
  goto <D.20827>;
  <D.20824>:
  if (level == 2) goto <D.20828>; else goto <D.20829>;
  <D.20828>:
  if (is_string == 1) goto <D.20830>; else goto <D.20832>;
  <D.20832>:
  if (is_string == 0) goto <D.20833>; else goto <D.20831>;
  <D.20833>:
  if (lang_id != 0) goto <D.20834>; else goto <D.20831>;
  <D.20834>:
  if (name_offset != lang_id) goto <D.20830>; else goto <D.20831>;
  <D.20830>:
  D.20821 = 0B;
  return D.20821;
  <D.20831>:
  goto <D.20835>;
  <D.20829>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image.c", 1829);
  <D.20835>:
  <D.20827>:
  <D.20822>:
  if (is_dir == 1) goto <D.20836>; else goto <D.20837>;
  <D.20836>:
  {
    struct MonoPEResourceDir * res_dir;
    struct MonoPEResourceDirEntry * sub_entries;
    guint32 entries;
    guint32 i;

    D.20838 = (sizetype) dir_offset;
    res_dir = root + D.20838;
    sub_entries = res_dir + 16;
    D.20839 = res_dir->res_named_entries;
    D.20840 = (int) D.20839;
    D.20841 = res_dir->res_id_entries;
    D.20842 = (int) D.20841;
    D.20843 = D.20840 + D.20842;
    entries = (guint32) D.20843;
    i = 0;
    goto <D.19338>;
    <D.19337>:
    {
      struct MonoPEResourceDirEntry * sub_entry;
      void * ret;

      D.20844 = (long unsigned int) i;
      D.20845 = D.20844 * 8;
      sub_entry = sub_entries + D.20845;
      D.20846 = level + 1;
      ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, sub_entry, root, D.20846);
      if (ret != 0B) goto <D.20847>; else goto <D.20848>;
      <D.20847>:
      D.20821 = ret;
      return D.20821;
      <D.20848>:
    }
    i = i + 1;
    <D.19338>:
    if (i < entries) goto <D.19337>; else goto <D.19339>;
    <D.19339>:
    D.20821 = 0B;
    return D.20821;
  }
  <D.20837>:
  {
    struct MonoPEResourceDataEntry * data_entry;
    struct MonoPEResourceDataEntry * res;

    D.20838 = (sizetype) dir_offset;
    data_entry = root + D.20838;
    res = monoeg_malloc0 (16);
    D.20849 = data_entry->rde_data_offset;
    res->rde_data_offset = D.20849;
    D.20850 = data_entry->rde_size;
    res->rde_size = D.20850;
    D.20851 = data_entry->rde_codepage;
    res->rde_codepage = D.20851;
    D.20852 = data_entry->rde_reserved;
    res->rde_reserved = D.20852;
    D.20821 = res;
    return D.20821;
  }
}


mono_image_get_entry_point (struct MonoImage * image)
{
  uint32_t D.20854;
  void * D.20855;

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


mono_image_get_resource (struct MonoImage * image, guint32 offset, guint32 * size)
{
  unsigned int D.20859;
  unsigned int D.20861;
  unsigned int D.20862;
  const char * D.20863;
  sizetype D.20866;
  unsigned int D.20869;
  struct MonoCLIImageInfo * iinfo;
  struct MonoCLIHeader * ch;
  const char * data;

  iinfo = image->image_info;
  ch = &iinfo->cli_cli_header;
  D.20859 = ch->ch_resources.rva;
  if (D.20859 == 0) goto <D.20857>; else goto <D.20860>;
  <D.20860>:
  D.20861 = offset + 4;
  D.20862 = ch->ch_resources.size;
  if (D.20861 > D.20862) goto <D.20857>; else goto <D.20858>;
  <D.20857>:
  D.20863 = 0B;
  return D.20863;
  <D.20858>:
  D.20859 = ch->ch_resources.rva;
  data = mono_image_rva_map (image, D.20859);
  if (data == 0B) goto <D.20864>; else goto <D.20865>;
  <D.20864>:
  D.20863 = 0B;
  return D.20863;
  <D.20865>:
  D.20866 = (sizetype) offset;
  data = data + D.20866;
  if (size != 0B) goto <D.20867>; else goto <D.20868>;
  <D.20867>:
  D.20869 = MEM[(const guint32 *)data];
  *size = D.20869;
  <D.20868>:
  data = data + 4;
  D.20863 = data;
  return D.20863;
}


mono_image_load_file_for_image (struct MonoImage * image, int fileidx)
{
  <unnamed-unsigned:24> D.20874;
  int D.20875;
  struct MonoImage * D.20876;
  struct MonoImage * * D.20877;
  long unsigned int D.20880;
  long unsigned int D.20881;
  sizetype D.20882;
  struct MonoImage * * D.20883;
  struct MonoImage * D.20884;
  long unsigned int D.20889;
  long unsigned int D.20890;
  void * D.20891;
  int D.20892;
  char * D.20893;
  struct MonoAssembly * D.20896;
  struct MonoImage * * D.20897;
  long unsigned int D.20898;
  long unsigned int D.20899;
  struct MonoImage * * D.20900;
  struct MonoImage * D.20901;
  struct MonoAssembly * D.20904;
  unsigned int i.42;
  unsigned int D.20908;
  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.20871>; else goto <D.20873>;
  <D.20873>:
  D.20874 = t->rows;
  D.20875 = (int) D.20874;
  if (D.20875 < fileidx) goto <D.20871>; else goto <D.20872>;
  <D.20871>:
  D.20876 = 0B;
  return D.20876;
  <D.20872>:
  mono_loader_lock ();
  D.20877 = image->files;
  if (D.20877 != 0B) goto <D.20878>; else goto <D.20879>;
  <D.20878>:
  D.20877 = image->files;
  D.20880 = (long unsigned int) fileidx;
  D.20881 = D.20880 * 8;
  D.20882 = D.20881 + 18446744073709551608;
  D.20883 = D.20877 + D.20882;
  D.20884 = *D.20883;
  if (D.20884 != 0B) goto <D.20885>; else goto <D.20886>;
  <D.20885>:
  mono_loader_unlock ();
  D.20877 = image->files;
  D.20880 = (long unsigned int) fileidx;
  D.20881 = D.20880 * 8;
  D.20882 = D.20881 + 18446744073709551608;
  D.20883 = D.20877 + D.20882;
  D.20876 = *D.20883;
  return D.20876;
  <D.20886>:
  <D.20879>:
  D.20877 = image->files;
  if (D.20877 == 0B) goto <D.20887>; else goto <D.20888>;
  <D.20887>:
  D.20874 = t->rows;
  D.20889 = (long unsigned int) D.20874;
  D.20890 = D.20889 * 8;
  D.20891 = monoeg_malloc0 (D.20890);
  image->files = D.20891;
  <D.20888>:
  D.20892 = fileidx + -1;
  fname_id = mono_metadata_decode_row_col (t, D.20892, 1);
  fname = mono_metadata_string_heap (image, fname_id);
  D.20893 = image->name;
  base_dir = monoeg_g_path_get_dirname (D.20893);
  name = monoeg_g_build_path ("/", base_dir, fname, 0B);
  res = mono_image_open (name, 0B);
  if (res != 0B) goto <D.20894>; else goto <D.20895>;
  <D.20894>:
  {
    int i;

    D.20896 = image->assembly;
    res->assembly = D.20896;
    i = 0;
    goto <D.19384>;
    <D.19383>:
    D.20897 = res->modules;
    D.20898 = (long unsigned int) i;
    D.20899 = D.20898 * 8;
    D.20900 = D.20897 + D.20899;
    D.20901 = *D.20900;
    if (D.20901 != 0B) goto <D.20902>; else goto <D.20903>;
    <D.20902>:
    D.20897 = res->modules;
    D.20898 = (long unsigned int) i;
    D.20899 = D.20898 * 8;
    D.20900 = D.20897 + D.20899;
    D.20901 = *D.20900;
    D.20904 = D.20901->assembly;
    if (D.20904 == 0B) goto <D.20905>; else goto <D.20906>;
    <D.20905>:
    D.20897 = res->modules;
    D.20898 = (long unsigned int) i;
    D.20899 = D.20898 * 8;
    D.20900 = D.20897 + D.20899;
    D.20901 = *D.20900;
    D.20896 = image->assembly;
    D.20901->assembly = D.20896;
    <D.20906>:
    <D.20903>:
    i = i + 1;
    <D.19384>:
    i.42 = (unsigned int) i;
    D.20908 = res->module_count;
    if (i.42 < D.20908) goto <D.19383>; else goto <D.19385>;
    <D.19385>:
    D.20877 = image->files;
    D.20880 = (long unsigned int) fileidx;
    D.20881 = D.20880 * 8;
    D.20882 = D.20881 + 18446744073709551608;
    D.20883 = D.20877 + D.20882;
    *D.20883 = res;
  }
  <D.20895>:
  mono_loader_unlock ();
  monoeg_g_free (name);
  monoeg_g_free (base_dir);
  D.20876 = res;
  return D.20876;
}


mono_image_get_strong_name (struct MonoImage * image, guint32 * size)
{
  unsigned int D.20912;
  unsigned int D.20914;
  const char * D.20915;
  struct MonoCLIImageInfo * iinfo;
  struct MonoPEDirEntry * de;
  const char * data;

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  D.20912 = de->size;
  if (D.20912 == 0) goto <D.20910>; else goto <D.20913>;
  <D.20913>:
  D.20914 = de->rva;
  if (D.20914 == 0) goto <D.20910>; else goto <D.20911>;
  <D.20910>:
  D.20915 = 0B;
  return D.20915;
  <D.20911>:
  D.20914 = de->rva;
  data = mono_image_rva_map (image, D.20914);
  if (data == 0B) goto <D.20916>; else goto <D.20917>;
  <D.20916>:
  D.20915 = 0B;
  return D.20915;
  <D.20917>:
  if (size != 0B) goto <D.20918>; else goto <D.20919>;
  <D.20918>:
  D.20912 = de->size;
  *size = D.20912;
  <D.20919>:
  D.20915 = data;
  return D.20915;
}


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

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  if (size != 0B) goto <D.20921>; else goto <D.20922>;
  <D.20921>:
  D.20923 = de->size;
  *size = D.20923;
  <D.20922>:
  D.20923 = de->size;
  if (D.20923 == 0) goto <D.20924>; else goto <D.20926>;
  <D.20926>:
  D.20927 = de->rva;
  if (D.20927 == 0) goto <D.20924>; else goto <D.20925>;
  <D.20924>:
  D.20928 = 0;
  return D.20928;
  <D.20925>:
  D.20927 = de->rva;
  pos = mono_cli_rva_image_map (image, D.20927);
  if (pos != 4294967295) goto <D.20930>; else goto <D.20931>;
  <D.20930>:
  iftmp.43 = pos;
  goto <D.20932>;
  <D.20931>:
  iftmp.43 = 0;
  <D.20932>:
  D.20928 = iftmp.43;
  return D.20928;
}


mono_image_get_public_key (struct MonoImage * image, guint32 * size)
{
  long unsigned int D.20934;
  long unsigned int D.20935;
  int D.20940;
  unsigned int D.20941;
  const char * D.20942;
  long unsigned int D.20943;
  long unsigned int D.20944;
  struct MonoTableInfo * D.20947;
  const char * pubkey.44;
  const char * pubkey.45;
  const char * pubkey;
  guint32 len;
  guint32 tok;

  try
    {
      D.20934 = BIT_FIELD_REF <*image, 64, 192>;
      D.20935 = D.20934 & 34359738368;
      if (D.20935 != 0) goto <D.20936>; else goto <D.20937>;
      <D.20936>:
      if (size != 0B) goto <D.20938>; else goto <D.20939>;
      <D.20938>:
      D.20940 = MEM[(struct MonoDynamicImage *)image].public_key_len;
      D.20941 = (unsigned int) D.20940;
      *size = D.20941;
      <D.20939>:
      D.20942 = MEM[(struct MonoDynamicImage *)image].public_key;
      return D.20942;
      <D.20937>:
      D.20943 = BIT_FIELD_REF <*image, 64, 5696>;
      D.20944 = D.20943 & 16777215;
      if (D.20944 != 1) goto <D.20945>; else goto <D.20946>;
      <D.20945>:
      D.20942 = 0B;
      return D.20942;
      <D.20946>:
      D.20947 = &image->tables[32];
      tok = mono_metadata_decode_row_col (D.20947, 0, 6);
      if (tok == 0) goto <D.20948>; else goto <D.20949>;
      <D.20948>:
      D.20942 = 0B;
      return D.20942;
      <D.20949>:
      pubkey.44 = mono_metadata_blob_heap (image, tok);
      pubkey = pubkey.44;
      pubkey.45 = pubkey;
      len = mono_metadata_decode_blob_size (pubkey.45, &pubkey);
      if (size != 0B) goto <D.20952>; else goto <D.20953>;
      <D.20952>:
      *size = len;
      <D.20953>:
      D.20942 = pubkey;
      return D.20942;
    }
  finally
    {
      pubkey = {CLOBBER};
    }
}


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

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


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

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


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

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


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

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


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

  table_id.47 = (unsigned int) table_id;
  if (table_id.47 > 44) goto <D.20968>; else goto <D.20969>;
  <D.20968>:
  D.20970 = 0;
  return D.20970;
  <D.20969>:
  D.20971 = image->tables[table_id].rows;
  D.20970 = (int) D.20971;
  return D.20970;
}


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

  D.20974 = table->rows;
  D.20973 = (int) D.20974;
  return D.20973;
}


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

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


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

  D.20979 = image->dynamic;
  D.20978 = (mono_bool) D.20979;
  return D.20978;
}


mono_image_has_authenticode_entry (struct MonoImage * image)
{
  mono_bool D.20981;
  int iftmp.48;
  unsigned int D.20985;
  unsigned int D.20987;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoPEDirEntry * de;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  de = &header->datadir.pe_certificate_table;
  D.20985 = de->rva;
  if (D.20985 != 0) goto <D.20986>; else goto <D.20983>;
  <D.20986>:
  D.20987 = de->size;
  if (D.20987 > 8) goto <D.20988>; else goto <D.20983>;
  <D.20988>:
  iftmp.48 = 1;
  goto <D.20984>;
  <D.20983>:
  iftmp.48 = 0;
  <D.20984>:
  D.20981 = iftmp.48;
  return D.20981;
}


mono_image_alloc (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.49;
  unsigned int D.20991;
  unsigned int D.20992;
  struct MonoMemPool * D.20993;
  void * D.20994;
  void * res;

  mono_perfcounters.49 = mono_perfcounters;
  mono_perfcounters.49 = mono_perfcounters;
  D.20991 = mono_perfcounters.49->loader_bytes;
  D.20992 = D.20991 + size;
  mono_perfcounters.49->loader_bytes = D.20992;
  mono_image_lock (image);
  D.20993 = image->mempool;
  res = mono_mempool_alloc (D.20993, size);
  mono_image_unlock (image);
  D.20994 = res;
  return D.20994;
}


mono_image_alloc0 (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.50;
  unsigned int D.20997;
  unsigned int D.20998;
  struct MonoMemPool * D.20999;
  void * D.21000;
  void * res;

  mono_perfcounters.50 = mono_perfcounters;
  mono_perfcounters.50 = mono_perfcounters;
  D.20997 = mono_perfcounters.50->loader_bytes;
  D.20998 = D.20997 + size;
  mono_perfcounters.50->loader_bytes = D.20998;
  mono_image_lock (image);
  D.20999 = image->mempool;
  res = mono_mempool_alloc0 (D.20999, size);
  mono_image_unlock (image);
  D.21000 = res;
  return D.21000;
}


mono_image_strdup (struct MonoImage * image, const char * s)
{
  struct MonoPerfCounters * mono_perfcounters.51;
  unsigned int D.21003;
  long unsigned int D.21004;
  unsigned int D.21005;
  unsigned int D.21006;
  struct MonoMemPool * D.21007;
  char * D.21008;
  char * res;

  mono_perfcounters.51 = mono_perfcounters;
  mono_perfcounters.51 = mono_perfcounters;
  D.21003 = mono_perfcounters.51->loader_bytes;
  D.21004 = strlen (s);
  D.21005 = (unsigned int) D.21004;
  D.21006 = D.21003 + D.21005;
  mono_perfcounters.51->loader_bytes = D.21006;
  mono_image_lock (image);
  D.21007 = image->mempool;
  res = mono_mempool_strdup (D.21007, s);
  mono_image_unlock (image);
  D.21008 = res;
  return D.21008;
}


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

  new_list = mono_image_alloc (image, 24);
  new_list->data = data;
  if (list != 0B) goto <D.21011>; else goto <D.21012>;
  <D.21011>:
  iftmp.52 = list->prev;
  goto <D.21013>;
  <D.21012>:
  iftmp.52 = 0B;
  <D.21013>:
  new_list->prev = iftmp.52;
  new_list->next = list;
  D.21014 = new_list->prev;
  if (D.21014 != 0B) goto <D.21015>; else goto <D.21016>;
  <D.21015>:
  D.21014 = new_list->prev;
  D.21014->next = new_list;
  <D.21016>:
  if (list != 0B) goto <D.21017>; else goto <D.21018>;
  <D.21017>:
  list->prev = new_list;
  <D.21018>:
  D.21019 = new_list;
  return D.21019;
}


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

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


mono_image_lock (struct MonoImage * image)
{
  union mono_mutex_t * D.21023;
  _Bool D.21026;
  long int D.21027;
  long int D.21028;

  {
    int ret;

    D.21023 = &image->lock.mutex;
    ret = pthread_mutex_lock (D.21023);
    if (ret != 0) goto <D.21024>; else goto <D.21025>;
    <D.21024>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21025>:
    D.21026 = ret != 0;
    D.21027 = (long int) D.21026;
    D.21028 = __builtin_expect (D.21027, 0);
    if (D.21028 != 0) goto <D.21029>; else goto <D.21030>;
    <D.21029>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2304, "ret == 0");
    <D.21030>:
  }
}


mono_image_unlock (struct MonoImage * image)
{
  union mono_mutex_t * D.21031;
  _Bool D.21034;
  long int D.21035;
  long int D.21036;

  {
    int ret;

    D.21031 = &image->lock.mutex;
    ret = pthread_mutex_unlock (D.21031);
    if (ret != 0) goto <D.21032>; else goto <D.21033>;
    <D.21032>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21033>:
    D.21034 = ret != 0;
    D.21035 = (long int) D.21034;
    D.21036 = __builtin_expect (D.21035, 0);
    if (D.21036 != 0) goto <D.21037>; else goto <D.21038>;
    <D.21037>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2310, "ret == 0");
    <D.21038>:
  }
}


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

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


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

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


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

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


mono_image_append_class_to_reflection_info_set (struct MonoClass * class)
{
  long unsigned int D.21044;
  long unsigned int D.21045;
  _Bool D.21046;
  long int D.21047;
  long int D.21048;
  struct MonoMemPool * D.21051;
  struct GSList * D.21052;
  struct GSList * D.21053;
  struct MonoImage * image;

  image = class->image;
  D.21044 = BIT_FIELD_REF <*image, 64, 192>;
  D.21045 = D.21044 & 34359738368;
  D.21046 = D.21045 == 0;
  D.21047 = (long int) D.21046;
  D.21048 = __builtin_expect (D.21047, 0);
  if (D.21048 != 0) goto <D.21049>; else goto <D.21050>;
  <D.21049>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2367, "image->dynamic");
  <D.21050>:
  mono_image_lock (image);
  D.21051 = image->mempool;
  D.21052 = image->reflection_info_unregister_classes;
  D.21053 = g_slist_prepend_mempool (D.21051, D.21052, class);
  image->reflection_info_unregister_classes = D.21053;
  mono_image_unlock (image);
}


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

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


