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


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

  l = image_unload_hooks;
  goto <D.20530>;
  <D.20529>:
  hook = l->data;
  D.21175 = hook->func;
  if (D.21175 == func) goto <D.21176>; else goto <D.21177>;
  <D.21176>:
  D.21178 = hook->user_data;
  if (D.21178 == user_data) goto <D.21179>; else goto <D.21180>;
  <D.21179>:
  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.20528>;
  <D.21180>:
  <D.21177>:
  l = l->next;
  <D.20530>:
  if (l != 0B) goto <D.20529>; else goto <D.20528>;
  <D.20528>:
}


mono_cli_rva_image_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.21183;
  unsigned int D.21186;
  unsigned int D.21187;
  guint32 D.21190;
  unsigned int D.21191;
  unsigned int D.21192;
  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.20548>;
  <D.20547>:
  D.21183 = tables->st_virtual_address;
  if (D.21183 <= addr) goto <D.21184>; else goto <D.21185>;
  <D.21184>:
  D.21183 = tables->st_virtual_address;
  D.21186 = tables->st_raw_data_size;
  D.21187 = D.21183 + D.21186;
  if (D.21187 > addr) goto <D.21188>; else goto <D.21189>;
  <D.21188>:
  D.21183 = tables->st_virtual_address;
  D.21191 = addr - D.21183;
  D.21192 = tables->st_raw_data_ptr;
  D.21190 = D.21191 + D.21192;
  return D.21190;
  <D.21189>:
  <D.21185>:
  tables = tables + 40;
  i = i + 1;
  <D.20548>:
  if (i < top) goto <D.20547>; else goto <D.20549>;
  <D.20549>:
  D.21190 = 4294967295;
  return D.21190;
}


mono_image_rva_map (struct MonoImage * image, guint32 addr)
{
  unsigned int D.21194;
  unsigned int D.21197;
  unsigned int D.21198;
  void * * D.21201;
  unsigned int i.4;
  unsigned int D.21203;
  void * * D.21204;
  void * D.21205;
  int D.21208;
  char * D.21211;
  unsigned int D.21212;
  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.20559>;
  <D.20558>:
  D.21194 = tables->st_virtual_address;
  if (D.21194 <= addr) goto <D.21195>; else goto <D.21196>;
  <D.21195>:
  D.21194 = tables->st_virtual_address;
  D.21197 = tables->st_raw_data_size;
  D.21198 = D.21194 + D.21197;
  if (D.21198 > addr) goto <D.21199>; else goto <D.21200>;
  <D.21199>:
  D.21201 = iinfo->cli_sections;
  i.4 = (unsigned int) i;
  D.21203 = i.4 * 4;
  D.21204 = D.21201 + D.21203;
  D.21205 = *D.21204;
  if (D.21205 == 0B) goto <D.21206>; else goto <D.21207>;
  <D.21206>:
  D.21208 = mono_image_ensure_section_idx (image, i);
  if (D.21208 == 0) goto <D.21209>; else goto <D.21210>;
  <D.21209>:
  D.21211 = 0B;
  return D.21211;
  <D.21210>:
  <D.21207>:
  D.21201 = iinfo->cli_sections;
  i.4 = (unsigned int) i;
  D.21203 = i.4 * 4;
  D.21204 = D.21201 + D.21203;
  D.21205 = *D.21204;
  D.21194 = tables->st_virtual_address;
  D.21212 = addr - D.21194;
  D.21211 = D.21205 + D.21212;
  return D.21211;
  <D.21200>:
  <D.21196>:
  tables = tables + 40;
  i = i + 1;
  <D.20559>:
  if (i < top) goto <D.20558>; else goto <D.20560>;
  <D.20560>:
  D.21211 = 0B;
  return D.21211;
}


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

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


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

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


mono_image_ensure_section_idx (struct MonoImage * image, int section)
{
  int D.21224;
  int D.21227;
  void * * D.21228;
  unsigned int section.11;
  unsigned int D.21230;
  void * * D.21231;
  void * D.21232;
  struct MonoSectionTable * D.21235;
  unsigned int D.21236;
  unsigned int D.21237;
  int D.21238;
  unsigned int D.21239;
  unsigned int D.21240;
  unsigned int D.21241;
  unsigned int D.21242;
  char * D.21245;
  void * D.21246;
  struct MonoCLIImageInfo * iinfo;
  struct MonoSectionTable * sect;
  gboolean writable;

  iinfo = image->image_info;
  D.21224 = iinfo->cli_section_count;
  if (D.21224 <= section) goto <D.21225>; else goto <D.21226>;
  <D.21225>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 237, "section < iinfo->cli_section_count");
  D.21227 = 0;
  return D.21227;
  <D.21226>:
  D.21228 = iinfo->cli_sections;
  section.11 = (unsigned int) section;
  D.21230 = section.11 * 4;
  D.21231 = D.21228 + D.21230;
  D.21232 = *D.21231;
  if (D.21232 != 0B) goto <D.21233>; else goto <D.21234>;
  <D.21233>:
  D.21227 = 1;
  return D.21227;
  <D.21234>:
  D.21235 = iinfo->cli_section_tables;
  section.11 = (unsigned int) section;
  D.21236 = section.11 * 40;
  sect = D.21235 + D.21236;
  D.21237 = sect->st_flags;
  D.21238 = (int) D.21237;
  writable = D.21238 & -2147483648;
  D.21239 = sect->st_raw_data_ptr;
  D.21240 = sect->st_raw_data_size;
  D.21241 = D.21239 + D.21240;
  D.21242 = image->raw_data_len;
  if (D.21241 > D.21242) goto <D.21243>; else goto <D.21244>;
  <D.21243>:
  D.21227 = 0;
  return D.21227;
  <D.21244>:
  D.21228 = iinfo->cli_sections;
  section.11 = (unsigned int) section;
  D.21230 = section.11 * 4;
  D.21231 = D.21228 + D.21230;
  D.21245 = image->raw_data;
  D.21239 = sect->st_raw_data_ptr;
  D.21246 = D.21245 + D.21239;
  *D.21231 = D.21246;
  D.21227 = 1;
  return D.21227;
}


mono_image_ensure_section (struct MonoImage * image, const char * section)
{
  struct MonoSectionTable * D.21248;
  unsigned int i.12;
  unsigned int D.21250;
  struct MonoSectionTable * D.21251;
  char[8] * D.21252;
  int D.21253;
  int D.21256;
  int D.21257;
  struct MonoCLIImageInfo * ii;
  int i;

  ii = image->image_info;
  i = 0;
  goto <D.20596>;
  <D.20595>:
  D.21248 = ii->cli_section_tables;
  i.12 = (unsigned int) i;
  D.21250 = i.12 * 40;
  D.21251 = D.21248 + D.21250;
  D.21252 = &D.21251->st_name;
  D.21253 = strncmp (D.21252, section, 8);
  if (D.21253 != 0) goto <D.21254>; else goto <D.21255>;
  <D.21254>:
  // predicted unlikely by continue predictor.
  goto <D.20594>;
  <D.21255>:
  D.21256 = mono_image_ensure_section_idx (image, i);
  return D.21256;
  <D.20594>:
  i = i + 1;
  <D.20596>:
  D.21257 = ii->cli_section_count;
  if (D.21257 > i) goto <D.20595>; else goto <D.20597>;
  <D.20597>:
  D.21256 = 0;
  return D.21256;
}


mono_image_check_for_module_cctor (struct MonoImage * image)
{
  unsigned char D.21259;
  unsigned char D.21260;
  <unnamed-unsigned:24> D.21263;
  int D.21264;
  int D.20724;
  int iftmp.13;
  int D.20723;
  const char[9] * D.21270;
  unsigned char D.21271;
  int D.21272;
  unsigned char D.21273;
  int D.21274;
  _Bool D.21275;
  _Bool D.21276;
  _Bool D.21277;
  const unsigned char * D.21280;
  unsigned char D.21281;
  int D.21282;
  const unsigned char * D.21283;
  unsigned char D.21284;
  int D.21285;
  _Bool D.21286;
  _Bool D.21287;
  const unsigned char * D.21290;
  unsigned char D.21291;
  int D.21292;
  const unsigned char * D.21293;
  unsigned char D.21294;
  int D.21295;
  _Bool D.21296;
  _Bool D.21297;
  const unsigned char * D.21300;
  unsigned char D.21301;
  int D.21302;
  const unsigned char * D.21303;
  unsigned char D.21304;
  int D.21305;
  unsigned int D.21309;
  unsigned int D.21312;
  <unnamed-unsigned:24> D.21314;
  int first_method.14;
  int D.20735;
  int iftmp.15;
  int D.20734;
  const char[7] * D.21319;
  unsigned char D.21320;
  int D.21321;
  unsigned char D.21322;
  int D.21323;
  _Bool D.21324;
  _Bool D.21325;
  _Bool D.21326;
  const unsigned char * D.21329;
  unsigned char D.21330;
  int D.21331;
  const unsigned char * D.21332;
  unsigned char D.21333;
  int D.21334;
  _Bool D.21335;
  _Bool D.21336;
  const unsigned char * D.21339;
  unsigned char D.21340;
  int D.21341;
  const unsigned char * D.21342;
  unsigned char D.21343;
  int D.21344;
  _Bool D.21345;
  _Bool D.21346;
  const unsigned char * D.21349;
  unsigned char D.21350;
  int D.21351;
  const unsigned char * D.21352;
  unsigned char D.21353;
  int D.21354;
  struct MonoTableInfo * t;
  struct MonoTableInfo * mt;

  t = &image->tables[2];
  mt = &image->tables[6];
  D.21259 = BIT_FIELD_REF <*image, 8, 128>;
  D.21260 = D.21259 & 8;
  if (D.21260 != 0) goto <D.21261>; else goto <D.21262>;
  <D.21261>:
  image->checked_module_cctor = 1;
  return;
  <D.21262>:
  D.21263 = t->rows;
  D.21264 = (int) D.21263;
  if (D.21264 > 0) goto <D.21265>; else goto <D.21266>;
  <D.21265>:
  {
    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.21268>; else goto <D.21269>;
      <D.21268>:
      {
        const unsigned char * __s2;
        int __result;

        __s2 = name;
        D.21270 = "<Module>";
        D.21271 = MEM[(const unsigned char *)D.21270];
        D.21272 = (int) D.21271;
        D.21273 = *__s2;
        D.21274 = (int) D.21273;
        __result = D.21272 - D.21274;
        {
          D.21275 = __s2_len != 0;
          D.21276 = __result == 0;
          D.21277 = D.21275 & D.21276;
          if (D.21277 != 0) goto <D.21278>; else goto <D.21279>;
          <D.21278>:
          D.21280 = &MEM[(void *)"<Module>" + 1B];
          D.21281 = *D.21280;
          D.21282 = (int) D.21281;
          D.21283 = __s2 + 1;
          D.21284 = *D.21283;
          D.21285 = (int) D.21284;
          __result = D.21282 - D.21285;
          D.21286 = __s2_len > 1;
          D.21276 = __result == 0;
          D.21287 = D.21286 & D.21276;
          if (D.21287 != 0) goto <D.21288>; else goto <D.21289>;
          <D.21288>:
          D.21290 = &MEM[(void *)"<Module>" + 2B];
          D.21291 = *D.21290;
          D.21292 = (int) D.21291;
          D.21293 = __s2 + 2;
          D.21294 = *D.21293;
          D.21295 = (int) D.21294;
          __result = D.21292 - D.21295;
          D.21296 = __s2_len > 2;
          D.21276 = __result == 0;
          D.21297 = D.21296 & D.21276;
          if (D.21297 != 0) goto <D.21298>; else goto <D.21299>;
          <D.21298>:
          D.21300 = &MEM[(void *)"<Module>" + 3B];
          D.21301 = *D.21300;
          D.21302 = (int) D.21301;
          D.21303 = __s2 + 3;
          D.21304 = *D.21303;
          D.21305 = (int) D.21304;
          __result = D.21302 - D.21305;
          <D.21299>:
          <D.21289>:
          <D.21279>:
        }
        D.20723 = __result;
      }
      iftmp.13 = -D.20723;
      goto <D.21306>;
      <D.21269>:
      iftmp.13 = __builtin_strcmp (name, "<Module>");
      <D.21306>:
      D.20724 = iftmp.13;
    }
    if (D.20724 == 0) goto <D.21307>; else goto <D.21308>;
    <D.21307>:
    {
      guint32 first_method;
      guint32 last_method;

      D.21309 = mono_metadata_decode_row_col (t, 0, 5);
      first_method = D.21309 + 4294967295;
      D.21263 = t->rows;
      D.21264 = (int) D.21263;
      if (D.21264 > 1) goto <D.21310>; else goto <D.21311>;
      <D.21310>:
      D.21312 = mono_metadata_decode_row_col (t, 1, 5);
      last_method = D.21312 + 4294967295;
      goto <D.21313>;
      <D.21311>:
      D.21314 = mt->rows;
      last_method = (guint32) D.21314;
      <D.21313>:
      goto <D.20737>;
      <D.20736>:
      first_method.14 = (int) first_method;
      nameidx = mono_metadata_decode_row_col (mt, first_method.14, 3);
      name = mono_metadata_string_heap (image, nameidx);
      {
        size_t __s1_len;
        size_t __s2_len;

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

          __s2 = name;
          D.21319 = ".cctor";
          D.21320 = MEM[(const unsigned char *)D.21319];
          D.21321 = (int) D.21320;
          D.21322 = *__s2;
          D.21323 = (int) D.21322;
          __result = D.21321 - D.21323;
          {
            D.21324 = __s2_len != 0;
            D.21325 = __result == 0;
            D.21326 = D.21324 & D.21325;
            if (D.21326 != 0) goto <D.21327>; else goto <D.21328>;
            <D.21327>:
            D.21329 = &MEM[(void *)".cctor" + 1B];
            D.21330 = *D.21329;
            D.21331 = (int) D.21330;
            D.21332 = __s2 + 1;
            D.21333 = *D.21332;
            D.21334 = (int) D.21333;
            __result = D.21331 - D.21334;
            D.21335 = __s2_len > 1;
            D.21325 = __result == 0;
            D.21336 = D.21335 & D.21325;
            if (D.21336 != 0) goto <D.21337>; else goto <D.21338>;
            <D.21337>:
            D.21339 = &MEM[(void *)".cctor" + 2B];
            D.21340 = *D.21339;
            D.21341 = (int) D.21340;
            D.21342 = __s2 + 2;
            D.21343 = *D.21342;
            D.21344 = (int) D.21343;
            __result = D.21341 - D.21344;
            D.21345 = __s2_len > 2;
            D.21325 = __result == 0;
            D.21346 = D.21345 & D.21325;
            if (D.21346 != 0) goto <D.21347>; else goto <D.21348>;
            <D.21347>:
            D.21349 = &MEM[(void *)".cctor" + 3B];
            D.21350 = *D.21349;
            D.21351 = (int) D.21350;
            D.21352 = __s2 + 3;
            D.21353 = *D.21352;
            D.21354 = (int) D.21353;
            __result = D.21351 - D.21354;
            <D.21348>:
            <D.21338>:
            <D.21328>:
          }
          D.20734 = __result;
        }
        iftmp.15 = -D.20734;
        goto <D.21355>;
        <D.21318>:
        iftmp.15 = __builtin_strcmp (name, ".cctor");
        <D.21355>:
        D.20735 = iftmp.15;
      }
      if (D.20735 == 0) goto <D.21356>; else goto <D.21357>;
      <D.21356>:
      image->has_module_cctor = 1;
      image->checked_module_cctor = 1;
      return;
      <D.21357>:
      first_method = first_method + 1;
      <D.20737>:
      if (first_method < last_method) goto <D.20736>; else goto <D.20738>;
      <D.20738>:
    }
    <D.21308>:
  }
  <D.21266>:
  image->has_module_cctor = 0;
  image->checked_module_cctor = 1;
}


mono_image_load_module (struct MonoImage * image, int idx)
{
  <unnamed-unsigned:1> D.21359;
  unsigned int D.21362;
  unsigned int idx.16;
  struct MonoImage * D.21366;
  gboolean * D.21367;
  sizetype idx.17;
  sizetype D.21369;
  sizetype D.21370;
  gboolean * D.21371;
  int D.21372;
  struct MonoImage * * D.21375;
  struct MonoImage * * D.21376;
  unsigned int D.21377;
  unsigned int D.21380;
  const char * D.21381;
  <unnamed-unsigned:24> D.21382;
  int D.21383;
  char * D.21384;
  unsigned int D.21385;
  unsigned int D.21386;
  _Bool D.21387;
  int D.21388;
  unsigned int D.21389;
  int D.20772;
  void * D.21390;
  struct MonoImage * D.21395;
  struct MonoImage * D.21396;
  struct MonoAssembly * D.21399;
  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.21359 = image->ref_only;
      refonly = (gboolean) D.21359;
      valid_modules = 0B;
      D.21362 = image->module_count;
      if (D.21362 == 0) goto <D.21360>; else goto <D.21363>;
      <D.21363>:
      idx.16 = (unsigned int) idx;
      D.21362 = image->module_count;
      if (idx.16 > D.21362) goto <D.21360>; else goto <D.21365>;
      <D.21365>:
      if (idx <= 0) goto <D.21360>; else goto <D.21361>;
      <D.21360>:
      D.21366 = 0B;
      return D.21366;
      <D.21361>:
      D.21367 = image->modules_loaded;
      idx.17 = (sizetype) idx;
      D.21369 = idx.17 + 1073741823;
      D.21370 = D.21369 * 4;
      D.21371 = D.21367 + D.21370;
      D.21372 = *D.21371;
      if (D.21372 != 0) goto <D.21373>; else goto <D.21374>;
      <D.21373>:
      D.21375 = image->modules;
      idx.17 = (sizetype) idx;
      D.21369 = idx.17 + 1073741823;
      D.21370 = D.21369 * 4;
      D.21376 = D.21375 + D.21370;
      D.21366 = *D.21376;
      return D.21366;
      <D.21374>:
      file_table = &image->tables[38];
      i = 0;
      goto <D.20758>;
      <D.20757>:
      {
        guint32 cols[3];

        try
          {
            mono_metadata_decode_row (file_table, i, &cols, 3);
            D.21377 = cols[0];
            if (D.21377 == 1) goto <D.21378>; else goto <D.21379>;
            <D.21378>:
            // predicted unlikely by continue predictor.
            goto <D.20756>;
            <D.21379>:
            D.21380 = cols[1];
            D.21381 = mono_metadata_string_heap (image, D.21380);
            valid_modules = monoeg_g_list_prepend (valid_modules, D.21381);
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      <D.20756>:
      i = i + 1;
      <D.20758>:
      D.21382 = file_table->rows;
      D.21383 = (int) D.21382;
      if (D.21383 > i) goto <D.20757>; else goto <D.20759>;
      <D.20759>:
      t = &image->tables[26];
      D.21384 = image->name;
      base_dir = monoeg_g_path_get_dirname (D.21384);
      {
        char * module_ref;
        const char * name;
        guint32 cols[1];
        int valid;

        try
          {
            D.21385 = BIT_FIELD_REF <*file_table, 32, 32>;
            D.21386 = D.21385 & 16777215;
            D.21387 = D.21386 == 0;
            valid = (int) D.21387;
            D.21388 = idx + -1;
            mono_metadata_decode_row (t, D.21388, &cols, 1);
            D.21389 = cols[0];
            name = mono_metadata_string_heap (image, D.21389);
            list_iter = valid_modules;
            goto <D.20775>;
            <D.20774>:
            {
              size_t __s1_len;
              size_t __s2_len;

              D.21390 = list_iter->data;
              D.20772 = __builtin_strcmp (D.21390, name);
            }
            if (D.20772 == 0) goto <D.21391>; else goto <D.21392>;
            <D.21391>:
            valid = 1;
            goto <D.20773>;
            <D.21392>:
            list_iter = list_iter->next;
            <D.20775>:
            if (list_iter != 0B) goto <D.20774>; else goto <D.20773>;
            <D.20773>:
            if (valid != 0) goto <D.21393>; else goto <D.21394>;
            <D.21393>:
            module_ref = monoeg_g_build_path ("/", base_dir, name, 0B);
            D.21375 = image->modules;
            idx.17 = (sizetype) idx;
            D.21369 = idx.17 + 1073741823;
            D.21370 = D.21369 * 4;
            D.21376 = D.21375 + D.21370;
            D.21395 = mono_image_open_full (module_ref, &status, refonly);
            *D.21376 = D.21395;
            D.21375 = image->modules;
            idx.17 = (sizetype) idx;
            D.21369 = idx.17 + 1073741823;
            D.21370 = D.21369 * 4;
            D.21376 = D.21375 + D.21370;
            D.21396 = *D.21376;
            if (D.21396 != 0B) goto <D.21397>; else goto <D.21398>;
            <D.21397>:
            D.21375 = image->modules;
            idx.17 = (sizetype) idx;
            D.21369 = idx.17 + 1073741823;
            D.21370 = D.21369 * 4;
            D.21376 = D.21375 + D.21370;
            D.21396 = *D.21376;
            mono_image_addref (D.21396);
            D.21375 = image->modules;
            idx.17 = (sizetype) idx;
            D.21369 = idx.17 + 1073741823;
            D.21370 = D.21369 * 4;
            D.21376 = D.21375 + D.21370;
            D.21396 = *D.21376;
            D.21399 = image->assembly;
            D.21396->assembly = D.21399;
            <D.21398>:
            monoeg_g_free (module_ref);
            <D.21394>:
          }
        finally
          {
            cols = {CLOBBER};
          }
      }
      D.21367 = image->modules_loaded;
      idx.17 = (sizetype) idx;
      D.21369 = idx.17 + 1073741823;
      D.21370 = D.21369 * 4;
      D.21371 = D.21367 + D.21370;
      *D.21371 = 1;
      monoeg_g_free (base_dir);
      monoeg_g_list_free (valid_modules);
      D.21375 = image->modules;
      idx.17 = (sizetype) idx;
      D.21369 = idx.17 + 1073741823;
      D.21370 = D.21369 * 4;
      D.21376 = D.21375 + D.21370;
      D.21366 = *D.21376;
      return D.21366;
    }
  finally
    {
      status = {CLOBBER};
    }
}


mono_image_init (struct MonoImage * image)
{
  struct MonoMemPool * D.21404;
  struct MonoInternalHashTable * D.21405;
  struct GHashTable * D.21406;
  struct GHashTable * D.21407;
  struct GHashTable * D.21408;
  struct GHashTable * D.21409;
  struct GHashTable * D.21410;
  struct MonoPropertyHash * D.21411;
  struct CRITICAL_SECTION * D.21412;
  struct CRITICAL_SECTION * D.21413;

  D.21404 = mono_mempool_new_size (512);
  image->mempool = D.21404;
  D.21405 = &image->class_cache;
  mono_internal_hash_table_init (D.21405, monoeg_g_direct_hash, class_key_extract, class_next_value);
  D.21406 = monoeg_g_hash_table_new (0B, 0B);
  image->field_cache = D.21406;
  D.21407 = monoeg_g_hash_table_new (0B, 0B);
  image->typespec_cache = D.21407;
  D.21408 = monoeg_g_hash_table_new (0B, 0B);
  image->memberref_signatures = D.21408;
  D.21409 = monoeg_g_hash_table_new (monoeg_g_str_hash, monoeg_g_str_equal);
  image->helper_signatures = D.21409;
  D.21410 = monoeg_g_hash_table_new (0B, 0B);
  image->method_signatures = D.21410;
  D.21411 = mono_property_hash_new ();
  image->property_hash = D.21411;
  D.21412 = &image->lock;
  InitializeCriticalSection (D.21412);
  D.21413 = &image->szarray_cache_lock;
  InitializeCriticalSection (D.21413);
}


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

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


class_key_extract (void * value)
{
  void * D.21416;
  unsigned int D.21417;
  struct MonoClass * class;

  class = value;
  D.21417 = class->type_token;
  D.21416 = (void *) D.21417;
  return D.21416;
}


mono_image_load_pe_data (struct MonoImage * image)
{
  unsigned int offset.18;
  unsigned int D.21420;
  unsigned int D.21421;
  char * D.21423;
  sizetype offset.19;
  char * D.21425;
  short unsigned int D.21426;
  short unsigned int D.21427;
  unsigned int D.21429;
  unsigned int offset.20;
  int D.21432;
  gboolean D.21434;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoMSDOSHeader msdos;
  gint32 offset;
  void invalid_image = <<< error >>>;

  try
    {
      offset = 0;
      iinfo = image->image_info;
      header = &iinfo->cli_header;
      offset.18 = (unsigned int) offset;
      D.21420 = offset.18 + 128;
      D.21421 = image->raw_data_len;
      if (D.21420 > D.21421) goto invalid_image; else goto <D.21422>;
      <D.21422>:
      D.21423 = image->raw_data;
      offset.19 = (sizetype) offset;
      D.21425 = D.21423 + offset.19;
      memcpy (&msdos, D.21425, 128);
      D.21426 = BIT_FIELD_REF <msdos, 16, 0>;
      D.21427 = D.21426;
      if (D.21427 != 23117) goto invalid_image; else goto <D.21428>;
      <D.21428>:
      D.21429 = msdos.pe_offset;
      msdos.pe_offset = D.21429;
      D.21429 = msdos.pe_offset;
      offset = (gint32) D.21429;
      offset = do_load_header (image, header, offset);
      if (offset < 0) goto invalid_image; else goto <D.21430>;
      <D.21430>:
      offset.20 = (unsigned int) offset;
      D.21432 = load_section_tables (image, iinfo, offset.20);
      if (D.21432 == 0) goto invalid_image; else goto <D.21433>;
      <D.21433>:
      D.21434 = 1;
      return D.21434;
      invalid_image:
      D.21434 = 0;
      return D.21434;
    }
  finally
    {
      msdos = {CLOBBER};
    }
}


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

  D.21438 = __builtin_object_size (__dest, 0);
  D.21437 = __builtin___memcpy_chk (__dest, __src, __len, D.21438);
  return D.21437;
}


do_load_header (struct MonoImage * image, struct MonoDotNetHeader * header, int offset)
{
  unsigned int offset.21;
  unsigned int D.21441;
  unsigned int D.21442;
  int D.21445;
  char * D.21446;
  sizetype offset.22;
  char * D.21448;
  short unsigned int D.21449;
  short unsigned int D.21450;
  short unsigned int D.21453;
  short unsigned int D.21456;
  unsigned int D.21464;
  long long unsigned int D.21465;
  unsigned int D.21466;
  long long unsigned int D.21467;
  unsigned int D.21468;
  long long unsigned int D.21469;
  unsigned int D.21470;
  long long unsigned int D.21471;
  unsigned int D.21472;
  long long unsigned int D.21473;
  unsigned int D.21474;
  unsigned int D.21475;
  unsigned int D.21476;
  short unsigned int D.21477;
  short unsigned int D.21478;
  short unsigned int D.21479;
  short unsigned int D.21480;
  short unsigned int D.21481;
  short unsigned int D.21482;
  unsigned int D.21483;
  unsigned int D.21484;
  unsigned int D.21485;
  unsigned int D.21486;
  short unsigned int D.21487;
  short unsigned int D.21488;
  unsigned int D.21489;
  unsigned int D.21490;
  struct MonoPEDatadir * D.21491;
  struct MonoDotNetHeader64 header64;

  try
    {
      offset.21 = (unsigned int) offset;
      D.21441 = offset.21 + 248;
      D.21442 = image->raw_data_len;
      if (D.21441 > D.21442) goto <D.21443>; else goto <D.21444>;
      <D.21443>:
      D.21445 = -1;
      return D.21445;
      <D.21444>:
      D.21446 = image->raw_data;
      offset.22 = (sizetype) offset;
      D.21448 = D.21446 + offset.22;
      memcpy (header, D.21448, 248);
      D.21449 = BIT_FIELD_REF <*header, 16, 0>;
      D.21450 = D.21449;
      if (D.21450 != 17744) goto <D.21451>; else goto <D.21452>;
      <D.21451>:
      D.21445 = -1;
      return D.21445;
      <D.21452>:
      D.21453 = header->pe.pe_magic;
      if (D.21453 == 267) goto <D.21454>; else goto <D.21455>;
      <D.21454>:
      offset.21 = (unsigned int) offset;
      D.21441 = offset.21 + 248;
      offset = (int) D.21441;
      D.21456 = header->coff.coff_opt_header_size;
      if (D.21456 != 224) goto <D.21457>; else goto <D.21458>;
      <D.21457>:
      D.21445 = -1;
      return D.21445;
      <D.21458>:
      goto <D.21459>;
      <D.21455>:
      D.21453 = header->pe.pe_magic;
      if (D.21453 == 523) goto <D.21460>; else goto <D.21461>;
      <D.21460>:
      D.21456 = header->coff.coff_opt_header_size;
      if (D.21456 != 240) goto <D.21462>; else goto <D.21463>;
      <D.21462>:
      D.21445 = -1;
      return D.21445;
      <D.21463>:
      D.21446 = image->raw_data;
      offset.22 = (sizetype) offset;
      D.21448 = D.21446 + offset.22;
      memcpy (&header64, D.21448, 264);
      offset.21 = (unsigned int) offset;
      D.21464 = offset.21 + 264;
      offset = (int) D.21464;
      memcpy (&header64, header, 244);
      D.21465 = header64.nt.pe_image_base;
      D.21466 = (unsigned int) D.21465;
      header->nt.pe_image_base = D.21466;
      D.21467 = header64.nt.pe_stack_reserve;
      D.21468 = (unsigned int) D.21467;
      header->nt.pe_stack_reserve = D.21468;
      D.21469 = header64.nt.pe_stack_commit;
      D.21470 = (unsigned int) D.21469;
      header->nt.pe_stack_commit = D.21470;
      D.21471 = header64.nt.pe_heap_reserve;
      D.21472 = (unsigned int) D.21471;
      header->nt.pe_heap_reserve = D.21472;
      D.21473 = header64.nt.pe_heap_commit;
      D.21474 = (unsigned int) D.21473;
      header->nt.pe_heap_commit = D.21474;
      D.21475 = header64.nt.pe_section_align;
      header->nt.pe_section_align = D.21475;
      D.21476 = header64.nt.pe_file_alignment;
      header->nt.pe_file_alignment = D.21476;
      D.21477 = header64.nt.pe_os_major;
      header->nt.pe_os_major = D.21477;
      D.21478 = header64.nt.pe_os_minor;
      header->nt.pe_os_minor = D.21478;
      D.21479 = header64.nt.pe_user_major;
      header->nt.pe_user_major = D.21479;
      D.21480 = header64.nt.pe_user_minor;
      header->nt.pe_user_minor = D.21480;
      D.21481 = header64.nt.pe_subsys_major;
      header->nt.pe_subsys_major = D.21481;
      D.21482 = header64.nt.pe_subsys_minor;
      header->nt.pe_subsys_minor = D.21482;
      D.21483 = header64.nt.pe_reserved_1;
      header->nt.pe_reserved_1 = D.21483;
      D.21484 = header64.nt.pe_image_size;
      header->nt.pe_image_size = D.21484;
      D.21485 = header64.nt.pe_header_size;
      header->nt.pe_header_size = D.21485;
      D.21486 = header64.nt.pe_checksum;
      header->nt.pe_checksum = D.21486;
      D.21487 = header64.nt.pe_subsys_required;
      header->nt.pe_subsys_required = D.21487;
      D.21488 = header64.nt.pe_dll_flags;
      header->nt.pe_dll_flags = D.21488;
      D.21489 = header64.nt.pe_loader_flags;
      header->nt.pe_loader_flags = D.21489;
      D.21490 = header64.nt.pe_data_dir_count;
      header->nt.pe_data_dir_count = D.21490;
      D.21491 = &header->datadir;
      memcpy (D.21491, &header64.datadir, 128);
      goto <D.21492>;
      <D.21461>:
      D.21445 = -1;
      return D.21445;
      <D.21492>:
      <D.21459>:
      D.21445 = offset;
      return D.21445;
    }
  finally
    {
      header64 = {CLOBBER};
    }
}


load_section_tables (struct MonoImage * image, struct MonoCLIImageInfo * iinfo, guint32 offset)
{
  short unsigned int D.21495;
  unsigned int top.23;
  unsigned int D.21497;
  void * D.21498;
  unsigned int D.21499;
  void * D.21500;
  struct MonoSectionTable * D.21501;
  unsigned int i.24;
  unsigned int D.21503;
  unsigned int D.21504;
  unsigned int D.21505;
  int D.21508;
  char * D.21509;
  char * D.21510;
  const int top;
  int i;

  D.21495 = iinfo->cli_header.coff.coff_sections;
  top = (const int) D.21495;
  iinfo->cli_section_count = top;
  top.23 = (unsigned int) top;
  D.21497 = top.23 * 40;
  D.21498 = monoeg_malloc0 (D.21497);
  iinfo->cli_section_tables = D.21498;
  top.23 = (unsigned int) top;
  D.21499 = top.23 * 4;
  D.21500 = monoeg_malloc0 (D.21499);
  iinfo->cli_sections = D.21500;
  i = 0;
  goto <D.20607>;
  <D.20606>:
  {
    struct MonoSectionTable * t;

    D.21501 = iinfo->cli_section_tables;
    i.24 = (unsigned int) i;
    D.21503 = i.24 * 40;
    t = D.21501 + D.21503;
    D.21504 = offset + 40;
    D.21505 = image->raw_data_len;
    if (D.21504 > D.21505) goto <D.21506>; else goto <D.21507>;
    <D.21506>:
    D.21508 = 0;
    return D.21508;
    <D.21507>:
    D.21509 = image->raw_data;
    D.21510 = D.21509 + offset;
    memcpy (t, D.21510, 40);
    offset = offset + 40;
  }
  i = i + 1;
  <D.20607>:
  if (i < top) goto <D.20606>; else goto <D.20608>;
  <D.20608>:
  D.21508 = 1;
  return D.21508;
}


mono_image_load_cli_data (struct MonoImage * image)
{
  int D.21512;
  gboolean D.21515;
  int D.21516;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  D.21512 = load_cli_header (image, iinfo);
  if (D.21512 == 0) goto <D.21513>; else goto <D.21514>;
  <D.21513>:
  D.21515 = 0;
  return D.21515;
  <D.21514>:
  D.21516 = load_metadata (image, iinfo);
  if (D.21516 == 0) goto <D.21517>; else goto <D.21518>;
  <D.21517>:
  D.21515 = 0;
  return D.21515;
  <D.21518>:
  D.21515 = 1;
  return D.21515;
}


load_cli_header (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.21520;
  gboolean D.21523;
  unsigned int D.21524;
  unsigned int D.21525;
  struct MonoCLIHeader * D.21528;
  char * D.21529;
  char * D.21530;
  unsigned int D.21531;
  unsigned int D.21534;
  unsigned int D.21537;
  unsigned int D.21540;
  unsigned int D.21543;
  unsigned int D.21546;
  unsigned int D.21549;
  unsigned int D.21552;
  unsigned int D.21555;
  guint32 offset;

  D.21520 = iinfo->cli_header.datadir.pe_cli_header.rva;
  offset = mono_cli_rva_image_map (image, D.21520);
  if (offset == 4294967295) goto <D.21521>; else goto <D.21522>;
  <D.21521>:
  D.21523 = 0;
  return D.21523;
  <D.21522>:
  D.21524 = offset + 136;
  D.21525 = image->raw_data_len;
  if (D.21524 > D.21525) goto <D.21526>; else goto <D.21527>;
  <D.21526>:
  D.21523 = 0;
  return D.21523;
  <D.21527>:
  D.21528 = &iinfo->cli_cli_header;
  D.21529 = image->raw_data;
  D.21530 = D.21529 + offset;
  memcpy (D.21528, D.21530, 136);
  D.21531 = iinfo->cli_cli_header.ch_eeinfo_table.rva;
  if (D.21531 != 0) goto <D.21532>; else goto <D.21533>;
  <D.21533>:
  D.21534 = iinfo->cli_cli_header.ch_helper_table.rva;
  if (D.21534 != 0) goto <D.21535>; else goto <D.21536>;
  <D.21536>:
  D.21537 = iinfo->cli_cli_header.ch_dynamic_info.rva;
  if (D.21537 != 0) goto <D.21538>; else goto <D.21539>;
  <D.21539>:
  D.21540 = iinfo->cli_cli_header.ch_delay_load_info.rva;
  if (D.21540 != 0) goto <D.21541>; else goto <D.21542>;
  <D.21542>:
  D.21543 = iinfo->cli_cli_header.ch_module_image.rva;
  if (D.21543 != 0) goto <D.21544>; else goto <D.21545>;
  <D.21545>:
  D.21546 = iinfo->cli_cli_header.ch_external_fixups.rva;
  if (D.21546 != 0) goto <D.21547>; else goto <D.21548>;
  <D.21548>:
  D.21549 = iinfo->cli_cli_header.ch_ridmap.rva;
  if (D.21549 != 0) goto <D.21550>; else goto <D.21551>;
  <D.21551>:
  D.21552 = iinfo->cli_cli_header.ch_debug_map.rva;
  if (D.21552 != 0) goto <D.21553>; else goto <D.21554>;
  <D.21554>:
  D.21555 = iinfo->cli_cli_header.ch_ip_map.rva;
  if (D.21555 != 0) goto <D.21556>; else goto <D.21557>;
  <D.21556>:
  <D.21557>:
  <D.21553>:
  <D.21550>:
  <D.21547>:
  <D.21544>:
  <D.21541>:
  <D.21538>:
  <D.21535>:
  <D.21532>:
  D.21523 = 1;
  return D.21523;
}


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

  D.21559 = load_metadata_ptrs (image, iinfo);
  if (D.21559 == 0) goto <D.21560>; else goto <D.21561>;
  <D.21560>:
  D.21562 = 0;
  return D.21562;
  <D.21561>:
  D.21562 = load_tables (image);
  return D.21562;
}


load_metadata_ptrs (struct MonoImage * image, struct MonoCLIImageInfo * iinfo)
{
  unsigned int D.21564;
  gboolean D.21567;
  unsigned int D.21568;
  unsigned int D.21569;
  char * D.21572;
  char * D.21573;
  int D.21574;
  short unsigned int D.21577;
  short int D.21578;
  short unsigned int D.21579;
  short int D.21580;
  gchar * D.21581;
  int ptr.25;
  char * D.21583;
  int D.21584;
  int D.21585;
  unsigned int D.21586;
  unsigned int D.21589;
  int D.20642;
  int iftmp.26;
  int D.20641;
  const char[3] * D.21594;
  unsigned char D.21595;
  int D.21596;
  unsigned char D.21597;
  int D.21598;
  _Bool D.21599;
  _Bool D.21600;
  _Bool D.21601;
  const unsigned char * D.21604;
  unsigned char D.21605;
  int D.21606;
  const unsigned char * D.21607;
  unsigned char D.21608;
  int D.21609;
  _Bool D.21610;
  _Bool D.21611;
  const unsigned char * D.21614;
  unsigned char D.21615;
  int D.21616;
  const unsigned char * D.21617;
  unsigned char D.21618;
  int D.21619;
  _Bool D.21620;
  _Bool D.21621;
  const unsigned char * D.21624;
  unsigned char D.21625;
  int D.21626;
  const unsigned char * D.21627;
  unsigned char D.21628;
  int D.21629;
  const char * D.21631;
  unsigned int D.21634;
  const char * D.21635;
  const unsigned char * D.21636;
  unsigned int D.21637;
  int D.20651;
  int iftmp.27;
  int D.20650;
  const char[9] * D.21642;
  unsigned char D.21643;
  int D.21644;
  unsigned char D.21645;
  int D.21646;
  _Bool D.21647;
  _Bool D.21648;
  _Bool D.21649;
  const unsigned char * D.21652;
  unsigned char D.21653;
  int D.21654;
  const unsigned char * D.21655;
  unsigned char D.21656;
  int D.21657;
  _Bool D.21658;
  _Bool D.21659;
  const unsigned char * D.21662;
  unsigned char D.21663;
  int D.21664;
  const unsigned char * D.21665;
  unsigned char D.21666;
  int D.21667;
  _Bool D.21668;
  _Bool D.21669;
  const unsigned char * D.21672;
  unsigned char D.21673;
  int D.21674;
  const unsigned char * D.21675;
  unsigned char D.21676;
  int D.21677;
  unsigned int D.21681;
  const char * D.21682;
  unsigned int D.21683;
  int D.20660;
  int iftmp.28;
  int D.20659;
  const char[4] * D.21688;
  unsigned char D.21689;
  int D.21690;
  unsigned char D.21691;
  int D.21692;
  _Bool D.21693;
  _Bool D.21694;
  _Bool D.21695;
  const unsigned char * D.21698;
  unsigned char D.21699;
  int D.21700;
  const unsigned char * D.21701;
  unsigned char D.21702;
  int D.21703;
  _Bool D.21704;
  _Bool D.21705;
  const unsigned char * D.21708;
  unsigned char D.21709;
  int D.21710;
  const unsigned char * D.21711;
  unsigned char D.21712;
  int D.21713;
  _Bool D.21714;
  _Bool D.21715;
  const unsigned char * D.21718;
  unsigned char D.21719;
  int D.21720;
  const unsigned char * D.21721;
  unsigned char D.21722;
  int D.21723;
  unsigned int D.21727;
  const char * D.21728;
  unsigned int D.21729;
  int D.20669;
  int iftmp.29;
  int D.20668;
  const char[6] * D.21734;
  unsigned char D.21735;
  int D.21736;
  unsigned char D.21737;
  int D.21738;
  _Bool D.21739;
  _Bool D.21740;
  _Bool D.21741;
  const unsigned char * D.21744;
  unsigned char D.21745;
  int D.21746;
  const unsigned char * D.21747;
  unsigned char D.21748;
  int D.21749;
  _Bool D.21750;
  _Bool D.21751;
  const unsigned char * D.21754;
  unsigned char D.21755;
  int D.21756;
  const unsigned char * D.21757;
  unsigned char D.21758;
  int D.21759;
  _Bool D.21760;
  _Bool D.21761;
  const unsigned char * D.21764;
  unsigned char D.21765;
  int D.21766;
  const unsigned char * D.21767;
  unsigned char D.21768;
  int D.21769;
  unsigned int D.21773;
  const char * D.21774;
  unsigned int D.21775;
  int D.20678;
  int iftmp.30;
  int D.20677;
  const char[6] * D.21780;
  unsigned char D.21781;
  int D.21782;
  unsigned char D.21783;
  int D.21784;
  _Bool D.21785;
  _Bool D.21786;
  _Bool D.21787;
  const unsigned char * D.21790;
  unsigned char D.21791;
  int D.21792;
  const unsigned char * D.21793;
  unsigned char D.21794;
  int D.21795;
  _Bool D.21796;
  _Bool D.21797;
  const unsigned char * D.21800;
  unsigned char D.21801;
  int D.21802;
  const unsigned char * D.21803;
  unsigned char D.21804;
  int D.21805;
  _Bool D.21806;
  _Bool D.21807;
  const unsigned char * D.21810;
  unsigned char D.21811;
  int D.21812;
  const unsigned char * D.21813;
  unsigned char D.21814;
  int D.21815;
  unsigned int D.21819;
  const char * D.21820;
  unsigned int D.21821;
  int D.20687;
  int iftmp.31;
  int D.20686;
  const char[3] * D.21826;
  unsigned char D.21827;
  int D.21828;
  unsigned char D.21829;
  int D.21830;
  _Bool D.21831;
  _Bool D.21832;
  _Bool D.21833;
  const unsigned char * D.21836;
  unsigned char D.21837;
  int D.21838;
  const unsigned char * D.21839;
  unsigned char D.21840;
  int D.21841;
  _Bool D.21842;
  _Bool D.21843;
  const unsigned char * D.21846;
  unsigned char D.21847;
  int D.21848;
  const unsigned char * D.21849;
  unsigned char D.21850;
  int D.21851;
  _Bool D.21852;
  _Bool D.21853;
  const unsigned char * D.21856;
  unsigned char D.21857;
  int D.21858;
  const unsigned char * D.21859;
  unsigned char D.21860;
  int D.21861;
  unsigned int D.21865;
  const char * D.21866;
  unsigned int D.21867;
  char * D.21868;
  char * D.21870;
  unsigned int D.21871;
  sizetype D.21872;
  int D.21875;
  const char * D.21876;
  _Bool D.21877;
  long int D.21878;
  long int D.21879;
  unsigned int D.21882;
  _Bool D.21883;
  long int D.21884;
  long int D.21885;
  char * D.21888;
  guint32 offset;
  guint32 size;
  guint16 streams;
  int i;
  guint32 pad;
  char * ptr;

  D.21564 = iinfo->cli_cli_header.ch_metadata.rva;
  offset = mono_cli_rva_image_map (image, D.21564);
  if (offset == 4294967295) goto <D.21565>; else goto <D.21566>;
  <D.21565>:
  D.21567 = 0;
  return D.21567;
  <D.21566>:
  size = iinfo->cli_cli_header.ch_metadata.size;
  D.21568 = offset + size;
  D.21569 = image->raw_data_len;
  if (D.21568 > D.21569) goto <D.21570>; else goto <D.21571>;
  <D.21570>:
  D.21567 = 0;
  return D.21567;
  <D.21571>:
  D.21572 = image->raw_data;
  D.21573 = D.21572 + offset;
  image->raw_metadata = D.21573;
  ptr = image->raw_metadata;
  D.21574 = strncmp (ptr, "BSJB", 4);
  if (D.21574 == 0) goto <D.21575>; else goto <D.21576>;
  <D.21575>:
  {
    guint32 version_string_len;

    ptr = ptr + 4;
    D.21577 = mono_read16 (ptr);
    D.21578 = (short int) D.21577;
    image->md_version_major = D.21578;
    ptr = ptr + 2;
    D.21579 = mono_read16 (ptr);
    D.21580 = (short int) D.21579;
    image->md_version_minor = D.21580;
    ptr = ptr + 6;
    version_string_len = mono_read32 (ptr);
    ptr = ptr + 4;
    D.21581 = monoeg_g_strndup (ptr, version_string_len);
    image->version = D.21581;
    ptr = ptr + version_string_len;
    ptr.25 = (int) ptr;
    D.21583 = image->raw_metadata;
    D.21584 = (int) D.21583;
    D.21585 = ptr.25 - D.21584;
    pad = (guint32) D.21585;
    D.21586 = pad & 3;
    if (D.21586 != 0) goto <D.21587>; else goto <D.21588>;
    <D.21587>:
    D.21586 = pad & 3;
    D.21589 = 4 - D.21586;
    ptr = ptr + D.21589;
    <D.21588>:
  }
  goto <D.21590>;
  <D.21576>:
  D.21567 = 0;
  return D.21567;
  <D.21590>:
  ptr = ptr + 2;
  streams = mono_read16 (ptr);
  ptr = ptr + 2;
  i = 0;
  goto <D.20689>;
  <D.20688>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.21594 = "#~";
      D.21595 = MEM[(const unsigned char *)D.21594];
      D.21596 = (int) D.21595;
      D.21597 = *__s2;
      D.21598 = (int) D.21597;
      __result = D.21596 - D.21598;
      {
        D.21599 = __s2_len != 0;
        D.21600 = __result == 0;
        D.21601 = D.21599 & D.21600;
        if (D.21601 != 0) goto <D.21602>; else goto <D.21603>;
        <D.21602>:
        D.21604 = &MEM[(void *)"#~" + 1B];
        D.21605 = *D.21604;
        D.21606 = (int) D.21605;
        D.21607 = __s2 + 1;
        D.21608 = *D.21607;
        D.21609 = (int) D.21608;
        __result = D.21606 - D.21609;
        D.21610 = __s2_len > 1;
        D.21600 = __result == 0;
        D.21611 = D.21610 & D.21600;
        if (D.21611 != 0) goto <D.21612>; else goto <D.21613>;
        <D.21612>:
        D.21614 = &MEM[(void *)"#~" + 2B];
        D.21615 = *D.21614;
        D.21616 = (int) D.21615;
        D.21617 = __s2 + 2;
        D.21618 = *D.21617;
        D.21619 = (int) D.21618;
        __result = D.21616 - D.21619;
        D.21620 = __s2_len > 2;
        D.21600 = __result == 0;
        D.21621 = D.21620 & D.21600;
        if (D.21621 != 0) goto <D.21622>; else goto <D.21623>;
        <D.21622>:
        D.21624 = &MEM[(void *)"#~" + 3B];
        D.21625 = *D.21624;
        D.21626 = (int) D.21625;
        D.21627 = __s2 + 3;
        D.21628 = *D.21627;
        D.21629 = (int) D.21628;
        __result = D.21626 - D.21629;
        <D.21623>:
        <D.21613>:
        <D.21603>:
      }
      D.20641 = __result;
    }
    iftmp.26 = -D.20641;
    goto <D.21630>;
    <D.21593>:
    D.21631 = ptr + 8;
    iftmp.26 = __builtin_strcmp (D.21631, "#~");
    <D.21630>:
    D.20642 = iftmp.26;
  }
  if (D.20642 == 0) goto <D.21632>; else goto <D.21633>;
  <D.21632>:
  D.21583 = image->raw_metadata;
  D.21634 = mono_read32 (ptr);
  D.21635 = D.21583 + D.21634;
  image->heap_tables.data = D.21635;
  D.21636 = ptr + 4;
  D.21637 = mono_read32 (D.21636);
  image->heap_tables.size = D.21637;
  ptr = ptr + 11;
  goto <D.21638>;
  <D.21633>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.21642 = "#Strings";
      D.21643 = MEM[(const unsigned char *)D.21642];
      D.21644 = (int) D.21643;
      D.21645 = *__s2;
      D.21646 = (int) D.21645;
      __result = D.21644 - D.21646;
      {
        D.21647 = __s2_len != 0;
        D.21648 = __result == 0;
        D.21649 = D.21647 & D.21648;
        if (D.21649 != 0) goto <D.21650>; else goto <D.21651>;
        <D.21650>:
        D.21652 = &MEM[(void *)"#Strings" + 1B];
        D.21653 = *D.21652;
        D.21654 = (int) D.21653;
        D.21655 = __s2 + 1;
        D.21656 = *D.21655;
        D.21657 = (int) D.21656;
        __result = D.21654 - D.21657;
        D.21658 = __s2_len > 1;
        D.21648 = __result == 0;
        D.21659 = D.21658 & D.21648;
        if (D.21659 != 0) goto <D.21660>; else goto <D.21661>;
        <D.21660>:
        D.21662 = &MEM[(void *)"#Strings" + 2B];
        D.21663 = *D.21662;
        D.21664 = (int) D.21663;
        D.21665 = __s2 + 2;
        D.21666 = *D.21665;
        D.21667 = (int) D.21666;
        __result = D.21664 - D.21667;
        D.21668 = __s2_len > 2;
        D.21648 = __result == 0;
        D.21669 = D.21668 & D.21648;
        if (D.21669 != 0) goto <D.21670>; else goto <D.21671>;
        <D.21670>:
        D.21672 = &MEM[(void *)"#Strings" + 3B];
        D.21673 = *D.21672;
        D.21674 = (int) D.21673;
        D.21675 = __s2 + 3;
        D.21676 = *D.21675;
        D.21677 = (int) D.21676;
        __result = D.21674 - D.21677;
        <D.21671>:
        <D.21661>:
        <D.21651>:
      }
      D.20650 = __result;
    }
    iftmp.27 = -D.20650;
    goto <D.21678>;
    <D.21641>:
    D.21631 = ptr + 8;
    iftmp.27 = __builtin_strcmp (D.21631, "#Strings");
    <D.21678>:
    D.20651 = iftmp.27;
  }
  if (D.20651 == 0) goto <D.21679>; else goto <D.21680>;
  <D.21679>:
  D.21583 = image->raw_metadata;
  D.21681 = mono_read32 (ptr);
  D.21682 = D.21583 + D.21681;
  image->heap_strings.data = D.21682;
  D.21636 = ptr + 4;
  D.21683 = mono_read32 (D.21636);
  image->heap_strings.size = D.21683;
  ptr = ptr + 17;
  goto <D.21684>;
  <D.21680>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.21688 = "#US";
      D.21689 = MEM[(const unsigned char *)D.21688];
      D.21690 = (int) D.21689;
      D.21691 = *__s2;
      D.21692 = (int) D.21691;
      __result = D.21690 - D.21692;
      {
        D.21693 = __s2_len != 0;
        D.21694 = __result == 0;
        D.21695 = D.21693 & D.21694;
        if (D.21695 != 0) goto <D.21696>; else goto <D.21697>;
        <D.21696>:
        D.21698 = &MEM[(void *)"#US" + 1B];
        D.21699 = *D.21698;
        D.21700 = (int) D.21699;
        D.21701 = __s2 + 1;
        D.21702 = *D.21701;
        D.21703 = (int) D.21702;
        __result = D.21700 - D.21703;
        D.21704 = __s2_len > 1;
        D.21694 = __result == 0;
        D.21705 = D.21704 & D.21694;
        if (D.21705 != 0) goto <D.21706>; else goto <D.21707>;
        <D.21706>:
        D.21708 = &MEM[(void *)"#US" + 2B];
        D.21709 = *D.21708;
        D.21710 = (int) D.21709;
        D.21711 = __s2 + 2;
        D.21712 = *D.21711;
        D.21713 = (int) D.21712;
        __result = D.21710 - D.21713;
        D.21714 = __s2_len > 2;
        D.21694 = __result == 0;
        D.21715 = D.21714 & D.21694;
        if (D.21715 != 0) goto <D.21716>; else goto <D.21717>;
        <D.21716>:
        D.21718 = &MEM[(void *)"#US" + 3B];
        D.21719 = *D.21718;
        D.21720 = (int) D.21719;
        D.21721 = __s2 + 3;
        D.21722 = *D.21721;
        D.21723 = (int) D.21722;
        __result = D.21720 - D.21723;
        <D.21717>:
        <D.21707>:
        <D.21697>:
      }
      D.20659 = __result;
    }
    iftmp.28 = -D.20659;
    goto <D.21724>;
    <D.21687>:
    D.21631 = ptr + 8;
    iftmp.28 = __builtin_strcmp (D.21631, "#US");
    <D.21724>:
    D.20660 = iftmp.28;
  }
  if (D.20660 == 0) goto <D.21725>; else goto <D.21726>;
  <D.21725>:
  D.21583 = image->raw_metadata;
  D.21727 = mono_read32 (ptr);
  D.21728 = D.21583 + D.21727;
  image->heap_us.data = D.21728;
  D.21636 = ptr + 4;
  D.21729 = mono_read32 (D.21636);
  image->heap_us.size = D.21729;
  ptr = ptr + 12;
  goto <D.21730>;
  <D.21726>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.21734 = "#Blob";
      D.21735 = MEM[(const unsigned char *)D.21734];
      D.21736 = (int) D.21735;
      D.21737 = *__s2;
      D.21738 = (int) D.21737;
      __result = D.21736 - D.21738;
      {
        D.21739 = __s2_len != 0;
        D.21740 = __result == 0;
        D.21741 = D.21739 & D.21740;
        if (D.21741 != 0) goto <D.21742>; else goto <D.21743>;
        <D.21742>:
        D.21744 = &MEM[(void *)"#Blob" + 1B];
        D.21745 = *D.21744;
        D.21746 = (int) D.21745;
        D.21747 = __s2 + 1;
        D.21748 = *D.21747;
        D.21749 = (int) D.21748;
        __result = D.21746 - D.21749;
        D.21750 = __s2_len > 1;
        D.21740 = __result == 0;
        D.21751 = D.21750 & D.21740;
        if (D.21751 != 0) goto <D.21752>; else goto <D.21753>;
        <D.21752>:
        D.21754 = &MEM[(void *)"#Blob" + 2B];
        D.21755 = *D.21754;
        D.21756 = (int) D.21755;
        D.21757 = __s2 + 2;
        D.21758 = *D.21757;
        D.21759 = (int) D.21758;
        __result = D.21756 - D.21759;
        D.21760 = __s2_len > 2;
        D.21740 = __result == 0;
        D.21761 = D.21760 & D.21740;
        if (D.21761 != 0) goto <D.21762>; else goto <D.21763>;
        <D.21762>:
        D.21764 = &MEM[(void *)"#Blob" + 3B];
        D.21765 = *D.21764;
        D.21766 = (int) D.21765;
        D.21767 = __s2 + 3;
        D.21768 = *D.21767;
        D.21769 = (int) D.21768;
        __result = D.21766 - D.21769;
        <D.21763>:
        <D.21753>:
        <D.21743>:
      }
      D.20668 = __result;
    }
    iftmp.29 = -D.20668;
    goto <D.21770>;
    <D.21733>:
    D.21631 = ptr + 8;
    iftmp.29 = __builtin_strcmp (D.21631, "#Blob");
    <D.21770>:
    D.20669 = iftmp.29;
  }
  if (D.20669 == 0) goto <D.21771>; else goto <D.21772>;
  <D.21771>:
  D.21583 = image->raw_metadata;
  D.21773 = mono_read32 (ptr);
  D.21774 = D.21583 + D.21773;
  image->heap_blob.data = D.21774;
  D.21636 = ptr + 4;
  D.21775 = mono_read32 (D.21636);
  image->heap_blob.size = D.21775;
  ptr = ptr + 14;
  goto <D.21776>;
  <D.21772>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.21780 = "#GUID";
      D.21781 = MEM[(const unsigned char *)D.21780];
      D.21782 = (int) D.21781;
      D.21783 = *__s2;
      D.21784 = (int) D.21783;
      __result = D.21782 - D.21784;
      {
        D.21785 = __s2_len != 0;
        D.21786 = __result == 0;
        D.21787 = D.21785 & D.21786;
        if (D.21787 != 0) goto <D.21788>; else goto <D.21789>;
        <D.21788>:
        D.21790 = &MEM[(void *)"#GUID" + 1B];
        D.21791 = *D.21790;
        D.21792 = (int) D.21791;
        D.21793 = __s2 + 1;
        D.21794 = *D.21793;
        D.21795 = (int) D.21794;
        __result = D.21792 - D.21795;
        D.21796 = __s2_len > 1;
        D.21786 = __result == 0;
        D.21797 = D.21796 & D.21786;
        if (D.21797 != 0) goto <D.21798>; else goto <D.21799>;
        <D.21798>:
        D.21800 = &MEM[(void *)"#GUID" + 2B];
        D.21801 = *D.21800;
        D.21802 = (int) D.21801;
        D.21803 = __s2 + 2;
        D.21804 = *D.21803;
        D.21805 = (int) D.21804;
        __result = D.21802 - D.21805;
        D.21806 = __s2_len > 2;
        D.21786 = __result == 0;
        D.21807 = D.21806 & D.21786;
        if (D.21807 != 0) goto <D.21808>; else goto <D.21809>;
        <D.21808>:
        D.21810 = &MEM[(void *)"#GUID" + 3B];
        D.21811 = *D.21810;
        D.21812 = (int) D.21811;
        D.21813 = __s2 + 3;
        D.21814 = *D.21813;
        D.21815 = (int) D.21814;
        __result = D.21812 - D.21815;
        <D.21809>:
        <D.21799>:
        <D.21789>:
      }
      D.20677 = __result;
    }
    iftmp.30 = -D.20677;
    goto <D.21816>;
    <D.21779>:
    D.21631 = ptr + 8;
    iftmp.30 = __builtin_strcmp (D.21631, "#GUID");
    <D.21816>:
    D.20678 = iftmp.30;
  }
  if (D.20678 == 0) goto <D.21817>; else goto <D.21818>;
  <D.21817>:
  D.21583 = image->raw_metadata;
  D.21819 = mono_read32 (ptr);
  D.21820 = D.21583 + D.21819;
  image->heap_guid.data = D.21820;
  D.21636 = ptr + 4;
  D.21821 = mono_read32 (D.21636);
  image->heap_guid.size = D.21821;
  ptr = ptr + 14;
  goto <D.21822>;
  <D.21818>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = ptr + 8;
      D.21826 = "#-";
      D.21827 = MEM[(const unsigned char *)D.21826];
      D.21828 = (int) D.21827;
      D.21829 = *__s2;
      D.21830 = (int) D.21829;
      __result = D.21828 - D.21830;
      {
        D.21831 = __s2_len != 0;
        D.21832 = __result == 0;
        D.21833 = D.21831 & D.21832;
        if (D.21833 != 0) goto <D.21834>; else goto <D.21835>;
        <D.21834>:
        D.21836 = &MEM[(void *)"#-" + 1B];
        D.21837 = *D.21836;
        D.21838 = (int) D.21837;
        D.21839 = __s2 + 1;
        D.21840 = *D.21839;
        D.21841 = (int) D.21840;
        __result = D.21838 - D.21841;
        D.21842 = __s2_len > 1;
        D.21832 = __result == 0;
        D.21843 = D.21842 & D.21832;
        if (D.21843 != 0) goto <D.21844>; else goto <D.21845>;
        <D.21844>:
        D.21846 = &MEM[(void *)"#-" + 2B];
        D.21847 = *D.21846;
        D.21848 = (int) D.21847;
        D.21849 = __s2 + 2;
        D.21850 = *D.21849;
        D.21851 = (int) D.21850;
        __result = D.21848 - D.21851;
        D.21852 = __s2_len > 2;
        D.21832 = __result == 0;
        D.21853 = D.21852 & D.21832;
        if (D.21853 != 0) goto <D.21854>; else goto <D.21855>;
        <D.21854>:
        D.21856 = &MEM[(void *)"#-" + 3B];
        D.21857 = *D.21856;
        D.21858 = (int) D.21857;
        D.21859 = __s2 + 3;
        D.21860 = *D.21859;
        D.21861 = (int) D.21860;
        __result = D.21858 - D.21861;
        <D.21855>:
        <D.21845>:
        <D.21835>:
      }
      D.20686 = __result;
    }
    iftmp.31 = -D.20686;
    goto <D.21862>;
    <D.21825>:
    D.21631 = ptr + 8;
    iftmp.31 = __builtin_strcmp (D.21631, "#-");
    <D.21862>:
    D.20687 = iftmp.31;
  }
  if (D.20687 == 0) goto <D.21863>; else goto <D.21864>;
  <D.21863>:
  D.21583 = image->raw_metadata;
  D.21865 = mono_read32 (ptr);
  D.21866 = D.21583 + D.21865;
  image->heap_tables.data = D.21866;
  D.21636 = ptr + 4;
  D.21867 = mono_read32 (D.21636);
  image->heap_tables.size = D.21867;
  ptr = ptr + 11;
  image->uncompressed_metadata = 1;
  D.21868 = 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.21868);
  goto <D.21869>;
  <D.21864>:
  D.21870 = ptr + 8;
  monoeg_g_log (0B, 32, "Unknown heap type: %s\n", D.21870);
  D.21631 = ptr + 8;
  D.21871 = strlen (D.21631);
  D.21872 = D.21871 + 9;
  ptr = ptr + D.21872;
  <D.21869>:
  <D.21822>:
  <D.21776>:
  <D.21730>:
  <D.21684>:
  <D.21638>:
  ptr.25 = (int) ptr;
  D.21583 = image->raw_metadata;
  D.21584 = (int) D.21583;
  D.21585 = ptr.25 - D.21584;
  pad = (guint32) D.21585;
  D.21586 = pad & 3;
  if (D.21586 != 0) goto <D.21873>; else goto <D.21874>;
  <D.21873>:
  D.21586 = pad & 3;
  D.21589 = 4 - D.21586;
  ptr = ptr + D.21589;
  <D.21874>:
  i = i + 1;
  <D.20689>:
  D.21875 = (int) streams;
  if (D.21875 > i) goto <D.20688>; else goto <D.20690>;
  <D.20690>:
  D.21876 = image->heap_guid.data;
  D.21877 = D.21876 == 0B;
  D.21878 = (long int) D.21877;
  D.21879 = __builtin_expect (D.21878, 0);
  if (D.21879 != 0) goto <D.21880>; else goto <D.21881>;
  <D.21880>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 465, "image->heap_guid.data");
  <D.21881>:
  D.21882 = image->heap_guid.size;
  D.21883 = D.21882 <= 15;
  D.21884 = (long int) D.21883;
  D.21885 = __builtin_expect (D.21884, 0);
  if (D.21885 != 0) goto <D.21886>; else goto <D.21887>;
  <D.21886>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 466, "image->heap_guid.size >= 16");
  <D.21887>:
  D.21876 = image->heap_guid.data;
  D.21888 = mono_guid_to_string (D.21876);
  image->guid = D.21888;
  D.21567 = 1;
  return D.21567;
}


load_tables (struct MonoImage * image)
{
  const char * D.21890;
  char D.21891;
  int D.21892;
  _Bool D.21893;
  int D.21894;
  _Bool D.21895;
  int D.21896;
  _Bool D.21897;
  const unsigned char * D.21898;
  const unsigned char * D.21899;
  long long unsigned int D.21900;
  long long unsigned int D.21901;
  unsigned int D.21909;
  <unnamed-unsigned:24> D.21910;
  int D.21911;
  sizetype D.21912;
  sizetype D.21913;
  const char * D.21914;
  const char * D.21915;
  _Bool D.21916;
  long int D.21917;
  long int D.21918;
  gboolean D.21921;
  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.21890 = heap_tables + 6;
  D.21891 = *D.21890;
  heap_sizes = (int) D.21891;
  D.21892 = heap_sizes & 1;
  D.21893 = D.21892 != 0;
  image->idx_string_wide = D.21893;
  D.21894 = heap_sizes & 2;
  D.21895 = D.21894 != 0;
  image->idx_guid_wide = D.21895;
  D.21896 = heap_sizes & 4;
  D.21897 = D.21896 != 0;
  image->idx_blob_wide = D.21897;
  D.21898 = heap_tables + 8;
  valid_mask = mono_read64 (D.21898);
  D.21899 = heap_tables + 16;
  sorted_mask = mono_read64 (D.21899);
  rows = heap_tables + 24;
  table = 0;
  goto <D.20703>;
  <D.20702>:
  D.21900 = valid_mask >> table;
  D.21901 = D.21900 & 1;
  if (D.21901 == 0) goto <D.21902>; else goto <D.21903>;
  <D.21902>:
  if (table > 44) goto <D.21904>; else goto <D.21905>;
  <D.21904>:
  // predicted unlikely by continue predictor.
  goto <D.20701>;
  <D.21905>:
  image->tables[table].rows = 0;
  // predicted unlikely by continue predictor.
  goto <D.20701>;
  <D.21903>:
  if (table > 44) goto <D.21906>; else goto <D.21907>;
  <D.21906>:
  monoeg_g_log (0B, 16, "bits in valid must be zero above 0x2d (II - 23.1.6)");
  goto <D.21908>;
  <D.21907>:
  D.21909 = mono_read32 (rows);
  D.21910 = (<unnamed-unsigned:24>) D.21909;
  image->tables[table].rows = D.21910;
  <D.21908>:
  rows = rows + 4;
  valid = valid + 1;
  <D.20701>:
  table = table + 1;
  <D.20703>:
  if (table <= 63) goto <D.20702>; else goto <D.20704>;
  <D.20704>:
  D.21911 = valid * 4;
  D.21912 = (sizetype) D.21911;
  D.21913 = D.21912 + 24;
  D.21914 = heap_tables + D.21913;
  image->tables_base = D.21914;
  D.21915 = image->tables_base;
  D.21916 = D.21915 != rows;
  D.21917 = (long int) D.21916;
  D.21918 = __builtin_expect (D.21917, 0);
  if (D.21918 != 0) goto <D.21919>; else goto <D.21920>;
  <D.21919>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 516, "(const void *) image->tables_base == (const void *) rows");
  <D.21920>:
  mono_metadata_compute_table_bases (image);
  D.21921 = 1;
  return D.21921;
}


mono_image_load_names (struct MonoImage * image)
{
  unsigned int D.21923;
  unsigned int D.21924;
  struct MonoTableInfo * D.21927;
  unsigned int D.21928;
  const char * D.21929;
  struct MonoTableInfo * D.21930;
  unsigned int D.21931;
  const char * D.21932;

  D.21923 = BIT_FIELD_REF <*image, 32, 3904>;
  D.21924 = D.21923 & 16777215;
  if (D.21924 != 0) goto <D.21925>; else goto <D.21926>;
  <D.21925>:
  D.21927 = &image->tables[32];
  D.21928 = mono_metadata_decode_row_col (D.21927, 0, 7);
  D.21929 = mono_metadata_string_heap (image, D.21928);
  image->assembly_name = D.21929;
  <D.21926>:
  D.21930 = &image->tables[0];
  D.21931 = mono_metadata_decode_row_col (D.21930, 0, 1);
  D.21932 = mono_metadata_string_heap (image, D.21931);
  image->module_name = D.21932;
}


mono_image_loaded_full (const char * name, gboolean refonly)
{
  struct GHashTable * iftmp.32;
  int mutex_inited.33;
  _Bool D.21942;
  long int D.21943;
  long int D.21944;
  _Bool D.21951;
  long int D.21952;
  long int D.21953;
  struct MonoImage * D.21956;
  struct MonoImage * res;
  struct GHashTable * loaded_images;

  if (refonly != 0) goto <D.21934>; else goto <D.21935>;
  <D.21934>:
  iftmp.32 = loaded_images_refonly_hash;
  goto <D.21936>;
  <D.21935>:
  iftmp.32 = loaded_images_hash;
  <D.21936>:
  loaded_images = iftmp.32;
  mutex_inited.33 = mutex_inited;
  if (mutex_inited.33 != 0) goto <D.21938>; else goto <D.21939>;
  <D.21938>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.21940>; else goto <D.21941>;
    <D.21940>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21941>:
    D.21942 = ret != 0;
    D.21943 = (long int) D.21942;
    D.21944 = __builtin_expect (D.21943, 0);
    if (D.21944 != 0) goto <D.21945>; else goto <D.21946>;
    <D.21945>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1060, "ret == 0");
    <D.21946>:
  }
  <D.21939>:
  res = monoeg_g_hash_table_lookup (loaded_images, name);
  mutex_inited.33 = mutex_inited;
  if (mutex_inited.33 != 0) goto <D.21947>; else goto <D.21948>;
  <D.21947>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.21949>; else goto <D.21950>;
    <D.21949>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21950>:
    D.21951 = ret != 0;
    D.21952 = (long int) D.21951;
    D.21953 = __builtin_expect (D.21952, 0);
    if (D.21953 != 0) goto <D.21954>; else goto <D.21955>;
    <D.21954>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1062, "ret == 0");
    <D.21955>:
  }
  <D.21948>:
  D.21956 = res;
  return D.21956;
}


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

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


mono_image_loaded_by_guid_full (const char * guid, gboolean refonly)
{
  struct GHashTable * iftmp.34;
  int mutex_inited.35;
  _Bool D.21969;
  long int D.21970;
  long int D.21971;
  _Bool D.21978;
  long int D.21979;
  long int D.21980;
  struct MonoImage * D.21983;
  struct GuidData data;
  struct GHashTable * loaded_images;

  try
    {
      if (refonly != 0) goto <D.21961>; else goto <D.21962>;
      <D.21961>:
      iftmp.34 = loaded_images_refonly_hash;
      goto <D.21963>;
      <D.21962>:
      iftmp.34 = loaded_images_hash;
      <D.21963>:
      loaded_images = iftmp.34;
      data.res = 0B;
      data.guid = guid;
      mutex_inited.35 = mutex_inited;
      if (mutex_inited.35 != 0) goto <D.21965>; else goto <D.21966>;
      <D.21965>:
      {
        int ret;

        ret = pthread_mutex_lock (&images_mutex.mutex);
        if (ret != 0) goto <D.21967>; else goto <D.21968>;
        <D.21967>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.21968>:
        D.21969 = ret != 0;
        D.21970 = (long int) D.21969;
        D.21971 = __builtin_expect (D.21970, 0);
        if (D.21971 != 0) goto <D.21972>; else goto <D.21973>;
        <D.21972>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1106, "ret == 0");
        <D.21973>:
      }
      <D.21966>:
      monoeg_g_hash_table_foreach (loaded_images, find_by_guid, &data);
      mutex_inited.35 = mutex_inited;
      if (mutex_inited.35 != 0) goto <D.21974>; else goto <D.21975>;
      <D.21974>:
      {
        int ret;

        ret = pthread_mutex_unlock (&images_mutex.mutex);
        if (ret != 0) goto <D.21976>; else goto <D.21977>;
        <D.21976>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.21977>:
        D.21978 = ret != 0;
        D.21979 = (long int) D.21978;
        D.21980 = __builtin_expect (D.21979, 0);
        if (D.21980 != 0) goto <D.21981>; else goto <D.21982>;
        <D.21981>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1108, "ret == 0");
        <D.21982>:
      }
      <D.21975>:
      D.21983 = data.res;
      return D.21983;
    }
  finally
    {
      data = {CLOBBER};
    }
}


find_by_guid (void * key, void * val, void * user_data)
{
  struct MonoImage * D.21986;
  int D.20862;
  const char * D.21989;
  const char * D.21990;
  struct GuidData * data;
  struct MonoImage * image;

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

    D.21989 = data->guid;
    D.21990 = mono_image_get_guid (image);
    D.20862 = __builtin_strcmp (D.21989, D.21990);
  }
  if (D.20862 == 0) goto <D.21991>; else goto <D.21992>;
  <D.21991>:
  data->res = image;
  <D.21992>:
}


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

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


mono_image_open_from_data_with_name (char * data, guint32 data_len, gboolean need_copy, MonoImageOpenStatus * status, gboolean refonly, const char * name)
{
  _Bool D.21996;
  _Bool D.21997;
  _Bool D.21998;
  struct MonoImage * D.22003;
  unsigned char D.22010;
  <unnamed-unsigned:1> D.22011;
  gchar * iftmp.36;
  unsigned char D.22016;
  <unnamed-unsigned:1> D.22017;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  char * datac;

  D.21996 = data == 0B;
  D.21997 = data_len == 0;
  D.21998 = D.21996 | D.21997;
  if (D.21998 != 0) goto <D.21999>; else goto <D.22000>;
  <D.21999>:
  if (status != 0B) goto <D.22001>; else goto <D.22002>;
  <D.22001>:
  *status = 3;
  <D.22002>:
  D.22003 = 0B;
  return D.22003;
  <D.22000>:
  datac = data;
  if (need_copy != 0) goto <D.22004>; else goto <D.22005>;
  <D.22004>:
  datac = monoeg_try_malloc (data_len);
  if (datac == 0B) goto <D.22006>; else goto <D.22007>;
  <D.22006>:
  if (status != 0B) goto <D.22008>; else goto <D.22009>;
  <D.22008>:
  *status = 1;
  <D.22009>:
  D.22003 = 0B;
  return D.22003;
  <D.22007>:
  memcpy (datac, data, data_len);
  <D.22005>:
  image = monoeg_malloc0 (980);
  image->raw_data = datac;
  image->raw_data_len = data_len;
  D.22010 = (unsigned char) need_copy;
  D.22011 = (<unnamed-unsigned:1>) D.22010;
  image->raw_data_allocated = D.22011;
  if (name == 0B) goto <D.22013>; else goto <D.22014>;
  <D.22013>:
  iftmp.36 = monoeg_g_strdup_printf ("data-%p", datac);
  goto <D.22015>;
  <D.22014>:
  iftmp.36 = monoeg_strdup (name);
  <D.22015>:
  image->name = iftmp.36;
  iinfo = monoeg_malloc0 (396);
  image->image_info = iinfo;
  D.22016 = (unsigned char) refonly;
  D.22017 = (<unnamed-unsigned:1>) D.22016;
  image->ref_only = D.22017;
  image = do_mono_image_load (image, status, 1, 1);
  if (image == 0B) goto <D.22018>; else goto <D.22019>;
  <D.22018>:
  D.22003 = 0B;
  return D.22003;
  <D.22019>:
  D.22003 = register_image (image);
  return D.22003;
}


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

  if (str != 0B) goto <D.22021>; else goto <D.22022>;
  <D.22021>:
  D.22023 = __strdup (str);
  return D.22023;
  <D.22022>:
  D.22023 = 0B;
  return D.22023;
}


do_mono_image_load (struct MonoImage * image, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff)
{
  int D.22028;
  int D.22030;
  int D.22033;
  int D.22035;
  int D.22037;
  struct MonoImage * D.22041;
  struct GSList * errors.37;
  char * D.22045;
  char * D.22046;
  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.22025>; else goto <D.22026>;
      <D.22025>:
      *status = 3;
      <D.22026>:
      if (care_about_pecoff == 0) goto done; else goto <D.22027>;
      <D.22027>:
      D.22028 = mono_verifier_verify_pe_data (image, &errors);
      if (D.22028 == 0) goto invalid_image; else goto <D.22029>;
      <D.22029>:
      D.22030 = mono_image_load_pe_data (image);
      if (D.22030 == 0) goto invalid_image; else goto <D.22031>;
      <D.22031>:
      if (care_about_cli == 0) goto done; else goto <D.22032>;
      <D.22032>:
      D.22033 = mono_verifier_verify_cli_data (image, &errors);
      if (D.22033 == 0) goto invalid_image; else goto <D.22034>;
      <D.22034>:
      D.22035 = mono_image_load_cli_data (image);
      if (D.22035 == 0) goto invalid_image; else goto <D.22036>;
      <D.22036>:
      D.22037 = mono_verifier_verify_table_data (image, &errors);
      if (D.22037 == 0) goto invalid_image; else goto <D.22038>;
      <D.22038>:
      mono_image_load_names (image);
      load_modules (image);
      done:
      mono_profiler_module_loaded (image, 0);
      if (status != 0B) goto <D.22039>; else goto <D.22040>;
      <D.22039>:
      *status = 0;
      <D.22040>:
      D.22041 = image;
      return D.22041;
      invalid_image:
      errors.37 = errors;
      if (errors.37 != 0B) goto <D.22043>; else goto <D.22044>;
      <D.22043>:
      {
        struct MonoVerifyInfo * info;

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


load_modules (struct MonoImage * image)
{
  struct MonoImage * * D.22049;
  <unnamed-unsigned:24> D.22052;
  unsigned int D.22053;
  unsigned int D.22054;
  void * D.22055;
  void * D.22056;
  unsigned int D.22057;
  struct MonoTableInfo * t;

  D.22049 = image->modules;
  if (D.22049 != 0B) goto <D.22050>; else goto <D.22051>;
  <D.22050>:
  return;
  <D.22051>:
  t = &image->tables[26];
  D.22052 = t->rows;
  D.22053 = (unsigned int) D.22052;
  D.22054 = D.22053 * 4;
  D.22055 = monoeg_malloc0 (D.22054);
  image->modules = D.22055;
  D.22052 = t->rows;
  D.22053 = (unsigned int) D.22052;
  D.22054 = D.22053 * 4;
  D.22056 = monoeg_malloc0 (D.22054);
  image->modules_loaded = D.22056;
  D.22052 = t->rows;
  D.22057 = (unsigned int) D.22052;
  image->module_count = D.22057;
}


register_image (struct MonoImage * image)
{
  struct GHashTable * iftmp.38;
  unsigned char D.22060;
  unsigned char D.22061;
  int mutex_inited.39;
  _Bool D.22070;
  long int D.22071;
  long int D.22072;
  char * D.22075;
  _Bool D.22082;
  long int D.22083;
  long int D.22084;
  struct MonoImage * D.22087;
  const char * D.22088;
  void * D.22091;
  _Bool D.22098;
  long int D.22099;
  long int D.22100;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;

  D.22060 = BIT_FIELD_REF <*image, 8, 128>;
  D.22061 = D.22060 & 16;
  if (D.22061 != 0) goto <D.22062>; else goto <D.22063>;
  <D.22062>:
  iftmp.38 = loaded_images_refonly_hash;
  goto <D.22064>;
  <D.22063>:
  iftmp.38 = loaded_images_hash;
  <D.22064>:
  loaded_images = iftmp.38;
  mutex_inited.39 = mutex_inited;
  if (mutex_inited.39 != 0) goto <D.22066>; else goto <D.22067>;
  <D.22066>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.22068>; else goto <D.22069>;
    <D.22068>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22069>:
    D.22070 = ret != 0;
    D.22071 = (long int) D.22070;
    D.22072 = __builtin_expect (D.22071, 0);
    if (D.22072 != 0) goto <D.22073>; else goto <D.22074>;
    <D.22073>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1124, "ret == 0");
    <D.22074>:
  }
  <D.22067>:
  D.22075 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.22075);
  if (image2 != 0B) goto <D.22076>; else goto <D.22077>;
  <D.22076>:
  mono_image_addref (image2);
  mutex_inited.39 = mutex_inited;
  if (mutex_inited.39 != 0) goto <D.22078>; else goto <D.22079>;
  <D.22078>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.22080>; else goto <D.22081>;
    <D.22080>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22081>:
    D.22082 = ret != 0;
    D.22083 = (long int) D.22082;
    D.22084 = __builtin_expect (D.22083, 0);
    if (D.22084 != 0) goto <D.22085>; else goto <D.22086>;
    <D.22085>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1130, "ret == 0");
    <D.22086>:
  }
  <D.22079>:
  mono_image_close (image);
  D.22087 = image2;
  return D.22087;
  <D.22077>:
  D.22075 = image->name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.22075, image, 0);
  D.22088 = image->assembly_name;
  if (D.22088 != 0B) goto <D.22089>; else goto <D.22090>;
  <D.22089>:
  D.22088 = image->assembly_name;
  D.22091 = monoeg_g_hash_table_lookup (loaded_images, D.22088);
  if (D.22091 == 0B) goto <D.22092>; else goto <D.22093>;
  <D.22092>:
  D.22088 = image->assembly_name;
  monoeg_g_hash_table_insert_replace (loaded_images, D.22088, image, 0);
  <D.22093>:
  <D.22090>:
  mutex_inited.39 = mutex_inited;
  if (mutex_inited.39 != 0) goto <D.22094>; else goto <D.22095>;
  <D.22094>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.22096>; else goto <D.22097>;
    <D.22096>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22097>:
    D.22098 = ret != 0;
    D.22099 = (long int) D.22098;
    D.22100 = __builtin_expect (D.22099, 0);
    if (D.22100 != 0) goto <D.22101>; else goto <D.22102>;
    <D.22101>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1137, "ret == 0");
    <D.22102>:
  }
  <D.22095>:
  D.22087 = image;
  return D.22087;
}


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

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


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

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


mono_image_open_full (const char * fname, MonoImageOpenStatus * status, gboolean refonly)
{
  struct MonoImage * D.22110;
  int mutex_inited.40;
  _Bool D.22116;
  long int D.22117;
  long int D.22118;
  struct GHashTable * iftmp.41;
  _Bool D.22131;
  long int D.22132;
  long int D.22133;
  _Bool D.22140;
  long int D.22141;
  long int D.22142;
  struct MonoImage * image;
  struct GHashTable * loaded_images;
  char * absfname;

  if (fname == 0B) goto <D.22108>; else goto <D.22109>;
  <D.22108>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1225, "fname != NULL");
  D.22110 = 0B;
  return D.22110;
  <D.22109>:
  absfname = mono_path_canonicalize (fname);
  mutex_inited.40 = mutex_inited;
  if (mutex_inited.40 != 0) goto <D.22112>; else goto <D.22113>;
  <D.22112>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.22114>; else goto <D.22115>;
    <D.22114>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22115>:
    D.22116 = ret != 0;
    D.22117 = (long int) D.22116;
    D.22118 = __builtin_expect (D.22117, 0);
    if (D.22118 != 0) goto <D.22119>; else goto <D.22120>;
    <D.22119>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1305, "ret == 0");
    <D.22120>:
  }
  <D.22113>:
  if (refonly != 0) goto <D.22122>; else goto <D.22123>;
  <D.22122>:
  iftmp.41 = loaded_images_refonly_hash;
  goto <D.22124>;
  <D.22123>:
  iftmp.41 = loaded_images_hash;
  <D.22124>:
  loaded_images = iftmp.41;
  image = monoeg_g_hash_table_lookup (loaded_images, absfname);
  monoeg_g_free (absfname);
  if (image != 0B) goto <D.22125>; else goto <D.22126>;
  <D.22125>:
  mono_image_addref (image);
  mutex_inited.40 = mutex_inited;
  if (mutex_inited.40 != 0) goto <D.22127>; else goto <D.22128>;
  <D.22127>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.22129>; else goto <D.22130>;
    <D.22129>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22130>:
    D.22131 = ret != 0;
    D.22132 = (long int) D.22131;
    D.22133 = __builtin_expect (D.22132, 0);
    if (D.22133 != 0) goto <D.22134>; else goto <D.22135>;
    <D.22134>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1312, "ret == 0");
    <D.22135>:
  }
  <D.22128>:
  D.22110 = image;
  return D.22110;
  <D.22126>:
  mutex_inited.40 = mutex_inited;
  if (mutex_inited.40 != 0) goto <D.22136>; else goto <D.22137>;
  <D.22136>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.22138>; else goto <D.22139>;
    <D.22138>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22139>:
    D.22140 = ret != 0;
    D.22141 = (long int) D.22140;
    D.22142 = __builtin_expect (D.22141, 0);
    if (D.22142 != 0) goto <D.22143>; else goto <D.22144>;
    <D.22143>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1315, "ret == 0");
    <D.22144>:
  }
  <D.22137>:
  image = do_mono_image_open (fname, status, 1, 1, refonly);
  if (image == 0B) goto <D.22145>; else goto <D.22146>;
  <D.22145>:
  D.22110 = 0B;
  return D.22110;
  <D.22146>:
  D.22110 = register_image (image);
  return D.22110;
}


do_mono_image_open (const char * fname, MonoImageOpenStatus * status, gboolean care_about_cli, gboolean care_about_pecoff, gboolean refonly)
{
  int __mono_io_portability_helpers.42;
  struct MonoImage * D.22159;
  long long unsigned int D.22160;
  unsigned int D.22161;
  unsigned int D.22162;
  int D.22163;
  void * * D.22164;
  void * D.22165;
  char * D.22166;
  int D.22169;
  void * D.22170;
  gchar * D.22175;
  unsigned char D.22176;
  <unnamed-unsigned:1> D.22177;
  int D.22178;
  unsigned char D.22179;
  <unnamed-unsigned:1> D.22180;
  struct MonoCLIImageInfo * iinfo;
  struct MonoImage * image;
  struct MonoFileMap * filed;

  filed = mono_file_map_open (fname);
  if (filed == 0B) goto <D.22148>; else goto <D.22149>;
  <D.22148>:
  __mono_io_portability_helpers.42 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.42 > 0) goto <D.22151>; else goto <D.22152>;
  <D.22151>:
  {
    gchar * ffname;

    ffname = mono_portability_find_file (fname, 1);
    if (ffname != 0B) goto <D.22153>; else goto <D.22154>;
    <D.22153>:
    filed = mono_file_map_open (ffname);
    monoeg_g_free (ffname);
    <D.22154>:
  }
  <D.22152>:
  if (filed == 0B) goto <D.22155>; else goto <D.22156>;
  <D.22155>:
  if (status != 0B) goto <D.22157>; else goto <D.22158>;
  <D.22157>:
  *status = 1;
  <D.22158>:
  D.22159 = 0B;
  return D.22159;
  <D.22156>:
  <D.22149>:
  image = monoeg_malloc0 (980);
  image->raw_buffer_used = 1;
  D.22160 = mono_file_map_size (filed);
  D.22161 = (unsigned int) D.22160;
  image->raw_data_len = D.22161;
  D.22162 = image->raw_data_len;
  D.22163 = mono_file_map_fd (filed);
  D.22164 = &image->raw_data_handle;
  D.22165 = mono_file_map (D.22162, 17, D.22163, 0, D.22164);
  image->raw_data = D.22165;
  D.22166 = image->raw_data;
  if (D.22166 == 0B) goto <D.22167>; else goto <D.22168>;
  <D.22167>:
  image->fileio_used = 1;
  D.22162 = image->raw_data_len;
  D.22169 = mono_file_map_fd (filed);
  D.22164 = &image->raw_data_handle;
  D.22170 = mono_file_map_fileio (D.22162, 17, D.22169, 0, D.22164);
  image->raw_data = D.22170;
  <D.22168>:
  D.22166 = image->raw_data;
  if (D.22166 == 0B) goto <D.22171>; else goto <D.22172>;
  <D.22171>:
  mono_file_map_close (filed);
  monoeg_g_free (image);
  if (status != 0B) goto <D.22173>; else goto <D.22174>;
  <D.22173>:
  *status = 3;
  <D.22174>:
  D.22159 = 0B;
  return D.22159;
  <D.22172>:
  iinfo = monoeg_malloc0 (396);
  image->image_info = iinfo;
  D.22175 = mono_path_resolve_symlinks (fname);
  image->name = D.22175;
  D.22176 = (unsigned char) refonly;
  D.22177 = (<unnamed-unsigned:1>) D.22176;
  image->ref_only = D.22177;
  image->ref_count = 1;
  D.22178 = mono_security_core_clr_determine_platform_image (image);
  D.22179 = (unsigned char) D.22178;
  D.22180 = (<unnamed-unsigned:1>) D.22179;
  image->core_clr_platform_code = D.22180;
  mono_file_map_close (filed);
  D.22159 = do_mono_image_load (image, status, care_about_cli, care_about_pecoff);
  return D.22159;
}


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

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


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

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


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

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


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

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


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.22193;
  unsigned int D.22194;

  D.22194 = __sync_add_and_fetch_4 (val, 1);
  D.22193 = (gint32) D.22194;
  return D.22193;
}


mono_dynamic_stream_reset (struct MonoDynamicStream * stream)
{
  unsigned int D.22196;
  unsigned int D.22197;
  char * D.22198;
  struct GHashTable * D.22199;

  stream->offset = 0;
  D.22196 = stream->offset;
  stream->index = D.22196;
  D.22197 = stream->index;
  stream->alloc_size = D.22197;
  D.22198 = stream->data;
  monoeg_g_free (D.22198);
  stream->data = 0B;
  D.22199 = stream->hash;
  if (D.22199 != 0B) goto <D.22200>; else goto <D.22201>;
  <D.22200>:
  D.22199 = stream->hash;
  monoeg_g_hash_table_destroy (D.22199);
  stream->hash = 0B;
  <D.22201>:
}


mono_image_close_except_pools (struct MonoImage * image)
{
  gboolean D.22204;
  int mutex_inited.43;
  _Bool D.22210;
  long int D.22211;
  long int D.22212;
  int * D.22215;
  int D.22216;
  _Bool D.22223;
  long int D.22224;
  long int D.22225;
  struct GHashTable * iftmp.44;
  unsigned char D.22229;
  unsigned char D.22230;
  char * D.22234;
  const char * D.22237;
  void * D.22240;
  _Bool D.22247;
  long int D.22248;
  long int D.22249;
  struct MonoAssembly * * D.22254;
  unsigned char D.22256;
  unsigned int i.45;
  unsigned int D.22259;
  struct MonoAssembly * * D.22260;
  struct MonoAssembly * D.22261;
  struct MonoAssembly * D.22262;
  int D.22265;
  int D.22268;
  unsigned char D.22271;
  char * D.22274;
  unsigned char D.22277;
  void * D.22280;
  unsigned char D.22282;
  char * D.22285;
  unsigned int D.22288;
  char * D.22289;
  void * * D.22292;
  void * * D.22293;
  void * D.22294;
  int D.22299;
  int debug_assembly_unload.46;
  gchar * D.22303;
  char * D.22305;
  char * D.22306;
  struct MonoImage * * D.22307;
  struct GHashTable * D.22308;
  struct GHashTable * D.22311;
  struct MonoInternalHashTable * D.22314;
  struct GHashTable * D.22315;
  struct GHashTable * D.22316;
  struct GHashTable * D.22319;
  struct GHashTable * D.22322;
  struct GHashTable * D.22325;
  struct GHashTable * D.22328;
  struct GHashTable * D.22329;
  struct GHashTable * D.22330;
  struct GHashTable * D.22331;
  struct GHashTable * D.22332;
  struct GHashTable * D.22333;
  struct GHashTable * D.22334;
  struct GHashTable * D.22335;
  struct GHashTable * D.22336;
  struct GHashTable * D.22337;
  struct GHashTable * D.22338;
  struct GHashTable * D.22339;
  struct GHashTable * D.22340;
  struct GHashTable * D.22341;
  struct GHashTable * D.22342;
  struct GHashTable * D.22343;
  struct GHashTable * D.22344;
  struct GHashTable * D.22345;
  struct GHashTable * D.22346;
  struct GHashTable * D.22347;
  struct GHashTable * D.22348;
  struct GHashTable * D.22349;
  struct GHashTable * D.22350;
  struct GHashTable * D.22351;
  struct GHashTable * D.22352;
  struct GHashTable * D.22353;
  struct GHashTable * D.22354;
  struct GHashTable * D.22355;
  struct GHashTable * D.22356;
  struct GHashTable * D.22357;
  struct GHashTable * D.22358;
  struct GHashTable * D.22359;
  struct GHashTable * D.22360;
  struct GHashTable * D.22361;
  struct GHashTable * D.22362;
  struct GHashTable * D.22363;
  struct GHashTable * D.22364;
  struct GHashTable * D.22365;
  struct GHashTable * D.22366;
  struct MonoPropertyHash * D.22369;
  int iftmp.47;
  struct GSList * D.22375;
  int D.22377;
  _Bool D.22379;
  long int D.22380;
  long int D.22381;
  struct MonoBitSet * D.22384;
  void * D.22387;
  struct MonoSectionTable * D.22390;
  void * * D.22393;
  struct MonoImage * * D.22396;
  struct MonoImage * * D.22397;
  struct MonoImage * D.22398;
  int D.22401;
  unsigned int i.48;
  unsigned int D.22405;
  gboolean * D.22406;
  struct CRITICAL_SECTION * D.22409;
  struct CRITICAL_SECTION * D.22410;
  const char * D.22413;
  struct MonoImage * image2;
  struct GHashTable * loaded_images;
  int i;

  if (image == 0B) goto <D.22202>; else goto <D.22203>;
  <D.22202>:
  monoeg_g_log (0B, 8, "%s:%d: assertion \'%s\' failed", "image.c", 1492, "image != NULL");
  D.22204 = 0;
  return D.22204;
  <D.22203>:
  mutex_inited.43 = mutex_inited;
  if (mutex_inited.43 != 0) goto <D.22206>; else goto <D.22207>;
  <D.22206>:
  {
    int ret;

    ret = pthread_mutex_lock (&images_mutex.mutex);
    if (ret != 0) goto <D.22208>; else goto <D.22209>;
    <D.22208>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22209>:
    D.22210 = ret != 0;
    D.22211 = (long int) D.22210;
    D.22212 = __builtin_expect (D.22211, 0);
    if (D.22212 != 0) goto <D.22213>; else goto <D.22214>;
    <D.22213>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1498, "ret == 0");
    <D.22214>:
  }
  <D.22207>:
  D.22215 = &image->ref_count;
  D.22216 = InterlockedDecrement (D.22215);
  if (D.22216 > 0) goto <D.22217>; else goto <D.22218>;
  <D.22217>:
  mutex_inited.43 = mutex_inited;
  if (mutex_inited.43 != 0) goto <D.22219>; else goto <D.22220>;
  <D.22219>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.22221>; else goto <D.22222>;
    <D.22221>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22222>:
    D.22223 = ret != 0;
    D.22224 = (long int) D.22223;
    D.22225 = __builtin_expect (D.22224, 0);
    if (D.22225 != 0) goto <D.22226>; else goto <D.22227>;
    <D.22226>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1501, "ret == 0");
    <D.22227>:
  }
  <D.22220>:
  D.22204 = 0;
  return D.22204;
  <D.22218>:
  D.22229 = BIT_FIELD_REF <*image, 8, 128>;
  D.22230 = D.22229 & 16;
  if (D.22230 != 0) goto <D.22231>; else goto <D.22232>;
  <D.22231>:
  iftmp.44 = loaded_images_refonly_hash;
  goto <D.22233>;
  <D.22232>:
  iftmp.44 = loaded_images_hash;
  <D.22233>:
  loaded_images = iftmp.44;
  D.22234 = image->name;
  image2 = monoeg_g_hash_table_lookup (loaded_images, D.22234);
  if (image == image2) goto <D.22235>; else goto <D.22236>;
  <D.22235>:
  D.22234 = image->name;
  monoeg_g_hash_table_remove (loaded_images, D.22234);
  <D.22236>:
  D.22237 = image->assembly_name;
  if (D.22237 != 0B) goto <D.22238>; else goto <D.22239>;
  <D.22238>:
  D.22237 = image->assembly_name;
  D.22240 = monoeg_g_hash_table_lookup (loaded_images, D.22237);
  if (D.22240 == image) goto <D.22241>; else goto <D.22242>;
  <D.22241>:
  D.22237 = image->assembly_name;
  monoeg_g_hash_table_remove (loaded_images, D.22237);
  <D.22242>:
  <D.22239>:
  mutex_inited.43 = mutex_inited;
  if (mutex_inited.43 != 0) goto <D.22243>; else goto <D.22244>;
  <D.22243>:
  {
    int ret;

    ret = pthread_mutex_unlock (&images_mutex.mutex);
    if (ret != 0) goto <D.22245>; else goto <D.22246>;
    <D.22245>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22246>:
    D.22247 = ret != 0;
    D.22248 = (long int) D.22247;
    D.22249 = __builtin_expect (D.22248, 0);
    if (D.22249 != 0) goto <D.22250>; else goto <D.22251>;
    <D.22250>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 1514, "ret == 0");
    <D.22251>:
  }
  <D.22244>:
  mono_profiler_module_event (image, 2);
  D.22234 = image->name;
  mono_trace (64, 1, "Unloading image %s [%p].", D.22234, image);
  mono_image_invoke_unload_hook (image);
  mono_metadata_clean_for_image (image);
  D.22254 = image->references;
  if (D.22254 != 0B) goto <D.22255>; else goto <D.22252>;
  <D.22255>:
  D.22229 = BIT_FIELD_REF <*image, 8, 128>;
  D.22256 = D.22229 & 8;
  if (D.22256 == 0) goto <D.22257>; else goto <D.22252>;
  <D.22257>:
  i = 0;
  goto <D.20961>;
  <D.20960>:
  D.22254 = image->references;
  i.45 = (unsigned int) i;
  D.22259 = i.45 * 4;
  D.22260 = D.22254 + D.22259;
  D.22261 = *D.22260;
  D.22262 = D.22261 + 4294967295;
  if (D.22262 <= 4294967293B) goto <D.22263>; else goto <D.22264>;
  <D.22263>:
  D.22254 = image->references;
  i.45 = (unsigned int) i;
  D.22259 = i.45 * 4;
  D.22260 = D.22254 + D.22259;
  D.22261 = *D.22260;
  D.22265 = mono_assembly_close_except_image_pools (D.22261);
  if (D.22265 == 0) goto <D.22266>; else goto <D.22267>;
  <D.22266>:
  D.22254 = image->references;
  i.45 = (unsigned int) i;
  D.22259 = i.45 * 4;
  D.22260 = D.22254 + D.22259;
  *D.22260 = 0B;
  <D.22267>:
  <D.22264>:
  i = i + 1;
  <D.20961>:
  D.22268 = image->nreferences;
  if (D.22268 > i) goto <D.20960>; else goto <D.20962>;
  <D.20962>:
  goto <D.22253>;
  <D.22252>:
  D.22254 = image->references;
  if (D.22254 != 0B) goto <D.22269>; else goto <D.22270>;
  <D.22269>:
  D.22254 = image->references;
  monoeg_g_free (D.22254);
  image->references = 0B;
  <D.22270>:
  <D.22253>:
  D.22229 = BIT_FIELD_REF <*image, 8, 128>;
  D.22271 = D.22229 & 1;
  if (D.22271 != 0) goto <D.22272>; else goto <D.22273>;
  <D.22272>:
  D.22274 = image->raw_data;
  if (D.22274 != 0B) goto <D.22275>; else goto <D.22276>;
  <D.22275>:
  D.22229 = BIT_FIELD_REF <*image, 8, 128>;
  D.22277 = D.22229 & 4;
  if (D.22277 != 0) goto <D.22278>; else goto <D.22279>;
  <D.22278>:
  D.22274 = image->raw_data;
  D.22280 = image->raw_data_handle;
  mono_file_unmap_fileio (D.22274, D.22280);
  goto <D.22281>;
  <D.22279>:
  D.22274 = image->raw_data;
  D.22280 = image->raw_data_handle;
  mono_file_unmap (D.22274, D.22280);
  <D.22281>:
  <D.22276>:
  <D.22273>:
  D.22229 = BIT_FIELD_REF <*image, 8, 128>;
  D.22282 = D.22229 & 2;
  if (D.22282 != 0) goto <D.22283>; else goto <D.22284>;
  <D.22283>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.22285 = image->raw_metadata;
    D.22274 = image->raw_data;
    if (D.22285 > D.22274) goto <D.22286>; else goto <D.22287>;
    <D.22286>:
    D.22285 = image->raw_metadata;
    D.22274 = image->raw_data;
    D.22288 = image->raw_data_len;
    D.22289 = D.22274 + D.22288;
    if (D.22285 <= D.22289) goto <D.22290>; else goto <D.22291>;
    <D.22290>:
    image->raw_metadata = 0B;
    <D.22291>:
    <D.22287>:
    i = 0;
    goto <D.20965>;
    <D.20964>:
    D.22292 = ii->cli_sections;
    i.45 = (unsigned int) i;
    D.22259 = i.45 * 4;
    D.22293 = D.22292 + D.22259;
    D.22294 = *D.22293;
    D.22274 = image->raw_data;
    if (D.22294 > D.22274) goto <D.22295>; else goto <D.22296>;
    <D.22295>:
    D.22292 = ii->cli_sections;
    i.45 = (unsigned int) i;
    D.22259 = i.45 * 4;
    D.22293 = D.22292 + D.22259;
    D.22294 = *D.22293;
    D.22274 = image->raw_data;
    D.22288 = image->raw_data_len;
    D.22289 = D.22274 + D.22288;
    if (D.22294 <= D.22289) goto <D.22297>; else goto <D.22298>;
    <D.22297>:
    D.22292 = ii->cli_sections;
    i.45 = (unsigned int) i;
    D.22259 = i.45 * 4;
    D.22293 = D.22292 + D.22259;
    *D.22293 = 0B;
    <D.22298>:
    <D.22296>:
    i = i + 1;
    <D.20965>:
    D.22299 = ii->cli_section_count;
    if (D.22299 > i) goto <D.20964>; else goto <D.20966>;
    <D.20966>:
    D.22274 = image->raw_data;
    monoeg_g_free (D.22274);
  }
  <D.22284>:
  debug_assembly_unload.46 = debug_assembly_unload;
  if (debug_assembly_unload.46 != 0) goto <D.22301>; else goto <D.22302>;
  <D.22301>:
  D.22234 = image->name;
  D.22303 = monoeg_g_strdup_printf ("%s - UNLOADED", D.22234);
  image->name = D.22303;
  goto <D.22304>;
  <D.22302>:
  D.22234 = image->name;
  monoeg_g_free (D.22234);
  D.22305 = image->guid;
  monoeg_g_free (D.22305);
  D.22306 = image->version;
  monoeg_g_free (D.22306);
  D.22307 = image->files;
  monoeg_g_free (D.22307);
  <D.22304>:
  D.22308 = image->method_cache;
  if (D.22308 != 0B) goto <D.22309>; else goto <D.22310>;
  <D.22309>:
  D.22308 = image->method_cache;
  monoeg_g_hash_table_destroy (D.22308);
  <D.22310>:
  D.22311 = image->methodref_cache;
  if (D.22311 != 0B) goto <D.22312>; else goto <D.22313>;
  <D.22312>:
  D.22311 = image->methodref_cache;
  monoeg_g_hash_table_destroy (D.22311);
  <D.22313>:
  D.22314 = &image->class_cache;
  mono_internal_hash_table_destroy (D.22314);
  D.22315 = image->field_cache;
  monoeg_g_hash_table_destroy (D.22315);
  D.22316 = image->array_cache;
  if (D.22316 != 0B) goto <D.22317>; else goto <D.22318>;
  <D.22317>:
  D.22316 = image->array_cache;
  monoeg_g_hash_table_foreach (D.22316, free_array_cache_entry, 0B);
  D.22316 = image->array_cache;
  monoeg_g_hash_table_destroy (D.22316);
  <D.22318>:
  D.22319 = image->szarray_cache;
  if (D.22319 != 0B) goto <D.22320>; else goto <D.22321>;
  <D.22320>:
  D.22319 = image->szarray_cache;
  monoeg_g_hash_table_destroy (D.22319);
  <D.22321>:
  D.22322 = image->ptr_cache;
  if (D.22322 != 0B) goto <D.22323>; else goto <D.22324>;
  <D.22323>:
  D.22322 = image->ptr_cache;
  monoeg_g_hash_table_destroy (D.22322);
  <D.22324>:
  D.22325 = image->name_cache;
  if (D.22325 != 0B) goto <D.22326>; else goto <D.22327>;
  <D.22326>:
  D.22325 = image->name_cache;
  monoeg_g_hash_table_foreach (D.22325, free_hash_table, 0B);
  D.22325 = image->name_cache;
  monoeg_g_hash_table_destroy (D.22325);
  <D.22327>:
  D.22328 = image->native_wrapper_cache;
  free_hash (D.22328);
  D.22329 = image->managed_wrapper_cache;
  free_hash (D.22329);
  D.22330 = image->delegate_begin_invoke_cache;
  free_hash (D.22330);
  D.22331 = image->delegate_end_invoke_cache;
  free_hash (D.22331);
  D.22332 = image->delegate_invoke_cache;
  free_hash (D.22332);
  D.22333 = image->delegate_abstract_invoke_cache;
  free_hash (D.22333);
  D.22334 = image->delegate_bound_static_invoke_cache;
  free_hash (D.22334);
  D.22335 = image->delegate_invoke_generic_cache;
  free_hash (D.22335);
  D.22336 = image->delegate_begin_invoke_generic_cache;
  free_hash (D.22336);
  D.22337 = image->delegate_end_invoke_generic_cache;
  free_hash (D.22337);
  D.22338 = image->synchronized_generic_cache;
  free_hash (D.22338);
  D.22339 = image->remoting_invoke_cache;
  free_hash (D.22339);
  D.22340 = image->runtime_invoke_cache;
  free_hash (D.22340);
  D.22341 = image->runtime_invoke_vtype_cache;
  free_hash (D.22341);
  D.22342 = image->runtime_invoke_direct_cache;
  free_hash (D.22342);
  D.22343 = image->runtime_invoke_vcall_cache;
  free_hash (D.22343);
  D.22344 = image->synchronized_cache;
  free_hash (D.22344);
  D.22345 = image->unbox_wrapper_cache;
  free_hash (D.22345);
  D.22346 = image->cominterop_invoke_cache;
  free_hash (D.22346);
  D.22347 = image->cominterop_wrapper_cache;
  free_hash (D.22347);
  D.22348 = image->typespec_cache;
  free_hash (D.22348);
  D.22349 = image->ldfld_wrapper_cache;
  free_hash (D.22349);
  D.22350 = image->ldflda_wrapper_cache;
  free_hash (D.22350);
  D.22351 = image->stfld_wrapper_cache;
  free_hash (D.22351);
  D.22352 = image->isinst_cache;
  free_hash (D.22352);
  D.22353 = image->castclass_cache;
  free_hash (D.22353);
  D.22354 = image->proxy_isinst_cache;
  free_hash (D.22354);
  D.22355 = image->thunk_invoke_cache;
  free_hash (D.22355);
  D.22356 = image->var_cache_slow;
  free_hash (D.22356);
  D.22357 = image->mvar_cache_slow;
  free_hash (D.22357);
  D.22358 = image->wrapper_param_names;
  free_hash (D.22358);
  D.22359 = image->native_wrapper_aot_cache;
  free_hash (D.22359);
  D.22360 = image->pinvoke_scopes;
  free_hash (D.22360);
  D.22361 = image->pinvoke_scope_filenames;
  free_hash (D.22361);
  D.22362 = image->gsharedvt_types;
  free_hash (D.22362);
  D.22363 = image->memberref_signatures;
  monoeg_g_hash_table_destroy (D.22363);
  D.22364 = image->helper_signatures;
  monoeg_g_hash_table_destroy (D.22364);
  D.22365 = image->method_signatures;
  monoeg_g_hash_table_destroy (D.22365);
  D.22366 = image->rgctx_template_hash;
  if (D.22366 != 0B) goto <D.22367>; else goto <D.22368>;
  <D.22367>:
  D.22366 = image->rgctx_template_hash;
  monoeg_g_hash_table_destroy (D.22366);
  <D.22368>:
  D.22369 = image->property_hash;
  if (D.22369 != 0B) goto <D.22370>; else goto <D.22371>;
  <D.22370>:
  D.22369 = image->property_hash;
  mono_property_hash_destroy (D.22369);
  <D.22371>:
  D.22375 = image->reflection_info_unregister_classes;
  if (D.22375 != 0B) goto <D.22376>; else goto <D.22373>;
  <D.22376>:
  D.22377 = mono_runtime_is_shutting_down ();
  if (D.22377 == 0) goto <D.22378>; else goto <D.22373>;
  <D.22378>:
  iftmp.47 = 1;
  goto <D.22374>;
  <D.22373>:
  iftmp.47 = 0;
  <D.22374>:
  D.22379 = iftmp.47 != 0;
  D.22380 = (long int) D.22379;
  D.22381 = __builtin_expect (D.22380, 0);
  if (D.22381 != 0) goto <D.22382>; else goto <D.22383>;
  <D.22382>:
  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.22383>:
  image->reflection_info_unregister_classes = 0B;
  D.22384 = image->interface_bitset;
  if (D.22384 != 0B) goto <D.22385>; else goto <D.22386>;
  <D.22385>:
  D.22384 = image->interface_bitset;
  mono_unload_interface_ids (D.22384);
  D.22384 = image->interface_bitset;
  mono_bitset_free (D.22384);
  <D.22386>:
  D.22387 = image->image_info;
  if (D.22387 != 0B) goto <D.22388>; else goto <D.22389>;
  <D.22388>:
  {
    struct MonoCLIImageInfo * ii;

    ii = image->image_info;
    D.22390 = ii->cli_section_tables;
    if (D.22390 != 0B) goto <D.22391>; else goto <D.22392>;
    <D.22391>:
    D.22390 = ii->cli_section_tables;
    monoeg_g_free (D.22390);
    <D.22392>:
    D.22393 = ii->cli_sections;
    if (D.22393 != 0B) goto <D.22394>; else goto <D.22395>;
    <D.22394>:
    D.22393 = ii->cli_sections;
    monoeg_g_free (D.22393);
    <D.22395>:
    D.22387 = image->image_info;
    monoeg_g_free (D.22387);
  }
  <D.22389>:
  i = 0;
  goto <D.20969>;
  <D.20968>:
  D.22396 = image->modules;
  i.45 = (unsigned int) i;
  D.22259 = i.45 * 4;
  D.22397 = D.22396 + D.22259;
  D.22398 = *D.22397;
  if (D.22398 != 0B) goto <D.22399>; else goto <D.22400>;
  <D.22399>:
  D.22396 = image->modules;
  i.45 = (unsigned int) i;
  D.22259 = i.45 * 4;
  D.22397 = D.22396 + D.22259;
  D.22398 = *D.22397;
  D.22401 = mono_image_close_except_pools (D.22398);
  if (D.22401 == 0) goto <D.22402>; else goto <D.22403>;
  <D.22402>:
  D.22396 = image->modules;
  i.45 = (unsigned int) i;
  D.22259 = i.45 * 4;
  D.22397 = D.22396 + D.22259;
  *D.22397 = 0B;
  <D.22403>:
  <D.22400>:
  i = i + 1;
  <D.20969>:
  i.48 = (unsigned int) i;
  D.22405 = image->module_count;
  if (i.48 < D.22405) goto <D.20968>; else goto <D.20970>;
  <D.20970>:
  D.22406 = image->modules_loaded;
  if (D.22406 != 0B) goto <D.22407>; else goto <D.22408>;
  <D.22407>:
  D.22406 = image->modules_loaded;
  monoeg_g_free (D.22406);
  <D.22408>:
  D.22409 = &image->szarray_cache_lock;
  DeleteCriticalSection (D.22409);
  D.22410 = &image->lock;
  DeleteCriticalSection (D.22410);
  D.22229 = BIT_FIELD_REF <*image, 8, 128>;
  D.22256 = D.22229 & 8;
  if (D.22256 != 0) goto <D.22411>; else goto <D.22412>;
  <D.22411>:
  D.22413 = image->module_name;
  monoeg_g_free (D.22413);
  mono_dynamic_image_free (image);
  <D.22412>:
  mono_profiler_module_event (image, 3);
  D.22204 = 1;
  return D.22204;
}


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.22415;
  unsigned int D.22416;

  D.22416 = __sync_sub_and_fetch_4 (val, 1);
  D.22415 = (gint32) D.22416;
  return D.22415;
}


mono_image_invoke_unload_hook (struct MonoImage * image)
{
  void (*<T2550>) (struct MonoImage *, void *) D.22418;
  void * D.22419;
  struct GSList * l;
  struct ImageUnloadHook * hook;

  l = image_unload_hooks;
  goto <D.20537>;
  <D.20536>:
  hook = l->data;
  D.22418 = hook->func;
  D.22419 = hook->user_data;
  D.22418 (image, D.22419);
  l = l->next;
  <D.20537>:
  if (l != 0B) goto <D.20536>; else goto <D.20538>;
  <D.20538>:
}


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


mono_image_close_finish (struct MonoImage * image)
{
  struct MonoAssembly * * D.22422;
  unsigned char D.22425;
  unsigned char D.22426;
  unsigned int i.49;
  unsigned int D.22430;
  struct MonoAssembly * * D.22431;
  struct MonoAssembly * D.22432;
  struct MonoAssembly * D.22433;
  int D.22436;
  struct MonoImage * * D.22437;
  struct MonoImage * * D.22438;
  struct MonoImage * D.22439;
  unsigned int i.50;
  unsigned int D.22443;
  struct MonoMemPool * D.22446;
  unsigned int D.22447;
  struct MonoPerfCounters * mono_perfcounters.51;
  unsigned int D.22449;
  unsigned int D.22450;
  int debug_assembly_unload.52;
  int i;

  D.22422 = image->references;
  if (D.22422 != 0B) goto <D.22423>; else goto <D.22424>;
  <D.22423>:
  D.22425 = BIT_FIELD_REF <*image, 8, 128>;
  D.22426 = D.22425 & 8;
  if (D.22426 == 0) goto <D.22427>; else goto <D.22428>;
  <D.22427>:
  i = 0;
  goto <D.20976>;
  <D.20975>:
  D.22422 = image->references;
  i.49 = (unsigned int) i;
  D.22430 = i.49 * 4;
  D.22431 = D.22422 + D.22430;
  D.22432 = *D.22431;
  D.22433 = D.22432 + 4294967295;
  if (D.22433 <= 4294967293B) goto <D.22434>; else goto <D.22435>;
  <D.22434>:
  D.22422 = image->references;
  i.49 = (unsigned int) i;
  D.22430 = i.49 * 4;
  D.22431 = D.22422 + D.22430;
  D.22432 = *D.22431;
  mono_assembly_close_finish (D.22432);
  <D.22435>:
  i = i + 1;
  <D.20976>:
  D.22436 = image->nreferences;
  if (D.22436 > i) goto <D.20975>; else goto <D.20977>;
  <D.20977>:
  D.22422 = image->references;
  monoeg_g_free (D.22422);
  image->references = 0B;
  <D.22428>:
  <D.22424>:
  i = 0;
  goto <D.20979>;
  <D.20978>:
  D.22437 = image->modules;
  i.49 = (unsigned int) i;
  D.22430 = i.49 * 4;
  D.22438 = D.22437 + D.22430;
  D.22439 = *D.22438;
  if (D.22439 != 0B) goto <D.22440>; else goto <D.22441>;
  <D.22440>:
  D.22437 = image->modules;
  i.49 = (unsigned int) i;
  D.22430 = i.49 * 4;
  D.22438 = D.22437 + D.22430;
  D.22439 = *D.22438;
  mono_image_close_finish (D.22439);
  <D.22441>:
  i = i + 1;
  <D.20979>:
  i.50 = (unsigned int) i;
  D.22443 = image->module_count;
  if (i.50 < D.22443) goto <D.20978>; else goto <D.20980>;
  <D.20980>:
  D.22437 = image->modules;
  if (D.22437 != 0B) goto <D.22444>; else goto <D.22445>;
  <D.22444>:
  D.22437 = image->modules;
  monoeg_g_free (D.22437);
  <D.22445>:
  D.22446 = image->mempool;
  D.22447 = mono_mempool_get_allocated (D.22446);
  mono_perfcounters.51 = mono_perfcounters;
  mono_perfcounters.51 = mono_perfcounters;
  D.22449 = mono_perfcounters.51->loader_bytes;
  D.22450 = D.22449 - D.22447;
  mono_perfcounters.51->loader_bytes = D.22450;
  D.22425 = BIT_FIELD_REF <*image, 8, 128>;
  D.22426 = D.22425 & 8;
  if (D.22426 == 0) goto <D.22451>; else goto <D.22452>;
  <D.22451>:
  debug_assembly_unload.52 = debug_assembly_unload;
  if (debug_assembly_unload.52 != 0) goto <D.22454>; else goto <D.22455>;
  <D.22454>:
  D.22446 = image->mempool;
  mono_mempool_invalidate (D.22446);
  goto <D.22456>;
  <D.22455>:
  D.22446 = image->mempool;
  mono_mempool_destroy (D.22446);
  monoeg_g_free (image);
  <D.22456>:
  goto <D.22457>;
  <D.22452>:
  debug_assembly_unload.52 = debug_assembly_unload;
  if (debug_assembly_unload.52 != 0) goto <D.22458>; else goto <D.22459>;
  <D.22458>:
  D.22446 = image->mempool;
  mono_mempool_invalidate (D.22446);
  goto <D.22460>;
  <D.22459>:
  D.22446 = image->mempool;
  mono_mempool_destroy (D.22446);
  <D.22460>:
  <D.22457>:
}


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

  D.22461 = mono_image_close_except_pools (image);
  if (D.22461 != 0) goto <D.22462>; else goto <D.22463>;
  <D.22462>:
  mono_image_close_finish (image);
  <D.22463>:
}


mono_image_strerror (MonoImageOpenStatus status)
{
  const char * D.22464;
  int * D.22465;
  int D.22466;

  switch (status) <default: <D.22467>, case 0: <D.20987>, case 1: <D.20988>, case 2: <D.20990>, case 3: <D.20989>>
  <D.20987>:
  D.22464 = "success";
  return D.22464;
  <D.20988>:
  D.22465 = __errno_location ();
  D.22466 = *D.22465;
  D.22464 = strerror (D.22466);
  return D.22464;
  <D.20989>:
  D.22464 = "File does not contain a valid CIL image";
  return D.22464;
  <D.20990>:
  D.22464 = "An assembly was referenced, but could not be found";
  return D.22464;
  <D.22467>:
  D.22464 = "Internal error";
  return D.22464;
}


mono_image_lookup_resource (struct MonoImage * image, guint32 res_id, guint32 lang_id, gunichar2 * name)
{
  void * D.22471;
  unsigned int D.22480;
  short unsigned int D.22483;
  int D.22484;
  short unsigned int D.22485;
  int D.22486;
  int D.22487;
  unsigned int D.22488;
  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.22469>; else goto <D.22470>;
  <D.22469>:
  D.22471 = 0B;
  return D.22471;
  <D.22470>:
  mono_image_ensure_section_idx (image, 1);
  info = image->image_info;
  if (info == 0B) goto <D.22472>; else goto <D.22473>;
  <D.22472>:
  D.22471 = 0B;
  return D.22471;
  <D.22473>:
  header = &info->cli_header;
  if (header == 0B) goto <D.22474>; else goto <D.22475>;
  <D.22474>:
  D.22471 = 0B;
  return D.22471;
  <D.22475>:
  datadir = &header->datadir;
  if (datadir == 0B) goto <D.22476>; else goto <D.22477>;
  <D.22476>:
  D.22471 = 0B;
  return D.22471;
  <D.22477>:
  rsrc = &datadir->pe_resource_table;
  if (rsrc == 0B) goto <D.22478>; else goto <D.22479>;
  <D.22478>:
  D.22471 = 0B;
  return D.22471;
  <D.22479>:
  D.22480 = rsrc->rva;
  resource_dir = mono_image_rva_map (image, D.22480);
  if (resource_dir == 0B) goto <D.22481>; else goto <D.22482>;
  <D.22481>:
  D.22471 = 0B;
  return D.22471;
  <D.22482>:
  D.22483 = resource_dir->res_named_entries;
  D.22484 = (int) D.22483;
  D.22485 = resource_dir->res_id_entries;
  D.22486 = (int) D.22485;
  D.22487 = D.22484 + D.22486;
  entries = (guint32) D.22487;
  res_entries = resource_dir + 16;
  i = 0;
  goto <D.21032>;
  <D.21031>:
  {
    struct MonoPEResourceDirEntry * entry;
    void * ret;

    D.22488 = i * 8;
    entry = res_entries + D.22488;
    ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, entry, resource_dir, 0);
    if (ret != 0B) goto <D.22489>; else goto <D.22490>;
    <D.22489>:
    D.22471 = ret;
    return D.22471;
    <D.22490>:
  }
  i = i + 1;
  <D.21032>:
  if (i < entries) goto <D.21031>; else goto <D.21033>;
  <D.21033>:
  D.22471 = 0B;
  return D.22471;
}


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.22492;
  unsigned int D.22493;
  unsigned int D.22494;
  unsigned int D.22495;
  void * D.22500;
  _Bool D.22512;
  _Bool D.22513;
  _Bool D.22514;
  short unsigned int D.22519;
  int D.22520;
  short unsigned int D.22521;
  int D.22522;
  int D.22523;
  unsigned int D.22524;
  unsigned int D.22525;
  unsigned int D.22528;
  unsigned int D.22529;
  unsigned int D.22530;
  unsigned int D.22531;
  gboolean is_string;
  gboolean is_dir;
  guint32 name_offset;
  guint32 dir_offset;

  D.22492 = entry->name;
  D.22493 = D.22492 >> 31;
  is_string = (gboolean) D.22493;
  D.22492 = entry->name;
  name_offset = D.22492 & 2147483647;
  D.22494 = entry->dir;
  D.22495 = D.22494 >> 31;
  is_dir = (gboolean) D.22495;
  D.22494 = entry->dir;
  dir_offset = D.22494 & 2147483647;
  if (level == 0) goto <D.22496>; else goto <D.22497>;
  <D.22496>:
  if (is_string != 0) goto <D.22498>; else goto <D.22499>;
  <D.22498>:
  D.22500 = 0B;
  return D.22500;
  <D.22499>:
  goto <D.22501>;
  <D.22497>:
  if (level == 1) goto <D.22502>; else goto <D.22503>;
  <D.22502>:
  if (res_id != name_offset) goto <D.22504>; else goto <D.22505>;
  <D.22504>:
  D.22500 = 0B;
  return D.22500;
  <D.22505>:
  goto <D.22506>;
  <D.22503>:
  if (level == 2) goto <D.22507>; else goto <D.22508>;
  <D.22507>:
  if (is_string == 1) goto <D.22509>; else goto <D.22511>;
  <D.22511>:
  D.22512 = is_string == 0;
  D.22513 = lang_id != 0;
  D.22514 = D.22512 & D.22513;
  if (D.22514 != 0) goto <D.22515>; else goto <D.22510>;
  <D.22515>:
  if (name_offset != lang_id) goto <D.22509>; else goto <D.22510>;
  <D.22509>:
  D.22500 = 0B;
  return D.22500;
  <D.22510>:
  goto <D.22516>;
  <D.22508>:
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "image.c", 1829);
  <D.22516>:
  <D.22506>:
  <D.22501>:
  if (is_dir == 1) goto <D.22517>; else goto <D.22518>;
  <D.22517>:
  {
    struct MonoPEResourceDir * res_dir;
    struct MonoPEResourceDirEntry * sub_entries;
    guint32 entries;
    guint32 i;

    res_dir = root + dir_offset;
    sub_entries = res_dir + 16;
    D.22519 = res_dir->res_named_entries;
    D.22520 = (int) D.22519;
    D.22521 = res_dir->res_id_entries;
    D.22522 = (int) D.22521;
    D.22523 = D.22520 + D.22522;
    entries = (guint32) D.22523;
    i = 0;
    goto <D.21011>;
    <D.21010>:
    {
      struct MonoPEResourceDirEntry * sub_entry;
      void * ret;

      D.22524 = i * 8;
      sub_entry = sub_entries + D.22524;
      D.22525 = level + 1;
      ret = mono_image_walk_resource_tree (info, res_id, lang_id, name, sub_entry, root, D.22525);
      if (ret != 0B) goto <D.22526>; else goto <D.22527>;
      <D.22526>:
      D.22500 = ret;
      return D.22500;
      <D.22527>:
    }
    i = i + 1;
    <D.21011>:
    if (i < entries) goto <D.21010>; else goto <D.21012>;
    <D.21012>:
    D.22500 = 0B;
    return D.22500;
  }
  <D.22518>:
  {
    struct MonoPEResourceDataEntry * data_entry;
    struct MonoPEResourceDataEntry * res;

    data_entry = root + dir_offset;
    res = monoeg_malloc0 (16);
    D.22528 = data_entry->rde_data_offset;
    res->rde_data_offset = D.22528;
    D.22529 = data_entry->rde_size;
    res->rde_size = D.22529;
    D.22530 = data_entry->rde_codepage;
    res->rde_codepage = D.22530;
    D.22531 = data_entry->rde_reserved;
    res->rde_reserved = D.22531;
    D.22500 = res;
    return D.22500;
  }
}


mono_image_get_entry_point (struct MonoImage * image)
{
  uint32_t D.22533;
  void * D.22534;

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


mono_image_get_resource (struct MonoImage * image, guint32 offset, guint32 * size)
{
  unsigned int D.22538;
  unsigned int D.22540;
  unsigned int D.22541;
  const char * D.22542;
  unsigned int D.22547;
  struct MonoCLIImageInfo * iinfo;
  struct MonoCLIHeader * ch;
  const char * data;

  iinfo = image->image_info;
  ch = &iinfo->cli_cli_header;
  D.22538 = ch->ch_resources.rva;
  if (D.22538 == 0) goto <D.22536>; else goto <D.22539>;
  <D.22539>:
  D.22540 = offset + 4;
  D.22541 = ch->ch_resources.size;
  if (D.22540 > D.22541) goto <D.22536>; else goto <D.22537>;
  <D.22536>:
  D.22542 = 0B;
  return D.22542;
  <D.22537>:
  D.22538 = ch->ch_resources.rva;
  data = mono_image_rva_map (image, D.22538);
  if (data == 0B) goto <D.22543>; else goto <D.22544>;
  <D.22543>:
  D.22542 = 0B;
  return D.22542;
  <D.22544>:
  data = data + offset;
  if (size != 0B) goto <D.22545>; else goto <D.22546>;
  <D.22545>:
  D.22547 = mono_read32 (data);
  *size = D.22547;
  <D.22546>:
  data = data + 4;
  D.22542 = data;
  return D.22542;
}


mono_image_load_file_for_image (struct MonoImage * image, int fileidx)
{
  <unnamed-unsigned:24> D.22552;
  int D.22553;
  struct MonoImage * D.22554;
  struct MonoImage * * D.22555;
  sizetype fileidx.53;
  sizetype D.22559;
  sizetype D.22560;
  struct MonoImage * * D.22561;
  struct MonoImage * D.22562;
  unsigned int D.22567;
  unsigned int D.22568;
  void * D.22569;
  int D.22570;
  char * D.22571;
  struct MonoAssembly * D.22574;
  struct MonoImage * * D.22575;
  unsigned int i.54;
  unsigned int D.22577;
  struct MonoImage * * D.22578;
  struct MonoImage * D.22579;
  struct MonoAssembly * D.22582;
  unsigned int i.55;
  unsigned int D.22586;
  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.22549>; else goto <D.22551>;
  <D.22551>:
  D.22552 = t->rows;
  D.22553 = (int) D.22552;
  if (D.22553 < fileidx) goto <D.22549>; else goto <D.22550>;
  <D.22549>:
  D.22554 = 0B;
  return D.22554;
  <D.22550>:
  mono_loader_lock ();
  D.22555 = image->files;
  if (D.22555 != 0B) goto <D.22556>; else goto <D.22557>;
  <D.22556>:
  D.22555 = image->files;
  fileidx.53 = (sizetype) fileidx;
  D.22559 = fileidx.53 + 1073741823;
  D.22560 = D.22559 * 4;
  D.22561 = D.22555 + D.22560;
  D.22562 = *D.22561;
  if (D.22562 != 0B) goto <D.22563>; else goto <D.22564>;
  <D.22563>:
  mono_loader_unlock ();
  D.22555 = image->files;
  fileidx.53 = (sizetype) fileidx;
  D.22559 = fileidx.53 + 1073741823;
  D.22560 = D.22559 * 4;
  D.22561 = D.22555 + D.22560;
  D.22554 = *D.22561;
  return D.22554;
  <D.22564>:
  <D.22557>:
  D.22555 = image->files;
  if (D.22555 == 0B) goto <D.22565>; else goto <D.22566>;
  <D.22565>:
  D.22552 = t->rows;
  D.22567 = (unsigned int) D.22552;
  D.22568 = D.22567 * 4;
  D.22569 = monoeg_malloc0 (D.22568);
  image->files = D.22569;
  <D.22566>:
  D.22570 = fileidx + -1;
  fname_id = mono_metadata_decode_row_col (t, D.22570, 1);
  fname = mono_metadata_string_heap (image, fname_id);
  D.22571 = image->name;
  base_dir = monoeg_g_path_get_dirname (D.22571);
  name = monoeg_g_build_path ("/", base_dir, fname, 0B);
  res = mono_image_open (name, 0B);
  if (res != 0B) goto <D.22572>; else goto <D.22573>;
  <D.22572>:
  {
    int i;

    D.22574 = image->assembly;
    res->assembly = D.22574;
    i = 0;
    goto <D.21057>;
    <D.21056>:
    D.22575 = res->modules;
    i.54 = (unsigned int) i;
    D.22577 = i.54 * 4;
    D.22578 = D.22575 + D.22577;
    D.22579 = *D.22578;
    if (D.22579 != 0B) goto <D.22580>; else goto <D.22581>;
    <D.22580>:
    D.22575 = res->modules;
    i.54 = (unsigned int) i;
    D.22577 = i.54 * 4;
    D.22578 = D.22575 + D.22577;
    D.22579 = *D.22578;
    D.22582 = D.22579->assembly;
    if (D.22582 == 0B) goto <D.22583>; else goto <D.22584>;
    <D.22583>:
    D.22575 = res->modules;
    i.54 = (unsigned int) i;
    D.22577 = i.54 * 4;
    D.22578 = D.22575 + D.22577;
    D.22579 = *D.22578;
    D.22574 = image->assembly;
    D.22579->assembly = D.22574;
    <D.22584>:
    <D.22581>:
    i = i + 1;
    <D.21057>:
    i.55 = (unsigned int) i;
    D.22586 = res->module_count;
    if (i.55 < D.22586) goto <D.21056>; else goto <D.21058>;
    <D.21058>:
    D.22555 = image->files;
    fileidx.53 = (sizetype) fileidx;
    D.22559 = fileidx.53 + 1073741823;
    D.22560 = D.22559 * 4;
    D.22561 = D.22555 + D.22560;
    *D.22561 = res;
  }
  <D.22573>:
  mono_loader_unlock ();
  monoeg_g_free (name);
  monoeg_g_free (base_dir);
  D.22554 = res;
  return D.22554;
}


mono_image_get_strong_name (struct MonoImage * image, guint32 * size)
{
  unsigned int D.22590;
  unsigned int D.22592;
  const char * D.22593;
  struct MonoCLIImageInfo * iinfo;
  struct MonoPEDirEntry * de;
  const char * data;

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  D.22590 = de->size;
  if (D.22590 == 0) goto <D.22588>; else goto <D.22591>;
  <D.22591>:
  D.22592 = de->rva;
  if (D.22592 == 0) goto <D.22588>; else goto <D.22589>;
  <D.22588>:
  D.22593 = 0B;
  return D.22593;
  <D.22589>:
  D.22592 = de->rva;
  data = mono_image_rva_map (image, D.22592);
  if (data == 0B) goto <D.22594>; else goto <D.22595>;
  <D.22594>:
  D.22593 = 0B;
  return D.22593;
  <D.22595>:
  if (size != 0B) goto <D.22596>; else goto <D.22597>;
  <D.22596>:
  D.22590 = de->size;
  *size = D.22590;
  <D.22597>:
  D.22593 = data;
  return D.22593;
}


mono_image_strong_name_position (struct MonoImage * image, guint32 * size)
{
  unsigned int D.22601;
  unsigned int D.22605;
  uint32_t D.22606;
  uint32_t iftmp.56;
  struct MonoCLIImageInfo * iinfo;
  struct MonoPEDirEntry * de;
  guint32 pos;

  iinfo = image->image_info;
  de = &iinfo->cli_cli_header.ch_strong_name;
  if (size != 0B) goto <D.22599>; else goto <D.22600>;
  <D.22599>:
  D.22601 = de->size;
  *size = D.22601;
  <D.22600>:
  D.22601 = de->size;
  if (D.22601 == 0) goto <D.22602>; else goto <D.22604>;
  <D.22604>:
  D.22605 = de->rva;
  if (D.22605 == 0) goto <D.22602>; else goto <D.22603>;
  <D.22602>:
  D.22606 = 0;
  return D.22606;
  <D.22603>:
  D.22605 = de->rva;
  pos = mono_cli_rva_image_map (image, D.22605);
  if (pos != 4294967295) goto <D.22608>; else goto <D.22609>;
  <D.22608>:
  iftmp.56 = pos;
  goto <D.22610>;
  <D.22609>:
  iftmp.56 = 0;
  <D.22610>:
  D.22606 = iftmp.56;
  return D.22606;
}


mono_image_get_public_key (struct MonoImage * image, guint32 * size)
{
  unsigned char D.22612;
  unsigned char D.22613;
  int D.22618;
  unsigned int D.22619;
  const char * D.22620;
  unsigned int D.22621;
  unsigned int D.22622;
  struct MonoTableInfo * D.22625;
  const char * pubkey.57;
  const char * pubkey.58;
  const char * pubkey;
  guint32 len;
  guint32 tok;

  try
    {
      D.22612 = BIT_FIELD_REF <*image, 8, 128>;
      D.22613 = D.22612 & 8;
      if (D.22613 != 0) goto <D.22614>; else goto <D.22615>;
      <D.22614>:
      if (size != 0B) goto <D.22616>; else goto <D.22617>;
      <D.22616>:
      D.22618 = MEM[(struct MonoDynamicImage *)image].public_key_len;
      D.22619 = (unsigned int) D.22618;
      *size = D.22619;
      <D.22617>:
      D.22620 = MEM[(struct MonoDynamicImage *)image].public_key;
      return D.22620;
      <D.22615>:
      D.22621 = BIT_FIELD_REF <*image, 32, 3904>;
      D.22622 = D.22621 & 16777215;
      if (D.22622 != 1) goto <D.22623>; else goto <D.22624>;
      <D.22623>:
      D.22620 = 0B;
      return D.22620;
      <D.22624>:
      D.22625 = &image->tables[32];
      tok = mono_metadata_decode_row_col (D.22625, 0, 6);
      if (tok == 0) goto <D.22626>; else goto <D.22627>;
      <D.22626>:
      D.22620 = 0B;
      return D.22620;
      <D.22627>:
      pubkey.57 = mono_metadata_blob_heap (image, tok);
      pubkey = pubkey.57;
      pubkey.58 = pubkey;
      len = mono_metadata_decode_blob_size (pubkey.58, &pubkey);
      if (size != 0B) goto <D.22630>; else goto <D.22631>;
      <D.22630>:
      *size = len;
      <D.22631>:
      D.22620 = pubkey;
      return D.22620;
    }
  finally
    {
      pubkey = {CLOBBER};
    }
}


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

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


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

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


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

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


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

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


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

  table_id.60 = (unsigned int) table_id;
  if (table_id.60 > 44) goto <D.22646>; else goto <D.22647>;
  <D.22646>:
  D.22648 = 0;
  return D.22648;
  <D.22647>:
  D.22649 = image->tables[table_id].rows;
  D.22648 = (int) D.22649;
  return D.22648;
}


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

  D.22652 = table->rows;
  D.22651 = (int) D.22652;
  return D.22651;
}


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

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


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

  D.22657 = image->dynamic;
  D.22656 = (mono_bool) D.22657;
  return D.22656;
}


mono_image_has_authenticode_entry (struct MonoImage * image)
{
  mono_bool D.22659;
  int iftmp.61;
  unsigned int D.22663;
  unsigned int D.22665;
  struct MonoCLIImageInfo * iinfo;
  struct MonoDotNetHeader * header;
  struct MonoPEDirEntry * de;

  iinfo = image->image_info;
  header = &iinfo->cli_header;
  de = &header->datadir.pe_certificate_table;
  D.22663 = de->rva;
  if (D.22663 != 0) goto <D.22664>; else goto <D.22661>;
  <D.22664>:
  D.22665 = de->size;
  if (D.22665 > 8) goto <D.22666>; else goto <D.22661>;
  <D.22666>:
  iftmp.61 = 1;
  goto <D.22662>;
  <D.22661>:
  iftmp.61 = 0;
  <D.22662>:
  D.22659 = iftmp.61;
  return D.22659;
}


mono_image_alloc (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.62;
  unsigned int D.22669;
  unsigned int D.22670;
  struct MonoMemPool * D.22671;
  void * D.22672;
  void * res;

  mono_perfcounters.62 = mono_perfcounters;
  mono_perfcounters.62 = mono_perfcounters;
  D.22669 = mono_perfcounters.62->loader_bytes;
  D.22670 = D.22669 + size;
  mono_perfcounters.62->loader_bytes = D.22670;
  mono_image_lock (image);
  D.22671 = image->mempool;
  res = mono_mempool_alloc (D.22671, size);
  mono_image_unlock (image);
  D.22672 = res;
  return D.22672;
}


mono_image_alloc0 (struct MonoImage * image, guint size)
{
  struct MonoPerfCounters * mono_perfcounters.63;
  unsigned int D.22675;
  unsigned int D.22676;
  struct MonoMemPool * D.22677;
  void * D.22678;
  void * res;

  mono_perfcounters.63 = mono_perfcounters;
  mono_perfcounters.63 = mono_perfcounters;
  D.22675 = mono_perfcounters.63->loader_bytes;
  D.22676 = D.22675 + size;
  mono_perfcounters.63->loader_bytes = D.22676;
  mono_image_lock (image);
  D.22677 = image->mempool;
  res = mono_mempool_alloc0 (D.22677, size);
  mono_image_unlock (image);
  D.22678 = res;
  return D.22678;
}


mono_image_strdup (struct MonoImage * image, const char * s)
{
  struct MonoPerfCounters * mono_perfcounters.64;
  unsigned int D.22681;
  unsigned int D.22682;
  unsigned int D.22683;
  struct MonoMemPool * D.22684;
  char * D.22685;
  char * res;

  mono_perfcounters.64 = mono_perfcounters;
  mono_perfcounters.64 = mono_perfcounters;
  D.22681 = mono_perfcounters.64->loader_bytes;
  D.22682 = strlen (s);
  D.22683 = D.22681 + D.22682;
  mono_perfcounters.64->loader_bytes = D.22683;
  mono_image_lock (image);
  D.22684 = image->mempool;
  res = mono_mempool_strdup (D.22684, s);
  mono_image_unlock (image);
  D.22685 = res;
  return D.22685;
}


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

  new_list = mono_image_alloc (image, 12);
  new_list->data = data;
  if (list != 0B) goto <D.22688>; else goto <D.22689>;
  <D.22688>:
  iftmp.65 = list->prev;
  goto <D.22690>;
  <D.22689>:
  iftmp.65 = 0B;
  <D.22690>:
  new_list->prev = iftmp.65;
  new_list->next = list;
  D.22691 = new_list->prev;
  if (D.22691 != 0B) goto <D.22692>; else goto <D.22693>;
  <D.22692>:
  D.22691 = new_list->prev;
  D.22691->next = new_list;
  <D.22693>:
  if (list != 0B) goto <D.22694>; else goto <D.22695>;
  <D.22694>:
  list->prev = new_list;
  <D.22695>:
  D.22696 = new_list;
  return D.22696;
}


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

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


mono_image_lock (struct MonoImage * image)
{
  union mono_mutex_t * D.22700;
  _Bool D.22703;
  long int D.22704;
  long int D.22705;

  {
    int ret;

    D.22700 = &image->lock.mutex;
    ret = pthread_mutex_lock (D.22700);
    if (ret != 0) goto <D.22701>; else goto <D.22702>;
    <D.22701>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22702>:
    D.22703 = ret != 0;
    D.22704 = (long int) D.22703;
    D.22705 = __builtin_expect (D.22704, 0);
    if (D.22705 != 0) goto <D.22706>; else goto <D.22707>;
    <D.22706>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2304, "ret == 0");
    <D.22707>:
  }
}


mono_image_unlock (struct MonoImage * image)
{
  union mono_mutex_t * D.22708;
  _Bool D.22711;
  long int D.22712;
  long int D.22713;

  {
    int ret;

    D.22708 = &image->lock.mutex;
    ret = pthread_mutex_unlock (D.22708);
    if (ret != 0) goto <D.22709>; else goto <D.22710>;
    <D.22709>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22710>:
    D.22711 = ret != 0;
    D.22712 = (long int) D.22711;
    D.22713 = __builtin_expect (D.22712, 0);
    if (D.22713 != 0) goto <D.22714>; else goto <D.22715>;
    <D.22714>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2310, "ret == 0");
    <D.22715>:
  }
}


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

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


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

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


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

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


mono_image_append_class_to_reflection_info_set (struct MonoClass * class)
{
  unsigned char D.22721;
  unsigned char D.22722;
  _Bool D.22723;
  long int D.22724;
  long int D.22725;
  struct MonoMemPool * D.22728;
  struct GSList * D.22729;
  struct GSList * D.22730;
  struct MonoImage * image;

  image = class->image;
  D.22721 = BIT_FIELD_REF <*image, 8, 128>;
  D.22722 = D.22721 & 8;
  D.22723 = D.22722 == 0;
  D.22724 = (long int) D.22723;
  D.22725 = __builtin_expect (D.22724, 0);
  if (D.22725 != 0) goto <D.22726>; else goto <D.22727>;
  <D.22726>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "image.c", 2367, "image->dynamic");
  <D.22727>:
  mono_image_lock (image);
  D.22728 = image->mempool;
  D.22729 = image->reflection_info_unregister_classes;
  D.22730 = g_slist_prepend_mempool (D.22728, D.22729, class);
  image->reflection_info_unregister_classes = D.22730;
  mono_image_unlock (image);
}


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

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


