mono_runtime_set_shutting_down ()
{
  shutting_down = 1;
}


mono_runtime_is_shutting_down ()
{
  mono_bool D.19584;

  D.19584 = shutting_down;
  return D.19584;
}


mono_runtime_try_shutdown ()
{
  int D.19586;
  gboolean D.19589;

  D.19586 = InterlockedCompareExchange (&shutting_down_inited, 1, 0);
  if (D.19586 != 0) goto <D.19587>; else goto <D.19588>;
  <D.19587>:
  D.19589 = 0;
  return D.19589;
  <D.19588>:
  mono_runtime_fire_process_exit_event ();
  shutting_down = 1;
  mono_threads_set_shutting_down ();
  mono_runtime_set_shutting_down ();
  mono_thread_pool_cleanup ();
  D.19589 = 1;
  return D.19589;
}


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

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


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.19596;
  _Bool D.19597;
  long int D.19598;
  long int D.19599;
  struct MonoAppDomain * D.19602;
  int D.19603;
  sizetype D.19604;
  struct MonoObject * * D.19605;
  struct MonoClassField * field;
  void * pa[2];
  struct MonoObject * delegate;
  struct MonoObject * exc;

  try
    {
      D.19596 = mono_defaults.appdomain_class;
      field = mono_class_get_field_from_name (D.19596, "ProcessExit");
      D.19597 = field == 0B;
      D.19598 = (long int) D.19597;
      D.19599 = __builtin_expect (D.19598, 0);
      if (D.19599 != 0) goto <D.19600>; else goto <D.19601>;
      <D.19600>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "runtime.c", 64, "field");
      <D.19601>:
      D.19602 = domain->domain;
      D.19603 = field->offset;
      D.19604 = (sizetype) D.19603;
      D.19605 = D.19602 + D.19604;
      delegate = *D.19605;
      if (delegate == 0B) goto <D.19606>; else goto <D.19607>;
      <D.19606>:
      return;
      <D.19607>:
      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.19611;
  gboolean D.19614;

  D.19611 = mono_monitor_is_il_fastpath_wrapper (method);
  if (D.19611 != 0) goto <D.19612>; else goto <D.19613>;
  <D.19612>:
  D.19614 = 1;
  return D.19614;
  <D.19613>:
  D.19614 = 0;
  return D.19614;
}


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


