mono_runtime_set_shutting_down ()
{
  shutting_down = 1;
}


mono_runtime_is_shutting_down ()
{
  mono_bool D.17383;

  D.17383 = shutting_down;
  return D.17383;
}


mono_runtime_try_shutdown ()
{
  int D.17385;
  gboolean D.17388;

  D.17385 = InterlockedCompareExchange (&shutting_down_inited, 1, 0);
  if (D.17385 != 0) goto <D.17386>; else goto <D.17387>;
  <D.17386>:
  D.17388 = 0;
  return D.17388;
  <D.17387>:
  mono_runtime_fire_process_exit_event ();
  shutting_down = 1;
  mono_threads_set_shutting_down ();
  mono_runtime_set_shutting_down ();
  mono_thread_pool_cleanup ();
  D.17388 = 1;
  return D.17388;
}


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

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


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.17395;
  _Bool D.17396;
  long int D.17397;
  long int D.17398;
  struct MonoAppDomain * D.17401;
  int D.17402;
  sizetype D.17403;
  struct MonoObject * * D.17404;
  struct MonoClassField * field;
  void * pa[2];
  struct MonoObject * delegate;
  struct MonoObject * exc;

  try
    {
      D.17395 = mono_defaults.appdomain_class;
      field = mono_class_get_field_from_name (D.17395, "ProcessExit");
      D.17396 = field == 0B;
      D.17397 = (long int) D.17396;
      D.17398 = __builtin_expect (D.17397, 0);
      if (D.17398 != 0) goto <D.17399>; else goto <D.17400>;
      <D.17399>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "runtime.c", 64, "field");
      <D.17400>:
      D.17401 = domain->domain;
      D.17402 = field->offset;
      D.17403 = (sizetype) D.17402;
      D.17404 = D.17401 + D.17403;
      delegate = *D.17404;
      if (delegate == 0B) goto <D.17405>; else goto <D.17406>;
      <D.17405>:
      return;
      <D.17406>:
      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.17410;
  gboolean D.17413;

  D.17410 = mono_monitor_is_il_fastpath_wrapper (method);
  if (D.17410 != 0) goto <D.17411>; else goto <D.17412>;
  <D.17411>:
  D.17413 = 1;
  return D.17413;
  <D.17412>:
  D.17413 = 0;
  return D.17413;
}


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


