mono_runtime_set_shutting_down ()
{
  shutting_down = 1;
}


mono_runtime_is_shutting_down ()
{
  mono_bool D.17913;

  D.17913 = shutting_down;
  return D.17913;
}


mono_runtime_try_shutdown ()
{
  int D.17915;
  gboolean D.17918;

  D.17915 = InterlockedCompareExchange (&shutting_down_inited, 1, 0);
  if (D.17915 != 0) goto <D.17916>; else goto <D.17917>;
  <D.17916>:
  D.17918 = 0;
  return D.17918;
  <D.17917>:
  mono_runtime_fire_process_exit_event ();
  shutting_down = 1;
  mono_threads_set_shutting_down ();
  mono_runtime_set_shutting_down ();
  mono_thread_pool_cleanup ();
  D.17918 = 1;
  return D.17918;
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.17920;
  unsigned int comp.0;
  unsigned int exch.1;
  unsigned int D.17923;

  comp.0 = (unsigned int) comp;
  exch.1 = (unsigned int) exch;
  D.17923 = __sync_val_compare_and_swap_4 (dest, comp.0, exch.1);
  D.17920 = (gint32) D.17923;
  return D.17920;
}


mono_runtime_fire_process_exit_event ()
{
  mono_domain_foreach (fire_process_exit_event, 0B);
}


fire_process_exit_event (struct MonoDomain * domain, void * user_data)
{
  struct MonoClass * D.17925;
  _Bool D.17926;
  long int D.17927;
  long int D.17928;
  struct MonoAppDomain * D.17931;
  int D.17932;
  sizetype D.17933;
  struct MonoObject * * D.17934;
  struct MonoClassField * field;
  void * pa[2];
  struct MonoObject * delegate;
  struct MonoObject * exc;

  try
    {
      D.17925 = mono_defaults.appdomain_class;
      field = mono_class_get_field_from_name (D.17925, "ProcessExit");
      D.17926 = field == 0B;
      D.17927 = (long int) D.17926;
      D.17928 = __builtin_expect (D.17927, 0);
      if (D.17928 != 0) goto <D.17929>; else goto <D.17930>;
      <D.17929>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "runtime.c", 64, "field");
      <D.17930>:
      D.17931 = domain->domain;
      D.17932 = field->offset;
      D.17933 = (sizetype) D.17932;
      D.17934 = D.17931 + D.17933;
      delegate = *D.17934;
      if (delegate == 0B) goto <D.17935>; else goto <D.17936>;
      <D.17935>:
      return;
      <D.17936>:
      pa[0] = domain;
      pa[1] = 0B;
      mono_runtime_delegate_invoke (delegate, &pa, &exc);
    }
  finally
    {
      pa = {CLOBBER};
      exc = {CLOBBER};
    }
}


mono_runtime_is_critical_method (struct MonoMethod * method)
{
  int D.17940;
  gboolean D.17943;

  D.17940 = mono_monitor_is_il_fastpath_wrapper (method);
  if (D.17940 != 0) goto <D.17941>; else goto <D.17942>;
  <D.17941>:
  D.17943 = 1;
  return D.17943;
  <D.17942>:
  D.17943 = 0;
  return D.17943;
}


mono_runtime_init_tls ()
{
  mono_marshal_init_tls ();
  mono_thread_pool_init_tls ();
  mono_thread_init_tls ();
}


