mono_thread_pool_remove_socket (int sock)
{
  int D.18729;
  _Bool D.18734;
  long int D.18735;
  long int D.18736;
  struct MonoGHashTable * D.18739;
  _Bool D.18744;
  long int D.18745;
  long int D.18746;
  const void * sock.0;
  void * list.1;
  struct MonoMList * list.2;
  _Bool D.18756;
  long int D.18757;
  long int D.18758;
  int D.18761;
  struct MonoMList * list;
  struct MonoSocketAsyncResult * state;
  struct MonoObject * ares;

  try
    {
      D.18729 = socket_io_data.inited;
      if (D.18729 == 0) goto <D.18730>; else goto <D.18731>;
      <D.18730>:
      return;
      <D.18731>:
      {
        int ret;

        ret = pthread_mutex_lock (&socket_io_data.io_lock.mutex);
        if (ret != 0) goto <D.18732>; else goto <D.18733>;
        <D.18732>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.18733>:
        D.18734 = ret != 0;
        D.18735 = (long int) D.18734;
        D.18736 = __builtin_expect (D.18735, 0);
        if (D.18736 != 0) goto <D.18737>; else goto <D.18738>;
        <D.18737>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 446, "ret == 0");
        <D.18738>:
      }
      D.18739 = socket_io_data.sock_to_state;
      if (D.18739 == 0B) goto <D.18740>; else goto <D.18741>;
      <D.18740>:
      {
        int ret;

        ret = pthread_mutex_unlock (&socket_io_data.io_lock.mutex);
        if (ret != 0) goto <D.18742>; else goto <D.18743>;
        <D.18742>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18743>:
        D.18744 = ret != 0;
        D.18745 = (long int) D.18744;
        D.18746 = __builtin_expect (D.18745, 0);
        if (D.18746 != 0) goto <D.18747>; else goto <D.18748>;
        <D.18747>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 448, "ret == 0");
        <D.18748>:
      }
      return;
      <D.18741>:
      sock.0 = (const void *) sock;
      D.18739 = socket_io_data.sock_to_state;
      list.1 = mono_g_hash_table_lookup (D.18739, sock.0);
      list = list.1;
      list.2 = list;
      if (list.2 != 0B) goto <D.18752>; else goto <D.18753>;
      <D.18752>:
      sock.0 = (const void *) sock;
      D.18739 = socket_io_data.sock_to_state;
      mono_g_hash_table_remove (D.18739, sock.0);
      <D.18753>:
      {
        int ret;

        ret = pthread_mutex_unlock (&socket_io_data.io_lock.mutex);
        if (ret != 0) goto <D.18754>; else goto <D.18755>;
        <D.18754>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18755>:
        D.18756 = ret != 0;
        D.18757 = (long int) D.18756;
        D.18758 = __builtin_expect (D.18757, 0);
        if (D.18758 != 0) goto <D.18759>; else goto <D.18760>;
        <D.18759>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 454, "ret == 0");
        <D.18760>:
      }
      goto <D.18352>;
      <D.18351>:
      list.2 = list;
      state = mono_mlist_get_data (list.2);
      D.18761 = state->operation;
      if (D.18761 == 2) goto <D.18762>; else goto <D.18763>;
      <D.18762>:
      state->operation = 6;
      goto <D.18764>;
      <D.18763>:
      D.18761 = state->operation;
      if (D.18761 == 4) goto <D.18765>; else goto <D.18766>;
      <D.18765>:
      state->operation = 7;
      <D.18766>:
      <D.18764>:
      ares = get_io_event (&list, 1);
      threadpool_append_job (&async_io_tp, ares);
      list.2 = list;
      if (list.2 != 0B) goto <D.18767>; else goto <D.18768>;
      <D.18767>:
      ares = get_io_event (&list, 4);
      threadpool_append_job (&async_io_tp, ares);
      <D.18768>:
      <D.18352>:
      list.2 = list;
      if (list.2 != 0B) goto <D.18351>; else goto <D.18353>;
      <D.18353>:
    }
  finally
    {
      list = {CLOBBER};
    }
}


get_io_event (struct MonoMList * * list, gint event)
{
  int D.18772;
  struct MonoMList * D.18778;
  struct MonoMList * D.18780;
  struct MonoMList * D.18781;
  struct MonoObject * D.18782;
  struct MonoObject * state;
  struct MonoMList * current;
  struct MonoMList * prev;

  current = *list;
  prev = 0B;
  state = 0B;
  goto <D.18341>;
  <D.18340>:
  state = mono_mlist_get_data (current);
  D.18772 = get_event_from_state (state);
  if (D.18772 == event) goto <D.18339>; else goto <D.18773>;
  <D.18773>:
  state = 0B;
  prev = current;
  current = mono_mlist_next (current);
  <D.18341>:
  if (current != 0B) goto <D.18340>; else goto <D.18339>;
  <D.18339>:
  if (current != 0B) goto <D.18774>; else goto <D.18775>;
  <D.18774>:
  if (prev != 0B) goto <D.18776>; else goto <D.18777>;
  <D.18776>:
  D.18778 = mono_mlist_next (current);
  mono_mlist_set_next (prev, D.18778);
  goto <D.18779>;
  <D.18777>:
  D.18780 = *list;
  D.18781 = mono_mlist_next (D.18780);
  *list = D.18781;
  <D.18779>:
  <D.18775>:
  D.18782 = state;
  return D.18782;
}


get_event_from_state (struct MonoSocketAsyncResult * state)
{
  int D.18784;
  int D.18785;

  D.18784 = state->operation;
  switch (D.18784) <default: <D.18315>, case 0: <D.18302>, case 1: <D.18312>, case 2: <D.18303>, case 3: <D.18305>, case 4: <D.18309>, case 5: <D.18311>, case 6: <D.18304>, case 7: <D.18310>, case 8: <D.18306>, case 10: <D.18314>, case 11: <D.18307>, case 12: <D.18308>, case 13: <D.18313>>
  <D.18302>:
  <D.18303>:
  <D.18304>:
  <D.18305>:
  <D.18306>:
  <D.18307>:
  <D.18308>:
  D.18785 = 1;
  return D.18785;
  <D.18309>:
  <D.18310>:
  <D.18311>:
  <D.18312>:
  <D.18313>:
  <D.18314>:
  D.18785 = 4;
  return D.18785;
  <D.18315>:
  monoeg_g_log (0B, 32, "get_event_from_state: unknown value in switch!!!");
  D.18785 = 0;
  return D.18785;
}


threadpool_append_job (struct ThreadPool * tp, struct MonoObject * ar)
{
  threadpool_append_jobs (tp, &ar, 1);
}


threadpool_append_jobs (struct ThreadPool * tp, struct MonoObject * * jobs, gint njobs)
{
  int D.18787;
  int D.18790;
  volatile gint * D.18793;
  int D.18794;
  int D.18797;
  struct MonoDomain * D.18800;
  int D.18801;
  struct MonoDomain * D.18804;
  unsigned int i.3;
  unsigned int D.18806;
  struct MonoObject * * D.18807;
  struct MonoVTable * D.18811;
  struct MonoDomain * D.18812;
  int D.18813;
  int D.18816;
  int D.18817;
  long long int D.18820;
  void * D.18821;
  int D.18824;
  struct MonoCQ * D.18827;
  int D.18828;
  int iftmp.4;
  int D.18831;
  static int job_counter;
  struct MonoObject * ar;
  gint i;

  D.18787 = mono_runtime_is_shutting_down ();
  if (D.18787 != 0) goto <D.18788>; else goto <D.18789>;
  <D.18788>:
  return;
  <D.18789>:
  D.18790 = tp->pool_status;
  if (D.18790 == 0) goto <D.18791>; else goto <D.18792>;
  <D.18791>:
  D.18793 = &tp->pool_status;
  D.18794 = InterlockedCompareExchange (D.18793, 1, 0);
  if (D.18794 == 0) goto <D.18795>; else goto <D.18796>;
  <D.18795>:
  D.18797 = tp->is_io;
  if (D.18797 == 0) goto <D.18798>; else goto <D.18799>;
  <D.18798>:
  D.18800 = mono_get_root_domain ();
  mono_thread_create_internal (D.18800, monitor_thread, 0B, 1, 0, 131072);
  threadpool_start_thread (tp);
  <D.18799>:
  D.18801 = mono_config_is_server_mode ();
  if (D.18801 != 0) goto <D.18802>; else goto <D.18803>;
  <D.18802>:
  D.18804 = mono_get_root_domain ();
  mono_thread_create_internal (D.18804, threadpool_start_idle_threads, tp, 1, 0, 131072);
  <D.18803>:
  <D.18796>:
  <D.18792>:
  i = 0;
  goto <D.18525>;
  <D.18524>:
  i.3 = (unsigned int) i;
  D.18806 = i.3 * 4;
  D.18807 = jobs + D.18806;
  ar = *D.18807;
  if (ar == 0B) goto <D.18808>; else goto <D.18810>;
  <D.18810>:
  D.18811 = ar->vtable;
  D.18812 = D.18811->domain;
  D.18813 = mono_domain_is_unloading (D.18812);
  if (D.18813 != 0) goto <D.18808>; else goto <D.18809>;
  <D.18808>:
  // predicted unlikely by continue predictor.
  goto <D.18522>;
  <D.18809>:
  D.18797 = tp->is_io;
  if (D.18797 == 0) goto <D.18814>; else goto <D.18815>;
  <D.18814>:
  D.18816 = InterlockedIncrement (&job_counter);
  D.18817 = D.18816 % 10;
  if (D.18817 == 0) goto <D.18818>; else goto <D.18819>;
  <D.18818>:
  {
    struct MonoAsyncResult * o;

    o = ar;
    D.18820 = mono_100ns_ticks ();
    o->add_time = D.18820;
  }
  <D.18819>:
  <D.18815>:
  threadpool_jobs_inc (ar);
  D.18821 = tp->pc_nitems;
  mono_perfcounter_update_value (D.18821, 1, 1);
  D.18797 = tp->is_io;
  if (D.18797 == 0) goto <D.18822>; else goto <D.18823>;
  <D.18822>:
  D.18824 = mono_wsq_local_push (ar);
  if (D.18824 != 0) goto <D.18825>; else goto <D.18826>;
  <D.18825>:
  // predicted unlikely by continue predictor.
  goto <D.18522>;
  <D.18826>:
  <D.18823>:
  D.18827 = tp->queue;
  mono_cq_enqueue (D.18827, ar);
  <D.18522>:
  i = i + 1;
  <D.18525>:
  if (i < njobs) goto <D.18524>; else goto <D.18526>;
  <D.18526>:
  i = 0;
  goto <D.18528>;
  <D.18527>:
  pulse_on_new_job (tp);
  i = i + 1;
  <D.18528>:
  D.18828 = tp->waiting;
  if (D.18828 > 0) goto <D.18829>; else goto <D.18529>;
  <D.18829>:
  D.18831 = tp->max_threads;
  if (D.18831 <= njobs) goto <D.18832>; else goto <D.18833>;
  <D.18832>:
  iftmp.4 = tp->max_threads;
  goto <D.18834>;
  <D.18833>:
  iftmp.4 = njobs;
  <D.18834>:
  if (iftmp.4 > i) goto <D.18527>; else goto <D.18529>;
  <D.18529>:
}


threadpool_start_idle_threads (struct ThreadPool * tp)
{
  unsigned int iftmp.5;
  int D.18837;
  int D.18841;
  int D.18844;
  volatile gint * D.18845;
  int D.18846;
  void * D.18848;
  void (*<Tb27>) (void *) D.18849;
  struct MonoDomain * D.18850;
  int n;
  guint32 stack_size;

  D.18837 = tp->is_io;
  if (D.18837 == 0) goto <D.18838>; else goto <D.18839>;
  <D.18838>:
  iftmp.5 = 0;
  goto <D.18840>;
  <D.18839>:
  iftmp.5 = 131072;
  <D.18840>:
  stack_size = iftmp.5;
  <D.18403>:
  <D.18402>:
  n = tp->nthreads;
  D.18841 = tp->min_threads;
  if (D.18841 <= n) goto <D.18842>; else goto <D.18843>;
  <D.18842>:
  return;
  <D.18843>:
  D.18844 = n + 1;
  D.18845 = &tp->nthreads;
  D.18846 = InterlockedCompareExchange (D.18845, D.18844, n);
  if (D.18846 == n) goto <D.18401>; else goto <D.18847>;
  <D.18847>:
  goto <D.18402>;
  <D.18401>:
  D.18848 = tp->pc_nthreads;
  mono_perfcounter_update_value (D.18848, 1, 1);
  D.18849 = tp->async_invoke;
  D.18850 = mono_get_root_domain ();
  mono_thread_create_internal (D.18850, D.18849, tp, 1, 0, stack_size);
  SleepEx (100, 1);
  goto <D.18403>;
}


monitor_thread (void * unused)
{
  struct MonoDomain * D.18852;
  struct MonoString * D.18853;
  unsigned int D.18854;
  unsigned int D.18856;
  unsigned int D.18857;
  int D.18858;
  unsigned int D.18860;
  unsigned int D.18861;
  int i.6;
  int D.18866;
  int suspended.7;
  int D.18871;
  struct MonoCQ * D.18874;
  int D.18875;
  _Bool D.18876;
  int D.18879;
  _Bool D.18884;
  long int D.18885;
  long int D.18886;
  struct GPtrArray * wsqs.8;
  void * * D.18890;
  unsigned int i.9;
  unsigned int D.18892;
  void * * D.18893;
  int D.18894;
  unsigned int i.10;
  unsigned int D.18899;
  _Bool D.18902;
  long int D.18903;
  long int D.18904;
  struct ThreadPool * pools[2];
  struct MonoInternalThread * thread;
  guint32 ms;
  gboolean need_one;
  int i;

  try
    {
      pools[0] = &async_tp;
      pools[1] = &async_io_tp;
      thread = mono_thread_internal_current ();
      D.18852 = mono_domain_get ();
      D.18853 = mono_string_new (D.18852, "Threadpool monitor");
      ves_icall_System_Threading_Thread_SetName_internal (thread, D.18853);
      <D.18445>:
      ms = 500;
      i = 10;
      <D.18431>:
      {
        guint32 ts;

        ts = mono_msec_ticks ();
        D.18854 = SleepEx (ms, 1);
        if (D.18854 == 0) goto <D.18430>; else goto <D.18855>;
        <D.18855>:
        D.18856 = mono_msec_ticks ();
        D.18857 = D.18856 - ts;
        ms = ms - D.18857;
        D.18858 = mono_runtime_is_shutting_down ();
        if (D.18858 != 0) goto <D.18430>; else goto <D.18859>;
        <D.18859>:
        D.18860 = thread->state;
        D.18861 = D.18860 & 3;
        if (D.18861 != 0) goto <D.18862>; else goto <D.18863>;
        <D.18862>:
        mono_thread_interruption_checkpoint ();
        <D.18863>:
      }
      if (ms != 0) goto <D.18864>; else goto <D.18430>;
      <D.18864>:
      i.6 = i;
      i = i.6 + -1;
      if (i.6 != 0) goto <D.18431>; else goto <D.18430>;
      <D.18430>:
      D.18866 = mono_runtime_is_shutting_down ();
      if (D.18866 != 0) goto <D.18432>; else goto <D.18867>;
      <D.18867>:
      suspended.7 = suspended;
      if (suspended.7 != 0) goto <D.18869>; else goto <D.18870>;
      <D.18869>:
      // predicted unlikely by continue predictor.
      goto <D.18433>;
      <D.18870>:
      i = 0;
      goto <D.18443>;
      <D.18442>:
      {
        struct ThreadPool * tp;

        tp = pools[i];
        D.18871 = tp->waiting;
        if (D.18871 > 0) goto <D.18872>; else goto <D.18873>;
        <D.18872>:
        // predicted unlikely by continue predictor.
        goto <D.18435>;
        <D.18873>:
        D.18874 = tp->queue;
        D.18875 = mono_cq_count (D.18874);
        D.18876 = D.18875 > 0;
        need_one = (gboolean) D.18876;
        if (need_one == 0) goto <D.18877>; else goto <D.18878>;
        <D.18877>:
        D.18879 = tp->is_io;
        if (D.18879 == 0) goto <D.18880>; else goto <D.18881>;
        <D.18880>:
        {
          int ret;

          ret = pthread_mutex_lock (&wsqs_lock.mutex);
          if (ret != 0) goto <D.18882>; else goto <D.18883>;
          <D.18882>:
          monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
          <D.18883>:
          D.18884 = ret != 0;
          D.18885 = (long int) D.18884;
          D.18886 = __builtin_expect (D.18885, 0);
          if (D.18886 != 0) goto <D.18887>; else goto <D.18888>;
          <D.18887>:
          monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 801, "ret == 0");
          <D.18888>:
        }
        i = 0;
        goto <D.18440>;
        <D.18439>:
        {
          struct MonoWSQ * wsq;

          wsqs.8 = wsqs;
          D.18890 = wsqs.8->pdata;
          i.9 = (unsigned int) i;
          D.18892 = i.9 * 4;
          D.18893 = D.18890 + D.18892;
          wsq = *D.18893;
          D.18894 = mono_wsq_count (wsq);
          if (D.18894 != 0) goto <D.18895>; else goto <D.18896>;
          <D.18895>:
          need_one = 1;
          goto <D.18438>;
          <D.18896>:
        }
        i = i + 1;
        <D.18440>:
        wsqs.8 = wsqs;
        if (wsqs.8 != 0B) goto <D.18897>; else goto <D.18438>;
        <D.18897>:
        i.10 = (unsigned int) i;
        wsqs.8 = wsqs;
        D.18899 = wsqs.8->len;
        if (i.10 < D.18899) goto <D.18439>; else goto <D.18438>;
        <D.18438>:
        {
          int ret;

          ret = pthread_mutex_unlock (&wsqs_lock.mutex);
          if (ret != 0) goto <D.18900>; else goto <D.18901>;
          <D.18900>:
          monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
          <D.18901>:
          D.18902 = ret != 0;
          D.18903 = (long int) D.18902;
          D.18904 = __builtin_expect (D.18903, 0);
          if (D.18904 != 0) goto <D.18905>; else goto <D.18906>;
          <D.18905>:
          monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 810, "ret == 0");
          <D.18906>:
        }
        <D.18881>:
        <D.18878>:
        if (need_one != 0) goto <D.18907>; else goto <D.18908>;
        <D.18907>:
        threadpool_start_thread (tp);
        <D.18908>:
      }
      <D.18435>:
      i = i + 1;
      <D.18443>:
      if (i <= 1) goto <D.18442>; else goto <D.18444>;
      <D.18444>:
      <D.18433>:
      goto <D.18445>;
      <D.18432>:
    }
  finally
    {
      pools = {CLOBBER};
    }
}


InterlockedCompareExchange (volatile gint32 * dest, gint32 exch, gint32 comp)
{
  gint32 D.18909;
  unsigned int exch.11;
  unsigned int comp.12;
  unsigned int D.18912;

  exch.11 = (unsigned int) exch;
  comp.12 = (unsigned int) comp;
  D.18912 = __sync_val_compare_and_swap_4 (dest, comp.12, exch.11);
  D.18909 = (gint32) D.18912;
  return D.18909;
}


threadpool_start_thread (struct ThreadPool * tp)
{
  unsigned int iftmp.13;
  int D.18915;
  int D.18919;
  volatile gint * D.18920;
  int D.18921;
  void * D.18924;
  void (*<Tb27>) (void *) D.18925;
  struct MonoDomain * D.18926;
  gboolean D.18927;
  int D.18928;
  int D.18930;
  gint n;
  guint32 stack_size;

  D.18915 = tp->is_io;
  if (D.18915 == 0) goto <D.18916>; else goto <D.18917>;
  <D.18916>:
  iftmp.13 = 0;
  goto <D.18918>;
  <D.18917>:
  iftmp.13 = 131072;
  <D.18918>:
  stack_size = iftmp.13;
  goto <D.18502>;
  <D.18501>:
  D.18919 = n + 1;
  D.18920 = &tp->nthreads;
  D.18921 = InterlockedCompareExchange (D.18920, D.18919, n);
  if (D.18921 == n) goto <D.18922>; else goto <D.18923>;
  <D.18922>:
  D.18924 = tp->pc_nthreads;
  mono_perfcounter_update_value (D.18924, 1, 1);
  D.18925 = tp->async_invoke;
  D.18926 = mono_get_root_domain ();
  mono_thread_create_internal (D.18926, D.18925, tp, 1, 0, stack_size);
  D.18927 = 1;
  return D.18927;
  <D.18923>:
  <D.18502>:
  D.18928 = mono_runtime_is_shutting_down ();
  if (D.18928 == 0) goto <D.18929>; else goto <D.18503>;
  <D.18929>:
  n = tp->nthreads;
  D.18930 = tp->max_threads;
  if (n < D.18930) goto <D.18501>; else goto <D.18503>;
  <D.18503>:
  D.18927 = 0;
  return D.18927;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.18932;
  unsigned int D.18933;

  D.18933 = __sync_add_and_fetch_4 (val, 1);
  D.18932 = (gint32) D.18933;
  return D.18932;
}


threadpool_jobs_inc (struct MonoObject * obj)
{
  struct MonoVTable * D.18937;
  struct MonoDomain * D.18938;
  volatile int * D.18939;

  if (obj != 0B) goto <D.18935>; else goto <D.18936>;
  <D.18935>:
  D.18937 = obj->vtable;
  D.18938 = D.18937->domain;
  D.18939 = &D.18938->threadpool_jobs;
  InterlockedIncrement (D.18939);
  <D.18936>:
}


pulse_on_new_job (struct ThreadPool * tp)
{
  int D.18940;
  union MonoSemType * D.18943;

  D.18940 = tp->waiting;
  if (D.18940 != 0) goto <D.18941>; else goto <D.18942>;
  <D.18941>:
  D.18943 = &tp->new_job;
  mono_sem_post (D.18943);
  <D.18942>:
}


mono_thread_pool_init_tls ()
{
  mono_wsq_init ();
}


mono_thread_pool_init ()
{
  int tp_inited.14;
  int tp_inited.15;
  int D.18952;
  const gchar * D.18955;
  const gchar * D.18958;
  int D.18961;
  int D.18962;
  int D.18963;
  int D.18964;
  int D.18965;
  struct MonoImage * D.18966;
  struct MonoClass * async_call_klass.16;
  struct MonoClass * async_call_klass.17;
  _Bool D.18969;
  long int D.18970;
  long int D.18971;
  unsigned int D.18974;
  struct GPtrArray * wsqs.18;
  void * D.18976;
  void * D.18977;
  _Bool D.18978;
  long int D.18979;
  long int D.18980;
  void * D.18983;
  void * D.18984;
  _Bool D.18985;
  long int D.18986;
  long int D.18987;
  void * D.18990;
  void * D.18991;
  _Bool D.18992;
  long int D.18993;
  long int D.18994;
  void * D.18997;
  void * D.18998;
  _Bool D.18999;
  long int D.19000;
  long int D.19001;
  gint threads_per_cpu;
  gint thread_count;
  gint cpu_count;
  int result;

  threads_per_cpu = 1;
  cpu_count = mono_cpu_count ();
  tp_inited.14 = tp_inited;
  if (tp_inited.14 == 2) goto <D.18945>; else goto <D.18946>;
  <D.18945>:
  return;
  <D.18946>:
  result = InterlockedCompareExchange (&tp_inited, 1, 0);
  if (result == 1) goto <D.18947>; else goto <D.18948>;
  <D.18947>:
  <D.18456>:
  SleepEx (1, 0);
  tp_inited.15 = tp_inited;
  if (tp_inited.15 == 2) goto <D.18950>; else goto <D.18951>;
  <D.18950>:
  return;
  <D.18951>:
  goto <D.18456>;
  <D.18948>:
  D.18952 = mono_gc_is_moving ();
  if (D.18952 == 0) goto <D.18953>; else goto <D.18954>;
  <D.18953>:
  mono_gc_register_root (&socket_io_data.sock_to_state, 4, 0B);
  <D.18954>:
  InitializeCriticalSection (&socket_io_data.io_lock);
  D.18955 = monoeg_g_getenv ("MONO_THREADS_PER_CPU");
  if (D.18955 != 0B) goto <D.18956>; else goto <D.18957>;
  <D.18956>:
  D.18958 = monoeg_g_getenv ("MONO_THREADS_PER_CPU");
  threads_per_cpu = atoi (D.18958);
  if (threads_per_cpu <= 0) goto <D.18959>; else goto <D.18960>;
  <D.18959>:
  threads_per_cpu = 1;
  <D.18960>:
  <D.18957>:
  D.18961 = cpu_count * 100;
  D.18962 = cpu_count * threads_per_cpu;
  thread_count = MIN_EXPR <D.18961, D.18962>;
  D.18961 = cpu_count * 100;
  D.18963 = MAX_EXPR <D.18961, thread_count>;
  threadpool_init (&async_tp, thread_count, D.18963, async_invoke_thread);
  D.18964 = cpu_count * 4;
  D.18965 = cpu_count * 2;
  threadpool_init (&async_io_tp, D.18965, D.18964, async_invoke_thread);
  async_io_tp.is_io = 1;
  D.18966 = mono_defaults.corlib;
  async_call_klass.16 = mono_class_from_name (D.18966, "System", "MonoAsyncCall");
  async_call_klass = async_call_klass.16;
  async_call_klass.17 = async_call_klass;
  D.18969 = async_call_klass.17 == 0B;
  D.18970 = (long int) D.18969;
  D.18971 = __builtin_expect (D.18970, 0);
  if (D.18971 != 0) goto <D.18972>; else goto <D.18973>;
  <D.18972>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 858, "async_call_klass");
  <D.18973>:
  InitializeCriticalSection (&wsqs_lock);
  D.18961 = cpu_count * 100;
  D.18963 = MAX_EXPR <D.18961, thread_count>;
  D.18974 = (unsigned int) D.18963;
  wsqs.18 = monoeg_g_ptr_array_sized_new (D.18974);
  wsqs = wsqs.18;
  D.18976 = init_perf_counter ("Mono Threadpool", "Work Items Added");
  async_tp.pc_nitems = D.18976;
  D.18977 = async_tp.pc_nitems;
  D.18978 = D.18977 == 0B;
  D.18979 = (long int) D.18978;
  D.18980 = __builtin_expect (D.18979, 0);
  if (D.18980 != 0) goto <D.18981>; else goto <D.18982>;
  <D.18981>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 865, "async_tp.pc_nitems");
  <D.18982>:
  D.18983 = init_perf_counter ("Mono Threadpool", "IO Work Items Added");
  async_io_tp.pc_nitems = D.18983;
  D.18984 = async_io_tp.pc_nitems;
  D.18985 = D.18984 == 0B;
  D.18986 = (long int) D.18985;
  D.18987 = __builtin_expect (D.18986, 0);
  if (D.18987 != 0) goto <D.18988>; else goto <D.18989>;
  <D.18988>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 868, "async_io_tp.pc_nitems");
  <D.18989>:
  D.18990 = init_perf_counter ("Mono Threadpool", "# of Threads");
  async_tp.pc_nthreads = D.18990;
  D.18991 = async_tp.pc_nthreads;
  D.18992 = D.18991 == 0B;
  D.18993 = (long int) D.18992;
  D.18994 = __builtin_expect (D.18993, 0);
  if (D.18994 != 0) goto <D.18995>; else goto <D.18996>;
  <D.18995>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 871, "async_tp.pc_nthreads");
  <D.18996>:
  D.18997 = init_perf_counter ("Mono Threadpool", "# of IO Threads");
  async_io_tp.pc_nthreads = D.18997;
  D.18998 = async_io_tp.pc_nthreads;
  D.18999 = D.18998 == 0B;
  D.19000 = (long int) D.18999;
  D.19001 = __builtin_expect (D.19000, 0);
  if (D.19001 != 0) goto <D.19002>; else goto <D.19003>;
  <D.19002>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 874, "async_io_tp.pc_nthreads");
  <D.19003>:
  tp_inited = 2;
}


async_invoke_thread (void * data)
{
  int D.19005;
  void (*<Tb27>) (void *) tp_start_func.19;
  void * tp_hooks_user_data.20;
  volatile gint * D.19014;
  struct MonoVTable * D.19015;
  void * data.21;
  struct MonoVTable * D.19017;
  int D.19018;
  _Bool D.19019;
  int D.19022;
  gint * D.19023;
  int D.19024;
  int D.19025;
  int D.19026;
  struct MonoArray * D.19027;
  void * D.19028;
  unsigned int D.19029;
  int D.19030;
  int D.19031;
  _Bool D.19033;
  long int D.19034;
  long int D.19035;
  int D.19041;
  int D.19043;
  volatile gint * D.19044;
  int D.19045;
  volatile gint * D.19048;
  int D.19049;
  void (*<Tb27>) (void *) tp_item_begin_func.22;
  void * tp_item_user_data.23;
  long long int D.19058;
  void (*<Tb27>) (void *) tp_item_end_func.24;
  unsigned char D.19070;
  struct MonoDelegate * D.19073;
  struct MonoDomain * D.19076;
  volatile gint * D.19077;
  int D.19083;
  volatile gint * D.19084;
  volatile gint * D.19087;
  int D.19088;
  struct MonoCQ * D.19090;
  int D.19091;
  union MonoSemType * D.19093;
  volatile gint * D.19094;
  int D.19095;
  int D.19103;
  volatile gint * D.19110;
  int D.19115;
  int D.19120;
  volatile gint * D.19121;
  int D.19122;
  void * D.19123;
  void (*<Tb27>) (void *) tp_finish_func.25;
  struct MonoDomain * domain;
  struct MonoWSQ * wsq;
  struct ThreadPool * tp;
  gboolean must_die;

  tp = data;
  wsq = 0B;
  D.19005 = tp->is_io;
  if (D.19005 == 0) goto <D.19006>; else goto <D.19007>;
  <D.19006>:
  wsq = add_wsq ();
  <D.19007>:
  set_tp_thread_info (tp);
  tp_start_func.19 = tp_start_func;
  if (tp_start_func.19 != 0B) goto <D.19009>; else goto <D.19010>;
  <D.19009>:
  tp_start_func.19 = tp_start_func;
  tp_hooks_user_data.20 = tp_hooks_user_data;
  tp_start_func.19 (tp_hooks_user_data.20);
  <D.19010>:
  data = 0B;
  <D.18681>:
  {
    struct MonoAsyncResult * ar;
    struct MonoClass * klass;
    gboolean is_io_task;
    gboolean is_socket;
    int n_naps;

    n_naps = 0;
    is_io_task = 0;
    ar = data;
    if (ar != 0B) goto <D.19012>; else goto <D.19013>;
    <D.19012>:
    D.19014 = &tp->busy_threads;
    InterlockedIncrement (D.19014);
    D.19015 = MEM[(struct MonoObject *)ar].vtable;
    domain = D.19015->domain;
    data.21 = data;
    D.19017 = MEM[(struct MonoObject *)data.21].vtable;
    klass = D.19017->klass;
    D.19018 = is_corlib_asyncresult (domain, klass);
    D.19019 = D.19018 == 0;
    is_io_task = (gboolean) D.19019;
    is_socket = 0;
    if (is_io_task != 0) goto <D.19020>; else goto <D.19021>;
    <D.19020>:
    {
      struct MonoSocketAsyncResult * state;

      state = data;
      is_socket = is_socketasyncresult (domain, klass);
      ar = state->ares;
      D.19022 = state->operation;
      switch (D.19022) <default: <D.19032>, case 2: <D.18663>, case 4: <D.18665>>
      <D.18663>:
      D.19023 = &state->error;
      D.19024 = state->socket_flags;
      D.19025 = state->size;
      D.19026 = state->offset;
      D.19027 = state->buffer;
      D.19028 = state->handle;
      D.19029 = (unsigned int) D.19028;
      D.19030 = ves_icall_System_Net_Sockets_Socket_Receive_internal (D.19029, D.19027, D.19026, D.19025, D.19024, D.19023);
      state->total = D.19030;
      goto <D.18664>;
      <D.18665>:
      D.19023 = &state->error;
      D.19024 = state->socket_flags;
      D.19025 = state->size;
      D.19026 = state->offset;
      D.19027 = state->buffer;
      D.19028 = state->handle;
      D.19029 = (unsigned int) D.19028;
      D.19031 = ves_icall_System_Net_Sockets_Socket_Send_internal (D.19029, D.19027, D.19026, D.19025, D.19024, D.19023);
      state->total = D.19031;
      goto <D.18664>;
      <D.19032>:
      <D.18664>:
    }
    <D.19021>:
    D.19033 = domain == 0B;
    D.19034 = (long int) D.19033;
    D.19035 = __builtin_expect (D.19034, 0);
    if (D.19035 != 0) goto <D.19036>; else goto <D.19037>;
    <D.19036>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1492, "domain");
    <D.19037>:
    D.19041 = mono_domain_is_unloading (domain);
    if (D.19041 != 0) goto <D.19038>; else goto <D.19042>;
    <D.19042>:
    D.19043 = mono_runtime_is_shutting_down ();
    if (D.19043 != 0) goto <D.19038>; else goto <D.19039>;
    <D.19038>:
    threadpool_jobs_dec (ar);
    data = 0B;
    ar = 0B;
    D.19044 = &tp->busy_threads;
    InterlockedDecrement (D.19044);
    goto <D.19040>;
    <D.19039>:
    mono_thread_push_appdomain_ref (domain);
    D.19045 = threadpool_jobs_dec (ar);
    if (D.19045 != 0) goto <D.19046>; else goto <D.19047>;
    <D.19046>:
    data = 0B;
    ar = 0B;
    mono_thread_pop_appdomain_ref ();
    D.19048 = &tp->busy_threads;
    InterlockedDecrement (D.19048);
    // predicted unlikely by continue predictor.
    goto <D.18666>;
    <D.19047>:
    D.19049 = mono_domain_set (domain, 0);
    if (D.19049 != 0) goto <D.19050>; else goto <D.19051>;
    <D.19050>:
    {
      struct MonoObject * exc;

      tp_item_begin_func.22 = tp_item_begin_func;
      if (tp_item_begin_func.22 != 0B) goto <D.19053>; else goto <D.19054>;
      <D.19053>:
      tp_item_begin_func.22 = tp_item_begin_func;
      tp_item_user_data.23 = tp_item_user_data;
      tp_item_begin_func.22 (tp_item_user_data.23);
      <D.19054>:
      if (is_io_task == 0) goto <D.19056>; else goto <D.19057>;
      <D.19056>:
      D.19058 = ar->add_time;
      if (D.19058 > 0) goto <D.19059>; else goto <D.19060>;
      <D.19059>:
      D.19058 = ar->add_time;
      process_idle_times (tp, D.19058);
      <D.19060>:
      <D.19057>:
      exc = mono_async_invoke (tp, ar);
      tp_item_end_func.24 = tp_item_end_func;
      if (tp_item_end_func.24 != 0B) goto <D.19062>; else goto <D.19063>;
      <D.19062>:
      tp_item_end_func.24 = tp_item_end_func;
      tp_item_user_data.23 = tp_item_user_data;
      tp_item_end_func.24 (tp_item_user_data.23);
      <D.19063>:
      if (exc != 0B) goto <D.19064>; else goto <D.19065>;
      <D.19064>:
      mono_internal_thread_unhandled_exception (exc);
      <D.19065>:
      if (is_socket != 0) goto <D.19066>; else goto <D.19067>;
      <D.19066>:
      D.19005 = tp->is_io;
      if (D.19005 != 0) goto <D.19068>; else goto <D.19069>;
      <D.19068>:
      {
        struct MonoSocketAsyncResult * state;

        state = data;
        D.19070 = state->completed;
        if (D.19070 != 0) goto <D.19071>; else goto <D.19072>;
        <D.19071>:
        D.19073 = state->callback;
        if (D.19073 != 0B) goto <D.19074>; else goto <D.19075>;
        <D.19074>:
        {
          struct MonoAsyncResult * cb_ares;

          D.19073 = state->callback;
          cb_ares = create_simple_asyncresult (D.19073, state);
          icall_append_job (cb_ares);
        }
        <D.19075>:
        <D.19072>:
      }
      <D.19069>:
      <D.19067>:
      D.19076 = mono_get_root_domain ();
      mono_domain_set (D.19076, 1);
    }
    <D.19051>:
    mono_thread_pop_appdomain_ref ();
    D.19077 = &tp->busy_threads;
    InterlockedDecrement (D.19077);
    clear_thread_state ();
    <D.19040>:
    <D.19013>:
    ar = 0B;
    data = 0B;
    must_die = should_i_die (tp);
    if (must_die == 0) goto <D.19080>; else goto <D.19081>;
    <D.19080>:
    D.19005 = tp->is_io;
    if (D.19005 != 0) goto <D.19078>; else goto <D.19082>;
    <D.19082>:
    D.19083 = mono_wsq_local_pop (&data);
    if (D.19083 == 0) goto <D.19078>; else goto <D.19079>;
    <D.19078>:
    dequeue_or_steal (tp, &data, wsq);
    <D.19079>:
    <D.19081>:
    n_naps = 0;
    goto <D.18676>;
    <D.18675>:
    {
      gboolean res;

      D.19084 = &tp->waiting;
      InterlockedIncrement (D.19084);
      dequeue_or_steal (tp, &data, wsq);
      data.21 = data;
      if (data.21 != 0B) goto <D.19085>; else goto <D.19086>;
      <D.19085>:
      D.19087 = &tp->waiting;
      InterlockedDecrement (D.19087);
      goto <D.18671>;
      <D.19086>:
      mono_gc_set_skip_thread (1);
      goto <D.18674>;
      <D.18673>:
      D.19088 = mono_runtime_is_shutting_down ();
      if (D.19088 != 0) goto <D.18672>; else goto <D.19089>;
      <D.19089>:
      check_for_interruption_critical ();
      <D.18674>:
      D.19090 = tp->queue;
      D.19091 = mono_cq_count (D.19090);
      if (D.19091 == 0) goto <D.19092>; else goto <D.18672>;
      <D.19092>:
      D.19093 = &tp->new_job;
      res = mono_sem_timedwait (D.19093, 2000, 1);
      if (res == -1) goto <D.18673>; else goto <D.18672>;
      <D.18672>:
      D.19094 = &tp->waiting;
      InterlockedDecrement (D.19094);
      mono_gc_set_skip_thread (0);
      D.19095 = mono_runtime_is_shutting_down ();
      if (D.19095 != 0) goto <D.18671>; else goto <D.19096>;
      <D.19096>:
      must_die = should_i_die (tp);
      dequeue_or_steal (tp, &data, wsq);
      n_naps = n_naps + 1;
    }
    <D.18676>:
    if (must_die == 0) goto <D.19097>; else goto <D.18671>;
    <D.19097>:
    data.21 = data;
    if (data.21 == 0B) goto <D.19098>; else goto <D.18671>;
    <D.19098>:
    if (n_naps <= 3) goto <D.18675>; else goto <D.18671>;
    <D.18671>:
    data.21 = data;
    if (data.21 == 0B) goto <D.19099>; else goto <D.19100>;
    <D.19099>:
    D.19005 = tp->is_io;
    if (D.19005 == 0) goto <D.19101>; else goto <D.19102>;
    <D.19101>:
    D.19103 = mono_runtime_is_shutting_down ();
    if (D.19103 == 0) goto <D.19104>; else goto <D.19105>;
    <D.19104>:
    mono_wsq_local_pop (&data);
    data.21 = data;
    if (data.21 != 0B) goto <D.19106>; else goto <D.19107>;
    <D.19106>:
    if (must_die != 0) goto <D.19108>; else goto <D.19109>;
    <D.19108>:
    D.19110 = &tp->destroy_thread;
    InterlockedCompareExchange (D.19110, 1, 0);
    pulse_on_new_job (tp);
    <D.19109>:
    <D.19107>:
    <D.19105>:
    <D.19102>:
    <D.19100>:
    data.21 = data;
    if (data.21 == 0B) goto <D.19111>; else goto <D.19112>;
    <D.19111>:
    {
      gint nt;
      gboolean down;

      <D.18680>:
      nt = tp->nthreads;
      down = mono_runtime_is_shutting_down ();
      if (down == 0) goto <D.19113>; else goto <D.19114>;
      <D.19113>:
      D.19115 = tp->min_threads;
      if (D.19115 >= nt) goto <D.18679>; else goto <D.19116>;
      <D.19116>:
      <D.19114>:
      if (down != 0) goto <D.19117>; else goto <D.19119>;
      <D.19119>:
      D.19120 = nt + -1;
      D.19121 = &tp->nthreads;
      D.19122 = InterlockedCompareExchange (D.19121, D.19120, nt);
      if (D.19122 == nt) goto <D.19117>; else goto <D.19118>;
      <D.19117>:
      D.19123 = tp->pc_nthreads;
      mono_perfcounter_update_value (D.19123, 1, -1);
      D.19005 = tp->is_io;
      if (D.19005 == 0) goto <D.19124>; else goto <D.19125>;
      <D.19124>:
      remove_wsq (wsq);
      <D.19125>:
      fire_profiler_thread_end ();
      tp_finish_func.25 = tp_finish_func;
      if (tp_finish_func.25 != 0B) goto <D.19127>; else goto <D.19128>;
      <D.19127>:
      tp_finish_func.25 = tp_finish_func;
      tp_hooks_user_data.20 = tp_hooks_user_data;
      tp_finish_func.25 (tp_hooks_user_data.20);
      <D.19128>:
      return;
      <D.19118>:
      goto <D.18680>;
      <D.18679>:
    }
    <D.19112>:
  }
  <D.18666>:
  goto <D.18681>;
  monoeg_assertion_message ("* Assertion: should not be reached at %s:%d\n", "threadpool.c", 1616);
}


add_wsq ()
{
  _Bool D.19132;
  long int D.19133;
  long int D.19134;
  struct GPtrArray * wsqs.26;
  _Bool D.19142;
  long int D.19143;
  long int D.19144;
  struct MonoWSQ * D.19147;
  void * * D.19148;
  unsigned int i.27;
  unsigned int D.19150;
  void * * D.19151;
  void * D.19152;
  _Bool D.19157;
  long int D.19158;
  long int D.19159;
  unsigned int i.28;
  unsigned int D.19163;
  _Bool D.19166;
  long int D.19167;
  long int D.19168;
  int i;
  struct MonoWSQ * wsq;

  {
    int ret;

    ret = pthread_mutex_lock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.19130>; else goto <D.19131>;
    <D.19130>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19131>:
    D.19132 = ret != 0;
    D.19133 = (long int) D.19132;
    D.19134 = __builtin_expect (D.19133, 0);
    if (D.19134 != 0) goto <D.19135>; else goto <D.19136>;
    <D.19135>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1221, "ret == 0");
    <D.19136>:
  }
  wsq = mono_wsq_create ();
  wsqs.26 = wsqs;
  if (wsqs.26 == 0B) goto <D.19138>; else goto <D.19139>;
  <D.19138>:
  {
    int ret;

    ret = pthread_mutex_unlock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.19140>; else goto <D.19141>;
    <D.19140>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19141>:
    D.19142 = ret != 0;
    D.19143 = (long int) D.19142;
    D.19144 = __builtin_expect (D.19143, 0);
    if (D.19144 != 0) goto <D.19145>; else goto <D.19146>;
    <D.19145>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1224, "ret == 0");
    <D.19146>:
  }
  D.19147 = 0B;
  return D.19147;
  <D.19139>:
  i = 0;
  goto <D.18581>;
  <D.18580>:
  wsqs.26 = wsqs;
  D.19148 = wsqs.26->pdata;
  i.27 = (unsigned int) i;
  D.19150 = i.27 * 4;
  D.19151 = D.19148 + D.19150;
  D.19152 = *D.19151;
  if (D.19152 == 0B) goto <D.19153>; else goto <D.19154>;
  <D.19153>:
  wsqs.26 = wsqs;
  D.19148 = wsqs.26->pdata;
  i.27 = (unsigned int) i;
  D.19150 = i.27 * 4;
  D.19151 = D.19148 + D.19150;
  *D.19151 = wsq;
  {
    int ret;

    ret = pthread_mutex_unlock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.19155>; else goto <D.19156>;
    <D.19155>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19156>:
    D.19157 = ret != 0;
    D.19158 = (long int) D.19157;
    D.19159 = __builtin_expect (D.19158, 0);
    if (D.19159 != 0) goto <D.19160>; else goto <D.19161>;
    <D.19160>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1230, "ret == 0");
    <D.19161>:
  }
  D.19147 = wsq;
  return D.19147;
  <D.19154>:
  i = i + 1;
  <D.18581>:
  i.28 = (unsigned int) i;
  wsqs.26 = wsqs;
  D.19163 = wsqs.26->len;
  if (i.28 < D.19163) goto <D.18580>; else goto <D.18582>;
  <D.18582>:
  wsqs.26 = wsqs;
  monoeg_g_ptr_array_add (wsqs.26, wsq);
  {
    int ret;

    ret = pthread_mutex_unlock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.19164>; else goto <D.19165>;
    <D.19164>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19165>:
    D.19166 = ret != 0;
    D.19167 = (long int) D.19166;
    D.19168 = __builtin_expect (D.19167, 0);
    if (D.19168 != 0) goto <D.19169>; else goto <D.19170>;
    <D.19169>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1235, "ret == 0");
    <D.19170>:
  }
  D.19147 = wsq;
  return D.19147;
}


set_tp_thread_info (struct ThreadPool * tp)
{
  long long unsigned int D.19172;
  unsigned int D.19173;
  const gchar * iftmp.29;
  int D.19175;
  struct MonoDomain * D.19179;
  struct MonoString * D.19180;
  const gchar * name;
  struct MonoInternalThread * thread;

  thread = mono_thread_internal_current ();
  D.19172 = thread->tid;
  D.19173 = (unsigned int) D.19172;
  mono_profiler_thread_start (D.19173);
  D.19175 = tp->is_io;
  if (D.19175 != 0) goto <D.19176>; else goto <D.19177>;
  <D.19176>:
  iftmp.29 = "IO Threadpool worker";
  goto <D.19178>;
  <D.19177>:
  iftmp.29 = "Threadpool worker";
  <D.19178>:
  name = iftmp.29;
  D.19179 = mono_domain_get ();
  D.19180 = mono_string_new (D.19179, name);
  mono_thread_set_name_internal (thread, D.19180, 0);
}


is_corlib_asyncresult (struct MonoDomain * domain, struct MonoClass * klass)
{
  struct MonoClass * D.19181;
  gboolean D.19184;
  _Bool D.19185;
  int D.19186;
  int D.18178;
  int iftmp.30;
  int D.18174;
  const char[12] * D.19192;
  unsigned char D.19193;
  int D.19194;
  unsigned char D.19195;
  int D.19196;
  _Bool D.19197;
  _Bool D.19198;
  _Bool D.19199;
  const unsigned char * D.19202;
  unsigned char D.19203;
  int D.19204;
  const unsigned char * D.19205;
  unsigned char D.19206;
  int D.19207;
  _Bool D.19208;
  _Bool D.19209;
  const unsigned char * D.19212;
  unsigned char D.19213;
  int D.19214;
  const unsigned char * D.19215;
  unsigned char D.19216;
  int D.19217;
  _Bool D.19218;
  _Bool D.19219;
  const unsigned char * D.19222;
  unsigned char D.19223;
  int D.19224;
  const unsigned char * D.19225;
  unsigned char D.19226;
  int D.19227;
  const char * D.19229;
  int D.18187;
  int iftmp.31;
  int D.18183;
  const char[34] * D.19235;
  unsigned char D.19236;
  int D.19237;
  unsigned char D.19238;
  int D.19239;
  _Bool D.19240;
  _Bool D.19241;
  _Bool D.19242;
  const unsigned char * D.19245;
  unsigned char D.19246;
  int D.19247;
  const unsigned char * D.19248;
  unsigned char D.19249;
  int D.19250;
  _Bool D.19251;
  _Bool D.19252;
  const unsigned char * D.19255;
  unsigned char D.19256;
  int D.19257;
  const unsigned char * D.19258;
  unsigned char D.19259;
  int D.19260;
  _Bool D.19261;
  _Bool D.19262;
  const unsigned char * D.19265;
  unsigned char D.19266;
  int D.19267;
  const unsigned char * D.19268;
  unsigned char D.19269;
  int D.19270;
  const char * D.19272;

  D.19181 = domain->corlib_asyncresult_class;
  if (D.19181 != 0B) goto <D.19182>; else goto <D.19183>;
  <D.19182>:
  D.19181 = domain->corlib_asyncresult_class;
  D.19185 = D.19181 == klass;
  D.19184 = (gboolean) D.19185;
  return D.19184;
  <D.19183>:
  D.19186 = is_corlib_type (domain, klass);
  if (D.19186 != 0) goto <D.19187>; else goto <D.19188>;
  <D.19187>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 11;
    if (__s1_len <= 3) goto <D.19190>; else goto <D.19191>;
    <D.19190>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name;
      D.19192 = "AsyncResult";
      D.19193 = MEM[(const unsigned char *)D.19192];
      D.19194 = (int) D.19193;
      D.19195 = *__s2;
      D.19196 = (int) D.19195;
      __result = D.19194 - D.19196;
      {
        D.19197 = __s1_len != 0;
        D.19198 = __result == 0;
        D.19199 = D.19197 & D.19198;
        if (D.19199 != 0) goto <D.19200>; else goto <D.19201>;
        <D.19200>:
        D.19202 = &MEM[(void *)"AsyncResult" + 1B];
        D.19203 = *D.19202;
        D.19204 = (int) D.19203;
        D.19205 = __s2 + 1;
        D.19206 = *D.19205;
        D.19207 = (int) D.19206;
        __result = D.19204 - D.19207;
        D.19208 = __s1_len > 1;
        D.19198 = __result == 0;
        D.19209 = D.19208 & D.19198;
        if (D.19209 != 0) goto <D.19210>; else goto <D.19211>;
        <D.19210>:
        D.19212 = &MEM[(void *)"AsyncResult" + 2B];
        D.19213 = *D.19212;
        D.19214 = (int) D.19213;
        D.19215 = __s2 + 2;
        D.19216 = *D.19215;
        D.19217 = (int) D.19216;
        __result = D.19214 - D.19217;
        D.19218 = __s1_len > 2;
        D.19198 = __result == 0;
        D.19219 = D.19218 & D.19198;
        if (D.19219 != 0) goto <D.19220>; else goto <D.19221>;
        <D.19220>:
        D.19222 = &MEM[(void *)"AsyncResult" + 3B];
        D.19223 = *D.19222;
        D.19224 = (int) D.19223;
        D.19225 = __s2 + 3;
        D.19226 = *D.19225;
        D.19227 = (int) D.19226;
        __result = D.19224 - D.19227;
        <D.19221>:
        <D.19211>:
        <D.19201>:
      }
      D.18174 = __result;
    }
    iftmp.30 = D.18174;
    goto <D.19228>;
    <D.19191>:
    D.19229 = klass->name;
    iftmp.30 = __builtin_strcmp ("AsyncResult", D.19229);
    <D.19228>:
    D.18178 = iftmp.30;
  }
  if (D.18178 == 0) goto <D.19230>; else goto <D.19231>;
  <D.19230>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 33;
    if (__s1_len <= 3) goto <D.19233>; else goto <D.19234>;
    <D.19233>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name_space;
      D.19235 = "System.Runtime.Remoting.Messaging";
      D.19236 = MEM[(const unsigned char *)D.19235];
      D.19237 = (int) D.19236;
      D.19238 = *__s2;
      D.19239 = (int) D.19238;
      __result = D.19237 - D.19239;
      {
        D.19240 = __s1_len != 0;
        D.19241 = __result == 0;
        D.19242 = D.19240 & D.19241;
        if (D.19242 != 0) goto <D.19243>; else goto <D.19244>;
        <D.19243>:
        D.19245 = &MEM[(void *)"System.Runtime.Remoting.Messaging" + 1B];
        D.19246 = *D.19245;
        D.19247 = (int) D.19246;
        D.19248 = __s2 + 1;
        D.19249 = *D.19248;
        D.19250 = (int) D.19249;
        __result = D.19247 - D.19250;
        D.19251 = __s1_len > 1;
        D.19241 = __result == 0;
        D.19252 = D.19251 & D.19241;
        if (D.19252 != 0) goto <D.19253>; else goto <D.19254>;
        <D.19253>:
        D.19255 = &MEM[(void *)"System.Runtime.Remoting.Messaging" + 2B];
        D.19256 = *D.19255;
        D.19257 = (int) D.19256;
        D.19258 = __s2 + 2;
        D.19259 = *D.19258;
        D.19260 = (int) D.19259;
        __result = D.19257 - D.19260;
        D.19261 = __s1_len > 2;
        D.19241 = __result == 0;
        D.19262 = D.19261 & D.19241;
        if (D.19262 != 0) goto <D.19263>; else goto <D.19264>;
        <D.19263>:
        D.19265 = &MEM[(void *)"System.Runtime.Remoting.Messaging" + 3B];
        D.19266 = *D.19265;
        D.19267 = (int) D.19266;
        D.19268 = __s2 + 3;
        D.19269 = *D.19268;
        D.19270 = (int) D.19269;
        __result = D.19267 - D.19270;
        <D.19264>:
        <D.19254>:
        <D.19244>:
      }
      D.18183 = __result;
    }
    iftmp.31 = D.18183;
    goto <D.19271>;
    <D.19234>:
    D.19272 = klass->name_space;
    iftmp.31 = __builtin_strcmp ("System.Runtime.Remoting.Messaging", D.19272);
    <D.19271>:
    D.18187 = iftmp.31;
  }
  if (D.18187 == 0) goto <D.19273>; else goto <D.19274>;
  <D.19273>:
  domain->corlib_asyncresult_class = klass;
  D.19184 = 1;
  return D.19184;
  <D.19274>:
  <D.19231>:
  <D.19188>:
  D.19184 = 0;
  return D.19184;
}


is_corlib_type (struct MonoDomain * domain, struct MonoClass * klass)
{
  gboolean D.19276;
  struct MonoImage * D.19277;
  struct MonoImage * D.19278;
  _Bool D.19279;

  D.19277 = klass->image;
  D.19278 = mono_defaults.corlib;
  D.19279 = D.19277 == D.19278;
  D.19276 = (gboolean) D.19279;
  return D.19276;
}


is_socketasyncresult (struct MonoDomain * domain, struct MonoClass * klass)
{
  gboolean D.19281;
  int iftmp.32;
  struct MonoClass * D.19285;
  int D.19287;
  int D.18222;
  int iftmp.33;
  int D.18221;
  const char[18] * D.19292;
  unsigned char D.19293;
  int D.19294;
  unsigned char D.19295;
  int D.19296;
  _Bool D.19297;
  _Bool D.19298;
  _Bool D.19299;
  const unsigned char * D.19302;
  unsigned char D.19303;
  int D.19304;
  const unsigned char * D.19305;
  unsigned char D.19306;
  int D.19307;
  _Bool D.19308;
  _Bool D.19309;
  const unsigned char * D.19312;
  unsigned char D.19313;
  int D.19314;
  const unsigned char * D.19315;
  unsigned char D.19316;
  int D.19317;
  _Bool D.19318;
  _Bool D.19319;
  const unsigned char * D.19322;
  unsigned char D.19323;
  int D.19324;
  const unsigned char * D.19325;
  unsigned char D.19326;
  int D.19327;
  const char * D.19329;

  D.19285 = klass->nested_in;
  if (D.19285 != 0B) goto <D.19286>; else goto <D.19283>;
  <D.19286>:
  D.19285 = klass->nested_in;
  D.19287 = is_socket (domain, D.19285);
  if (D.19287 != 0) goto <D.19288>; else goto <D.19283>;
  <D.19288>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s2_len = 17;
    if (__s2_len <= 3) goto <D.19290>; else goto <D.19291>;
    <D.19290>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name;
      D.19292 = "SocketAsyncResult";
      D.19293 = MEM[(const unsigned char *)D.19292];
      D.19294 = (int) D.19293;
      D.19295 = *__s2;
      D.19296 = (int) D.19295;
      __result = D.19294 - D.19296;
      {
        D.19297 = __s2_len != 0;
        D.19298 = __result == 0;
        D.19299 = D.19297 & D.19298;
        if (D.19299 != 0) goto <D.19300>; else goto <D.19301>;
        <D.19300>:
        D.19302 = &MEM[(void *)"SocketAsyncResult" + 1B];
        D.19303 = *D.19302;
        D.19304 = (int) D.19303;
        D.19305 = __s2 + 1;
        D.19306 = *D.19305;
        D.19307 = (int) D.19306;
        __result = D.19304 - D.19307;
        D.19308 = __s2_len > 1;
        D.19298 = __result == 0;
        D.19309 = D.19308 & D.19298;
        if (D.19309 != 0) goto <D.19310>; else goto <D.19311>;
        <D.19310>:
        D.19312 = &MEM[(void *)"SocketAsyncResult" + 2B];
        D.19313 = *D.19312;
        D.19314 = (int) D.19313;
        D.19315 = __s2 + 2;
        D.19316 = *D.19315;
        D.19317 = (int) D.19316;
        __result = D.19314 - D.19317;
        D.19318 = __s2_len > 2;
        D.19298 = __result == 0;
        D.19319 = D.19318 & D.19298;
        if (D.19319 != 0) goto <D.19320>; else goto <D.19321>;
        <D.19320>:
        D.19322 = &MEM[(void *)"SocketAsyncResult" + 3B];
        D.19323 = *D.19322;
        D.19324 = (int) D.19323;
        D.19325 = __s2 + 3;
        D.19326 = *D.19325;
        D.19327 = (int) D.19326;
        __result = D.19324 - D.19327;
        <D.19321>:
        <D.19311>:
        <D.19301>:
      }
      D.18221 = __result;
    }
    iftmp.33 = -D.18221;
    goto <D.19328>;
    <D.19291>:
    D.19329 = klass->name;
    iftmp.33 = __builtin_strcmp (D.19329, "SocketAsyncResult");
    <D.19328>:
    D.18222 = iftmp.33;
  }
  if (D.18222 == 0) goto <D.19330>; else goto <D.19283>;
  <D.19330>:
  iftmp.32 = 1;
  goto <D.19284>;
  <D.19283>:
  iftmp.32 = 0;
  <D.19284>:
  D.19281 = iftmp.32;
  return D.19281;
}


is_socket (struct MonoDomain * domain, struct MonoClass * klass)
{
  struct MonoClass * D.19332;
  gboolean D.19335;
  _Bool D.19336;
  int D.19337;
  int D.18200;
  int iftmp.34;
  int D.18196;
  const char[7] * D.19343;
  unsigned char D.19344;
  int D.19345;
  unsigned char D.19346;
  int D.19347;
  _Bool D.19348;
  _Bool D.19349;
  _Bool D.19350;
  const unsigned char * D.19353;
  unsigned char D.19354;
  int D.19355;
  const unsigned char * D.19356;
  unsigned char D.19357;
  int D.19358;
  _Bool D.19359;
  _Bool D.19360;
  const unsigned char * D.19363;
  unsigned char D.19364;
  int D.19365;
  const unsigned char * D.19366;
  unsigned char D.19367;
  int D.19368;
  _Bool D.19369;
  _Bool D.19370;
  const unsigned char * D.19373;
  unsigned char D.19374;
  int D.19375;
  const unsigned char * D.19376;
  unsigned char D.19377;
  int D.19378;
  const char * D.19380;
  int D.18209;
  int iftmp.35;
  int D.18205;
  const char[19] * D.19386;
  unsigned char D.19387;
  int D.19388;
  unsigned char D.19389;
  int D.19390;
  _Bool D.19391;
  _Bool D.19392;
  _Bool D.19393;
  const unsigned char * D.19396;
  unsigned char D.19397;
  int D.19398;
  const unsigned char * D.19399;
  unsigned char D.19400;
  int D.19401;
  _Bool D.19402;
  _Bool D.19403;
  const unsigned char * D.19406;
  unsigned char D.19407;
  int D.19408;
  const unsigned char * D.19409;
  unsigned char D.19410;
  int D.19411;
  _Bool D.19412;
  _Bool D.19413;
  const unsigned char * D.19416;
  unsigned char D.19417;
  int D.19418;
  const unsigned char * D.19419;
  unsigned char D.19420;
  int D.19421;
  const char * D.19423;

  D.19332 = domain->socket_class;
  if (D.19332 != 0B) goto <D.19333>; else goto <D.19334>;
  <D.19333>:
  D.19332 = domain->socket_class;
  D.19336 = D.19332 == klass;
  D.19335 = (gboolean) D.19336;
  return D.19335;
  <D.19334>:
  D.19337 = is_socket_type (domain, klass);
  if (D.19337 != 0) goto <D.19338>; else goto <D.19339>;
  <D.19338>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 6;
    if (__s1_len <= 3) goto <D.19341>; else goto <D.19342>;
    <D.19341>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name;
      D.19343 = "Socket";
      D.19344 = MEM[(const unsigned char *)D.19343];
      D.19345 = (int) D.19344;
      D.19346 = *__s2;
      D.19347 = (int) D.19346;
      __result = D.19345 - D.19347;
      {
        D.19348 = __s1_len != 0;
        D.19349 = __result == 0;
        D.19350 = D.19348 & D.19349;
        if (D.19350 != 0) goto <D.19351>; else goto <D.19352>;
        <D.19351>:
        D.19353 = &MEM[(void *)"Socket" + 1B];
        D.19354 = *D.19353;
        D.19355 = (int) D.19354;
        D.19356 = __s2 + 1;
        D.19357 = *D.19356;
        D.19358 = (int) D.19357;
        __result = D.19355 - D.19358;
        D.19359 = __s1_len > 1;
        D.19349 = __result == 0;
        D.19360 = D.19359 & D.19349;
        if (D.19360 != 0) goto <D.19361>; else goto <D.19362>;
        <D.19361>:
        D.19363 = &MEM[(void *)"Socket" + 2B];
        D.19364 = *D.19363;
        D.19365 = (int) D.19364;
        D.19366 = __s2 + 2;
        D.19367 = *D.19366;
        D.19368 = (int) D.19367;
        __result = D.19365 - D.19368;
        D.19369 = __s1_len > 2;
        D.19349 = __result == 0;
        D.19370 = D.19369 & D.19349;
        if (D.19370 != 0) goto <D.19371>; else goto <D.19372>;
        <D.19371>:
        D.19373 = &MEM[(void *)"Socket" + 3B];
        D.19374 = *D.19373;
        D.19375 = (int) D.19374;
        D.19376 = __s2 + 3;
        D.19377 = *D.19376;
        D.19378 = (int) D.19377;
        __result = D.19375 - D.19378;
        <D.19372>:
        <D.19362>:
        <D.19352>:
      }
      D.18196 = __result;
    }
    iftmp.34 = D.18196;
    goto <D.19379>;
    <D.19342>:
    D.19380 = klass->name;
    iftmp.34 = __builtin_strcmp ("Socket", D.19380);
    <D.19379>:
    D.18200 = iftmp.34;
  }
  if (D.18200 == 0) goto <D.19381>; else goto <D.19382>;
  <D.19381>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 18;
    if (__s1_len <= 3) goto <D.19384>; else goto <D.19385>;
    <D.19384>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name_space;
      D.19386 = "System.Net.Sockets";
      D.19387 = MEM[(const unsigned char *)D.19386];
      D.19388 = (int) D.19387;
      D.19389 = *__s2;
      D.19390 = (int) D.19389;
      __result = D.19388 - D.19390;
      {
        D.19391 = __s1_len != 0;
        D.19392 = __result == 0;
        D.19393 = D.19391 & D.19392;
        if (D.19393 != 0) goto <D.19394>; else goto <D.19395>;
        <D.19394>:
        D.19396 = &MEM[(void *)"System.Net.Sockets" + 1B];
        D.19397 = *D.19396;
        D.19398 = (int) D.19397;
        D.19399 = __s2 + 1;
        D.19400 = *D.19399;
        D.19401 = (int) D.19400;
        __result = D.19398 - D.19401;
        D.19402 = __s1_len > 1;
        D.19392 = __result == 0;
        D.19403 = D.19402 & D.19392;
        if (D.19403 != 0) goto <D.19404>; else goto <D.19405>;
        <D.19404>:
        D.19406 = &MEM[(void *)"System.Net.Sockets" + 2B];
        D.19407 = *D.19406;
        D.19408 = (int) D.19407;
        D.19409 = __s2 + 2;
        D.19410 = *D.19409;
        D.19411 = (int) D.19410;
        __result = D.19408 - D.19411;
        D.19412 = __s1_len > 2;
        D.19392 = __result == 0;
        D.19413 = D.19412 & D.19392;
        if (D.19413 != 0) goto <D.19414>; else goto <D.19415>;
        <D.19414>:
        D.19416 = &MEM[(void *)"System.Net.Sockets" + 3B];
        D.19417 = *D.19416;
        D.19418 = (int) D.19417;
        D.19419 = __s2 + 3;
        D.19420 = *D.19419;
        D.19421 = (int) D.19420;
        __result = D.19418 - D.19421;
        <D.19415>:
        <D.19405>:
        <D.19395>:
      }
      D.18205 = __result;
    }
    iftmp.35 = D.18205;
    goto <D.19422>;
    <D.19385>:
    D.19423 = klass->name_space;
    iftmp.35 = __builtin_strcmp ("System.Net.Sockets", D.19423);
    <D.19422>:
    D.18209 = iftmp.35;
  }
  if (D.18209 == 0) goto <D.19424>; else goto <D.19425>;
  <D.19424>:
  domain->socket_class = klass;
  D.19335 = 1;
  return D.19335;
  <D.19425>:
  <D.19382>:
  <D.19339>:
  D.19335 = 0;
  return D.19335;
}


is_socket_type (struct MonoDomain * domain, struct MonoClass * klass)
{
  gboolean D.19427;

  D.19427 = is_system_type (domain, klass);
  return D.19427;
}


is_system_type (struct MonoDomain * domain, struct MonoClass * klass)
{
  struct MonoImage * D.19429;
  struct MonoImage * D.19432;
  gboolean D.19433;
  struct MonoImage * D.19434;
  _Bool D.19435;

  D.19429 = domain->system_image;
  if (D.19429 == 0B) goto <D.19430>; else goto <D.19431>;
  <D.19430>:
  D.19432 = mono_image_loaded ("System");
  domain->system_image = D.19432;
  <D.19431>:
  D.19434 = klass->image;
  D.19429 = domain->system_image;
  D.19435 = D.19434 == D.19429;
  D.19433 = (gboolean) D.19435;
  return D.19433;
}


threadpool_jobs_dec (struct MonoObject * obj)
{
  gboolean D.19439;
  struct MonoVTable * D.19440;
  volatile int * D.19441;
  void * D.19444;
  struct MonoDomain * domain;
  int remaining_jobs;

  if (obj == 0B) goto <D.19437>; else goto <D.19438>;
  <D.19437>:
  D.19439 = 0;
  return D.19439;
  <D.19438>:
  D.19440 = obj->vtable;
  domain = D.19440->domain;
  D.19441 = &domain->threadpool_jobs;
  remaining_jobs = InterlockedDecrement (D.19441);
  if (remaining_jobs == 0) goto <D.19442>; else goto <D.19443>;
  <D.19442>:
  D.19444 = domain->cleanup_semaphore;
  if (D.19444 != 0B) goto <D.19445>; else goto <D.19446>;
  <D.19445>:
  D.19444 = domain->cleanup_semaphore;
  ReleaseSemaphore (D.19444, 1, 0B);
  D.19439 = 1;
  return D.19439;
  <D.19446>:
  <D.19443>:
  D.19439 = 0;
  return D.19439;
}


process_idle_times (struct ThreadPool * tp, gint64 t)
{
  int D.19450;
  volatile gint * D.19452;
  int D.19453;
  int D.19455;
  long long int D.19458;
  long long int D.19459;
  int D.19460;
  int D.19461;
  long long int D.19462;
  long long int D.19466;
  long long int D.19469;
  long long int D.19470;
  long long int D.19475;
  int D.19476;
  long long int D.19477;
  long long int D.19478;
  long long int D.19482;
  long long int D.19483;
  long long int D.19484;
  long long int D.19489;
  int D.19499;
  int D.19502;
  int D.19507;
  volatile gint * D.19510;
  int D.19511;
  gint64 ticks;
  gint64 avg;
  gboolean compute_avg;
  gint new_threads;
  gint64 per1;

  D.19450 = tp->ignore_times;
  if (D.19450 != 0) goto <D.19448>; else goto <D.19451>;
  <D.19451>:
  if (t <= 0) goto <D.19448>; else goto <D.19449>;
  <D.19448>:
  return;
  <D.19449>:
  compute_avg = 0;
  ticks = mono_100ns_ticks ();
  t = ticks - t;
  <D.18626>:
  D.19452 = &tp->sp_lock;
  D.19453 = InterlockedCompareExchange (D.19452, 1, 0);
  if (D.19453 == 0) goto <D.18625>; else goto <D.19454>;
  <D.19454>:
  goto <D.18626>;
  <D.18625>:
  D.19455 = tp->ignore_times;
  if (D.19455 != 0) goto <D.19456>; else goto <D.19457>;
  <D.19456>:
  tp->sp_lock = 0;
  return;
  <D.19457>:
  D.19458 = tp->time_sum;
  D.19459 = D.19458 + t;
  tp->time_sum = D.19459;
  D.19460 = tp->n_sum;
  D.19461 = D.19460 + 1;
  tp->n_sum = D.19461;
  D.19462 = tp->last_check;
  if (D.19462 == 0) goto <D.19463>; else goto <D.19464>;
  <D.19463>:
  tp->last_check = ticks;
  goto <D.19465>;
  <D.19464>:
  D.19466 = tp->last_check;
  if (D.19466 > 0) goto <D.19467>; else goto <D.19468>;
  <D.19467>:
  D.19469 = tp->last_check;
  D.19470 = ticks - D.19469;
  if (D.19470 > 5000000) goto <D.19471>; else goto <D.19472>;
  <D.19471>:
  tp->ignore_times = 1;
  compute_avg = 1;
  <D.19472>:
  <D.19468>:
  <D.19465>:
  tp->sp_lock = 0;
  if (compute_avg == 0) goto <D.19473>; else goto <D.19474>;
  <D.19473>:
  return;
  <D.19474>:
  tp->last_check = ticks;
  new_threads = 0;
  D.19475 = tp->time_sum;
  D.19476 = tp->n_sum;
  D.19477 = (long long int) D.19476;
  avg = D.19475 / D.19477;
  D.19478 = tp->averages[1];
  if (D.19478 == 0) goto <D.19479>; else goto <D.19480>;
  <D.19479>:
  tp->averages[1] = avg;
  goto <D.19481>;
  <D.19480>:
  D.19478 = tp->averages[1];
  D.19482 = avg - D.19478;
  D.19483 = ABS_EXPR <D.19482>;
  D.19484 = D.19483 * 100;
  D.19478 = tp->averages[1];
  per1 = D.19484 / D.19478;
  if (per1 > 5) goto <D.19485>; else goto <D.19486>;
  <D.19485>:
  D.19478 = tp->averages[1];
  if (D.19478 < avg) goto <D.19487>; else goto <D.19488>;
  <D.19487>:
  D.19478 = tp->averages[1];
  D.19489 = tp->averages[0];
  if (D.19478 < D.19489) goto <D.19490>; else goto <D.19491>;
  <D.19490>:
  new_threads = -1;
  goto <D.19492>;
  <D.19491>:
  new_threads = 1;
  <D.19492>:
  goto <D.19493>;
  <D.19488>:
  D.19478 = tp->averages[1];
  if (D.19478 > avg) goto <D.19494>; else goto <D.19495>;
  <D.19494>:
  D.19478 = tp->averages[1];
  D.19489 = tp->averages[0];
  if (D.19478 < D.19489) goto <D.19496>; else goto <D.19497>;
  <D.19496>:
  new_threads = 1;
  <D.19497>:
  <D.19495>:
  <D.19493>:
  goto <D.19498>;
  <D.19486>:
  {
    int min;
    int n;

    min = tp->min_threads;
    n = tp->nthreads;
    D.19499 = n - min;
    if (D.19499 < min) goto <D.19500>; else goto <D.19501>;
    <D.19500>:
    D.19502 = tp->busy_threads;
    if (D.19502 == n) goto <D.19503>; else goto <D.19504>;
    <D.19503>:
    new_threads = 1;
    <D.19504>:
    <D.19501>:
  }
  <D.19498>:
  <D.19481>:
  tp->time_sum = 0;
  tp->n_sum = 0;
  D.19478 = tp->averages[1];
  tp->averages[0] = D.19478;
  tp->averages[1] = avg;
  tp->ignore_times = 0;
  if (new_threads == -1) goto <D.19505>; else goto <D.19506>;
  <D.19505>:
  D.19507 = tp->destroy_thread;
  if (D.19507 == 0) goto <D.19508>; else goto <D.19509>;
  <D.19508>:
  D.19510 = &tp->destroy_thread;
  D.19511 = InterlockedCompareExchange (D.19510, 1, 0);
  if (D.19511 == 0) goto <D.19512>; else goto <D.19513>;
  <D.19512>:
  pulse_on_new_job (tp);
  <D.19513>:
  <D.19509>:
  <D.19506>:
}


mono_async_invoke (struct ThreadPool * tp, struct MonoAsyncResult * ares)
{
  struct MonoAsyncResult * ares.36;
  struct MonoObject * D.19516;
  struct MonoObject * D.19519;
  struct MonoObject * * D.19520;
  struct MonoObject * pa.37;
  struct MonoObject * D.19525;
  struct MonoMethod * D.19526;
  struct MonoMethodMessage * D.19528;
  struct MonoObject * * D.19529;
  struct MonoObject * exc.38;
  struct MonoObject * * D.19531;
  struct MonoArray * out_args.39;
  struct MonoArray * * D.19533;
  struct MonoObject * D.19534;
  struct MonoMethod * D.19542;
  struct MonoDelegate * D.19544;
  struct MonoObject * cb_exc.40;
  struct MonoObject * D.19546;
  struct MonoObject * D.19549;
  struct ASyncCall * ac;
  struct MonoObject * res;
  struct MonoObject * exc;
  struct MonoArray * out_args;
  void * wait_event;
  struct MonoInternalThread * thread;

  try
    {
      ares.36 = ares;
      ac = ares.36->object_data;
      exc = 0B;
      out_args = 0B;
      wait_event = 0B;
      thread = mono_thread_internal_current ();
      ares.36 = ares;
      D.19516 = ares.36->execution_context;
      if (D.19516 != 0B) goto <D.19517>; else goto <D.19518>;
      <D.19517>:
      D.19519 = mono_thread_get_execution_context ();
      ares.36 = ares;
      D.19520 = &ares.36->original_context;
      ares.36 = ares;
      mono_gc_wbarrier_set_field (ares.36, D.19520, D.19519);
      ares.36 = ares;
      D.19516 = ares.36->execution_context;
      mono_thread_set_execution_context (D.19516);
      goto <D.19521>;
      <D.19518>:
      ares.36 = ares;
      ares.36->original_context = 0B;
      <D.19521>:
      if (ac == 0B) goto <D.19522>; else goto <D.19523>;
      <D.19522>:
      {
        void * pa;

        try
          {
            ares.36 = ares;
            pa.37 = ares.36->async_state;
            pa = pa.37;
            ares.36 = ares;
            D.19525 = ares.36->async_delegate;
            D.19526 = MEM[(struct MonoDelegate *)D.19525].method;
            thread->async_invoke_method = D.19526;
            ares.36 = ares;
            D.19525 = ares.36->async_delegate;
            res = mono_runtime_delegate_invoke (D.19525, &pa, &exc);
            thread->async_invoke_method = 0B;
          }
        finally
          {
            pa = {CLOBBER};
          }
      }
      goto <D.19527>;
      <D.19523>:
      {
        struct MonoObject * cb_exc;

        try
          {
            cb_exc = 0B;
            D.19528 = ac->msg;
            D.19528->exc = 0B;
            D.19528 = ac->msg;
            ares.36 = ares;
            D.19525 = ares.36->async_delegate;
            res = mono_message_invoke (D.19525, D.19528, &exc, &out_args);
            D.19529 = &ac->res;
            mono_gc_wbarrier_set_field (ac, D.19529, res);
            exc.38 = exc;
            D.19528 = ac->msg;
            D.19531 = &D.19528->exc;
            mono_gc_wbarrier_set_field (ac, D.19531, exc.38);
            out_args.39 = out_args;
            D.19533 = &ac->out_args;
            mono_gc_wbarrier_set_field (ac, D.19533, out_args.39);
            ares.36 = ares;
            mono_monitor_enter (ares.36);
            ares.36 = ares;
            ares.36->completed = 1;
            ares.36 = ares;
            D.19534 = ares.36->handle;
            if (D.19534 != 0B) goto <D.19535>; else goto <D.19536>;
            <D.19535>:
            ares.36 = ares;
            D.19534 = ares.36->handle;
            wait_event = mono_wait_handle_get_handle (D.19534);
            <D.19536>:
            ares.36 = ares;
            mono_monitor_exit (ares.36);
            if (wait_event != 0B) goto <D.19537>; else goto <D.19538>;
            <D.19537>:
            SetEvent (wait_event);
            <D.19538>:
            if (ac != 0B) goto <D.19541>; else goto <D.19539>;
            <D.19541>:
            D.19542 = ac->cb_method;
            if (D.19542 != 0B) goto <D.19543>; else goto <D.19539>;
            <D.19543>:
            {
              void * pa;

              pa = &ares;
              cb_exc = 0B;
              D.19542 = ac->cb_method;
              thread->async_invoke_method = D.19542;
              D.19544 = ac->cb_target;
              D.19542 = ac->cb_method;
              mono_runtime_invoke (D.19542, D.19544, pa, &cb_exc);
              thread->async_invoke_method = 0B;
              cb_exc.40 = cb_exc;
              exc = cb_exc.40;
            }
            goto <D.19540>;
            <D.19539>:
            exc = 0B;
            <D.19540>:
          }
        finally
          {
            cb_exc = {CLOBBER};
          }
      }
      <D.19527>:
      ares.36 = ares;
      D.19546 = ares.36->original_context;
      if (D.19546 != 0B) goto <D.19547>; else goto <D.19548>;
      <D.19547>:
      ares.36 = ares;
      D.19546 = ares.36->original_context;
      mono_thread_set_execution_context (D.19546);
      ares.36 = ares;
      ares.36->original_context = 0B;
      <D.19548>:
      D.19549 = exc;
      return D.19549;
    }
  finally
    {
      exc = {CLOBBER};
      out_args = {CLOBBER};
    }
}


create_simple_asyncresult (struct MonoObject * target, struct MonoObject * state)
{
  struct MonoClass * D.19552;
  struct MonoObject * * D.19553;
  struct MonoObject * * D.19554;
  struct MonoAsyncResult * D.19555;
  struct MonoDomain * domain;
  struct MonoAsyncResult * ares;

  domain = mono_domain_get ();
  D.19552 = mono_defaults.asyncresult_class;
  ares = mono_object_new (domain, D.19552);
  D.19553 = &ares->async_delegate;
  mono_gc_wbarrier_set_field (ares, D.19553, target);
  D.19554 = &ares->async_state;
  mono_gc_wbarrier_set_field (ares, D.19554, state);
  D.19555 = ares;
  return D.19555;
}


clear_thread_state ()
{
  int D.19557;
  struct MonoInternalThread * thread;

  thread = mono_thread_internal_current ();
  mono_thread_clr_state (thread, 4294967291);
  D.19557 = mono_thread_test_state (thread, 4);
  if (D.19557 == 0) goto <D.19558>; else goto <D.19559>;
  <D.19558>:
  ves_icall_System_Threading_Thread_SetState (thread, 4);
  <D.19559>:
}


check_for_interruption_critical ()
{
  unsigned int D.19560;
  unsigned int D.19561;
  struct MonoInternalThread * thread;

  mono_gc_set_skip_thread (0);
  thread = mono_thread_internal_current ();
  D.19560 = thread->state;
  D.19561 = D.19560 & 3;
  if (D.19561 != 0) goto <D.19562>; else goto <D.19563>;
  <D.19562>:
  mono_thread_interruption_checkpoint ();
  <D.19563>:
  mono_gc_set_skip_thread (1);
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.19564;
  unsigned int D.19565;

  D.19565 = __sync_sub_and_fetch_4 (val, 1);
  D.19564 = (gint32) D.19565;
  return D.19564;
}


should_i_die (struct ThreadPool * tp)
{
  int D.19567;
  volatile gint * D.19570;
  int D.19571;
  int D.19574;
  int D.19575;
  _Bool D.19576;
  gboolean D.19577;
  gboolean result;

  result = 0;
  D.19567 = tp->destroy_thread;
  if (D.19567 == 1) goto <D.19568>; else goto <D.19569>;
  <D.19568>:
  D.19570 = &tp->destroy_thread;
  D.19571 = InterlockedCompareExchange (D.19570, 0, 1);
  if (D.19571 == 1) goto <D.19572>; else goto <D.19573>;
  <D.19572>:
  D.19574 = tp->nthreads;
  D.19575 = tp->min_threads;
  D.19576 = D.19574 > D.19575;
  result = (gboolean) D.19576;
  <D.19573>:
  <D.19569>:
  D.19577 = result;
  return D.19577;
}


dequeue_or_steal (struct ThreadPool * tp, void * * data, struct MonoWSQ * local_wsq)
{
  int D.19579;
  gboolean D.19582;
  struct MonoCQ * D.19583;
  int D.19584;
  void * D.19587;
  _Bool D.19590;

  D.19579 = mono_runtime_is_shutting_down ();
  if (D.19579 != 0) goto <D.19580>; else goto <D.19581>;
  <D.19580>:
  D.19582 = 0;
  return D.19582;
  <D.19581>:
  D.19583 = tp->queue;
  mono_cq_dequeue (D.19583, data);
  D.19584 = tp->is_io;
  if (D.19584 == 0) goto <D.19585>; else goto <D.19586>;
  <D.19585>:
  D.19587 = *data;
  if (D.19587 == 0B) goto <D.19588>; else goto <D.19589>;
  <D.19588>:
  try_steal (local_wsq, data, 0);
  <D.19589>:
  <D.19586>:
  D.19587 = *data;
  D.19590 = D.19587 != 0B;
  D.19582 = (gboolean) D.19590;
  return D.19582;
}


try_steal (struct MonoWSQ * local_wsq, void * * data, gboolean retry)
{
  struct GPtrArray * wsqs.41;
  void * D.19597;
  int D.19598;
  _Bool D.19603;
  long int D.19604;
  long int D.19605;
  void * * D.19608;
  unsigned int i.42;
  unsigned int D.19610;
  void * * D.19611;
  int D.19615;
  unsigned int ms.43;
  void * D.19617;
  _Bool D.19622;
  long int D.19623;
  long int D.19624;
  unsigned int i.44;
  unsigned int D.19629;
  _Bool D.19632;
  long int D.19633;
  long int D.19634;
  _Bool D.19637;
  _Bool D.19638;
  _Bool D.19639;
  int i;
  int ms;

  wsqs.41 = wsqs;
  if (wsqs.41 == 0B) goto <D.19592>; else goto <D.19595>;
  <D.19595>:
  if (data == 0B) goto <D.19592>; else goto <D.19596>;
  <D.19596>:
  D.19597 = *data;
  if (D.19597 != 0B) goto <D.19592>; else goto <D.19593>;
  <D.19592>:
  return;
  <D.19593>:
  ms = 0;
  <D.18609>:
  D.19598 = mono_runtime_is_shutting_down ();
  if (D.19598 != 0) goto <D.19599>; else goto <D.19600>;
  <D.19599>:
  return;
  <D.19600>:
  {
    int ret;

    ret = pthread_mutex_lock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.19601>; else goto <D.19602>;
    <D.19601>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19602>:
    D.19603 = ret != 0;
    D.19604 = (long int) D.19603;
    D.19605 = __builtin_expect (D.19604, 0);
    if (D.19605 != 0) goto <D.19606>; else goto <D.19607>;
    <D.19606>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1282, "ret == 0");
    <D.19607>:
  }
  i = 0;
  goto <D.18606>;
  <D.18605>:
  {
    struct MonoWSQ * wsq;

    wsqs.41 = wsqs;
    D.19608 = wsqs.41->pdata;
    i.42 = (unsigned int) i;
    D.19610 = i.42 * 4;
    D.19611 = D.19608 + D.19610;
    wsq = *D.19611;
    if (wsq == local_wsq) goto <D.19612>; else goto <D.19614>;
    <D.19614>:
    D.19615 = mono_wsq_count (wsq);
    if (D.19615 == 0) goto <D.19612>; else goto <D.19613>;
    <D.19612>:
    // predicted unlikely by continue predictor.
    goto <D.18603>;
    <D.19613>:
    ms.43 = (unsigned int) ms;
    wsqs.41 = wsqs;
    D.19608 = wsqs.41->pdata;
    i.42 = (unsigned int) i;
    D.19610 = i.42 * 4;
    D.19611 = D.19608 + D.19610;
    D.19617 = *D.19611;
    mono_wsq_try_steal (D.19617, data, ms.43);
    D.19597 = *data;
    if (D.19597 != 0B) goto <D.19618>; else goto <D.19619>;
    <D.19618>:
    {
      int ret;

      ret = pthread_mutex_unlock (&wsqs_lock.mutex);
      if (ret != 0) goto <D.19620>; else goto <D.19621>;
      <D.19620>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.19621>:
      D.19622 = ret != 0;
      D.19623 = (long int) D.19622;
      D.19624 = __builtin_expect (D.19623, 0);
      if (D.19624 != 0) goto <D.19625>; else goto <D.19626>;
      <D.19625>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1291, "ret == 0");
      <D.19626>:
    }
    return;
    <D.19619>:
  }
  <D.18603>:
  i = i + 1;
  <D.18606>:
  wsqs.41 = wsqs;
  if (wsqs.41 != 0B) goto <D.19627>; else goto <D.18607>;
  <D.19627>:
  i.44 = (unsigned int) i;
  wsqs.41 = wsqs;
  D.19629 = wsqs.41->len;
  if (i.44 < D.19629) goto <D.18605>; else goto <D.18607>;
  <D.18607>:
  {
    int ret;

    ret = pthread_mutex_unlock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.19630>; else goto <D.19631>;
    <D.19630>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19631>:
    D.19632 = ret != 0;
    D.19633 = (long int) D.19632;
    D.19634 = __builtin_expect (D.19633, 0);
    if (D.19634 != 0) goto <D.19635>; else goto <D.19636>;
    <D.19635>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1295, "ret == 0");
    <D.19636>:
  }
  ms = ms + 10;
  D.19637 = retry != 0;
  D.19638 = ms <= 10;
  D.19639 = D.19637 & D.19638;
  if (D.19639 != 0) goto <D.18609>; else goto <D.18610>;
  <D.18610>:
}


remove_wsq (struct MonoWSQ * wsq)
{
  _Bool D.19645;
  long int D.19646;
  long int D.19647;
  struct GPtrArray * wsqs.45;
  _Bool D.19655;
  long int D.19656;
  long int D.19657;
  int D.19660;
  void * data.46;
  int D.19664;
  _Bool D.19667;
  long int D.19668;
  long int D.19669;
  void * data;

  try
    {
      if (wsq == 0B) goto <D.19641>; else goto <D.19642>;
      <D.19641>:
      return;
      <D.19642>:
      {
        int ret;

        ret = pthread_mutex_lock (&wsqs_lock.mutex);
        if (ret != 0) goto <D.19643>; else goto <D.19644>;
        <D.19643>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.19644>:
        D.19645 = ret != 0;
        D.19646 = (long int) D.19645;
        D.19647 = __builtin_expect (D.19646, 0);
        if (D.19647 != 0) goto <D.19648>; else goto <D.19649>;
        <D.19648>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1247, "ret == 0");
        <D.19649>:
      }
      wsqs.45 = wsqs;
      if (wsqs.45 == 0B) goto <D.19651>; else goto <D.19652>;
      <D.19651>:
      {
        int ret;

        ret = pthread_mutex_unlock (&wsqs_lock.mutex);
        if (ret != 0) goto <D.19653>; else goto <D.19654>;
        <D.19653>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19654>:
        D.19655 = ret != 0;
        D.19656 = (long int) D.19655;
        D.19657 = __builtin_expect (D.19656, 0);
        if (D.19657 != 0) goto <D.19658>; else goto <D.19659>;
        <D.19658>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1249, "ret == 0");
        <D.19659>:
      }
      return;
      <D.19652>:
      wsqs.45 = wsqs;
      monoeg_g_ptr_array_remove_fast (wsqs.45, wsq);
      data = 0B;
      D.19660 = mono_runtime_is_shutting_down ();
      if (D.19660 != 0) goto <D.19661>; else goto <D.19662>;
      <D.19661>:
      goto <D.18591>;
      <D.18590>:
      data.46 = data;
      threadpool_jobs_dec (data.46);
      data = 0B;
      <D.18591>:
      D.19664 = mono_wsq_local_pop (&data);
      if (D.19664 != 0) goto <D.18590>; else goto <D.18592>;
      <D.18592>:
      <D.19662>:
      mono_wsq_destroy (wsq);
      {
        int ret;

        ret = pthread_mutex_unlock (&wsqs_lock.mutex);
        if (ret != 0) goto <D.19665>; else goto <D.19666>;
        <D.19665>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19666>:
        D.19667 = ret != 0;
        D.19668 = (long int) D.19667;
        D.19669 = __builtin_expect (D.19668, 0);
        if (D.19669 != 0) goto <D.19670>; else goto <D.19671>;
        <D.19670>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1265, "ret == 0");
        <D.19671>:
      }
    }
  finally
    {
      data = {CLOBBER};
    }
}


fire_profiler_thread_end ()
{
  long long unsigned int D.19675;
  unsigned int D.19676;
  struct MonoInternalThread * thread;

  thread = mono_thread_internal_current ();
  D.19675 = thread->tid;
  D.19676 = (unsigned int) D.19675;
  mono_profiler_thread_end (D.19676);
}


atoi (const char * __nptr)
{
  int D.19677;

  D.19677 = strtol (__nptr, 0B, 10);
  return D.19677;
}


threadpool_init (struct ThreadPool * tp, int min_threads, int max_threads, void (*<Tb27>) (void *) async_invoke)
{
  struct MonoCQ * D.19679;
  union MonoSemType * D.19680;

  memset (tp, 0, 124);
  tp->min_threads = min_threads;
  tp->max_threads = max_threads;
  tp->async_invoke = async_invoke;
  D.19679 = mono_cq_create ();
  tp->queue = D.19679;
  D.19680 = &tp->new_job;
  sem_init (D.19680, 0, 0);
}


memset (void * __dest, int __ch, size_t __len)
{
  int D.19683;
  int D.19688;
  void * D.19690;
  unsigned int D.19691;

  D.19683 = __builtin_constant_p (__len);
  if (D.19683 != 0) goto <D.19684>; else goto <D.19685>;
  <D.19684>:
  if (__len == 0) goto <D.19686>; else goto <D.19687>;
  <D.19686>:
  D.19688 = __builtin_constant_p (__ch);
  if (D.19688 == 0) goto <D.19681>; else goto <D.19689>;
  <D.19689>:
  if (__ch != 0) goto <D.19681>; else goto <D.19682>;
  <D.19681>:
  __warn_memset_zero_len ();
  D.19690 = __dest;
  return D.19690;
  <D.19682>:
  <D.19687>:
  <D.19685>:
  D.19691 = __builtin_object_size (__dest, 0);
  D.19690 = __builtin___memset_chk (__dest, __ch, __len, D.19691);
  return D.19690;
}


init_perf_counter (const char * category, const char * counter)
{
  _Bool D.19693;
  _Bool D.19694;
  _Bool D.19695;
  void * D.19698;
  struct MonoString * category_str;
  struct MonoString * counter_str;
  struct MonoString * machine;
  struct MonoDomain * root;
  MonoBoolean custom;
  int type;

  try
    {
      D.19693 = category == 0B;
      D.19694 = counter == 0B;
      D.19695 = D.19693 | D.19694;
      if (D.19695 != 0) goto <D.19696>; else goto <D.19697>;
      <D.19696>:
      D.19698 = 0B;
      return D.19698;
      <D.19697>:
      root = mono_get_root_domain ();
      category_str = mono_string_new (root, category);
      counter_str = mono_string_new (root, counter);
      machine = mono_string_new (root, ".");
      D.19698 = mono_perfcounter_get_impl (category_str, counter_str, 0B, machine, &type, &custom);
      return D.19698;
    }
  finally
    {
      custom = {CLOBBER};
      type = {CLOBBER};
    }
}


icall_append_io_job (struct MonoObject * target, struct MonoSocketAsyncResult * state)
{
  struct MonoAsyncResult * ares;

  ares = create_simple_asyncresult (target, state);
  socket_io_add (ares, state);
}


socket_io_add (struct MonoAsyncResult * ares, struct MonoSocketAsyncResult * state)
{
  int D.19703;
  int D.19705;
  struct MonoGHashTable * D.19707;
  int D.19708;
  struct MonoAsyncResult * * D.19711;
  void * D.19712;
  union mono_mutex_t * D.19713;
  _Bool D.19716;
  long int D.19717;
  long int D.19718;
  _Bool D.19725;
  long int D.19726;
  long int D.19727;
  const void * fd.47;
  void (*<T2ee2>) (void *, int, int, int, gboolean) D.19734;
  int D.19735;
  struct MonoMList * list;
  struct SocketIOData * data;
  int fd;
  gboolean is_new;
  int ievt;

  data = &socket_io_data;
  socket_io_init (&socket_io_data);
  D.19703 = mono_runtime_is_shutting_down ();
  if (D.19703 != 0) goto <D.19701>; else goto <D.19704>;
  <D.19704>:
  D.19705 = data->inited;
  if (D.19705 == 3) goto <D.19701>; else goto <D.19706>;
  <D.19706>:
  D.19707 = data->sock_to_state;
  if (D.19707 == 0B) goto <D.19701>; else goto <D.19702>;
  <D.19701>:
  return;
  <D.19702>:
  D.19708 = async_tp.pool_status;
  if (D.19708 == 2) goto <D.19709>; else goto <D.19710>;
  <D.19709>:
  return;
  <D.19710>:
  D.19711 = &state->ares;
  mono_gc_wbarrier_set_field (state, D.19711, ares);
  D.19712 = state->handle;
  fd = (int) D.19712;
  {
    int ret;

    D.19713 = &data->io_lock.mutex;
    ret = pthread_mutex_lock (D.19713);
    if (ret != 0) goto <D.19714>; else goto <D.19715>;
    <D.19714>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19715>:
    D.19716 = ret != 0;
    D.19717 = (long int) D.19716;
    D.19718 = __builtin_expect (D.19717, 0);
    if (D.19718 != 0) goto <D.19719>; else goto <D.19720>;
    <D.19719>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 546, "ret == 0");
    <D.19720>:
  }
  D.19707 = data->sock_to_state;
  if (D.19707 == 0B) goto <D.19721>; else goto <D.19722>;
  <D.19721>:
  {
    int ret;

    D.19713 = &data->io_lock.mutex;
    ret = pthread_mutex_unlock (D.19713);
    if (ret != 0) goto <D.19723>; else goto <D.19724>;
    <D.19723>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19724>:
    D.19725 = ret != 0;
    D.19726 = (long int) D.19725;
    D.19727 = __builtin_expect (D.19726, 0);
    if (D.19727 != 0) goto <D.19728>; else goto <D.19729>;
    <D.19728>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 548, "ret == 0");
    <D.19729>:
  }
  return;
  <D.19722>:
  fd.47 = (const void *) fd;
  D.19707 = data->sock_to_state;
  list = mono_g_hash_table_lookup (D.19707, fd.47);
  if (list == 0B) goto <D.19731>; else goto <D.19732>;
  <D.19731>:
  list = mono_mlist_alloc (state);
  is_new = 1;
  goto <D.19733>;
  <D.19732>:
  list = mono_mlist_append (list, state);
  is_new = 0;
  <D.19733>:
  D.19712 = state->handle;
  D.19707 = data->sock_to_state;
  mono_g_hash_table_replace (D.19707, D.19712, list);
  ievt = get_events_from_list (list);
  D.19734 = data->modify;
  D.19735 = state->operation;
  D.19734 (data, fd, D.19735, ievt, is_new);
}


socket_io_init (struct SocketIOData * data)
{
  int D.19737;
  int * D.19740;
  union mono_mutex_t * D.19745;
  _Bool D.19748;
  long int D.19749;
  long int D.19750;
  struct MonoGHashTable * D.19753;
  const gchar * D.19754;
  void (*<Tb27>) (void *) D.19757;
  struct MonoDomain * D.19758;
  _Bool D.19761;
  long int D.19762;
  long int D.19763;
  int inited;

  D.19737 = data->inited;
  if (D.19737 > 1) goto <D.19738>; else goto <D.19739>;
  <D.19738>:
  return;
  <D.19739>:
  D.19740 = &data->inited;
  inited = InterlockedCompareExchange (D.19740, 1, 0);
  if (inited > 0) goto <D.19741>; else goto <D.19742>;
  <D.19741>:
  <D.18361>:
  D.19737 = data->inited;
  if (D.19737 > 1) goto <D.19743>; else goto <D.19744>;
  <D.19743>:
  return;
  <D.19744>:
  SleepEx (1, 0);
  goto <D.18361>;
  <D.19742>:
  {
    int ret;

    D.19745 = &data->io_lock.mutex;
    ret = pthread_mutex_lock (D.19745);
    if (ret != 0) goto <D.19746>; else goto <D.19747>;
    <D.19746>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19747>:
    D.19748 = ret != 0;
    D.19749 = (long int) D.19748;
    D.19750 = __builtin_expect (D.19749, 0);
    if (D.19750 != 0) goto <D.19751>; else goto <D.19752>;
    <D.19751>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 509, "ret == 0");
    <D.19752>:
  }
  D.19753 = mono_g_hash_table_new_type (monoeg_g_direct_hash, monoeg_g_direct_equal, 2);
  data->sock_to_state = D.19753;
  data->event_system = 1;
  D.19754 = monoeg_g_getenv ("MONO_DISABLE_AIO");
  if (D.19754 != 0B) goto <D.19755>; else goto <D.19756>;
  <D.19755>:
  data->event_system = 0;
  <D.19756>:
  init_event_system (data);
  D.19757 = data->wait;
  D.19758 = mono_get_root_domain ();
  mono_thread_create_internal (D.19758, D.19757, data, 1, 0, 131072);
  {
    int ret;

    D.19745 = &data->io_lock.mutex;
    ret = pthread_mutex_unlock (D.19745);
    if (ret != 0) goto <D.19759>; else goto <D.19760>;
    <D.19759>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19760>:
    D.19761 = ret != 0;
    D.19762 = (long int) D.19761;
    D.19763 = __builtin_expect (D.19762, 0);
    if (D.19763 != 0) goto <D.19764>; else goto <D.19765>;
    <D.19764>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 523, "ret == 0");
    <D.19765>:
  }
  data->inited = 2;
  threadpool_start_thread (&async_io_tp);
}


init_event_system (struct SocketIOData * data)
{
  int D.19767;
  void * D.19770;
  void * D.19771;
  const gchar * D.19774;
  void * D.19779;

  D.19767 = data->event_system;
  if (D.19767 == 1) goto <D.19768>; else goto <D.19769>;
  <D.19768>:
  D.19770 = tp_epoll_init (data);
  data->event_data = D.19770;
  D.19771 = data->event_data;
  if (D.19771 == 0B) goto <D.19772>; else goto <D.19773>;
  <D.19772>:
  D.19774 = monoeg_g_getenv ("MONO_DEBUG");
  if (D.19774 != 0B) goto <D.19775>; else goto <D.19776>;
  <D.19775>:
  monoeg_g_log (0B, 32, "Falling back to poll()");
  <D.19776>:
  data->event_system = 0;
  <D.19773>:
  <D.19769>:
  D.19767 = data->event_system;
  if (D.19767 == 0) goto <D.19777>; else goto <D.19778>;
  <D.19777>:
  D.19779 = tp_poll_init (data);
  data->event_data = D.19779;
  <D.19778>:
}


tp_epoll_init (struct SocketIOData * data)
{
  int D.19780;
  int D.19781;
  int * D.19784;
  const gchar * D.19785;
  const gchar * D.19788;
  void * D.19789;
  struct tp_epoll_data * result;

  result = monoeg_malloc0 (4);
  D.19780 = epoll_create1 (524288);
  result->epollfd = D.19780;
  D.19781 = result->epollfd;
  if (D.19781 == -1) goto <D.19782>; else goto <D.19783>;
  <D.19782>:
  {
    int err;

    D.19784 = __errno_location ();
    err = *D.19784;
    D.19785 = monoeg_g_getenv ("MONO_DEBUG");
    if (D.19785 != 0B) goto <D.19786>; else goto <D.19787>;
    <D.19786>:
    D.19788 = monoeg_g_strerror (err);
    monoeg_g_log (0B, 32, "epoll_create1(EPOLL_CLOEXEC) failed: %d %s", err, D.19788);
    <D.19787>:
    D.19789 = 0B;
    return D.19789;
  }
  <D.19783>:
  data->shutdown = tp_epoll_shutdown;
  data->modify = tp_epoll_modify;
  data->wait = tp_epoll_wait;
  D.19789 = result;
  return D.19789;
}


tp_epoll_wait (void * p)
{
  int * D.19794;
  int D.19795;
  const gchar * D.19800;
  union mono_mutex_t * D.19801;
  _Bool D.19804;
  long int D.19805;
  long int D.19806;
  int D.19809;
  _Bool D.19814;
  long int D.19815;
  long int D.19816;
  unsigned int i.48;
  unsigned int D.19820;
  const void * fd.49;
  struct MonoGHashTable * D.19822;
  void * list.50;
  struct MonoMList * list.51;
  unsigned int D.19827;
  unsigned int D.19828;
  int nresults.52;
  unsigned int D.19836;
  int nresults.53;
  void * fd.54;
  unsigned int p.55;
  unsigned int D.19846;
  unsigned int D.19847;
  unsigned int D.19848;
  int D.19849;
  int D.19852;
  const gchar * D.19855;
  _Bool D.19859;
  long int D.19860;
  long int D.19861;
  unsigned int nresults.56;
  unsigned int D.19865;
  struct SocketIOData * socket_io_data;
  int epollfd;
  struct epoll_event * events;
  struct epoll_event * evt;
  int ready;
  int i;
  void * async_results[256];
  gint nresults;
  struct tp_epoll_data * data;

  try
    {
      ready = 0;
      socket_io_data = p;
      data = socket_io_data->event_data;
      epollfd = data->epollfd;
      events = monoeg_malloc0 (1536);
      <D.18153>:
      mono_gc_set_skip_thread (1);
      <D.18139>:
      if (ready == -1) goto <D.19791>; else goto <D.19792>;
      <D.19791>:
      check_for_interruption_critical ();
      <D.19792>:
      ready = epoll_wait (epollfd, events, 128, -1);
      if (ready == -1) goto <D.19793>; else goto <D.18140>;
      <D.19793>:
      D.19794 = __errno_location ();
      D.19795 = *D.19794;
      if (D.19795 == 4) goto <D.18139>; else goto <D.18140>;
      <D.18140>:
      mono_gc_set_skip_thread (0);
      if (ready == -1) goto <D.19796>; else goto <D.19797>;
      <D.19796>:
      {
        int err;

        D.19794 = __errno_location ();
        err = *D.19794;
        monoeg_g_free (events);
        if (err != 9) goto <D.19798>; else goto <D.19799>;
        <D.19798>:
        D.19800 = monoeg_g_strerror (err);
        monoeg_g_log (0B, 16, "epoll_wait: %d %s", err, D.19800);
        <D.19799>:
        return;
      }
      <D.19797>:
      {
        int ret;

        D.19801 = &socket_io_data->io_lock.mutex;
        ret = pthread_mutex_lock (D.19801);
        if (ret != 0) goto <D.19802>; else goto <D.19803>;
        <D.19802>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.19803>:
        D.19804 = ret != 0;
        D.19805 = (long int) D.19804;
        D.19806 = __builtin_expect (D.19805, 0);
        if (D.19806 != 0) goto <D.19807>; else goto <D.19808>;
        <D.19807>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-epoll.c", 132, "ret == 0");
        <D.19808>:
      }
      D.19809 = socket_io_data->inited;
      if (D.19809 == 3) goto <D.19810>; else goto <D.19811>;
      <D.19810>:
      monoeg_g_free (events);
      {
        int ret;

        D.19801 = &socket_io_data->io_lock.mutex;
        ret = pthread_mutex_unlock (D.19801);
        if (ret != 0) goto <D.19812>; else goto <D.19813>;
        <D.19812>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19813>:
        D.19814 = ret != 0;
        D.19815 = (long int) D.19814;
        D.19816 = __builtin_expect (D.19815, 0);
        if (D.19816 != 0) goto <D.19817>; else goto <D.19818>;
        <D.19817>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-epoll.c", 135, "ret == 0");
        <D.19818>:
      }
      return;
      <D.19811>:
      nresults = 0;
      i = 0;
      goto <D.18150>;
      <D.18149>:
      {
        int fd;
        struct MonoMList * list;
        struct MonoObject * ares;

        try
          {
            i.48 = (unsigned int) i;
            D.19820 = i.48 * 12;
            evt = events + D.19820;
            fd = evt->data.fd;
            fd.49 = (const void *) fd;
            D.19822 = socket_io_data->sock_to_state;
            list.50 = mono_g_hash_table_lookup (D.19822, fd.49);
            list = list.50;
            list.51 = list;
            if (list.51 != 0B) goto <D.19825>; else goto <D.19826>;
            <D.19825>:
            D.19827 = evt->events;
            D.19828 = D.19827 & 25;
            if (D.19828 != 0) goto <D.19829>; else goto <D.19830>;
            <D.19829>:
            ares = get_io_event (&list, 1);
            if (ares != 0B) goto <D.19831>; else goto <D.19832>;
            <D.19831>:
            nresults.52 = nresults;
            nresults = nresults.52 + 1;
            async_results[nresults.52] = ares;
            <D.19832>:
            <D.19830>:
            <D.19826>:
            list.51 = list;
            if (list.51 != 0B) goto <D.19834>; else goto <D.19835>;
            <D.19834>:
            D.19827 = evt->events;
            D.19836 = D.19827 & 28;
            if (D.19836 != 0) goto <D.19837>; else goto <D.19838>;
            <D.19837>:
            ares = get_io_event (&list, 4);
            if (ares != 0B) goto <D.19839>; else goto <D.19840>;
            <D.19839>:
            nresults.53 = nresults;
            nresults = nresults.53 + 1;
            async_results[nresults.53] = ares;
            <D.19840>:
            <D.19838>:
            <D.19835>:
            list.51 = list;
            if (list.51 != 0B) goto <D.19842>; else goto <D.19843>;
            <D.19842>:
            {
              int p;

              list.51 = list;
              fd.54 = (void *) fd;
              D.19822 = socket_io_data->sock_to_state;
              mono_g_hash_table_replace (D.19822, fd.54, list.51);
              list.51 = list;
              p = get_events_from_list (list.51);
              p.55 = (unsigned int) p;
              D.19846 = p.55 & 4;
              evt->events = D.19846;
              D.19827 = evt->events;
              p.55 = (unsigned int) p;
              D.19847 = p.55 & 1;
              D.19848 = D.19827 | D.19847;
              evt->events = D.19848;
              D.19849 = epoll_ctl (epollfd, 3, fd, evt);
              if (D.19849 == -1) goto <D.19850>; else goto <D.19851>;
              <D.19850>:
              D.19852 = epoll_ctl (epollfd, 1, fd, evt);
              if (D.19852 == -1) goto <D.19853>; else goto <D.19854>;
              <D.19853>:
              {
                int err;

                D.19794 = __errno_location ();
                err = *D.19794;
                D.19855 = monoeg_g_strerror (err);
                monoeg_g_log (0B, 32, "epoll(ADD): %d %s", err, D.19855);
              }
              <D.19854>:
              <D.19851>:
            }
            goto <D.19856>;
            <D.19843>:
            fd.49 = (const void *) fd;
            D.19822 = socket_io_data->sock_to_state;
            mono_g_hash_table_remove (D.19822, fd.49);
            epoll_ctl (epollfd, 2, fd, evt);
            <D.19856>:
          }
        finally
          {
            list = {CLOBBER};
          }
      }
      i = i + 1;
      <D.18150>:
      if (i < ready) goto <D.18149>; else goto <D.18151>;
      <D.18151>:
      {
        int ret;

        D.19801 = &socket_io_data->io_lock.mutex;
        ret = pthread_mutex_unlock (D.19801);
        if (ret != 0) goto <D.19857>; else goto <D.19858>;
        <D.19857>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19858>:
        D.19859 = ret != 0;
        D.19860 = (long int) D.19859;
        D.19861 = __builtin_expect (D.19860, 0);
        if (D.19861 != 0) goto <D.19862>; else goto <D.19863>;
        <D.19862>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-epoll.c", 178, "ret == 0");
        <D.19863>:
      }
      threadpool_append_jobs (&async_io_tp, &async_results, nresults);
      nresults.56 = (unsigned int) nresults;
      D.19865 = nresults.56 * 4;
      mono_gc_bzero_aligned (&async_results, D.19865);
      goto <D.18153>;
    }
  finally
    {
      async_results = {CLOBBER};
    }
}


tp_epoll_modify (void * p, int fd, int operation, int events, gboolean is_new)
{
  int D.19868;
  unsigned int D.19871;
  unsigned int D.19872;
  int D.19873;
  unsigned int D.19876;
  int iftmp.57;
  int D.19881;
  int D.19882;
  int * D.19885;
  _Bool D.19886;
  _Bool D.19887;
  _Bool D.19888;
  int D.19891;
  const gchar * D.19894;
  union mono_mutex_t * D.19895;
  _Bool D.19898;
  long int D.19899;
  long int D.19900;
  struct SocketIOData * socket_io_data;
  struct tp_epoll_data * data;
  struct epoll_event evt;
  int epoll_op;

  try
    {
      socket_io_data = p;
      data = socket_io_data->event_data;
      memset (&evt, 0, 12);
      evt.data.fd = fd;
      D.19868 = events & 1;
      if (D.19868 != 0) goto <D.19869>; else goto <D.19870>;
      <D.19869>:
      D.19871 = evt.events;
      D.19872 = D.19871 | 1;
      evt.events = D.19872;
      <D.19870>:
      D.19873 = events & 4;
      if (D.19873 != 0) goto <D.19874>; else goto <D.19875>;
      <D.19874>:
      D.19871 = evt.events;
      D.19876 = D.19871 | 4;
      evt.events = D.19876;
      <D.19875>:
      if (is_new != 0) goto <D.19878>; else goto <D.19879>;
      <D.19878>:
      iftmp.57 = 1;
      goto <D.19880>;
      <D.19879>:
      iftmp.57 = 3;
      <D.19880>:
      epoll_op = iftmp.57;
      D.19881 = data->epollfd;
      D.19882 = epoll_ctl (D.19881, epoll_op, fd, &evt);
      if (D.19882 == -1) goto <D.19883>; else goto <D.19884>;
      <D.19883>:
      {
        int err;

        D.19885 = __errno_location ();
        err = *D.19885;
        D.19886 = epoll_op == 1;
        D.19887 = err == 17;
        D.19888 = D.19886 & D.19887;
        if (D.19888 != 0) goto <D.19889>; else goto <D.19890>;
        <D.19889>:
        epoll_op = 3;
        D.19881 = data->epollfd;
        D.19891 = epoll_ctl (D.19881, epoll_op, fd, &evt);
        if (D.19891 == -1) goto <D.19892>; else goto <D.19893>;
        <D.19892>:
        D.19894 = monoeg_g_strerror (err);
        monoeg_g_log (0B, 32, "epoll_ctl(MOD): %d %s", err, D.19894);
        <D.19893>:
        <D.19890>:
      }
      <D.19884>:
      {
        int ret;

        D.19895 = &socket_io_data->io_lock.mutex;
        ret = pthread_mutex_unlock (D.19895);
        if (ret != 0) goto <D.19896>; else goto <D.19897>;
        <D.19896>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.19897>:
        D.19898 = ret != 0;
        D.19899 = (long int) D.19898;
        D.19900 = __builtin_expect (D.19899, 0);
        if (D.19900 != 0) goto <D.19901>; else goto <D.19902>;
        <D.19901>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-epoll.c", 81, "ret == 0");
        <D.19902>:
      }
    }
  finally
    {
      evt = {CLOBBER};
    }
}


tp_epoll_shutdown (void * event_data)
{
  int D.19903;
  struct tp_epoll_data * data;

  data = event_data;
  D.19903 = data->epollfd;
  close (D.19903);
  monoeg_g_free (data);
}


tp_poll_init (struct SocketIOData * data)
{
  int[2] * D.19904;
  int D.19905;
  int * D.19908;
  _Bool D.19909;
  long int D.19910;
  long int D.19911;
  union MonoSemType * D.19914;
  void * D.19915;
  struct tp_poll_data * result;

  result = monoeg_malloc0 (32);
  D.19904 = &result->pipe;
  D.19905 = pipe (D.19904);
  if (D.19905 != 0) goto <D.19906>; else goto <D.19907>;
  <D.19906>:
  {
    int err;

    D.19908 = __errno_location ();
    err = *D.19908;
    perror ("mono");
    D.19909 = err == 0;
    D.19910 = (long int) D.19909;
    D.19911 = __builtin_expect (D.19910, 0);
    if (D.19911 != 0) goto <D.19912>; else goto <D.19913>;
    <D.19912>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-poll.c", 41, "err");
    <D.19913>:
  }
  <D.19907>:
  D.19914 = &result->new_sem;
  sem_init (D.19914, 0, 1);
  data->shutdown = tp_poll_shutdown;
  data->modify = tp_poll_modify;
  data->wait = tp_poll_wait;
  D.19915 = result;
  return D.19915;
}


tp_poll_wait (void * p)
{
  unsigned int allocated.58;
  unsigned int D.19918;
  int D.19919;
  int D.19920;
  void * iftmp.59;
  void * D.19924;
  int D.19926;
  unsigned int i.60;
  unsigned int D.19928;
  struct mono_pollfd * D.19929;
  unsigned int maxfd.61;
  int * D.19934;
  int D.19935;
  short int D.19940;
  int D.19941;
  int D.19942;
  int D.19945;
  void * * D.19948;
  int D.19949;
  int D.19952;
  int D.19953;
  short int D.19965;
  struct mono_pollfd * D.19966;
  union MonoSemType * D.19967;
  union mono_mutex_t * D.19972;
  _Bool D.19975;
  long int D.19976;
  long int D.19977;
  int D.19980;
  _Bool D.19987;
  long int D.19988;
  long int D.19989;
  unsigned int D.19992;
  unsigned int D.19993;
  short int D.19997;
  const void * D.19998;
  struct MonoGHashTable * D.19999;
  void * list.62;
  struct MonoMList * list.63;
  int D.20004;
  int D.20005;
  int D.20010;
  int D.20013;
  void * D.20014;
  unsigned int D.20015;
  int D.20018;
  int D.20019;
  unsigned int D.20020;
  unsigned int D.20021;
  void * * D.20022;
  int D.20025;
  void * D.20032;
  int D.20035;
  int D.20036;
  unsigned int D.20037;
  unsigned int D.20038;
  void * * D.20039;
  void * D.20042;
  int D.20043;
  short int D.20044;
  int D.20046;
  _Bool D.20049;
  _Bool D.20050;
  _Bool D.20051;
  _Bool D.20054;
  long int D.20055;
  long int D.20056;
  struct mono_pollfd * pfds;
  gint maxfd;
  gint allocated;
  gint i;
  struct tp_poll_data * data;
  struct SocketIOData * socket_io_data;
  struct MonoPtrArray async_results;
  gint nresults;

  try
    {
      maxfd = 1;
      socket_io_data = p;
      data = socket_io_data->event_data;
      allocated = 1024;
      allocated.58 = (unsigned int) allocated;
      D.19918 = allocated.58 * 8;
      pfds = monoeg_malloc0 (D.19918);
      async_results.size = 0;
      D.19919 = allocated * 2;
      D.19920 = MAX_EXPR <D.19919, 16>;
      async_results.capacity = D.19920;
      D.19919 = allocated * 2;
      if (D.19919 > 16) goto <D.19922>; else goto <D.19923>;
      <D.19922>:
      D.19919 = allocated * 2;
      D.19924 = mono_gc_make_root_descr_all_refs (D.19919);
      allocated.58 = (unsigned int) allocated;
      D.19918 = allocated.58 * 8;
      iftmp.59 = mono_gc_alloc_fixed (D.19918, D.19924);
      goto <D.19925>;
      <D.19923>:
      iftmp.59 = __builtin_alloca (64);
      <D.19925>:
      async_results.data = iftmp.59;
      D.19926 = data->pipe[0];
      pfds->fd = D.19926;
      pfds->events = 1;
      pfds->revents = 0;
      i = 1;
      goto <D.18060>;
      <D.18059>:
      i.60 = (unsigned int) i;
      D.19928 = i.60 * 8;
      D.19929 = pfds + D.19928;
      D.19929->fd = -1;
      i.60 = (unsigned int) i;
      D.19928 = i.60 * 8;
      D.19929 = pfds + D.19928;
      D.19929->events = 0;
      i.60 = (unsigned int) i;
      D.19928 = i.60 * 8;
      D.19929 = pfds + D.19928;
      D.19929->revents = 0;
      i = i + 1;
      <D.18060>:
      if (i < allocated) goto <D.18059>; else goto <D.18061>;
      <D.18061>:
      <D.18091>:
      {
        int nsock;
        struct mono_pollfd * pfd;
        char one[1];
        struct MonoMList * list;
        struct MonoObject * ares;

        try
          {
            nsock = 0;
            mono_gc_set_skip_thread (1);
            <D.18067>:
            if (nsock == -1) goto <D.19930>; else goto <D.19931>;
            <D.19930>:
            check_for_interruption_critical ();
            <D.19931>:
            maxfd.61 = (unsigned int) maxfd;
            nsock = mono_poll (pfds, maxfd.61, -1);
            if (nsock == -1) goto <D.19933>; else goto <D.18068>;
            <D.19933>:
            D.19934 = __errno_location ();
            D.19935 = *D.19934;
            if (D.19935 == 4) goto <D.18067>; else goto <D.18068>;
            <D.18068>:
            mono_gc_set_skip_thread (0);
            if (nsock == -1) goto <D.19936>; else goto <D.19937>;
            <D.19936>:
            D.19934 = __errno_location ();
            D.19935 = *D.19934;
            if (D.19935 == 9) goto <D.19938>; else goto <D.19939>;
            <D.19938>:
            pfds->revents = 0;
            nsock = mark_bad_fds (pfds, maxfd);
            <D.19939>:
            <D.19937>:
            D.19940 = pfds->revents;
            D.19941 = (int) D.19940;
            D.19942 = D.19941 & 56;
            if (D.19942 != 0) goto <D.19943>; else goto <D.19944>;
            <D.19943>:
            monoeg_g_free (pfds);
            D.19945 = async_results.capacity;
            if (D.19945 > 16) goto <D.19946>; else goto <D.19947>;
            <D.19946>:
            D.19948 = async_results.data;
            mono_gc_free_fixed (D.19948);
            <D.19947>:
            socket_io_cleanup (socket_io_data);
            return;
            <D.19944>:
            D.19940 = pfds->revents;
            D.19941 = (int) D.19940;
            D.19949 = D.19941 & 1;
            if (D.19949 != 0) goto <D.19950>; else goto <D.19951>;
            <D.19950>:
            {
              int nread;
              gboolean found;

              found = 0;
              i = 1;
              goto <D.18073>;
              <D.18072>:
              i.60 = (unsigned int) i;
              D.19928 = i.60 * 8;
              pfd = pfds + D.19928;
              D.19952 = pfd->fd;
              D.19953 = data->newpfd.fd;
              if (D.19952 == D.19953) goto <D.19954>; else goto <D.19955>;
              <D.19954>:
              found = 1;
              goto <D.18071>;
              <D.19955>:
              i = i + 1;
              <D.18073>:
              if (i < allocated) goto <D.18072>; else goto <D.18071>;
              <D.18071>:
              if (found == 0) goto <D.19956>; else goto <D.19957>;
              <D.19956>:
              i = 1;
              goto <D.18076>;
              <D.18075>:
              i.60 = (unsigned int) i;
              D.19928 = i.60 * 8;
              pfd = pfds + D.19928;
              D.19952 = pfd->fd;
              if (D.19952 == -1) goto <D.18074>; else goto <D.19958>;
              <D.19958>:
              i = i + 1;
              <D.18076>:
              if (i < allocated) goto <D.18075>; else goto <D.18074>;
              <D.18074>:
              <D.19957>:
              if (i == allocated) goto <D.19959>; else goto <D.19960>;
              <D.19959>:
              {
                struct mono_pollfd * oldfd;

                oldfd = pfds;
                i = allocated;
                allocated = allocated * 2;
                allocated.58 = (unsigned int) allocated;
                D.19918 = allocated.58 * 8;
                pfds = monoeg_realloc (oldfd, D.19918);
                monoeg_g_free (oldfd);
                goto <D.18079>;
                <D.18078>:
                i.60 = (unsigned int) i;
                D.19928 = i.60 * 8;
                D.19929 = pfds + D.19928;
                D.19929->fd = -1;
                i.60 = (unsigned int) i;
                D.19928 = i.60 * 8;
                D.19929 = pfds + D.19928;
                D.19929->events = 0;
                i.60 = (unsigned int) i;
                D.19928 = i.60 * 8;
                D.19929 = pfds + D.19928;
                D.19929->revents = 0;
                i = i + 1;
                <D.18079>:
                if (i < allocated) goto <D.18078>; else goto <D.18080>;
                <D.18080>:
              }
              <D.19960>:
              D.19926 = data->pipe[0];
              nread = read (D.19926, &one, 1);
              if (nread <= 0) goto <D.19961>; else goto <D.19962>;
              <D.19961>:
              monoeg_g_free (pfds);
              D.19945 = async_results.capacity;
              if (D.19945 > 16) goto <D.19963>; else goto <D.19964>;
              <D.19963>:
              D.19948 = async_results.data;
              mono_gc_free_fixed (D.19948);
              <D.19964>:
              return;
              <D.19962>:
              i.60 = (unsigned int) i;
              D.19928 = i.60 * 8;
              D.19929 = pfds + D.19928;
              D.19953 = data->newpfd.fd;
              D.19929->fd = D.19953;
              i.60 = (unsigned int) i;
              D.19928 = i.60 * 8;
              D.19929 = pfds + D.19928;
              D.19965 = data->newpfd.events;
              D.19929->events = D.19965;
              i.60 = (unsigned int) i;
              D.19928 = i.60 * 8;
              D.19929 = pfds + D.19928;
              D.19929->revents = 0;
              D.19966 = &data->newpfd;
              memset (D.19966, 0, 8);
              D.19967 = &data->new_sem;
              mono_sem_post (D.19967);
              if (i >= maxfd) goto <D.19968>; else goto <D.19969>;
              <D.19968>:
              maxfd = i + 1;
              <D.19969>:
              nsock = nsock + -1;
            }
            <D.19951>:
            if (nsock == 0) goto <D.19970>; else goto <D.19971>;
            <D.19970>:
            // predicted unlikely by continue predictor.
            goto <D.18081>;
            <D.19971>:
            {
              int ret;

              D.19972 = &socket_io_data->io_lock.mutex;
              ret = pthread_mutex_lock (D.19972);
              if (ret != 0) goto <D.19973>; else goto <D.19974>;
              <D.19973>:
              monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
              <D.19974>:
              D.19975 = ret != 0;
              D.19976 = (long int) D.19975;
              D.19977 = __builtin_expect (D.19976, 0);
              if (D.19977 != 0) goto <D.19978>; else goto <D.19979>;
              <D.19978>:
              monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-poll.c", 273, "ret == 0");
              <D.19979>:
            }
            D.19980 = socket_io_data->inited;
            if (D.19980 == 3) goto <D.19981>; else goto <D.19982>;
            <D.19981>:
            monoeg_g_free (pfds);
            D.19945 = async_results.capacity;
            if (D.19945 > 16) goto <D.19983>; else goto <D.19984>;
            <D.19983>:
            D.19948 = async_results.data;
            mono_gc_free_fixed (D.19948);
            <D.19984>:
            {
              int ret;

              D.19972 = &socket_io_data->io_lock.mutex;
              ret = pthread_mutex_unlock (D.19972);
              if (ret != 0) goto <D.19985>; else goto <D.19986>;
              <D.19985>:
              monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
              <D.19986>:
              D.19987 = ret != 0;
              D.19988 = (long int) D.19987;
              D.19989 = __builtin_expect (D.19988, 0);
              if (D.19989 != 0) goto <D.19990>; else goto <D.19991>;
              <D.19990>:
              monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-poll.c", 277, "ret == 0");
              <D.19991>:
            }
            return;
            <D.19982>:
            nresults = 0;
            async_results.size = 0;
            D.19945 = async_results.capacity;
            D.19992 = (unsigned int) D.19945;
            D.19993 = D.19992 * 4;
            D.19948 = async_results.data;
            mono_gc_bzero_aligned (D.19948, D.19993);
            i = 1;
            goto <D.18088>;
            <D.18087>:
            i.60 = (unsigned int) i;
            D.19928 = i.60 * 8;
            pfd = pfds + D.19928;
            D.19952 = pfd->fd;
            if (D.19952 == -1) goto <D.19994>; else goto <D.19996>;
            <D.19996>:
            D.19997 = pfd->revents;
            if (D.19997 == 0) goto <D.19994>; else goto <D.19995>;
            <D.19994>:
            // predicted unlikely by continue predictor.
            goto <D.18084>;
            <D.19995>:
            nsock = nsock + -1;
            D.19952 = pfd->fd;
            D.19998 = (const void *) D.19952;
            D.19999 = socket_io_data->sock_to_state;
            list.62 = mono_g_hash_table_lookup (D.19999, D.19998);
            list = list.62;
            list.63 = list;
            if (list.63 != 0B) goto <D.20002>; else goto <D.20003>;
            <D.20002>:
            D.19997 = pfd->revents;
            D.20004 = (int) D.19997;
            D.20005 = D.20004 & 57;
            if (D.20005 != 0) goto <D.20006>; else goto <D.20007>;
            <D.20006>:
            ares = get_io_event (&list, 1);
            if (ares != 0B) goto <D.20008>; else goto <D.20009>;
            <D.20008>:
            D.20010 = async_results.size;
            D.19945 = async_results.capacity;
            if (D.20010 >= D.19945) goto <D.20011>; else goto <D.20012>;
            <D.20011>:
            {
              void * __tmp;

              D.19945 = async_results.capacity;
              D.20013 = D.19945 * 2;
              D.20014 = mono_gc_make_root_descr_all_refs (D.20013);
              D.19945 = async_results.capacity;
              D.19992 = (unsigned int) D.19945;
              D.20015 = D.19992 * 8;
              __tmp = mono_gc_alloc_fixed (D.20015, D.20014);
              D.19945 = async_results.capacity;
              D.19992 = (unsigned int) D.19945;
              D.19993 = D.19992 * 4;
              D.19948 = async_results.data;
              mono_gc_memmove_aligned (__tmp, D.19948, D.19993);
              D.19945 = async_results.capacity;
              if (D.19945 > 16) goto <D.20016>; else goto <D.20017>;
              <D.20016>:
              D.19948 = async_results.data;
              mono_gc_free_fixed (D.19948);
              <D.20017>:
              async_results.data = __tmp;
              D.19945 = async_results.capacity;
              D.20013 = D.19945 * 2;
              async_results.capacity = D.20013;
            }
            <D.20012>:
            D.19948 = async_results.data;
            D.20010 = async_results.size;
            D.20018 = D.20010;
            D.20019 = D.20018 + 1;
            async_results.size = D.20019;
            D.20020 = (unsigned int) D.20018;
            D.20021 = D.20020 * 4;
            D.20022 = D.19948 + D.20021;
            *D.20022 = ares;
            nresults = nresults + 1;
            <D.20009>:
            <D.20007>:
            <D.20003>:
            list.63 = list;
            if (list.63 != 0B) goto <D.20023>; else goto <D.20024>;
            <D.20023>:
            D.19997 = pfd->revents;
            D.20004 = (int) D.19997;
            D.20025 = D.20004 & 60;
            if (D.20025 != 0) goto <D.20026>; else goto <D.20027>;
            <D.20026>:
            ares = get_io_event (&list, 4);
            if (ares != 0B) goto <D.20028>; else goto <D.20029>;
            <D.20028>:
            D.20010 = async_results.size;
            D.19945 = async_results.capacity;
            if (D.20010 >= D.19945) goto <D.20030>; else goto <D.20031>;
            <D.20030>:
            {
              void * __tmp;

              D.19945 = async_results.capacity;
              D.20013 = D.19945 * 2;
              D.20032 = mono_gc_make_root_descr_all_refs (D.20013);
              D.19945 = async_results.capacity;
              D.19992 = (unsigned int) D.19945;
              D.20015 = D.19992 * 8;
              __tmp = mono_gc_alloc_fixed (D.20015, D.20032);
              D.19945 = async_results.capacity;
              D.19992 = (unsigned int) D.19945;
              D.19993 = D.19992 * 4;
              D.19948 = async_results.data;
              mono_gc_memmove_aligned (__tmp, D.19948, D.19993);
              D.19945 = async_results.capacity;
              if (D.19945 > 16) goto <D.20033>; else goto <D.20034>;
              <D.20033>:
              D.19948 = async_results.data;
              mono_gc_free_fixed (D.19948);
              <D.20034>:
              async_results.data = __tmp;
              D.19945 = async_results.capacity;
              D.20013 = D.19945 * 2;
              async_results.capacity = D.20013;
            }
            <D.20031>:
            D.19948 = async_results.data;
            D.20010 = async_results.size;
            D.20035 = D.20010;
            D.20036 = D.20035 + 1;
            async_results.size = D.20036;
            D.20037 = (unsigned int) D.20035;
            D.20038 = D.20037 * 4;
            D.20039 = D.19948 + D.20038;
            *D.20039 = ares;
            nresults = nresults + 1;
            <D.20029>:
            <D.20027>:
            <D.20024>:
            list.63 = list;
            if (list.63 != 0B) goto <D.20040>; else goto <D.20041>;
            <D.20040>:
            list.63 = list;
            D.19952 = pfd->fd;
            D.20042 = (void *) D.19952;
            D.19999 = socket_io_data->sock_to_state;
            mono_g_hash_table_replace (D.19999, D.20042, list.63);
            list.63 = list;
            D.20043 = get_events_from_list (list.63);
            D.20044 = (short int) D.20043;
            pfd->events = D.20044;
            goto <D.20045>;
            <D.20041>:
            D.19952 = pfd->fd;
            D.19998 = (const void *) D.19952;
            D.19999 = socket_io_data->sock_to_state;
            mono_g_hash_table_remove (D.19999, D.19998);
            pfd->fd = -1;
            D.20046 = maxfd + -1;
            if (D.20046 == i) goto <D.20047>; else goto <D.20048>;
            <D.20047>:
            maxfd = maxfd + -1;
            <D.20048>:
            <D.20045>:
            <D.18084>:
            i = i + 1;
            <D.18088>:
            D.20049 = i < maxfd;
            D.20050 = nsock > 0;
            D.20051 = D.20049 & D.20050;
            if (D.20051 != 0) goto <D.18087>; else goto <D.18089>;
            <D.18089>:
            {
              int ret;

              D.19972 = &socket_io_data->io_lock.mutex;
              ret = pthread_mutex_unlock (D.19972);
              if (ret != 0) goto <D.20052>; else goto <D.20053>;
              <D.20052>:
              monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
              <D.20053>:
              D.20054 = ret != 0;
              D.20055 = (long int) D.20054;
              D.20056 = __builtin_expect (D.20055, 0);
              if (D.20056 != 0) goto <D.20057>; else goto <D.20058>;
              <D.20057>:
              monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-poll.c", 317, "ret == 0");
              <D.20058>:
            }
            D.19948 = async_results.data;
            threadpool_append_jobs (&async_io_tp, D.19948, nresults);
            async_results.size = 0;
            D.19945 = async_results.capacity;
            D.19992 = (unsigned int) D.19945;
            D.19993 = D.19992 * 4;
            D.19948 = async_results.data;
            mono_gc_bzero_aligned (D.19948, D.19993);
          }
        finally
          {
            one = {CLOBBER};
            list = {CLOBBER};
          }
      }
      <D.18081>:
      goto <D.18091>;
    }
  finally
    {
      async_results = {CLOBBER};
    }
}


mark_bad_fds (struct mono_pollfd * pfds, int nfds)
{
  unsigned int i.64;
  unsigned int D.20065;
  int D.20066;
  int * D.20072;
  int D.20073;
  short int D.20075;
  short int D.20076;
  int D.20079;
  int i;
  int ret;
  struct mono_pollfd * pfd;
  int count;

  count = 0;
  i = 0;
  goto <D.18046>;
  <D.18045>:
  i.64 = (unsigned int) i;
  D.20065 = i.64 * 8;
  pfd = pfds + D.20065;
  D.20066 = pfd->fd;
  if (D.20066 == -1) goto <D.20067>; else goto <D.20068>;
  <D.20067>:
  // predicted unlikely by continue predictor.
  goto <D.18044>;
  <D.20068>:
  ret = mono_poll (pfd, 1, 0);
  if (ret == -1) goto <D.20071>; else goto <D.20069>;
  <D.20071>:
  D.20072 = __errno_location ();
  D.20073 = *D.20072;
  if (D.20073 == 9) goto <D.20074>; else goto <D.20069>;
  <D.20074>:
  D.20075 = pfd->revents;
  D.20076 = D.20075 | 32;
  pfd->revents = D.20076;
  count = count + 1;
  goto <D.20070>;
  <D.20069>:
  if (ret == 1) goto <D.20077>; else goto <D.20078>;
  <D.20077>:
  count = count + 1;
  <D.20078>:
  <D.20070>:
  <D.18044>:
  i = i + 1;
  <D.18046>:
  if (i < nfds) goto <D.18045>; else goto <D.18047>;
  <D.18047>:
  D.20079 = count;
  return D.20079;
}


socket_io_cleanup (struct SocketIOData * data)
{
  union mono_mutex_t * D.20081;
  _Bool D.20084;
  long int D.20085;
  long int D.20086;
  int D.20089;
  _Bool D.20094;
  long int D.20095;
  long int D.20096;
  void (*<Tb27>) (void *) D.20099;
  void * D.20100;
  _Bool D.20103;
  long int D.20104;
  long int D.20105;

  {
    int ret;

    D.20081 = &data->io_lock.mutex;
    ret = pthread_mutex_lock (D.20081);
    if (ret != 0) goto <D.20082>; else goto <D.20083>;
    <D.20082>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20083>:
    D.20084 = ret != 0;
    D.20085 = (long int) D.20084;
    D.20086 = __builtin_expect (D.20085, 0);
    if (D.20086 != 0) goto <D.20087>; else goto <D.20088>;
    <D.20087>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 317, "ret == 0");
    <D.20088>:
  }
  D.20089 = data->inited;
  if (D.20089 != 2) goto <D.20090>; else goto <D.20091>;
  <D.20090>:
  {
    int ret;

    D.20081 = &data->io_lock.mutex;
    ret = pthread_mutex_unlock (D.20081);
    if (ret != 0) goto <D.20092>; else goto <D.20093>;
    <D.20092>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20093>:
    D.20094 = ret != 0;
    D.20095 = (long int) D.20094;
    D.20096 = __builtin_expect (D.20095, 0);
    if (D.20096 != 0) goto <D.20097>; else goto <D.20098>;
    <D.20097>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 319, "ret == 0");
    <D.20098>:
  }
  return;
  <D.20091>:
  data->inited = 3;
  D.20099 = data->shutdown;
  D.20100 = data->event_data;
  D.20099 (D.20100);
  {
    int ret;

    D.20081 = &data->io_lock.mutex;
    ret = pthread_mutex_unlock (D.20081);
    if (ret != 0) goto <D.20101>; else goto <D.20102>;
    <D.20101>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20102>:
    D.20103 = ret != 0;
    D.20104 = (long int) D.20103;
    D.20105 = __builtin_expect (D.20104, 0);
    if (D.20105 != 0) goto <D.20106>; else goto <D.20107>;
    <D.20106>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 324, "ret == 0");
    <D.20107>:
  }
}


read (int __fd, void * __buf, size_t __nbytes)
{
  unsigned int D.20109;
  int D.20112;
  ssize_t D.20115;
  unsigned int D.20116;
  unsigned int D.20117;
  unsigned int D.20120;

  D.20109 = __builtin_object_size (__buf, 0);
  if (D.20109 != 4294967295) goto <D.20110>; else goto <D.20111>;
  <D.20110>:
  D.20112 = __builtin_constant_p (__nbytes);
  if (D.20112 == 0) goto <D.20113>; else goto <D.20114>;
  <D.20113>:
  D.20116 = __builtin_object_size (__buf, 0);
  D.20115 = __read_chk (__fd, __buf, __nbytes, D.20116);
  return D.20115;
  <D.20114>:
  D.20117 = __builtin_object_size (__buf, 0);
  if (D.20117 < __nbytes) goto <D.20118>; else goto <D.20119>;
  <D.20118>:
  D.20120 = __builtin_object_size (__buf, 0);
  D.20115 = __read_chk_warn (__fd, __buf, __nbytes, D.20120);
  return D.20115;
  <D.20119>:
  <D.20111>:
  D.20115 = __read_alias (__fd, __buf, __nbytes);
  return D.20115;
}


tp_poll_modify (void * p, int fd, int operation, int events, gboolean is_new)
{
  union mono_mutex_t * D.20122;
  _Bool D.20125;
  long int D.20126;
  long int D.20127;
  union MonoSemType * D.20130;
  short int D.20131;
  char D.20132;
  int D.20133;
  struct SocketIOData * socket_io_data;
  struct tp_poll_data * data;
  char msg[1];
  int unused;

  try
    {
      socket_io_data = p;
      data = socket_io_data->event_data;
      {
        int ret;

        D.20122 = &socket_io_data->io_lock.mutex;
        ret = pthread_mutex_unlock (D.20122);
        if (ret != 0) goto <D.20123>; else goto <D.20124>;
        <D.20123>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20124>:
        D.20125 = ret != 0;
        D.20126 = (long int) D.20125;
        D.20127 = __builtin_expect (D.20126, 0);
        if (D.20127 != 0) goto <D.20128>; else goto <D.20129>;
        <D.20128>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "../../mono/metadata/tpool-poll.c", 87, "ret == 0");
        <D.20129>:
      }
      D.20130 = &data->new_sem;
      mono_sem_wait (D.20130, 0);
      data->newpfd.fd = fd;
      D.20131 = (short int) events;
      data->newpfd.events = D.20131;
      data->newpfd.revents = 0;
      D.20132 = (char) operation;
      msg[0] = D.20132;
      D.20133 = data->pipe[1];
      unused = write (D.20133, &msg, 1);
    }
  finally
    {
      msg = {CLOBBER};
    }
}


tp_poll_shutdown (void * event_data)
{
  int D.20134;
  int D.20137;
  union MonoSemType * D.20140;
  struct tp_poll_data * data;

  data = event_data;
  D.20134 = data->pipe[0];
  if (D.20134 >= 0) goto <D.20135>; else goto <D.20136>;
  <D.20135>:
  D.20134 = data->pipe[0];
  close (D.20134);
  <D.20136>:
  D.20137 = data->pipe[1];
  if (D.20137 >= 0) goto <D.20138>; else goto <D.20139>;
  <D.20138>:
  D.20137 = data->pipe[1];
  close (D.20137);
  <D.20139>:
  data->pipe[0] = -1;
  data->pipe[1] = -1;
  D.20140 = &data->new_sem;
  sem_destroy (D.20140);
}


get_events_from_list (struct MonoMList * list)
{
  int D.20141;
  int D.20143;
  struct MonoSocketAsyncResult * state;
  int events;

  events = 0;
  goto <D.18322>;
  <D.18321>:
  D.20141 = get_event_from_state (state);
  events = D.20141 | events;
  list = mono_mlist_next (list);
  <D.18322>:
  if (list != 0B) goto <D.20142>; else goto <D.18323>;
  <D.20142>:
  state = mono_mlist_get_data (list);
  if (state != 0B) goto <D.18321>; else goto <D.18323>;
  <D.18323>:
  D.20143 = events;
  return D.20143;
}


mono_thread_pool_add (struct MonoObject * target, struct MonoMethodMessage * msg, struct MonoDelegate * async_callback, struct MonoObject * state)
{
  struct MonoClass * async_call_klass.65;
  struct MonoMethodMessage * * D.20146;
  struct MonoObject * * D.20147;
  struct MonoVTable * D.20150;
  struct MonoClass * D.20151;
  struct MonoMethod * D.20152;
  struct MonoDelegate * * D.20153;
  struct MonoObject * D.20154;
  struct MonoObject * * D.20155;
  int D.20156;
  struct MonoAsyncResult * D.20159;
  struct MonoDomain * domain;
  struct MonoAsyncResult * ares;
  struct ASyncCall * ac;

  domain = mono_domain_get ();
  async_call_klass.65 = async_call_klass;
  ac = mono_object_new (domain, async_call_klass.65);
  D.20146 = &ac->msg;
  mono_gc_wbarrier_set_field (ac, D.20146, msg);
  D.20147 = &ac->state;
  mono_gc_wbarrier_set_field (ac, D.20147, state);
  if (async_callback != 0B) goto <D.20148>; else goto <D.20149>;
  <D.20148>:
  D.20150 = MEM[(struct MonoObject *)async_callback].vtable;
  D.20151 = D.20150->klass;
  D.20152 = mono_get_delegate_invoke (D.20151);
  ac->cb_method = D.20152;
  D.20153 = &ac->cb_target;
  mono_gc_wbarrier_set_field (ac, D.20153, async_callback);
  <D.20149>:
  D.20154 = ac->state;
  ares = mono_async_result_new (domain, 0B, D.20154, 0B, ac);
  D.20155 = &ares->async_delegate;
  mono_gc_wbarrier_set_field (ares, D.20155, target);
  D.20156 = socket_io_filter (target, state);
  if (D.20156 != 0) goto <D.20157>; else goto <D.20158>;
  <D.20157>:
  socket_io_add (ares, state);
  D.20159 = ares;
  return D.20159;
  <D.20158>:
  threadpool_append_job (&async_tp, ares);
  D.20159 = ares;
  return D.20159;
}


socket_io_filter (struct MonoObject * target, struct MonoObject * state)
{
  _Bool D.20161;
  _Bool D.20162;
  _Bool D.20163;
  gboolean D.20166;
  struct MonoVTable * D.20167;
  struct MonoClass * socket_async_call_klass.66;
  int D.20171;
  struct MonoClass * process_async_call_klass.67;
  int D.20177;
  unsigned int op.68;
  gint op;
  struct MonoSocketAsyncResult * sock_res;
  struct MonoClass * klass;
  struct MonoDomain * domain;

  D.20161 = target == 0B;
  D.20162 = state == 0B;
  D.20163 = D.20161 | D.20162;
  if (D.20163 != 0) goto <D.20164>; else goto <D.20165>;
  <D.20164>:
  D.20166 = 0;
  return D.20166;
  <D.20165>:
  D.20167 = target->vtable;
  domain = D.20167->domain;
  D.20167 = target->vtable;
  klass = D.20167->klass;
  socket_async_call_klass.66 = socket_async_call_klass;
  if (socket_async_call_klass.66 == 0B) goto <D.20169>; else goto <D.20170>;
  <D.20169>:
  D.20171 = is_socketasynccall (domain, klass);
  if (D.20171 != 0) goto <D.20172>; else goto <D.20173>;
  <D.20172>:
  socket_async_call_klass = klass;
  <D.20173>:
  <D.20170>:
  process_async_call_klass.67 = process_async_call_klass;
  if (process_async_call_klass.67 == 0B) goto <D.20175>; else goto <D.20176>;
  <D.20175>:
  D.20177 = is_sdp_asyncreadhandler (domain, klass);
  if (D.20177 != 0) goto <D.20178>; else goto <D.20179>;
  <D.20178>:
  process_async_call_klass = klass;
  <D.20179>:
  <D.20176>:
  socket_async_call_klass.66 = socket_async_call_klass;
  if (klass != socket_async_call_klass.66) goto <D.20180>; else goto <D.20181>;
  <D.20180>:
  process_async_call_klass.67 = process_async_call_klass;
  if (klass != process_async_call_klass.67) goto <D.20182>; else goto <D.20183>;
  <D.20182>:
  D.20166 = 0;
  return D.20166;
  <D.20183>:
  <D.20181>:
  sock_res = state;
  op = sock_res->operation;
  op.68 = (unsigned int) op;
  if (op.68 > 13) goto <D.20185>; else goto <D.20186>;
  <D.20185>:
  D.20166 = 0;
  return D.20166;
  <D.20186>:
  D.20166 = 1;
  return D.20166;
}


is_socketasynccall (struct MonoDomain * domain, struct MonoClass * klass)
{
  gboolean D.20188;
  int iftmp.69;
  struct MonoClass * D.20192;
  int D.20194;
  int D.18235;
  int iftmp.70;
  int D.18234;
  const char[16] * D.20199;
  unsigned char D.20200;
  int D.20201;
  unsigned char D.20202;
  int D.20203;
  _Bool D.20204;
  _Bool D.20205;
  _Bool D.20206;
  const unsigned char * D.20209;
  unsigned char D.20210;
  int D.20211;
  const unsigned char * D.20212;
  unsigned char D.20213;
  int D.20214;
  _Bool D.20215;
  _Bool D.20216;
  const unsigned char * D.20219;
  unsigned char D.20220;
  int D.20221;
  const unsigned char * D.20222;
  unsigned char D.20223;
  int D.20224;
  _Bool D.20225;
  _Bool D.20226;
  const unsigned char * D.20229;
  unsigned char D.20230;
  int D.20231;
  const unsigned char * D.20232;
  unsigned char D.20233;
  int D.20234;
  const char * D.20236;

  D.20192 = klass->nested_in;
  if (D.20192 != 0B) goto <D.20193>; else goto <D.20190>;
  <D.20193>:
  D.20192 = klass->nested_in;
  D.20194 = is_socket (domain, D.20192);
  if (D.20194 != 0) goto <D.20195>; else goto <D.20190>;
  <D.20195>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = klass->name;
      D.20199 = "SocketAsyncCall";
      D.20200 = MEM[(const unsigned char *)D.20199];
      D.20201 = (int) D.20200;
      D.20202 = *__s2;
      D.20203 = (int) D.20202;
      __result = D.20201 - D.20203;
      {
        D.20204 = __s2_len != 0;
        D.20205 = __result == 0;
        D.20206 = D.20204 & D.20205;
        if (D.20206 != 0) goto <D.20207>; else goto <D.20208>;
        <D.20207>:
        D.20209 = &MEM[(void *)"SocketAsyncCall" + 1B];
        D.20210 = *D.20209;
        D.20211 = (int) D.20210;
        D.20212 = __s2 + 1;
        D.20213 = *D.20212;
        D.20214 = (int) D.20213;
        __result = D.20211 - D.20214;
        D.20215 = __s2_len > 1;
        D.20205 = __result == 0;
        D.20216 = D.20215 & D.20205;
        if (D.20216 != 0) goto <D.20217>; else goto <D.20218>;
        <D.20217>:
        D.20219 = &MEM[(void *)"SocketAsyncCall" + 2B];
        D.20220 = *D.20219;
        D.20221 = (int) D.20220;
        D.20222 = __s2 + 2;
        D.20223 = *D.20222;
        D.20224 = (int) D.20223;
        __result = D.20221 - D.20224;
        D.20225 = __s2_len > 2;
        D.20205 = __result == 0;
        D.20226 = D.20225 & D.20205;
        if (D.20226 != 0) goto <D.20227>; else goto <D.20228>;
        <D.20227>:
        D.20229 = &MEM[(void *)"SocketAsyncCall" + 3B];
        D.20230 = *D.20229;
        D.20231 = (int) D.20230;
        D.20232 = __s2 + 3;
        D.20233 = *D.20232;
        D.20234 = (int) D.20233;
        __result = D.20231 - D.20234;
        <D.20228>:
        <D.20218>:
        <D.20208>:
      }
      D.18234 = __result;
    }
    iftmp.70 = -D.18234;
    goto <D.20235>;
    <D.20198>:
    D.20236 = klass->name;
    iftmp.70 = __builtin_strcmp (D.20236, "SocketAsyncCall");
    <D.20235>:
    D.18235 = iftmp.70;
  }
  if (D.18235 == 0) goto <D.20237>; else goto <D.20190>;
  <D.20237>:
  iftmp.69 = 1;
  goto <D.20191>;
  <D.20190>:
  iftmp.69 = 0;
  <D.20191>:
  D.20188 = iftmp.69;
  return D.20188;
}


is_sdp_asyncreadhandler (struct MonoDomain * domain, struct MonoClass * klass)
{
  gboolean D.20239;
  int iftmp.71;
  struct MonoClass * D.20243;
  int D.20245;
  int D.18292;
  int iftmp.72;
  int D.18291;
  const char[17] * D.20250;
  unsigned char D.20251;
  int D.20252;
  unsigned char D.20253;
  int D.20254;
  _Bool D.20255;
  _Bool D.20256;
  _Bool D.20257;
  const unsigned char * D.20260;
  unsigned char D.20261;
  int D.20262;
  const unsigned char * D.20263;
  unsigned char D.20264;
  int D.20265;
  _Bool D.20266;
  _Bool D.20267;
  const unsigned char * D.20270;
  unsigned char D.20271;
  int D.20272;
  const unsigned char * D.20273;
  unsigned char D.20274;
  int D.20275;
  _Bool D.20276;
  _Bool D.20277;
  const unsigned char * D.20280;
  unsigned char D.20281;
  int D.20282;
  const unsigned char * D.20283;
  unsigned char D.20284;
  int D.20285;
  const char * D.20287;

  D.20243 = klass->nested_in;
  if (D.20243 != 0B) goto <D.20244>; else goto <D.20241>;
  <D.20244>:
  D.20243 = klass->nested_in;
  D.20245 = is_sd_process (domain, D.20243);
  if (D.20245 != 0) goto <D.20246>; else goto <D.20241>;
  <D.20246>:
  {
    size_t __s1_len;
    size_t __s2_len;

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

      __s2 = klass->name;
      D.20250 = "AsyncReadHandler";
      D.20251 = MEM[(const unsigned char *)D.20250];
      D.20252 = (int) D.20251;
      D.20253 = *__s2;
      D.20254 = (int) D.20253;
      __result = D.20252 - D.20254;
      {
        D.20255 = __s2_len != 0;
        D.20256 = __result == 0;
        D.20257 = D.20255 & D.20256;
        if (D.20257 != 0) goto <D.20258>; else goto <D.20259>;
        <D.20258>:
        D.20260 = &MEM[(void *)"AsyncReadHandler" + 1B];
        D.20261 = *D.20260;
        D.20262 = (int) D.20261;
        D.20263 = __s2 + 1;
        D.20264 = *D.20263;
        D.20265 = (int) D.20264;
        __result = D.20262 - D.20265;
        D.20266 = __s2_len > 1;
        D.20256 = __result == 0;
        D.20267 = D.20266 & D.20256;
        if (D.20267 != 0) goto <D.20268>; else goto <D.20269>;
        <D.20268>:
        D.20270 = &MEM[(void *)"AsyncReadHandler" + 2B];
        D.20271 = *D.20270;
        D.20272 = (int) D.20271;
        D.20273 = __s2 + 2;
        D.20274 = *D.20273;
        D.20275 = (int) D.20274;
        __result = D.20272 - D.20275;
        D.20276 = __s2_len > 2;
        D.20256 = __result == 0;
        D.20277 = D.20276 & D.20256;
        if (D.20277 != 0) goto <D.20278>; else goto <D.20279>;
        <D.20278>:
        D.20280 = &MEM[(void *)"AsyncReadHandler" + 3B];
        D.20281 = *D.20280;
        D.20282 = (int) D.20281;
        D.20283 = __s2 + 3;
        D.20284 = *D.20283;
        D.20285 = (int) D.20284;
        __result = D.20282 - D.20285;
        <D.20279>:
        <D.20269>:
        <D.20259>:
      }
      D.18291 = __result;
    }
    iftmp.72 = -D.18291;
    goto <D.20286>;
    <D.20249>:
    D.20287 = klass->name;
    iftmp.72 = __builtin_strcmp (D.20287, "AsyncReadHandler");
    <D.20286>:
    D.18292 = iftmp.72;
  }
  if (D.18292 == 0) goto <D.20288>; else goto <D.20241>;
  <D.20288>:
  iftmp.71 = 1;
  goto <D.20242>;
  <D.20241>:
  iftmp.71 = 0;
  <D.20242>:
  D.20239 = iftmp.71;
  return D.20239;
}


is_sd_process (struct MonoDomain * domain, struct MonoClass * klass)
{
  struct MonoClass * D.20290;
  gboolean D.20293;
  _Bool D.20294;
  int D.20295;
  int D.18270;
  int iftmp.73;
  int D.18266;
  const char[8] * D.20301;
  unsigned char D.20302;
  int D.20303;
  unsigned char D.20304;
  int D.20305;
  _Bool D.20306;
  _Bool D.20307;
  _Bool D.20308;
  const unsigned char * D.20311;
  unsigned char D.20312;
  int D.20313;
  const unsigned char * D.20314;
  unsigned char D.20315;
  int D.20316;
  _Bool D.20317;
  _Bool D.20318;
  const unsigned char * D.20321;
  unsigned char D.20322;
  int D.20323;
  const unsigned char * D.20324;
  unsigned char D.20325;
  int D.20326;
  _Bool D.20327;
  _Bool D.20328;
  const unsigned char * D.20331;
  unsigned char D.20332;
  int D.20333;
  const unsigned char * D.20334;
  unsigned char D.20335;
  int D.20336;
  const char * D.20338;
  int D.18279;
  int iftmp.74;
  int D.18275;
  const char[19] * D.20344;
  unsigned char D.20345;
  int D.20346;
  unsigned char D.20347;
  int D.20348;
  _Bool D.20349;
  _Bool D.20350;
  _Bool D.20351;
  const unsigned char * D.20354;
  unsigned char D.20355;
  int D.20356;
  const unsigned char * D.20357;
  unsigned char D.20358;
  int D.20359;
  _Bool D.20360;
  _Bool D.20361;
  const unsigned char * D.20364;
  unsigned char D.20365;
  int D.20366;
  const unsigned char * D.20367;
  unsigned char D.20368;
  int D.20369;
  _Bool D.20370;
  _Bool D.20371;
  const unsigned char * D.20374;
  unsigned char D.20375;
  int D.20376;
  const unsigned char * D.20377;
  unsigned char D.20378;
  int D.20379;
  const char * D.20381;

  D.20290 = domain->process_class;
  if (D.20290 != 0B) goto <D.20291>; else goto <D.20292>;
  <D.20291>:
  D.20290 = domain->process_class;
  D.20294 = D.20290 == klass;
  D.20293 = (gboolean) D.20294;
  return D.20293;
  <D.20292>:
  D.20295 = is_system_type (domain, klass);
  if (D.20295 != 0) goto <D.20296>; else goto <D.20297>;
  <D.20296>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 7;
    if (__s1_len <= 3) goto <D.20299>; else goto <D.20300>;
    <D.20299>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name;
      D.20301 = "Process";
      D.20302 = MEM[(const unsigned char *)D.20301];
      D.20303 = (int) D.20302;
      D.20304 = *__s2;
      D.20305 = (int) D.20304;
      __result = D.20303 - D.20305;
      {
        D.20306 = __s1_len != 0;
        D.20307 = __result == 0;
        D.20308 = D.20306 & D.20307;
        if (D.20308 != 0) goto <D.20309>; else goto <D.20310>;
        <D.20309>:
        D.20311 = &MEM[(void *)"Process" + 1B];
        D.20312 = *D.20311;
        D.20313 = (int) D.20312;
        D.20314 = __s2 + 1;
        D.20315 = *D.20314;
        D.20316 = (int) D.20315;
        __result = D.20313 - D.20316;
        D.20317 = __s1_len > 1;
        D.20307 = __result == 0;
        D.20318 = D.20317 & D.20307;
        if (D.20318 != 0) goto <D.20319>; else goto <D.20320>;
        <D.20319>:
        D.20321 = &MEM[(void *)"Process" + 2B];
        D.20322 = *D.20321;
        D.20323 = (int) D.20322;
        D.20324 = __s2 + 2;
        D.20325 = *D.20324;
        D.20326 = (int) D.20325;
        __result = D.20323 - D.20326;
        D.20327 = __s1_len > 2;
        D.20307 = __result == 0;
        D.20328 = D.20327 & D.20307;
        if (D.20328 != 0) goto <D.20329>; else goto <D.20330>;
        <D.20329>:
        D.20331 = &MEM[(void *)"Process" + 3B];
        D.20332 = *D.20331;
        D.20333 = (int) D.20332;
        D.20334 = __s2 + 3;
        D.20335 = *D.20334;
        D.20336 = (int) D.20335;
        __result = D.20333 - D.20336;
        <D.20330>:
        <D.20320>:
        <D.20310>:
      }
      D.18266 = __result;
    }
    iftmp.73 = D.18266;
    goto <D.20337>;
    <D.20300>:
    D.20338 = klass->name;
    iftmp.73 = __builtin_strcmp ("Process", D.20338);
    <D.20337>:
    D.18270 = iftmp.73;
  }
  if (D.18270 == 0) goto <D.20339>; else goto <D.20340>;
  <D.20339>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 18;
    if (__s1_len <= 3) goto <D.20342>; else goto <D.20343>;
    <D.20342>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name_space;
      D.20344 = "System.Diagnostics";
      D.20345 = MEM[(const unsigned char *)D.20344];
      D.20346 = (int) D.20345;
      D.20347 = *__s2;
      D.20348 = (int) D.20347;
      __result = D.20346 - D.20348;
      {
        D.20349 = __s1_len != 0;
        D.20350 = __result == 0;
        D.20351 = D.20349 & D.20350;
        if (D.20351 != 0) goto <D.20352>; else goto <D.20353>;
        <D.20352>:
        D.20354 = &MEM[(void *)"System.Diagnostics" + 1B];
        D.20355 = *D.20354;
        D.20356 = (int) D.20355;
        D.20357 = __s2 + 1;
        D.20358 = *D.20357;
        D.20359 = (int) D.20358;
        __result = D.20356 - D.20359;
        D.20360 = __s1_len > 1;
        D.20350 = __result == 0;
        D.20361 = D.20360 & D.20350;
        if (D.20361 != 0) goto <D.20362>; else goto <D.20363>;
        <D.20362>:
        D.20364 = &MEM[(void *)"System.Diagnostics" + 2B];
        D.20365 = *D.20364;
        D.20366 = (int) D.20365;
        D.20367 = __s2 + 2;
        D.20368 = *D.20367;
        D.20369 = (int) D.20368;
        __result = D.20366 - D.20369;
        D.20370 = __s1_len > 2;
        D.20350 = __result == 0;
        D.20371 = D.20370 & D.20350;
        if (D.20371 != 0) goto <D.20372>; else goto <D.20373>;
        <D.20372>:
        D.20374 = &MEM[(void *)"System.Diagnostics" + 3B];
        D.20375 = *D.20374;
        D.20376 = (int) D.20375;
        D.20377 = __s2 + 3;
        D.20378 = *D.20377;
        D.20379 = (int) D.20378;
        __result = D.20376 - D.20379;
        <D.20373>:
        <D.20363>:
        <D.20353>:
      }
      D.18275 = __result;
    }
    iftmp.74 = D.18275;
    goto <D.20380>;
    <D.20343>:
    D.20381 = klass->name_space;
    iftmp.74 = __builtin_strcmp ("System.Diagnostics", D.20381);
    <D.20380>:
    D.18279 = iftmp.74;
  }
  if (D.18279 == 0) goto <D.20382>; else goto <D.20383>;
  <D.20382>:
  domain->process_class = klass;
  D.20293 = 1;
  return D.20293;
  <D.20383>:
  <D.20340>:
  <D.20297>:
  D.20293 = 0;
  return D.20293;
}


mono_thread_pool_finish (struct MonoAsyncResult * ares, struct MonoArray * * out_args, struct MonoObject * * exc)
{
  unsigned char D.20385;
  struct MonoException * D.20388;
  struct MonoObject * D.20389;
  unsigned char D.20390;
  struct MonoObject * D.20393;
  _Bool D.20396;
  long int D.20397;
  long int D.20398;
  struct MonoVTable * D.20401;
  struct MonoDomain * D.20402;
  struct MonoWaitHandle * D.20403;
  struct MonoObject * * D.20404;
  _Bool D.20407;
  long int D.20408;
  long int D.20409;
  struct MonoMethodMessage * D.20412;
  struct MonoObject * D.20413;
  struct MonoArray * D.20414;
  struct ASyncCall * ac;
  void * wait_event;

  *exc = 0B;
  *out_args = 0B;
  mono_monitor_enter (ares);
  D.20385 = ares->endinvoke_called;
  if (D.20385 != 0) goto <D.20386>; else goto <D.20387>;
  <D.20386>:
  D.20388 = mono_get_exception_invalid_operation (0B);
  *exc = D.20388;
  mono_monitor_exit (ares);
  D.20389 = 0B;
  return D.20389;
  <D.20387>:
  ares->endinvoke_called = 1;
  D.20390 = ares->completed;
  if (D.20390 == 0) goto <D.20391>; else goto <D.20392>;
  <D.20391>:
  D.20393 = ares->handle;
  if (D.20393 == 0B) goto <D.20394>; else goto <D.20395>;
  <D.20394>:
  wait_event = CreateEvent (0B, 1, 0, 0B);
  D.20396 = wait_event == 0B;
  D.20397 = (long int) D.20396;
  D.20398 = __builtin_expect (D.20397, 0);
  if (D.20398 != 0) goto <D.20399>; else goto <D.20400>;
  <D.20399>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 958, "wait_event != 0");
  <D.20400>:
  D.20401 = MEM[(struct MonoObject *)ares].vtable;
  D.20402 = D.20401->domain;
  D.20403 = mono_wait_handle_new (D.20402, wait_event);
  D.20404 = &ares->handle;
  mono_gc_wbarrier_set_field (ares, D.20404, D.20403);
  goto <D.20405>;
  <D.20395>:
  D.20393 = ares->handle;
  wait_event = mono_wait_handle_get_handle (D.20393);
  <D.20405>:
  mono_monitor_exit (ares);
  WaitForSingleObjectEx (wait_event, 4294967295, 1);
  goto <D.20406>;
  <D.20392>:
  mono_monitor_exit (ares);
  <D.20406>:
  ac = ares->object_data;
  D.20407 = ac == 0B;
  D.20408 = (long int) D.20407;
  D.20409 = __builtin_expect (D.20408, 0);
  if (D.20409 != 0) goto <D.20410>; else goto <D.20411>;
  <D.20410>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 970, "ac != NULL");
  <D.20411>:
  D.20412 = ac->msg;
  D.20413 = D.20412->exc;
  *exc = D.20413;
  D.20414 = ac->out_args;
  *out_args = D.20414;
  D.20389 = ac->res;
  return D.20389;
}


mono_thread_pool_cleanup ()
{
  int D.20416;
  struct MonoCQ * D.20419;
  int D.20422;
  struct GPtrArray * wsqs.75;
  _Bool D.20430;
  long int D.20431;
  long int D.20432;
  _Bool D.20439;
  long int D.20440;
  long int D.20441;

  D.20416 = InterlockedExchange (&async_io_tp.pool_status, 2);
  if (D.20416 == 1) goto <D.20417>; else goto <D.20418>;
  <D.20417>:
  socket_io_cleanup (&socket_io_data);
  threadpool_kill_idle_threads (&async_io_tp);
  <D.20418>:
  D.20419 = async_io_tp.queue;
  if (D.20419 != 0B) goto <D.20420>; else goto <D.20421>;
  <D.20420>:
  sem_destroy (&async_io_tp.new_job);
  threadpool_free_queue (&async_io_tp);
  <D.20421>:
  D.20422 = InterlockedExchange (&async_tp.pool_status, 2);
  if (D.20422 == 1) goto <D.20423>; else goto <D.20424>;
  <D.20423>:
  threadpool_kill_idle_threads (&async_tp);
  threadpool_free_queue (&async_tp);
  <D.20424>:
  wsqs.75 = wsqs;
  if (wsqs.75 != 0B) goto <D.20426>; else goto <D.20427>;
  <D.20426>:
  {
    int ret;

    ret = pthread_mutex_lock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.20428>; else goto <D.20429>;
    <D.20428>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20429>:
    D.20430 = ret != 0;
    D.20431 = (long int) D.20430;
    D.20432 = __builtin_expect (D.20431, 0);
    if (D.20432 != 0) goto <D.20433>; else goto <D.20434>;
    <D.20433>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1009, "ret == 0");
    <D.20434>:
  }
  mono_wsq_cleanup ();
  wsqs.75 = wsqs;
  if (wsqs.75 != 0B) goto <D.20435>; else goto <D.20436>;
  <D.20435>:
  wsqs.75 = wsqs;
  monoeg_g_ptr_array_free (wsqs.75, 1);
  <D.20436>:
  wsqs = 0B;
  {
    int ret;

    ret = pthread_mutex_unlock (&wsqs_lock.mutex);
    if (ret != 0) goto <D.20437>; else goto <D.20438>;
    <D.20437>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20438>:
    D.20439 = ret != 0;
    D.20440 = (long int) D.20439;
    D.20441 = __builtin_expect (D.20440, 0);
    if (D.20441 != 0) goto <D.20442>; else goto <D.20443>;
    <D.20442>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1014, "ret == 0");
    <D.20443>:
  }
  sem_destroy (&async_tp.new_job);
  <D.20427>:
}


InterlockedExchange (volatile gint32 * val, gint32 new_val)
{
  unsigned int new_val.76;
  unsigned int old_val.77;
  unsigned int D.20446;
  int D.20447;
  gint32 D.20448;
  gint32 old_val;

  <D.16943>:
  old_val = *val;
  new_val.76 = (unsigned int) new_val;
  old_val.77 = (unsigned int) old_val;
  D.20446 = __sync_val_compare_and_swap_4 (val, old_val.77, new_val.76);
  D.20447 = (int) D.20446;
  if (D.20447 != old_val) goto <D.16943>; else goto <D.16944>;
  <D.16944>:
  D.20448 = old_val;
  return D.20448;
}


threadpool_kill_idle_threads (struct ThreadPool * tp)
{
  volatile gint * D.20450;
  union MonoSemType * D.20451;
  gint n;

  D.20450 = &tp->max_threads;
  n = InterlockedCompareExchange (D.20450, 0, -1);
  goto <D.18489>;
  <D.18488>:
  n = n + -1;
  D.20451 = &tp->new_job;
  mono_sem_post (D.20451);
  <D.18489>:
  if (n != 0) goto <D.18488>; else goto <D.18490>;
  <D.18490>:
}


threadpool_free_queue (struct ThreadPool * tp)
{
  struct MonoCQ * D.20452;

  D.20452 = tp->queue;
  mono_cq_destroy (D.20452);
  tp->queue = 0B;
}


icall_append_job (struct MonoObject * ar)
{
  threadpool_append_jobs (&async_tp, &ar, 1);
}


mono_thread_pool_remove_domain_jobs (struct MonoDomain * domain, int timeout)
{
  unsigned int D.20453;
  _Bool D.20454;
  long int D.20455;
  long int D.20456;
  _Bool D.20461;
  long int D.20462;
  long int D.20463;
  struct MonoGHashTable * D.20466;
  _Bool D.20471;
  long int D.20472;
  long int D.20473;
  int D.20476;
  unsigned int timeout.78;
  unsigned int D.20484;
  unsigned int D.20485;
  int D.20488;
  gboolean D.20489;
  void * sem_handle;
  int result;
  guint32 start_time;

  result = 1;
  start_time = 0;
  D.20453 = domain->state;
  D.20454 = D.20453 != 2;
  D.20455 = (long int) D.20454;
  D.20456 = __builtin_expect (D.20455, 0);
  if (D.20456 != 0) goto <D.20457>; else goto <D.20458>;
  <D.20457>:
  monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1159, "domain->state == MONO_APPDOMAIN_UNLOADING");
  <D.20458>:
  threadpool_clear_queue (&async_tp, domain);
  threadpool_clear_queue (&async_io_tp, domain);
  {
    int ret;

    ret = pthread_mutex_lock (&socket_io_data.io_lock.mutex);
    if (ret != 0) goto <D.20459>; else goto <D.20460>;
    <D.20459>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20460>:
    D.20461 = ret != 0;
    D.20462 = (long int) D.20461;
    D.20463 = __builtin_expect (D.20462, 0);
    if (D.20463 != 0) goto <D.20464>; else goto <D.20465>;
    <D.20464>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1164, "ret == 0");
    <D.20465>:
  }
  D.20466 = socket_io_data.sock_to_state;
  if (D.20466 != 0B) goto <D.20467>; else goto <D.20468>;
  <D.20467>:
  D.20466 = socket_io_data.sock_to_state;
  mono_g_hash_table_foreach_remove (D.20466, remove_sockstate_for_domain, domain);
  <D.20468>:
  {
    int ret;

    ret = pthread_mutex_unlock (&socket_io_data.io_lock.mutex);
    if (ret != 0) goto <D.20469>; else goto <D.20470>;
    <D.20469>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20470>:
    D.20471 = ret != 0;
    D.20472 = (long int) D.20471;
    D.20473 = __builtin_expect (D.20472, 0);
    if (D.20473 != 0) goto <D.20474>; else goto <D.20475>;
    <D.20474>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "threadpool.c", 1168, "ret == 0");
    <D.20475>:
  }
  sem_handle = CreateSemaphore (0B, 0, 1, 0B);
  domain->cleanup_semaphore = sem_handle;
  mono_memory_write_barrier ();
  D.20476 = domain->threadpool_jobs;
  if (D.20476 != 0) goto <D.20477>; else goto <D.20478>;
  <D.20477>:
  if (timeout != -1) goto <D.20479>; else goto <D.20480>;
  <D.20479>:
  start_time = mono_msec_ticks ();
  <D.20480>:
  <D.20478>:
  goto <D.18565>;
  <D.18564>:
  timeout.78 = (unsigned int) timeout;
  WaitForSingleObject (sem_handle, timeout.78);
  if (timeout != -1) goto <D.20482>; else goto <D.20483>;
  <D.20482>:
  D.20484 = mono_msec_ticks ();
  D.20485 = D.20484 - start_time;
  timeout.78 = (unsigned int) timeout;
  if (D.20485 > timeout.78) goto <D.20486>; else goto <D.20487>;
  <D.20486>:
  result = 0;
  goto <D.18563>;
  <D.20487>:
  <D.20483>:
  <D.18565>:
  D.20488 = domain->threadpool_jobs;
  if (D.20488 != 0) goto <D.18564>; else goto <D.18563>;
  <D.18563>:
  domain->cleanup_semaphore = 0B;
  CloseHandle (sem_handle);
  D.20489 = result;
  return D.20489;
}


remove_sockstate_for_domain (void * key, void * value, void * user_data)
{
  struct MonoVTable * D.20491;
  struct MonoDomain * D.20492;
  gboolean D.20495;
  struct MonoMList * list;
  gboolean remove;

  list = value;
  remove = 0;
  goto <D.18552>;
  <D.18551>:
  {
    struct MonoObject * data;

    data = mono_mlist_get_data (list);
    D.20491 = data->vtable;
    D.20492 = D.20491->domain;
    if (D.20492 == user_data) goto <D.20493>; else goto <D.20494>;
    <D.20493>:
    remove = 1;
    mono_mlist_set_data (list, 0B);
    <D.20494>:
    list = mono_mlist_next (list);
  }
  <D.18552>:
  if (list != 0B) goto <D.18551>; else goto <D.18553>;
  <D.18553>:
  D.20495 = remove;
  return D.20495;
}


threadpool_clear_queue (struct ThreadPool * tp, struct MonoDomain * domain)
{
  struct MonoObject * obj.79;
  struct MonoVTable * D.20502;
  struct MonoDomain * D.20503;
  int D.20506;
  int D.20507;
  struct MonoObject * D.20510;
  struct MonoObject * obj;
  struct MonoMList * other;
  struct MonoCQ * queue;

  try
    {
      other = 0B;
      queue = tp->queue;
      if (queue == 0B) goto <D.20497>; else goto <D.20498>;
      <D.20497>:
      return;
      <D.20498>:
      goto <D.18537>;
      <D.18538>:
      obj.79 = obj;
      if (obj.79 == 0B) goto <D.20500>; else goto <D.20501>;
      <D.20500>:
      // predicted unlikely by continue predictor.
      goto <D.18537>;
      <D.20501>:
      obj.79 = obj;
      D.20502 = obj.79->vtable;
      D.20503 = D.20502->domain;
      if (D.20503 != domain) goto <D.20504>; else goto <D.20505>;
      <D.20504>:
      obj.79 = obj;
      other = mono_mlist_prepend (other, obj.79);
      <D.20505>:
      obj.79 = obj;
      threadpool_jobs_dec (obj.79);
      <D.18537>:
      D.20506 = mono_cq_dequeue (queue, &obj);
      if (D.20506 != 0) goto <D.18538>; else goto <D.18539>;
      <D.18539>:
      D.20507 = mono_runtime_is_shutting_down ();
      if (D.20507 != 0) goto <D.20508>; else goto <D.20509>;
      <D.20508>:
      return;
      <D.20509>:
      goto <D.18541>;
      <D.18540>:
      D.20510 = mono_mlist_get_data (other);
      threadpool_append_job (tp, D.20510);
      other = mono_mlist_next (other);
      <D.18541>:
      if (other != 0B) goto <D.18540>; else goto <D.18542>;
      <D.18542>:
    }
  finally
    {
      obj = {CLOBBER};
    }
}


mono_memory_write_barrier ()
{
  mono_memory_barrier ();
}


mono_memory_barrier ()
{
  __sync_synchronize ();
}


mono_thread_pool_is_queue_array (struct MonoArray * o)
{
  gboolean D.20514;

  D.20514 = 0;
  return D.20514;
}


ves_icall_System_Threading_ThreadPool_GetAvailableThreads (gint * workerThreads, gint * completionPortThreads)
{
  int D.20516;
  int D.20517;
  int D.20518;
  int D.20519;
  int D.20520;
  int D.20521;

  D.20516 = async_tp.max_threads;
  D.20517 = async_tp.busy_threads;
  D.20518 = D.20516 - D.20517;
  *workerThreads = D.20518;
  D.20519 = async_io_tp.max_threads;
  D.20520 = async_io_tp.busy_threads;
  D.20521 = D.20519 - D.20520;
  *completionPortThreads = D.20521;
}


ves_icall_System_Threading_ThreadPool_GetMaxThreads (gint * workerThreads, gint * completionPortThreads)
{
  int D.20522;
  int D.20523;

  D.20522 = async_tp.max_threads;
  *workerThreads = D.20522;
  D.20523 = async_io_tp.max_threads;
  *completionPortThreads = D.20523;
}


ves_icall_System_Threading_ThreadPool_GetMinThreads (gint * workerThreads, gint * completionPortThreads)
{
  int D.20524;
  int D.20525;

  D.20524 = async_tp.min_threads;
  *workerThreads = D.20524;
  D.20525 = async_io_tp.min_threads;
  *completionPortThreads = D.20525;
}


ves_icall_System_Threading_ThreadPool_SetMinThreads (gint workerThreads, gint completionPortThreads)
{
  _Bool D.20526;
  _Bool D.20527;
  _Bool D.20528;
  MonoBoolean D.20531;
  _Bool D.20532;
  _Bool D.20533;
  _Bool D.20534;
  int D.20537;
  struct MonoDomain * D.20540;
  int D.20541;
  struct MonoDomain * D.20544;
  gint max_threads;
  gint max_io_threads;

  max_threads = async_tp.max_threads;
  D.20526 = workerThreads <= 0;
  D.20527 = workerThreads > max_threads;
  D.20528 = D.20526 | D.20527;
  if (D.20528 != 0) goto <D.20529>; else goto <D.20530>;
  <D.20529>:
  D.20531 = 0;
  return D.20531;
  <D.20530>:
  max_io_threads = async_io_tp.max_threads;
  D.20532 = completionPortThreads <= 0;
  D.20533 = completionPortThreads > max_io_threads;
  D.20534 = D.20532 | D.20533;
  if (D.20534 != 0) goto <D.20535>; else goto <D.20536>;
  <D.20535>:
  D.20531 = 0;
  return D.20531;
  <D.20536>:
  InterlockedExchange (&async_tp.min_threads, workerThreads);
  InterlockedExchange (&async_io_tp.min_threads, completionPortThreads);
  D.20537 = async_tp.nthreads;
  if (D.20537 < workerThreads) goto <D.20538>; else goto <D.20539>;
  <D.20538>:
  D.20540 = mono_get_root_domain ();
  mono_thread_create_internal (D.20540, threadpool_start_idle_threads, &async_tp, 1, 0, 131072);
  <D.20539>:
  D.20541 = async_io_tp.nthreads;
  if (D.20541 < completionPortThreads) goto <D.20542>; else goto <D.20543>;
  <D.20542>:
  D.20544 = mono_get_root_domain ();
  mono_thread_create_internal (D.20544, threadpool_start_idle_threads, &async_io_tp, 1, 0, 131072);
  <D.20543>:
  D.20531 = 1;
  return D.20531;
}


ves_icall_System_Threading_ThreadPool_SetMaxThreads (gint workerThreads, gint completionPortThreads)
{
  _Bool D.20546;
  _Bool D.20547;
  _Bool D.20548;
  MonoBoolean D.20551;
  _Bool D.20552;
  _Bool D.20553;
  _Bool D.20554;
  gint min_threads;
  gint min_io_threads;
  gint cpu_count;

  cpu_count = mono_cpu_count ();
  min_threads = async_tp.min_threads;
  D.20546 = workerThreads < min_threads;
  D.20547 = workerThreads < cpu_count;
  D.20548 = D.20546 | D.20547;
  if (D.20548 != 0) goto <D.20549>; else goto <D.20550>;
  <D.20549>:
  D.20551 = 0;
  return D.20551;
  <D.20550>:
  min_io_threads = async_io_tp.min_threads;
  D.20552 = completionPortThreads < min_io_threads;
  D.20553 = completionPortThreads < cpu_count;
  D.20554 = D.20552 | D.20553;
  if (D.20554 != 0) goto <D.20555>; else goto <D.20556>;
  <D.20555>:
  D.20551 = 0;
  return D.20551;
  <D.20556>:
  InterlockedExchange (&async_tp.max_threads, workerThreads);
  InterlockedExchange (&async_io_tp.max_threads, completionPortThreads);
  D.20551 = 1;
  return D.20551;
}


mono_install_threadpool_thread_hooks (void (*MonoThreadPoolFunc) (void *) start_func, void (*MonoThreadPoolFunc) (void *) finish_func, void * user_data)
{
  tp_start_func = start_func;
  tp_finish_func = finish_func;
  tp_hooks_user_data = user_data;
}


mono_install_threadpool_item_hooks (void (*MonoThreadPoolItemFunc) (void *) begin_func, void (*MonoThreadPoolItemFunc) (void *) end_func, void * user_data)
{
  tp_item_begin_func = begin_func;
  tp_item_end_func = end_func;
  tp_item_user_data = user_data;
}


mono_internal_thread_unhandled_exception (struct MonoObject * exc)
{
  <unnamed type> D.20558;
  struct MonoVTable * D.20561;
  struct MonoDomain * D.20562;
  struct MonoClass * D.20565;
  int D.20568;
  struct MonoInternalThread * D.20573;

  D.20558 = mono_runtime_unhandled_exception_policy_get ();
  if (D.20558 == 1) goto <D.20559>; else goto <D.20560>;
  <D.20559>:
  {
    gboolean unloaded;
    struct MonoClass * klass;

    D.20561 = exc->vtable;
    klass = D.20561->klass;
    D.20561 = exc->vtable;
    D.20562 = D.20561->domain;
    unloaded = is_appdomainunloaded_exception (D.20562, klass);
    if (unloaded == 0) goto <D.20563>; else goto <D.20564>;
    <D.20563>:
    D.20565 = mono_defaults.threadabortexception_class;
    if (D.20565 != klass) goto <D.20566>; else goto <D.20567>;
    <D.20566>:
    mono_unhandled_exception (exc);
    D.20568 = mono_environment_exitcode_get ();
    if (D.20568 == 1) goto <D.20569>; else goto <D.20570>;
    <D.20569>:
    exit (255);
    <D.20570>:
    <D.20567>:
    <D.20564>:
    D.20565 = mono_defaults.threadabortexception_class;
    if (D.20565 == klass) goto <D.20571>; else goto <D.20572>;
    <D.20571>:
    D.20573 = mono_thread_internal_current ();
    mono_thread_internal_reset_abort (D.20573);
    <D.20572>:
  }
  <D.20560>:
}


is_appdomainunloaded_exception (struct MonoDomain * domain, struct MonoClass * klass)
{
  struct MonoClass * D.20574;
  gboolean D.20577;
  _Bool D.20578;
  int D.20579;
  int D.18248;
  int iftmp.80;
  int D.18244;
  const char[27] * D.20585;
  unsigned char D.20586;
  int D.20587;
  unsigned char D.20588;
  int D.20589;
  _Bool D.20590;
  _Bool D.20591;
  _Bool D.20592;
  const unsigned char * D.20595;
  unsigned char D.20596;
  int D.20597;
  const unsigned char * D.20598;
  unsigned char D.20599;
  int D.20600;
  _Bool D.20601;
  _Bool D.20602;
  const unsigned char * D.20605;
  unsigned char D.20606;
  int D.20607;
  const unsigned char * D.20608;
  unsigned char D.20609;
  int D.20610;
  _Bool D.20611;
  _Bool D.20612;
  const unsigned char * D.20615;
  unsigned char D.20616;
  int D.20617;
  const unsigned char * D.20618;
  unsigned char D.20619;
  int D.20620;
  const char * D.20622;
  int D.18257;
  int iftmp.81;
  int D.18253;
  const char[7] * D.20628;
  unsigned char D.20629;
  int D.20630;
  unsigned char D.20631;
  int D.20632;
  _Bool D.20633;
  _Bool D.20634;
  _Bool D.20635;
  const unsigned char * D.20638;
  unsigned char D.20639;
  int D.20640;
  const unsigned char * D.20641;
  unsigned char D.20642;
  int D.20643;
  _Bool D.20644;
  _Bool D.20645;
  const unsigned char * D.20648;
  unsigned char D.20649;
  int D.20650;
  const unsigned char * D.20651;
  unsigned char D.20652;
  int D.20653;
  _Bool D.20654;
  _Bool D.20655;
  const unsigned char * D.20658;
  unsigned char D.20659;
  int D.20660;
  const unsigned char * D.20661;
  unsigned char D.20662;
  int D.20663;
  const char * D.20665;

  D.20574 = domain->ad_unloaded_ex_class;
  if (D.20574 != 0B) goto <D.20575>; else goto <D.20576>;
  <D.20575>:
  D.20574 = domain->ad_unloaded_ex_class;
  D.20578 = D.20574 == klass;
  D.20577 = (gboolean) D.20578;
  return D.20577;
  <D.20576>:
  D.20579 = is_corlib_type (domain, klass);
  if (D.20579 != 0) goto <D.20580>; else goto <D.20581>;
  <D.20580>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 26;
    if (__s1_len <= 3) goto <D.20583>; else goto <D.20584>;
    <D.20583>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name;
      D.20585 = "AppDomainUnloadedException";
      D.20586 = MEM[(const unsigned char *)D.20585];
      D.20587 = (int) D.20586;
      D.20588 = *__s2;
      D.20589 = (int) D.20588;
      __result = D.20587 - D.20589;
      {
        D.20590 = __s1_len != 0;
        D.20591 = __result == 0;
        D.20592 = D.20590 & D.20591;
        if (D.20592 != 0) goto <D.20593>; else goto <D.20594>;
        <D.20593>:
        D.20595 = &MEM[(void *)"AppDomainUnloadedException" + 1B];
        D.20596 = *D.20595;
        D.20597 = (int) D.20596;
        D.20598 = __s2 + 1;
        D.20599 = *D.20598;
        D.20600 = (int) D.20599;
        __result = D.20597 - D.20600;
        D.20601 = __s1_len > 1;
        D.20591 = __result == 0;
        D.20602 = D.20601 & D.20591;
        if (D.20602 != 0) goto <D.20603>; else goto <D.20604>;
        <D.20603>:
        D.20605 = &MEM[(void *)"AppDomainUnloadedException" + 2B];
        D.20606 = *D.20605;
        D.20607 = (int) D.20606;
        D.20608 = __s2 + 2;
        D.20609 = *D.20608;
        D.20610 = (int) D.20609;
        __result = D.20607 - D.20610;
        D.20611 = __s1_len > 2;
        D.20591 = __result == 0;
        D.20612 = D.20611 & D.20591;
        if (D.20612 != 0) goto <D.20613>; else goto <D.20614>;
        <D.20613>:
        D.20615 = &MEM[(void *)"AppDomainUnloadedException" + 3B];
        D.20616 = *D.20615;
        D.20617 = (int) D.20616;
        D.20618 = __s2 + 3;
        D.20619 = *D.20618;
        D.20620 = (int) D.20619;
        __result = D.20617 - D.20620;
        <D.20614>:
        <D.20604>:
        <D.20594>:
      }
      D.18244 = __result;
    }
    iftmp.80 = D.18244;
    goto <D.20621>;
    <D.20584>:
    D.20622 = klass->name;
    iftmp.80 = __builtin_strcmp ("AppDomainUnloadedException", D.20622);
    <D.20621>:
    D.18248 = iftmp.80;
  }
  if (D.18248 == 0) goto <D.20623>; else goto <D.20624>;
  <D.20623>:
  {
    size_t __s1_len;
    size_t __s2_len;

    __s1_len = 6;
    if (__s1_len <= 3) goto <D.20626>; else goto <D.20627>;
    <D.20626>:
    {
      const unsigned char * __s2;
      int __result;

      __s2 = klass->name_space;
      D.20628 = "System";
      D.20629 = MEM[(const unsigned char *)D.20628];
      D.20630 = (int) D.20629;
      D.20631 = *__s2;
      D.20632 = (int) D.20631;
      __result = D.20630 - D.20632;
      {
        D.20633 = __s1_len != 0;
        D.20634 = __result == 0;
        D.20635 = D.20633 & D.20634;
        if (D.20635 != 0) goto <D.20636>; else goto <D.20637>;
        <D.20636>:
        D.20638 = &MEM[(void *)"System" + 1B];
        D.20639 = *D.20638;
        D.20640 = (int) D.20639;
        D.20641 = __s2 + 1;
        D.20642 = *D.20641;
        D.20643 = (int) D.20642;
        __result = D.20640 - D.20643;
        D.20644 = __s1_len > 1;
        D.20634 = __result == 0;
        D.20645 = D.20644 & D.20634;
        if (D.20645 != 0) goto <D.20646>; else goto <D.20647>;
        <D.20646>:
        D.20648 = &MEM[(void *)"System" + 2B];
        D.20649 = *D.20648;
        D.20650 = (int) D.20649;
        D.20651 = __s2 + 2;
        D.20652 = *D.20651;
        D.20653 = (int) D.20652;
        __result = D.20650 - D.20653;
        D.20654 = __s1_len > 2;
        D.20634 = __result == 0;
        D.20655 = D.20654 & D.20634;
        if (D.20655 != 0) goto <D.20656>; else goto <D.20657>;
        <D.20656>:
        D.20658 = &MEM[(void *)"System" + 3B];
        D.20659 = *D.20658;
        D.20660 = (int) D.20659;
        D.20661 = __s2 + 3;
        D.20662 = *D.20661;
        D.20663 = (int) D.20662;
        __result = D.20660 - D.20663;
        <D.20657>:
        <D.20647>:
        <D.20637>:
      }
      D.18253 = __result;
    }
    iftmp.81 = D.18253;
    goto <D.20664>;
    <D.20627>:
    D.20665 = klass->name_space;
    iftmp.81 = __builtin_strcmp ("System", D.20665);
    <D.20664>:
    D.18257 = iftmp.81;
  }
  if (D.18257 == 0) goto <D.20666>; else goto <D.20667>;
  <D.20666>:
  domain->ad_unloaded_ex_class = klass;
  D.20577 = 1;
  return D.20577;
  <D.20667>:
  <D.20624>:
  <D.20581>:
  D.20577 = 0;
  return D.20577;
}


mono_thread_pool_suspend ()
{
  suspended = 1;
}


mono_thread_pool_resume ()
{
  suspended = 0;
}


