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


__attribute__((visibility ("hidden")))
mono_runtime_load (const char * filename, const char * runtime_version)
{
  struct MonoDomain * (*<T1d72>) (const char *, const char *) load_function.0;
  _Bool D.20008;
  long int D.20009;
  long int D.20010;
  struct MonoDomain * D.20013;

  load_function.0 = load_function;
  D.20008 = load_function.0 == 0B;
  D.20009 = (long int) D.20008;
  D.20010 = __builtin_expect (D.20009, 0);
  if (D.20010 != 0) goto <D.20011>; else goto <D.20012>;
  <D.20011>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 136, "load_function");
  <D.20012>:
  load_function.0 = load_function;
  D.20013 = load_function.0 (filename, runtime_version);
  return D.20013;
}


__attribute__((visibility ("hidden")))
mono_runtime_set_no_exec (gboolean val)
{
  no_exec = val;
}


__attribute__((visibility ("hidden")))
mono_runtime_get_no_exec ()
{
  gboolean D.20015;

  D.20015 = no_exec;
  return D.20015;
}


mono_runtime_init (struct MonoDomain * domain, void (*MonoThreadStartCB) (intptr_t, void *, void *) start_cb, void (*MonoThreadAttachCB) (intptr_t, void *) attach_cb)
{
  struct MonoImage * D.20017;
  struct MonoAppContext * D.20018;
  int D.20019;
  struct MonoAssembly * D.20022;
  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.20017 = mono_defaults.corlib;
  class = mono_class_from_name (D.20017, "System", "AppDomainSetup");
  setup = mono_object_new (domain, class);
  D.20017 = mono_defaults.corlib;
  class = mono_class_from_name (D.20017, "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.20018 = domain->default_context;
  mono_context_set (D.20018);
  mono_type_initialization_init ();
  D.20019 = mono_runtime_get_no_exec ();
  if (D.20019 == 0) goto <D.20020>; else goto <D.20021>;
  <D.20020>:
  create_domain_objects (domain);
  <D.20021>:
  mono_gc_init ();
  mono_network_init ();
  mono_console_init ();
  mono_attach_init ();
  D.20017 = mono_defaults.corlib;
  D.20022 = D.20017->assembly;
  mono_domain_fire_assembly_load (D.20022, 0B);
  return;
}


mono_domain_assembly_postload_search (struct MonoAssemblyName * aname, void * user_data)
{
  long int user_data.1;
  struct MonoAssembly * D.20027;
  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.20025>; else goto <D.20026>;
  <D.20025>:
  monoeg_g_free (aname_str);
  D.20027 = 0B;
  return D.20027;
  <D.20026>:
  assembly = mono_try_assembly_resolve (domain, str, refonly);
  monoeg_g_free (aname_str);
  if (assembly != 0B) goto <D.20028>; else goto <D.20029>;
  <D.20028>:
  D.20027 = assembly->assembly;
  return D.20027;
  <D.20029>:
  D.20027 = 0B;
  return D.20027;
}


mono_domain_assembly_search (struct MonoAssemblyName * aname, void * user_data)
{
  long int user_data.2;
  union mono_mutex_t * D.20032;
  _Bool D.20035;
  long int D.20036;
  long int D.20037;
  unsigned char D.20042;
  int D.20044;
  struct MonoAssemblyName * D.20046;
  int D.20047;
  _Bool D.20050;
  long int D.20051;
  long int D.20052;
  struct MonoAssembly * D.20055;
  _Bool D.20058;
  long int D.20059;
  long int D.20060;
  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.20032 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_lock (D.20032);
    if (ret != 0) goto <D.20033>; else goto <D.20034>;
    <D.20033>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20034>:
    D.20035 = ret != 0;
    D.20036 = (long int) D.20035;
    D.20037 = __builtin_expect (D.20036, 0);
    if (D.20037 != 0) goto <D.20038>; else goto <D.20039>;
    <D.20038>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1853, "ret == 0");
    <D.20039>:
  }
  tmp = domain->domain_assemblies;
  goto <D.19824>;
  <D.19823>:
  ass = tmp->data;
  D.20042 = ass->dynamic;
  if (D.20042 != 0) goto <D.20040>; else goto <D.20043>;
  <D.20043>:
  D.20044 = ass->ref_only;
  if (D.20044 != refonly) goto <D.20040>; else goto <D.20045>;
  <D.20045>:
  D.20046 = &ass->aname;
  D.20047 = mono_assembly_names_equal (aname, D.20046);
  if (D.20047 == 0) goto <D.20040>; else goto <D.20041>;
  <D.20040>:
  // predicted unlikely by continue predictor.
  goto <D.19821>;
  <D.20041>:
  {
    int ret;

    D.20032 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.20032);
    if (ret != 0) goto <D.20048>; else goto <D.20049>;
    <D.20048>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20049>:
    D.20050 = ret != 0;
    D.20051 = (long int) D.20050;
    D.20052 = __builtin_expect (D.20051, 0);
    if (D.20052 != 0) goto <D.20053>; else goto <D.20054>;
    <D.20053>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1860, "ret == 0");
    <D.20054>:
  }
  D.20055 = ass;
  return D.20055;
  <D.19821>:
  tmp = tmp->next;
  <D.19824>:
  if (tmp != 0B) goto <D.19823>; else goto <D.19825>;
  <D.19825>:
  {
    int ret;

    D.20032 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.20032);
    if (ret != 0) goto <D.20056>; else goto <D.20057>;
    <D.20056>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20057>:
    D.20058 = ret != 0;
    D.20059 = (long int) D.20058;
    D.20060 = __builtin_expect (D.20059, 0);
    if (D.20060 != 0) goto <D.20061>; else goto <D.20062>;
    <D.20061>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1863, "ret == 0");
    <D.20062>:
  }
  D.20055 = 0B;
  return D.20055;
}


mono_domain_assembly_preload (struct MonoAssemblyName * aname, gchar * * assemblies_path, void * user_data)
{
  long int user_data.3;
  gchar * * D.20065;
  gchar * D.20068;
  const char * D.20071;
  const char * D.20072;
  gchar * D.20077;
  struct MonoAssembly * D.20080;
  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.20065 = domain->search_path;
  if (D.20065 != 0B) goto <D.20066>; else goto <D.20067>;
  <D.20066>:
  D.20065 = domain->search_path;
  D.20068 = *D.20065;
  if (D.20068 != 0B) goto <D.20069>; else goto <D.20070>;
  <D.20069>:
  D.20065 = domain->search_path;
  D.20071 = aname->culture;
  D.20072 = aname->name;
  result = real_load (D.20065, D.20071, D.20072, refonly);
  <D.20070>:
  <D.20067>:
  if (result == 0B) goto <D.20073>; else goto <D.20074>;
  <D.20073>:
  if (assemblies_path != 0B) goto <D.20075>; else goto <D.20076>;
  <D.20075>:
  D.20077 = *assemblies_path;
  if (D.20077 != 0B) goto <D.20078>; else goto <D.20079>;
  <D.20078>:
  D.20071 = aname->culture;
  D.20072 = aname->name;
  result = real_load (assemblies_path, D.20071, D.20072, refonly);
  <D.20079>:
  <D.20076>:
  <D.20074>:
  D.20080 = result;
  return D.20080;
}


set_domain_search_path (struct MonoDomain * domain)
{
  union mono_mutex_t * D.20082;
  _Bool D.20085;
  long int D.20086;
  long int D.20087;
  struct MonoAppDomainSetup * D.20090;
  _Bool D.20095;
  long int D.20096;
  long int D.20097;
  gchar * * D.20100;
  unsigned char D.20103;
  _Bool D.20108;
  long int D.20109;
  long int D.20110;
  struct MonoString * D.20113;
  _Bool D.20118;
  long int D.20119;
  long int D.20120;
  struct MonoString * D.20123;
  int D.20126;
  _Bool D.20131;
  long int D.20132;
  long int D.20133;
  gchar * D.20136;
  long unsigned int D.20144;
  sizetype D.20145;
  gchar * D.20146;
  char D.20147;
  gchar * D.20150;
  _Bool D.20157;
  long int D.20158;
  long int D.20159;
  int D.20164;
  long unsigned int D.20165;
  long unsigned int D.20166;
  long unsigned int D.20167;
  long unsigned int D.20168;
  gchar * * D.20169;
  char * D.20170;
  int D.20171;
  _Bool D.20176;
  long int D.20177;
  long int D.20178;
  _Bool iftmp.4;
  long unsigned int D.20182;
  int D.20185;
  int D.20187;
  gchar * D.20190;
  char D.20191;
  gchar * D.20194;
  struct GError * gerror.5;
  gchar * D.20200;
  long unsigned int D.20202;
  long unsigned int D.20203;
  sizetype D.20204;
  gchar * * D.20205;
  gchar * D.20206;
  int D.20207;
  gchar * * D.20210;
  gchar * D.20211;
  gchar * D.20213;
  gchar * D.20214;
  char * D.20215;
  long unsigned int D.20220;
  long unsigned int D.20221;
  int D.20222;
  gchar * D.20225;
  struct MonoString * D.20227;
  gchar * D.20230;
  _Bool D.20233;
  long int D.20234;
  long int D.20235;
  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.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_lock (D.20082);
        if (ret != 0) goto <D.20083>; else goto <D.20084>;
        <D.20083>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20084>:
        D.20085 = ret != 0;
        D.20086 = (long int) D.20085;
        D.20087 = __builtin_expect (D.20086, 0);
        if (D.20087 != 0) goto <D.20088>; else goto <D.20089>;
        <D.20088>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1058, "ret == 0");
        <D.20089>:
      }
      D.20090 = domain->setup;
      if (D.20090 == 0B) goto <D.20091>; else goto <D.20092>;
      <D.20091>:
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20093>; else goto <D.20094>;
        <D.20093>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20094>:
        D.20095 = ret != 0;
        D.20096 = (long int) D.20095;
        D.20097 = __builtin_expect (D.20096, 0);
        if (D.20097 != 0) goto <D.20098>; else goto <D.20099>;
        <D.20098>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1061, "ret == 0");
        <D.20099>:
      }
      return;
      <D.20092>:
      D.20100 = domain->search_path;
      if (D.20100 != 0B) goto <D.20101>; else goto <D.20102>;
      <D.20101>:
      D.20090 = domain->setup;
      D.20103 = D.20090->path_changed;
      if (D.20103 == 0) goto <D.20104>; else goto <D.20105>;
      <D.20104>:
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20106>; else goto <D.20107>;
        <D.20106>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20107>:
        D.20108 = ret != 0;
        D.20109 = (long int) D.20108;
        D.20110 = __builtin_expect (D.20109, 0);
        if (D.20110 != 0) goto <D.20111>; else goto <D.20112>;
        <D.20111>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1066, "ret == 0");
        <D.20112>:
      }
      return;
      <D.20105>:
      <D.20102>:
      setup = domain->setup;
      D.20113 = setup->application_base;
      if (D.20113 == 0B) goto <D.20114>; else goto <D.20115>;
      <D.20114>:
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20116>; else goto <D.20117>;
        <D.20116>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20117>:
        D.20118 = ret != 0;
        D.20119 = (long int) D.20118;
        D.20120 = __builtin_expect (D.20119, 0);
        if (D.20120 != 0) goto <D.20121>; else goto <D.20122>;
        <D.20121>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1071, "ret == 0");
        <D.20122>:
      }
      return;
      <D.20115>:
      npaths = npaths + 1;
      D.20123 = setup->private_bin_path;
      if (D.20123 != 0B) goto <D.20124>; else goto <D.20125>;
      <D.20124>:
      D.20123 = setup->private_bin_path;
      search_path = mono_string_to_utf8_checked (D.20123, &error);
      D.20126 = mono_error_ok (&error);
      if (D.20126 == 0) goto <D.20127>; else goto <D.20128>;
      <D.20127>:
      monoeg_g_log (0B, 16, "Could not decode AppDomain search path since it contains invalid characters");
      mono_error_cleanup (&error);
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20129>; else goto <D.20130>;
        <D.20129>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20130>:
        D.20131 = ret != 0;
        D.20132 = (long int) D.20131;
        D.20133 = __builtin_expect (D.20132, 0);
        if (D.20133 != 0) goto <D.20134>; else goto <D.20135>;
        <D.20134>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1082, "ret == 0");
        <D.20135>:
      }
      return;
      <D.20128>:
      <D.20125>:
      D.20136 = domain->private_bin_path;
      if (D.20136 != 0B) goto <D.20137>; else goto <D.20138>;
      <D.20137>:
      if (search_path == 0B) goto <D.20139>; else goto <D.20140>;
      <D.20139>:
      search_path = domain->private_bin_path;
      goto <D.20141>;
      <D.20140>:
      {
        gchar * tmp2;

        tmp2 = search_path;
        D.20136 = domain->private_bin_path;
        search_path = monoeg_g_strjoin (";", search_path, D.20136, 0B);
        monoeg_g_free (tmp2);
      }
      <D.20141>:
      <D.20138>:
      if (search_path != 0B) goto <D.20142>; else goto <D.20143>;
      <D.20142>:
      {
        gint slen;

        D.20144 = __strlen_g (search_path);
        slen = (gint) D.20144;
        i = 0;
        goto <D.19641>;
        <D.19640>:
        D.20145 = (sizetype) i;
        D.20146 = search_path + D.20145;
        D.20147 = *D.20146;
        if (D.20147 == 58) goto <D.20148>; else goto <D.20149>;
        <D.20148>:
        D.20145 = (sizetype) i;
        D.20146 = search_path + D.20145;
        *D.20146 = 59;
        <D.20149>:
        i = i + 1;
        <D.19641>:
        if (i < slen) goto <D.19640>; else goto <D.19642>;
        <D.19642>:
        pvt_split = monoeg_g_strsplit (search_path, ";", 1000);
        monoeg_g_free (search_path);
        tmp = pvt_split;
        goto <D.19644>;
        <D.19643>:
        tmp = tmp + 8;
        npaths = npaths + 1;
        <D.19644>:
        D.20150 = *tmp;
        if (D.20150 != 0B) goto <D.19643>; else goto <D.19645>;
        <D.19645>:
      }
      <D.20143>:
      if (npaths == 0) goto <D.20151>; else goto <D.20152>;
      <D.20151>:
      if (pvt_split != 0B) goto <D.20153>; else goto <D.20154>;
      <D.20153>:
      monoeg_g_strfreev (pvt_split);
      <D.20154>:
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20155>; else goto <D.20156>;
        <D.20155>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20156>:
        D.20157 = ret != 0;
        D.20158 = (long int) D.20157;
        D.20159 = __builtin_expect (D.20158, 0);
        if (D.20159 != 0) goto <D.20160>; else goto <D.20161>;
        <D.20160>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1133, "ret == 0");
        <D.20161>:
      }
      return;
      <D.20152>:
      D.20100 = domain->search_path;
      if (D.20100 != 0B) goto <D.20162>; else goto <D.20163>;
      <D.20162>:
      D.20100 = domain->search_path;
      monoeg_g_strfreev (D.20100);
      <D.20163>:
      D.20164 = npaths + 1;
      D.20165 = (long unsigned int) D.20164;
      D.20166 = D.20165 * 8;
      tmp = monoeg_malloc (D.20166);
      D.20167 = (long unsigned int) npaths;
      D.20168 = D.20167 * 8;
      D.20169 = tmp + D.20168;
      *D.20169 = 0B;
      D.20113 = setup->application_base;
      D.20170 = mono_string_to_utf8_checked (D.20113, &error);
      *tmp = D.20170;
      D.20171 = mono_error_ok (&error);
      if (D.20171 == 0) goto <D.20172>; else goto <D.20173>;
      <D.20172>:
      mono_error_cleanup (&error);
      monoeg_g_strfreev (pvt_split);
      monoeg_g_free (tmp);
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20174>; else goto <D.20175>;
        <D.20174>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20175>:
        D.20176 = ret != 0;
        D.20177 = (long int) D.20176;
        D.20178 = __builtin_expect (D.20177, 0);
        if (D.20178 != 0) goto <D.20179>; else goto <D.20180>;
        <D.20179>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1149, "ret == 0");
        <D.20180>:
      }
      return;
      <D.20173>:
      domain->search_path = tmp;
      D.20182 = __strlen_g ("file://");
      if (D.20182 <= 6) goto <D.20183>; else goto <D.20184>;
      <D.20183>:
      D.20150 = *tmp;
      D.20185 = strcmp (D.20150, "file://");
      iftmp.4 = D.20185 == 0;
      goto <D.20186>;
      <D.20184>:
      D.20150 = *tmp;
      D.20187 = strncmp (D.20150, "file://", 7);
      iftmp.4 = D.20187 == 0;
      <D.20186>:
      if (iftmp.4 != 0) goto <D.20188>; else goto <D.20189>;
      <D.20188>:
      {
        gchar * file;
        gchar * uri;
        gchar * tmpuri;

        file = *tmp;
        uri = *tmp;
        D.20190 = uri + 7;
        D.20191 = *D.20190;
        if (D.20191 != 47) goto <D.20192>; else goto <D.20193>;
        <D.20192>:
        D.20190 = uri + 7;
        uri = monoeg_g_strdup_printf ("file:///%s", D.20190);
        <D.20193>:
        tmpuri = uri;
        uri = mono_escape_uri_string (tmpuri);
        D.20194 = monoeg_g_filename_from_uri (uri, 0B, &gerror);
        *tmp = D.20194;
        monoeg_g_free (uri);
        if (tmpuri != file) goto <D.20195>; else goto <D.20196>;
        <D.20195>:
        monoeg_g_free (tmpuri);
        <D.20196>:
        gerror.5 = gerror;
        if (gerror.5 != 0B) goto <D.20198>; else goto <D.20199>;
        <D.20198>:
        gerror.5 = gerror;
        D.20200 = gerror.5->message;
        monoeg_g_log (0B, 16, "%s\n", D.20200);
        gerror.5 = gerror;
        monoeg_g_error_free (gerror.5);
        *tmp = file;
        goto <D.20201>;
        <D.20199>:
        monoeg_g_free (file);
        <D.20201>:
      }
      <D.20189>:
      i = 1;
      goto <D.19655>;
      <D.19654>:
      D.20202 = (long unsigned int) i;
      D.20203 = D.20202 * 8;
      D.20204 = D.20203 + 18446744073709551608;
      D.20205 = pvt_split + D.20204;
      D.20206 = *D.20205;
      D.20207 = monoeg_g_path_is_absolute (D.20206);
      if (D.20207 != 0) goto <D.20208>; else goto <D.20209>;
      <D.20208>:
      D.20202 = (long unsigned int) i;
      D.20203 = D.20202 * 8;
      D.20210 = tmp + D.20203;
      D.20202 = (long unsigned int) i;
      D.20203 = D.20202 * 8;
      D.20204 = D.20203 + 18446744073709551608;
      D.20205 = pvt_split + D.20204;
      D.20206 = *D.20205;
      D.20211 = monoeg_strdup (D.20206);
      *D.20210 = D.20211;
      goto <D.20212>;
      <D.20209>:
      D.20202 = (long unsigned int) i;
      D.20203 = D.20202 * 8;
      D.20210 = tmp + D.20203;
      D.20150 = *tmp;
      D.20202 = (long unsigned int) i;
      D.20203 = D.20202 * 8;
      D.20204 = D.20203 + 18446744073709551608;
      D.20205 = pvt_split + D.20204;
      D.20206 = *D.20205;
      D.20213 = monoeg_g_build_path ("/", D.20150, D.20206, 0B);
      *D.20210 = D.20213;
      <D.20212>:
      D.20202 = (long unsigned int) i;
      D.20203 = D.20202 * 8;
      D.20210 = tmp + D.20203;
      D.20214 = *D.20210;
      D.20215 = __builtin_strchr (D.20214, 46);
      if (D.20215 != 0B) goto <D.20216>; else goto <D.20217>;
      <D.20216>:
      {
        gchar * reduced;
        gchar * freeme;

        D.20202 = (long unsigned int) i;
        D.20203 = D.20202 * 8;
        D.20210 = tmp + D.20203;
        D.20214 = *D.20210;
        reduced = mono_path_canonicalize (D.20214);
        if (appbaselen == -1) goto <D.20218>; else goto <D.20219>;
        <D.20218>:
        D.20150 = *tmp;
        D.20220 = __strlen_g (D.20150);
        appbaselen = (gint) D.20220;
        <D.20219>:
        D.20150 = *tmp;
        D.20221 = (long unsigned int) appbaselen;
        D.20222 = strncmp (D.20150, reduced, D.20221);
        if (D.20222 != 0) goto <D.20223>; else goto <D.20224>;
        <D.20223>:
        monoeg_g_free (reduced);
        D.20202 = (long unsigned int) i;
        D.20203 = D.20202 * 8;
        D.20210 = tmp + D.20203;
        D.20214 = *D.20210;
        monoeg_g_free (D.20214);
        D.20202 = (long unsigned int) i;
        D.20203 = D.20202 * 8;
        D.20210 = tmp + D.20203;
        D.20225 = monoeg_strdup ("");
        *D.20210 = D.20225;
        // predicted unlikely by continue predictor.
        goto <D.19653>;
        <D.20224>:
        D.20202 = (long unsigned int) i;
        D.20203 = D.20202 * 8;
        D.20210 = tmp + D.20203;
        freeme = *D.20210;
        D.20202 = (long unsigned int) i;
        D.20203 = D.20202 * 8;
        D.20210 = tmp + D.20203;
        *D.20210 = reduced;
        monoeg_g_free (freeme);
      }
      <D.20217>:
      <D.19653>:
      i = i + 1;
      <D.19655>:
      if (pvt_split != 0B) goto <D.20226>; else goto <D.19656>;
      <D.20226>:
      if (i < npaths) goto <D.19654>; else goto <D.19656>;
      <D.19656>:
      D.20227 = setup->private_bin_path_probe;
      if (D.20227 != 0B) goto <D.20228>; else goto <D.20229>;
      <D.20228>:
      D.20150 = *tmp;
      monoeg_g_free (D.20150);
      D.20230 = monoeg_strdup ("");
      *tmp = D.20230;
      <D.20229>:
      D.20090 = domain->setup;
      D.20090->path_changed = 0;
      monoeg_g_strfreev (pvt_split);
      {
        int ret;

        D.20082 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20082);
        if (ret != 0) goto <D.20231>; else goto <D.20232>;
        <D.20231>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20232>:
        D.20233 = ret != 0;
        D.20234 = (long int) D.20233;
        D.20235 = __builtin_expect (D.20234, 0);
        if (D.20235 != 0) goto <D.20236>; else goto <D.20237>;
        <D.20236>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1218, "ret == 0");
        <D.20237>:
      }
    }
  finally
    {
      error = {CLOBBER};
      gerror = {CLOBBER};
    }
}


__attribute__((__gnu_inline__, nothrow, leaf, pure))
strcmp (const char * __s1, const char * __s2)
{
  int iftmp.6;
  int iftmp.7;
  int D.20249;
  char * __p1;
  char * __p2;
  int __ret;

  __p1 = __s1;
  __p2 = __s2;
  __asm__ __volatile__("   slr   0,0
0: clst  %1,%2
   jo    0b
   ipm   %0
   srl   %0,28" : "=d" __ret, "=&a" __p1, "=&a" __p2 : "1" __p1, "2" __p2 : "0", "memory", "cc");
  if (__ret != 0) goto <D.20242>; else goto <D.20243>;
  <D.20242>:
  if (__ret == 1) goto <D.20245>; else goto <D.20246>;
  <D.20245>:
  iftmp.7 = -1;
  goto <D.20247>;
  <D.20246>:
  iftmp.7 = 1;
  <D.20247>:
  iftmp.6 = iftmp.7;
  goto <D.20248>;
  <D.20243>:
  iftmp.6 = 0;
  <D.20248>:
  __ret = iftmp.6;
  D.20249 = __ret;
  return D.20249;
}


__attribute__((__gnu_inline__))
__strlen_g (const char * __str)
{
  size_t D.20251;
  long int __ptr.8;
  long int __str.9;
  long int D.20254;
  char * __ptr;
  char * __tmp;

  __ptr = 0B;
  __tmp = __str;
  __asm__ __volatile__("   la    0,0
0: srst  %0,%1
   jo    0b
" : "=&a" __ptr, "=&a" __tmp : "0" __ptr, "1" __tmp : "0", "memory", "cc");
  __ptr.8 = (long int) __ptr;
  __str.9 = (long int) __str;
  D.20254 = __ptr.8 - __str.9;
  D.20251 = (size_t) D.20254;
  return D.20251;
}


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

  if (str != 0B) goto <D.20256>; else goto <D.20257>;
  <D.20256>:
  D.20258 = __strdup (str);
  return D.20258;
  <D.20257>:
  D.20258 = 0B;
  return D.20258;
}


real_load (gchar * * search_path, const gchar * culture, const gchar * name, gboolean refonly)
{
  char D.20264;
  long unsigned int D.20265;
  gchar * D.20266;
  char D.20267;
  sizetype D.20270;
  sizetype D.20271;
  gchar * D.20272;
  int D.20273;
  int D.20275;
  int D.20277;
  int D.20279;
  struct MonoAssembly * D.20281;
  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.20260>; else goto <D.20263>;
      <D.20263>:
      D.20264 = *culture;
      if (D.20264 == 0) goto <D.20260>; else goto <D.20261>;
      <D.20260>:
      local_culture = "";
      goto <D.20262>;
      <D.20261>:
      local_culture = culture;
      <D.20262>:
      filename = monoeg_g_strconcat (name, ".dll", 0B);
      D.20265 = __strlen_g (filename);
      len = (gint) D.20265;
      path = search_path;
      goto <D.19803>;
      <D.19802>:
      D.20266 = *path;
      D.20267 = *D.20266;
      if (D.20267 == 0) goto <D.20268>; else goto <D.20269>;
      <D.20268>:
      is_private = 1;
      // predicted unlikely by continue predictor.
      goto <D.19800>;
      <D.20269>:
      D.20270 = (sizetype) len;
      D.20271 = D.20270 + 18446744073709551612;
      D.20272 = filename + D.20271;
      strcpy (D.20272, ".dll");
      D.20266 = *path;
      D.20273 = try_load_from (&result, D.20266, local_culture, "", filename, refonly, is_private);
      if (D.20273 != 0) goto <D.19801>; else goto <D.20274>;
      <D.20274>:
      D.20270 = (sizetype) len;
      D.20271 = D.20270 + 18446744073709551612;
      D.20272 = filename + D.20271;
      strcpy (D.20272, ".exe");
      D.20266 = *path;
      D.20275 = try_load_from (&result, D.20266, local_culture, "", filename, refonly, is_private);
      if (D.20275 != 0) goto <D.19801>; else goto <D.20276>;
      <D.20276>:
      D.20270 = (sizetype) len;
      D.20271 = D.20270 + 18446744073709551612;
      D.20272 = filename + D.20271;
      strcpy (D.20272, ".dll");
      D.20266 = *path;
      D.20277 = try_load_from (&result, D.20266, local_culture, name, filename, refonly, is_private);
      if (D.20277 != 0) goto <D.19801>; else goto <D.20278>;
      <D.20278>:
      D.20270 = (sizetype) len;
      D.20271 = D.20270 + 18446744073709551612;
      D.20272 = filename + D.20271;
      strcpy (D.20272, ".exe");
      D.20266 = *path;
      D.20279 = try_load_from (&result, D.20266, local_culture, name, filename, refonly, is_private);
      if (D.20279 != 0) goto <D.19801>; else goto <D.20280>;
      <D.20280>:
      <D.19800>:
      path = path + 8;
      <D.19803>:
      D.20266 = *path;
      if (D.20266 != 0B) goto <D.19802>; else goto <D.19801>;
      <D.19801>:
      monoeg_g_free (filename);
      D.20281 = result;
      return D.20281;
    }
  finally
    {
      result = {CLOBBER};
    }
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
strcpy (char * restrict __dest, const char * restrict __src)
{
  char * D.20284;
  long unsigned int D.20285;

  D.20285 = __builtin_object_size (__dest, 1);
  D.20284 = __builtin___strcpy_chk (__dest, __src, D.20285);
  return D.20284;
}


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.10;
  struct MonoAssembly * D.20295;
  gboolean D.20296;
  struct MonoAssembly * D.20297;
  _Bool D.20298;
  gchar * fullpath;
  gboolean found;

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

    new_fullpath = mono_portability_find_file (fullpath, 1);
    if (new_fullpath != 0B) goto <D.20290>; else goto <D.20291>;
    <D.20290>:
    monoeg_g_free (fullpath);
    fullpath = new_fullpath;
    found = 1;
    <D.20291>:
  }
  goto <D.20292>;
  <D.20289>:
  found = monoeg_g_file_test (fullpath, 1);
  <D.20292>:
  if (found != 0) goto <D.20293>; else goto <D.20294>;
  <D.20293>:
  D.20295 = mono_assembly_open_full (fullpath, 0B, refonly);
  *assembly = D.20295;
  <D.20294>:
  monoeg_g_free (fullpath);
  D.20297 = *assembly;
  D.20298 = D.20297 != 0B;
  D.20296 = (gboolean) D.20298;
  return D.20296;
}


create_domain_objects (struct MonoDomain * domain)
{
  struct MonoImage * D.20302;
  struct MonoException * D.20303;
  struct MonoException * D.20304;
  struct MonoException * D.20305;
  struct MonoClass * D.20306;
  struct MonoObject * D.20307;
  struct MonoClass * D.20310;
  struct MonoClass * D.20311;
  struct MonoDomain * old_domain;
  struct MonoString * arg;

  old_domain = mono_domain_get ();
  if (domain != old_domain) goto <D.20300>; else goto <D.20301>;
  <D.20300>:
  mono_thread_push_appdomain_ref (domain);
  mono_domain_set_internal_with_options (domain, 0);
  <D.20301>:
  arg = mono_string_new (domain, "Out of memory");
  D.20302 = mono_defaults.corlib;
  D.20303 = mono_exception_from_name_two_strings (D.20302, "System", "OutOfMemoryException", arg, 0B);
  domain->out_of_memory_ex = D.20303;
  arg = mono_string_new (domain, "A null value was found where an object instance was required");
  D.20302 = mono_defaults.corlib;
  D.20304 = mono_exception_from_name_two_strings (D.20302, "System", "NullReferenceException", arg, 0B);
  domain->null_reference_ex = D.20304;
  arg = mono_string_new (domain, "The requested operation caused a stack overflow.");
  D.20302 = mono_defaults.corlib;
  D.20305 = mono_exception_from_name_two_strings (D.20302, "System", "StackOverflowException", arg, 0B);
  domain->stack_overflow_ex = D.20305;
  D.20306 = mono_defaults.object_class;
  D.20307 = mono_object_new (domain, D.20306);
  domain->ephemeron_tombstone = D.20307;
  if (domain != old_domain) goto <D.20308>; else goto <D.20309>;
  <D.20308>:
  mono_thread_pop_appdomain_ref ();
  mono_domain_set_internal_with_options (old_domain, 0);
  <D.20309>:
  D.20310 = mono_defaults.int_class;
  D.20311 = mono_array_class_get (D.20310, 1);
  mono_class_init (D.20311);
}


mono_domain_fire_assembly_load (struct MonoAssembly * assembly, void * user_data)
{
  struct MonoAppDomain * D.20312;
  struct MonoVTable * D.20315;
  union mono_mutex_t * D.20316;
  _Bool D.20319;
  long int D.20320;
  long int D.20321;
  _Bool D.20326;
  long int D.20327;
  long int D.20328;
  struct MonoClassField * assembly_load_field.11;
  struct MonoClassField * assembly_load_field.12;
  _Bool D.20335;
  long int D.20336;
  long int D.20337;
  void * load_value.13;
  _Bool D.20343;
  long int D.20344;
  long int D.20345;
  struct MonoMethod * assembly_load_method.14;
  struct MonoMethod * assembly_load_method.15;
  _Bool D.20352;
  long int D.20353;
  long int D.20354;
  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.20312 = domain->domain;
      if (D.20312 == 0B) goto <D.20313>; else goto <D.20314>;
      <D.20313>:
      return;
      <D.20314>:
      D.20312 = domain->domain;
      D.20315 = D.20312->mbr.obj.vtable;
      klass = D.20315->klass;
      {
        int ret;

        D.20316 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_lock (D.20316);
        if (ret != 0) goto <D.20317>; else goto <D.20318>;
        <D.20317>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20318>:
        D.20319 = ret != 0;
        D.20320 = (long int) D.20319;
        D.20321 = __builtin_expect (D.20320, 0);
        if (D.20321 != 0) goto <D.20322>; else goto <D.20323>;
        <D.20322>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1011, "ret == 0");
        <D.20323>:
      }
      add_assemblies_to_domain (domain, assembly, 0B);
      {
        int ret;

        D.20316 = &domain->assemblies_lock.mutex;
        ret = pthread_mutex_unlock (D.20316);
        if (ret != 0) goto <D.20324>; else goto <D.20325>;
        <D.20324>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20325>:
        D.20326 = ret != 0;
        D.20327 = (long int) D.20326;
        D.20328 = __builtin_expect (D.20327, 0);
        if (D.20328 != 0) goto <D.20329>; else goto <D.20330>;
        <D.20329>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1013, "ret == 0");
        <D.20330>:
      }
      assembly_load_field.11 = assembly_load_field;
      if (assembly_load_field.11 == 0B) goto <D.20332>; else goto <D.20333>;
      <D.20332>:
      assembly_load_field.12 = mono_class_get_field_from_name (klass, "AssemblyLoad");
      assembly_load_field = assembly_load_field.12;
      assembly_load_field.11 = assembly_load_field;
      D.20335 = assembly_load_field.11 == 0B;
      D.20336 = (long int) D.20335;
      D.20337 = __builtin_expect (D.20336, 0);
      if (D.20337 != 0) goto <D.20338>; else goto <D.20339>;
      <D.20338>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1017, "assembly_load_field");
      <D.20339>:
      <D.20333>:
      D.20312 = domain->domain;
      assembly_load_field.11 = assembly_load_field;
      mono_field_get_value (D.20312, assembly_load_field.11, &load_value);
      load_value.13 = load_value;
      if (load_value.13 == 0B) goto <D.20341>; else goto <D.20342>;
      <D.20341>:
      return;
      <D.20342>:
      ref_assembly = mono_assembly_get_object (domain, assembly);
      D.20343 = ref_assembly == 0B;
      D.20344 = (long int) D.20343;
      D.20345 = __builtin_expect (D.20344, 0);
      if (D.20345 != 0) goto <D.20346>; else goto <D.20347>;
      <D.20346>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1027, "ref_assembly");
      <D.20347>:
      assembly_load_method.14 = assembly_load_method;
      if (assembly_load_method.14 == 0B) goto <D.20349>; else goto <D.20350>;
      <D.20349>:
      assembly_load_method.15 = mono_class_get_method_from_name (klass, "DoAssemblyLoad", -1);
      assembly_load_method = assembly_load_method.15;
      assembly_load_method.14 = assembly_load_method;
      D.20352 = assembly_load_method.14 == 0B;
      D.20353 = (long int) D.20352;
      D.20354 = __builtin_expect (D.20353, 0);
      if (D.20354 != 0) goto <D.20355>; else goto <D.20356>;
      <D.20355>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1031, "assembly_load_method");
      <D.20356>:
      <D.20350>:
      params[0] = ref_assembly;
      assembly_load_method.14 = assembly_load_method;
      D.20312 = domain->domain;
      mono_runtime_invoke (assembly_load_method.14, D.20312, &params, 0B);
    }
  finally
    {
      load_value = {CLOBBER};
      params = {CLOBBER};
    }
}


add_assemblies_to_domain (struct MonoDomain * domain, struct MonoAssembly * ass, struct GHashTable * ht)
{
  const char * D.20360;
  void * D.20365;
  void * D.20366;
  struct GSList * D.20369;
  struct GSList * D.20370;
  char * D.20371;
  int D.20372;
  struct MonoImage * D.20373;
  struct MonoAssembly * * D.20374;
  long unsigned int D.20377;
  long unsigned int D.20378;
  struct MonoAssembly * * D.20379;
  struct MonoAssembly * D.20380;
  void * D.20383;
  gint i;
  struct GSList * tmp;
  gboolean destroy_ht;

  destroy_ht = 0;
  D.20360 = ass->aname.name;
  if (D.20360 == 0B) goto <D.20361>; else goto <D.20362>;
  <D.20361>:
  return;
  <D.20362>:
  if (ht == 0B) goto <D.20363>; else goto <D.20364>;
  <D.20363>:
  ht = monoeg_g_hash_table_new (mono_aligned_addr_hash, 0B);
  destroy_ht = 1;
  <D.20364>:
  tmp = domain->domain_assemblies;
  goto <D.19603>;
  <D.19602>:
  D.20365 = tmp->data;
  D.20365 = tmp->data;
  monoeg_g_hash_table_insert_replace (ht, D.20365, D.20365, 0);
  tmp = tmp->next;
  <D.19603>:
  if (tmp != 0B) goto <D.19602>; else goto <D.19604>;
  <D.19604>:
  D.20366 = monoeg_g_hash_table_lookup (ht, ass);
  if (D.20366 == 0B) goto <D.20367>; else goto <D.20368>;
  <D.20367>:
  mono_assembly_addref (ass);
  monoeg_g_hash_table_insert_replace (ht, ass, ass, 0);
  D.20369 = domain->domain_assemblies;
  D.20370 = monoeg_g_slist_append (D.20369, ass);
  domain->domain_assemblies = D.20370;
  D.20360 = ass->aname.name;
  D.20371 = domain->friendly_name;
  D.20372 = ass->ref_count;
  mono_trace (64, 1, "Assembly %s[%p] added to domain %s, ref_count=%d", D.20360, ass, D.20371, D.20372);
  <D.20368>:
  D.20373 = ass->image;
  D.20374 = D.20373->references;
  if (D.20374 != 0B) goto <D.20375>; else goto <D.20376>;
  <D.20375>:
  i = 0;
  goto <D.19606>;
  <D.19605>:
  D.20373 = ass->image;
  D.20374 = D.20373->references;
  D.20377 = (long unsigned int) i;
  D.20378 = D.20377 * 8;
  D.20379 = D.20374 + D.20378;
  D.20380 = *D.20379;
  if (D.20380 != -1B) goto <D.20381>; else goto <D.20382>;
  <D.20381>:
  D.20373 = ass->image;
  D.20374 = D.20373->references;
  D.20377 = (long unsigned int) i;
  D.20378 = D.20377 * 8;
  D.20379 = D.20374 + D.20378;
  D.20380 = *D.20379;
  D.20383 = monoeg_g_hash_table_lookup (ht, D.20380);
  if (D.20383 == 0B) goto <D.20384>; else goto <D.20385>;
  <D.20384>:
  D.20373 = ass->image;
  D.20374 = D.20373->references;
  D.20377 = (long unsigned int) i;
  D.20378 = D.20377 * 8;
  D.20379 = D.20374 + D.20378;
  D.20380 = *D.20379;
  add_assemblies_to_domain (domain, D.20380, ht);
  <D.20385>:
  <D.20382>:
  i = i + 1;
  <D.19606>:
  D.20373 = ass->image;
  D.20374 = D.20373->references;
  D.20377 = (long unsigned int) i;
  D.20378 = D.20377 * 8;
  D.20379 = D.20374 + D.20378;
  D.20380 = *D.20379;
  if (D.20380 != 0B) goto <D.19605>; else goto <D.19607>;
  <D.19607>:
  <D.20376>:
  if (destroy_ht != 0) goto <D.20386>; else goto <D.20387>;
  <D.20386>:
  monoeg_g_hash_table_destroy (ht);
  <D.20387>:
}


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

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


mono_get_corlib_version ()
{
  struct MonoImage * D.20393;
  int D.20396;
  struct MonoType * D.20397;
  short unsigned int D.20398;
  int D.20399;
  int D.20400;
  struct MonoDomain * D.20403;
  gint32 * D.20404;
  struct MonoClass * klass;
  struct MonoClassField * field;
  struct MonoObject * value;

  D.20393 = mono_defaults.corlib;
  klass = mono_class_from_name (D.20393, "System", "Environment");
  mono_class_init (klass);
  field = mono_class_get_field_from_name (klass, "mono_corlib_version");
  if (field == 0B) goto <D.20394>; else goto <D.20395>;
  <D.20394>:
  D.20396 = -1;
  return D.20396;
  <D.20395>:
  D.20397 = field->type;
  D.20398 = D.20397->attrs;
  D.20399 = (int) D.20398;
  D.20400 = D.20399 & 16;
  if (D.20400 == 0) goto <D.20401>; else goto <D.20402>;
  <D.20401>:
  D.20396 = -1;
  return D.20396;
  <D.20402>:
  D.20403 = mono_domain_get ();
  value = mono_field_get_value_object (D.20403, field, 0B);
  D.20404 = value + 16;
  D.20396 = *D.20404;
  return D.20396;
}


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

  D.20406 = mono_defaults.corlib;
  class = mono_class_from_name (D.20406, "System.Runtime.Remoting.Contexts", "Context");
  context = mono_object_new (domain, class);
  D.20407 = domain->domain_id;
  context->domain_id = D.20407;
  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 (*<T1788>) (struct MonoDomain *, void *) quit_function.16;
  struct MonoDomain * D.20411;

  quit_function.16 = quit_function;
  if (quit_function.16 != 0B) goto <D.20409>; else goto <D.20410>;
  <D.20409>:
  quit_function.16 = quit_function;
  D.20411 = mono_get_root_domain ();
  quit_function.16 (D.20411, 0B);
  <D.20410>:
}


mono_domain_create_appdomain (char * friendly_name, char * configuration_file)
{
  struct MonoImage * D.20412;
  struct MonoDomain * D.20413;
  struct MonoString * iftmp.17;
  struct MonoDomain * D.20417;
  struct MonoDomain * D.20419;
  struct MonoAppDomain * ad;
  struct MonoAppDomainSetup * setup;
  struct MonoClass * class;

  D.20412 = mono_defaults.corlib;
  class = mono_class_from_name (D.20412, "System", "AppDomainSetup");
  D.20413 = mono_domain_get ();
  setup = mono_object_new (D.20413, class);
  if (configuration_file != 0B) goto <D.20415>; else goto <D.20416>;
  <D.20415>:
  D.20417 = mono_domain_get ();
  iftmp.17 = mono_string_new (D.20417, configuration_file);
  goto <D.20418>;
  <D.20416>:
  iftmp.17 = 0B;
  <D.20418>:
  setup->configuration_file = iftmp.17;
  ad = mono_domain_create_appdomain_internal (friendly_name, setup);
  D.20419 = mono_domain_from_appdomain (ad);
  return D.20419;
}


mono_domain_create_appdomain_internal (char * friendly_name, struct MonoAppDomainSetup * setup)
{
  struct MonoImage * D.20421;
  gchar * D.20422;
  struct MonoString * D.20423;
  struct MonoAppDomainSetup * D.20426;
  struct MonoString * D.20427;
  struct MonoString * * D.20430;
  mono_unichar2 * D.20431;
  int D.20432;
  struct MonoString * D.20433;
  struct MonoAppDomainSetup * D.20434;
  struct MonoAssembly * D.20435;
  int D.20436;
  struct MonoAppDomain * D.20439;
  struct MonoError error;
  struct MonoClass * adclass;
  struct MonoAppDomain * ad;
  struct MonoDomain * data;
  char * shadow_location;

  try
    {
      D.20421 = mono_defaults.corlib;
      adclass = mono_class_from_name (D.20421, "System", "AppDomain");
      data = mono_domain_create ();
      ad = mono_object_new (data, adclass);
      ad->data = data;
      data->domain = ad;
      D.20422 = monoeg_strdup (friendly_name);
      data->friendly_name = D.20422;
      D.20423 = setup->application_base;
      if (D.20423 == 0B) goto <D.20424>; else goto <D.20425>;
      <D.20424>:
      {
        struct MonoDomain * root;

        root = mono_get_root_domain ();
        D.20426 = root->setup;
        D.20427 = D.20426->application_base;
        if (D.20427 != 0B) goto <D.20428>; else goto <D.20429>;
        <D.20428>:
        D.20430 = &setup->application_base;
        D.20426 = root->setup;
        D.20427 = D.20426->application_base;
        D.20431 = mono_string_chars (D.20427);
        D.20426 = root->setup;
        D.20427 = D.20426->application_base;
        D.20432 = mono_string_length (D.20427);
        D.20433 = mono_string_new_utf16 (data, D.20431, D.20432);
        mono_gc_wbarrier_set_field (setup, D.20430, D.20433);
        <D.20429>:
      }
      <D.20425>:
      mono_context_init (data);
      D.20434 = copy_app_domain_setup (data, setup);
      data->setup = D.20434;
      mono_set_private_bin_path_from_config (data);
      D.20421 = mono_defaults.corlib;
      D.20435 = D.20421->assembly;
      add_assemblies_to_domain (data, D.20435, 0B);
      shadow_location = get_shadow_assembly_location_base (data, &error);
      D.20436 = mono_error_ok (&error);
      if (D.20436 == 0) goto <D.20437>; else goto <D.20438>;
      <D.20437>:
      mono_error_raise_exception (&error);
      <D.20438>:
      monoeg_g_free (shadow_location);
      create_domain_objects (data);
      D.20439 = ad;
      return D.20439;
    }
  finally
    {
      error = {CLOBBER};
    }
}


copy_app_domain_setup (struct MonoDomain * domain, struct MonoAppDomainSetup * setup)
{
  struct MonoImage * D.20442;
  struct MonoString * * D.20443;
  struct MonoString * D.20444;
  struct MonoObject * D.20445;
  struct MonoString * * D.20446;
  struct MonoString * D.20447;
  struct MonoObject * D.20448;
  struct MonoString * * D.20449;
  struct MonoString * D.20450;
  struct MonoObject * D.20451;
  struct MonoString * * D.20452;
  struct MonoString * D.20453;
  struct MonoObject * D.20454;
  struct MonoString * * D.20455;
  struct MonoString * D.20456;
  struct MonoObject * D.20457;
  struct MonoString * * D.20458;
  struct MonoString * D.20459;
  struct MonoObject * D.20460;
  struct MonoString * * D.20461;
  struct MonoString * D.20462;
  struct MonoObject * D.20463;
  struct MonoString * * D.20464;
  struct MonoString * D.20465;
  struct MonoObject * D.20466;
  struct MonoString * * D.20467;
  struct MonoString * D.20468;
  struct MonoObject * D.20469;
  struct MonoString * * D.20470;
  struct MonoString * D.20471;
  struct MonoObject * D.20472;
  unsigned char D.20473;
  unsigned char D.20474;
  int D.20475;
  unsigned char D.20476;
  unsigned char D.20477;
  struct MonoArray * * D.20478;
  struct MonoArray * D.20479;
  struct MonoObject * D.20480;
  unsigned char D.20481;
  struct MonoObject * * D.20482;
  struct MonoObject * D.20483;
  struct MonoObject * D.20484;
  struct MonoArray * * D.20485;
  struct MonoArray * D.20486;
  struct MonoObject * D.20487;
  struct MonoArray * * D.20488;
  struct MonoArray * D.20489;
  struct MonoObject * D.20490;
  struct MonoAppDomainSetup * D.20491;
  struct MonoDomain * caller_domain;
  struct MonoClass * ads_class;
  struct MonoAppDomainSetup * copy;

  caller_domain = mono_domain_get ();
  D.20442 = mono_defaults.corlib;
  ads_class = mono_class_from_name (D.20442, "System", "AppDomainSetup");
  copy = mono_object_new (domain, ads_class);
  mono_domain_set_internal (domain);
  D.20443 = &copy->application_base;
  D.20444 = setup->application_base;
  D.20445 = mono_marshal_xdomain_copy_value (D.20444);
  mono_gc_wbarrier_set_field (copy, D.20443, D.20445);
  D.20446 = &copy->application_name;
  D.20447 = setup->application_name;
  D.20448 = mono_marshal_xdomain_copy_value (D.20447);
  mono_gc_wbarrier_set_field (copy, D.20446, D.20448);
  D.20449 = &copy->cache_path;
  D.20450 = setup->cache_path;
  D.20451 = mono_marshal_xdomain_copy_value (D.20450);
  mono_gc_wbarrier_set_field (copy, D.20449, D.20451);
  D.20452 = &copy->configuration_file;
  D.20453 = setup->configuration_file;
  D.20454 = mono_marshal_xdomain_copy_value (D.20453);
  mono_gc_wbarrier_set_field (copy, D.20452, D.20454);
  D.20455 = &copy->dynamic_base;
  D.20456 = setup->dynamic_base;
  D.20457 = mono_marshal_xdomain_copy_value (D.20456);
  mono_gc_wbarrier_set_field (copy, D.20455, D.20457);
  D.20458 = &copy->license_file;
  D.20459 = setup->license_file;
  D.20460 = mono_marshal_xdomain_copy_value (D.20459);
  mono_gc_wbarrier_set_field (copy, D.20458, D.20460);
  D.20461 = &copy->private_bin_path;
  D.20462 = setup->private_bin_path;
  D.20463 = mono_marshal_xdomain_copy_value (D.20462);
  mono_gc_wbarrier_set_field (copy, D.20461, D.20463);
  D.20464 = &copy->private_bin_path_probe;
  D.20465 = setup->private_bin_path_probe;
  D.20466 = mono_marshal_xdomain_copy_value (D.20465);
  mono_gc_wbarrier_set_field (copy, D.20464, D.20466);
  D.20467 = &copy->shadow_copy_directories;
  D.20468 = setup->shadow_copy_directories;
  D.20469 = mono_marshal_xdomain_copy_value (D.20468);
  mono_gc_wbarrier_set_field (copy, D.20467, D.20469);
  D.20470 = &copy->shadow_copy_files;
  D.20471 = setup->shadow_copy_files;
  D.20472 = mono_marshal_xdomain_copy_value (D.20471);
  mono_gc_wbarrier_set_field (copy, D.20470, D.20472);
  D.20473 = setup->publisher_policy;
  copy->publisher_policy = D.20473;
  D.20474 = setup->path_changed;
  copy->path_changed = D.20474;
  D.20475 = setup->loader_optimization;
  copy->loader_optimization = D.20475;
  D.20476 = setup->disallow_binding_redirects;
  copy->disallow_binding_redirects = D.20476;
  D.20477 = setup->disallow_code_downloads;
  copy->disallow_code_downloads = D.20477;
  D.20478 = &copy->domain_initializer_args;
  D.20479 = setup->domain_initializer_args;
  D.20480 = mono_marshal_xdomain_copy_value (D.20479);
  mono_gc_wbarrier_set_field (copy, D.20478, D.20480);
  D.20481 = setup->disallow_appbase_probe;
  copy->disallow_appbase_probe = D.20481;
  D.20482 = &copy->application_trust;
  D.20483 = setup->application_trust;
  D.20484 = mono_marshal_xdomain_copy_value (D.20483);
  mono_gc_wbarrier_set_field (copy, D.20482, D.20484);
  D.20485 = &copy->configuration_bytes;
  D.20486 = setup->configuration_bytes;
  D.20487 = mono_marshal_xdomain_copy_value (D.20486);
  mono_gc_wbarrier_set_field (copy, D.20485, D.20487);
  D.20488 = &copy->serialized_non_primitives;
  D.20489 = setup->serialized_non_primitives;
  D.20490 = mono_marshal_xdomain_copy_value (D.20489);
  mono_gc_wbarrier_set_field (copy, D.20488, D.20490);
  mono_domain_set_internal (caller_domain);
  D.20491 = copy;
  return D.20491;
}


get_shadow_assembly_location_base (struct MonoDomain * domain, struct MonoError * error)
{
  struct MonoString * D.20495;
  struct MonoString * D.20497;
  int D.20499;
  char * D.20502;
  long unsigned int D.20503;
  unsigned int D.20504;
  unsigned int D.20505;
  sizetype D.20506;
  char * D.20507;
  char D.20508;
  int D.20511;
  const gchar * D.20514;
  const gchar * D.20515;
  struct MonoAppDomainSetup * setup;
  char * cache_path;
  char * appname;
  char * userdir;
  char * location;

  mono_error_init (error);
  setup = domain->setup;
  D.20495 = setup->cache_path;
  if (D.20495 != 0B) goto <D.20496>; else goto <D.20493>;
  <D.20496>:
  D.20497 = setup->application_name;
  if (D.20497 != 0B) goto <D.20498>; else goto <D.20493>;
  <D.20498>:
  D.20495 = setup->cache_path;
  cache_path = mono_string_to_utf8_checked (D.20495, error);
  D.20499 = mono_error_ok (error);
  if (D.20499 == 0) goto <D.20500>; else goto <D.20501>;
  <D.20500>:
  D.20502 = 0B;
  return D.20502;
  <D.20501>:
  {
    gint i;

    D.20503 = __strlen_g (cache_path);
    D.20504 = (unsigned int) D.20503;
    D.20505 = D.20504 + 4294967295;
    i = (gint) D.20505;
    goto <D.19691>;
    <D.19690>:
    D.20506 = (sizetype) i;
    D.20507 = cache_path + D.20506;
    D.20508 = *D.20507;
    if (D.20508 == 92) goto <D.20509>; else goto <D.20510>;
    <D.20509>:
    D.20506 = (sizetype) i;
    D.20507 = cache_path + D.20506;
    *D.20507 = 47;
    <D.20510>:
    i = i + -1;
    <D.19691>:
    if (i >= 0) goto <D.19690>; else goto <D.19692>;
    <D.19692>:
  }
  D.20497 = setup->application_name;
  appname = mono_string_to_utf8_checked (D.20497, error);
  D.20511 = mono_error_ok (error);
  if (D.20511 == 0) goto <D.20512>; else goto <D.20513>;
  <D.20512>:
  monoeg_g_free (cache_path);
  D.20502 = 0B;
  return D.20502;
  <D.20513>:
  location = monoeg_g_build_path ("/", cache_path, appname, "assembly", "shadow", 0B);
  monoeg_g_free (appname);
  monoeg_g_free (cache_path);
  goto <D.20494>;
  <D.20493>:
  D.20514 = monoeg_g_get_user_name ();
  userdir = monoeg_g_strdup_printf ("%s-mono-cachepath", D.20514);
  D.20515 = monoeg_g_get_tmp_dir ();
  location = monoeg_g_build_path ("/", D.20515, userdir, "assembly", "shadow", 0B);
  monoeg_g_free (userdir);
  <D.20494>:
  D.20502 = location;
  return D.20502;
}


mono_domain_has_type_resolve (struct MonoDomain * domain)
{
  struct MonoClassField * field.18;
  struct MonoClass * D.20520;
  struct MonoClassField * field.19;
  _Bool D.20522;
  long int D.20523;
  long int D.20524;
  struct MonoAppDomain * D.20527;
  mono_bool D.20530;
  struct MonoObject * o.20;
  _Bool D.20532;
  static struct MonoClassField * field = 0B;
  struct MonoObject * o;

  try
    {
      field.18 = field;
      if (field.18 == 0B) goto <D.20518>; else goto <D.20519>;
      <D.20518>:
      D.20520 = mono_defaults.appdomain_class;
      field.19 = mono_class_get_field_from_name (D.20520, "TypeResolve");
      field = field.19;
      field.18 = field;
      D.20522 = field.18 == 0B;
      D.20523 = (long int) D.20522;
      D.20524 = __builtin_expect (D.20523, 0);
      if (D.20524 != 0) goto <D.20525>; else goto <D.20526>;
      <D.20525>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 503, "field");
      <D.20526>:
      <D.20519>:
      D.20527 = domain->domain;
      if (D.20527 == 0B) goto <D.20528>; else goto <D.20529>;
      <D.20528>:
      D.20530 = 0;
      return D.20530;
      <D.20529>:
      D.20527 = domain->domain;
      field.18 = field;
      mono_field_get_value (D.20527, field.18, &o);
      o.20 = o;
      D.20532 = o.20 != 0B;
      D.20530 = (mono_bool) D.20532;
      return D.20530;
    }
  finally
    {
      o = {CLOBBER};
    }
}


mono_domain_try_type_resolve (struct MonoDomain * domain, char * name, struct MonoObject * tb)
{
  int iftmp.21;
  _Bool D.20541;
  long int D.20542;
  long int D.20543;
  struct MonoMethod * method.22;
  struct MonoAppDomain * D.20549;
  struct MonoVTable * D.20550;
  _Bool D.20551;
  long int D.20552;
  long int D.20553;
  struct MonoMethod * method.23;
  struct MonoReflectionAssembly * D.20559;
  struct MonoDomain * D.20562;
  struct MonoString * D.20563;
  struct MonoClass * klass;
  void * params[1];
  static struct MonoMethod * method = 0B;

  try
    {
      if (domain == 0B) goto <D.20536>; else goto <D.20539>;
      <D.20539>:
      if (name == 0B) goto <D.20540>; else goto <D.20537>;
      <D.20540>:
      if (tb == 0B) goto <D.20536>; else goto <D.20537>;
      <D.20536>:
      iftmp.21 = 1;
      goto <D.20538>;
      <D.20537>:
      iftmp.21 = 0;
      <D.20538>:
      D.20541 = iftmp.21 != 0;
      D.20542 = (long int) D.20541;
      D.20543 = __builtin_expect (D.20542, 0);
      if (D.20543 != 0) goto <D.20544>; else goto <D.20545>;
      <D.20544>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 534, "domain != NULL && ((name != NULL) || (tb != NULL))");
      <D.20545>:
      method.22 = method;
      if (method.22 == 0B) goto <D.20547>; else goto <D.20548>;
      <D.20547>:
      D.20549 = domain->domain;
      D.20550 = D.20549->mbr.obj.vtable;
      klass = D.20550->klass;
      D.20551 = klass == 0B;
      D.20552 = (long int) D.20551;
      D.20553 = __builtin_expect (D.20552, 0);
      if (D.20553 != 0) goto <D.20554>; else goto <D.20555>;
      <D.20554>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 538, "klass");
      <D.20555>:
      method.23 = mono_class_get_method_from_name (klass, "DoTypeResolve", -1);
      method = method.23;
      method.22 = method;
      if (method.22 == 0B) goto <D.20557>; else goto <D.20558>;
      <D.20557>:
      monoeg_g_log (0B, 16, "Method AppDomain.DoTypeResolve not found.\n");
      D.20559 = 0B;
      return D.20559;
      <D.20558>:
      <D.20548>:
      if (name != 0B) goto <D.20560>; else goto <D.20561>;
      <D.20560>:
      D.20562 = mono_domain_get ();
      D.20563 = mono_string_new (D.20562, name);
      params[0] = D.20563;
      goto <D.20564>;
      <D.20561>:
      params[0] = tb;
      <D.20564>:
      method.22 = method;
      D.20549 = domain->domain;
      D.20559 = mono_runtime_invoke (method.22, D.20549, &params, 0B);
      return D.20559;
    }
  finally
    {
      params = {CLOBBER};
    }
}


mono_domain_owns_vtable_slot (struct MonoDomain * domain, void * vtable_slot)
{
  union mono_mutex_t * D.20567;
  _Bool D.20570;
  long int D.20571;
  long int D.20572;
  struct MonoMemPool * D.20575;
  _Bool D.20578;
  long int D.20579;
  long int D.20580;
  mono_bool D.20583;
  gboolean res;

  {
    int ret;

    D.20567 = &domain->lock.mutex;
    ret = pthread_mutex_lock (D.20567);
    if (ret != 0) goto <D.20568>; else goto <D.20569>;
    <D.20568>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20569>:
    D.20570 = ret != 0;
    D.20571 = (long int) D.20570;
    D.20572 = __builtin_expect (D.20571, 0);
    if (D.20572 != 0) goto <D.20573>; else goto <D.20574>;
    <D.20573>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 564, "ret == 0");
    <D.20574>:
  }
  D.20575 = domain->mp;
  res = mono_mempool_contains_addr (D.20575, vtable_slot);
  {
    int ret;

    D.20567 = &domain->lock.mutex;
    ret = pthread_mutex_unlock (D.20567);
    if (ret != 0) goto <D.20576>; else goto <D.20577>;
    <D.20576>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20577>:
    D.20578 = ret != 0;
    D.20579 = (long int) D.20578;
    D.20580 = __builtin_expect (D.20579, 0);
    if (D.20580 != 0) goto <D.20581>; else goto <D.20582>;
    <D.20581>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 566, "ret == 0");
    <D.20582>:
  }
  D.20583 = res;
  return D.20583;
}


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

  if (force == 0) goto <D.20585>; else goto <D.20586>;
  <D.20585>:
  D.20587 = domain->state;
  if (D.20587 == 3) goto <D.20588>; else goto <D.20589>;
  <D.20588>:
  D.20590 = 0;
  return D.20590;
  <D.20589>:
  <D.20586>:
  mono_domain_set_internal (domain);
  D.20590 = 1;
  return D.20590;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_GetData (struct MonoAppDomain * ad, struct MonoString * name)
{
  _Bool D.20592;
  long int D.20593;
  long int D.20594;
  _Bool D.20597;
  long int D.20598;
  long int D.20599;
  struct MonoException * D.20604;
  union mono_mutex_t * D.20605;
  _Bool D.20608;
  long int D.20609;
  long int D.20610;
  int D.20613;
  struct MonoAppDomainSetup * D.20616;
  int D.20618;
  int D.20622;
  int D.20626;
  int D.20630;
  int D.20634;
  int D.20638;
  int D.20642;
  int D.20646;
  struct MonoGHashTable * D.20650;
  _Bool D.20653;
  long int D.20654;
  long int D.20655;
  struct MonoObject * D.20660;
  struct MonoDomain * add;
  struct MonoObject * o;
  char * str;

  D.20592 = ad == 0B;
  D.20593 = (long int) D.20592;
  D.20594 = __builtin_expect (D.20593, 0);
  if (D.20594 != 0) goto <D.20595>; else goto <D.20596>;
  <D.20595>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 602, "ad != NULL");
  <D.20596>:
  add = ad->data;
  D.20597 = add == 0B;
  D.20598 = (long int) D.20597;
  D.20599 = __builtin_expect (D.20598, 0);
  if (D.20599 != 0) goto <D.20600>; else goto <D.20601>;
  <D.20600>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 604, "add != NULL");
  <D.20601>:
  if (name == 0B) goto <D.20602>; else goto <D.20603>;
  <D.20602>:
  D.20604 = mono_get_exception_argument_null ("name");
  mono_raise_exception (D.20604);
  <D.20603>:
  str = mono_string_to_utf8 (name);
  {
    int ret;

    D.20605 = &add->lock.mutex;
    ret = pthread_mutex_lock (D.20605);
    if (ret != 0) goto <D.20606>; else goto <D.20607>;
    <D.20606>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20607>:
    D.20608 = ret != 0;
    D.20609 = (long int) D.20608;
    D.20610 = __builtin_expect (D.20609, 0);
    if (D.20610 != 0) goto <D.20611>; else goto <D.20612>;
    <D.20611>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 611, "ret == 0");
    <D.20612>:
  }
  D.20613 = strcmp (str, "APPBASE");
  if (D.20613 == 0) goto <D.20614>; else goto <D.20615>;
  <D.20614>:
  D.20616 = add->setup;
  o = D.20616->application_base;
  goto <D.20617>;
  <D.20615>:
  D.20618 = strcmp (str, "APP_CONFIG_FILE");
  if (D.20618 == 0) goto <D.20619>; else goto <D.20620>;
  <D.20619>:
  D.20616 = add->setup;
  o = D.20616->configuration_file;
  goto <D.20621>;
  <D.20620>:
  D.20622 = strcmp (str, "DYNAMIC_BASE");
  if (D.20622 == 0) goto <D.20623>; else goto <D.20624>;
  <D.20623>:
  D.20616 = add->setup;
  o = D.20616->dynamic_base;
  goto <D.20625>;
  <D.20624>:
  D.20626 = strcmp (str, "APP_NAME");
  if (D.20626 == 0) goto <D.20627>; else goto <D.20628>;
  <D.20627>:
  D.20616 = add->setup;
  o = D.20616->application_name;
  goto <D.20629>;
  <D.20628>:
  D.20630 = strcmp (str, "CACHE_BASE");
  if (D.20630 == 0) goto <D.20631>; else goto <D.20632>;
  <D.20631>:
  D.20616 = add->setup;
  o = D.20616->cache_path;
  goto <D.20633>;
  <D.20632>:
  D.20634 = strcmp (str, "PRIVATE_BINPATH");
  if (D.20634 == 0) goto <D.20635>; else goto <D.20636>;
  <D.20635>:
  D.20616 = add->setup;
  o = D.20616->private_bin_path;
  goto <D.20637>;
  <D.20636>:
  D.20638 = strcmp (str, "BINPATH_PROBE_ONLY");
  if (D.20638 == 0) goto <D.20639>; else goto <D.20640>;
  <D.20639>:
  D.20616 = add->setup;
  o = D.20616->private_bin_path_probe;
  goto <D.20641>;
  <D.20640>:
  D.20642 = strcmp (str, "SHADOW_COPY_DIRS");
  if (D.20642 == 0) goto <D.20643>; else goto <D.20644>;
  <D.20643>:
  D.20616 = add->setup;
  o = D.20616->shadow_copy_directories;
  goto <D.20645>;
  <D.20644>:
  D.20646 = strcmp (str, "FORCE_CACHE_INSTALL");
  if (D.20646 == 0) goto <D.20647>; else goto <D.20648>;
  <D.20647>:
  D.20616 = add->setup;
  o = D.20616->shadow_copy_files;
  goto <D.20649>;
  <D.20648>:
  D.20650 = add->env;
  o = mono_g_hash_table_lookup (D.20650, name);
  <D.20649>:
  <D.20645>:
  <D.20641>:
  <D.20637>:
  <D.20633>:
  <D.20629>:
  <D.20625>:
  <D.20621>:
  <D.20617>:
  {
    int ret;

    D.20605 = &add->lock.mutex;
    ret = pthread_mutex_unlock (D.20605);
    if (ret != 0) goto <D.20651>; else goto <D.20652>;
    <D.20651>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20652>:
    D.20653 = ret != 0;
    D.20654 = (long int) D.20653;
    D.20655 = __builtin_expect (D.20654, 0);
    if (D.20655 != 0) goto <D.20656>; else goto <D.20657>;
    <D.20656>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 634, "ret == 0");
    <D.20657>:
  }
  monoeg_g_free (str);
  if (o == 0B) goto <D.20658>; else goto <D.20659>;
  <D.20658>:
  D.20660 = 0B;
  return D.20660;
  <D.20659>:
  D.20660 = o;
  return D.20660;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_SetData (struct MonoAppDomain * ad, struct MonoString * name, struct MonoObject * data)
{
  _Bool D.20662;
  long int D.20663;
  long int D.20664;
  _Bool D.20667;
  long int D.20668;
  long int D.20669;
  struct MonoException * D.20674;
  union mono_mutex_t * D.20675;
  _Bool D.20678;
  long int D.20679;
  long int D.20680;
  struct MonoGHashTable * D.20683;
  _Bool D.20686;
  long int D.20687;
  long int D.20688;
  struct MonoDomain * add;

  D.20662 = ad == 0B;
  D.20663 = (long int) D.20662;
  D.20664 = __builtin_expect (D.20663, 0);
  if (D.20664 != 0) goto <D.20665>; else goto <D.20666>;
  <D.20665>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 650, "ad != NULL");
  <D.20666>:
  add = ad->data;
  D.20667 = add == 0B;
  D.20668 = (long int) D.20667;
  D.20669 = __builtin_expect (D.20668, 0);
  if (D.20669 != 0) goto <D.20670>; else goto <D.20671>;
  <D.20670>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 652, "add != NULL");
  <D.20671>:
  if (name == 0B) goto <D.20672>; else goto <D.20673>;
  <D.20672>:
  D.20674 = mono_get_exception_argument_null ("name");
  mono_raise_exception (D.20674);
  <D.20673>:
  {
    int ret;

    D.20675 = &add->lock.mutex;
    ret = pthread_mutex_lock (D.20675);
    if (ret != 0) goto <D.20676>; else goto <D.20677>;
    <D.20676>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20677>:
    D.20678 = ret != 0;
    D.20679 = (long int) D.20678;
    D.20680 = __builtin_expect (D.20679, 0);
    if (D.20680 != 0) goto <D.20681>; else goto <D.20682>;
    <D.20681>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 657, "ret == 0");
    <D.20682>:
  }
  D.20683 = add->env;
  mono_g_hash_table_insert (D.20683, name, data);
  {
    int ret;

    D.20675 = &add->lock.mutex;
    ret = pthread_mutex_unlock (D.20675);
    if (ret != 0) goto <D.20684>; else goto <D.20685>;
    <D.20684>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20685>:
    D.20686 = ret != 0;
    D.20687 = (long int) D.20686;
    D.20688 = __builtin_expect (D.20687, 0);
    if (D.20688 != 0) goto <D.20689>; else goto <D.20690>;
    <D.20689>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 661, "ret == 0");
    <D.20690>:
  }
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_getSetup (struct MonoAppDomain * ad)
{
  _Bool D.20691;
  long int D.20692;
  long int D.20693;
  struct MonoDomain * D.20696;
  _Bool D.20697;
  long int D.20698;
  long int D.20699;
  struct MonoAppDomainSetup * D.20702;

  D.20691 = ad == 0B;
  D.20692 = (long int) D.20691;
  D.20693 = __builtin_expect (D.20692, 0);
  if (D.20693 != 0) goto <D.20694>; else goto <D.20695>;
  <D.20694>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 669, "ad != NULL");
  <D.20695>:
  D.20696 = ad->data;
  D.20697 = D.20696 == 0B;
  D.20698 = (long int) D.20697;
  D.20699 = __builtin_expect (D.20698, 0);
  if (D.20699 != 0) goto <D.20700>; else goto <D.20701>;
  <D.20700>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 670, "ad->data != NULL");
  <D.20701>:
  D.20696 = ad->data;
  D.20702 = D.20696->setup;
  return D.20702;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_getFriendlyName (struct MonoAppDomain * ad)
{
  _Bool D.20704;
  long int D.20705;
  long int D.20706;
  struct MonoDomain * D.20709;
  _Bool D.20710;
  long int D.20711;
  long int D.20712;
  struct MonoString * D.20715;
  char * D.20716;

  D.20704 = ad == 0B;
  D.20705 = (long int) D.20704;
  D.20706 = __builtin_expect (D.20705, 0);
  if (D.20706 != 0) goto <D.20707>; else goto <D.20708>;
  <D.20707>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 680, "ad != NULL");
  <D.20708>:
  D.20709 = ad->data;
  D.20710 = D.20709 == 0B;
  D.20711 = (long int) D.20710;
  D.20712 = __builtin_expect (D.20711, 0);
  if (D.20712 != 0) goto <D.20713>; else goto <D.20714>;
  <D.20713>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 681, "ad->data != NULL");
  <D.20714>:
  D.20709 = ad->data;
  D.20709 = ad->data;
  D.20716 = D.20709->friendly_name;
  D.20715 = mono_string_new (D.20709, D.20716);
  return D.20715;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_getCurDomain ()
{
  struct MonoAppDomain * D.20718;
  struct MonoDomain * add;

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


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_getRootDomain ()
{
  struct MonoAppDomain * D.20720;
  struct MonoDomain * root;

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


__attribute__((visibility ("hidden")))
mono_set_private_bin_path_from_config (struct MonoDomain * domain)
{
  struct MonoAppDomainSetup * D.20725;
  struct MonoString * D.20727;
  int D.20728;
  int D.20733;
  long unsigned int len.24;
  gchar * text.25;
  char D.20739;
  gchar * D.20742;
  char D.20743;
  gchar * D.20746;
  char D.20747;
  sizetype D.20750;
  gchar * D.20751;
  long unsigned int D.20752;
  long unsigned int D.20753;
  long int D.20754;
  int D.20755;
  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.20722>; else goto <D.20724>;
      <D.20724>:
      D.20725 = domain->setup;
      if (D.20725 == 0B) goto <D.20722>; else goto <D.20726>;
      <D.20726>:
      D.20725 = domain->setup;
      D.20727 = D.20725->configuration_file;
      if (D.20727 == 0B) goto <D.20722>; else goto <D.20723>;
      <D.20722>:
      return;
      <D.20723>:
      D.20725 = domain->setup;
      D.20727 = D.20725->configuration_file;
      config_file_name = mono_string_to_utf8_checked (D.20727, &error);
      D.20728 = mono_error_ok (&error);
      if (D.20728 == 0) goto <D.20729>; else goto <D.20730>;
      <D.20729>:
      mono_error_cleanup (&error);
      goto free_and_out;
      <D.20730>:
      config_file_path = mono_portability_find_file (config_file_name, 1);
      if (config_file_path == 0B) goto <D.20731>; else goto <D.20732>;
      <D.20731>:
      config_file_path = config_file_name;
      <D.20732>:
      D.20733 = monoeg_g_file_get_contents (config_file_path, &text, &len, 0B);
      if (D.20733 == 0) goto free_and_out; else goto <D.20734>;
      <D.20734>:
      runtime_config.runtime_count = 0;
      runtime_config.assemblybinding_count = 0;
      runtime_config.domain = domain;
      runtime_config.filename = config_file_path;
      offset = 0;
      len.24 = len;
      if (len.24 > 3) goto <D.20736>; else goto <D.20737>;
      <D.20736>:
      text.25 = text;
      D.20739 = *text.25;
      if (D.20739 == 239) goto <D.20740>; else goto <D.20741>;
      <D.20740>:
      text.25 = text;
      D.20742 = text.25 + 1;
      D.20743 = *D.20742;
      if (D.20743 == 187) goto <D.20744>; else goto <D.20745>;
      <D.20744>:
      text.25 = text;
      D.20746 = text.25 + 2;
      D.20747 = *D.20746;
      if (D.20747 == 191) goto <D.20748>; else goto <D.20749>;
      <D.20748>:
      offset = 3;
      <D.20749>:
      <D.20745>:
      <D.20741>:
      <D.20737>:
      context = monoeg_g_markup_parse_context_new (&mono_parser, 0, &runtime_config, 0B);
      text.25 = text;
      D.20750 = (sizetype) offset;
      D.20751 = text.25 + D.20750;
      len.24 = len;
      D.20752 = (long unsigned int) offset;
      D.20753 = len.24 - D.20752;
      D.20754 = (long int) D.20753;
      D.20755 = monoeg_g_markup_parse_context_parse (context, D.20751, D.20754, 0B);
      if (D.20755 != 0) goto <D.20756>; else goto <D.20757>;
      <D.20756>:
      monoeg_g_markup_parse_context_end_parse (context, 0B);
      <D.20757>:
      monoeg_g_markup_parse_context_free (context);
      free_and_out:
      text.25 = text;
      monoeg_g_free (text.25);
      if (config_file_name != config_file_path) goto <D.20758>; else goto <D.20759>;
      <D.20758>:
      monoeg_g_free (config_file_name);
      <D.20759>:
      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.26;
  gchar * D.20767;
  const gchar * iftmp.27;
  gchar * D.20773;
  struct RuntimeConfig * state;
  const gchar * msg;
  const gchar * filename;

  state = user_data;
  if (state != 0B) goto <D.20766>; else goto <D.20764>;
  <D.20766>:
  D.20767 = state->filename;
  if (D.20767 != 0B) goto <D.20768>; else goto <D.20764>;
  <D.20768>:
  iftmp.26 = state->filename;
  goto <D.20765>;
  <D.20764>:
  iftmp.26 = "<unknown>";
  <D.20765>:
  filename = iftmp.26;
  if (error != 0B) goto <D.20772>; else goto <D.20770>;
  <D.20772>:
  D.20773 = error->message;
  if (D.20773 != 0B) goto <D.20774>; else goto <D.20770>;
  <D.20774>:
  iftmp.27 = error->message;
  goto <D.20771>;
  <D.20770>:
  iftmp.27 = "";
  <D.20771>:
  msg = iftmp.27;
  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.20775;
  int D.20778;
  int D.20779;
  int D.20781;
  int D.20784;
  int D.20785;
  struct RuntimeConfig * runtime_config;

  runtime_config = user_data;
  D.20775 = strcmp (element_name, "runtime");
  if (D.20775 == 0) goto <D.20776>; else goto <D.20777>;
  <D.20776>:
  D.20778 = runtime_config->runtime_count;
  D.20779 = D.20778 + -1;
  runtime_config->runtime_count = D.20779;
  goto <D.20780>;
  <D.20777>:
  D.20781 = strcmp (element_name, "assemblyBinding");
  if (D.20781 == 0) goto <D.20782>; else goto <D.20783>;
  <D.20782>:
  D.20784 = runtime_config->assemblybinding_count;
  D.20785 = D.20784 + -1;
  runtime_config->assemblybinding_count = D.20785;
  <D.20783>:
  <D.20780>:
}


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.20786;
  int D.20789;
  int D.20790;
  int D.20791;
  int D.20794;
  int D.20795;
  signed long D.20796;
  long unsigned int D.20797;
  long unsigned int D.20798;
  int D.20801;
  struct MonoDomain * D.20804;
  gchar * D.20805;
  char * D.20806;
  char D.20809;
  struct RuntimeConfig * runtime_config;

  runtime_config = user_data;
  D.20786 = strcmp (element_name, "runtime");
  if (D.20786 == 0) goto <D.20787>; else goto <D.20788>;
  <D.20787>:
  D.20789 = runtime_config->runtime_count;
  D.20790 = D.20789 + 1;
  runtime_config->runtime_count = D.20790;
  return;
  <D.20788>:
  D.20791 = strcmp (element_name, "assemblyBinding");
  if (D.20791 == 0) goto <D.20792>; else goto <D.20793>;
  <D.20792>:
  D.20794 = runtime_config->assemblybinding_count;
  D.20795 = D.20794 + 1;
  runtime_config->assemblybinding_count = D.20795;
  return;
  <D.20793>:
  D.20796 = BIT_FIELD_REF <*runtime_config, 64, 0>;
  D.20797 = (long unsigned int) D.20796;
  D.20798 = D.20797;
  if (D.20798 != 4294967297) goto <D.20799>; else goto <D.20800>;
  <D.20799>:
  return;
  <D.20800>:
  D.20801 = strcmp (element_name, "probing");
  if (D.20801 != 0) goto <D.20802>; else goto <D.20803>;
  <D.20802>:
  return;
  <D.20803>:
  D.20804 = runtime_config->domain;
  D.20805 = D.20804->private_bin_path;
  monoeg_g_free (D.20805);
  D.20804 = runtime_config->domain;
  D.20806 = get_attribute_value (attribute_names, attribute_values, "privatePath");
  D.20804->private_bin_path = D.20806;
  D.20804 = runtime_config->domain;
  D.20805 = D.20804->private_bin_path;
  if (D.20805 != 0B) goto <D.20807>; else goto <D.20808>;
  <D.20807>:
  D.20804 = runtime_config->domain;
  D.20805 = D.20804->private_bin_path;
  D.20809 = *D.20805;
  if (D.20809 == 0) goto <D.20810>; else goto <D.20811>;
  <D.20810>:
  D.20804 = runtime_config->domain;
  D.20805 = D.20804->private_bin_path;
  monoeg_g_free (D.20805);
  D.20804 = runtime_config->domain;
  D.20804->private_bin_path = 0B;
  return;
  <D.20811>:
  <D.20808>:
}


get_attribute_value (const gchar * * attribute_names, const gchar * * attribute_values, const char * att_name)
{
  long unsigned int D.20813;
  long unsigned int D.20814;
  const gchar * * D.20815;
  const gchar * D.20816;
  int D.20817;
  char * D.20820;
  const gchar * * D.20821;
  const gchar * D.20822;
  int n;

  n = 0;
  goto <D.19510>;
  <D.19509>:
  D.20813 = (long unsigned int) n;
  D.20814 = D.20813 * 8;
  D.20815 = attribute_names + D.20814;
  D.20816 = *D.20815;
  D.20817 = strcmp (D.20816, att_name);
  if (D.20817 == 0) goto <D.20818>; else goto <D.20819>;
  <D.20818>:
  D.20813 = (long unsigned int) n;
  D.20814 = D.20813 * 8;
  D.20821 = attribute_values + D.20814;
  D.20822 = *D.20821;
  D.20820 = monoeg_strdup (D.20822);
  return D.20820;
  <D.20819>:
  n = n + 1;
  <D.19510>:
  D.20813 = (long unsigned int) n;
  D.20814 = D.20813 * 8;
  D.20815 = attribute_names + D.20814;
  D.20816 = *D.20815;
  if (D.20816 != 0B) goto <D.19509>; else goto <D.19511>;
  <D.19511>:
  D.20820 = 0B;
  return D.20820;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_createDomain (struct MonoString * friendly_name, struct MonoAppDomainSetup * setup)
{
  struct MonoAppDomain * D.20824;
  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.20824 = ad;
  return D.20824;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_GetAssemblies (struct MonoAppDomain * ad, MonoBoolean refonly)
{
  struct MonoClass * System_Reflection_Assembly.28;
  struct MonoImage * D.20829;
  struct MonoClass * System_Reflection_Assembly.29;
  union mono_mutex_t * D.20831;
  _Bool D.20834;
  long int D.20835;
  long int D.20836;
  int D.20839;
  int D.20840;
  unsigned char D.20843;
  _Bool D.20848;
  long int D.20849;
  long int D.20850;
  unsigned int D.20853;
  long unsigned int D.20854;
  void * * D.20855;
  long unsigned int D.20856;
  long unsigned int D.20857;
  void * * D.20858;
  long unsigned int D.20859;
  struct MonoReflectionAssembly * D.20860;
  unsigned int i.30;
  struct MonoArray * D.20862;
  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.28 = System_Reflection_Assembly;
  if (System_Reflection_Assembly.28 == 0B) goto <D.20827>; else goto <D.20828>;
  <D.20827>:
  D.20829 = mono_defaults.corlib;
  System_Reflection_Assembly.29 = mono_class_from_name (D.20829, "System.Reflection", "Assembly");
  System_Reflection_Assembly = System_Reflection_Assembly.29;
  <D.20828>:
  assemblies = monoeg_g_ptr_array_new ();
  {
    int ret;

    D.20831 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_lock (D.20831);
    if (ret != 0) goto <D.20832>; else goto <D.20833>;
    <D.20832>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20833>:
    D.20834 = ret != 0;
    D.20835 = (long int) D.20834;
    D.20836 = __builtin_expect (D.20835, 0);
    if (D.20836 != 0) goto <D.20837>; else goto <D.20838>;
    <D.20837>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 874, "ret == 0");
    <D.20838>:
  }
  tmp = domain->domain_assemblies;
  goto <D.19569>;
  <D.19568>:
  ass = tmp->data;
  D.20839 = (int) refonly;
  D.20840 = ass->ref_only;
  if (D.20839 != D.20840) goto <D.20841>; else goto <D.20842>;
  <D.20841>:
  // predicted unlikely by continue predictor.
  goto <D.19567>;
  <D.20842>:
  D.20843 = ass->corlib_internal;
  if (D.20843 != 0) goto <D.20844>; else goto <D.20845>;
  <D.20844>:
  // predicted unlikely by continue predictor.
  goto <D.19567>;
  <D.20845>:
  monoeg_g_ptr_array_add (assemblies, ass);
  <D.19567>:
  tmp = tmp->next;
  <D.19569>:
  if (tmp != 0B) goto <D.19568>; else goto <D.19570>;
  <D.19570>:
  {
    int ret;

    D.20831 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.20831);
    if (ret != 0) goto <D.20846>; else goto <D.20847>;
    <D.20846>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20847>:
    D.20848 = ret != 0;
    D.20849 = (long int) D.20848;
    D.20850 = __builtin_expect (D.20849, 0);
    if (D.20850 != 0) goto <D.20851>; else goto <D.20852>;
    <D.20851>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 883, "ret == 0");
    <D.20852>:
  }
  System_Reflection_Assembly.28 = System_Reflection_Assembly;
  D.20853 = assemblies->len;
  D.20854 = (long unsigned int) D.20853;
  res = mono_array_new (domain, System_Reflection_Assembly.28, D.20854);
  i = 0;
  goto <D.19574>;
  <D.19573>:
  D.20855 = assemblies->pdata;
  D.20856 = (long unsigned int) i;
  D.20857 = D.20856 * 8;
  D.20858 = D.20855 + D.20857;
  ass = *D.20858;
  {
    void * * __p;

    D.20859 = (long unsigned int) i;
    __p = mono_array_addr_with_size (res, 8, D.20859);
    D.20860 = mono_assembly_get_object (domain, ass);
    mono_gc_wbarrier_set_arrayref (res, __p, D.20860);
  }
  i = i + 1;
  <D.19574>:
  D.20853 = assemblies->len;
  i.30 = (unsigned int) i;
  if (D.20853 > i.30) goto <D.19573>; else goto <D.19575>;
  <D.19575>:
  monoeg_g_ptr_array_free (assemblies, 1);
  D.20862 = res;
  return D.20862;
}


__attribute__((visibility ("hidden")))
mono_try_assembly_resolve (struct MonoDomain * domain, struct MonoString * fname, gboolean refonly)
{
  int D.20864;
  struct MonoReflectionAssembly * D.20867;
  int iftmp.31;
  _Bool D.20873;
  long int D.20874;
  long int D.20875;
  struct MonoAppDomain * D.20878;
  struct MonoVTable * D.20879;
  _Bool D.20880;
  long int D.20881;
  long int D.20882;
  _Bool D.20887;
  unsigned char isrefonly.32;
  struct MonoClass * klass;
  struct MonoMethod * method;
  MonoBoolean isrefonly;
  void * params[2];

  try
    {
      D.20864 = mono_runtime_get_no_exec ();
      if (D.20864 != 0) goto <D.20865>; else goto <D.20866>;
      <D.20865>:
      D.20867 = 0B;
      return D.20867;
      <D.20866>:
      if (domain == 0B) goto <D.20869>; else goto <D.20872>;
      <D.20872>:
      if (fname == 0B) goto <D.20869>; else goto <D.20870>;
      <D.20869>:
      iftmp.31 = 1;
      goto <D.20871>;
      <D.20870>:
      iftmp.31 = 0;
      <D.20871>:
      D.20873 = iftmp.31 != 0;
      D.20874 = (long int) D.20873;
      D.20875 = __builtin_expect (D.20874, 0);
      if (D.20875 != 0) goto <D.20876>; else goto <D.20877>;
      <D.20876>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 907, "domain != NULL && fname != NULL");
      <D.20877>:
      D.20878 = domain->domain;
      D.20879 = D.20878->mbr.obj.vtable;
      klass = D.20879->klass;
      D.20880 = klass == 0B;
      D.20881 = (long int) D.20880;
      D.20882 = __builtin_expect (D.20881, 0);
      if (D.20882 != 0) goto <D.20883>; else goto <D.20884>;
      <D.20883>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 910, "klass");
      <D.20884>:
      method = mono_class_get_method_from_name (klass, "DoAssemblyResolve", -1);
      if (method == 0B) goto <D.20885>; else goto <D.20886>;
      <D.20885>:
      monoeg_g_log (0B, 16, "Method AppDomain.DoAssemblyResolve not found.\n");
      D.20867 = 0B;
      return D.20867;
      <D.20886>:
      D.20887 = refonly != 0;
      isrefonly.32 = (unsigned char) D.20887;
      isrefonly = isrefonly.32;
      params[0] = fname;
      params[1] = &isrefonly;
      D.20878 = domain->domain;
      D.20867 = mono_runtime_invoke (method, D.20878, &params, 0B);
      return D.20867;
    }
  finally
    {
      isrefonly = {CLOBBER};
      params = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
mono_is_shadow_copy_enabled (struct MonoDomain * domain, const gchar * dir_name)
{
  gboolean D.20893;
  struct MonoString * D.20897;
  int D.20898;
  int D.20901;
  _Bool D.20902;
  struct MonoString * D.20905;
  int D.20908;
  char * D.20911;
  int D.20914;
  gchar * D.20917;
  char D.20918;
  int D.20921;
  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.20891>; else goto <D.20892>;
      <D.20891>:
      D.20893 = 0;
      return D.20893;
      <D.20892>:
      setup = domain->setup;
      if (setup == 0B) goto <D.20894>; else goto <D.20896>;
      <D.20896>:
      D.20897 = setup->shadow_copy_files;
      if (D.20897 == 0B) goto <D.20894>; else goto <D.20895>;
      <D.20894>:
      D.20893 = 0;
      return D.20893;
      <D.20895>:
      D.20897 = setup->shadow_copy_files;
      shadow_status_string = mono_string_to_utf8_checked (D.20897, &error);
      D.20898 = mono_error_ok (&error);
      if (D.20898 == 0) goto <D.20899>; else goto <D.20900>;
      <D.20899>:
      mono_error_cleanup (&error);
      D.20893 = 0;
      return D.20893;
      <D.20900>:
      D.20901 = monoeg_g_ascii_strncasecmp (shadow_status_string, "true", 4);
      D.20902 = D.20901 == 0;
      shadow_enabled = (gboolean) D.20902;
      monoeg_g_free (shadow_status_string);
      if (shadow_enabled == 0) goto <D.20903>; else goto <D.20904>;
      <D.20903>:
      D.20893 = 0;
      return D.20893;
      <D.20904>:
      D.20905 = setup->shadow_copy_directories;
      if (D.20905 == 0B) goto <D.20906>; else goto <D.20907>;
      <D.20906>:
      D.20893 = 1;
      return D.20893;
      <D.20907>:
      base_dir = get_shadow_assembly_location_base (domain, &error);
      D.20908 = mono_error_ok (&error);
      if (D.20908 == 0) goto <D.20909>; else goto <D.20910>;
      <D.20909>:
      mono_error_cleanup (&error);
      D.20893 = 0;
      return D.20893;
      <D.20910>:
      D.20911 = strstr (dir_name, base_dir);
      if (D.20911 != 0B) goto <D.20912>; else goto <D.20913>;
      <D.20912>:
      monoeg_g_free (base_dir);
      D.20893 = 1;
      return D.20893;
      <D.20913>:
      monoeg_g_free (base_dir);
      D.20905 = setup->shadow_copy_directories;
      all_dirs = mono_string_to_utf8_checked (D.20905, &error);
      D.20914 = mono_error_ok (&error);
      if (D.20914 == 0) goto <D.20915>; else goto <D.20916>;
      <D.20915>:
      mono_error_cleanup (&error);
      D.20893 = 0;
      return D.20893;
      <D.20916>:
      directories = monoeg_g_strsplit (all_dirs, ":", 1000);
      dir_ptr = directories;
      goto <D.19753>;
      <D.19752>:
      D.20917 = *dir_ptr;
      D.20918 = *D.20917;
      if (D.20918 != 0) goto <D.20919>; else goto <D.20920>;
      <D.20919>:
      D.20917 = *dir_ptr;
      D.20921 = strcmp (D.20917, dir_name);
      if (D.20921 == 0) goto <D.20922>; else goto <D.20923>;
      <D.20922>:
      found = 1;
      goto <D.19751>;
      <D.20923>:
      <D.20920>:
      dir_ptr = dir_ptr + 8;
      <D.19753>:
      D.20917 = *dir_ptr;
      if (D.20917 != 0B) goto <D.19752>; else goto <D.19751>;
      <D.19751>:
      monoeg_g_strfreev (directories);
      monoeg_g_free (all_dirs);
      D.20893 = found;
      return D.20893;
    }
  finally
    {
      error = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
mono_make_shadow_copy (const char * filename)
{
  int D.20926;
  char * D.20929;
  int D.20930;
  char * D.20933;
  int D.20936;
  int D.20939;
  int D.20942;
  long unsigned int D.20945;
  long int D.20946;
  long unsigned int D.20947;
  long int D.20948;
  long unsigned int D.20955;
  long unsigned int D.20956;
  int D.20961;
  long int D.20964;
  long int D.20965;
  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.20926 = mono_is_shadow_copy_enabled (domain, dir_name);
      if (D.20926 == 0) goto <D.20927>; else goto <D.20928>;
      <D.20927>:
      monoeg_g_free (dir_name);
      D.20929 = filename;
      return D.20929;
      <D.20928>:
      shadow_dir = get_shadow_assembly_location_base (domain, &error);
      D.20930 = mono_error_ok (&error);
      if (D.20930 == 0) goto <D.20931>; else goto <D.20932>;
      <D.20931>:
      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.20932>:
      D.20933 = strstr (dir_name, shadow_dir);
      if (D.20933 != 0B) goto <D.20934>; else goto <D.20935>;
      <D.20934>:
      monoeg_g_free (shadow_dir);
      monoeg_g_free (dir_name);
      D.20929 = filename;
      return D.20929;
      <D.20935>:
      monoeg_g_free (shadow_dir);
      monoeg_g_free (dir_name);
      shadow = get_shadow_assembly_location (filename, &error);
      D.20936 = mono_error_ok (&error);
      if (D.20936 == 0) goto <D.20937>; else goto <D.20938>;
      <D.20937>:
      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.20938>:
      D.20939 = ensure_directory_exists (shadow);
      if (D.20939 == 0) goto <D.20940>; else goto <D.20941>;
      <D.20940>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy (ensure directory exists).");
      mono_raise_exception (exc);
      <D.20941>:
      D.20942 = private_file_needs_copying (filename, &src_sbuf, shadow);
      if (D.20942 == 0) goto <D.20943>; else goto <D.20944>;
      <D.20943>:
      D.20929 = shadow;
      return D.20929;
      <D.20944>:
      D.20945 = __strlen_g (filename);
      D.20946 = (long int) D.20945;
      orig = monoeg_g_utf8_to_utf16 (filename, D.20946, 0B, 0B, 0B);
      D.20947 = __strlen_g (shadow);
      D.20948 = (long int) D.20947;
      dest = monoeg_g_utf8_to_utf16 (shadow, D.20948, 0B, 0B, 0B);
      DeleteFile (dest);
      attrs = GetFileAttributes (orig);
      if (attrs == 4294967295) goto <D.20949>; else goto <D.20950>;
      <D.20949>:
      monoeg_g_free (shadow);
      D.20929 = filename;
      return D.20929;
      <D.20950>:
      copy_result = CopyFile (orig, dest, 0);
      if (copy_result != 0) goto <D.20951>; else goto <D.20952>;
      <D.20951>:
      copy_result = SetFileAttributes (dest, 128);
      <D.20952>:
      monoeg_g_free (dest);
      monoeg_g_free (orig);
      if (copy_result == 0) goto <D.20953>; else goto <D.20954>;
      <D.20953>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy (CopyFile).");
      mono_raise_exception (exc);
      <D.20954>:
      sibling_source = monoeg_g_strconcat (filename, ".config", 0B);
      D.20955 = __strlen_g (sibling_source);
      sibling_source_len = (gint) D.20955;
      sibling_target = monoeg_g_strconcat (shadow, ".config", 0B);
      D.20956 = __strlen_g (sibling_target);
      sibling_target_len = (gint) D.20956;
      copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".mdb", sibling_target, sibling_target_len, 7);
      if (copy_result == 1) goto <D.20957>; else goto <D.20958>;
      <D.20957>:
      copy_result = shadow_copy_sibling (sibling_source, sibling_source_len, ".config", sibling_target, sibling_target_len, 7);
      <D.20958>:
      monoeg_g_free (sibling_source);
      monoeg_g_free (sibling_target);
      if (copy_result == 0) goto <D.20959>; else goto <D.20960>;
      <D.20959>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy of sibling data (CopyFile).");
      mono_raise_exception (exc);
      <D.20960>:
      D.20961 = shadow_copy_create_ini (shadow, filename);
      if (D.20961 == 0) goto <D.20962>; else goto <D.20963>;
      <D.20962>:
      monoeg_g_free (shadow);
      exc = mono_get_exception_execution_engine ("Failed to create shadow copy .ini file.");
      mono_raise_exception (exc);
      <D.20963>:
      D.20964 = src_sbuf.st_atim.tv_sec;
      utbuf.actime = D.20964;
      D.20965 = src_sbuf.st_mtim.tv_sec;
      utbuf.modtime = D.20965;
      utime (shadow, &utbuf);
      D.20929 = shadow;
      return D.20929;
    }
  finally
    {
      error = {CLOBBER};
      src_sbuf = {CLOBBER};
      utbuf = {CLOBBER};
    }
}


get_shadow_assembly_location (const char * filename, struct MonoError * error)
{
  int D.20968;
  int D.20969;
  int D.20970;
  char * D.20973;
  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.20968 = hash ^ hash2;
      D.20969 = domain->shadow_serial;
      monoeg_g_snprintf (&path_hash, 30, "%08x_%08x_%08x", D.20968, hash2, D.20969);
      tmploc = get_shadow_assembly_location_base (domain, error);
      D.20970 = mono_error_ok (error);
      if (D.20970 == 0) goto <D.20971>; else goto <D.20972>;
      <D.20971>:
      monoeg_g_free (bname);
      monoeg_g_free (dirname);
      D.20973 = 0B;
      return D.20973;
      <D.20972>:
      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.20973 = location;
      return D.20973;
    }
  finally
    {
      name_hash = {CLOBBER};
      path_hash = {CLOBBER};
    }
}


get_cstring_hash (const char * str)
{
  char D.20979;
  gint32 D.20980;
  long unsigned int D.20981;
  int D.20982;
  int D.20983;
  char D.20984;
  int D.20985;
  int len;
  int i;
  const char * p;
  gint32 h;

  h = 0;
  if (str == 0B) goto <D.20976>; else goto <D.20978>;
  <D.20978>:
  D.20979 = *str;
  if (D.20979 == 0) goto <D.20976>; else goto <D.20977>;
  <D.20976>:
  D.20980 = 0;
  return D.20980;
  <D.20977>:
  D.20981 = __strlen_g (str);
  len = (int) D.20981;
  p = str;
  i = 0;
  goto <D.19678>;
  <D.19677>:
  D.20982 = h << 5;
  D.20983 = D.20982 - h;
  D.20984 = *p;
  D.20985 = (int) D.20984;
  h = D.20983 + D.20985;
  p = p + 1;
  i = i + 1;
  <D.19678>:
  if (i < len) goto <D.19677>; else goto <D.19679>;
  <D.19679>:
  D.20980 = h;
  return D.20980;
}


ensure_directory_exists (const char * filename)
{
  char D.20990;
  gboolean D.20991;
  int D.20992;
  unsigned int D.20995;
  unsigned int D.20996;
  char D.20999;
  int * D.21004;
  int D.21005;
  char * p.33;
  char * p;
  gchar * dir;
  int retval;
  struct stat sbuf;

  try
    {
      dir = monoeg_g_path_get_dirname (filename);
      if (dir == 0B) goto <D.20987>; else goto <D.20989>;
      <D.20989>:
      D.20990 = *dir;
      if (D.20990 == 0) goto <D.20987>; else goto <D.20988>;
      <D.20987>:
      monoeg_g_free (dir);
      D.20991 = 0;
      return D.20991;
      <D.20988>:
      D.20992 = stat (dir, &sbuf);
      if (D.20992 == 0) goto <D.20993>; else goto <D.20994>;
      <D.20993>:
      D.20995 = sbuf.st_mode;
      D.20996 = D.20995 & 61440;
      if (D.20996 == 16384) goto <D.20997>; else goto <D.20998>;
      <D.20997>:
      monoeg_g_free (dir);
      D.20991 = 1;
      return D.20991;
      <D.20998>:
      <D.20994>:
      p = dir;
      goto <D.19714>;
      <D.19713>:
      p = p + 1;
      <D.19714>:
      D.20999 = *p;
      if (D.20999 == 47) goto <D.19713>; else goto <D.19715>;
      <D.19715>:
      <D.19717>:
      p = __builtin_strchr (p, 47);
      if (p != 0B) goto <D.21000>; else goto <D.21001>;
      <D.21000>:
      *p = 0;
      <D.21001>:
      retval = mkdir (dir, 511);
      if (retval != 0) goto <D.21002>; else goto <D.21003>;
      <D.21002>:
      D.21004 = __errno_location ();
      D.21005 = *D.21004;
      if (D.21005 != 17) goto <D.21006>; else goto <D.21007>;
      <D.21006>:
      monoeg_g_free (dir);
      D.20991 = 0;
      return D.20991;
      <D.21007>:
      <D.21003>:
      if (p == 0B) goto <D.19716>; else goto <D.21008>;
      <D.21008>:
      p.33 = p;
      p = p.33 + 1;
      *p.33 = 47;
      goto <D.19717>;
      <D.19716>:
      monoeg_g_free (dir);
      D.20991 = 1;
      return D.20991;
    }
  finally
    {
      sbuf = {CLOBBER};
    }
}


__attribute__((__gnu_inline__, __leaf__, __nothrow__))
stat (const char * __path, struct stat * __statbuf)
{
  int D.21012;

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


private_file_needs_copying (const char * src, struct stat * sbuf_src, char * dest)
{
  int D.21017;
  gboolean D.21022;
  int D.21025;
  long int D.21028;
  long int D.21029;
  long int D.21032;
  long int D.21033;
  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.21014>; else goto <D.21015>;
      <D.21014>:
      stat_src = src;
      goto <D.21016>;
      <D.21015>:
      stat_src = real_src;
      <D.21016>:
      D.21017 = stat (stat_src, sbuf_src);
      if (D.21017 == -1) goto <D.21018>; else goto <D.21019>;
      <D.21018>:
      {
        time_t tnow;

        tnow = time (0B);
        if (real_src != 0B) goto <D.21020>; else goto <D.21021>;
        <D.21020>:
        monoeg_g_free (real_src);
        <D.21021>:
        memset (sbuf_src, 0, 144);
        sbuf_src->st_mtim.tv_sec = tnow;
        sbuf_src->st_atim.tv_sec = tnow;
        D.21022 = 1;
        return D.21022;
      }
      <D.21019>:
      if (real_src != 0B) goto <D.21023>; else goto <D.21024>;
      <D.21023>:
      monoeg_g_free (real_src);
      <D.21024>:
      D.21025 = stat (dest, &sbuf_dest);
      if (D.21025 == -1) goto <D.21026>; else goto <D.21027>;
      <D.21026>:
      D.21022 = 1;
      return D.21022;
      <D.21027>:
      D.21028 = sbuf_src->st_size;
      D.21029 = sbuf_dest.st_size;
      if (D.21028 == D.21029) goto <D.21030>; else goto <D.21031>;
      <D.21030>:
      D.21032 = sbuf_src->st_mtim.tv_sec;
      D.21033 = sbuf_dest.st_mtim.tv_sec;
      if (D.21032 == D.21033) goto <D.21034>; else goto <D.21035>;
      <D.21034>:
      D.21022 = 0;
      return D.21022;
      <D.21035>:
      <D.21031>:
      D.21022 = 1;
      return D.21022;
    }
  finally
    {
      sbuf_dest = {CLOBBER};
    }
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memset (void * __dest, int __ch, size_t __len)
{
  void * D.21038;
  long unsigned int D.21039;

  D.21039 = __builtin_object_size (__dest, 0);
  D.21038 = __builtin___memset_chk (__dest, __ch, __len, D.21039);
  return D.21038;
}


shadow_copy_sibling (gchar * src, gint srclen, const char * extension, gchar * target, gint targetlen, gint tail_len)
{
  sizetype D.21041;
  sizetype D.21042;
  sizetype D.21043;
  gchar * D.21044;
  int __mono_io_portability_helpers.34;
  int D.21046;
  gboolean D.21051;
  int D.21053;
  long unsigned int D.21056;
  long int D.21057;
  sizetype D.21058;
  sizetype D.21059;
  gchar * D.21060;
  long unsigned int D.21061;
  long int D.21062;
  guint16 * orig;
  guint16 * dest;
  gboolean copy_result;

  D.21041 = (sizetype) srclen;
  D.21042 = (sizetype) tail_len;
  D.21043 = D.21041 - D.21042;
  D.21044 = src + D.21043;
  strcpy (D.21044, extension);
  __mono_io_portability_helpers.34 = __mono_io_portability_helpers;
  D.21046 = __mono_io_portability_helpers.34 & 4;
  if (D.21046 != 0) goto <D.21047>; else goto <D.21048>;
  <D.21047>:
  {
    gchar * file;

    file = mono_portability_find_file (src, 1);
    if (file == 0B) goto <D.21049>; else goto <D.21050>;
    <D.21049>:
    D.21051 = 1;
    return D.21051;
    <D.21050>:
    monoeg_g_free (file);
  }
  goto <D.21052>;
  <D.21048>:
  D.21053 = monoeg_g_file_test (src, 1);
  if (D.21053 == 0) goto <D.21054>; else goto <D.21055>;
  <D.21054>:
  D.21051 = 1;
  return D.21051;
  <D.21055>:
  <D.21052>:
  D.21056 = __strlen_g (src);
  D.21057 = (long int) D.21056;
  orig = monoeg_g_utf8_to_utf16 (src, D.21057, 0B, 0B, 0B);
  D.21058 = (sizetype) targetlen;
  D.21042 = (sizetype) tail_len;
  D.21059 = D.21058 - D.21042;
  D.21060 = target + D.21059;
  strcpy (D.21060, extension);
  D.21061 = __strlen_g (target);
  D.21062 = (long int) D.21061;
  dest = monoeg_g_utf8_to_utf16 (target, D.21062, 0B, 0B, 0B);
  DeleteFile (dest);
  copy_result = CopyFile (orig, dest, 0);
  if (copy_result != 0) goto <D.21063>; else goto <D.21064>;
  <D.21063>:
  copy_result = SetFileAttributes (dest, 128);
  <D.21064>:
  monoeg_g_free (orig);
  monoeg_g_free (dest);
  D.21051 = copy_result;
  return D.21051;
}


shadow_copy_create_ini (const char * shadow, const char * filename)
{
  int D.21066;
  gboolean D.21069;
  long unsigned int D.21070;
  long int D.21071;
  long unsigned int D.21076;
  unsigned int D.21077;
  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.21066 = monoeg_g_file_test (ini_file, 1);
      if (D.21066 != 0) goto <D.21067>; else goto <D.21068>;
      <D.21067>:
      monoeg_g_free (ini_file);
      D.21069 = 1;
      return D.21069;
      <D.21068>:
      D.21070 = __strlen_g (ini_file);
      D.21071 = (long int) D.21070;
      u16_ini = monoeg_g_utf8_to_utf16 (ini_file, D.21071, 0B, 0B, 0B);
      monoeg_g_free (ini_file);
      if (u16_ini == 0B) goto <D.21072>; else goto <D.21073>;
      <D.21072>:
      D.21069 = 0;
      return D.21069;
      <D.21073>:
      handle = CreateFile (u16_ini, 1073741824, 3, 0B, 1, 128, 0B);
      monoeg_g_free (u16_ini);
      if (handle == -1B) goto <D.21074>; else goto <D.21075>;
      <D.21074>:
      D.21069 = 0;
      return D.21069;
      <D.21075>:
      full_path = mono_path_resolve_symlinks (filename);
      D.21076 = __strlen_g (full_path);
      D.21077 = (unsigned int) D.21076;
      result = WriteFile (handle, full_path, D.21077, &n, 0B);
      monoeg_g_free (full_path);
      CloseHandle (handle);
      D.21069 = result;
      return D.21069;
    }
  finally
    {
      n = {CLOBBER};
    }
}


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

  if (appdomain == 0B) goto <D.21080>; else goto <D.21081>;
  <D.21080>:
  D.21082 = 0B;
  return D.21082;
  <D.21081>:
  D.21082 = appdomain->data;
  return D.21082;
}


__attribute__((visibility ("hidden")))
ves_icall_System_Reflection_Assembly_LoadFrom (struct MonoString * fname, MonoBoolean refOnly)
{
  int D.21086;
  <unnamed type> status.35;
  struct MonoReflectionAssembly * D.21093;
  struct MonoDomain * domain;
  char * name;
  char * filename;
  MonoImageOpenStatus status;
  struct MonoAssembly * ass;

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

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

        status.35 = status;
        if (status.35 == 3) goto <D.21090>; else goto <D.21091>;
        <D.21090>:
        exc = mono_get_exception_bad_image_format2 (0B, fname);
        goto <D.21092>;
        <D.21091>:
        exc = mono_get_exception_file_not_found2 (0B, fname);
        <D.21092>:
        monoeg_g_free (name);
        mono_raise_exception (exc);
      }
      <D.21088>:
      monoeg_g_free (name);
      D.21093 = mono_assembly_get_object (domain, ass);
      return D.21093;
    }
  finally
    {
      status = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
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.21096;
  char * D.21097;
  int D.21098;
  struct MonoException * D.21101;
  struct MonoReflectionAssembly * D.21102;
  char * D.21105;
  long unsigned int D.21106;
  int D.21107;
  struct MonoException * D.21110;
  struct MonoObject * * D.21111;
  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.21096 = mono_array_length (raw_assembly);
      raw_assembly_len = (guint32) D.21096;
      D.21097 = mono_array_addr_with_size (raw_assembly, 1, 0);
      D.21098 = (int) refonly;
      image = mono_image_open_from_data_full (D.21097, raw_assembly_len, 1, 0B, D.21098);
      if (image == 0B) goto <D.21099>; else goto <D.21100>;
      <D.21099>:
      D.21101 = mono_get_exception_bad_image_format ("");
      mono_raise_exception (D.21101);
      D.21102 = 0B;
      return D.21102;
      <D.21100>:
      if (raw_symbol_store != 0B) goto <D.21103>; else goto <D.21104>;
      <D.21103>:
      D.21105 = mono_array_addr_with_size (raw_symbol_store, 1, 0);
      D.21106 = mono_array_length (raw_symbol_store);
      D.21107 = (int) D.21106;
      mono_debug_open_image_from_memory (image, D.21105, D.21107);
      <D.21104>:
      D.21098 = (int) refonly;
      ass = mono_assembly_load_from_full (image, "", &status, D.21098);
      if (ass == 0B) goto <D.21108>; else goto <D.21109>;
      <D.21108>:
      mono_image_close (image);
      D.21110 = mono_get_exception_bad_image_format ("");
      mono_raise_exception (D.21110);
      D.21102 = 0B;
      return D.21102;
      <D.21109>:
      refass = mono_assembly_get_object (domain, ass);
      D.21111 = &refass->evidence;
      mono_gc_wbarrier_set_field (refass, D.21111, evidence);
      D.21102 = refass;
      return D.21102;
    }
  finally
    {
      status = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_LoadAssembly (struct MonoAppDomain * ad, struct MonoString * assRef, struct MonoObject * evidence, MonoBoolean refOnly)
{
  _Bool D.21114;
  long int D.21115;
  long int D.21116;
  int D.21123;
  struct MonoReflectionAssembly * D.21124;
  struct MonoObject * * D.21134;
  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.21114 = assRef == 0B;
      D.21115 = (long int) D.21114;
      D.21116 = __builtin_expect (D.21115, 0);
      if (D.21116 != 0) goto <D.21117>; else goto <D.21118>;
      <D.21117>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 1951, "assRef != NULL");
      <D.21118>:
      name = mono_string_to_utf8 (assRef);
      parsed = mono_assembly_name_parse (name, &aname);
      monoeg_g_free (name);
      if (parsed == 0) goto <D.21119>; else goto <D.21120>;
      <D.21119>:
      if (refOnly == 0) goto <D.21121>; else goto <D.21122>;
      <D.21121>:
      D.21123 = (int) refOnly;
      refass = mono_try_assembly_resolve (domain, assRef, D.21123);
      <D.21122>:
      D.21124 = refass;
      return D.21124;
      <D.21120>:
      D.21123 = (int) refOnly;
      ass = mono_assembly_load_full_nosearch (&aname, 0B, &status, D.21123);
      mono_assembly_name_free (&aname);
      if (ass == 0B) goto <D.21125>; else goto <D.21126>;
      <D.21125>:
      if (refOnly == 0) goto <D.21127>; else goto <D.21128>;
      <D.21127>:
      D.21123 = (int) refOnly;
      refass = mono_try_assembly_resolve (domain, assRef, D.21123);
      goto <D.21129>;
      <D.21128>:
      refass = 0B;
      <D.21129>:
      if (refass == 0B) goto <D.21130>; else goto <D.21131>;
      <D.21130>:
      D.21124 = 0B;
      return D.21124;
      <D.21131>:
      <D.21126>:
      if (refass == 0B) goto <D.21132>; else goto <D.21133>;
      <D.21132>:
      refass = mono_assembly_get_object (domain, ass);
      <D.21133>:
      D.21134 = &refass->evidence;
      mono_gc_wbarrier_set_field (refass, D.21134, evidence);
      D.21124 = refass;
      return D.21124;
    }
  finally
    {
      status = {CLOBBER};
      aname = {CLOBBER};
    }
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalUnload (gint32 domain_id)
{
  struct MonoDomain * D.21139;
  struct MonoException * D.21142;
  const gchar * D.21143;
  struct MonoDomain * domain;

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

    exc = mono_get_exception_execution_engine ("Failed to unload domain, domain id not found");
    mono_raise_exception (exc);
  }
  <D.21138>:
  D.21139 = mono_get_root_domain ();
  if (D.21139 == domain) goto <D.21140>; else goto <D.21141>;
  <D.21140>:
  D.21142 = mono_get_exception_cannot_unload_appdomain ("The default appdomain can not be unloaded.");
  mono_raise_exception (D.21142);
  return;
  <D.21141>:
  D.21143 = monoeg_g_getenv ("MONO_NO_UNLOAD");
  if (D.21143 != 0B) goto <D.21144>; else goto <D.21145>;
  <D.21144>:
  return;
  <D.21145>:
  mono_domain_unload (domain);
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id)
{
  gboolean D.21149;
  struct MonoDomain * domain;

  domain = mono_domain_get_by_id (domain_id);
  if (domain == 0B) goto <D.21147>; else goto <D.21148>;
  <D.21147>:
  D.21149 = 1;
  return D.21149;
  <D.21148>:
  D.21149 = mono_domain_is_unloading (domain);
  return D.21149;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_ExecuteAssembly (struct MonoAppDomain * ad, struct MonoReflectionAssembly * refass, struct MonoArray * args)
{
  _Bool D.21151;
  long int D.21152;
  long int D.21153;
  struct MonoAssembly * D.21156;
  _Bool D.21157;
  long int D.21158;
  long int D.21159;
  unsigned int D.21162;
  char * D.21165;
  struct MonoDomain * D.21168;
  struct MonoClass * D.21169;
  gint32 D.21170;
  struct MonoImage * image;
  struct MonoMethod * method;

  D.21151 = refass == 0B;
  D.21152 = (long int) D.21151;
  D.21153 = __builtin_expect (D.21152, 0);
  if (D.21153 != 0) goto <D.21154>; else goto <D.21155>;
  <D.21154>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2035, "refass");
  <D.21155>:
  D.21156 = refass->assembly;
  image = D.21156->image;
  D.21157 = image == 0B;
  D.21158 = (long int) D.21157;
  D.21159 = __builtin_expect (D.21158, 0);
  if (D.21159 != 0) goto <D.21160>; else goto <D.21161>;
  <D.21160>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2037, "image");
  <D.21161>:
  D.21162 = mono_image_get_entry_point (image);
  method = mono_get_method (image, D.21162, 0B);
  if (method == 0B) goto <D.21163>; else goto <D.21164>;
  <D.21163>:
  D.21165 = image->name;
  monoeg_g_log (0B, 4, "No entry point method found in %s", D.21165);
  <D.19880>:
  goto <D.19880>;
  <D.21164>:
  if (args == 0B) goto <D.21166>; else goto <D.21167>;
  <D.21166>:
  D.21168 = ad->data;
  D.21169 = mono_defaults.string_class;
  args = mono_array_new (D.21168, D.21169, 0);
  <D.21167>:
  D.21170 = mono_runtime_exec_main (method, args, 0B);
  return D.21170;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_GetIDFromDomain (struct MonoAppDomain * ad)
{
  gint32 D.21172;
  struct MonoDomain * D.21173;

  D.21173 = ad->data;
  D.21172 = D.21173->domain_id;
  return D.21172;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalSetDomain (struct MonoAppDomain * ad)
{
  struct MonoDomain * D.21175;
  int D.21176;
  struct MonoException * D.21179;
  struct MonoAppDomain * D.21180;
  struct MonoDomain * old_domain;

  old_domain = mono_domain_get ();
  D.21175 = ad->data;
  D.21176 = mono_domain_set (D.21175, 0);
  if (D.21176 == 0) goto <D.21177>; else goto <D.21178>;
  <D.21177>:
  D.21179 = mono_get_exception_appdomain_unloaded ();
  mono_raise_exception (D.21179);
  <D.21178>:
  D.21180 = old_domain->domain;
  return D.21180;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid)
{
  int D.21185;
  struct MonoException * D.21186;
  struct MonoAppDomain * D.21187;
  struct MonoDomain * current_domain;
  struct MonoDomain * domain;

  current_domain = mono_domain_get ();
  domain = mono_domain_get_by_id (domainid);
  if (domain == 0B) goto <D.21182>; else goto <D.21184>;
  <D.21184>:
  D.21185 = mono_domain_set (domain, 0);
  if (D.21185 == 0) goto <D.21182>; else goto <D.21183>;
  <D.21182>:
  D.21186 = mono_get_exception_appdomain_unloaded ();
  mono_raise_exception (D.21186);
  <D.21183>:
  D.21187 = current_domain->domain;
  return D.21187;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalPushDomainRef (struct MonoAppDomain * ad)
{
  struct MonoDomain * D.21189;

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


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id)
{
  struct MonoException * D.21192;
  struct MonoDomain * domain;

  domain = mono_domain_get_by_id (domain_id);
  if (domain == 0B) goto <D.21190>; else goto <D.21191>;
  <D.21190>:
  D.21192 = mono_get_exception_appdomain_unloaded ();
  mono_raise_exception (D.21192);
  <D.21191>:
  mono_thread_push_appdomain_ref (domain);
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalPopDomainRef ()
{
  mono_thread_pop_appdomain_ref ();
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalGetContext ()
{
  struct MonoAppContext * D.21193;

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


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalGetDefaultContext ()
{
  struct MonoAppContext * D.21195;
  struct MonoDomain * D.21196;

  D.21196 = mono_domain_get ();
  D.21195 = D.21196->default_context;
  return D.21195;
}


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalSetContext (struct MonoAppContext * mc)
{
  struct MonoAppContext * D.21198;
  struct MonoAppContext * old_context;

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


__attribute__((visibility ("hidden")))
ves_icall_System_AppDomain_InternalGetProcessGuid (struct MonoString * newguid)
{
  union mono_mutex_t * D.21200;
  _Bool D.21203;
  long int D.21204;
  long int D.21205;
  int process_guid_set.36;
  _Bool D.21213;
  long int D.21214;
  long int D.21215;
  struct MonoString * D.21218;
  struct MonoDomain * D.21219;
  mono_unichar2 * D.21220;
  _Bool D.21223;
  long int D.21224;
  long int D.21225;
  struct MonoDomain * mono_root_domain;

  mono_root_domain = mono_get_root_domain ();
  {
    int ret;

    D.21200 = &mono_root_domain->lock.mutex;
    ret = pthread_mutex_lock (D.21200);
    if (ret != 0) goto <D.21201>; else goto <D.21202>;
    <D.21201>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21202>:
    D.21203 = ret != 0;
    D.21204 = (long int) D.21203;
    D.21205 = __builtin_expect (D.21204, 0);
    if (D.21205 != 0) goto <D.21206>; else goto <D.21207>;
    <D.21206>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2150, "ret == 0");
    <D.21207>:
  }
  process_guid_set.36 = process_guid_set;
  if (process_guid_set.36 != 0) goto <D.21209>; else goto <D.21210>;
  <D.21209>:
  {
    int ret;

    D.21200 = &mono_root_domain->lock.mutex;
    ret = pthread_mutex_unlock (D.21200);
    if (ret != 0) goto <D.21211>; else goto <D.21212>;
    <D.21211>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21212>:
    D.21213 = ret != 0;
    D.21214 = (long int) D.21213;
    D.21215 = __builtin_expect (D.21214, 0);
    if (D.21215 != 0) goto <D.21216>; else goto <D.21217>;
    <D.21216>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2152, "ret == 0");
    <D.21217>:
  }
  D.21219 = mono_domain_get ();
  D.21218 = mono_string_new_utf16 (D.21219, &process_guid, 36);
  return D.21218;
  <D.21210>:
  D.21220 = mono_string_chars (newguid);
  memcpy (&process_guid, D.21220, 72);
  process_guid_set = 1;
  {
    int ret;

    D.21200 = &mono_root_domain->lock.mutex;
    ret = pthread_mutex_unlock (D.21200);
    if (ret != 0) goto <D.21221>; else goto <D.21222>;
    <D.21221>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21222>:
    D.21223 = ret != 0;
    D.21224 = (long int) D.21223;
    D.21225 = __builtin_expect (D.21224, 0);
    if (D.21225 != 0) goto <D.21226>; else goto <D.21227>;
    <D.21226>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2157, "ret == 0");
    <D.21227>:
  }
  D.21218 = newguid;
  return D.21218;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
memcpy (void * restrict __dest, const void * restrict __src, size_t __len)
{
  void * D.21229;
  long unsigned int D.21230;

  D.21230 = __builtin_object_size (__dest, 0);
  D.21229 = __builtin___memcpy_chk (__dest, __src, __len, D.21230);
  return D.21229;
}


mono_domain_is_unloading (struct MonoDomain * domain)
{
  unsigned int D.21232;
  unsigned int D.21233;
  mono_bool D.21236;

  D.21232 = domain->state;
  D.21233 = D.21232 + 4294967294;
  if (D.21233 <= 1) goto <D.21234>; else goto <D.21235>;
  <D.21234>:
  D.21236 = 1;
  return D.21236;
  <D.21235>:
  D.21236 = 0;
  return D.21236;
}


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

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


mono_domain_try_unload (struct MonoDomain * domain, struct MonoObject * * exc)
{
  guint32 * D.21241;
  int D.21242;
  struct MonoException * D.21245;
  struct MonoException * D.21246;
  struct MonoAppDomain * D.21247;
  struct MonoVTable * D.21248;
  struct MonoClass * D.21249;
  _Bool D.21250;
  long int D.21251;
  long int D.21252;
  struct MonoObject * D.21255;
  struct MonoInternalThread * D.21260;
  int D.21261;
  int D.21264;
  int D.21267;
  unsigned int D.21269;
  char * D.21270;
  struct MonoException * D.21273;
  void * thread_handle;
  MonoAppDomainState prev_state;
  struct MonoMethod * method;
  struct unload_data * thread_data;
  struct MonoDomain * caller_domain;

  caller_domain = mono_domain_get ();
  D.21241 = &domain->state;
  D.21242 = InterlockedCompareExchange (D.21241, 1, 0);
  prev_state = (MonoAppDomainState) D.21242;
  if (prev_state != 0) goto <D.21243>; else goto <D.21244>;
  <D.21243>:
  switch (prev_state) <default: <D.20002>, case 1: <D.19999>, case 2: <D.20000>, case 3: <D.20001>>
  <D.19999>:
  <D.20000>:
  D.21245 = mono_get_exception_cannot_unload_appdomain ("Appdomain is already being unloaded.");
  *exc = D.21245;
  return;
  <D.20001>:
  D.21246 = mono_get_exception_cannot_unload_appdomain ("Appdomain is already unloaded.");
  *exc = D.21246;
  return;
  <D.20002>:
  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.21244>:
  mono_domain_set (domain, 0);
  D.21247 = domain->domain;
  D.21248 = D.21247->mbr.obj.vtable;
  D.21249 = D.21248->klass;
  method = mono_class_get_method_from_name (D.21249, "DoDomainUnload", -1);
  D.21250 = method == 0B;
  D.21251 = (long int) D.21250;
  D.21252 = __builtin_expect (D.21251, 0);
  if (D.21252 != 0) goto <D.21253>; else goto <D.21254>;
  <D.21253>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2416, "method");
  <D.21254>:
  D.21247 = domain->domain;
  mono_runtime_invoke (method, D.21247, 0B, exc);
  D.21255 = *exc;
  if (D.21255 != 0B) goto <D.21256>; else goto <D.21257>;
  <D.21256>:
  domain->state = 0;
  mono_domain_set (caller_domain, 0);
  return;
  <D.21257>:
  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.21258>; else goto <D.21259>;
  <D.21258>:
  return;
  <D.21259>:
  ResumeThread (thread_handle);
  goto <D.20004>;
  <D.20003>:
  D.21260 = mono_thread_internal_current ();
  D.21261 = mono_thread_internal_has_appdomain_ref (D.21260, domain);
  if (D.21261 != 0) goto <D.21262>; else goto <D.21263>;
  <D.21262>:
  D.21264 = mono_thread_interruption_requested ();
  if (D.21264 != 0) goto <D.21265>; else goto <D.21266>;
  <D.21265>:
  CloseHandle (thread_handle);
  unload_data_unref (thread_data);
  return;
  <D.21266>:
  <D.21263>:
  <D.20004>:
  D.21267 = thread_data->done;
  if (D.21267 == 0) goto <D.21268>; else goto <D.20005>;
  <D.21268>:
  D.21269 = WaitForSingleObjectEx (thread_handle, 4294967295, 1);
  if (D.21269 == 192) goto <D.20003>; else goto <D.20005>;
  <D.20005>:
  CloseHandle (thread_handle);
  D.21270 = thread_data->failure_reason;
  if (D.21270 != 0B) goto <D.21271>; else goto <D.21272>;
  <D.21271>:
  domain->state = 0;
  D.21270 = thread_data->failure_reason;
  monoeg_g_log (0B, 16, "%s", D.21270);
  D.21270 = thread_data->failure_reason;
  D.21273 = mono_get_exception_cannot_unload_appdomain (D.21270);
  *exc = D.21273;
  D.21270 = thread_data->failure_reason;
  monoeg_g_free (D.21270);
  thread_data->failure_reason = 0B;
  <D.21272>:
  unload_data_unref (thread_data);
}


unload_thread_main (void * arg)
{
  struct MonoDomain * D.21275;
  int D.21276;
  char * D.21279;
  gchar * D.21280;
  int D.21281;
  gchar * D.21284;
  int D.21285;
  gchar * D.21288;
  union mono_mutex_t * D.21289;
  _Bool D.21292;
  long int D.21293;
  long int D.21294;
  struct GPtrArray * D.21297;
  void * * D.21298;
  long unsigned int D.21299;
  long unsigned int D.21300;
  void * * D.21301;
  void * D.21302;
  unsigned int D.21303;
  unsigned int i.38;
  int D.21305;
  unsigned int D.21306;
  _Bool D.21309;
  long int D.21310;
  long int D.21311;
  int D.21314;
  guint32 D.21315;
  struct unload_data * data;
  struct MonoDomain * domain;
  struct MonoThread * thread;
  int i;
  void failure = <<< error >>>;

  data = arg;
  domain = data->domain;
  D.21275 = mono_get_root_domain ();
  thread = mono_thread_attach_full (D.21275, 1);
  D.21276 = mono_threads_abort_appdomain_threads (domain, -1);
  if (D.21276 == 0) goto <D.21277>; else goto <D.21278>;
  <D.21277>:
  D.21279 = domain->friendly_name;
  D.21280 = monoeg_g_strdup_printf ("Aborting of threads in domain %s timed out.", D.21279);
  data->failure_reason = D.21280;
  goto failure;
  <D.21278>:
  D.21281 = mono_thread_pool_remove_domain_jobs (domain, -1);
  if (D.21281 == 0) goto <D.21282>; else goto <D.21283>;
  <D.21282>:
  D.21279 = domain->friendly_name;
  D.21284 = monoeg_g_strdup_printf ("Cleanup of threadpool jobs of domain %s timed out.", D.21279);
  data->failure_reason = D.21284;
  goto failure;
  <D.21283>:
  D.21285 = mono_domain_finalize (domain, 4294967295);
  if (D.21285 == 0) goto <D.21286>; else goto <D.21287>;
  <D.21286>:
  D.21279 = domain->friendly_name;
  D.21288 = monoeg_g_strdup_printf ("Finalization of domain %s timed out.", D.21279);
  data->failure_reason = D.21288;
  goto failure;
  <D.21287>:
  mono_loader_lock ();
  {
    int ret;

    D.21289 = &domain->lock.mutex;
    ret = pthread_mutex_lock (D.21289);
    if (ret != 0) goto <D.21290>; else goto <D.21291>;
    <D.21290>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21291>:
    D.21292 = ret != 0;
    D.21293 = (long int) D.21292;
    D.21294 = __builtin_expect (D.21293, 0);
    if (D.21294 != 0) goto <D.21295>; else goto <D.21296>;
    <D.21295>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2299, "ret == 0");
    <D.21296>:
  }
  i = 0;
  goto <D.19980>;
  <D.19979>:
  D.21297 = domain->class_vtable_array;
  D.21298 = D.21297->pdata;
  D.21299 = (long unsigned int) i;
  D.21300 = D.21299 * 8;
  D.21301 = D.21298 + D.21300;
  D.21302 = *D.21301;
  zero_static_data (D.21302);
  i = i + 1;
  <D.19980>:
  D.21297 = domain->class_vtable_array;
  D.21303 = D.21297->len;
  i.38 = (unsigned int) i;
  if (D.21303 > i.38) goto <D.19979>; else goto <D.19981>;
  <D.19981>:
  mono_gc_collect (0);
  i = 0;
  goto <D.19983>;
  <D.19982>:
  D.21297 = domain->class_vtable_array;
  D.21298 = D.21297->pdata;
  D.21299 = (long unsigned int) i;
  D.21300 = D.21299 * 8;
  D.21301 = D.21298 + D.21300;
  D.21302 = *D.21301;
  clear_cached_vtable (D.21302);
  i = i + 1;
  <D.19983>:
  D.21297 = domain->class_vtable_array;
  D.21303 = D.21297->len;
  i.38 = (unsigned int) i;
  if (D.21303 > i.38) goto <D.19982>; else goto <D.19984>;
  <D.19984>:
  deregister_reflection_info_roots (domain);
  D.21305 = domain->domain_id;
  D.21306 = (unsigned int) D.21305;
  mono_assembly_cleanup_domain_bindings (D.21306);
  {
    int ret;

    D.21289 = &domain->lock.mutex;
    ret = pthread_mutex_unlock (D.21289);
    if (ret != 0) goto <D.21307>; else goto <D.21308>;
    <D.21307>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21308>:
    D.21309 = ret != 0;
    D.21310 = (long int) D.21309;
    D.21311 = __builtin_expect (D.21310, 0);
    if (D.21311 != 0) goto <D.21312>; else goto <D.21313>;
    <D.21312>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2320, "ret == 0");
    <D.21313>:
  }
  mono_loader_unlock ();
  mono_threads_clear_cached_culture (domain);
  domain->state = 3;
  mono_gchandle_free_domain (domain);
  mono_domain_free (domain, 0);
  D.21314 = mono_gc_max_generation ();
  mono_gc_collect (D.21314);
  data->done = 1;
  unload_data_unref (data);
  mono_thread_detach (thread);
  D.21315 = 0;
  return D.21315;
  failure:
  data->done = 1;
  unload_data_unref (data);
  mono_thread_detach (thread);
  D.21315 = 1;
  return D.21315;
}


__attribute__((__unused__))
zero_static_data (struct MonoVTable * vtable)
{
  long unsigned int D.21317;
  long unsigned int D.21318;
  int D.21323;
  long unsigned int D.21324;
  struct MonoClass * klass;
  void * data;

  klass = vtable->klass;
  D.21317 = BIT_FIELD_REF <*klass, 64, 256>;
  D.21318 = D.21317 & 34359738368;
  if (D.21318 != 0) goto <D.21319>; else goto <D.21320>;
  <D.21319>:
  data = mono_vtable_get_static_field_data (vtable);
  if (data != 0B) goto <D.21321>; else goto <D.21322>;
  <D.21321>:
  D.21323 = mono_class_data_size (klass);
  D.21324 = (long unsigned int) D.21323;
  mono_gc_bzero_aligned (data, D.21324);
  <D.21322>:
  <D.21320>:
}


clear_cached_vtable (struct MonoVTable * vtable)
{
  short unsigned int D.21327;
  int D.21328;
  int D.21329;
  long unsigned int D.21332;
  long unsigned int D.21333;
  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.21325>; else goto <D.21326>;
  <D.21325>:
  D.21327 = runtime_info->max_domain;
  D.21328 = (int) D.21327;
  D.21329 = domain->domain_id;
  if (D.21328 >= D.21329) goto <D.21330>; else goto <D.21331>;
  <D.21330>:
  D.21329 = domain->domain_id;
  runtime_info->domain_vtables[D.21329] = 0B;
  <D.21331>:
  <D.21326>:
  D.21332 = BIT_FIELD_REF <*klass, 64, 256>;
  D.21333 = D.21332 & 34359738368;
  if (D.21333 != 0) goto <D.21334>; else goto <D.21335>;
  <D.21334>:
  data = mono_vtable_get_static_field_data (vtable);
  if (data != 0B) goto <D.21336>; else goto <D.21337>;
  <D.21336>:
  mono_gc_free_fixed (data);
  <D.21337>:
  <D.21335>:
}


deregister_reflection_info_roots (struct MonoDomain * domain)
{
  union mono_mutex_t * D.21338;
  _Bool D.21341;
  long int D.21342;
  long int D.21343;
  long unsigned int D.21346;
  long unsigned int D.21347;
  struct MonoImage * * D.21350;
  long unsigned int D.21351;
  long unsigned int D.21352;
  struct MonoImage * * D.21353;
  long unsigned int D.21356;
  long unsigned int D.21357;
  unsigned int D.21360;
  unsigned int i.39;
  _Bool D.21364;
  long int D.21365;
  long int D.21366;
  struct GSList * list;

  {
    int ret;

    D.21338 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_lock (D.21338);
    if (ret != 0) goto <D.21339>; else goto <D.21340>;
    <D.21339>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.21340>:
    D.21341 = ret != 0;
    D.21342 = (long int) D.21341;
    D.21343 = __builtin_expect (D.21342, 0);
    if (D.21343 != 0) goto <D.21344>; else goto <D.21345>;
    <D.21344>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2237, "ret == 0");
    <D.21345>:
  }
  list = domain->domain_assemblies;
  goto <D.19967>;
  <D.19966>:
  {
    struct MonoAssembly * assembly;
    struct MonoImage * image;
    int i;

    assembly = list->data;
    image = assembly->image;
    D.21346 = BIT_FIELD_REF <*image, 64, 192>;
    D.21347 = D.21346 & 268435456;
    if (D.21347 != 0) goto <D.21348>; else goto <D.21349>;
    <D.21348>:
    deregister_reflection_info_roots_from_list (image);
    <D.21349>:
    i = 0;
    goto <D.19964>;
    <D.19963>:
    {
      struct MonoImage * module;

      D.21350 = image->modules;
      D.21351 = (long unsigned int) i;
      D.21352 = D.21351 * 8;
      D.21353 = D.21350 + D.21352;
      module = *D.21353;
      if (module != 0B) goto <D.21354>; else goto <D.21355>;
      <D.21354>:
      D.21356 = BIT_FIELD_REF <*module, 64, 192>;
      D.21357 = D.21356 & 268435456;
      if (D.21357 != 0) goto <D.21358>; else goto <D.21359>;
      <D.21358>:
      deregister_reflection_info_roots_from_list (module);
      <D.21359>:
      <D.21355>:
    }
    i = i + 1;
    <D.19964>:
    D.21360 = image->module_count;
    i.39 = (unsigned int) i;
    if (D.21360 > i.39) goto <D.19963>; else goto <D.19965>;
    <D.19965>:
  }
  list = list->next;
  <D.19967>:
  if (list != 0B) goto <D.19966>; else goto <D.19968>;
  <D.19968>:
  {
    int ret;

    D.21338 = &domain->assemblies_lock.mutex;
    ret = pthread_mutex_unlock (D.21338);
    if (ret != 0) goto <D.21362>; else goto <D.21363>;
    <D.21362>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.21363>:
    D.21364 = ret != 0;
    D.21365 = (long int) D.21364;
    D.21366 = __builtin_expect (D.21365, 0);
    if (D.21366 != 0) goto <D.21367>; else goto <D.21368>;
    <D.21367>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2258, "ret == 0");
    <D.21368>:
  }
}


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

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

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


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.21369;
  unsigned int comp.40;
  unsigned int exch.41;
  unsigned int D.21372;

  comp.40 = (unsigned int) comp;
  exch.41 = (unsigned int) exch;
  D.21372 = __sync_val_compare_and_swap_4 (dest, comp.40, exch.41);
  D.21369 = (gint32) D.21372;
  return D.21369;
}


unload_data_unref (struct unload_data * data)
{
  unsigned int count.42;
  unsigned int D.21375;
  _Bool D.21376;
  long int D.21377;
  long int D.21378;
  gint32 * D.21383;
  int D.21384;
  int D.21385;
  gint32 count;

  <D.19944>:
  {
    gint32 __tmp;

    __tmp = data->refcount;
    count = __tmp;
  }
  count.42 = (unsigned int) count;
  D.21375 = count.42 + 4294967295;
  D.21376 = D.21375 > 1;
  D.21377 = (long int) D.21376;
  D.21378 = __builtin_expect (D.21377, 0);
  if (D.21378 != 0) goto <D.21379>; else goto <D.21380>;
  <D.21379>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "appdomain.c", 2208, "count >= 1 && count <= 2");
  <D.21380>:
  if (count == 1) goto <D.21381>; else goto <D.21382>;
  <D.21381>:
  monoeg_g_free (data);
  return;
  <D.21382>:
  D.21383 = &data->refcount;
  D.21384 = count + -1;
  D.21385 = InterlockedCompareExchange (D.21383, count, D.21384);
  if (D.21385 != count) goto <D.19944>; else goto <D.19945>;
  <D.19945>:
}


