mono_install_runtime_load (struct MonoDomain * (*MonoLoadFunc) (const char *, const char *) func)
{
  load_function = func;
}


mono_runtime_load (const char * filename, const char * runtime_version)
{
  struct MonoDomain * (*<T1c90>) (const char *, const char *) load_function.0;
  _Bool D.20560;
  long int D.20561;
  long int D.20562;
  struct MonoDomain * D.20565;

  load_function.0 = load_function;
  D.20560 = load_function.0 == 0B;
  D.20561 = (long int) D.20560;
  D.20562 = __builtin_expect (D.20561, 0);
  if (D.20562 != 0) goto <D.20563>; else goto <D.20564>;
  <D.20563>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 136, "load_function");
  <D.20564>:
  load_function.0 = load_function;
  D.20565 = load_function.0 (filename, runtime_version);
  return D.20565;
}


mono_runtime_set_no_exec (gboolean val)
{
  no_exec = val;
}


mono_runtime_get_no_exec ()
{
  gboolean D.20567;

  D.20567 = no_exec;
  return D.20567;
}


mono_runtime_init (struct MonoDomain * domain, void (*MonoThreadStartCB) (intptr_t, void *, void *) start_cb, void (*MonoThreadAttachCB) (intptr_t, void *) attach_cb)
{
  struct MonoImage * D.20569;
  struct MonoAppContext * D.20570;
  int D.20571;
  struct MonoAssembly * D.20574;
  struct MonoAppDomainSetup * setup;
  struct MonoAppDomain * ad;
  struct MonoClass * class;

  mono_portability_helpers_init ();
  mono_gc_base_init ();
  mono_monitor_init ();
  mono_thread_pool_init ();
  mono_marshal_init ();
  mono_install_assembly_preload_hook (mono_domain_assembly_preload, 0B);
  mono_install_assembly_refonly_preload_hook (mono_domain_assembly_preload, 1B);
  mono_install_assembly_search_hook (mono_domain_assembly_search, 0B);
  mono_install_assembly_refonly_search_hook (mono_domain_assembly_search, 1B);
  mono_install_assembly_postload_search_hook (mono_domain_assembly_postload_search, 0B);
  mono_install_assembly_postload_refonly_search_hook (mono_domain_assembly_postload_search, 1B);
  mono_install_assembly_load_hook (mono_domain_fire_assembly_load, 0B);
  mono_install_lookup_dynamic_token (mono_reflection_lookup_dynamic_token);
  mono_thread_init (start_cb, attach_cb);
  D.20569 = mono_defaults.corlib;
  class = mono_class_from_name (D.20569, "System", "AppDomainSetup");
  setup = mono_object_new (domain, class);
  D.20569 = mono_defaults.corlib;
  class = mono_class_from_name (D.20569, "System", "AppDomain");
  ad = mono_object_new (domain, class);
  ad->data = domain;
  domain->domain = ad;
  domain->setup = setup;
  InitializeCriticalSection (&mono_delegate_section);
  InitializeCriticalSection (&mono_strtod_mutex);
  mono_thread_attach (domain);
  mono_context_init (domain);
  D.20570 = domain->default_context;
  mono_context_set (D.20570);
  mono_type_initialization_init ();
  D.20571 = mono_runtime_get_no_exec ();
  if (D.20571 == 0) goto <D.20572>; else goto <D.20573>;
  <D.20572>:
  create_domain_objects (domain);
  <D.20573>:
  mono_gc_init ();
  mono_network_init ();
  mono_console_init ();
  mono_attach_init ();
  D.20569 = mono_defaults.corlib;
  D.20574 = D.20569->assembly;
  mono_domain_fire_assembly_load (D.20574, 0B);
  return;
}


mono_domain_assembly_postload_search (struct MonoAssemblyName * aname, void * user_data)
{
  long int user_data.1;
  struct MonoAssembly * D.20579;
  gboolean refonly;
  struct MonoReflectionAssembly * assembly;
  struct MonoDomain * domain;
  char * aname_str;
  struct MonoString * str;

  user_data.1 = (long int) user_data;
  refonly = (gboolean) user_data.1;
  domain = mono_domain_get ();
  aname_str = mono_stringify_assembly_name (aname);
  str = mono_string_new (domain, aname_str);
  if (str == 0B) goto <D.20577>; else goto <D.20578>;
  <D.20577>:
  monoeg_g_free (aname_str);
  D.20579 = 0B;
  return D.20579;
  <D.20578>:
  assembly = mono_try_assembly_resolve (domain, str, refonly);
  monoeg_g_free (aname_str);
  if (assembly != 0B) goto <D.20580>; else goto <D.20581>;
  <D.20580>:
  D.20579 = assembly->assembly;
  return D.20579;
  <D.20581>:
  D.20579 = 0B;
  return D.20579;
}


mono_domain_assembly_search (struct MonoAssemblyName * aname, void * user_data)
{
  long int user_data.2;
  union mono_mutex_t * D.20584;
  _Bool D.20587;
  long int D.20588;
  long int D.20589;
  unsigned char D.20594;
  int D.20596;
  struct MonoAssemblyName * D.20598;
  int D.20599;
  _Bool D.20602;
  long int D.20603;
  long int D.20604;
  struct MonoAssembly * D.20607;
  _Bool D.20610;
  long int D.20611;
  long int D.20612;
  struct MonoDomain * domain;
  struct GSList * tmp;
  struct MonoAssembly * ass;
  gboolean refonly;

  domain = mono_domain_get ();
  user_data.2 = (long int) user_data;
  refonly = (gboolean) user_data.2;
  {
    int ret;

    D.20584 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_lock (D.20584);
    if (ret != 0) goto <D.20585>; else goto <D.20586>;
    <D.20585>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20586>:
    D.20587 = ret != 0;
    D.20588 = (long int) D.20587;
    D.20589 = __builtin_expect (D.20588, 0);
    if (D.20589 != 0) goto <D.20590>; else goto <D.20591>;
    <D.20590>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1853, "ret == 0");
    <D.20591>:
  }
  tmp = domain->domain_assemblies;
  goto <D.20376>;
  <D.20375>:
  ass = tmp->data;
  D.20594 = ass->dynamic;
  if (D.20594 != 0) goto <D.20592>; else goto <D.20595>;
  <D.20595>:
  D.20596 = ass->ref_only;
  if (D.20596 != refonly) goto <D.20592>; else goto <D.20597>;
  <D.20597>:
  D.20598 = &ass->aname;
  D.20599 = mono_assembly_names_equal (aname, D.20598);
  if (D.20599 == 0) goto <D.20592>; else goto <D.20593>;
  <D.20592>:
  // predicted unlikely by continue predictor.
  goto <D.20373>;
  <D.20593>:
  {
    int ret;

    D.20584 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.20584);
    if (ret != 0) goto <D.20600>; else goto <D.20601>;
    <D.20600>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20601>:
    D.20602 = ret != 0;
    D.20603 = (long int) D.20602;
    D.20604 = __builtin_expect (D.20603, 0);
    if (D.20604 != 0) goto <D.20605>; else goto <D.20606>;
    <D.20605>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1860, "ret == 0");
    <D.20606>:
  }
  D.20607 = ass;
  return D.20607;
  <D.20373>:
  tmp = tmp->next;
  <D.20376>:
  if (tmp != 0B) goto <D.20375>; else goto <D.20377>;
  <D.20377>:
  {
    int ret;

    D.20584 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.20584);
    if (ret != 0) goto <D.20608>; else goto <D.20609>;
    <D.20608>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20609>:
    D.20610 = ret != 0;
    D.20611 = (long int) D.20610;
    D.20612 = __builtin_expect (D.20611, 0);
    if (D.20612 != 0) goto <D.20613>; else goto <D.20614>;
    <D.20613>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1863, "ret == 0");
    <D.20614>:
  }
  D.20607 = 0B;
  return D.20607;
}


mono_domain_assembly_preload (struct MonoAssemblyName * aname, gchar * * assemblies_path, void * user_data)
{
  long int user_data.3;
  gchar * * D.20617;
  gchar * D.20620;
  const char * D.20623;
  const char * D.20624;
  gchar * D.20629;
  struct MonoAssembly * D.20632;
  struct MonoDomain * domain;
  struct MonoAssembly * result;
  gboolean refonly;

  domain = mono_domain_get ();
  result = 0B;
  user_data.3 = (long int) user_data;
  refonly = (gboolean) user_data.3;
  set_domain_search_path (domain);
  D.20617 = domain->search_path;
  if (D.20617 != 0B) goto <D.20618>; else goto <D.20619>;
  <D.20618>:
  D.20617 = domain->search_path;
  D.20620 = *D.20617;
  if (D.20620 != 0B) goto <D.20621>; else goto <D.20622>;
  <D.20621>:
  D.20617 = domain->search_path;
  D.20623 = aname->culture;
  D.20624 = aname->name;
  result = real_load (D.20617, D.20623, D.20624, refonly);
  <D.20622>:
  <D.20619>:
  if (result == 0B) goto <D.20625>; else goto <D.20626>;
  <D.20625>:
  if (assemblies_path != 0B) goto <D.20627>; else goto <D.20628>;
  <D.20627>:
  D.20629 = *assemblies_path;
  if (D.20629 != 0B) goto <D.20630>; else goto <D.20631>;
  <D.20630>:
  D.20623 = aname->culture;
  D.20624 = aname->name;
  result = real_load (assemblies_path, D.20623, D.20624, refonly);
  <D.20631>:
  <D.20628>:
  <D.20626>:
  D.20632 = result;
  return D.20632;
}


set_domain_search_path (struct MonoDomain * domain)
{
  union mono_mutex_t * D.20634;
  _Bool D.20637;
  long int D.20638;
  long int D.20639;
  struct MonoAppDomainSetup * D.20642;
  _Bool D.20647;
  long int D.20648;
  long int D.20649;
  gchar * * D.20652;
  unsigned char D.20655;
  _Bool D.20660;
  long int D.20661;
  long int D.20662;
  struct MonoString * D.20665;
  _Bool D.20670;
  long int D.20671;
  long int D.20672;
  struct MonoString * D.20675;
  int D.20678;
  _Bool D.20683;
  long int D.20684;
  long int D.20685;
  gchar * D.20688;
  long unsigned int D.20696;
  sizetype D.20697;
  gchar * D.20698;
  char D.20699;
  gchar * D.20702;
  _Bool D.20709;
  long int D.20710;
  long int D.20711;
  int D.20716;
  long unsigned int D.20717;
  long unsigned int D.20718;
  long unsigned int D.20719;
  long unsigned int D.20720;
  gchar * * D.20721;
  char * D.20722;
  int D.20723;
  _Bool D.20728;
  long int D.20729;
  long int D.20730;
  int D.20733;
  gchar * D.20736;
  char D.20737;
  gchar * D.20740;
  struct GError * gerror.4;
  gchar * D.20746;
  long unsigned int D.20748;
  long unsigned int D.20749;
  sizetype D.20750;
  gchar * * D.20751;
  gchar * D.20752;
  int D.20753;
  gchar * * D.20756;
  gchar * D.20757;
  gchar * D.20759;
  gchar * D.20760;
  char * D.20761;
  long unsigned int D.20766;
  long unsigned int D.20767;
  int D.20768;
  gchar * D.20771;
  struct MonoString * D.20773;
  gchar * D.20776;
  _Bool D.20779;
  long int D.20780;
  long int D.20781;
  struct MonoError error;
  struct MonoAppDomainSetup * setup;
  gchar * * tmp;
  gchar * search_path;
  gint i;
  gint npaths;
  gchar * * pvt_split;
  struct GError * gerror;
  gint appbaselen;

  try
    {
      search_path = 0B;
      npaths = 0;
      pvt_split = 0B;
      gerror = 0B;
      appbaselen = -1;
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_lock (D.20634);
        if (ret != 0) goto <D.20635>; else goto <D.20636>;
        <D.20635>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20636>:
        D.20637 = ret != 0;
        D.20638 = (long int) D.20637;
        D.20639 = __builtin_expect (D.20638, 0);
        if (D.20639 != 0) goto <D.20640>; else goto <D.20641>;
        <D.20640>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1058, "ret == 0");
        <D.20641>:
      }
      D.20642 = domain->setup;
      if (D.20642 == 0B) goto <D.20643>; else goto <D.20644>;
      <D.20643>:
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20645>; else goto <D.20646>;
        <D.20645>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20646>:
        D.20647 = ret != 0;
        D.20648 = (long int) D.20647;
        D.20649 = __builtin_expect (D.20648, 0);
        if (D.20649 != 0) goto <D.20650>; else goto <D.20651>;
        <D.20650>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1061, "ret == 0");
        <D.20651>:
      }
      return;
      <D.20644>:
      D.20652 = domain->search_path;
      if (D.20652 != 0B) goto <D.20653>; else goto <D.20654>;
      <D.20653>:
      D.20642 = domain->setup;
      D.20655 = D.20642->path_changed;
      if (D.20655 == 0) goto <D.20656>; else goto <D.20657>;
      <D.20656>:
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20658>; else goto <D.20659>;
        <D.20658>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20659>:
        D.20660 = ret != 0;
        D.20661 = (long int) D.20660;
        D.20662 = __builtin_expect (D.20661, 0);
        if (D.20662 != 0) goto <D.20663>; else goto <D.20664>;
        <D.20663>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1066, "ret == 0");
        <D.20664>:
      }
      return;
      <D.20657>:
      <D.20654>:
      setup = domain->setup;
      D.20665 = setup->application_base;
      if (D.20665 == 0B) goto <D.20666>; else goto <D.20667>;
      <D.20666>:
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20668>; else goto <D.20669>;
        <D.20668>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20669>:
        D.20670 = ret != 0;
        D.20671 = (long int) D.20670;
        D.20672 = __builtin_expect (D.20671, 0);
        if (D.20672 != 0) goto <D.20673>; else goto <D.20674>;
        <D.20673>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1071, "ret == 0");
        <D.20674>:
      }
      return;
      <D.20667>:
      npaths = npaths + 1;
      D.20675 = setup->private_bin_path;
      if (D.20675 != 0B) goto <D.20676>; else goto <D.20677>;
      <D.20676>:
      D.20675 = setup->private_bin_path;
      search_path = mono_string_to_utf8_checked (D.20675, &error);
      D.20678 = mono_error_ok (&error);
      if (D.20678 == 0) goto <D.20679>; else goto <D.20680>;
      <D.20679>:
      monoeg_g_log (0B, 16, "Could not decode AppDomain search path since it contains invalid characters");
      mono_error_cleanup (&error);
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20681>; else goto <D.20682>;
        <D.20681>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20682>:
        D.20683 = ret != 0;
        D.20684 = (long int) D.20683;
        D.20685 = __builtin_expect (D.20684, 0);
        if (D.20685 != 0) goto <D.20686>; else goto <D.20687>;
        <D.20686>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1082, "ret == 0");
        <D.20687>:
      }
      return;
      <D.20680>:
      <D.20677>:
      D.20688 = domain->private_bin_path;
      if (D.20688 != 0B) goto <D.20689>; else goto <D.20690>;
      <D.20689>:
      if (search_path == 0B) goto <D.20691>; else goto <D.20692>;
      <D.20691>:
      search_path = domain->private_bin_path;
      goto <D.20693>;
      <D.20692>:
      {
        gchar * tmp2;

        tmp2 = search_path;
        D.20688 = domain->private_bin_path;
        search_path = monoeg_g_strjoin (";", search_path, D.20688, 0B);
        monoeg_g_free (tmp2);
      }
      <D.20693>:
      <D.20690>:
      if (search_path != 0B) goto <D.20694>; else goto <D.20695>;
      <D.20694>:
      {
        gint slen;

        D.20696 = strlen (search_path);
        slen = (gint) D.20696;
        i = 0;
        goto <D.20166>;
        <D.20165>:
        D.20697 = (sizetype) i;
        D.20698 = search_path + D.20697;
        D.20699 = *D.20698;
        if (D.20699 == 58) goto <D.20700>; else goto <D.20701>;
        <D.20700>:
        D.20697 = (sizetype) i;
        D.20698 = search_path + D.20697;
        *D.20698 = 59;
        <D.20701>:
        i = i + 1;
        <D.20166>:
        if (i < slen) goto <D.20165>; else goto <D.20167>;
        <D.20167>:
        pvt_split = monoeg_g_strsplit (search_path, ";", 1000);
        monoeg_g_free (search_path);
        tmp = pvt_split;
        goto <D.20169>;
        <D.20168>:
        tmp = tmp + 8;
        npaths = npaths + 1;
        <D.20169>:
        D.20702 = *tmp;
        if (D.20702 != 0B) goto <D.20168>; else goto <D.20170>;
        <D.20170>:
      }
      <D.20695>:
      if (npaths == 0) goto <D.20703>; else goto <D.20704>;
      <D.20703>:
      if (pvt_split != 0B) goto <D.20705>; else goto <D.20706>;
      <D.20705>:
      monoeg_g_strfreev (pvt_split);
      <D.20706>:
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20707>; else goto <D.20708>;
        <D.20707>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20708>:
        D.20709 = ret != 0;
        D.20710 = (long int) D.20709;
        D.20711 = __builtin_expect (D.20710, 0);
        if (D.20711 != 0) goto <D.20712>; else goto <D.20713>;
        <D.20712>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1133, "ret == 0");
        <D.20713>:
      }
      return;
      <D.20704>:
      D.20652 = domain->search_path;
      if (D.20652 != 0B) goto <D.20714>; else goto <D.20715>;
      <D.20714>:
      D.20652 = domain->search_path;
      monoeg_g_strfreev (D.20652);
      <D.20715>:
      D.20716 = npaths + 1;
      D.20717 = (long unsigned int) D.20716;
      D.20718 = D.20717 * 8;
      tmp = monoeg_malloc (D.20718);
      D.20719 = (long unsigned int) npaths;
      D.20720 = D.20719 * 8;
      D.20721 = tmp + D.20720;
      *D.20721 = 0B;
      D.20665 = setup->application_base;
      D.20722 = mono_string_to_utf8_checked (D.20665, &error);
      *tmp = D.20722;
      D.20723 = mono_error_ok (&error);
      if (D.20723 == 0) goto <D.20724>; else goto <D.20725>;
      <D.20724>:
      mono_error_cleanup (&error);
      monoeg_g_strfreev (pvt_split);
      monoeg_g_free (tmp);
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20726>; else goto <D.20727>;
        <D.20726>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20727>:
        D.20728 = ret != 0;
        D.20729 = (long int) D.20728;
        D.20730 = __builtin_expect (D.20729, 0);
        if (D.20730 != 0) goto <D.20731>; else goto <D.20732>;
        <D.20731>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1149, "ret == 0");
        <D.20732>:
      }
      return;
      <D.20725>:
      domain->search_path = tmp;
      D.20702 = *tmp;
      D.20733 = strncmp (D.20702, "file://", 7);
      if (D.20733 == 0) goto <D.20734>; else goto <D.20735>;
      <D.20734>:
      {
        gchar * file;
        gchar * uri;
        gchar * tmpuri;

        file = *tmp;
        uri = *tmp;
        D.20736 = uri + 7;
        D.20737 = *D.20736;
        if (D.20737 != 47) goto <D.20738>; else goto <D.20739>;
        <D.20738>:
        D.20736 = uri + 7;
        uri = monoeg_g_strdup_printf ("file:///%s", D.20736);
        <D.20739>:
        tmpuri = uri;
        uri = mono_escape_uri_string (tmpuri);
        D.20740 = monoeg_g_filename_from_uri (uri, 0B, &gerror);
        *tmp = D.20740;
        monoeg_g_free (uri);
        if (tmpuri != file) goto <D.20741>; else goto <D.20742>;
        <D.20741>:
        monoeg_g_free (tmpuri);
        <D.20742>:
        gerror.4 = gerror;
        if (gerror.4 != 0B) goto <D.20744>; else goto <D.20745>;
        <D.20744>:
        gerror.4 = gerror;
        D.20746 = gerror.4->message;
        monoeg_g_log (0B, 16, "%s\n", D.20746);
        gerror.4 = gerror;
        monoeg_g_error_free (gerror.4);
        *tmp = file;
        goto <D.20747>;
        <D.20745>:
        monoeg_g_free (file);
        <D.20747>:
      }
      <D.20735>:
      i = 1;
      goto <D.20198>;
      <D.20197>:
      D.20748 = (long unsigned int) i;
      D.20749 = D.20748 * 8;
      D.20750 = D.20749 + 18446744073709551608;
      D.20751 = pvt_split + D.20750;
      D.20752 = *D.20751;
      D.20753 = monoeg_g_path_is_absolute (D.20752);
      if (D.20753 != 0) goto <D.20754>; else goto <D.20755>;
      <D.20754>:
      D.20748 = (long unsigned int) i;
      D.20749 = D.20748 * 8;
      D.20756 = tmp + D.20749;
      D.20748 = (long unsigned int) i;
      D.20749 = D.20748 * 8;
      D.20750 = D.20749 + 18446744073709551608;
      D.20751 = pvt_split + D.20750;
      D.20752 = *D.20751;
      D.20757 = monoeg_strdup (D.20752);
      *D.20756 = D.20757;
      goto <D.20758>;
      <D.20755>:
      D.20748 = (long unsigned int) i;
      D.20749 = D.20748 * 8;
      D.20756 = tmp + D.20749;
      D.20702 = *tmp;
      D.20748 = (long unsigned int) i;
      D.20749 = D.20748 * 8;
      D.20750 = D.20749 + 18446744073709551608;
      D.20751 = pvt_split + D.20750;
      D.20752 = *D.20751;
      D.20759 = monoeg_g_build_path ("/", D.20702, D.20752, 0B);
      *D.20756 = D.20759;
      <D.20758>:
      D.20748 = (long unsigned int) i;
      D.20749 = D.20748 * 8;
      D.20756 = tmp + D.20749;
      D.20760 = *D.20756;
      D.20761 = __builtin_strchr (D.20760, 46);
      if (D.20761 != 0B) goto <D.20762>; else goto <D.20763>;
      <D.20762>:
      {
        gchar * reduced;
        gchar * freeme;

        D.20748 = (long unsigned int) i;
        D.20749 = D.20748 * 8;
        D.20756 = tmp + D.20749;
        D.20760 = *D.20756;
        reduced = mono_path_canonicalize (D.20760);
        if (appbaselen == -1) goto <D.20764>; else goto <D.20765>;
        <D.20764>:
        D.20702 = *tmp;
        D.20766 = strlen (D.20702);
        appbaselen = (gint) D.20766;
        <D.20765>:
        D.20702 = *tmp;
        D.20767 = (long unsigned int) appbaselen;
        D.20768 = strncmp (D.20702, reduced, D.20767);
        if (D.20768 != 0) goto <D.20769>; else goto <D.20770>;
        <D.20769>:
        monoeg_g_free (reduced);
        D.20748 = (long unsigned int) i;
        D.20749 = D.20748 * 8;
        D.20756 = tmp + D.20749;
        D.20760 = *D.20756;
        monoeg_g_free (D.20760);
        D.20748 = (long unsigned int) i;
        D.20749 = D.20748 * 8;
        D.20756 = tmp + D.20749;
        D.20771 = monoeg_strdup ("");
        *D.20756 = D.20771;
        // predicted unlikely by continue predictor.
        goto <D.20196>;
        <D.20770>:
        D.20748 = (long unsigned int) i;
        D.20749 = D.20748 * 8;
        D.20756 = tmp + D.20749;
        freeme = *D.20756;
        D.20748 = (long unsigned int) i;
        D.20749 = D.20748 * 8;
        D.20756 = tmp + D.20749;
        *D.20756 = reduced;
        monoeg_g_free (freeme);
      }
      <D.20763>:
      <D.20196>:
      i = i + 1;
      <D.20198>:
      if (pvt_split != 0B) goto <D.20772>; else goto <D.20199>;
      <D.20772>:
      if (i < npaths) goto <D.20197>; else goto <D.20199>;
      <D.20199>:
      D.20773 = setup->private_bin_path_probe;
      if (D.20773 != 0B) goto <D.20774>; else goto <D.20775>;
      <D.20774>:
      D.20702 = *tmp;
      monoeg_g_free (D.20702);
      D.20776 = monoeg_strdup ("");
      *tmp = D.20776;
      <D.20775>:
      D.20642 = domain->setup;
      D.20642->path_changed = 0;
      monoeg_g_strfreev (pvt_split);
      {
        int ret;

        D.20634 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20634);
        if (ret != 0) goto <D.20777>; else goto <D.20778>;
        <D.20777>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20778>:
        D.20779 = ret != 0;
        D.20780 = (long int) D.20779;
        D.20781 = __builtin_expect (D.20780, 0);
        if (D.20781 != 0) goto <D.20782>; else goto <D.20783>;
        <D.20782>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1218, "ret == 0");
        <D.20783>:
      }
    }
  finally
    {
      error = {CLOBBER};
      gerror = {CLOBBER};
    }
}


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

  if (str != 0B) goto <D.20787>; else goto <D.20788>;
  <D.20787>:
  D.20789 = __strdup (str);
  return D.20789;
  <D.20788>:
  D.20789 = 0B;
  return D.20789;
}


real_load (gchar * * search_path, const gchar * culture, const gchar * name, gboolean refonly)
{
  char D.20795;
  long unsigned int D.20796;
  gchar * D.20797;
  char D.20798;
  sizetype D.20801;
  sizetype D.20802;
  gchar * D.20803;
  int D.20804;
  int D.20806;
  int D.20808;
  int D.20810;
  struct MonoAssembly * D.20812;
  struct MonoAssembly * result;
  gchar * * path;
  gchar * filename;
  const gchar * local_culture;
  gint len;
  gboolean is_private;

  try
    {
      result = 0B;
      is_private = 0;
      if (culture == 0B) goto <D.20791>; else goto <D.20794>;
      <D.20794>:
      D.20795 = *culture;
      if (D.20795 == 0) goto <D.20791>; else goto <D.20792>;
      <D.20791>:
      local_culture = "";
      goto <D.20793>;
      <D.20792>:
      local_culture = culture;
      <D.20793>:
      filename = monoeg_g_strconcat (name, ".dll", 0B);
      D.20796 = strlen (filename);
      len = (gint) D.20796;
      path = search_path;
      goto <D.20355>;
      <D.20354>:
      D.20797 = *path;
      D.20798 = *D.20797;
      if (D.20798 == 0) goto <D.20799>; else goto <D.20800>;
      <D.20799>:
      is_private = 1;
      // predicted unlikely by continue predictor.
      goto <D.20352>;
      <D.20800>:
      D.20801 = (sizetype) len;
      D.20802 = D.20801 + 18446744073709551612;
      D.20803 = filename + D.20802;
      strcpy (D.20803, ".dll");
      D.20797 = *path;
      D.20804 = try_load_from (&result, D.20797, local_culture, "", filename, refonly, is_private);
      if (D.20804 != 0) goto <D.20353>; else goto <D.20805>;
      <D.20805>:
      D.20801 = (sizetype) len;
      D.20802 = D.20801 + 18446744073709551612;
      D.20803 = filename + D.20802;
      strcpy (D.20803, ".exe");
      D.20797 = *path;
      D.20806 = try_load_from (&result, D.20797, local_culture, "", filename, refonly, is_private);
      if (D.20806 != 0) goto <D.20353>; else goto <D.20807>;
      <D.20807>:
      D.20801 = (sizetype) len;
      D.20802 = D.20801 + 18446744073709551612;
      D.20803 = filename + D.20802;
      strcpy (D.20803, ".dll");
      D.20797 = *path;
      D.20808 = try_load_from (&result, D.20797, local_culture, name, filename, refonly, is_private);
      if (D.20808 != 0) goto <D.20353>; else goto <D.20809>;
      <D.20809>:
      D.20801 = (sizetype) len;
      D.20802 = D.20801 + 18446744073709551612;
      D.20803 = filename + D.20802;
      strcpy (D.20803, ".exe");
      D.20797 = *path;
      D.20810 = try_load_from (&result, D.20797, local_culture, name, filename, refonly, is_private);
      if (D.20810 != 0) goto <D.20353>; else goto <D.20811>;
      <D.20811>:
      <D.20352>:
      path = path + 8;
      <D.20355>:
      D.20797 = *path;
      if (D.20797 != 0B) goto <D.20354>; else goto <D.20353>;
      <D.20353>:
      monoeg_g_free (filename);
      D.20812 = result;
      return D.20812;
    }
  finally
    {
      result = {CLOBBER};
    }
}


strcpy (char * restrict __dest, const char * restrict __src)
{
  char * D.20815;
  long unsigned int D.20816;

  D.20816 = __builtin_object_size (__dest, 1);
  D.20815 = __builtin___strcpy_chk (__dest, __src, D.20816);
  return D.20815;
}


try_load_from (struct MonoAssembly * * assembly, const gchar * path1, const gchar * path2, const gchar * path3, const gchar * path4, gboolean refonly, gboolean is_private)
{
  int __mono_io_portability_helpers.5;
  struct MonoAssembly * D.20826;
  gboolean D.20827;
  struct MonoAssembly * D.20828;
  _Bool D.20829;
  gchar * fullpath;
  gboolean found;

  found = 0;
  *assembly = 0B;
  fullpath = monoeg_g_build_path ("/", path1, path2, path3, path4, 0B);
  __mono_io_portability_helpers.5 = __mono_io_portability_helpers;
  if (__mono_io_portability_helpers.5 > 0) goto <D.20819>; else goto <D.20820>;
  <D.20819>:
  {
    gchar * new_fullpath;

    new_fullpath = mono_portability_find_file (fullpath, 1);
    if (new_fullpath != 0B) goto <D.20821>; else goto <D.20822>;
    <D.20821>:
    monoeg_g_free (fullpath);
    fullpath = new_fullpath;
    found = 1;
    <D.20822>:
  }
  goto <D.20823>;
  <D.20820>:
  found = monoeg_g_file_test (fullpath, 1);
  <D.20823>:
  if (found != 0) goto <D.20824>; else goto <D.20825>;
  <D.20824>:
  D.20826 = mono_assembly_open_full (fullpath, 0B, refonly);
  *assembly = D.20826;
  <D.20825>:
  monoeg_g_free (fullpath);
  D.20828 = *assembly;
  D.20829 = D.20828 != 0B;
  D.20827 = (gboolean) D.20829;
  return D.20827;
}


create_domain_objects (struct MonoDomain * domain)
{
  struct MonoImage * D.20833;
  struct MonoException * D.20834;
  struct MonoException * D.20835;
  struct MonoException * D.20836;
  struct MonoClass * D.20837;
  struct MonoObject * D.20838;
  struct MonoClass * D.20841;
  struct MonoClass * D.20842;
  struct MonoDomain * old_domain;
  struct MonoString * arg;

  old_domain = mono_domain_get ();
  if (domain != old_domain) goto <D.20831>; else goto <D.20832>;
  <D.20831>:
  mono_thread_push_appdomain_ref (domain);
  mono_domain_set_internal_with_options (domain, 0);
  <D.20832>:
  arg = mono_string_new (domain, "Out of memory");
  D.20833 = mono_defaults.corlib;
  D.20834 = mono_exception_from_name_two_strings (D.20833, "System", "OutOfMemoryException", arg, 0B);
  domain->out_of_memory_ex = D.20834;
  arg = mono_string_new (domain, "A null value was found where an object instance was required");
  D.20833 = mono_defaults.corlib;
  D.20835 = mono_exception_from_name_two_strings (D.20833, "System", "NullReferenceException", arg, 0B);
  domain->null_reference_ex = D.20835;
  arg = mono_string_new (domain, "The requested operation caused a stack overflow.");
  D.20833 = mono_defaults.corlib;
  D.20836 = mono_exception_from_name_two_strings (D.20833, "System", "StackOverflowException", arg, 0B);
  domain->stack_overflow_ex = D.20836;
  D.20837 = mono_defaults.object_class;
  D.20838 = mono_object_new (domain, D.20837);
  domain->ephemeron_tombstone = D.20838;
  if (domain != old_domain) goto <D.20839>; else goto <D.20840>;
  <D.20839>:
  mono_thread_pop_appdomain_ref ();
  mono_domain_set_internal_with_options (old_domain, 0);
  <D.20840>:
  D.20841 = mono_defaults.int_class;
  D.20842 = mono_array_class_get (D.20841, 1);
  mono_class_init (D.20842);
}


mono_domain_fire_assembly_load (struct MonoAssembly * assembly, void * user_data)
{
  struct MonoAppDomain * D.20843;
  struct MonoVTable * D.20846;
  union mono_mutex_t * D.20847;
  _Bool D.20850;
  long int D.20851;
  long int D.20852;
  _Bool D.20857;
  long int D.20858;
  long int D.20859;
  struct MonoClassField * assembly_load_field.6;
  struct MonoClassField * assembly_load_field.7;
  _Bool D.20866;
  long int D.20867;
  long int D.20868;
  void * load_value.8;
  _Bool D.20874;
  long int D.20875;
  long int D.20876;
  struct MonoMethod * assembly_load_method.9;
  struct MonoMethod * assembly_load_method.10;
  _Bool D.20883;
  long int D.20884;
  long int D.20885;
  static struct MonoClassField * assembly_load_field;
  static struct MonoMethod * assembly_load_method;
  struct MonoDomain * domain;
  struct MonoReflectionAssembly * ref_assembly;
  struct MonoClass * klass;
  void * load_value;
  void * params[1];

  try
    {
      domain = mono_domain_get ();
      D.20843 = domain->domain;
      if (D.20843 == 0B) goto <D.20844>; else goto <D.20845>;
      <D.20844>:
      return;
      <D.20845>:
      D.20843 = domain->domain;
      D.20846 = D.20843->mbr.obj.vtable;
      klass = D.20846->klass;
      {
        int ret;

        D.20847 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_lock (D.20847);
        if (ret != 0) goto <D.20848>; else goto <D.20849>;
        <D.20848>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20849>:
        D.20850 = ret != 0;
        D.20851 = (long int) D.20850;
        D.20852 = __builtin_expect (D.20851, 0);
        if (D.20852 != 0) goto <D.20853>; else goto <D.20854>;
        <D.20853>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1011, "ret == 0");
        <D.20854>:
      }
      add_assemblies_to_domain (domain, assembly, 0B);
      {
        int ret;

        D.20847 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20847);
        if (ret != 0) goto <D.20855>; else goto <D.20856>;
        <D.20855>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20856>:
        D.20857 = ret != 0;
        D.20858 = (long int) D.20857;
        D.20859 = __builtin_expect (D.20858, 0);
        if (D.20859 != 0) goto <D.20860>; else goto <D.20861>;
        <D.20860>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1013, "ret == 0");
        <D.20861>:
      }
      assembly_load_field.6 = assembly_load_field;
      if (assembly_load_field.6 == 0B) goto <D.20863>; else goto <D.20864>;
      <D.20863>:
      assembly_load_field.7 = mono_class_get_field_from_name (klass, "AssemblyLoad");
      assembly_load_field = assembly_load_field.7;
      assembly_load_field.6 = assembly_load_field;
      D.20866 = assembly_load_field.6 == 0B;
      D.20867 = (long int) D.20866;
      D.20868 = __builtin_expect (D.20867, 0);
      if (D.20868 != 0) goto <D.20869>; else goto <D.20870>;
      <D.20869>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1017, "assembly_load_field");
      <D.20870>:
      <D.20864>:
      D.20843 = domain->domain;
      assembly_load_field.6 = assembly_load_field;
      mono_field_get_value (D.20843, assembly_load_field.6, &load_value);
      load_value.8 = load_value;
      if (load_value.8 == 0B) goto <D.20872>; else goto <D.20873>;
      <D.20872>:
      return;
      <D.20873>:
      ref_assembly = mono_assembly_get_object (domain, assembly);
      D.20874 = ref_assembly == 0B;
      D.20875 = (long int) D.20874;
      D.20876 = __builtin_expect (D.20875, 0);
      if (D.20876 != 0) goto <D.20877>; else goto <D.20878>;
      <D.20877>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1027, "ref_assembly");
      <D.20878>:
      assembly_load_method.9 = assembly_load_method;
      if (assembly_load_method.9 == 0B) goto <D.20880>; else goto <D.20881>;
      <D.20880>:
      assembly_load_method.10 = mono_class_get_method_from_name (klass, "DoAssemblyLoad", -1);
      assembly_load_method = assembly_load_method.10;
      assembly_load_method.9 = assembly_load_method;
      D.20883 = assembly_load_method.9 == 0B;
      D.20884 = (long int) D.20883;
      D.20885 = __builtin_expect (D.20884, 0);
      if (D.20885 != 0) goto <D.20886>; else goto <D.20887>;
      <D.20886>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1031, "assembly_load_method");
      <D.20887>:
      <D.20881>:
      params[0] = ref_assembly;
      assembly_load_method.9 = assembly_load_method;
      D.20843 = domain->domain;
      mono_runtime_invoke (assembly_load_method.9, D.20843, &params, 0B);
    }
  finally
    {
      load_value = {CLOBBER};
      params = {CLOBBER};
    }
}


add_assemblies_to_domain (struct MonoDomain * domain, struct MonoAssembly * ass, struct GHashTable * ht)
{
  const char * D.20891;
  void * D.20896;
  void * D.20897;
  struct GSList * D.20900;
  struct GSList * D.20901;
  char * D.20902;
  int D.20903;
  struct MonoImage * D.20904;
  struct MonoAssembly * * D.20905;
  long unsigned int D.20908;
  long unsigned int D.20909;
  struct MonoAssembly * * D.20910;
  struct MonoAssembly * D.20911;
  void * D.20914;
  gint i;
  struct GSList * tmp;
  gboolean destroy_ht;

  destroy_ht = 0;
  D.20891 = ass->aname.name;
  if (D.20891 == 0B) goto <D.20892>; else goto <D.20893>;
  <D.20892>:
  return;
  <D.20893>:
  if (ht == 0B) goto <D.20894>; else goto <D.20895>;
  <D.20894>:
  ht = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
  destroy_ht = 1;
  <D.20895>:
  tmp = domain->domain_assemblies;
  goto <D.20128>;
  <D.20127>:
  D.20896 = tmp->data;
  D.20896 = tmp->data;
  monoeg_g_hash_table_insert_replace (ht, D.20896, D.20896, 0);
  tmp = tmp->next;
  <D.20128>:
  if (tmp != 0B) goto <D.20127>; else goto <D.20129>;
  <D.20129>:
  D.20897 = monoeg_g_hash_table_lookup (ht, ass);
  if (D.20897 == 0B) goto <D.20898>; else goto <D.20899>;
  <D.20898>:
  mono_assembly_addref (ass);
  monoeg_g_hash_table_insert_replace (ht, ass, ass, 0);
  D.20900 = domain->domain_assemblies;
  D.20901 = monoeg_g_slist_append (D.20900, ass);
  domain->domain_assemblies = D.20901;
  D.20891 = ass->aname.name;
  D.20902 = domain->friendly_name;
  D.20903 = ass->ref_count;
  mono_trace (64, 1, "Assembly %s[%p] added to domain %s, ref_count=%d", D.20891, ass, D.20902, D.20903);
  <D.20899>:
  D.20904 = ass->image;
  D.20905 = D.20904->references;
  if (D.20905 != 0B) goto <D.20906>; else goto <D.20907>;
  <D.20906>:
  i = 0;
  goto <D.20131>;
  <D.20130>:
  D.20904 = ass->image;
  D.20905 = D.20904->references;
  D.20908 = (long unsigned int) i;
  D.20909 = D.20908 * 8;
  D.20910 = D.20905 + D.20909;
  D.20911 = *D.20910;
  if (D.20911 != -1B) goto <D.20912>; else goto <D.20913>;
  <D.20912>:
  D.20904 = ass->image;
  D.20905 = D.20904->references;
  D.20908 = (long unsigned int) i;
  D.20909 = D.20908 * 8;
  D.20910 = D.20905 + D.20909;
  D.20911 = *D.20910;
  D.20914 = monoeg_g_hash_table_lookup (ht, D.20911);
  if (D.20914 == 0B) goto <D.20915>; else goto <D.20916>;
  <D.20915>:
  D.20904 = ass->image;
  D.20905 = D.20904->references;
  D.20908 = (long unsigned int) i;
  D.20909 = D.20908 * 8;
  D.20910 = D.20905 + D.20909;
  D.20911 = *D.20910;
  add_assemblies_to_domain (domain, D.20911, ht);
  <D.20916>:
  <D.20913>:
  i = i + 1;
  <D.20131>:
  D.20904 = ass->image;
  D.20905 = D.20904->references;
  D.20908 = (long unsigned int) i;
  D.20909 = D.20908 * 8;
  D.20910 = D.20905 + D.20909;
  D.20911 = *D.20910;
  if (D.20911 != 0B) goto <D.20130>; else goto <D.20132>;
  <D.20132>:
  <D.20907>:
  if (destroy_ht != 0) goto <D.20917>; else goto <D.20918>;
  <D.20917>:
  monoeg_g_hash_table_destroy (ht);
  <D.20918>:
}


mono_check_corlib_version ()
{
  const char * D.20922;
  int version;

  version = mono_get_corlib_version ();
  if (version != 111) goto <D.20920>; else goto <D.20921>;
  <D.20920>:
  D.20922 = monoeg_g_strdup_printf ("expected corlib version %d, found %d.", 111, version);
  return D.20922;
  <D.20921>:
  D.20922 = 0B;
  return D.20922;
}


mono_get_corlib_version ()
{
  struct MonoImage * D.20924;
  int D.20927;
  struct MonoType * D.20928;
  short unsigned int D.20929;
  int D.20930;
  int D.20931;
  struct MonoDomain * D.20934;
  gint32 * D.20935;
  struct MonoClass * klass;
  struct MonoClassField * field;
  struct MonoObject * value;

  D.20924 = mono_defaults.corlib;
  klass = mono_class_from_name (D.20924, "System", "Environment");
  mono_class_init (klass);
  field = mono_class_get_field_from_name (klass, "mono_corlib_version");
  if (field == 0B) goto <D.20925>; else goto <D.20926>;
  <D.20925>:
  D.20927 = -1;
  return D.20927;
  <D.20926>:
  D.20928 = field->type;
  D.20929 = D.20928->attrs;
  D.20930 = (int) D.20929;
  D.20931 = D.20930 & 16;
  if (D.20931 == 0) goto <D.20932>; else goto <D.20933>;
  <D.20932>:
  D.20927 = -1;
  return D.20927;
  <D.20933>:
  D.20934 = mono_domain_get ();
  value = mono_field_get_value_object (D.20934, field, 0B);
  D.20935 = value + 16;
  D.20927 = *D.20935;
  return D.20927;
}


mono_context_init (struct MonoDomain * domain)
{
  struct MonoImage * D.20937;
  int D.20938;
  struct MonoClass * class;
  struct MonoAppContext * context;

  D.20937 = mono_defaults.corlib;
  class = mono_class_from_name (D.20937, "System.Runtime.Remoting.Contexts", "Context");
  context = mono_object_new (domain, class);
  D.20938 = domain->domain_id;
  context->domain_id = D.20938;
  context->context_id = 0;
  domain->default_context = context;
}


mono_runtime_cleanup (struct MonoDomain * domain)
{
  mono_attach_cleanup ();
  mono_gc_cleanup ();
  mono_thread_cleanup ();
  mono_network_cleanup ();
  mono_marshal_cleanup ();
  mono_type_initialization_cleanup ();
  mono_monitor_cleanup ();
}


mono_install_runtime_cleanup (void (*MonoDomainFunc) (struct MonoDomain *, void *) func)
{
  quit_function = func;
}


mono_runtime_quit ()
{
  void (*<T16ac>) (struct MonoDomain *, void *) quit_function.11;
  struct MonoDomain * D.20942;

  quit_function.11 = quit_function;
  if (quit_function.11 != 0B) goto <D.20940>; else goto <D.20941>;
  <D.20940>:
  quit_function.11 = quit_function;
  D.20942 = mono_get_root_domain ();
  quit_function.11 (D.20942, 0B);
  <D.20941>:
}


mono_domain_create_appdomain (char * friendly_name, char * configuration_file)
{
  struct MonoImage * D.20943;
  struct MonoDomain * D.20944;
  struct MonoString * iftmp.12;
  struct MonoDomain * D.20948;
  struct MonoDomain * D.20950;
  struct MonoAppDomain * ad;
  struct MonoAppDomainSetup * setup;
  struct MonoClass * class;

  D.20943 = mono_defaults.corlib;
  class = mono_class_from_name (D.20943, "System", "AppDomainSetup");
  D.20944 = mono_domain_get ();
  setup = mono_object_new (D.20944, class);
  if (configuration_file != 0B) goto <D.20946>; else goto <D.20947>;
  <D.20946>:
  D.20948 = mono_domain_get ();
  iftmp.12 = mono_string_new (D.20948, configuration_file);
  goto <D.20949>;
  <D.20947>:
  iftmp.12 = 0B;
  <D.20949>:
  setup->configuration_file = iftmp.12;
  ad = mono_domain_create_appdomain_internal (friendly_name, setup);
  D.20950 = mono_domain_from_appdomain (ad);
  return D.20950;
}


mono_domain_create_appdomain_internal (char * friendly_name, struct MonoAppDomainSetup * setup)
{
  struct MonoImage * D.20952;
  gchar * D.20953;
  struct MonoString * D.20954;
  struct MonoAppDomainSetup * D.20957;
  struct MonoString * D.20958;
  struct MonoString * * D.20961;
  mono_unichar2 * D.20962;
  int D.20963;
  struct MonoString * D.20964;
  struct MonoAppDomainSetup * D.20965;
  struct MonoAssembly * D.20966;
  int D.20967;
  struct MonoAppDomain * D.20970;
  struct MonoError error;
  struct MonoClass * adclass;
  struct MonoAppDomain * ad;
  struct MonoDomain * data;
  char * shadow_location;

  try
    {
      D.20952 = mono_defaults.corlib;
      adclass = mono_class_from_name (D.20952, "System", "AppDomain");
      data = mono_domain_create ();
      ad = mono_object_new (data, adclass);
      ad->data = data;
      data->domain = ad;
      D.20953 = monoeg_strdup (friendly_name);
      data->friendly_name = D.20953;
      D.20954 = setup->application_base;
      if (D.20954 == 0B) goto <D.20955>; else goto <D.20956>;
      <D.20955>:
      {
        struct MonoDomain * root;

        root = mono_get_root_domain ();
        D.20957 = root->setup;
        D.20958 = D.20957->application_base;
        if (D.20958 != 0B) goto <D.20959>; else goto <D.20960>;
        <D.20959>:
        D.20961 = &setup->application_base;
        D.20957 = root->setup;
        D.20958 = D.20957->application_base;
        D.20962 = mono_string_chars (D.20958);
        D.20957 = root->setup;
        D.20958 = D.20957->application_base;
        D.20963 = mono_string_length (D.20958);
        D.20964 = mono_string_new_utf16 (data, D.20962, D.20963);
        mono_gc_wbarrier_set_field (setup, D.20961, D.20964);
        <D.20960>:
      }
      <D.20956>:
      mono_context_init (data);
      D.20965 = copy_app_domain_setup (data, setup);
      data->setup = D.20965;
      mono_set_private_bin_path_from_config (data);
      D.20952 = mono_defaults.corlib;
      D.20966 = D.20952->assembly;
      add_assemblies_to_domain (data, D.20966, 0B);
      shadow_location = get_shadow_assembly_location_base (data, &error);
      D.20967 = mono_error_ok (&error);
      if (D.20967 == 0) goto <D.20968>; else goto <D.20969>;
      <D.20968>:
      mono_error_raise_exception (&error);
      <D.20969>:
      monoeg_g_free (shadow_location);
      create_domain_objects (data);
      D.20970 = ad;
      return D.20970;
    }
  finally
    {
      error = {CLOBBER};
    }
}


copy_app_domain_setup (struct MonoDomain * domain, struct MonoAppDomainSetup * setup)
{
  struct MonoImage * D.20973;
  struct MonoString * * D.20974;
  struct MonoString * D.20975;
  struct MonoObject * D.20976;
  struct MonoString * * D.20977;
  struct MonoString * D.20978;
  struct MonoObject * D.20979;
  struct MonoString * * D.20980;
  struct MonoString * D.20981;
  struct MonoObject * D.20982;
  struct MonoString * * D.20983;
  struct MonoString * D.20984;
  struct MonoObject * D.20985;
  struct MonoString * * D.20986;
  struct MonoString * D.20987;
  struct MonoObject * D.20988;
  struct MonoString * * D.20989;
  struct MonoString * D.20990;
  struct MonoObject * D.20991;
  struct MonoString * * D.20992;
  struct MonoString * D.20993;
  struct MonoObject * D.20994;
  struct MonoString * * D.20995;
  struct MonoString * D.20996;
  struct MonoObject * D.20997;
  struct MonoString * * D.20998;
  struct MonoString * D.20999;
  struct MonoObject * D.21000;
  struct MonoString * * D.21001;
  struct MonoString * D.21002;
  struct MonoObject * D.21003;
  unsigned char D.21004;
  unsigned char D.21005;
  int D.21006;
  unsigned char D.21007;
  unsigned char D.21008;
  struct MonoArray * * D.21009;
  struct MonoArray * D.21010;
  struct MonoObject * D.21011;
  unsigned char D.21012;
  struct MonoObject * * D.21013;
  struct MonoObject * D.21014;
  struct MonoObject * D.21015;
  struct MonoArray * * D.21016;
  struct MonoArray * D.21017;
  struct MonoObject * D.21018;
  struct MonoArray * * D.21019;
  struct MonoArray * D.21020;
  struct MonoObject * D.21021;
  struct MonoAppDomainSetup * D.21022;
  struct MonoDomain * caller_domain;
  struct MonoClass * ads_class;
  struct MonoAppDomainSetup * copy;

  caller_domain = mono_domain_get ();
  D.20973 = mono_defaults.corlib;
  ads_class = mono_class_from_name (D.20973, "System", "AppDomainSetup");
  copy = mono_object_new (domain, ads_class);
  mono_domain_set_internal (domain);
  D.20974 = &copy->application_base;
  D.20975 = setup->application_base;
  D.20976 = mono_marshal_xdomain_copy_value (D.20975);
  mono_gc_wbarrier_set_field (copy, D.20974, D.20976);
  D.20977 = &copy->application_name;
  D.20978 = setup->application_name;
  D.20979 = mono_marshal_xdomain_copy_value (D.20978);
  mono_gc_wbarrier_set_field (copy, D.20977, D.20979);
  D.20980 = &copy->cache_path;
  D.20981 = setup->cache_path;
  D.20982 = mono_marshal_xdomain_copy_value (D.20981);
  mono_gc_wbarrier_set_field (copy, D.20980, D.20982);
  D.20983 = &copy->configuration_file;
  D.20984 = setup->configuration_file;
  D.20985 = mono_marshal_xdomain_copy_value (D.20984);
  mono_gc_wbarrier_set_field (copy, D.20983, D.20985);
  D.20986 = &copy->dynamic_base;
  D.20987 = setup->dynamic_base;
  D.20988 = mono_marshal_xdomain_copy_value (D.20987);
  mono_gc_wbarrier_set_field (copy, D.20986, D.20988);
  D.20989 = &copy->license_file;
  D.20990 = setup->license_file;
  D.20991 = mono_marshal_xdomain_copy_value (D.20990);
  mono_gc_wbarrier_set_field (copy, D.20989, D.20991);
  D.20992 = &copy->private_bin_path;
  D.20993 = setup->private_bin_path;
  D.20994 = mono_marshal_xdomain_copy_value (D.20993);
  mono_gc_wbarrier_set_field (copy, D.20992, D.20994);
  D.20995 = &copy->private_bin_path_probe;
  D.20996 = setup->private_bin_path_probe;
  D.20997 = mono_marshal_xdomain_copy_value (D.20996);
  mono_gc_wbarrier_set_field (copy, D.20995, D.20997);
  D.20998 = &copy->shadow_copy_directories;
  D.20999 = setup->shadow_copy_directories;
  D.21000 = mono_marshal_xdomain_copy_value (D.20999);
  mono_gc_wbarrier_set_field (copy, D.20998, D.21000);
  D.21001 = &copy->shadow_copy_files;
  D.21002 = setup->shadow_copy_files;
  D.21003 = mono_marshal_xdomain_copy_value (D.21002);
  mono_gc_wbarrier_set_field (copy, D.21001, D.21003);
  D.21004 = setup->publisher_policy;
  copy->publisher_policy = D.21004;
  D.21005 = setup->path_changed;
  copy->path_changed = D.21005;
  D.21006 = setup->loader_optimization;
  copy->loader_optimization = D.21006;
  D.21007 = setup->disallow_binding_redirects;
  copy->disallow_binding_redirects = D.21007;
  D.21008 = setup->disallow_code_downloads;
  copy->disallow_code_downloads = D.21008;
  D.21009 = &copy->domain_initializer_args;
  D.21010 = setup->domain_initializer_args;
  D.21011 = mono_marshal_xdomain_copy_value (D.21010);
  mono_gc_wbarrier_set_field (copy, D.21009, D.21011);
  D.21012 = setup->disallow_appbase_probe;
  copy->disallow_appbase_probe = D.21012;
  D.21013 = &copy->application_trust;
  D.21014 = setup->application_trust;
  D.21015 = mono_marshal_xdomain_copy_value (D.21014);
  mono_gc_wbarrier_set_field (copy, D.21013, D.21015);
  D.21016 = &copy->configuration_bytes;
  D.21017 = setup->configuration_bytes;
  D.21018 = mono_marshal_xdomain_copy_value (D.21017);
  mono_gc_wbarrier_set_field (copy, D.21016, D.21018);
  D.21019 = &copy->serialized_non_primitives;
  D.21020 = setup->serialized_non_primitives;
  D.21021 = mono_marshal_xdomain_copy_value (D.21020);
  mono_gc_wbarrier_set_field (copy, D.21019, D.21021);
  mono_domain_set_internal (caller_domain);
  D.21022 = copy;
  return D.21022;
}


get_shadow_assembly_location_base (struct MonoDomain * domain, struct MonoError * error)
{
  struct MonoString * D.21026;
  struct MonoString * D.21028;
  int D.21030;
  char * D.21033;
  long unsigned int D.21034;
  unsigned int D.21035;
  unsigned int D.21036;
  sizetype D.21037;
  char * D.21038;
  char D.21039;
  int D.21042;
  const gchar * D.21045;
  const gchar * D.21046;
  struct MonoAppDomainSetup * setup;
  char * cache_path;
  char * appname;
  char * userdir;
  char * location;

  mono_error_init (error);
  setup = domain->setup;
  D.21026 = setup->cache_path;
  if (D.21026 != 0B) goto <D.21027>; else goto <D.21024>;
  <D.21027>:
  D.21028 = setup->application_name;
  if (D.21028 != 0B) goto <D.21029>; else goto <D.21024>;
  <D.21029>:
  D.21026 = setup->cache_path;
  cache_path = mono_string_to_utf8_checked (D.21026, error);
  D.21030 = mono_error_ok (error);
  if (D.21030 == 0) goto <D.21031>; else goto <D.21032>;
  <D.21031>:
  D.21033 = 0B;
  return D.21033;
  <D.21032>:
  {
    gint i;

    D.21034 = strlen (cache_path);
    D.21035 = (unsigned int) D.21034;
    D.21036 = D.21035 + 4294967295;
    i = (gint) D.21036;
    goto <D.20234>;
    <D.20233>:
    D.21037 = (sizetype) i;
    D.21038 = cache_path + D.21037;
    D.21039 = *D.21038;
    if (D.21039 == 92) goto <D.21040>; else goto <D.21041>;
    <D.21040>:
    D.21037 = (sizetype) i;
    D.21038 = cache_path + D.21037;
    *D.21038 = 47;
    <D.21041>:
    i = i + -1;
    <D.20234>:
    if (i >= 0) goto <D.20233>; else goto <D.20235>;
    <D.20235>:
  }
  D.21028 = setup->application_name;
  appname = mono_string_to_utf8_checked (D.21028, error);
  D.21042 = mono_error_ok (error);
  if (D.21042 == 0) goto <D.21043>; else goto <D.21044>;
  <D.21043>:
  monoeg_g_free (cache_path);
  D.21033 = 0B;
  return D.21033;
  <D.21044>:
  location = monoeg_g_build_path ("/", cache_path, appname, "assembly", "shadow", 0B);
  monoeg_g_free (appname);
  monoeg_g_free (cache_path);
  goto <D.21025>;
  <D.21024>:
  D.21045 = monoeg_g_get_user_name ();
  userdir = monoeg_g_strdup_printf ("%s-mono-cachepath", D.21045);
  D.21046 = monoeg_g_get_tmp_dir ();
  location = monoeg_g_build_path ("/", D.21046, userdir, "assembly", "shadow", 0B);
  monoeg_g_free (userdir);
  <D.21025>:
  D.21033 = location;
  return D.21033;
}


mono_domain_has_type_resolve (struct MonoDomain * domain)
{
  struct MonoClassField * field.13;
  struct MonoClass * D.21051;
  struct MonoClassField * field.14;
  _Bool D.21053;
  long int D.21054;
  long int D.21055;
  struct MonoAppDomain * D.21058;
  mono_bool D.21061;
  struct MonoObject * o.15;
  _Bool D.21063;
  static struct MonoClassField * field = 0B;
  struct MonoObject * o;

  try
    {
      field.13 = field;
      if (field.13 == 0B) goto <D.21049>; else goto <D.21050>;
      <D.21049>:
      D.21051 = mono_defaults.appdomain_class;
      field.14 = mono_class_get_field_from_name (D.21051, "TypeResolve");
      field = field.14;
      field.13 = field;
      D.21053 = field.13 == 0B;
      D.21054 = (long int) D.21053;
      D.21055 = __builtin_expect (D.21054, 0);
      if (D.21055 != 0) goto <D.21056>; else goto <D.21057>;
      <D.21056>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 503, "field");
      <D.21057>:
      <D.21050>:
      D.21058 = domain->domain;
      if (D.21058 == 0B) goto <D.21059>; else goto <D.21060>;
      <D.21059>:
      D.21061 = 0;
      return D.21061;
      <D.21060>:
      D.21058 = domain->domain;
      field.13 = field;
      mono_field_get_value (D.21058, field.13, &o);
      o.15 = o;
      D.21063 = o.15 != 0B;
      D.21061 = (mono_bool) D.21063;
      return D.21061;
    }
  finally
    {
      o = {CLOBBER};
    }
}


mono_domain_try_type_resolve (struct MonoDomain * domain, char * name, struct MonoObject * tb)
{
  int iftmp.16;
  _Bool D.21072;
  long int D.21073;
  long int D.21074;
  struct MonoMethod * method.17;
  struct MonoAppDomain * D.21080;
  struct MonoVTable * D.21081;
  _Bool D.21082;
  long int D.21083;
  long int D.21084;
  struct MonoMethod * method.18;
  struct MonoReflectionAssembly * D.21090;
  struct MonoDomain * D.21093;
  struct MonoString * D.21094;
  struct MonoClass * klass;
  void * params[1];
  static struct MonoMethod * method = 0B;

  try
    {
      if (domain == 0B) goto <D.21067>; else goto <D.21070>;
      <D.21070>:
      if (name == 0B) goto <D.21071>; else goto <D.21068>;
      <D.21071>:
      if (tb == 0B) goto <D.21067>; else goto <D.21068>;
      <D.21067>:
      iftmp.16 = 1;
      goto <D.21069>;
      <D.21068>:
      iftmp.16 = 0;
      <D.21069>:
      D.21072 = iftmp.16 != 0;
      D.21073 = (long int) D.21072;
      D.21074 = __builtin_expect (D.21073, 0);
      if (D.21074 != 0) goto <D.21075>; else goto <D.21076>;
      <D.21075>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 534, "domain != NULL && ((name != NULL) || (tb != NULL))");
      <D.21076>:
      method.17 = method;
      if (method.17 == 0B) goto <D.21078>; else goto <D.21079>;
      <D.21078>:
      D.21080 = domain->domain;
      D.21081 = D.21080->mbr.obj.vtable;
      klass = D.21081->klass;
      D.21082 = klass == 0B;
      D.21083 = (long int) D.21082;
      D.21084 = __builtin_expect (D.21083, 0);
      if (D.21084 != 0) goto <D.21085>; else goto <D.21086>;
      <D.21085>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 538, "klass");
      <D.21086>:
      method.18 = mono_class_get_method_from_name (klass, "DoTypeResolve", -1);
      method = method.18;
      method.17 = method;
      if (method.17 == 0B) goto <D.21088>; else goto <D.21089>;
      <D.21088>:
      monoeg_g_log (0B, 16, "Method AppDomain.DoTypeResolve not found.\n");
      D.21090 = 0B;
      return D.21090;
      <D.21089>:
      <D.21079>:
      if (name != 0B) goto <D.21091>; else goto <D.21092>;
      <D.21091>:
      D.21093 = mono_domain_get ();
      D.21094 = mono_string_new (D.21093, name);
      params[0] = D.21094;
      goto <D.21095>;
      <D.21092>:
      params[0] = tb;
      <D.21095>:
      method.17 = method;
      D.21080 = domain->domain;
      D.21090 = mono_runtime_invoke (method.17, D.21080, &params, 0B);
      return D.21090;
    }
  finally
    {
      params = {CLOBBER};
    }
}


mono_domain_owns_vtable_slot (struct MonoDomain * domain, void * vtable_slot)
{
  union mono_mutex_t * D.21098;
  _Bool D.21101;
  long int D.21102;
  long int D.21103;
  struct MonoMemPool * D.21106;
  _Bool D.21109;
  long int D.21110;
  long int D.21111;
  mono_bool D.21114;
  gboolean res;

  {
    int ret;

    D.21098 = &domain->lock.mutex;
    ret = pthread_mutex_lock (D.21098);
    if (ret != 0) goto <D.21099>; else goto <D.21100>;
    <D.21099>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21100>:
    D.21101 = ret != 0;
    D.21102 = (long int) D.21101;
    D.21103 = __builtin_expect (D.21102, 0);
    if (D.21103 != 0) goto <D.21104>; else goto <D.21105>;
    <D.21104>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 564, "ret == 0");
    <D.21105>:
  }
  D.21106 = domain->mp;
  res = mono_mempool_contains_addr (D.21106, vtable_slot);
  {
    int ret;

    D.21098 = &domain->lock.mutex;
    ret = pthread_mutex_unlock (D.21098);
    if (ret != 0) goto <D.21107>; else goto <D.21108>;
    <D.21107>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21108>:
    D.21109 = ret != 0;
    D.21110 = (long int) D.21109;
    D.21111 = __builtin_expect (D.21110, 0);
    if (D.21111 != 0) goto <D.21112>; else goto <D.21113>;
    <D.21112>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 566, "ret == 0");
    <D.21113>:
  }
  D.21114 = res;
  return D.21114;
}


mono_domain_set (struct MonoDomain * domain, gboolean force)
{
  unsigned int D.21118;
  mono_bool D.21121;

  if (force == 0) goto <D.21116>; else goto <D.21117>;
  <D.21116>:
  D.21118 = domain->state;
  if (D.21118 == 3) goto <D.21119>; else goto <D.21120>;
  <D.21119>:
  D.21121 = 0;
  return D.21121;
  <D.21120>:
  <D.21117>:
  mono_domain_set_internal (domain);
  D.21121 = 1;
  return D.21121;
}


ves_icall_System_AppDomain_GetData (struct MonoAppDomain * ad, struct MonoString * name)
{
  _Bool D.21123;
  long int D.21124;
  long int D.21125;
  _Bool D.21128;
  long int D.21129;
  long int D.21130;
  struct MonoException * D.21135;
  union mono_mutex_t * D.21136;
  _Bool D.21139;
  long int D.21140;
  long int D.21141;
  int D.19880;
  int iftmp.19;
  int D.19879;
  const char[8] * D.21147;
  unsigned char D.21148;
  int D.21149;
  unsigned char D.21150;
  int D.21151;
  const unsigned char * D.21156;
  unsigned char D.21157;
  int D.21158;
  const unsigned char * D.21159;
  unsigned char D.21160;
  int D.21161;
  const unsigned char * D.21166;
  unsigned char D.21167;
  int D.21168;
  const unsigned char * D.21169;
  unsigned char D.21170;
  int D.21171;
  const unsigned char * D.21176;
  unsigned char D.21177;
  int D.21178;
  const unsigned char * D.21179;
  unsigned char D.21180;
  int D.21181;
  struct MonoAppDomainSetup * D.21185;
  int D.19889;
  int iftmp.20;
  int D.19888;
  const char[16] * D.21190;
  unsigned char D.21191;
  int D.21192;
  unsigned char D.21193;
  int D.21194;
  const unsigned char * D.21199;
  unsigned char D.21200;
  int D.21201;
  const unsigned char * D.21202;
  unsigned char D.21203;
  int D.21204;
  const unsigned char * D.21209;
  unsigned char D.21210;
  int D.21211;
  const unsigned char * D.21212;
  unsigned char D.21213;
  int D.21214;
  const unsigned char * D.21219;
  unsigned char D.21220;
  int D.21221;
  const unsigned char * D.21222;
  unsigned char D.21223;
  int D.21224;
  int D.19898;
  int iftmp.21;
  int D.19897;
  const char[13] * D.21232;
  unsigned char D.21233;
  int D.21234;
  unsigned char D.21235;
  int D.21236;
  const unsigned char * D.21241;
  unsigned char D.21242;
  int D.21243;
  const unsigned char * D.21244;
  unsigned char D.21245;
  int D.21246;
  const unsigned char * D.21251;
  unsigned char D.21252;
  int D.21253;
  const unsigned char * D.21254;
  unsigned char D.21255;
  int D.21256;
  const unsigned char * D.21261;
  unsigned char D.21262;
  int D.21263;
  const unsigned char * D.21264;
  unsigned char D.21265;
  int D.21266;
  int D.19907;
  int iftmp.22;
  int D.19906;
  const char[9] * D.21274;
  unsigned char D.21275;
  int D.21276;
  unsigned char D.21277;
  int D.21278;
  const unsigned char * D.21283;
  unsigned char D.21284;
  int D.21285;
  const unsigned char * D.21286;
  unsigned char D.21287;
  int D.21288;
  const unsigned char * D.21293;
  unsigned char D.21294;
  int D.21295;
  const unsigned char * D.21296;
  unsigned char D.21297;
  int D.21298;
  const unsigned char * D.21303;
  unsigned char D.21304;
  int D.21305;
  const unsigned char * D.21306;
  unsigned char D.21307;
  int D.21308;
  int D.19916;
  int iftmp.23;
  int D.19915;
  const char[11] * D.21316;
  unsigned char D.21317;
  int D.21318;
  unsigned char D.21319;
  int D.21320;
  const unsigned char * D.21325;
  unsigned char D.21326;
  int D.21327;
  const unsigned char * D.21328;
  unsigned char D.21329;
  int D.21330;
  const unsigned char * D.21335;
  unsigned char D.21336;
  int D.21337;
  const unsigned char * D.21338;
  unsigned char D.21339;
  int D.21340;
  const unsigned char * D.21345;
  unsigned char D.21346;
  int D.21347;
  const unsigned char * D.21348;
  unsigned char D.21349;
  int D.21350;
  int D.19925;
  int iftmp.24;
  int D.19924;
  const char[16] * D.21358;
  unsigned char D.21359;
  int D.21360;
  unsigned char D.21361;
  int D.21362;
  const unsigned char * D.21367;
  unsigned char D.21368;
  int D.21369;
  const unsigned char * D.21370;
  unsigned char D.21371;
  int D.21372;
  const unsigned char * D.21377;
  unsigned char D.21378;
  int D.21379;
  const unsigned char * D.21380;
  unsigned char D.21381;
  int D.21382;
  const unsigned char * D.21387;
  unsigned char D.21388;
  int D.21389;
  const unsigned char * D.21390;
  unsigned char D.21391;
  int D.21392;
  int D.19934;
  int iftmp.25;
  int D.19933;
  const char[19] * D.21400;
  unsigned char D.21401;
  int D.21402;
  unsigned char D.21403;
  int D.21404;
  const unsigned char * D.21409;
  unsigned char D.21410;
  int D.21411;
  const unsigned char * D.21412;
  unsigned char D.21413;
  int D.21414;
  const unsigned char * D.21419;
  unsigned char D.21420;
  int D.21421;
  const unsigned char * D.21422;
  unsigned char D.21423;
  int D.21424;
  const unsigned char * D.21429;
  unsigned char D.21430;
  int D.21431;
  const unsigned char * D.21432;
  unsigned char D.21433;
  int D.21434;
  int D.19943;
  int iftmp.26;
  int D.19942;
  const char[17] * D.21442;
  unsigned char D.21443;
  int D.21444;
  unsigned char D.21445;
  int D.21446;
  const unsigned char * D.21451;
  unsigned char D.21452;
  int D.21453;
  const unsigned char * D.21454;
  unsigned char D.21455;
  int D.21456;
  const unsigned char * D.21461;
  unsigned char D.21462;
  int D.21463;
  const unsigned char * D.21464;
  unsigned char D.21465;
  int D.21466;
  const unsigned char * D.21471;
  unsigned char D.21472;
  int D.21473;
  const unsigned char * D.21474;
  unsigned char D.21475;
  int D.21476;
  int D.19952;
  int iftmp.27;
  int D.19951;
  const char[20] * D.21484;
  unsigned char D.21485;
  int D.21486;
  unsigned char D.21487;
  int D.21488;
  const unsigned char * D.21493;
  unsigned char D.21494;
  int D.21495;
  const unsigned char * D.21496;
  unsigned char D.21497;
  int D.21498;
  const unsigned char * D.21503;
  unsigned char D.21504;
  int D.21505;
  const unsigned char * D.21506;
  unsigned char D.21507;
  int D.21508;
  const unsigned char * D.21513;
  unsigned char D.21514;
  int D.21515;
  const unsigned char * D.21516;
  unsigned char D.21517;
  int D.21518;
  struct MonoGHashTable * D.21523;
  _Bool D.21526;
  long int D.21527;
  long int D.21528;
  struct MonoObject * D.21533;
  struct MonoDomain * add;
  struct MonoObject * o;
  char * str;

  D.21123 = ad == 0B;
  D.21124 = (long int) D.21123;
  D.21125 = __builtin_expect (D.21124, 0);
  if (D.21125 != 0) goto <D.21126>; else goto <D.21127>;
  <D.21126>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 602, "ad != NULL");
  <D.21127>:
  add = ad->data;
  D.21128 = add == 0B;
  D.21129 = (long int) D.21128;
  D.21130 = __builtin_expect (D.21129, 0);
  if (D.21130 != 0) goto <D.21131>; else goto <D.21132>;
  <D.21131>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 604, "add != NULL");
  <D.21132>:
  if (name == 0B) goto <D.21133>; else goto <D.21134>;
  <D.21133>:
  D.21135 = mono_get_exception_argument_null ("name");
  mono_raise_exception (D.21135);
  <D.21134>:
  str = mono_string_to_utf8 (name);
  {
    int ret;

    D.21136 = &add->lock.mutex;
    ret = pthread_mutex_lock (D.21136);
    if (ret != 0) goto <D.21137>; else goto <D.21138>;
    <D.21137>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21138>:
    D.21139 = ret != 0;
    D.21140 = (long int) D.21139;
    D.21141 = __builtin_expect (D.21140, 0);
    if (D.21141 != 0) goto <D.21142>; else goto <D.21143>;
    <D.21142>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 611, "ret == 0");
    <D.21143>:
  }
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21147 = "APPBASE";
      D.21148 = MEM[(const unsigned char *)D.21147];
      D.21149 = (int) D.21148;
      D.21150 = *__s2;
      D.21151 = (int) D.21150;
      __result = D.21149 - D.21151;
      {
        if (__s2_len != 0) goto <D.21152>; else goto <D.21153>;
        <D.21152>:
        if (__result == 0) goto <D.21154>; else goto <D.21155>;
        <D.21154>:
        D.21156 = &MEM[(void *)"APPBASE" + 1B];
        D.21157 = *D.21156;
        D.21158 = (int) D.21157;
        D.21159 = __s2 + 1;
        D.21160 = *D.21159;
        D.21161 = (int) D.21160;
        __result = D.21158 - D.21161;
        if (__s2_len > 1) goto <D.21162>; else goto <D.21163>;
        <D.21162>:
        if (__result == 0) goto <D.21164>; else goto <D.21165>;
        <D.21164>:
        D.21166 = &MEM[(void *)"APPBASE" + 2B];
        D.21167 = *D.21166;
        D.21168 = (int) D.21167;
        D.21169 = __s2 + 2;
        D.21170 = *D.21169;
        D.21171 = (int) D.21170;
        __result = D.21168 - D.21171;
        if (__s2_len > 2) goto <D.21172>; else goto <D.21173>;
        <D.21172>:
        if (__result == 0) goto <D.21174>; else goto <D.21175>;
        <D.21174>:
        D.21176 = &MEM[(void *)"APPBASE" + 3B];
        D.21177 = *D.21176;
        D.21178 = (int) D.21177;
        D.21179 = __s2 + 3;
        D.21180 = *D.21179;
        D.21181 = (int) D.21180;
        __result = D.21178 - D.21181;
        <D.21175>:
        <D.21173>:
        <D.21165>:
        <D.21163>:
        <D.21155>:
        <D.21153>:
      }
      D.19879 = __result;
    }
    iftmp.19 = -D.19879;
    goto <D.21182>;
    <D.21146>:
    iftmp.19 = __builtin_strcmp (str, "APPBASE");
    <D.21182>:
    D.19880 = iftmp.19;
  }
  if (D.19880 == 0) goto <D.21183>; else goto <D.21184>;
  <D.21183>:
  D.21185 = add->setup;
  o = D.21185->application_base;
  goto <D.21186>;
  <D.21184>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21190 = "APP_CONFIG_FILE";
      D.21191 = MEM[(const unsigned char *)D.21190];
      D.21192 = (int) D.21191;
      D.21193 = *__s2;
      D.21194 = (int) D.21193;
      __result = D.21192 - D.21194;
      {
        if (__s2_len != 0) goto <D.21195>; else goto <D.21196>;
        <D.21195>:
        if (__result == 0) goto <D.21197>; else goto <D.21198>;
        <D.21197>:
        D.21199 = &MEM[(void *)"APP_CONFIG_FILE" + 1B];
        D.21200 = *D.21199;
        D.21201 = (int) D.21200;
        D.21202 = __s2 + 1;
        D.21203 = *D.21202;
        D.21204 = (int) D.21203;
        __result = D.21201 - D.21204;
        if (__s2_len > 1) goto <D.21205>; else goto <D.21206>;
        <D.21205>:
        if (__result == 0) goto <D.21207>; else goto <D.21208>;
        <D.21207>:
        D.21209 = &MEM[(void *)"APP_CONFIG_FILE" + 2B];
        D.21210 = *D.21209;
        D.21211 = (int) D.21210;
        D.21212 = __s2 + 2;
        D.21213 = *D.21212;
        D.21214 = (int) D.21213;
        __result = D.21211 - D.21214;
        if (__s2_len > 2) goto <D.21215>; else goto <D.21216>;
        <D.21215>:
        if (__result == 0) goto <D.21217>; else goto <D.21218>;
        <D.21217>:
        D.21219 = &MEM[(void *)"APP_CONFIG_FILE" + 3B];
        D.21220 = *D.21219;
        D.21221 = (int) D.21220;
        D.21222 = __s2 + 3;
        D.21223 = *D.21222;
        D.21224 = (int) D.21223;
        __result = D.21221 - D.21224;
        <D.21218>:
        <D.21216>:
        <D.21208>:
        <D.21206>:
        <D.21198>:
        <D.21196>:
      }
      D.19888 = __result;
    }
    iftmp.20 = -D.19888;
    goto <D.21225>;
    <D.21189>:
    iftmp.20 = __builtin_strcmp (str, "APP_CONFIG_FILE");
    <D.21225>:
    D.19889 = iftmp.20;
  }
  if (D.19889 == 0) goto <D.21226>; else goto <D.21227>;
  <D.21226>:
  D.21185 = add->setup;
  o = D.21185->configuration_file;
  goto <D.21228>;
  <D.21227>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21232 = "DYNAMIC_BASE";
      D.21233 = MEM[(const unsigned char *)D.21232];
      D.21234 = (int) D.21233;
      D.21235 = *__s2;
      D.21236 = (int) D.21235;
      __result = D.21234 - D.21236;
      {
        if (__s2_len != 0) goto <D.21237>; else goto <D.21238>;
        <D.21237>:
        if (__result == 0) goto <D.21239>; else goto <D.21240>;
        <D.21239>:
        D.21241 = &MEM[(void *)"DYNAMIC_BASE" + 1B];
        D.21242 = *D.21241;
        D.21243 = (int) D.21242;
        D.21244 = __s2 + 1;
        D.21245 = *D.21244;
        D.21246 = (int) D.21245;
        __result = D.21243 - D.21246;
        if (__s2_len > 1) goto <D.21247>; else goto <D.21248>;
        <D.21247>:
        if (__result == 0) goto <D.21249>; else goto <D.21250>;
        <D.21249>:
        D.21251 = &MEM[(void *)"DYNAMIC_BASE" + 2B];
        D.21252 = *D.21251;
        D.21253 = (int) D.21252;
        D.21254 = __s2 + 2;
        D.21255 = *D.21254;
        D.21256 = (int) D.21255;
        __result = D.21253 - D.21256;
        if (__s2_len > 2) goto <D.21257>; else goto <D.21258>;
        <D.21257>:
        if (__result == 0) goto <D.21259>; else goto <D.21260>;
        <D.21259>:
        D.21261 = &MEM[(void *)"DYNAMIC_BASE" + 3B];
        D.21262 = *D.21261;
        D.21263 = (int) D.21262;
        D.21264 = __s2 + 3;
        D.21265 = *D.21264;
        D.21266 = (int) D.21265;
        __result = D.21263 - D.21266;
        <D.21260>:
        <D.21258>:
        <D.21250>:
        <D.21248>:
        <D.21240>:
        <D.21238>:
      }
      D.19897 = __result;
    }
    iftmp.21 = -D.19897;
    goto <D.21267>;
    <D.21231>:
    iftmp.21 = __builtin_strcmp (str, "DYNAMIC_BASE");
    <D.21267>:
    D.19898 = iftmp.21;
  }
  if (D.19898 == 0) goto <D.21268>; else goto <D.21269>;
  <D.21268>:
  D.21185 = add->setup;
  o = D.21185->dynamic_base;
  goto <D.21270>;
  <D.21269>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21274 = "APP_NAME";
      D.21275 = MEM[(const unsigned char *)D.21274];
      D.21276 = (int) D.21275;
      D.21277 = *__s2;
      D.21278 = (int) D.21277;
      __result = D.21276 - D.21278;
      {
        if (__s2_len != 0) goto <D.21279>; else goto <D.21280>;
        <D.21279>:
        if (__result == 0) goto <D.21281>; else goto <D.21282>;
        <D.21281>:
        D.21283 = &MEM[(void *)"APP_NAME" + 1B];
        D.21284 = *D.21283;
        D.21285 = (int) D.21284;
        D.21286 = __s2 + 1;
        D.21287 = *D.21286;
        D.21288 = (int) D.21287;
        __result = D.21285 - D.21288;
        if (__s2_len > 1) goto <D.21289>; else goto <D.21290>;
        <D.21289>:
        if (__result == 0) goto <D.21291>; else goto <D.21292>;
        <D.21291>:
        D.21293 = &MEM[(void *)"APP_NAME" + 2B];
        D.21294 = *D.21293;
        D.21295 = (int) D.21294;
        D.21296 = __s2 + 2;
        D.21297 = *D.21296;
        D.21298 = (int) D.21297;
        __result = D.21295 - D.21298;
        if (__s2_len > 2) goto <D.21299>; else goto <D.21300>;
        <D.21299>:
        if (__result == 0) goto <D.21301>; else goto <D.21302>;
        <D.21301>:
        D.21303 = &MEM[(void *)"APP_NAME" + 3B];
        D.21304 = *D.21303;
        D.21305 = (int) D.21304;
        D.21306 = __s2 + 3;
        D.21307 = *D.21306;
        D.21308 = (int) D.21307;
        __result = D.21305 - D.21308;
        <D.21302>:
        <D.21300>:
        <D.21292>:
        <D.21290>:
        <D.21282>:
        <D.21280>:
      }
      D.19906 = __result;
    }
    iftmp.22 = -D.19906;
    goto <D.21309>;
    <D.21273>:
    iftmp.22 = __builtin_strcmp (str, "APP_NAME");
    <D.21309>:
    D.19907 = iftmp.22;
  }
  if (D.19907 == 0) goto <D.21310>; else goto <D.21311>;
  <D.21310>:
  D.21185 = add->setup;
  o = D.21185->application_name;
  goto <D.21312>;
  <D.21311>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21316 = "CACHE_BASE";
      D.21317 = MEM[(const unsigned char *)D.21316];
      D.21318 = (int) D.21317;
      D.21319 = *__s2;
      D.21320 = (int) D.21319;
      __result = D.21318 - D.21320;
      {
        if (__s2_len != 0) goto <D.21321>; else goto <D.21322>;
        <D.21321>:
        if (__result == 0) goto <D.21323>; else goto <D.21324>;
        <D.21323>:
        D.21325 = &MEM[(void *)"CACHE_BASE" + 1B];
        D.21326 = *D.21325;
        D.21327 = (int) D.21326;
        D.21328 = __s2 + 1;
        D.21329 = *D.21328;
        D.21330 = (int) D.21329;
        __result = D.21327 - D.21330;
        if (__s2_len > 1) goto <D.21331>; else goto <D.21332>;
        <D.21331>:
        if (__result == 0) goto <D.21333>; else goto <D.21334>;
        <D.21333>:
        D.21335 = &MEM[(void *)"CACHE_BASE" + 2B];
        D.21336 = *D.21335;
        D.21337 = (int) D.21336;
        D.21338 = __s2 + 2;
        D.21339 = *D.21338;
        D.21340 = (int) D.21339;
        __result = D.21337 - D.21340;
        if (__s2_len > 2) goto <D.21341>; else goto <D.21342>;
        <D.21341>:
        if (__result == 0) goto <D.21343>; else goto <D.21344>;
        <D.21343>:
        D.21345 = &MEM[(void *)"CACHE_BASE" + 3B];
        D.21346 = *D.21345;
        D.21347 = (int) D.21346;
        D.21348 = __s2 + 3;
        D.21349 = *D.21348;
        D.21350 = (int) D.21349;
        __result = D.21347 - D.21350;
        <D.21344>:
        <D.21342>:
        <D.21334>:
        <D.21332>:
        <D.21324>:
        <D.21322>:
      }
      D.19915 = __result;
    }
    iftmp.23 = -D.19915;
    goto <D.21351>;
    <D.21315>:
    iftmp.23 = __builtin_strcmp (str, "CACHE_BASE");
    <D.21351>:
    D.19916 = iftmp.23;
  }
  if (D.19916 == 0) goto <D.21352>; else goto <D.21353>;
  <D.21352>:
  D.21185 = add->setup;
  o = D.21185->cache_path;
  goto <D.21354>;
  <D.21353>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21358 = "PRIVATE_BINPATH";
      D.21359 = MEM[(const unsigned char *)D.21358];
      D.21360 = (int) D.21359;
      D.21361 = *__s2;
      D.21362 = (int) D.21361;
      __result = D.21360 - D.21362;
      {
        if (__s2_len != 0) goto <D.21363>; else goto <D.21364>;
        <D.21363>:
        if (__result == 0) goto <D.21365>; else goto <D.21366>;
        <D.21365>:
        D.21367 = &MEM[(void *)"PRIVATE_BINPATH" + 1B];
        D.21368 = *D.21367;
        D.21369 = (int) D.21368;
        D.21370 = __s2 + 1;
        D.21371 = *D.21370;
        D.21372 = (int) D.21371;
        __result = D.21369 - D.21372;
        if (__s2_len > 1) goto <D.21373>; else goto <D.21374>;
        <D.21373>:
        if (__result == 0) goto <D.21375>; else goto <D.21376>;
        <D.21375>:
        D.21377 = &MEM[(void *)"PRIVATE_BINPATH" + 2B];
        D.21378 = *D.21377;
        D.21379 = (int) D.21378;
        D.21380 = __s2 + 2;
        D.21381 = *D.21380;
        D.21382 = (int) D.21381;
        __result = D.21379 - D.21382;
        if (__s2_len > 2) goto <D.21383>; else goto <D.21384>;
        <D.21383>:
        if (__result == 0) goto <D.21385>; else goto <D.21386>;
        <D.21385>:
        D.21387 = &MEM[(void *)"PRIVATE_BINPATH" + 3B];
        D.21388 = *D.21387;
        D.21389 = (int) D.21388;
        D.21390 = __s2 + 3;
        D.21391 = *D.21390;
        D.21392 = (int) D.21391;
        __result = D.21389 - D.21392;
        <D.21386>:
        <D.21384>:
        <D.21376>:
        <D.21374>:
        <D.21366>:
        <D.21364>:
      }
      D.19924 = __result;
    }
    iftmp.24 = -D.19924;
    goto <D.21393>;
    <D.21357>:
    iftmp.24 = __builtin_strcmp (str, "PRIVATE_BINPATH");
    <D.21393>:
    D.19925 = iftmp.24;
  }
  if (D.19925 == 0) goto <D.21394>; else goto <D.21395>;
  <D.21394>:
  D.21185 = add->setup;
  o = D.21185->private_bin_path;
  goto <D.21396>;
  <D.21395>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21400 = "BINPATH_PROBE_ONLY";
      D.21401 = MEM[(const unsigned char *)D.21400];
      D.21402 = (int) D.21401;
      D.21403 = *__s2;
      D.21404 = (int) D.21403;
      __result = D.21402 - D.21404;
      {
        if (__s2_len != 0) goto <D.21405>; else goto <D.21406>;
        <D.21405>:
        if (__result == 0) goto <D.21407>; else goto <D.21408>;
        <D.21407>:
        D.21409 = &MEM[(void *)"BINPATH_PROBE_ONLY" + 1B];
        D.21410 = *D.21409;
        D.21411 = (int) D.21410;
        D.21412 = __s2 + 1;
        D.21413 = *D.21412;
        D.21414 = (int) D.21413;
        __result = D.21411 - D.21414;
        if (__s2_len > 1) goto <D.21415>; else goto <D.21416>;
        <D.21415>:
        if (__result == 0) goto <D.21417>; else goto <D.21418>;
        <D.21417>:
        D.21419 = &MEM[(void *)"BINPATH_PROBE_ONLY" + 2B];
        D.21420 = *D.21419;
        D.21421 = (int) D.21420;
        D.21422 = __s2 + 2;
        D.21423 = *D.21422;
        D.21424 = (int) D.21423;
        __result = D.21421 - D.21424;
        if (__s2_len > 2) goto <D.21425>; else goto <D.21426>;
        <D.21425>:
        if (__result == 0) goto <D.21427>; else goto <D.21428>;
        <D.21427>:
        D.21429 = &MEM[(void *)"BINPATH_PROBE_ONLY" + 3B];
        D.21430 = *D.21429;
        D.21431 = (int) D.21430;
        D.21432 = __s2 + 3;
        D.21433 = *D.21432;
        D.21434 = (int) D.21433;
        __result = D.21431 - D.21434;
        <D.21428>:
        <D.21426>:
        <D.21418>:
        <D.21416>:
        <D.21408>:
        <D.21406>:
      }
      D.19933 = __result;
    }
    iftmp.25 = -D.19933;
    goto <D.21435>;
    <D.21399>:
    iftmp.25 = __builtin_strcmp (str, "BINPATH_PROBE_ONLY");
    <D.21435>:
    D.19934 = iftmp.25;
  }
  if (D.19934 == 0) goto <D.21436>; else goto <D.21437>;
  <D.21436>:
  D.21185 = add->setup;
  o = D.21185->private_bin_path_probe;
  goto <D.21438>;
  <D.21437>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21442 = "SHADOW_COPY_DIRS";
      D.21443 = MEM[(const unsigned char *)D.21442];
      D.21444 = (int) D.21443;
      D.21445 = *__s2;
      D.21446 = (int) D.21445;
      __result = D.21444 - D.21446;
      {
        if (__s2_len != 0) goto <D.21447>; else goto <D.21448>;
        <D.21447>:
        if (__result == 0) goto <D.21449>; else goto <D.21450>;
        <D.21449>:
        D.21451 = &MEM[(void *)"SHADOW_COPY_DIRS" + 1B];
        D.21452 = *D.21451;
        D.21453 = (int) D.21452;
        D.21454 = __s2 + 1;
        D.21455 = *D.21454;
        D.21456 = (int) D.21455;
        __result = D.21453 - D.21456;
        if (__s2_len > 1) goto <D.21457>; else goto <D.21458>;
        <D.21457>:
        if (__result == 0) goto <D.21459>; else goto <D.21460>;
        <D.21459>:
        D.21461 = &MEM[(void *)"SHADOW_COPY_DIRS" + 2B];
        D.21462 = *D.21461;
        D.21463 = (int) D.21462;
        D.21464 = __s2 + 2;
        D.21465 = *D.21464;
        D.21466 = (int) D.21465;
        __result = D.21463 - D.21466;
        if (__s2_len > 2) goto <D.21467>; else goto <D.21468>;
        <D.21467>:
        if (__result == 0) goto <D.21469>; else goto <D.21470>;
        <D.21469>:
        D.21471 = &MEM[(void *)"SHADOW_COPY_DIRS" + 3B];
        D.21472 = *D.21471;
        D.21473 = (int) D.21472;
        D.21474 = __s2 + 3;
        D.21475 = *D.21474;
        D.21476 = (int) D.21475;
        __result = D.21473 - D.21476;
        <D.21470>:
        <D.21468>:
        <D.21460>:
        <D.21458>:
        <D.21450>:
        <D.21448>:
      }
      D.19942 = __result;
    }
    iftmp.26 = -D.19942;
    goto <D.21477>;
    <D.21441>:
    iftmp.26 = __builtin_strcmp (str, "SHADOW_COPY_DIRS");
    <D.21477>:
    D.19943 = iftmp.26;
  }
  if (D.19943 == 0) goto <D.21478>; else goto <D.21479>;
  <D.21478>:
  D.21185 = add->setup;
  o = D.21185->shadow_copy_directories;
  goto <D.21480>;
  <D.21479>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = str;
      D.21484 = "FORCE_CACHE_INSTALL";
      D.21485 = MEM[(const unsigned char *)D.21484];
      D.21486 = (int) D.21485;
      D.21487 = *__s2;
      D.21488 = (int) D.21487;
      __result = D.21486 - D.21488;
      {
        if (__s2_len != 0) goto <D.21489>; else goto <D.21490>;
        <D.21489>:
        if (__result == 0) goto <D.21491>; else goto <D.21492>;
        <D.21491>:
        D.21493 = &MEM[(void *)"FORCE_CACHE_INSTALL" + 1B];
        D.21494 = *D.21493;
        D.21495 = (int) D.21494;
        D.21496 = __s2 + 1;
        D.21497 = *D.21496;
        D.21498 = (int) D.21497;
        __result = D.21495 - D.21498;
        if (__s2_len > 1) goto <D.21499>; else goto <D.21500>;
        <D.21499>:
        if (__result == 0) goto <D.21501>; else goto <D.21502>;
        <D.21501>:
        D.21503 = &MEM[(void *)"FORCE_CACHE_INSTALL" + 2B];
        D.21504 = *D.21503;
        D.21505 = (int) D.21504;
        D.21506 = __s2 + 2;
        D.21507 = *D.21506;
        D.21508 = (int) D.21507;
        __result = D.21505 - D.21508;
        if (__s2_len > 2) goto <D.21509>; else goto <D.21510>;
        <D.21509>:
        if (__result == 0) goto <D.21511>; else goto <D.21512>;
        <D.21511>:
        D.21513 = &MEM[(void *)"FORCE_CACHE_INSTALL" + 3B];
        D.21514 = *D.21513;
        D.21515 = (int) D.21514;
        D.21516 = __s2 + 3;
        D.21517 = *D.21516;
        D.21518 = (int) D.21517;
        __result = D.21515 - D.21518;
        <D.21512>:
        <D.21510>:
        <D.21502>:
        <D.21500>:
        <D.21492>:
        <D.21490>:
      }
      D.19951 = __result;
    }
    iftmp.27 = -D.19951;
    goto <D.21519>;
    <D.21483>:
    iftmp.27 = __builtin_strcmp (str, "FORCE_CACHE_INSTALL");
    <D.21519>:
    D.19952 = iftmp.27;
  }
  if (D.19952 == 0) goto <D.21520>; else goto <D.21521>;
  <D.21520>:
  D.21185 = add->setup;
  o = D.21185->shadow_copy_files;
  goto <D.21522>;
  <D.21521>:
  D.21523 = add->env;
  o = mono_g_hash_table_lookup (D.21523, name);
  <D.21522>:
  <D.21480>:
  <D.21438>:
  <D.21396>:
  <D.21354>:
  <D.21312>:
  <D.21270>:
  <D.21228>:
  <D.21186>:
  {
    int ret;

    D.21136 = &add->lock.mutex;
    ret = pthread_mutex_unlock (D.21136);
    if (ret != 0) goto <D.21524>; else goto <D.21525>;
    <D.21524>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21525>:
    D.21526 = ret != 0;
    D.21527 = (long int) D.21526;
    D.21528 = __builtin_expect (D.21527, 0);
    if (D.21528 != 0) goto <D.21529>; else goto <D.21530>;
    <D.21529>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 634, "ret == 0");
    <D.21530>:
  }
  monoeg_g_free (str);
  if (o == 0B) goto <D.21531>; else goto <D.21532>;
  <D.21531>:
  D.21533 = 0B;
  return D.21533;
  <D.21532>:
  D.21533 = o;
  return D.21533;
}


ves_icall_System_AppDomain_SetData (struct MonoAppDomain * ad, struct MonoString * name, struct MonoObject * data)
{
  _Bool D.21535;
  long int D.21536;
  long int D.21537;
  _Bool D.21540;
  long int D.21541;
  long int D.21542;
  struct MonoException * D.21547;
  union mono_mutex_t * D.21548;
  _Bool D.21551;
  long int D.21552;
  long int D.21553;
  struct MonoGHashTable * D.21556;
  _Bool D.21559;
  long int D.21560;
  long int D.21561;
  struct MonoDomain * add;

  D.21535 = ad == 0B;
  D.21536 = (long int) D.21535;
  D.21537 = __builtin_expect (D.21536, 0);
  if (D.21537 != 0) goto <D.21538>; else goto <D.21539>;
  <D.21538>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 650, "ad != NULL");
  <D.21539>:
  add = ad->data;
  D.21540 = add == 0B;
  D.21541 = (long int) D.21540;
  D.21542 = __builtin_expect (D.21541, 0);
  if (D.21542 != 0) goto <D.21543>; else goto <D.21544>;
  <D.21543>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 652, "add != NULL");
  <D.21544>:
  if (name == 0B) goto <D.21545>; else goto <D.21546>;
  <D.21545>:
  D.21547 = mono_get_exception_argument_null ("name");
  mono_raise_exception (D.21547);
  <D.21546>:
  {
    int ret;

    D.21548 = &add->lock.mutex;
    ret = pthread_mutex_lock (D.21548);
    if (ret != 0) goto <D.21549>; else goto <D.21550>;
    <D.21549>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21550>:
    D.21551 = ret != 0;
    D.21552 = (long int) D.21551;
    D.21553 = __builtin_expect (D.21552, 0);
    if (D.21553 != 0) goto <D.21554>; else goto <D.21555>;
    <D.21554>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 657, "ret == 0");
    <D.21555>:
  }
  D.21556 = add->env;
  mono_g_hash_table_insert (D.21556, name, data);
  {
    int ret;

    D.21548 = &add->lock.mutex;
    ret = pthread_mutex_unlock (D.21548);
    if (ret != 0) goto <D.21557>; else goto <D.21558>;
    <D.21557>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21558>:
    D.21559 = ret != 0;
    D.21560 = (long int) D.21559;
    D.21561 = __builtin_expect (D.21560, 0);
    if (D.21561 != 0) goto <D.21562>; else goto <D.21563>;
    <D.21562>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 661, "ret == 0");
    <D.21563>:
  }
}


ves_icall_System_AppDomain_getSetup (struct MonoAppDomain * ad)
{
  _Bool D.21564;
  long int D.21565;
  long int D.21566;
  struct MonoDomain * D.21569;
  _Bool D.21570;
  long int D.21571;
  long int D.21572;
  struct MonoAppDomainSetup * D.21575;

  D.21564 = ad == 0B;
  D.21565 = (long int) D.21564;
  D.21566 = __builtin_expect (D.21565, 0);
  if (D.21566 != 0) goto <D.21567>; else goto <D.21568>;
  <D.21567>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 669, "ad != NULL");
  <D.21568>:
  D.21569 = ad->data;
  D.21570 = D.21569 == 0B;
  D.21571 = (long int) D.21570;
  D.21572 = __builtin_expect (D.21571, 0);
  if (D.21572 != 0) goto <D.21573>; else goto <D.21574>;
  <D.21573>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 670, "ad->data != NULL");
  <D.21574>:
  D.21569 = ad->data;
  D.21575 = D.21569->setup;
  return D.21575;
}


ves_icall_System_AppDomain_getFriendlyName (struct MonoAppDomain * ad)
{
  _Bool D.21577;
  long int D.21578;
  long int D.21579;
  struct MonoDomain * D.21582;
  _Bool D.21583;
  long int D.21584;
  long int D.21585;
  struct MonoString * D.21588;
  char * D.21589;

  D.21577 = ad == 0B;
  D.21578 = (long int) D.21577;
  D.21579 = __builtin_expect (D.21578, 0);
  if (D.21579 != 0) goto <D.21580>; else goto <D.21581>;
  <D.21580>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 680, "ad != NULL");
  <D.21581>:
  D.21582 = ad->data;
  D.21583 = D.21582 == 0B;
  D.21584 = (long int) D.21583;
  D.21585 = __builtin_expect (D.21584, 0);
  if (D.21585 != 0) goto <D.21586>; else goto <D.21587>;
  <D.21586>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 681, "ad->data != NULL");
  <D.21587>:
  D.21582 = ad->data;
  D.21582 = ad->data;
  D.21589 = D.21582->friendly_name;
  D.21588 = mono_string_new (D.21582, D.21589);
  return D.21588;
}


ves_icall_System_AppDomain_getCurDomain ()
{
  struct MonoAppDomain * D.21591;
  struct MonoDomain * add;

  add = mono_domain_get ();
  D.21591 = add->domain;
  return D.21591;
}


ves_icall_System_AppDomain_getRootDomain ()
{
  struct MonoAppDomain * D.21593;
  struct MonoDomain * root;

  root = mono_get_root_domain ();
  D.21593 = root->domain;
  return D.21593;
}


mono_set_private_bin_path_from_config (struct MonoDomain * domain)
{
  struct MonoAppDomainSetup * D.21598;
  struct MonoString * D.21600;
  int D.21601;
  int D.21606;
  long unsigned int len.28;
  gchar * text.29;
  char D.21612;
  gchar * D.21615;
  char D.21616;
  gchar * D.21619;
  char D.21620;
  sizetype D.21623;
  const gchar * D.21624;
  long unsigned int D.21625;
  long unsigned int D.21626;
  long int D.21627;
  int D.21628;
  struct MonoError error;
  gchar * config_file_name;
  gchar * text;
  gchar * config_file_path;
  gsize len;
  struct GMarkupParseContext * context;
  struct RuntimeConfig runtime_config;
  gint offset;
  void free_and_out = <<< error >>>;

  try
    {
      config_file_name = 0B;
      text = 0B;
      config_file_path = 0B;
      if (domain == 0B) goto <D.21595>; else goto <D.21597>;
      <D.21597>:
      D.21598 = domain->setup;
      if (D.21598 == 0B) goto <D.21595>; else goto <D.21599>;
      <D.21599>:
      D.21598 = domain->setup;
      D.21600 = D.21598->configuration_file;
      if (D.21600 == 0B) goto <D.21595>; else goto <D.21596>;
      <D.21595>:
      return;
      <D.21596>:
      D.21598 = domain->setup;
      D.21600 = D.21598->configuration_file;
      config_file_name = mono_string_to_utf8_checked (D.21600, &error);
      D.21601 = mono_error_ok (&error);
      if (D.21601 == 0) goto <D.21602>; else goto <D.21603>;
      <D.21602>:
      mono_error_cleanup (&error);
      goto free_and_out;
      <D.21603>:
      config_file_path = mono_portability_find_file (config_file_name, 1);
      if (config_file_path == 0B) goto <D.21604>; else goto <D.21605>;
      <D.21604>:
      config_file_path = config_file_name;
      <D.21605>:
      D.21606 = monoeg_g_file_get_contents (config_file_path, &text, &len, 0B);
      if (D.21606 == 0) goto free_and_out; else goto <D.21607>;
      <D.21607>:
      runtime_config.runtime_count = 0;
      runtime_config.assemblybinding_count = 0;
      runtime_config.domain = domain;
      runtime_config.filename = config_file_path;
      offset = 0;
      len.28 = len;
      if (len.28 > 3) goto <D.21609>; else goto <D.21610>;
      <D.21609>:
      text.29 = text;
      D.21612 = *text.29;
      if (D.21612 == 239) goto <D.21613>; else goto <D.21614>;
      <D.21613>:
      text.29 = text;
      D.21615 = text.29 + 1;
      D.21616 = *D.21615;
      if (D.21616 == 187) goto <D.21617>; else goto <D.21618>;
      <D.21617>:
      text.29 = text;
      D.21619 = text.29 + 2;
      D.21620 = *D.21619;
      if (D.21620 == 191) goto <D.21621>; else goto <D.21622>;
      <D.21621>:
      offset = 3;
      <D.21622>:
      <D.21618>:
      <D.21614>:
      <D.21610>:
      context = monoeg_g_markup_parse_context_new (&mono_parser, 0, &runtime_config, 0B);
      text.29 = text;
      D.21623 = (sizetype) offset;
      D.21624 = text.29 + D.21623;
      len.28 = len;
      D.21625 = (long unsigned int) offset;
      D.21626 = len.28 - D.21625;
      D.21627 = (long int) D.21626;
      D.21628 = monoeg_g_markup_parse_context_parse (context, D.21624, D.21627, 0B);
      if (D.21628 != 0) goto <D.21629>; else goto <D.21630>;
      <D.21629>:
      monoeg_g_markup_parse_context_end_parse (context, 0B);
      <D.21630>:
      monoeg_g_markup_parse_context_free (context);
      free_and_out:
      text.29 = text;
      monoeg_g_free (text.29);
      if (config_file_name != config_file_path) goto <D.21631>; else goto <D.21632>;
      <D.21631>:
      monoeg_g_free (config_file_name);
      <D.21632>:
      monoeg_g_free (config_file_path);
    }
  finally
    {
      error = {CLOBBER};
      text = {CLOBBER};
      len = {CLOBBER};
      runtime_config = {CLOBBER};
    }
}


parse_error (struct GMarkupParseContext * context, struct GError * error, void * user_data)
{
  const gchar * iftmp.30;
  gchar * D.21640;
  const gchar * iftmp.31;
  gchar * D.21646;
  struct RuntimeConfig * state;
  const gchar * msg;
  const gchar * filename;

  state = user_data;
  if (state != 0B) goto <D.21639>; else goto <D.21637>;
  <D.21639>:
  D.21640 = state->filename;
  if (D.21640 != 0B) goto <D.21641>; else goto <D.21637>;
  <D.21641>:
  iftmp.30 = state->filename;
  goto <D.21638>;
  <D.21637>:
  iftmp.30 = "<unknown>";
  <D.21638>:
  filename = iftmp.30;
  if (error != 0B) goto <D.21645>; else goto <D.21643>;
  <D.21645>:
  D.21646 = error->message;
  if (D.21646 != 0B) goto <D.21647>; else goto <D.21643>;
  <D.21647>:
  iftmp.31 = error->message;
  goto <D.21644>;
  <D.21643>:
  iftmp.31 = "";
  <D.21644>:
  msg = iftmp.31;
  monoeg_g_log (0B, 16, "Error parsing %s: %s", filename, msg);
}


end_element (struct GMarkupParseContext * context, const gchar * element_name, void * user_data, struct GError * * error)
{
  int D.20043;
  int iftmp.32;
  int D.20042;
  const char[8] * D.21651;
  unsigned char D.21652;
  int D.21653;
  unsigned char D.21654;
  int D.21655;
  const unsigned char * D.21660;
  unsigned char D.21661;
  int D.21662;
  const unsigned char * D.21663;
  unsigned char D.21664;
  int D.21665;
  const unsigned char * D.21670;
  unsigned char D.21671;
  int D.21672;
  const unsigned char * D.21673;
  unsigned char D.21674;
  int D.21675;
  const unsigned char * D.21680;
  unsigned char D.21681;
  int D.21682;
  const unsigned char * D.21683;
  unsigned char D.21684;
  int D.21685;
  int D.21689;
  int D.21690;
  int D.20052;
  int iftmp.33;
  int D.20051;
  const char[16] * D.21695;
  unsigned char D.21696;
  int D.21697;
  unsigned char D.21698;
  int D.21699;
  const unsigned char * D.21704;
  unsigned char D.21705;
  int D.21706;
  const unsigned char * D.21707;
  unsigned char D.21708;
  int D.21709;
  const unsigned char * D.21714;
  unsigned char D.21715;
  int D.21716;
  const unsigned char * D.21717;
  unsigned char D.21718;
  int D.21719;
  const unsigned char * D.21724;
  unsigned char D.21725;
  int D.21726;
  const unsigned char * D.21727;
  unsigned char D.21728;
  int D.21729;
  int D.21733;
  int D.21734;
  struct RuntimeConfig * runtime_config;

  runtime_config = user_data;
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = element_name;
      D.21651 = "runtime";
      D.21652 = MEM[(const unsigned char *)D.21651];
      D.21653 = (int) D.21652;
      D.21654 = *__s2;
      D.21655 = (int) D.21654;
      __result = D.21653 - D.21655;
      {
        if (__s2_len != 0) goto <D.21656>; else goto <D.21657>;
        <D.21656>:
        if (__result == 0) goto <D.21658>; else goto <D.21659>;
        <D.21658>:
        D.21660 = &MEM[(void *)"runtime" + 1B];
        D.21661 = *D.21660;
        D.21662 = (int) D.21661;
        D.21663 = __s2 + 1;
        D.21664 = *D.21663;
        D.21665 = (int) D.21664;
        __result = D.21662 - D.21665;
        if (__s2_len > 1) goto <D.21666>; else goto <D.21667>;
        <D.21666>:
        if (__result == 0) goto <D.21668>; else goto <D.21669>;
        <D.21668>:
        D.21670 = &MEM[(void *)"runtime" + 2B];
        D.21671 = *D.21670;
        D.21672 = (int) D.21671;
        D.21673 = __s2 + 2;
        D.21674 = *D.21673;
        D.21675 = (int) D.21674;
        __result = D.21672 - D.21675;
        if (__s2_len > 2) goto <D.21676>; else goto <D.21677>;
        <D.21676>:
        if (__result == 0) goto <D.21678>; else goto <D.21679>;
        <D.21678>:
        D.21680 = &MEM[(void *)"runtime" + 3B];
        D.21681 = *D.21680;
        D.21682 = (int) D.21681;
        D.21683 = __s2 + 3;
        D.21684 = *D.21683;
        D.21685 = (int) D.21684;
        __result = D.21682 - D.21685;
        <D.21679>:
        <D.21677>:
        <D.21669>:
        <D.21667>:
        <D.21659>:
        <D.21657>:
      }
      D.20042 = __result;
    }
    iftmp.32 = -D.20042;
    goto <D.21686>;
    <D.21650>:
    iftmp.32 = __builtin_strcmp (element_name, "runtime");
    <D.21686>:
    D.20043 = iftmp.32;
  }
  if (D.20043 == 0) goto <D.21687>; else goto <D.21688>;
  <D.21687>:
  D.21689 = runtime_config->runtime_count;
  D.21690 = D.21689 + -1;
  runtime_config->runtime_count = D.21690;
  goto <D.21691>;
  <D.21688>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = element_name;
      D.21695 = "assemblyBinding";
      D.21696 = MEM[(const unsigned char *)D.21695];
      D.21697 = (int) D.21696;
      D.21698 = *__s2;
      D.21699 = (int) D.21698;
      __result = D.21697 - D.21699;
      {
        if (__s2_len != 0) goto <D.21700>; else goto <D.21701>;
        <D.21700>:
        if (__result == 0) goto <D.21702>; else goto <D.21703>;
        <D.21702>:
        D.21704 = &MEM[(void *)"assemblyBinding" + 1B];
        D.21705 = *D.21704;
        D.21706 = (int) D.21705;
        D.21707 = __s2 + 1;
        D.21708 = *D.21707;
        D.21709 = (int) D.21708;
        __result = D.21706 - D.21709;
        if (__s2_len > 1) goto <D.21710>; else goto <D.21711>;
        <D.21710>:
        if (__result == 0) goto <D.21712>; else goto <D.21713>;
        <D.21712>:
        D.21714 = &MEM[(void *)"assemblyBinding" + 2B];
        D.21715 = *D.21714;
        D.21716 = (int) D.21715;
        D.21717 = __s2 + 2;
        D.21718 = *D.21717;
        D.21719 = (int) D.21718;
        __result = D.21716 - D.21719;
        if (__s2_len > 2) goto <D.21720>; else goto <D.21721>;
        <D.21720>:
        if (__result == 0) goto <D.21722>; else goto <D.21723>;
        <D.21722>:
        D.21724 = &MEM[(void *)"assemblyBinding" + 3B];
        D.21725 = *D.21724;
        D.21726 = (int) D.21725;
        D.21727 = __s2 + 3;
        D.21728 = *D.21727;
        D.21729 = (int) D.21728;
        __result = D.21726 - D.21729;
        <D.21723>:
        <D.21721>:
        <D.21713>:
        <D.21711>:
        <D.21703>:
        <D.21701>:
      }
      D.20051 = __result;
    }
    iftmp.33 = -D.20051;
    goto <D.21730>;
    <D.21694>:
    iftmp.33 = __builtin_strcmp (element_name, "assemblyBinding");
    <D.21730>:
    D.20052 = iftmp.33;
  }
  if (D.20052 == 0) goto <D.21731>; else goto <D.21732>;
  <D.21731>:
  D.21733 = runtime_config->assemblybinding_count;
  D.21734 = D.21733 + -1;
  runtime_config->assemblybinding_count = D.21734;
  <D.21732>:
  <D.21691>:
}


start_element (struct GMarkupParseContext * context, const gchar * element_name, const gchar * * attribute_names, const gchar * * attribute_values, void * user_data, struct GError * * error)
{
  int D.20009;
  int iftmp.34;
  int D.20008;
  const char[8] * D.21738;
  unsigned char D.21739;
  int D.21740;
  unsigned char D.21741;
  int D.21742;
  const unsigned char * D.21747;
  unsigned char D.21748;
  int D.21749;
  const unsigned char * D.21750;
  unsigned char D.21751;
  int D.21752;
  const unsigned char * D.21757;
  unsigned char D.21758;
  int D.21759;
  const unsigned char * D.21760;
  unsigned char D.21761;
  int D.21762;
  const unsigned char * D.21767;
  unsigned char D.21768;
  int D.21769;
  const unsigned char * D.21770;
  unsigned char D.21771;
  int D.21772;
  int D.21776;
  int D.21777;
  int D.20018;
  int iftmp.35;
  int D.20017;
  const char[16] * D.21781;
  unsigned char D.21782;
  int D.21783;
  unsigned char D.21784;
  int D.21785;
  const unsigned char * D.21790;
  unsigned char D.21791;
  int D.21792;
  const unsigned char * D.21793;
  unsigned char D.21794;
  int D.21795;
  const unsigned char * D.21800;
  unsigned char D.21801;
  int D.21802;
  const unsigned char * D.21803;
  unsigned char D.21804;
  int D.21805;
  const unsigned char * D.21810;
  unsigned char D.21811;
  int D.21812;
  const unsigned char * D.21813;
  unsigned char D.21814;
  int D.21815;
  int D.21819;
  int D.21820;
  signed long D.21821;
  long unsigned int D.21822;
  long unsigned int D.21823;
  int D.20027;
  int iftmp.36;
  int D.20026;
  const char[8] * D.21829;
  unsigned char D.21830;
  int D.21831;
  unsigned char D.21832;
  int D.21833;
  const unsigned char * D.21838;
  unsigned char D.21839;
  int D.21840;
  const unsigned char * D.21841;
  unsigned char D.21842;
  int D.21843;
  const unsigned char * D.21848;
  unsigned char D.21849;
  int D.21850;
  const unsigned char * D.21851;
  unsigned char D.21852;
  int D.21853;
  const unsigned char * D.21858;
  unsigned char D.21859;
  int D.21860;
  const unsigned char * D.21861;
  unsigned char D.21862;
  int D.21863;
  struct MonoDomain * D.21867;
  gchar * D.21868;
  char * D.21869;
  char D.21872;
  struct RuntimeConfig * runtime_config;

  runtime_config = user_data;
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = element_name;
      D.21738 = "runtime";
      D.21739 = MEM[(const unsigned char *)D.21738];
      D.21740 = (int) D.21739;
      D.21741 = *__s2;
      D.21742 = (int) D.21741;
      __result = D.21740 - D.21742;
      {
        if (__s2_len != 0) goto <D.21743>; else goto <D.21744>;
        <D.21743>:
        if (__result == 0) goto <D.21745>; else goto <D.21746>;
        <D.21745>:
        D.21747 = &MEM[(void *)"runtime" + 1B];
        D.21748 = *D.21747;
        D.21749 = (int) D.21748;
        D.21750 = __s2 + 1;
        D.21751 = *D.21750;
        D.21752 = (int) D.21751;
        __result = D.21749 - D.21752;
        if (__s2_len > 1) goto <D.21753>; else goto <D.21754>;
        <D.21753>:
        if (__result == 0) goto <D.21755>; else goto <D.21756>;
        <D.21755>:
        D.21757 = &MEM[(void *)"runtime" + 2B];
        D.21758 = *D.21757;
        D.21759 = (int) D.21758;
        D.21760 = __s2 + 2;
        D.21761 = *D.21760;
        D.21762 = (int) D.21761;
        __result = D.21759 - D.21762;
        if (__s2_len > 2) goto <D.21763>; else goto <D.21764>;
        <D.21763>:
        if (__result == 0) goto <D.21765>; else goto <D.21766>;
        <D.21765>:
        D.21767 = &MEM[(void *)"runtime" + 3B];
        D.21768 = *D.21767;
        D.21769 = (int) D.21768;
        D.21770 = __s2 + 3;
        D.21771 = *D.21770;
        D.21772 = (int) D.21771;
        __result = D.21769 - D.21772;
        <D.21766>:
        <D.21764>:
        <D.21756>:
        <D.21754>:
        <D.21746>:
        <D.21744>:
      }
      D.20008 = __result;
    }
    iftmp.34 = -D.20008;
    goto <D.21773>;
    <D.21737>:
    iftmp.34 = __builtin_strcmp (element_name, "runtime");
    <D.21773>:
    D.20009 = iftmp.34;
  }
  if (D.20009 == 0) goto <D.21774>; else goto <D.21775>;
  <D.21774>:
  D.21776 = runtime_config->runtime_count;
  D.21777 = D.21776 + 1;
  runtime_config->runtime_count = D.21777;
  return;
  <D.21775>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = element_name;
      D.21781 = "assemblyBinding";
      D.21782 = MEM[(const unsigned char *)D.21781];
      D.21783 = (int) D.21782;
      D.21784 = *__s2;
      D.21785 = (int) D.21784;
      __result = D.21783 - D.21785;
      {
        if (__s2_len != 0) goto <D.21786>; else goto <D.21787>;
        <D.21786>:
        if (__result == 0) goto <D.21788>; else goto <D.21789>;
        <D.21788>:
        D.21790 = &MEM[(void *)"assemblyBinding" + 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;
        if (__s2_len > 1) goto <D.21796>; else goto <D.21797>;
        <D.21796>:
        if (__result == 0) goto <D.21798>; else goto <D.21799>;
        <D.21798>:
        D.21800 = &MEM[(void *)"assemblyBinding" + 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;
        if (__s2_len > 2) goto <D.21806>; else goto <D.21807>;
        <D.21806>:
        if (__result == 0) goto <D.21808>; else goto <D.21809>;
        <D.21808>:
        D.21810 = &MEM[(void *)"assemblyBinding" + 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.21807>:
        <D.21799>:
        <D.21797>:
        <D.21789>:
        <D.21787>:
      }
      D.20017 = __result;
    }
    iftmp.35 = -D.20017;
    goto <D.21816>;
    <D.21780>:
    iftmp.35 = __builtin_strcmp (element_name, "assemblyBinding");
    <D.21816>:
    D.20018 = iftmp.35;
  }
  if (D.20018 == 0) goto <D.21817>; else goto <D.21818>;
  <D.21817>:
  D.21819 = runtime_config->assemblybinding_count;
  D.21820 = D.21819 + 1;
  runtime_config->assemblybinding_count = D.21820;
  return;
  <D.21818>:
  D.21821 = BIT_FIELD_REF <*runtime_config, 64, 0>;
  D.21822 = (long unsigned int) D.21821;
  D.21823 = D.21822;
  if (D.21823 != 4294967297) goto <D.21824>; else goto <D.21825>;
  <D.21824>:
  return;
  <D.21825>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = element_name;
      D.21829 = "probing";
      D.21830 = MEM[(const unsigned char *)D.21829];
      D.21831 = (int) D.21830;
      D.21832 = *__s2;
      D.21833 = (int) D.21832;
      __result = D.21831 - D.21833;
      {
        if (__s2_len != 0) goto <D.21834>; else goto <D.21835>;
        <D.21834>:
        if (__result == 0) goto <D.21836>; else goto <D.21837>;
        <D.21836>:
        D.21838 = &MEM[(void *)"probing" + 1B];
        D.21839 = *D.21838;
        D.21840 = (int) D.21839;
        D.21841 = __s2 + 1;
        D.21842 = *D.21841;
        D.21843 = (int) D.21842;
        __result = D.21840 - D.21843;
        if (__s2_len > 1) goto <D.21844>; else goto <D.21845>;
        <D.21844>:
        if (__result == 0) goto <D.21846>; else goto <D.21847>;
        <D.21846>:
        D.21848 = &MEM[(void *)"probing" + 2B];
        D.21849 = *D.21848;
        D.21850 = (int) D.21849;
        D.21851 = __s2 + 2;
        D.21852 = *D.21851;
        D.21853 = (int) D.21852;
        __result = D.21850 - D.21853;
        if (__s2_len > 2) goto <D.21854>; else goto <D.21855>;
        <D.21854>:
        if (__result == 0) goto <D.21856>; else goto <D.21857>;
        <D.21856>:
        D.21858 = &MEM[(void *)"probing" + 3B];
        D.21859 = *D.21858;
        D.21860 = (int) D.21859;
        D.21861 = __s2 + 3;
        D.21862 = *D.21861;
        D.21863 = (int) D.21862;
        __result = D.21860 - D.21863;
        <D.21857>:
        <D.21855>:
        <D.21847>:
        <D.21845>:
        <D.21837>:
        <D.21835>:
      }
      D.20026 = __result;
    }
    iftmp.36 = -D.20026;
    goto <D.21864>;
    <D.21828>:
    iftmp.36 = __builtin_strcmp (element_name, "probing");
    <D.21864>:
    D.20027 = iftmp.36;
  }
  if (D.20027 != 0) goto <D.21865>; else goto <D.21866>;
  <D.21865>:
  return;
  <D.21866>:
  D.21867 = runtime_config->domain;
  D.21868 = D.21867->private_bin_path;
  monoeg_g_free (D.21868);
  D.21867 = runtime_config->domain;
  D.21869 = get_attribute_value (attribute_names, attribute_values, "privatePath");
  D.21867->private_bin_path = D.21869;
  D.21867 = runtime_config->domain;
  D.21868 = D.21867->private_bin_path;
  if (D.21868 != 0B) goto <D.21870>; else goto <D.21871>;
  <D.21870>:
  D.21867 = runtime_config->domain;
  D.21868 = D.21867->private_bin_path;
  D.21872 = *D.21868;
  if (D.21872 == 0) goto <D.21873>; else goto <D.21874>;
  <D.21873>:
  D.21867 = runtime_config->domain;
  D.21868 = D.21867->private_bin_path;
  monoeg_g_free (D.21868);
  D.21867 = runtime_config->domain;
  D.21867->private_bin_path = 0B;
  return;
  <D.21874>:
  <D.21871>:
}


get_attribute_value (const gchar * * attribute_names, const gchar * * attribute_values, const char * att_name)
{
  int D.19988;
  long unsigned int D.21876;
  long unsigned int D.21877;
  const gchar * * D.21878;
  const gchar * D.21879;
  char * D.21882;
  const gchar * * D.21883;
  const gchar * D.21884;
  int n;

  n = 0;
  goto <D.19990>;
  <D.19989>:
  {
    size_t __s1_len;
    size_t __s2_len;

    D.21876 = (long unsigned int) n;
    D.21877 = D.21876 * 8;
    D.21878 = attribute_names + D.21877;
    D.21879 = *D.21878;
    D.19988 = __builtin_strcmp (D.21879, att_name);
  }
  if (D.19988 == 0) goto <D.21880>; else goto <D.21881>;
  <D.21880>:
  D.21876 = (long unsigned int) n;
  D.21877 = D.21876 * 8;
  D.21883 = attribute_values + D.21877;
  D.21884 = *D.21883;
  D.21882 = monoeg_strdup (D.21884);
  return D.21882;
  <D.21881>:
  n = n + 1;
  <D.19990>:
  D.21876 = (long unsigned int) n;
  D.21877 = D.21876 * 8;
  D.21878 = attribute_names + D.21877;
  D.21879 = *D.21878;
  if (D.21879 != 0B) goto <D.19989>; else goto <D.19991>;
  <D.19991>:
  D.21882 = 0B;
  return D.21882;
}


ves_icall_System_AppDomain_createDomain (struct MonoString * friendly_name, struct MonoAppDomainSetup * setup)
{
  struct MonoAppDomain * D.21886;
  char * fname;
  struct MonoAppDomain * ad;

  fname = mono_string_to_utf8 (friendly_name);
  ad = mono_domain_create_appdomain_internal (fname, setup);
  monoeg_g_free (fname);
  D.21886 = ad;
  return D.21886;
}


ves_icall_System_AppDomain_GetAssemblies (struct MonoAppDomain * ad, MonoBoolean refonly)
{
  struct MonoClass * System_Reflection_Assembly.37;
  struct MonoImage * D.21891;
  struct MonoClass * System_Reflection_Assembly.38;
  union mono_mutex_t * D.21893;
  _Bool D.21896;
  long int D.21897;
  long int D.21898;
  int D.21901;
  int D.21902;
  unsigned char D.21905;
  _Bool D.21910;
  long int D.21911;
  long int D.21912;
  unsigned int D.21915;
  long unsigned int D.21916;
  void * * D.21917;
  long unsigned int D.21918;
  long unsigned int D.21919;
  void * * D.21920;
  long unsigned int D.21921;
  struct MonoReflectionAssembly * D.21922;
  unsigned int i.39;
  struct MonoArray * D.21924;
  struct MonoDomain * domain;
  struct MonoAssembly * ass;
  static struct MonoClass * System_Reflection_Assembly;
  struct MonoArray * res;
  struct GSList * tmp;
  int i;
  struct GPtrArray * assemblies;

  domain = ad->data;
  System_Reflection_Assembly.37 = System_Reflection_Assembly;
  if (System_Reflection_Assembly.37 == 0B) goto <D.21889>; else goto <D.21890>;
  <D.21889>:
  D.21891 = mono_defaults.corlib;
  System_Reflection_Assembly.38 = mono_class_from_name (D.21891, "System.Reflection", "Assembly");
  System_Reflection_Assembly = System_Reflection_Assembly.38;
  <D.21890>:
  assemblies = monoeg_g_ptr_array_new ();
  {
    int ret;

    D.21893 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_lock (D.21893);
    if (ret != 0) goto <D.21894>; else goto <D.21895>;
    <D.21894>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21895>:
    D.21896 = ret != 0;
    D.21897 = (long int) D.21896;
    D.21898 = __builtin_expect (D.21897, 0);
    if (D.21898 != 0) goto <D.21899>; else goto <D.21900>;
    <D.21899>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 874, "ret == 0");
    <D.21900>:
  }
  tmp = domain->domain_assemblies;
  goto <D.20094>;
  <D.20093>:
  ass = tmp->data;
  D.21901 = (int) refonly;
  D.21902 = ass->ref_only;
  if (D.21901 != D.21902) goto <D.21903>; else goto <D.21904>;
  <D.21903>:
  // predicted unlikely by continue predictor.
  goto <D.20092>;
  <D.21904>:
  D.21905 = ass->corlib_internal;
  if (D.21905 != 0) goto <D.21906>; else goto <D.21907>;
  <D.21906>:
  // predicted unlikely by continue predictor.
  goto <D.20092>;
  <D.21907>:
  monoeg_g_ptr_array_add (assemblies, ass);
  <D.20092>:
  tmp = tmp->next;
  <D.20094>:
  if (tmp != 0B) goto <D.20093>; else goto <D.20095>;
  <D.20095>:
  {
    int ret;

    D.21893 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.21893);
    if (ret != 0) goto <D.21908>; else goto <D.21909>;
    <D.21908>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21909>:
    D.21910 = ret != 0;
    D.21911 = (long int) D.21910;
    D.21912 = __builtin_expect (D.21911, 0);
    if (D.21912 != 0) goto <D.21913>; else goto <D.21914>;
    <D.21913>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 883, "ret == 0");
    <D.21914>:
  }
  System_Reflection_Assembly.37 = System_Reflection_Assembly;
  D.21915 = assemblies->len;
  D.21916 = (long unsigned int) D.21915;
  res = mono_array_new (domain, System_Reflection_Assembly.37, D.21916);
  i = 0;
  goto <D.20099>;
  <D.20098>:
  D.21917 = assemblies->pdata;
  D.21918 = (long unsigned int) i;
  D.21919 = D.21918 * 8;
  D.21920 = D.21917 + D.21919;
  ass = *D.21920;
  {
    void * * __p;

    D.21921 = (long unsigned int) i;
    __p = mono_array_addr_with_size (res, 8, D.21921);
    D.21922 = mono_assembly_get_object (domain, ass);
    mono_gc_wbarrier_set_arrayref (res, __p, D.21922);
  }
  i = i + 1;
  <D.20099>:
  i.39 = (unsigned int) i;
  D.21915 = assemblies->len;
  if (i.39 < D.21915) goto <D.20098>; else goto <D.20100>;
  <D.20100>:
  monoeg_g_ptr_array_free (assemblies, 1);
  D.21924 = res;
  return D.21924;
}


mono_try_assembly_resolve (struct MonoDomain * domain, struct MonoString * fname, gboolean refonly)
{
  int D.21926;
  struct MonoReflectionAssembly * D.21929;
  int iftmp.40;
  _Bool D.21935;
  long int D.21936;
  long int D.21937;
  struct MonoAppDomain * D.21940;
  struct MonoVTable * D.21941;
  _Bool D.21942;
  long int D.21943;
  long int D.21944;
  _Bool D.21949;
  unsigned char isrefonly.41;
  struct MonoClass * klass;
  struct MonoMethod * method;
  MonoBoolean isrefonly;
  void * params[2];

  try
    {
      D.21926 = mono_runtime_get_no_exec ();
      if (D.21926 != 0) goto <D.21927>; else goto <D.21928>;
      <D.21927>:
      D.21929 = 0B;
      return D.21929;
      <D.21928>:
      if (domain == 0B) goto <D.21931>; else goto <D.21934>;
      <D.21934>:
      if (fname == 0B) goto <D.21931>; else goto <D.21932>;
      <D.21931>:
      iftmp.40 = 1;
      goto <D.21933>;
      <D.21932>:
      iftmp.40 = 0;
      <D.21933>:
      D.21935 = iftmp.40 != 0;
      D.21936 = (long int) D.21935;
      D.21937 = __builtin_expect (D.21936, 0);
      if (D.21937 != 0) goto <D.21938>; else goto <D.21939>;
      <D.21938>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 907, "domain != NULL && fname != NULL");
      <D.21939>:
      D.21940 = domain->domain;
      D.21941 = D.21940->mbr.obj.vtable;
      klass = D.21941->klass;
      D.21942 = klass == 0B;
      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", "appdomain.c", 910, "klass");
      <D.21946>:
      method = mono_class_get_method_from_name (klass, "DoAssemblyResolve", -1);
      if (method == 0B) goto <D.21947>; else goto <D.21948>;
      <D.21947>:
      monoeg_g_log (0B, 16, "Method AppDomain.DoAssemblyResolve not found.\n");
      D.21929 = 0B;
      return D.21929;
      <D.21948>:
      D.21949 = refonly != 0;
      isrefonly.41 = (unsigned char) D.21949;
      isrefonly = isrefonly.41;
      params[0] = fname;
      params[1] = &isrefonly;
      D.21940 = domain->domain;
      D.21929 = mono_runtime_invoke (method, D.21940, &params, 0B);
      return D.21929;
    }
  finally
    {
      isrefonly = {CLOBBER};
      params = {CLOBBER};
    }
}


mono_is_shadow_copy_enabled (struct MonoDomain * domain, const gchar * dir_name)
{
  gboolean D.21955;
  struct MonoString * D.21959;
  int D.21960;
  int D.21963;
  _Bool D.21964;
  struct MonoString * D.21967;
  int D.21970;
  char * D.21973;
  int D.21976;
  gchar * D.21979;
  char D.21980;
  int D.20302;
  struct MonoError error;
  struct MonoAppDomainSetup * setup;
  gchar * all_dirs;
  gchar * * dir_ptr;
  gchar * * directories;
  gchar * shadow_status_string;
  gchar * base_dir;
  gboolean shadow_enabled;
  gboolean found;

  try
    {
      found = 0;
      if (domain == 0B) goto <D.21953>; else goto <D.21954>;
      <D.21953>:
      D.21955 = 0;
      return D.21955;
      <D.21954>:
      setup = domain->setup;
      if (setup == 0B) goto <D.21956>; else goto <D.21958>;
      <D.21958>:
      D.21959 = setup->shadow_copy_files;
      if (D.21959 == 0B) goto <D.21956>; else goto <D.21957>;
      <D.21956>:
      D.21955 = 0;
      return D.21955;
      <D.21957>:
      D.21959 = setup->shadow_copy_files;
      shadow_status_string = mono_string_to_utf8_checked (D.21959, &error);
      D.21960 = mono_error_ok (&error);
      if (D.21960 == 0) goto <D.21961>; else goto <D.21962>;
      <D.21961>:
      mono_error_cleanup (&error);
      D.21955 = 0;
      return D.21955;
      <D.21962>:
      D.21963 = monoeg_g_ascii_strncasecmp (shadow_status_string, "true", 4);
      D.21964 = D.21963 == 0;
      shadow_enabled = (gboolean) D.21964;
      monoeg_g_free (shadow_status_string);
      if (shadow_enabled == 0) goto <D.21965>; else goto <D.21966>;
      <D.21965>:
      D.21955 = 0;
      return D.21955;
      <D.21966>:
      D.21967 = setup->shadow_copy_directories;
      if (D.21967 == 0B) goto <D.21968>; else goto <D.21969>;
      <D.21968>:
      D.21955 = 1;
      return D.21955;
      <D.21969>:
      base_dir = get_shadow_assembly_location_base (domain, &error);
      D.21970 = mono_error_ok (&error);
      if (D.21970 == 0) goto <D.21971>; else goto <D.21972>;
      <D.21971>:
      mono_error_cleanup (&error);
      D.21955 = 0;
      return D.21955;
      <D.21972>:
      D.21973 = strstr (dir_name, base_dir);
      if (D.21973 != 0B) goto <D.21974>; else goto <D.21975>;
      <D.21974>:
      monoeg_g_free (base_dir);
      D.21955 = 1;
      return D.21955;
      <D.21975>:
      monoeg_g_free (base_dir);
      D.21967 = setup->shadow_copy_directories;
      all_dirs = mono_string_to_utf8_checked (D.21967, &error);
      D.21976 = mono_error_ok (&error);
      if (D.21976 == 0) goto <D.21977>; else goto <D.21978>;
      <D.21977>:
      mono_error_cleanup (&error);
      D.21955 = 0;
      return D.21955;
      <D.21978>:
      directories = monoeg_g_strsplit (all_dirs, ":", 1000);
      dir_ptr = directories;
      goto <D.20305>;
      <D.20304>:
      D.21979 = *dir_ptr;
      D.21980 = *D.21979;
      if (D.21980 != 0) goto <D.21981>; else goto <D.21982>;
      <D.21981>:
      {
        size_t __s1_len;
        size_t __s2_len;

        D.21979 = *dir_ptr;
        D.20302 = __builtin_strcmp (D.21979, dir_name);
      }
      if (D.20302 == 0) goto <D.21983>; else goto <D.21984>;
      <D.21983>:
      found = 1;
      goto <D.20303>;
      <D.21984>:
      <D.21982>:
      dir_ptr = dir_ptr + 8;
      <D.20305>:
      D.21979 = *dir_ptr;
      if (D.21979 != 0B) goto <D.20304>; else goto <D.20303>;
      <D.20303>:
      monoeg_g_strfreev (directories);
      monoeg_g_free (all_dirs);
      D.21955 = found;
      return D.21955;
    }
  finally
    {
      error = {CLOBBER};
    }
}


mono_make_shadow_copy (const char * filename)
{
  int D.21987;
  char * D.21990;
  int D.21991;
  char * D.21994;
  int D.21997;
  int D.22000;
  int D.22003;
  long unsigned int D.22006;
  long int D.22007;
  long unsigned int D.22008;
  long int D.22009;
  long unsigned int D.22016;
  long unsigned int D.22017;
  int D.22022;
  long int D.22025;
  long int D.22026;
  struct MonoError error;
  gchar * sibling_source;
  gchar * sibling_target;
  gint sibling_source_len;
  gint sibling_target_len;
  guint16 * orig;
  guint16 * dest;
  guint32 attrs;
  char * shadow;
  gboolean copy_result;
  struct MonoException * exc;
  struct stat src_sbuf;
  struct utimbuf utbuf;
  char * dir_name;
  struct MonoDomain * domain;
  char * shadow_dir;

  try
    {
      dir_name = monoeg_g_path_get_dirname (filename);
      domain = mono_domain_get ();
      set_domain_search_path (domain);
      D.21987 = mono_is_shadow_copy_enabled (domain, dir_name);
      if (D.21987 == 0) goto <D.21988>; else goto <D.21989>;
      <D.21988>:
      monoeg_g_free (dir_name);
      D.21990 = filename;
      return D.21990;
      <D.21989>:
      shadow_dir = get_shadow_assembly_location_base (domain, &error);
      D.21991 = mono_error_ok (&error);
      if (D.21991 == 0) goto <D.21992>; else goto <D.21993>;
      <D.21992>:
      mono_error_cleanup (&error);
      monoeg_g_free (dir_name);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy (invalid characters in shadow directory name).");
      mono_raise_exception (exc);
      <D.21993>:
      D.21994 = strstr (dir_name, shadow_dir);
      if (D.21994 != 0B) goto <D.21995>; else goto <D.21996>;
      <D.21995>:
      monoeg_g_free (shadow_dir);
      monoeg_g_free (dir_name);
      D.21990 = filename;
      return D.21990;
      <D.21996>:
      monoeg_g_free (shadow_dir);
      monoeg_g_free (dir_name);
      shadow = get_shadow_assembly_location (filename, &error);
      D.21997 = mono_error_ok (&error);
      if (D.21997 == 0) goto <D.21998>; else goto <D.21999>;
      <D.21998>:
      mono_error_cleanup (&error);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy (invalid characters in file name).");
      mono_raise_exception (exc);
      <D.21999>:
      D.22000 = ensure_directory_exists (shadow);
      if (D.22000 == 0) goto <D.22001>; else goto <D.22002>;
      <D.22001>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy (ensure directory exists).");
      mono_raise_exception (exc);
      <D.22002>:
      D.22003 = private_file_needs_copying (filename, &src_sbuf, shadow);
      if (D.22003 == 0) goto <D.22004>; else goto <D.22005>;
      <D.22004>:
      D.21990 = shadow;
      return D.21990;
      <D.22005>:
      D.22006 = strlen (filename);
      D.22007 = (long int) D.22006;
      orig = monoeg_g_utf8_to_utf16 (filename, D.22007, 0B, 0B, 0B);
      D.22008 = strlen (shadow);
      D.22009 = (long int) D.22008;
      dest = monoeg_g_utf8_to_utf16 (shadow, D.22009, 0B, 0B, 0B);
      DeleteFile (dest);
      attrs = GetFileAttributes (orig);
      if (attrs == 4294967295) goto <D.22010>; else goto <D.22011>;
      <D.22010>:
      monoeg_g_free (shadow);
      D.21990 = filename;
      return D.21990;
      <D.22011>:
      copy_result = CopyFile (orig, dest, 0);
      if (copy_result != 0) goto <D.22012>; else goto <D.22013>;
      <D.22012>:
      copy_result = SetFileAttributes (dest, 128);
      <D.22013>:
      monoeg_g_free (dest);
      monoeg_g_free (orig);
      if (copy_result == 0) goto <D.22014>; else goto <D.22015>;
      <D.22014>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy (CopyFile).");
      mono_raise_exception (exc);
      <D.22015>:
      sibling_source = monoeg_g_strconcat (filename, ".config", 0B);
      D.22016 = strlen (sibling_source);
      sibling_source_len = (gint) D.22016;
      sibling_target = monoeg_g_strconcat (shadow, ".config", 0B);
      D.22017 = strlen (sibling_target);
      sibling_target_len = (gint) D.22017;
      copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".mdb", sibling_target, sibling_target_len, 7);
      if (copy_result == 1) goto <D.22018>; else goto <D.22019>;
      <D.22018>:
      copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".config", sibling_target, sibling_target_len, 7);
      <D.22019>:
      monoeg_g_free (sibling_source);
      monoeg_g_free (sibling_target);
      if (copy_result == 0) goto <D.22020>; else goto <D.22021>;
      <D.22020>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy of sibling data (CopyFile).");
      mono_raise_exception (exc);
      <D.22021>:
      D.22022 = shadow_copy_create_ini (shadow, filename);
      if (D.22022 == 0) goto <D.22023>; else goto <D.22024>;
      <D.22023>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy .ini file.");
      mono_raise_exception (exc);
      <D.22024>:
      D.22025 = src_sbuf.st_atim.tv_sec;
      utbuf.actime = D.22025;
      D.22026 = src_sbuf.st_mtim.tv_sec;
      utbuf.modtime = D.22026;
      utime (shadow, &utbuf);
      D.21990 = shadow;
      return D.21990;
    }
  finally
    {
      error = {CLOBBER};
      src_sbuf = {CLOBBER};
      utbuf = {CLOBBER};
    }
}


get_shadow_assembly_location (const char * filename, struct MonoError * error)
{
  int D.22029;
  int D.22030;
  int D.22031;
  char * D.22034;
  gint32 hash;
  gint32 hash2;
  char name_hash[9];
  char path_hash[30];
  char * bname;
  char * dirname;
  char * location;
  char * tmploc;
  struct MonoDomain * domain;

  try
    {
      hash = 0;
      hash2 = 0;
      bname = monoeg_g_path_get_basename (filename);
      dirname = monoeg_g_path_get_dirname (filename);
      domain = mono_domain_get ();
      mono_error_init (error);
      hash = get_cstring_hash (bname);
      hash2 = get_cstring_hash (dirname);
      monoeg_g_snprintf (&name_hash, 9, "%08x", hash);
      D.22029 = hash ^ hash2;
      D.22030 = domain->shadow_serial;
      monoeg_g_snprintf (&path_hash, 30, "%08x_%08x_%08x", D.22029, hash2, D.22030);
      tmploc = get_shadow_assembly_location_base (domain, error);
      D.22031 = mono_error_ok (error);
      if (D.22031 == 0) goto <D.22032>; else goto <D.22033>;
      <D.22032>:
      monoeg_g_free (bname);
      monoeg_g_free (dirname);
      D.22034 = 0B;
      return D.22034;
      <D.22033>:
      location = monoeg_g_build_path ("/", tmploc, &name_hash, &path_hash, bname, 0B);
      monoeg_g_free (tmploc);
      monoeg_g_free (bname);
      monoeg_g_free (dirname);
      D.22034 = location;
      return D.22034;
    }
  finally
    {
      name_hash = {CLOBBER};
      path_hash = {CLOBBER};
    }
}


get_cstring_hash (const char * str)
{
  char D.22040;
  gint32 D.22041;
  long unsigned int D.22042;
  int D.22043;
  int D.22044;
  char D.22045;
  int D.22046;
  int len;
  int i;
  const char * p;
  gint32 h;

  h = 0;
  if (str == 0B) goto <D.22037>; else goto <D.22039>;
  <D.22039>:
  D.22040 = *str;
  if (D.22040 == 0) goto <D.22037>; else goto <D.22038>;
  <D.22037>:
  D.22041 = 0;
  return D.22041;
  <D.22038>:
  D.22042 = strlen (str);
  len = (int) D.22042;
  p = str;
  i = 0;
  goto <D.20221>;
  <D.20220>:
  D.22043 = h << 5;
  D.22044 = D.22043 - h;
  D.22045 = *p;
  D.22046 = (int) D.22045;
  h = D.22044 + D.22046;
  p = p + 1;
  i = i + 1;
  <D.20221>:
  if (i < len) goto <D.20220>; else goto <D.20222>;
  <D.20222>:
  D.22041 = h;
  return D.22041;
}


ensure_directory_exists (const char * filename)
{
  char D.22051;
  gboolean D.22052;
  int D.22053;
  unsigned int D.22056;
  unsigned int D.22057;
  char D.22060;
  int * D.22065;
  int D.22066;
  char * p.42;
  char * p;
  gchar * dir;
  int retval;
  struct stat sbuf;

  try
    {
      dir = monoeg_g_path_get_dirname (filename);
      if (dir == 0B) goto <D.22048>; else goto <D.22050>;
      <D.22050>:
      D.22051 = *dir;
      if (D.22051 == 0) goto <D.22048>; else goto <D.22049>;
      <D.22048>:
      monoeg_g_free (dir);
      D.22052 = 0;
      return D.22052;
      <D.22049>:
      D.22053 = stat (dir, &sbuf);
      if (D.22053 == 0) goto <D.22054>; else goto <D.22055>;
      <D.22054>:
      D.22056 = sbuf.st_mode;
      D.22057 = D.22056 & 61440;
      if (D.22057 == 16384) goto <D.22058>; else goto <D.22059>;
      <D.22058>:
      monoeg_g_free (dir);
      D.22052 = 1;
      return D.22052;
      <D.22059>:
      <D.22055>:
      p = dir;
      goto <D.20257>;
      <D.20256>:
      p = p + 1;
      <D.20257>:
      D.22060 = *p;
      if (D.22060 == 47) goto <D.20256>; else goto <D.20258>;
      <D.20258>:
      <D.20260>:
      p = __builtin_strchr (p, 47);
      if (p != 0B) goto <D.22061>; else goto <D.22062>;
      <D.22061>:
      *p = 0;
      <D.22062>:
      retval = mkdir (dir, 511);
      if (retval != 0) goto <D.22063>; else goto <D.22064>;
      <D.22063>:
      D.22065 = __errno_location ();
      D.22066 = *D.22065;
      if (D.22066 != 17) goto <D.22067>; else goto <D.22068>;
      <D.22067>:
      monoeg_g_free (dir);
      D.22052 = 0;
      return D.22052;
      <D.22068>:
      <D.22064>:
      if (p == 0B) goto <D.20259>; else goto <D.22069>;
      <D.22069>:
      p.42 = p;
      p = p.42 + 1;
      *p.42 = 47;
      goto <D.20260>;
      <D.20259>:
      monoeg_g_free (dir);
      D.22052 = 1;
      return D.22052;
    }
  finally
    {
      sbuf = {CLOBBER};
    }
}


stat (const char * __path, struct stat * __statbuf)
{
  int D.22073;

  D.22073 = __xstat (1, __path, __statbuf);
  return D.22073;
}


private_file_needs_copying (const char * src, struct stat * sbuf_src, char * dest)
{
  int D.22078;
  gboolean D.22083;
  int D.22086;
  long int D.22089;
  long int D.22090;
  long int D.22093;
  long int D.22094;
  struct stat sbuf_dest;
  gchar * stat_src;
  gchar * real_src;

  try
    {
      real_src = mono_portability_find_file (src, 1);
      if (real_src == 0B) goto <D.22075>; else goto <D.22076>;
      <D.22075>:
      stat_src = src;
      goto <D.22077>;
      <D.22076>:
      stat_src = real_src;
      <D.22077>:
      D.22078 = stat (stat_src, sbuf_src);
      if (D.22078 == -1) goto <D.22079>; else goto <D.22080>;
      <D.22079>:
      {
        time_t tnow;

        tnow = time (0B);
        if (real_src != 0B) goto <D.22081>; else goto <D.22082>;
        <D.22081>:
        monoeg_g_free (real_src);
        <D.22082>:
        memset (sbuf_src, 0, 144);
        sbuf_src->st_mtim.tv_sec = tnow;
        sbuf_src->st_atim.tv_sec = tnow;
        D.22083 = 1;
        return D.22083;
      }
      <D.22080>:
      if (real_src != 0B) goto <D.22084>; else goto <D.22085>;
      <D.22084>:
      monoeg_g_free (real_src);
      <D.22085>:
      D.22086 = stat (dest, &sbuf_dest);
      if (D.22086 == -1) goto <D.22087>; else goto <D.22088>;
      <D.22087>:
      D.22083 = 1;
      return D.22083;
      <D.22088>:
      D.22089 = sbuf_src->st_size;
      D.22090 = sbuf_dest.st_size;
      if (D.22089 == D.22090) goto <D.22091>; else goto <D.22092>;
      <D.22091>:
      D.22093 = sbuf_src->st_mtim.tv_sec;
      D.22094 = sbuf_dest.st_mtim.tv_sec;
      if (D.22093 == D.22094) goto <D.22095>; else goto <D.22096>;
      <D.22095>:
      D.22083 = 0;
      return D.22083;
      <D.22096>:
      <D.22092>:
      D.22083 = 1;
      return D.22083;
    }
  finally
    {
      sbuf_dest = {CLOBBER};
    }
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.22101;
  int D.22106;
  void * D.22108;
  long unsigned int D.22109;

  D.22101 = __builtin_constant_p (__len);
  if (D.22101 != 0) goto <D.22102>; else goto <D.22103>;
  <D.22102>:
  if (__len == 0) goto <D.22104>; else goto <D.22105>;
  <D.22104>:
  D.22106 = __builtin_constant_p (__ch);
  if (D.22106 == 0) goto <D.22099>; else goto <D.22107>;
  <D.22107>:
  if (__ch != 0) goto <D.22099>; else goto <D.22100>;
  <D.22099>:
  __warn_memset_zero_len ();
  D.22108 = __dest;
  return D.22108;
  <D.22100>:
  <D.22105>:
  <D.22103>:
  D.22109 = __builtin_object_size (__dest, 0);
  D.22108 = __builtin___memset_chk (__dest, __ch, __len, D.22109);
  return D.22108;
}


shadow_copy_sibling (gchar * src, gint srclen, const char * extension, gchar * target, gint targetlen, gint tail_len)
{
  sizetype D.22111;
  sizetype D.22112;
  sizetype D.22113;
  gchar * D.22114;
  int __mono_io_portability_helpers.43;
  int D.22116;
  gboolean D.22121;
  int D.22123;
  long unsigned int D.22126;
  long int D.22127;
  sizetype D.22128;
  sizetype D.22129;
  gchar * D.22130;
  long unsigned int D.22131;
  long int D.22132;
  guint16 * orig;
  guint16 * dest;
  gboolean copy_result;

  D.22111 = (sizetype) srclen;
  D.22112 = (sizetype) tail_len;
  D.22113 = D.22111 - D.22112;
  D.22114 = src + D.22113;
  strcpy (D.22114, extension);
  __mono_io_portability_helpers.43 = __mono_io_portability_helpers;
  D.22116 = __mono_io_portability_helpers.43 & 4;
  if (D.22116 != 0) goto <D.22117>; else goto <D.22118>;
  <D.22117>:
  {
    gchar * file;

    file = mono_portability_find_file (src, 1);
    if (file == 0B) goto <D.22119>; else goto <D.22120>;
    <D.22119>:
    D.22121 = 1;
    return D.22121;
    <D.22120>:
    monoeg_g_free (file);
  }
  goto <D.22122>;
  <D.22118>:
  D.22123 = monoeg_g_file_test (src, 1);
  if (D.22123 == 0) goto <D.22124>; else goto <D.22125>;
  <D.22124>:
  D.22121 = 1;
  return D.22121;
  <D.22125>:
  <D.22122>:
  D.22126 = strlen (src);
  D.22127 = (long int) D.22126;
  orig = monoeg_g_utf8_to_utf16 (src, D.22127, 0B, 0B, 0B);
  D.22128 = (sizetype) targetlen;
  D.22112 = (sizetype) tail_len;
  D.22129 = D.22128 - D.22112;
  D.22130 = target + D.22129;
  strcpy (D.22130, extension);
  D.22131 = strlen (target);
  D.22132 = (long int) D.22131;
  dest = monoeg_g_utf8_to_utf16 (target, D.22132, 0B, 0B, 0B);
  DeleteFile (dest);
  copy_result = CopyFile (orig, dest, 0);
  if (copy_result != 0) goto <D.22133>; else goto <D.22134>;
  <D.22133>:
  copy_result = SetFileAttributes (dest, 128);
  <D.22134>:
  monoeg_g_free (orig);
  monoeg_g_free (dest);
  D.22121 = copy_result;
  return D.22121;
}


shadow_copy_create_ini (const char * shadow, const char * filename)
{
  int D.22136;
  gboolean D.22139;
  long unsigned int D.22140;
  long int D.22141;
  long unsigned int D.22146;
  unsigned int D.22147;
  char * dir_name;
  char * ini_file;
  guint16 * u16_ini;
  gboolean result;
  guint32 n;
  void * * handle;
  gchar * full_path;

  try
    {
      dir_name = monoeg_g_path_get_dirname (shadow);
      ini_file = monoeg_g_build_path ("/", dir_name, "__AssemblyInfo__.ini", 0B);
      monoeg_g_free (dir_name);
      D.22136 = monoeg_g_file_test (ini_file, 1);
      if (D.22136 != 0) goto <D.22137>; else goto <D.22138>;
      <D.22137>:
      monoeg_g_free (ini_file);
      D.22139 = 1;
      return D.22139;
      <D.22138>:
      D.22140 = strlen (ini_file);
      D.22141 = (long int) D.22140;
      u16_ini = monoeg_g_utf8_to_utf16 (ini_file, D.22141, 0B, 0B, 0B);
      monoeg_g_free (ini_file);
      if (u16_ini == 0B) goto <D.22142>; else goto <D.22143>;
      <D.22142>:
      D.22139 = 0;
      return D.22139;
      <D.22143>:
      handle = CreateFile (u16_ini, 1073741824, 3, 0B, 1, 128, 0B);
      monoeg_g_free (u16_ini);
      if (handle == -1B) goto <D.22144>; else goto <D.22145>;
      <D.22144>:
      D.22139 = 0;
      return D.22139;
      <D.22145>:
      full_path = mono_path_resolve_symlinks (filename);
      D.22146 = strlen (full_path);
      D.22147 = (unsigned int) D.22146;
      result = WriteFile (handle, full_path, D.22147, &n, 0B);
      monoeg_g_free (full_path);
      CloseHandle (handle);
      D.22139 = result;
      return D.22139;
    }
  finally
    {
      n = {CLOBBER};
    }
}


mono_domain_from_appdomain (struct MonoAppDomain * appdomain)
{
  struct MonoDomain * D.22152;

  if (appdomain == 0B) goto <D.22150>; else goto <D.22151>;
  <D.22150>:
  D.22152 = 0B;
  return D.22152;
  <D.22151>:
  D.22152 = appdomain->data;
  return D.22152;
}


ves_icall_System_Reflection_Assembly_LoadFrom (struct MonoString * fname, MonoBoolean refOnly)
{
  int D.22156;
  <unnamed type> status.44;
  struct MonoReflectionAssembly * D.22163;
  struct MonoDomain * domain;
  char * name;
  char * filename;
  MonoImageOpenStatus status;
  struct MonoAssembly * ass;

  try
    {
      domain = mono_domain_get ();
      status = 0;
      if (fname == 0B) goto <D.22154>; else goto <D.22155>;
      <D.22154>:
      {
        struct MonoException * exc;

        exc = mono_get_exception_argument_null ("assemblyFile");
        mono_raise_exception (exc);
      }
      <D.22155>:
      filename = mono_string_to_utf8 (fname);
      name = filename;
      D.22156 = (int) refOnly;
      ass = mono_assembly_open_full (filename, &status, D.22156);
      if (ass == 0B) goto <D.22157>; else goto <D.22158>;
      <D.22157>:
      {
        struct MonoException * exc;

        status.44 = status;
        if (status.44 == 3) goto <D.22160>; else goto <D.22161>;
        <D.22160>:
        exc = mono_get_exception_bad_image_format2 (0B, fname);
        goto <D.22162>;
        <D.22161>:
        exc = mono_get_exception_file_not_found2 (0B, fname);
        <D.22162>:
        monoeg_g_free (name);
        mono_raise_exception (exc);
      }
      <D.22158>:
      monoeg_g_free (name);
      D.22163 = mono_assembly_get_object (domain, ass);
      return D.22163;
    }
  finally
    {
      status = {CLOBBER};
    }
}


ves_icall_System_AppDomain_LoadAssemblyRaw (struct MonoAppDomain * ad, struct MonoArray * raw_assembly, struct MonoArray * raw_symbol_store, struct MonoObject * evidence, MonoBoolean refonly)
{
  long unsigned int D.22166;
  char * D.22167;
  int D.22168;
  struct MonoException * D.22171;
  struct MonoReflectionAssembly * D.22172;
  char * D.22175;
  long unsigned int D.22176;
  int D.22177;
  struct MonoException * D.22180;
  struct MonoObject * * D.22181;
  struct MonoAssembly * ass;
  struct MonoReflectionAssembly * refass;
  struct MonoDomain * domain;
  MonoImageOpenStatus status;
  guint32 raw_assembly_len;
  struct MonoImage * image;

  try
    {
      refass = 0B;
      domain = ad->data;
      D.22166 = mono_array_length (raw_assembly);
      raw_assembly_len = (guint32) D.22166;
      D.22167 = mono_array_addr_with_size (raw_assembly, 1, 0);
      D.22168 = (int) refonly;
      image = mono_image_open_from_data_full (D.22167, raw_assembly_len, 1, 0B, D.22168);
      if (image == 0B) goto <D.22169>; else goto <D.22170>;
      <D.22169>:
      D.22171 = mono_get_exception_bad_image_format ("");
      mono_raise_exception (D.22171);
      D.22172 = 0B;
      return D.22172;
      <D.22170>:
      if (raw_symbol_store != 0B) goto <D.22173>; else goto <D.22174>;
      <D.22173>:
      D.22175 = mono_array_addr_with_size (raw_symbol_store, 1, 0);
      D.22176 = mono_array_length (raw_symbol_store);
      D.22177 = (int) D.22176;
      mono_debug_open_image_from_memory (image, D.22175, D.22177);
      <D.22174>:
      D.22168 = (int) refonly;
      ass = mono_assembly_load_from_full (image, "", &status, D.22168);
      if (ass == 0B) goto <D.22178>; else goto <D.22179>;
      <D.22178>:
      mono_image_close (image);
      D.22180 = mono_get_exception_bad_image_format ("");
      mono_raise_exception (D.22180);
      D.22172 = 0B;
      return D.22172;
      <D.22179>:
      refass = mono_assembly_get_object (domain, ass);
      D.22181 = &refass->evidence;
      mono_gc_wbarrier_set_field (refass, D.22181, evidence);
      D.22172 = refass;
      return D.22172;
    }
  finally
    {
      status = {CLOBBER};
    }
}


ves_icall_System_AppDomain_LoadAssembly (struct MonoAppDomain * ad, struct MonoString * assRef, struct MonoObject * evidence, MonoBoolean refOnly)
{
  _Bool D.22184;
  long int D.22185;
  long int D.22186;
  int D.22193;
  struct MonoReflectionAssembly * D.22194;
  struct MonoObject * * D.22204;
  struct MonoDomain * domain;
  MonoImageOpenStatus status;
  struct MonoAssembly * ass;
  struct MonoAssemblyName aname;
  struct MonoReflectionAssembly * refass;
  gchar * name;
  gboolean parsed;

  try
    {
      domain = ad->data;
      status = 0;
      refass = 0B;
      D.22184 = assRef == 0B;
      D.22185 = (long int) D.22184;
      D.22186 = __builtin_expect (D.22185, 0);
      if (D.22186 != 0) goto <D.22187>; else goto <D.22188>;
      <D.22187>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1951, "assRef != NULL");
      <D.22188>:
      name = mono_string_to_utf8 (assRef);
      parsed = mono_assembly_name_parse (name, &aname);
      monoeg_g_free (name);
      if (parsed == 0) goto <D.22189>; else goto <D.22190>;
      <D.22189>:
      if (refOnly == 0) goto <D.22191>; else goto <D.22192>;
      <D.22191>:
      D.22193 = (int) refOnly;
      refass = mono_try_assembly_resolve (domain, assRef, D.22193);
      <D.22192>:
      D.22194 = refass;
      return D.22194;
      <D.22190>:
      D.22193 = (int) refOnly;
      ass = mono_assembly_load_full_nosearch (&aname, 0B, &status, D.22193);
      mono_assembly_name_free (&aname);
      if (ass == 0B) goto <D.22195>; else goto <D.22196>;
      <D.22195>:
      if (refOnly == 0) goto <D.22197>; else goto <D.22198>;
      <D.22197>:
      D.22193 = (int) refOnly;
      refass = mono_try_assembly_resolve (domain, assRef, D.22193);
      goto <D.22199>;
      <D.22198>:
      refass = 0B;
      <D.22199>:
      if (refass == 0B) goto <D.22200>; else goto <D.22201>;
      <D.22200>:
      D.22194 = 0B;
      return D.22194;
      <D.22201>:
      <D.22196>:
      if (refass == 0B) goto <D.22202>; else goto <D.22203>;
      <D.22202>:
      refass = mono_assembly_get_object (domain, ass);
      <D.22203>:
      D.22204 = &refass->evidence;
      mono_gc_wbarrier_set_field (refass, D.22204, evidence);
      D.22194 = refass;
      return D.22194;
    }
  finally
    {
      status = {CLOBBER};
      aname = {CLOBBER};
    }
}


ves_icall_System_AppDomain_InternalUnload (gint32 domain_id)
{
  struct MonoDomain * D.22209;
  struct MonoException * D.22212;
  const gchar * D.22213;
  struct MonoDomain * domain;

  domain = mono_domain_get_by_id (domain_id);
  if (domain == 0B) goto <D.22207>; else goto <D.22208>;
  <D.22207>:
  {
    struct MonoException * exc;

    exc = mono_get_exception_execution_engine ("Failed to unload domain, domain id not found");
    mono_raise_exception (exc);
  }
  <D.22208>:
  D.22209 = mono_get_root_domain ();
  if (D.22209 == domain) goto <D.22210>; else goto <D.22211>;
  <D.22210>:
  D.22212 = mono_get_exception_cannot_unload_appdomain ("The default appdomain can not be unloaded.");
  mono_raise_exception (D.22212);
  return;
  <D.22211>:
  D.22213 = monoeg_g_getenv ("MONO_NO_UNLOAD");
  if (D.22213 != 0B) goto <D.22214>; else goto <D.22215>;
  <D.22214>:
  return;
  <D.22215>:
  mono_domain_unload (domain);
}


ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id)
{
  gboolean D.22219;
  struct MonoDomain * domain;

  domain = mono_domain_get_by_id (domain_id);
  if (domain == 0B) goto <D.22217>; else goto <D.22218>;
  <D.22217>:
  D.22219 = 1;
  return D.22219;
  <D.22218>:
  D.22219 = mono_domain_is_unloading (domain);
  return D.22219;
}


ves_icall_System_AppDomain_ExecuteAssembly (struct MonoAppDomain * ad, struct MonoReflectionAssembly * refass, struct MonoArray * args)
{
  _Bool D.22221;
  long int D.22222;
  long int D.22223;
  struct MonoAssembly * D.22226;
  _Bool D.22227;
  long int D.22228;
  long int D.22229;
  unsigned int D.22232;
  char * D.22235;
  struct MonoDomain * D.22238;
  struct MonoClass * D.22239;
  gint32 D.22240;
  struct MonoImage * image;
  struct MonoMethod * method;

  D.22221 = refass == 0B;
  D.22222 = (long int) D.22221;
  D.22223 = __builtin_expect (D.22222, 0);
  if (D.22223 != 0) goto <D.22224>; else goto <D.22225>;
  <D.22224>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2035, "refass");
  <D.22225>:
  D.22226 = refass->assembly;
  image = D.22226->image;
  D.22227 = image == 0B;
  D.22228 = (long int) D.22227;
  D.22229 = __builtin_expect (D.22228, 0);
  if (D.22229 != 0) goto <D.22230>; else goto <D.22231>;
  <D.22230>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2037, "image");
  <D.22231>:
  D.22232 = mono_image_get_entry_point (image);
  method = mono_get_method (image, D.22232, 0B);
  if (method == 0B) goto <D.22233>; else goto <D.22234>;
  <D.22233>:
  D.22235 = image->name;
  monoeg_g_log (0B, 4, "No entry point method found in %s", D.22235);
  <D.20432>:
  goto <D.20432>;
  <D.22234>:
  if (args == 0B) goto <D.22236>; else goto <D.22237>;
  <D.22236>:
  D.22238 = ad->data;
  D.22239 = mono_defaults.string_class;
  args = mono_array_new (D.22238, D.22239, 0);
  <D.22237>:
  D.22240 = mono_runtime_exec_main (method, args, 0B);
  return D.22240;
}


ves_icall_System_AppDomain_GetIDFromDomain (struct MonoAppDomain * ad)
{
  gint32 D.22242;
  struct MonoDomain * D.22243;

  D.22243 = ad->data;
  D.22242 = D.22243->domain_id;
  return D.22242;
}


ves_icall_System_AppDomain_InternalSetDomain (struct MonoAppDomain * ad)
{
  struct MonoDomain * D.22245;
  int D.22246;
  struct MonoException * D.22249;
  struct MonoAppDomain * D.22250;
  struct MonoDomain * old_domain;

  old_domain = mono_domain_get ();
  D.22245 = ad->data;
  D.22246 = mono_domain_set (D.22245, 0);
  if (D.22246 == 0) goto <D.22247>; else goto <D.22248>;
  <D.22247>:
  D.22249 = mono_get_exception_appdomain_unloaded ();
  mono_raise_exception (D.22249);
  <D.22248>:
  D.22250 = old_domain->domain;
  return D.22250;
}


ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid)
{
  int D.22255;
  struct MonoException * D.22256;
  struct MonoAppDomain * D.22257;
  struct MonoDomain * current_domain;
  struct MonoDomain * domain;

  current_domain = mono_domain_get ();
  domain = mono_domain_get_by_id (domainid);
  if (domain == 0B) goto <D.22252>; else goto <D.22254>;
  <D.22254>:
  D.22255 = mono_domain_set (domain, 0);
  if (D.22255 == 0) goto <D.22252>; else goto <D.22253>;
  <D.22252>:
  D.22256 = mono_get_exception_appdomain_unloaded ();
  mono_raise_exception (D.22256);
  <D.22253>:
  D.22257 = current_domain->domain;
  return D.22257;
}


ves_icall_System_AppDomain_InternalPushDomainRef (struct MonoAppDomain * ad)
{
  struct MonoDomain * D.22259;

  D.22259 = ad->data;
  mono_thread_push_appdomain_ref (D.22259);
}


ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id)
{
  struct MonoException * D.22262;
  struct MonoDomain * domain;

  domain = mono_domain_get_by_id (domain_id);
  if (domain == 0B) goto <D.22260>; else goto <D.22261>;
  <D.22260>:
  D.22262 = mono_get_exception_appdomain_unloaded ();
  mono_raise_exception (D.22262);
  <D.22261>:
  mono_thread_push_appdomain_ref (domain);
}


ves_icall_System_AppDomain_InternalPopDomainRef ()
{
  mono_thread_pop_appdomain_ref ();
}


ves_icall_System_AppDomain_InternalGetContext ()
{
  struct MonoAppContext * D.22263;

  D.22263 = mono_context_get ();
  return D.22263;
}


ves_icall_System_AppDomain_InternalGetDefaultContext ()
{
  struct MonoAppContext * D.22265;
  struct MonoDomain * D.22266;

  D.22266 = mono_domain_get ();
  D.22265 = D.22266->default_context;
  return D.22265;
}


ves_icall_System_AppDomain_InternalSetContext (struct MonoAppContext * mc)
{
  struct MonoAppContext * D.22268;
  struct MonoAppContext * old_context;

  old_context = mono_context_get ();
  mono_context_set (mc);
  D.22268 = old_context;
  return D.22268;
}


ves_icall_System_AppDomain_InternalGetProcessGuid (struct MonoString * newguid)
{
  union mono_mutex_t * D.22270;
  _Bool D.22273;
  long int D.22274;
  long int D.22275;
  int process_guid_set.45;
  _Bool D.22283;
  long int D.22284;
  long int D.22285;
  struct MonoString * D.22288;
  struct MonoDomain * D.22289;
  mono_unichar2 * D.22290;
  _Bool D.22293;
  long int D.22294;
  long int D.22295;
  struct MonoDomain * mono_root_domain;

  mono_root_domain = mono_get_root_domain ();
  {
    int ret;

    D.22270 = &mono_root_domain->lock.mutex;
    ret = pthread_mutex_lock (D.22270);
    if (ret != 0) goto <D.22271>; else goto <D.22272>;
    <D.22271>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22272>:
    D.22273 = ret != 0;
    D.22274 = (long int) D.22273;
    D.22275 = __builtin_expect (D.22274, 0);
    if (D.22275 != 0) goto <D.22276>; else goto <D.22277>;
    <D.22276>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2150, "ret == 0");
    <D.22277>:
  }
  process_guid_set.45 = process_guid_set;
  if (process_guid_set.45 != 0) goto <D.22279>; else goto <D.22280>;
  <D.22279>:
  {
    int ret;

    D.22270 = &mono_root_domain->lock.mutex;
    ret = pthread_mutex_unlock (D.22270);
    if (ret != 0) goto <D.22281>; else goto <D.22282>;
    <D.22281>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22282>:
    D.22283 = ret != 0;
    D.22284 = (long int) D.22283;
    D.22285 = __builtin_expect (D.22284, 0);
    if (D.22285 != 0) goto <D.22286>; else goto <D.22287>;
    <D.22286>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2152, "ret == 0");
    <D.22287>:
  }
  D.22289 = mono_domain_get ();
  D.22288 = mono_string_new_utf16 (D.22289, &process_guid, 36);
  return D.22288;
  <D.22280>:
  D.22290 = mono_string_chars (newguid);
  memcpy (&process_guid, D.22290, 72);
  process_guid_set = 1;
  {
    int ret;

    D.22270 = &mono_root_domain->lock.mutex;
    ret = pthread_mutex_unlock (D.22270);
    if (ret != 0) goto <D.22291>; else goto <D.22292>;
    <D.22291>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22292>:
    D.22293 = ret != 0;
    D.22294 = (long int) D.22293;
    D.22295 = __builtin_expect (D.22294, 0);
    if (D.22295 != 0) goto <D.22296>; else goto <D.22297>;
    <D.22296>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2157, "ret == 0");
    <D.22297>:
  }
  D.22288 = newguid;
  return D.22288;
}


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

  D.22300 = __builtin_object_size (__dest, 0);
  D.22299 = __builtin___memcpy_chk (__dest, __src, __len, D.22300);
  return D.22299;
}


mono_domain_is_unloading (struct MonoDomain * domain)
{
  unsigned int D.22302;
  unsigned int D.22303;
  mono_bool D.22306;

  D.22302 = domain->state;
  D.22303 = D.22302 + 4294967294;
  if (D.22303 <= 1) goto <D.22304>; else goto <D.22305>;
  <D.22304>:
  D.22306 = 1;
  return D.22306;
  <D.22305>:
  D.22306 = 0;
  return D.22306;
}


mono_domain_unload (struct MonoDomain * domain)
{
  struct MonoObject * exc.46;
  struct MonoObject * exc;

  try
    {
      exc = 0B;
      mono_domain_try_unload (domain, &exc);
      exc.46 = exc;
      if (exc.46 != 0B) goto <D.22309>; else goto <D.22310>;
      <D.22309>:
      exc.46 = exc;
      mono_raise_exception (exc.46);
      <D.22310>:
    }
  finally
    {
      exc = {CLOBBER};
    }
}


mono_domain_try_unload (struct MonoDomain * domain, struct MonoObject * * exc)
{
  guint32 * D.22311;
  int D.22312;
  struct MonoException * D.22315;
  struct MonoException * D.22316;
  struct MonoAppDomain * D.22317;
  struct MonoVTable * D.22318;
  struct MonoClass * D.22319;
  _Bool D.22320;
  long int D.22321;
  long int D.22322;
  struct MonoObject * D.22325;
  struct MonoInternalThread * D.22330;
  int D.22331;
  int D.22334;
  int D.22337;
  unsigned int D.22339;
  char * D.22340;
  struct MonoException * D.22343;
  void * thread_handle;
  MonoAppDomainState prev_state;
  struct MonoMethod * method;
  struct unload_data * thread_data;
  struct MonoDomain * caller_domain;

  caller_domain = mono_domain_get ();
  D.22311 = &domain->state;
  D.22312 = InterlockedCompareExchange (D.22311, 1, 0);
  prev_state = (MonoAppDomainState) D.22312;
  if (prev_state != 0) goto <D.22313>; else goto <D.22314>;
  <D.22313>:
  switch (prev_state) <default: <D.20554>, case 1: <D.20551>, case 2: <D.20552>, case 3: <D.20553>>
  <D.20551>:
  <D.20552>:
  D.22315 = mono_get_exception_cannot_unload_appdomain ("Appdomain is already being unloaded.");
  *exc = D.22315;
  return;
  <D.20553>:
  D.22316 = mono_get_exception_cannot_unload_appdomain ("Appdomain is already unloaded.");
  *exc = D.22316;
  return;
  <D.20554>:
  monoeg_g_log (0B, 16, "Invalid appdomain state %d", prev_state);
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "appdomain.c", 2409);
  <D.22314>:
  mono_domain_set (domain, 0);
  D.22317 = domain->domain;
  D.22318 = D.22317->mbr.obj.vtable;
  D.22319 = D.22318->klass;
  method = mono_class_get_method_from_name (D.22319, "DoDomainUnload", -1);
  D.22320 = method == 0B;
  D.22321 = (long int) D.22320;
  D.22322 = __builtin_expect (D.22321, 0);
  if (D.22322 != 0) goto <D.22323>; else goto <D.22324>;
  <D.22323>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2416, "method");
  <D.22324>:
  D.22317 = domain->domain;
  mono_runtime_invoke (method, D.22317, 0B, exc);
  D.22325 = *exc;
  if (D.22325 != 0B) goto <D.22326>; else goto <D.22327>;
  <D.22326>:
  domain->state = 0;
  mono_domain_set (caller_domain, 0);
  return;
  <D.22327>:
  mono_domain_set (caller_domain, 0);
  thread_data = monoeg_malloc0 (32);
  thread_data->domain = domain;
  thread_data->failure_reason = 0B;
  thread_data->done = 0;
  thread_data->refcount = 2;
  domain->state = 2;
  thread_handle = mono_threads_create_thread (unload_thread_main, thread_data, 0, 4, 0B);
  if (thread_handle == 0B) goto <D.22328>; else goto <D.22329>;
  <D.22328>:
  return;
  <D.22329>:
  ResumeThread (thread_handle);
  goto <D.20556>;
  <D.20555>:
  D.22330 = mono_thread_internal_current ();
  D.22331 = mono_thread_internal_has_appdomain_ref (D.22330, domain);
  if (D.22331 != 0) goto <D.22332>; else goto <D.22333>;
  <D.22332>:
  D.22334 = mono_thread_interruption_requested ();
  if (D.22334 != 0) goto <D.22335>; else goto <D.22336>;
  <D.22335>:
  CloseHandle (thread_handle);
  unload_data_unref (thread_data);
  return;
  <D.22336>:
  <D.22333>:
  <D.20556>:
  D.22337 = thread_data->done;
  if (D.22337 == 0) goto <D.22338>; else goto <D.20557>;
  <D.22338>:
  D.22339 = WaitForSingleObjectEx (thread_handle, 4294967295, 1);
  if (D.22339 == 192) goto <D.20555>; else goto <D.20557>;
  <D.20557>:
  CloseHandle (thread_handle);
  D.22340 = thread_data->failure_reason;
  if (D.22340 != 0B) goto <D.22341>; else goto <D.22342>;
  <D.22341>:
  domain->state = 0;
  D.22340 = thread_data->failure_reason;
  monoeg_g_log (0B, 16, "%s", D.22340);
  D.22340 = thread_data->failure_reason;
  D.22343 = mono_get_exception_cannot_unload_appdomain (D.22340);
  *exc = D.22343;
  D.22340 = thread_data->failure_reason;
  monoeg_g_free (D.22340);
  thread_data->failure_reason = 0B;
  <D.22342>:
  unload_data_unref (thread_data);
}


unload_thread_main (void * arg)
{
  struct MonoDomain * D.22345;
  int D.22346;
  char * D.22349;
  gchar * D.22350;
  int D.22351;
  gchar * D.22354;
  int D.22355;
  gchar * D.22358;
  union mono_mutex_t * D.22359;
  _Bool D.22362;
  long int D.22363;
  long int D.22364;
  struct GPtrArray * D.22367;
  void * * D.22368;
  long unsigned int D.22369;
  long unsigned int D.22370;
  void * * D.22371;
  void * D.22372;
  unsigned int i.47;
  unsigned int D.22374;
  int D.22375;
  unsigned int D.22376;
  _Bool D.22379;
  long int D.22380;
  long int D.22381;
  int D.22384;
  guint32 D.22385;
  struct unload_data * data;
  struct MonoDomain * domain;
  struct MonoThread * thread;
  int i;
  void failure = <<< error >>>;

  data = arg;
  domain = data->domain;
  D.22345 = mono_get_root_domain ();
  thread = mono_thread_attach_full (D.22345, 1);
  D.22346 = mono_threads_abort_appdomain_threads (domain, -1);
  if (D.22346 == 0) goto <D.22347>; else goto <D.22348>;
  <D.22347>:
  D.22349 = domain->friendly_name;
  D.22350 = monoeg_g_strdup_printf ("Aborting of threads in domain %s timed out.", D.22349);
  data->failure_reason = D.22350;
  goto failure;
  <D.22348>:
  D.22351 = mono_thread_pool_remove_domain_jobs (domain, -1);
  if (D.22351 == 0) goto <D.22352>; else goto <D.22353>;
  <D.22352>:
  D.22349 = domain->friendly_name;
  D.22354 = monoeg_g_strdup_printf ("Cleanup of threadpool jobs of domain %s timed out.", D.22349);
  data->failure_reason = D.22354;
  goto failure;
  <D.22353>:
  D.22355 = mono_domain_finalize (domain, 4294967295);
  if (D.22355 == 0) goto <D.22356>; else goto <D.22357>;
  <D.22356>:
  D.22349 = domain->friendly_name;
  D.22358 = monoeg_g_strdup_printf ("Finalization of domain %s timed out.", D.22349);
  data->failure_reason = D.22358;
  goto failure;
  <D.22357>:
  mono_loader_lock ();
  {
    int ret;

    D.22359 = &domain->lock.mutex;
    ret = pthread_mutex_lock (D.22359);
    if (ret != 0) goto <D.22360>; else goto <D.22361>;
    <D.22360>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22361>:
    D.22362 = ret != 0;
    D.22363 = (long int) D.22362;
    D.22364 = __builtin_expect (D.22363, 0);
    if (D.22364 != 0) goto <D.22365>; else goto <D.22366>;
    <D.22365>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2299, "ret == 0");
    <D.22366>:
  }
  i = 0;
  goto <D.20532>;
  <D.20531>:
  D.22367 = domain->class_vtable_array;
  D.22368 = D.22367->pdata;
  D.22369 = (long unsigned int) i;
  D.22370 = D.22369 * 8;
  D.22371 = D.22368 + D.22370;
  D.22372 = *D.22371;
  zero_static_data (D.22372);
  i = i + 1;
  <D.20532>:
  i.47 = (unsigned int) i;
  D.22367 = domain->class_vtable_array;
  D.22374 = D.22367->len;
  if (i.47 < D.22374) goto <D.20531>; else goto <D.20533>;
  <D.20533>:
  mono_gc_collect (0);
  i = 0;
  goto <D.20535>;
  <D.20534>:
  D.22367 = domain->class_vtable_array;
  D.22368 = D.22367->pdata;
  D.22369 = (long unsigned int) i;
  D.22370 = D.22369 * 8;
  D.22371 = D.22368 + D.22370;
  D.22372 = *D.22371;
  clear_cached_vtable (D.22372);
  i = i + 1;
  <D.20535>:
  i.47 = (unsigned int) i;
  D.22367 = domain->class_vtable_array;
  D.22374 = D.22367->len;
  if (i.47 < D.22374) goto <D.20534>; else goto <D.20536>;
  <D.20536>:
  deregister_reflection_info_roots (domain);
  D.22375 = domain->domain_id;
  D.22376 = (unsigned int) D.22375;
  mono_assembly_cleanup_domain_bindings (D.22376);
  {
    int ret;

    D.22359 = &domain->lock.mutex;
    ret = pthread_mutex_unlock (D.22359);
    if (ret != 0) goto <D.22377>; else goto <D.22378>;
    <D.22377>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22378>:
    D.22379 = ret != 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", "appdomain.c", 2320, "ret == 0");
    <D.22383>:
  }
  mono_loader_unlock ();
  mono_threads_clear_cached_culture (domain);
  domain->state = 3;
  mono_gchandle_free_domain (domain);
  mono_domain_free (domain, 0);
  D.22384 = mono_gc_max_generation ();
  mono_gc_collect (D.22384);
  mono_memory_barrier ();
  data->done = 1;
  unload_data_unref (data);
  mono_thread_detach (thread);
  D.22385 = 0;
  return D.22385;
  failure:
  mono_memory_barrier ();
  data->done = 1;
  unload_data_unref (data);
  mono_thread_detach (thread);
  D.22385 = 1;
  return D.22385;
}


zero_static_data (struct MonoVTable * vtable)
{
  long unsigned int D.22387;
  long unsigned int D.22388;
  int D.22393;
  long unsigned int D.22394;
  struct MonoClass * klass;
  void * data;

  klass = vtable->klass;
  D.22387 = BIT_FIELD_REF <*klass, 64, 256>;
  D.22388 = D.22387 & 268435456;
  if (D.22388 != 0) goto <D.22389>; else goto <D.22390>;
  <D.22389>:
  data = mono_vtable_get_static_field_data (vtable);
  if (data != 0B) goto <D.22391>; else goto <D.22392>;
  <D.22391>:
  D.22393 = mono_class_data_size (klass);
  D.22394 = (long unsigned int) D.22393;
  mono_gc_bzero_aligned (data, D.22394);
  <D.22392>:
  <D.22390>:
}


clear_cached_vtable (struct MonoVTable * vtable)
{
  short unsigned int D.22397;
  int D.22398;
  int D.22399;
  long unsigned int D.22402;
  long unsigned int D.22403;
  struct MonoClass * klass;
  struct MonoDomain * domain;
  struct MonoClassRuntimeInfo * runtime_info;
  void * data;

  klass = vtable->klass;
  domain = vtable->domain;
  runtime_info = klass->runtime_info;
  if (runtime_info != 0B) goto <D.22395>; else goto <D.22396>;
  <D.22395>:
  D.22397 = runtime_info->max_domain;
  D.22398 = (int) D.22397;
  D.22399 = domain->domain_id;
  if (D.22398 >= D.22399) goto <D.22400>; else goto <D.22401>;
  <D.22400>:
  D.22399 = domain->domain_id;
  runtime_info->domain_vtables[D.22399] = 0B;
  <D.22401>:
  <D.22396>:
  D.22402 = BIT_FIELD_REF <*klass, 64, 256>;
  D.22403 = D.22402 & 268435456;
  if (D.22403 != 0) goto <D.22404>; else goto <D.22405>;
  <D.22404>:
  data = mono_vtable_get_static_field_data (vtable);
  if (data != 0B) goto <D.22406>; else goto <D.22407>;
  <D.22406>:
  mono_gc_free_fixed (data);
  <D.22407>:
  <D.22405>:
}


deregister_reflection_info_roots (struct MonoDomain * domain)
{
  union mono_mutex_t * D.22408;
  _Bool D.22411;
  long int D.22412;
  long int D.22413;
  long unsigned int D.22416;
  long unsigned int D.22417;
  struct MonoImage * * D.22420;
  long unsigned int D.22421;
  long unsigned int D.22422;
  struct MonoImage * * D.22423;
  long unsigned int D.22426;
  long unsigned int D.22427;
  unsigned int i.48;
  unsigned int D.22431;
  _Bool D.22434;
  long int D.22435;
  long int D.22436;
  struct GSList * list;

  {
    int ret;

    D.22408 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_lock (D.22408);
    if (ret != 0) goto <D.22409>; else goto <D.22410>;
    <D.22409>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.22410>:
    D.22411 = ret != 0;
    D.22412 = (long int) D.22411;
    D.22413 = __builtin_expect (D.22412, 0);
    if (D.22413 != 0) goto <D.22414>; else goto <D.22415>;
    <D.22414>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2237, "ret == 0");
    <D.22415>:
  }
  list = domain->domain_assemblies;
  goto <D.20519>;
  <D.20518>:
  {
    struct MonoAssembly * assembly;
    struct MonoImage * image;
    int i;

    assembly = list->data;
    image = assembly->image;
    D.22416 = BIT_FIELD_REF <*image, 64, 192>;
    D.22417 = D.22416 & 34359738368;
    if (D.22417 != 0) goto <D.22418>; else goto <D.22419>;
    <D.22418>:
    deregister_reflection_info_roots_from_list (image);
    <D.22419>:
    i = 0;
    goto <D.20516>;
    <D.20515>:
    {
      struct MonoImage * module;

      D.22420 = image->modules;
      D.22421 = (long unsigned int) i;
      D.22422 = D.22421 * 8;
      D.22423 = D.22420 + D.22422;
      module = *D.22423;
      if (module != 0B) goto <D.22424>; else goto <D.22425>;
      <D.22424>:
      D.22426 = BIT_FIELD_REF <*module, 64, 192>;
      D.22427 = D.22426 & 34359738368;
      if (D.22427 != 0) goto <D.22428>; else goto <D.22429>;
      <D.22428>:
      deregister_reflection_info_roots_from_list (module);
      <D.22429>:
      <D.22425>:
    }
    i = i + 1;
    <D.20516>:
    i.48 = (unsigned int) i;
    D.22431 = image->module_count;
    if (i.48 < D.22431) goto <D.20515>; else goto <D.20517>;
    <D.20517>:
  }
  list = list->next;
  <D.20519>:
  if (list != 0B) goto <D.20518>; else goto <D.20520>;
  <D.20520>:
  {
    int ret;

    D.22408 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.22408);
    if (ret != 0) goto <D.22432>; else goto <D.22433>;
    <D.22432>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.22433>:
    D.22434 = ret != 0;
    D.22435 = (long int) D.22434;
    D.22436 = __builtin_expect (D.22435, 0);
    if (D.22436 != 0) goto <D.22437>; else goto <D.22438>;
    <D.22437>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2258, "ret == 0");
    <D.22438>:
  }
}


deregister_reflection_info_roots_from_list (struct MonoImage * image)
{
  struct GSList * list;

  list = image->reflection_info_unregister_classes;
  goto <D.20504>;
  <D.20503>:
  {
    struct MonoClass * class;

    class = list->data;
    mono_class_free_ref_info (class);
    list = list->next;
  }
  <D.20504>:
  if (list != 0B) goto <D.20503>; else goto <D.20505>;
  <D.20505>:
  image->reflection_info_unregister_classes = 0B;
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.22439;
  unsigned int comp.49;
  unsigned int exch.50;
  unsigned int D.22442;

  comp.49 = (unsigned int) comp;
  exch.50 = (unsigned int) exch;
  D.22442 = __sync_val_compare_and_swap_4 (dest, comp.49, exch.50);
  D.22439 = (gint32) D.22442;
  return D.22439;
}


unload_data_unref (struct unload_data * data)
{
  unsigned int count.51;
  unsigned int D.22445;
  _Bool D.22446;
  long int D.22447;
  long int D.22448;
  gint32 * D.22453;
  int D.22454;
  int D.22455;
  gint32 count;

  <D.20496>:
  {
    gint32 __tmp;

    __tmp = data->refcount;
    mono_memory_barrier ();
    count = __tmp;
  }
  count.51 = (unsigned int) count;
  D.22445 = count.51 + 4294967295;
  D.22446 = D.22445 > 1;
  D.22447 = (long int) D.22446;
  D.22448 = __builtin_expect (D.22447, 0);
  if (D.22448 != 0) goto <D.22449>; else goto <D.22450>;
  <D.22449>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2208, "count >= 1 && count <= 2");
  <D.22450>:
  if (count == 1) goto <D.22451>; else goto <D.22452>;
  <D.22451>:
  monoeg_g_free (data);
  return;
  <D.22452>:
  D.22453 = &data->refcount;
  D.22454 = count + -1;
  D.22455 = InterlockedCompareExchange (D.22453, count, D.22454);
  if (D.22455 != count) goto <D.20496>; else goto <D.20497>;
  <D.20497>:
}


