mono_perfcounters_init ()
{
  void * shared_area.0;
  struct MonoSharedArea * shared_area.1;
  short unsigned int D.16931;
  struct MonoPerfCounters * mono_perfcounters.2;
  int d_offset;

  d_offset = 292;
  d_offset = d_offset + 7;
  d_offset = d_offset & -8;
  InitializeCriticalSection (&perfctr_mutex);
  shared_area.0 = mono_shared_area ();
  shared_area = shared_area.0;
  shared_area.1 = shared_area;
  shared_area.1->counters_start = 28;
  shared_area.1 = shared_area;
  shared_area.1->counters_size = 264;
  shared_area.1 = shared_area;
  D.16931 = (short unsigned int) d_offset;
  shared_area.1->data_start = D.16931;
  shared_area.1 = shared_area;
  shared_area.1->size = 4096;
  shared_area.1 = shared_area;
  mono_perfcounters.2 = &shared_area.1->counters;
  mono_perfcounters = mono_perfcounters.2;
}


mono_perfcounter_get_impl (struct MonoString * category, struct MonoString * counter, struct MonoString * instance, struct MonoString * machine, int * type, MonoBoolean * custom)
{
  int D.16933;
  void * D.16936;
  unsigned char D.16941;
  int D.16942;
  const struct CategoryDesc * cdesc;

  D.16933 = mono_string_compare_ascii (machine, ".");
  if (D.16933 != 0) goto <D.16934>; else goto <D.16935>;
  <D.16934>:
  D.16936 = 0B;
  return D.16936;
  <D.16935>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.16937>; else goto <D.16938>;
  <D.16937>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.16939>; else goto <D.16940>;
    <D.16939>:
    D.16936 = 0B;
    return D.16936;
    <D.16940>:
    *custom = 1;
    D.16936 = custom_get_impl (scat, counter, instance, type);
    return D.16936;
  }
  <D.16938>:
  D.16941 = cdesc->id;
  D.16942 = (int) D.16941;
  switch (D.16942) <default: <D.16943>, case 0: <D.16702>, case 1: <D.16703>, case 2: <D.16704>, case 3: <D.16714>, case 4: <D.16706>, case 5: <D.16707>, case 6: <D.16708>, case 7: <D.16709>, case 8: <D.16710>, case 9: <D.16711>, case 10: <D.16712>, case 11: <D.16713>, case 12: <D.16715>, case 13: <D.16705>>
  <D.16702>:
  D.16936 = cpu_get_impl (counter, instance, type, custom);
  return D.16936;
  <D.16703>:
  D.16936 = process_get_impl (counter, instance, type, custom);
  return D.16936;
  <D.16704>:
  D.16936 = mono_mem_get_impl (counter, instance, type, custom);
  return D.16936;
  <D.16705>:
  D.16936 = network_get_impl (counter, instance, type, custom);
  return D.16936;
  <D.16706>:
  <D.16707>:
  <D.16708>:
  <D.16709>:
  <D.16710>:
  <D.16711>:
  <D.16712>:
  <D.16713>:
  <D.16714>:
  <D.16715>:
  D.16941 = cdesc->id;
  D.16942 = (int) D.16941;
  D.16936 = predef_writable_get_impl (D.16942, counter, instance, type, custom);
  return D.16936;
  <D.16943>:
  D.16936 = 0B;
  return D.16936;
}


mono_string_compare_ascii (struct MonoString * str, const char * ascii_str)
{
  short unsigned int D.16945;
  int D.16948;
  int D.16949;
  const char * ascii_str.3;
  char D.16951;
  int D.16952;
  const unsigned char * D.16953;
  unsigned char D.16954;
  int D.16955;
  guint16 * strc;

  strc = mono_string_chars (str);
  goto <D.16409>;
  <D.16408>:
  D.16945 = *strc;
  if (D.16945 == 0) goto <D.16946>; else goto <D.16947>;
  <D.16946>:
  D.16948 = 0;
  return D.16948;
  <D.16947>:
  strc = strc + 2;
  <D.16409>:
  D.16945 = *strc;
  D.16949 = (int) D.16945;
  ascii_str.3 = ascii_str;
  ascii_str = ascii_str.3 + 1;
  D.16951 = *ascii_str.3;
  D.16952 = (int) D.16951;
  if (D.16949 == D.16952) goto <D.16408>; else goto <D.16410>;
  <D.16410>:
  D.16945 = *strc;
  D.16949 = (int) D.16945;
  D.16953 = ascii_str + 4294967295;
  D.16954 = *D.16953;
  D.16955 = (int) D.16954;
  D.16948 = D.16949 - D.16955;
  return D.16948;
}


find_category (struct MonoString * category)
{
  const char * D.16957;
  int D.16958;
  const struct CategoryDesc * D.16961;
  int i;

  i = 0;
  goto <D.16690>;
  <D.16689>:
  D.16957 = predef_categories[i].name;
  D.16958 = mono_string_compare_ascii (category, D.16957);
  if (D.16958 == 0) goto <D.16959>; else goto <D.16960>;
  <D.16959>:
  D.16961 = &predef_categories[i];
  return D.16961;
  <D.16960>:
  i = i + 1;
  <D.16690>:
  if (i <= 13) goto <D.16689>; else goto <D.16691>;
  <D.16691>:
  D.16961 = 0B;
  return D.16961;
}


find_custom_category (struct MonoString * name)
{
  struct SharedCategory * D.16963;
  struct CatSearch search;

  try
    {
      search.name = name;
      search.cat = 0B;
      foreach_shared_item (category_search, &search);
      D.16963 = search.cat;
      return D.16963;
    }
  finally
    {
      search = {CLOBBER};
    }
}


category_search (struct SharedHeader * header, void * data)
{
  unsigned char D.16966;
  char[1] * D.16969;
  struct MonoString * D.16970;
  int D.16971;
  gboolean D.16974;
  struct CatSearch * search;

  search = data;
  D.16966 = header->ftype;
  if (D.16966 == 67) goto <D.16967>; else goto <D.16968>;
  <D.16967>:
  {
    struct SharedCategory * cat;

    cat = header;
    D.16969 = &cat->name;
    D.16970 = search->name;
    D.16971 = mono_string_compare_ascii (D.16970, D.16969);
    if (D.16971 == 0) goto <D.16972>; else goto <D.16973>;
    <D.16972>:
    search->cat = cat;
    D.16974 = 0;
    return D.16974;
    <D.16973>:
  }
  <D.16968>:
  D.16974 = 1;
  return D.16974;
}


foreach_shared_item (gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  struct MonoSharedArea * shared_area.4;
  short unsigned int D.16977;
  sizetype D.16978;
  int D.16979;
  sizetype D.16980;
  unsigned char * p;
  unsigned char * end;

  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.16977 = shared_area.4->data_start;
  D.16978 = (sizetype) D.16977;
  p = shared_area.4 + D.16978;
  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.16979 = shared_area.4->size;
  D.16980 = (sizetype) D.16979;
  end = shared_area.4 + D.16980;
  foreach_shared_item_in_area (p, end, func, data);
}


foreach_shared_item_in_area (unsigned char * p, unsigned char * end, gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  unsigned char * D.16981;
  int D.16984;
  unsigned char D.16987;
  short unsigned int D.16990;
  sizetype D.16991;

  goto <D.16395>;
  <D.16394>:
  {
    short unsigned int * next;

    D.16981 = p + 4;
    if (D.16981 > end) goto <D.16982>; else goto <D.16983>;
    <D.16982>:
    return;
    <D.16983>:
    next = p + 2;
    D.16984 = func (p, data);
    if (D.16984 == 0) goto <D.16985>; else goto <D.16986>;
    <D.16985>:
    return;
    <D.16986>:
    D.16987 = *p;
    if (D.16987 == 0) goto <D.16988>; else goto <D.16989>;
    <D.16988>:
    return;
    <D.16989>:
    D.16990 = *next;
    D.16991 = (sizetype) D.16990;
    p = p + D.16991;
  }
  <D.16395>:
  if (p < end) goto <D.16394>; else goto <D.16396>;
  <D.16396>:
}


custom_get_impl (struct SharedCategory * cat, struct MonoString * counter, struct MonoString * instance, int * type)
{
  void * D.16995;
  unsigned char D.16996;
  int D.16997;
  int D.16998;
  char[1] * D.17001;
  unsigned int D.17002;
  unsigned int D.17003;
  unsigned char D.17004;
  unsigned int D.17005;
  unsigned int D.17006;
  sizetype size.5;
  sizetype D.17008;
  char * D.17009;
  struct SharedCounter * scounter;
  struct SharedInstance * inst;
  int size;

  scounter = find_custom_counter (cat, counter);
  if (scounter == 0B) goto <D.16993>; else goto <D.16994>;
  <D.16993>:
  D.16995 = 0B;
  return D.16995;
  <D.16994>:
  D.16996 = scounter->type;
  D.16997 = (int) D.16996;
  D.16998 = simple_type_to_type[D.16997];
  *type = D.16998;
  inst = custom_get_instance (cat, scounter, instance);
  if (inst == 0B) goto <D.16999>; else goto <D.17000>;
  <D.16999>:
  D.16995 = 0B;
  return D.16995;
  <D.17000>:
  D.17001 = &inst->instance_name;
  D.17002 = strlen (D.17001);
  D.17003 = D.17002 + 12;
  size = (int) D.17003;
  size = size + 7;
  size = size & -8;
  D.17004 = scounter->seq_num;
  D.17005 = (unsigned int) D.17004;
  D.17006 = D.17005 * 8;
  size.5 = (sizetype) size;
  D.17008 = D.17006 + size.5;
  D.17009 = inst + D.17008;
  D.16995 = custom_vtable (scounter, inst, D.17009);
  return D.16995;
}


find_custom_counter (struct SharedCategory * cat, struct MonoString * name)
{
  char[1] * D.17011;
  int D.17012;
  struct SharedCounter * D.17015;
  const char * D.17016;
  unsigned int D.17017;
  sizetype D.17018;
  unsigned int D.17019;
  sizetype D.17020;
  short unsigned int D.17021;
  int D.17022;
  int i;
  char * p;

  p = custom_category_counters (cat);
  i = 0;
  goto <D.16446>;
  <D.16445>:
  {
    struct SharedCounter * counter;

    counter = p;
    D.17011 = &counter->name;
    D.17012 = mono_string_compare_ascii (name, D.17011);
    if (D.17012 == 0) goto <D.17013>; else goto <D.17014>;
    <D.17013>:
    D.17015 = counter;
    return D.17015;
    <D.17014>:
    D.17016 = p + 1;
    D.17017 = strlen (D.17016);
    D.17018 = D.17017 + 2;
    p = p + D.17018;
    D.17019 = strlen (p);
    D.17020 = D.17019 + 1;
    p = p + D.17020;
  }
  i = i + 1;
  <D.16446>:
  D.17021 = cat->num_counters;
  D.17022 = (int) D.17021;
  if (D.17022 > i) goto <D.16445>; else goto <D.16447>;
  <D.16447>:
  D.17015 = 0B;
  return D.17015;
}


custom_category_counters (struct SharedCategory * cat)
{
  char[1] * D.17024;
  unsigned int D.17025;
  sizetype D.17026;
  unsigned int D.17027;
  sizetype D.17028;
  char * D.17029;
  char * p;

  D.17024 = &cat->name;
  D.17025 = strlen (D.17024);
  D.17026 = D.17025 + 1;
  p = &cat->name[D.17026];
  D.17027 = strlen (p);
  D.17028 = D.17027 + 1;
  p = p + D.17028;
  D.17029 = p;
  return D.17029;
}


custom_get_instance (struct SharedCategory * cat, struct SharedCounter * scounter, struct MonoString * instance)
{
  struct SharedInstance * D.17033;
  unsigned int D.17034;
  unsigned int D.17035;
  short unsigned int D.17036;
  unsigned int D.17037;
  unsigned int D.17038;
  unsigned int size.6;
  unsigned int D.17040;
  _Bool D.17043;
  long int D.17044;
  long int D.17045;
  _Bool D.17052;
  long int D.17053;
  long int D.17054;
  short unsigned int D.17057;
  int cat.7;
  struct MonoSharedArea * shared_area.8;
  int shared_area.9;
  int D.17061;
  unsigned int D.17062;
  int D.17063;
  int D.17064;
  unsigned int D.17065;
  sizetype D.17066;
  _Bool D.17069;
  long int D.17070;
  long int D.17071;
  struct SharedInstance * inst;
  unsigned char * ptr;
  char * p;
  int size;
  int data_offset;
  char * name;

  inst = find_custom_instance (cat, instance);
  if (inst != 0B) goto <D.17031>; else goto <D.17032>;
  <D.17031>:
  D.17033 = inst;
  return D.17033;
  <D.17032>:
  name = mono_string_to_utf8 (instance);
  D.17034 = strlen (name);
  D.17035 = D.17034 + 12;
  size = (int) D.17035;
  size = size + 7;
  size = size & -8;
  data_offset = size;
  D.17036 = cat->num_counters;
  D.17037 = (unsigned int) D.17036;
  D.17038 = D.17037 * 8;
  size.6 = (unsigned int) size;
  D.17040 = D.17038 + size.6;
  size = (int) D.17040;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17041>; else goto <D.17042>;
    <D.17041>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17042>:
    D.17043 = ret != 0;
    D.17044 = (long int) D.17043;
    D.17045 = __builtin_expect (D.17044, 0);
    if (D.17045 != 0) goto <D.17046>; else goto <D.17047>;
    <D.17046>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1159, "ret == 0");
    <D.17047>:
  }
  ptr = shared_data_find_room (size);
  if (ptr == 0B) goto <D.17048>; else goto <D.17049>;
  <D.17048>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17050>; else goto <D.17051>;
    <D.17050>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17051>:
    D.17052 = ret != 0;
    D.17053 = (long int) D.17052;
    D.17054 = __builtin_expect (D.17053, 0);
    if (D.17054 != 0) goto <D.17055>; else goto <D.17056>;
    <D.17055>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1162, "ret == 0");
    <D.17056>:
  }
  monoeg_g_free (name);
  D.17033 = 0B;
  return D.17033;
  <D.17049>:
  inst = ptr;
  inst->header.extra = 0;
  D.17057 = (short unsigned int) size;
  inst->header.size = D.17057;
  cat.7 = (int) cat;
  shared_area.8 = shared_area;
  shared_area.9 = (int) shared_area.8;
  D.17061 = cat.7 - shared_area.9;
  D.17062 = (unsigned int) D.17061;
  inst->category_offset = D.17062;
  D.17063 = cat->num_instances;
  D.17064 = D.17063 + 1;
  cat->num_instances = D.17064;
  p = &inst->instance_name;
  strcpy (p, name);
  D.17065 = strlen (name);
  D.17066 = D.17065 + 1;
  p = p + D.17066;
  inst->header.ftype = 73;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17067>; else goto <D.17068>;
    <D.17067>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17068>:
    D.17069 = ret != 0;
    D.17070 = (long int) D.17069;
    D.17071 = __builtin_expect (D.17070, 0);
    if (D.17071 != 0) goto <D.17072>; else goto <D.17073>;
    <D.17072>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1176, "ret == 0");
    <D.17073>:
  }
  monoeg_g_free (name);
  D.17033 = inst;
  return D.17033;
}


find_custom_instance (struct SharedCategory * cat, struct MonoString * instance)
{
  int cat.10;
  struct MonoSharedArea * shared_area.11;
  int shared_area.12;
  int D.17078;
  unsigned int D.17079;
  struct SharedInstance * D.17080;
  struct InstanceSearch search;

  try
    {
      cat.10 = (int) cat;
      shared_area.11 = shared_area;
      shared_area.12 = (int) shared_area.11;
      D.17078 = cat.10 - shared_area.12;
      D.17079 = (unsigned int) D.17078;
      search.cat_offset = D.17079;
      search.cat = cat;
      search.instance = instance;
      search.list = 0B;
      search.result = 0B;
      foreach_shared_item (instance_search, &search);
      D.17080 = search.result;
      return D.17080;
    }
  finally
    {
      search = {CLOBBER};
    }
}


instance_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17083;
  unsigned int D.17086;
  unsigned int D.17087;
  struct MonoString * D.17090;
  char[1] * D.17093;
  int D.17094;
  gboolean D.17097;
  struct GSList * D.17099;
  struct GSList * D.17100;
  struct InstanceSearch * search;

  search = data;
  D.17083 = header->ftype;
  if (D.17083 == 73) goto <D.17084>; else goto <D.17085>;
  <D.17084>:
  {
    struct SharedInstance * ins;

    ins = header;
    D.17086 = search->cat_offset;
    D.17087 = ins->category_offset;
    if (D.17086 == D.17087) goto <D.17088>; else goto <D.17089>;
    <D.17088>:
    D.17090 = search->instance;
    if (D.17090 != 0B) goto <D.17091>; else goto <D.17092>;
    <D.17091>:
    D.17093 = &ins->instance_name;
    D.17090 = search->instance;
    D.17094 = mono_string_compare_ascii (D.17090, D.17093);
    if (D.17094 == 0) goto <D.17095>; else goto <D.17096>;
    <D.17095>:
    search->result = ins;
    D.17097 = 0;
    return D.17097;
    <D.17096>:
    goto <D.17098>;
    <D.17092>:
    D.17099 = search->list;
    D.17100 = monoeg_g_slist_prepend (D.17099, ins);
    search->list = D.17100;
    <D.17098>:
    <D.17089>:
  }
  <D.17085>:
  D.17097 = 1;
  return D.17097;
}


shared_data_find_room (int size)
{
  struct MonoSharedArea * shared_area.13;
  short unsigned int D.17103;
  sizetype D.17104;
  int D.17105;
  sizetype D.17106;
  unsigned char D.17107;
  int end.14;
  int p.15;
  int D.17112;
  unsigned char * D.17115;
  unsigned char * D.17116;
  short unsigned int D.17121;
  int D.17122;
  sizetype D.17125;
  unsigned char * p;
  unsigned char * end;

  shared_area.13 = shared_area;
  shared_area.13 = shared_area;
  D.17103 = shared_area.13->data_start;
  D.17104 = (sizetype) D.17103;
  p = shared_area.13 + D.17104;
  shared_area.13 = shared_area;
  shared_area.13 = shared_area;
  D.17105 = shared_area.13->size;
  D.17106 = (sizetype) D.17105;
  end = shared_area.13 + D.17106;
  size = size + 7;
  size = size & -8;
  goto <D.16382>;
  <D.16381>:
  {
    short unsigned int * next;

    D.17107 = *p;
    if (D.17107 == 0) goto <D.17108>; else goto <D.17109>;
    <D.17108>:
    end.14 = (int) end;
    p.15 = (int) p;
    D.17112 = end.14 - p.15;
    if (D.17112 > size) goto <D.17113>; else goto <D.17114>;
    <D.17113>:
    D.17115 = p;
    return D.17115;
    <D.17114>:
    D.17115 = 0B;
    return D.17115;
    <D.17109>:
    D.17116 = p + 4;
    if (D.17116 > end) goto <D.17117>; else goto <D.17118>;
    <D.17117>:
    D.17115 = 0B;
    return D.17115;
    <D.17118>:
    next = p + 2;
    D.17107 = *p;
    if (D.17107 == 68) goto <D.17119>; else goto <D.17120>;
    <D.17119>:
    D.17121 = *next;
    D.17122 = (int) D.17121;
    if (D.17122 == size) goto <D.17123>; else goto <D.17124>;
    <D.17123>:
    D.17115 = p;
    return D.17115;
    <D.17124>:
    <D.17120>:
    D.17121 = *next;
    D.17125 = (sizetype) D.17121;
    p = p + D.17125;
  }
  <D.16382>:
  if (p < end) goto <D.16381>; else goto <D.16383>;
  <D.16383>:
  D.17115 = 0B;
  return D.17115;
}


strcpy (char * restrict __dest, const char * restrict __src)
{
  char * D.17127;
  unsigned int D.17128;

  D.17128 = __builtin_object_size (__dest, 1);
  D.17127 = __builtin___strcpy_chk (__dest, __src, D.17128);
  return D.17127;
}


custom_vtable (struct SharedCounter * scounter, struct SharedInstance * inst, char * data)
{
  struct ImplVtable * D.17130;
  struct CustomVTable * vtable;

  vtable = monoeg_malloc0 (24);
  vtable->vtable.arg = data;
  vtable->vtable.sample = custom_writable_counter;
  vtable->vtable.update = custom_writable_update;
  vtable->instance_desc = inst;
  vtable->counter_desc = scounter;
  D.17130 = vtable;
  return D.17130;
}


custom_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  long long unsigned int D.17136;
  long long unsigned int value.16;
  long long unsigned int D.17138;
  gint64 D.17139;
  long long unsigned int value.17;
  guint64 * ptr;

  ptr = vtable->arg;
  if (ptr != 0B) goto <D.17132>; else goto <D.17133>;
  <D.17132>:
  if (do_incr != 0) goto <D.17134>; else goto <D.17135>;
  <D.17134>:
  D.17136 = *ptr;
  value.16 = (long long unsigned int) value;
  D.17138 = D.17136 + value.16;
  *ptr = D.17138;
  D.17136 = *ptr;
  D.17139 = (gint64) D.17136;
  return D.17139;
  <D.17135>:
  value.17 = (long long unsigned int) value;
  *ptr = value.17;
  D.17139 = value;
  return D.17139;
  <D.17133>:
  D.17139 = 0;
  return D.17139;
}


custom_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  struct SharedCounter * D.17144;
  unsigned char D.17145;
  int D.17146;
  int D.17147;
  void * D.17148;
  long long unsigned int D.17152;
  long long int D.17153;
  MonoBoolean D.17154;
  struct CustomVTable * counter_data;

  counter_data = vtable;
  if (only_value == 0) goto <D.17142>; else goto <D.17143>;
  <D.17142>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17143>:
  D.17144 = counter_data->counter_desc;
  D.17145 = D.17144->type;
  D.17146 = (int) D.17145;
  D.17147 = simple_type_to_type[D.17146];
  sample->counterType = D.17147;
  D.17148 = vtable->arg;
  if (D.17148 == 0B) goto <D.17149>; else goto <D.17150>;
  <D.17149>:
  sample->rawValue = 0;
  goto <D.17151>;
  <D.17150>:
  D.17148 = vtable->arg;
  D.17152 = MEM[(guint64 *)D.17148];
  D.17153 = (long long int) D.17152;
  sample->rawValue = D.17153;
  <D.17151>:
  D.17154 = 1;
  return D.17154;
}


fill_sample (struct MonoCounterSample * sample)
{
  long long int D.17156;
  long long int D.17157;

  D.17156 = mono_100ns_ticks ();
  sample->timeStamp = D.17156;
  D.17157 = sample->timeStamp;
  sample->timeStamp100nSec = D.17157;
  D.17157 = sample->timeStamp;
  sample->counterTimeStamp = D.17157;
  sample->counterFrequency = 10000000;
  sample->systemFrequency = 10000000;
  sample->baseValue = 0;
}


cpu_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17158;
  int D.17161;
  void * D.17162;
  short int D.17163;
  int D.17164;
  int D.17165;
  void * D.17166;
  int id;
  const struct CounterDesc * cdesc;

  D.17158 = id_from_string (instance, 0);
  id = D.17158 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[0], counter);
  if (cdesc != 0B) goto <D.17159>; else goto <D.17160>;
  <D.17159>:
  D.17161 = cdesc->type;
  *type = D.17161;
  D.17163 = cdesc->id;
  D.17164 = (int) D.17163;
  D.17165 = D.17164 | id;
  D.17166 = (void *) D.17165;
  D.17162 = create_vtable (D.17166, get_cpu_counter, 0B);
  return D.17162;
  <D.17160>:
  D.17162 = 0B;
  return D.17162;
}


get_cpu_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17168;
  short int D.17171;
  int D.17172;
  int D.17173;
  int D.17174;
  long long int D.17175;
  MonoBoolean D.17176;
  long long int D.17177;
  long long int D.17178;
  long long int D.17179;
  long long int D.17180;
  MonoProcessError error;
  int id;
  int pid;

  try
    {
      D.17168 = vtable->arg;
      id = (int) D.17168;
      pid = id >> 5;
      id = id & 31;
      if (only_value == 0) goto <D.17169>; else goto <D.17170>;
      <D.17169>:
      fill_sample (sample);
      sample->baseValue = 1;
      <D.17170>:
      D.17171 = 0;
      D.17172 = (int) D.17171;
      D.17173 = D.17172 + id;
      D.17174 = predef_counters[D.17173].type;
      sample->counterType = D.17174;
      switch (id) <default: <D.17181>, case 0: <D.16500>, case 1: <D.16501>, case 2: <D.16502>, case 3: <D.16503>, case 4: <D.16504>>
      <D.16500>:
      D.17175 = mono_cpu_get_data (pid, 0, &error);
      sample->rawValue = D.17175;
      D.17176 = 1;
      return D.17176;
      <D.16501>:
      D.17177 = mono_cpu_get_data (pid, 1, &error);
      sample->rawValue = D.17177;
      D.17176 = 1;
      return D.17176;
      <D.16502>:
      D.17178 = mono_cpu_get_data (pid, 2, &error);
      sample->rawValue = D.17178;
      D.17176 = 1;
      return D.17176;
      <D.16503>:
      D.17179 = mono_cpu_get_data (pid, 3, &error);
      sample->rawValue = D.17179;
      D.17176 = 1;
      return D.17176;
      <D.16504>:
      D.17180 = mono_cpu_get_data (pid, 4, &error);
      sample->rawValue = D.17180;
      D.17176 = 1;
      return D.17176;
      <D.17181>:
      D.17176 = 0;
      return D.17176;
    }
  finally
    {
      error = {CLOBBER};
    }
}


id_from_string (struct MonoString * instance, gboolean is_process)
{
  int D.17184;
  char * end.18;
  int D.17192;
  int id;

  id = -1;
  D.17184 = mono_string_length (instance);
  if (D.17184 != 0) goto <D.17185>; else goto <D.17186>;
  <D.17185>:
  {
    char * id_str;
    char * end;

    try
      {
        id_str = mono_string_to_utf8 (instance);
        id = strtol (id_str, &end, 0);
        end.18 = end;
        if (end.18 == id_str) goto <D.17188>; else goto <D.17189>;
        <D.17188>:
        if (is_process == 0) goto <D.17190>; else goto <D.17191>;
        <D.17190>:
        id = -1;
        <D.17191>:
        <D.17189>:
        monoeg_g_free (id_str);
      }
    finally
      {
        end = {CLOBBER};
      }
  }
  <D.17186>:
  D.17192 = id;
  return D.17192;
}


get_counter_in_category (const struct CategoryDesc * desc, struct MonoString * counter)
{
  short int D.17194;
  int D.17195;
  const struct CategoryDesc * D.17196;
  short int D.17197;
  int D.17198;
  const char * D.17199;
  int D.17200;
  const struct CounterDesc * D.17203;
  const struct CounterDesc * cdesc;
  const struct CounterDesc * end;

  D.17194 = desc->first_counter;
  D.17195 = (int) D.17194;
  cdesc = &predef_counters[D.17195];
  D.17196 = desc + 12;
  D.17197 = D.17196->first_counter;
  D.17198 = (int) D.17197;
  end = &predef_counters[D.17198];
  goto <D.16480>;
  <D.16479>:
  D.17199 = cdesc->name;
  D.17200 = mono_string_compare_ascii (counter, D.17199);
  if (D.17200 == 0) goto <D.17201>; else goto <D.17202>;
  <D.17201>:
  D.17203 = cdesc;
  return D.17203;
  <D.17202>:
  cdesc = cdesc + 16;
  <D.16480>:
  if (cdesc < end) goto <D.16479>; else goto <D.16481>;
  <D.16481>:
  D.17203 = 0B;
  return D.17203;
}


create_vtable (void * arg, MonoBoolean (*SampleFunc) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) sample, gint64 (*UpdateFunc) (struct ImplVtable *, MonoBoolean, gint64) update)
{
  struct ImplVtable * D.17205;
  struct ImplVtable * vtable;

  vtable = monoeg_malloc0 (16);
  vtable->arg = arg;
  vtable->sample = sample;
  vtable->update = update;
  D.17205 = vtable;
  return D.17205;
}


process_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17207;
  int D.17210;
  void * D.17211;
  short int D.17212;
  int D.17213;
  int D.17214;
  void * D.17215;
  int id;
  const struct CounterDesc * cdesc;

  D.17207 = id_from_string (instance, 1);
  id = D.17207 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[1], counter);
  if (cdesc != 0B) goto <D.17208>; else goto <D.17209>;
  <D.17208>:
  D.17210 = cdesc->type;
  *type = D.17210;
  D.17212 = cdesc->id;
  D.17213 = (int) D.17212;
  D.17214 = D.17213 | id;
  D.17215 = (void *) D.17214;
  D.17211 = create_vtable (D.17215, get_process_counter, 0B);
  return D.17211;
  <D.17209>:
  D.17211 = 0B;
  return D.17211;
}


get_process_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17217;
  MonoBoolean D.17220;
  short int D.17223;
  int D.17224;
  int D.17225;
  int D.17226;
  void * pid.19;
  long long int D.17228;
  long long int D.17229;
  long long int D.17230;
  long long int D.17231;
  long long int D.17232;
  long long int D.17233;
  long long int D.17234;
  int id;
  int pid;

  D.17217 = vtable->arg;
  id = (int) D.17217;
  pid = id >> 5;
  if (pid < 0) goto <D.17218>; else goto <D.17219>;
  <D.17218>:
  D.17220 = 0;
  return D.17220;
  <D.17219>:
  id = id & 31;
  if (only_value == 0) goto <D.17221>; else goto <D.17222>;
  <D.17221>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17222>:
  D.17223 = 5;
  D.17224 = (int) D.17223;
  D.17225 = D.17224 + id;
  D.17226 = predef_counters[D.17225].type;
  sample->counterType = D.17226;
  switch (id) <default: <D.17235>, case 0: <D.16545>, case 1: <D.16546>, case 2: <D.16547>, case 3: <D.16548>, case 4: <D.16549>, case 5: <D.16550>, case 6: <D.16551>>
  <D.16545>:
  pid.19 = (void *) pid;
  D.17228 = mono_process_get_data (pid.19, 1);
  sample->rawValue = D.17228;
  D.17220 = 1;
  return D.17220;
  <D.16546>:
  pid.19 = (void *) pid;
  D.17229 = mono_process_get_data (pid.19, 2);
  sample->rawValue = D.17229;
  D.17220 = 1;
  return D.17220;
  <D.16547>:
  pid.19 = (void *) pid;
  D.17230 = mono_process_get_data (pid.19, 3);
  sample->rawValue = D.17230;
  D.17220 = 1;
  return D.17220;
  <D.16548>:
  pid.19 = (void *) pid;
  D.17231 = mono_process_get_data (pid.19, 0);
  sample->rawValue = D.17231;
  D.17220 = 1;
  return D.17220;
  <D.16549>:
  pid.19 = (void *) pid;
  D.17232 = mono_process_get_data (pid.19, 7);
  sample->rawValue = D.17232;
  D.17220 = 1;
  return D.17220;
  <D.16550>:
  pid.19 = (void *) pid;
  D.17233 = mono_process_get_data (pid.19, 4);
  sample->rawValue = D.17233;
  D.17220 = 1;
  return D.17220;
  <D.16551>:
  pid.19 = (void *) pid;
  D.17234 = mono_process_get_data (pid.19, 6);
  sample->rawValue = D.17234;
  D.17220 = 1;
  return D.17220;
  <D.17235>:
  D.17220 = 0;
  return D.17220;
}


mono_mem_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17239;
  void * D.17240;
  short int D.17241;
  int D.17242;
  void * D.17243;
  const struct CounterDesc * cdesc;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[2], counter);
  if (cdesc != 0B) goto <D.17237>; else goto <D.17238>;
  <D.17237>:
  D.17239 = cdesc->type;
  *type = D.17239;
  D.17241 = cdesc->id;
  D.17242 = (int) D.17241;
  D.17243 = (void *) D.17242;
  D.17240 = create_vtable (D.17243, mono_mem_counter, 0B);
  return D.17240;
  <D.17238>:
  D.17240 = 0B;
  return D.17240;
}


mono_mem_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17245;
  short int D.17248;
  int D.17249;
  int D.17250;
  int D.17251;
  long long unsigned int D.17252;
  long long int D.17253;
  MonoBoolean D.17254;
  long long unsigned int D.17255;
  long long int D.17256;
  int id;

  D.17245 = vtable->arg;
  id = (int) D.17245;
  if (only_value == 0) goto <D.17246>; else goto <D.17247>;
  <D.17246>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17247>:
  D.17248 = 12;
  D.17249 = (int) D.17248;
  D.17250 = D.17249 + id;
  D.17251 = predef_counters[D.17250].type;
  sample->counterType = D.17251;
  switch (id) <default: <D.17257>, case 0: <D.16566>, case 1: <D.16567>>
  <D.16566>:
  D.17252 = mono_stats.new_object_count;
  D.17253 = (long long int) D.17252;
  sample->rawValue = D.17253;
  D.17254 = 1;
  return D.17254;
  <D.16567>:
  D.17255 = mono_determine_physical_ram_size ();
  D.17256 = (long long int) D.17255;
  sample->rawValue = D.17256;
  D.17254 = 1;
  return D.17254;
  <D.17257>:
  D.17254 = 0;
  return D.17254;
}


mono_determine_physical_ram_size ()
{
  long int D.17259;
  long int D.17260;
  _Bool D.17261;
  _Bool D.17262;
  _Bool D.17263;
  guint64 D.17266;
  guint64 page_size;
  guint64 num_pages;

  page_size = 0;
  num_pages = 0;
  D.17259 = sysconf (30);
  page_size = (guint64) D.17259;
  D.17260 = sysconf (85);
  num_pages = (guint64) D.17260;
  D.17261 = page_size == 0;
  D.17262 = num_pages == 0;
  D.17263 = D.17261 | D.17262;
  if (D.17263 != 0) goto <D.17264>; else goto <D.17265>;
  <D.17264>:
  monoeg_g_log (0B, 16, "Your operating system\'s sysconf (3) function doesn\'t correctly report physical memory size!");
  D.17266 = 134217728;
  return D.17266;
  <D.17265>:
  D.17266 = page_size * num_pages;
  return D.17266;
}


network_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  short int D.17270;
  int D.17271;
  int D.17272;
  void * D.17273;
  const struct CounterDesc * cdesc;
  struct NetworkVtableArg * narg;
  struct ImplVtable * vtable;
  char * instance_name;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[13], counter);
  if (cdesc != 0B) goto <D.17268>; else goto <D.17269>;
  <D.17268>:
  instance_name = mono_string_to_utf8 (instance);
  narg = monoeg_malloc0 (8);
  D.17270 = cdesc->id;
  D.17271 = (int) D.17270;
  narg->id = D.17271;
  narg->name = instance_name;
  D.17272 = cdesc->type;
  *type = D.17272;
  vtable = create_vtable (narg, get_network_counter, 0B);
  vtable->cleanup = network_cleanup;
  D.17273 = vtable;
  return D.17273;
  <D.17269>:
  D.17273 = 0B;
  return D.17273;
}


network_cleanup (struct ImplVtable * vtable)
{
  char * D.17279;
  struct NetworkVtableArg * narg;

  if (vtable == 0B) goto <D.17275>; else goto <D.17276>;
  <D.17275>:
  return;
  <D.17276>:
  narg = vtable->arg;
  if (narg == 0B) goto <D.17277>; else goto <D.17278>;
  <D.17277>:
  return;
  <D.17278>:
  D.17279 = narg->name;
  monoeg_g_free (D.17279);
  narg->name = 0B;
  monoeg_g_free (narg);
  vtable->arg = 0B;
}


get_network_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  short int D.17283;
  int D.17284;
  int D.17285;
  int D.17286;
  int D.17287;
  char * D.17288;
  long long int D.17289;
  long long int D.17290;
  long long int D.17291;
  <unnamed type> error.20;
  MonoBoolean D.17296;
  MonoNetworkError error;
  struct NetworkVtableArg * narg;

  try
    {
      error = 2;
      narg = vtable->arg;
      if (only_value == 0) goto <D.17281>; else goto <D.17282>;
      <D.17281>:
      fill_sample (sample);
      <D.17282>:
      D.17283 = 93;
      D.17284 = (int) D.17283;
      D.17285 = narg->id;
      D.17286 = D.17284 + D.17285;
      D.17287 = predef_counters[D.17286].type;
      sample->counterType = D.17287;
      D.17285 = narg->id;
      switch (D.17285) <default: <D.17292>, case 0: <D.16520>, case 1: <D.16522>, case 2: <D.16523>>
      <D.16520>:
      D.17288 = narg->name;
      D.17289 = mono_network_get_data (D.17288, 0, &error);
      sample->rawValue = D.17289;
      goto <D.16521>;
      <D.16522>:
      D.17288 = narg->name;
      D.17290 = mono_network_get_data (D.17288, 1, &error);
      sample->rawValue = D.17290;
      goto <D.16521>;
      <D.16523>:
      D.17288 = narg->name;
      D.17291 = mono_network_get_data (D.17288, 2, &error);
      sample->rawValue = D.17291;
      goto <D.16521>;
      <D.17292>:
      <D.16521>:
      error.20 = error;
      if (error.20 == 0) goto <D.17294>; else goto <D.17295>;
      <D.17294>:
      D.17296 = 1;
      return D.17296;
      <D.17295>:
      D.17296 = 0;
      return D.17296;
    }
  finally
    {
      error = {CLOBBER};
    }
}


predef_writable_get_impl (int cat, struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  const struct CategoryDesc * D.17299;
  int D.17302;
  int D.17306;
  void * D.17307;
  short int D.17308;
  int D.17309;
  int D.17310;
  int D.17311;
  void * D.17312;
  const struct CounterDesc * cdesc;

  *custom = 1;
  D.17299 = &predef_categories[cat];
  cdesc = get_counter_in_category (D.17299, counter);
  if (cdesc != 0B) goto <D.17300>; else goto <D.17301>;
  <D.17300>:
  D.17302 = cdesc->type;
  *type = D.17302;
  if (instance == 0B) goto <D.17303>; else goto <D.17305>;
  <D.17305>:
  D.17306 = mono_string_compare_ascii (instance, "");
  if (D.17306 == 0) goto <D.17303>; else goto <D.17304>;
  <D.17303>:
  D.17308 = cdesc->id;
  D.17309 = (int) D.17308;
  D.17310 = D.17309 << 16;
  D.17311 = D.17310 | cat;
  D.17312 = (void *) D.17311;
  D.17307 = create_vtable (D.17312, predef_writable_counter, predef_writable_update);
  return D.17307;
  <D.17304>:
  D.17308 = cdesc->id;
  D.17309 = (int) D.17308;
  D.17310 = D.17309 << 16;
  D.17311 = D.17310 | cat;
  D.17312 = (void *) D.17311;
  D.17307 = predef_vtable (D.17312, instance);
  return D.17307;
  <D.17301>:
  D.17307 = 0B;
  return D.17307;
}


predef_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  void * D.17314;
  struct MonoPerfCounters * mono_perfcounters.21;
  guint32 * ptr.22;
  guint32 * ptr.23;
  guint64 * ptr64.24;
  guint64 * ptr64.25;
  guint * ptr.26;
  guint * ptr.27;
  guint32 * ptr.28;
  gint64 D.17332;
  guint32 * ptr.29;
  int D.17334;
  guint32 * ptr.30;
  int D.17338;
  guint32 * ptr.31;
  unsigned int D.17340;
  unsigned int D.17341;
  unsigned int D.17342;
  guint32 * ptr.32;
  unsigned int D.17344;
  guint32 * ptr.33;
  gint64 * ptr64.34;
  gint64 * ptr64.35;
  long long int D.17352;
  long long int D.17353;
  gint64 * ptr64.36;
  gint64 * ptr64.37;
  guint32 * volatile ptr;
  gint64 * volatile ptr64;
  int cat_id;
  int id;

  ptr = 0B;
  ptr64 = 0B;
  D.17314 = vtable->arg;
  cat_id = (int) D.17314;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  switch (cat_id) <default: <D.17324>, case 3: <D.16625>, case 12: <D.16630>>
  <D.16625>:
  switch (id) <default: <D.17318>, case 0: <D.16626>, case 1: <D.16628>>
  <D.16626>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.22 = &mono_perfcounters.21->aspnet_requests_queued;
  ptr = ptr.22;
  goto <D.16627>;
  <D.16628>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.23 = &mono_perfcounters.21->aspnet_requests;
  ptr = ptr.23;
  goto <D.16627>;
  <D.17318>:
  <D.16627>:
  goto <D.16629>;
  <D.16630>:
  switch (id) <default: <D.17323>, case 0: <D.16631>, case 2: <D.16633>, case 4: <D.16634>, case 5: <D.16635>>
  <D.16631>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr64.24 = &mono_perfcounters.21->threadpool_workitems;
  ptr64 = ptr64.24;
  goto <D.16632>;
  <D.16633>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr64.25 = &mono_perfcounters.21->threadpool_ioworkitems;
  ptr64 = ptr64.25;
  goto <D.16632>;
  <D.16634>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.26 = &mono_perfcounters.21->threadpool_threads;
  ptr = ptr.26;
  goto <D.16632>;
  <D.16635>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.27 = &mono_perfcounters.21->threadpool_iothreads;
  ptr = ptr.27;
  goto <D.16632>;
  <D.17323>:
  <D.16632>:
  goto <D.16629>;
  <D.17324>:
  <D.16629>:
  ptr.28 = ptr;
  if (ptr.28 != 0B) goto <D.17326>; else goto <D.17327>;
  <D.17326>:
  if (do_incr != 0) goto <D.17328>; else goto <D.17329>;
  <D.17328>:
  if (value == 1) goto <D.17330>; else goto <D.17331>;
  <D.17330>:
  ptr.29 = ptr;
  D.17334 = InterlockedIncrement (ptr.29);
  D.17332 = (gint64) D.17334;
  return D.17332;
  <D.17331>:
  if (value == -1) goto <D.17335>; else goto <D.17336>;
  <D.17335>:
  ptr.30 = ptr;
  D.17338 = InterlockedDecrement (ptr.30);
  D.17332 = (gint64) D.17338;
  return D.17332;
  <D.17336>:
  ptr.31 = ptr;
  D.17340 = *ptr.31;
  D.17341 = (unsigned int) value;
  D.17342 = D.17340 + D.17341;
  *ptr.31 = D.17342;
  ptr.32 = ptr;
  D.17344 = *ptr.32;
  D.17332 = (gint64) D.17344;
  return D.17332;
  <D.17329>:
  ptr.33 = ptr;
  D.17341 = (unsigned int) value;
  *ptr.33 = D.17341;
  D.17332 = value;
  return D.17332;
  <D.17327>:
  ptr64.34 = ptr64;
  if (ptr64.34 != 0B) goto <D.17347>; else goto <D.17348>;
  <D.17347>:
  if (do_incr != 0) goto <D.17349>; else goto <D.17350>;
  <D.17349>:
  ptr64.35 = ptr64;
  D.17352 = *ptr64.35;
  D.17353 = D.17352 + value;
  *ptr64.35 = D.17353;
  ptr64.36 = ptr64;
  D.17332 = *ptr64.36;
  return D.17332;
  <D.17350>:
  ptr64.37 = ptr64;
  *ptr64.37 = value;
  D.17332 = value;
  return D.17332;
  <D.17348>:
  D.17332 = 0;
  return D.17332;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.17357;
  unsigned int D.17358;

  D.17358 = __sync_add_and_fetch_4 (val, 1);
  D.17357 = (gint32) D.17358;
  return D.17357;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.17360;
  unsigned int D.17361;

  D.17361 = __sync_sub_and_fetch_4 (val, 1);
  D.17360 = (gint32) D.17361;
  return D.17360;
}


predef_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17363;
  short int D.17366;
  int D.17367;
  int D.17368;
  int D.17369;
  struct MonoPerfCounters * mono_perfcounters.38;
  unsigned int D.17371;
  long long int D.17372;
  MonoBoolean D.17373;
  unsigned int D.17375;
  long long int D.17376;
  unsigned int D.17377;
  long long int D.17378;
  long long unsigned int D.17380;
  long long int D.17381;
  long long unsigned int D.17382;
  long long int D.17383;
  unsigned int D.17384;
  long long int D.17385;
  unsigned int D.17386;
  long long int D.17387;
  unsigned int D.17389;
  long long int D.17390;
  unsigned int D.17391;
  long long int D.17392;
  unsigned int D.17393;
  long long int D.17394;
  unsigned int D.17395;
  long long int D.17396;
  int cat_id;
  int id;

  D.17363 = vtable->arg;
  cat_id = (int) D.17363;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17364>; else goto <D.17365>;
  <D.17364>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17365>:
  D.17366 = predef_categories[cat_id].first_counter;
  D.17367 = (int) D.17366;
  D.17368 = D.17367 + id;
  D.17369 = predef_counters[D.17368].type;
  sample->counterType = D.17369;
  switch (cat_id) <default: <D.17398>, case 3: <D.16602>, case 4: <D.16610>, case 5: <D.16599>, case 12: <D.16605>>
  <D.16599>:
  switch (id) <default: <D.17374>, case 0: <D.16600>>
  <D.16600>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17371 = mono_perfcounters.38->exceptions_thrown;
  D.17372 = (long long int) D.17371;
  sample->rawValue = D.17372;
  D.17373 = 1;
  return D.17373;
  <D.17374>:
  goto <D.16601>;
  <D.16602>:
  switch (id) <default: <D.17379>, case 0: <D.16603>, case 1: <D.16604>>
  <D.16603>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17375 = mono_perfcounters.38->aspnet_requests_queued;
  D.17376 = (long long int) D.17375;
  sample->rawValue = D.17376;
  D.17373 = 1;
  return D.17373;
  <D.16604>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17377 = mono_perfcounters.38->aspnet_requests;
  D.17378 = (long long int) D.17377;
  sample->rawValue = D.17378;
  D.17373 = 1;
  return D.17373;
  <D.17379>:
  goto <D.16601>;
  <D.16605>:
  switch (id) <default: <D.17388>, case 0: <D.16606>, case 2: <D.16607>, case 4: <D.16608>, case 5: <D.16609>>
  <D.16606>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17380 = mono_perfcounters.38->threadpool_workitems;
  D.17381 = (long long int) D.17380;
  sample->rawValue = D.17381;
  D.17373 = 1;
  return D.17373;
  <D.16607>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17382 = mono_perfcounters.38->threadpool_ioworkitems;
  D.17383 = (long long int) D.17382;
  sample->rawValue = D.17383;
  D.17373 = 1;
  return D.17373;
  <D.16608>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17384 = mono_perfcounters.38->threadpool_threads;
  D.17385 = (long long int) D.17384;
  sample->rawValue = D.17385;
  D.17373 = 1;
  return D.17373;
  <D.16609>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17386 = mono_perfcounters.38->threadpool_iothreads;
  D.17387 = (long long int) D.17386;
  sample->rawValue = D.17387;
  D.17373 = 1;
  return D.17373;
  <D.17388>:
  goto <D.16601>;
  <D.16610>:
  switch (id) <default: <D.17397>, case 0: <D.16611>, case 1: <D.16612>, case 2: <D.16613>, case 3: <D.16614>, case 4: <D.16615>>
  <D.16611>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17389 = mono_perfcounters.38->jit_bytes;
  D.17390 = (long long int) D.17389;
  sample->rawValue = D.17390;
  D.17373 = 1;
  return D.17373;
  <D.16612>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17391 = mono_perfcounters.38->jit_methods;
  D.17392 = (long long int) D.17391;
  sample->rawValue = D.17392;
  D.17373 = 1;
  return D.17373;
  <D.16613>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17393 = mono_perfcounters.38->jit_time;
  D.17394 = (long long int) D.17393;
  sample->rawValue = D.17394;
  D.17373 = 1;
  return D.17373;
  <D.16614>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17389 = mono_perfcounters.38->jit_bytes;
  D.17390 = (long long int) D.17389;
  sample->rawValue = D.17390;
  D.17373 = 1;
  return D.17373;
  <D.16615>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17395 = mono_perfcounters.38->jit_failures;
  D.17396 = (long long int) D.17395;
  sample->rawValue = D.17396;
  D.17373 = 1;
  return D.17373;
  <D.17397>:
  goto <D.16601>;
  <D.17398>:
  <D.16601>:
  D.17373 = 0;
  return D.17373;
}


predef_vtable (void * arg, struct MonoString * instance)
{
  struct ImplVtable * D.17402;
  short unsigned int D.17403;
  sizetype D.17404;
  struct MonoPerfCounters * D.17405;
  struct MonoSharedArea * area;
  struct PredefVtable * vtable;
  char * pids;
  int pid;

  pids = mono_string_to_utf8 (instance);
  pid = atoi (pids);
  monoeg_g_free (pids);
  area = load_sarea_for_pid (pid);
  if (area == 0B) goto <D.17400>; else goto <D.17401>;
  <D.17400>:
  D.17402 = 0B;
  return D.17402;
  <D.17401>:
  vtable = monoeg_malloc (24);
  vtable->vtable.arg = arg;
  vtable->vtable.sample = predef_readonly_counter;
  vtable->vtable.cleanup = predef_cleanup;
  D.17403 = area->counters_start;
  D.17404 = (sizetype) D.17403;
  D.17405 = area + D.17404;
  vtable->counters = D.17405;
  vtable->pid = pid;
  D.17402 = vtable;
  return D.17402;
}


predef_cleanup (struct ImplVtable * vtable)
{
  _Bool D.17409;
  long int D.17410;
  long int D.17411;
  struct GHashTable * pid_to_shared_area.39;
  _Bool D.17419;
  long int D.17420;
  long int D.17421;
  int D.17424;
  _Bool D.17427;
  long int D.17428;
  long int D.17429;
  struct PredefVtable * vt;

  vt = vtable;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17407>; else goto <D.17408>;
    <D.17407>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17408>:
    D.17409 = ret != 0;
    D.17410 = (long int) D.17409;
    D.17411 = __builtin_expect (D.17410, 0);
    if (D.17411 != 0) goto <D.17412>; else goto <D.17413>;
    <D.17412>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 389, "ret == 0");
    <D.17413>:
  }
  pid_to_shared_area.39 = pid_to_shared_area;
  if (pid_to_shared_area.39 == 0B) goto <D.17415>; else goto <D.17416>;
  <D.17415>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17417>; else goto <D.17418>;
    <D.17417>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17418>:
    D.17419 = ret != 0;
    D.17420 = (long int) D.17419;
    D.17421 = __builtin_expect (D.17420, 0);
    if (D.17421 != 0) goto <D.17422>; else goto <D.17423>;
    <D.17422>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 391, "ret == 0");
    <D.17423>:
  }
  return;
  <D.17416>:
  D.17424 = vt->pid;
  unref_pid_unlocked (D.17424);
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17425>; else goto <D.17426>;
    <D.17425>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17426>:
    D.17427 = ret != 0;
    D.17428 = (long int) D.17427;
    D.17429 = __builtin_expect (D.17428, 0);
    if (D.17429 != 0) goto <D.17430>; else goto <D.17431>;
    <D.17430>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 395, "ret == 0");
    <D.17431>:
  }
}


unref_pid_unlocked (int pid)
{
  const void * pid.40;
  struct GHashTable * pid_to_shared_area.41;
  int D.17437;
  int D.17438;
  void * D.17441;
  struct ExternalSArea * data;

  pid.40 = (const void *) pid;
  pid_to_shared_area.41 = pid_to_shared_area;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.41, pid.40);
  if (data != 0B) goto <D.17435>; else goto <D.17436>;
  <D.17435>:
  D.17437 = data->refcount;
  D.17438 = D.17437 + -1;
  data->refcount = D.17438;
  D.17437 = data->refcount;
  if (D.17437 == 0) goto <D.17439>; else goto <D.17440>;
  <D.17439>:
  pid.40 = (const void *) pid;
  pid_to_shared_area.41 = pid_to_shared_area;
  monoeg_g_hash_table_remove (pid_to_shared_area.41, pid.40);
  D.17441 = data->sarea;
  mono_shared_area_unload (D.17441);
  monoeg_g_free (data);
  <D.17440>:
  <D.17436>:
}


predef_readonly_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17442;
  short int D.17445;
  int D.17446;
  int D.17447;
  int D.17448;
  struct MonoPerfCounters * D.17449;
  short unsigned int D.17450;
  sizetype D.17451;
  guint32 * D.17452;
  unsigned int D.17453;
  long long int D.17454;
  MonoBoolean D.17455;
  struct PredefVtable * vt;
  const struct CounterDesc * desc;
  int cat_id;
  int id;

  vt = vtable;
  D.17442 = vtable->arg;
  cat_id = (int) D.17442;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17443>; else goto <D.17444>;
  <D.17443>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17444>:
  D.17445 = predef_categories[cat_id].first_counter;
  D.17446 = (int) D.17445;
  D.17447 = D.17446 + id;
  desc = &predef_counters[D.17447];
  D.17448 = desc->type;
  sample->counterType = D.17448;
  D.17449 = vt->counters;
  D.17450 = desc->offset;
  D.17451 = (sizetype) D.17450;
  D.17452 = D.17449 + D.17451;
  D.17453 = *D.17452;
  D.17454 = (long long int) D.17453;
  sample->rawValue = D.17454;
  D.17455 = 1;
  return D.17455;
}


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

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


load_sarea_for_pid (int pid)
{
  _Bool D.17461;
  long int D.17462;
  long int D.17463;
  struct GHashTable * pid_to_shared_area.42;
  struct GHashTable * pid_to_shared_area.43;
  const void * pid.44;
  void * pid.45;
  int D.17477;
  int D.17478;
  _Bool D.17481;
  long int D.17482;
  long int D.17483;
  struct MonoSharedArea * D.17486;
  struct ExternalSArea * data;
  struct MonoSharedArea * area;

  area = 0B;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17459>; else goto <D.17460>;
    <D.17459>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17460>:
    D.17461 = ret != 0;
    D.17462 = (long int) D.17461;
    D.17463 = __builtin_expect (D.17462, 0);
    if (D.17463 != 0) goto <D.17464>; else goto <D.17465>;
    <D.17464>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 348, "ret == 0");
    <D.17465>:
  }
  pid_to_shared_area.42 = pid_to_shared_area;
  if (pid_to_shared_area.42 == 0B) goto <D.17467>; else goto <D.17468>;
  <D.17467>:
  pid_to_shared_area.43 = monoeg_g_hash_table_new (0B, 0B);
  pid_to_shared_area = pid_to_shared_area.43;
  <D.17468>:
  pid.44 = (const void *) pid;
  pid_to_shared_area.42 = pid_to_shared_area;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.42, pid.44);
  if (data == 0B) goto <D.17471>; else goto <D.17472>;
  <D.17471>:
  pid.45 = (void *) pid;
  area = mono_shared_area_for_pid (pid.45);
  if (area != 0B) goto <D.17474>; else goto <D.17475>;
  <D.17474>:
  data = monoeg_malloc (8);
  data->sarea = area;
  data->refcount = 1;
  pid.45 = (void *) pid;
  pid_to_shared_area.42 = pid_to_shared_area;
  monoeg_g_hash_table_insert_replace (pid_to_shared_area.42, pid.45, data, 0);
  <D.17475>:
  goto <D.17476>;
  <D.17472>:
  area = data->sarea;
  D.17477 = data->refcount;
  D.17478 = D.17477 + 1;
  data->refcount = D.17478;
  <D.17476>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17479>; else goto <D.17480>;
    <D.17479>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17480>:
    D.17481 = ret != 0;
    D.17482 = (long int) D.17481;
    D.17483 = __builtin_expect (D.17482, 0);
    if (D.17483 != 0) goto <D.17484>; else goto <D.17485>;
    <D.17484>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 364, "ret == 0");
    <D.17485>:
  }
  D.17486 = area;
  return D.17486;
}


mono_perfcounter_get_sample (void * impl, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  MonoBoolean (*<T2ad2>) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) D.17490;
  MonoBoolean D.17493;
  int D.17494;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17488>; else goto <D.17489>;
  <D.17488>:
  D.17490 = vtable->sample;
  if (D.17490 != 0B) goto <D.17491>; else goto <D.17492>;
  <D.17491>:
  D.17490 = vtable->sample;
  D.17494 = (int) only_value;
  D.17493 = D.17490 (vtable, D.17494, sample);
  return D.17493;
  <D.17492>:
  <D.17489>:
  D.17493 = 0;
  return D.17493;
}


mono_perfcounter_update_value (void * impl, MonoBoolean do_incr, gint64 value)
{
  gint64 (*<T2ad7>) (struct ImplVtable *, MonoBoolean, gint64) D.17498;
  gint64 D.17501;
  int D.17502;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17496>; else goto <D.17497>;
  <D.17496>:
  D.17498 = vtable->update;
  if (D.17498 != 0B) goto <D.17499>; else goto <D.17500>;
  <D.17499>:
  D.17498 = vtable->update;
  D.17502 = (int) do_incr;
  D.17501 = D.17498 (vtable, D.17502, value);
  return D.17501;
  <D.17500>:
  <D.17497>:
  D.17501 = 0;
  return D.17501;
}


mono_perfcounter_free_data (void * impl)
{
  void (*<T2adc>) (struct ImplVtable *) D.17506;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17504>; else goto <D.17505>;
  <D.17504>:
  D.17506 = vtable->cleanup;
  if (D.17506 != 0B) goto <D.17507>; else goto <D.17508>;
  <D.17507>:
  D.17506 = vtable->cleanup;
  D.17506 (vtable);
  <D.17508>:
  <D.17505>:
  monoeg_g_free (impl);
}


mono_perfcounter_category_del (struct MonoString * name)
{
  MonoBoolean D.17511;
  _Bool D.17514;
  long int D.17515;
  long int D.17516;
  int D.17522;
  _Bool D.17525;
  long int D.17526;
  long int D.17527;
  _Bool D.17532;
  long int D.17533;
  long int D.17534;
  const struct CategoryDesc * cdesc;
  struct SharedCategory * cat;

  cdesc = find_category (name);
  if (cdesc != 0B) goto <D.17509>; else goto <D.17510>;
  <D.17509>:
  D.17511 = 0;
  return D.17511;
  <D.17510>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17512>; else goto <D.17513>;
    <D.17512>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17513>:
    D.17514 = ret != 0;
    D.17515 = (long int) D.17514;
    D.17516 = __builtin_expect (D.17515, 0);
    if (D.17516 != 0) goto <D.17517>; else goto <D.17518>;
    <D.17517>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1304, "ret == 0");
    <D.17518>:
  }
  cat = find_custom_category (name);
  if (cat == 0B) goto <D.17519>; else goto <D.17521>;
  <D.17521>:
  D.17522 = cat->num_instances;
  if (D.17522 != 0) goto <D.17519>; else goto <D.17520>;
  <D.17519>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17523>; else goto <D.17524>;
    <D.17523>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17524>:
    D.17525 = ret != 0;
    D.17526 = (long int) D.17525;
    D.17527 = __builtin_expect (D.17526, 0);
    if (D.17527 != 0) goto <D.17528>; else goto <D.17529>;
    <D.17528>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1308, "ret == 0");
    <D.17529>:
  }
  D.17511 = 0;
  return D.17511;
  <D.17520>:
  cat->header.ftype = 68;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17530>; else goto <D.17531>;
    <D.17530>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17531>:
    D.17532 = ret != 0;
    D.17533 = (long int) D.17532;
    D.17534 = __builtin_expect (D.17533, 0);
    if (D.17534 != 0) goto <D.17535>; else goto <D.17536>;
    <D.17535>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1312, "ret == 0");
    <D.17536>:
  }
  D.17511 = 1;
  return D.17511;
}


mono_perfcounter_category_help (struct MonoString * category, struct MonoString * machine)
{
  int D.17538;
  struct MonoString * D.17541;
  char * D.17546;
  struct MonoDomain * D.17547;
  const char * D.17548;
  struct MonoDomain * D.17549;
  const struct CategoryDesc * cdesc;

  D.17538 = mono_string_compare_ascii (machine, ".");
  if (D.17538 != 0) goto <D.17539>; else goto <D.17540>;
  <D.17539>:
  D.17541 = 0B;
  return D.17541;
  <D.17540>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17542>; else goto <D.17543>;
  <D.17542>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17544>; else goto <D.17545>;
    <D.17544>:
    D.17541 = 0B;
    return D.17541;
    <D.17545>:
    D.17546 = custom_category_help (scat);
    D.17547 = mono_domain_get ();
    D.17541 = mono_string_new (D.17547, D.17546);
    return D.17541;
  }
  <D.17543>:
  D.17548 = cdesc->help;
  D.17549 = mono_domain_get ();
  D.17541 = mono_string_new (D.17549, D.17548);
  return D.17541;
}


custom_category_help (struct SharedCategory * cat)
{
  char * D.17551;
  char[1] * D.17552;
  unsigned int D.17553;
  sizetype D.17554;

  D.17552 = &cat->name;
  D.17553 = strlen (D.17552);
  D.17554 = D.17553 + 1;
  D.17551 = &cat->name[D.17554];
  return D.17551;
}


mono_perfcounter_category_exists (struct MonoString * counter, struct MonoString * category, struct MonoString * machine)
{
  int D.17556;
  MonoBoolean D.17559;
  struct SharedCounter * D.17566;
  _Bool D.17567;
  const struct CounterDesc * D.17570;
  const struct CategoryDesc * cdesc;

  D.17556 = mono_string_compare_ascii (machine, ".");
  if (D.17556 != 0) goto <D.17557>; else goto <D.17558>;
  <D.17557>:
  D.17559 = 0;
  return D.17559;
  <D.17558>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17560>; else goto <D.17561>;
  <D.17560>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17562>; else goto <D.17563>;
    <D.17562>:
    D.17559 = 0;
    return D.17559;
    <D.17563>:
    if (counter == 0B) goto <D.17564>; else goto <D.17565>;
    <D.17564>:
    D.17559 = 1;
    return D.17559;
    <D.17565>:
    D.17566 = find_custom_counter (scat, counter);
    D.17567 = D.17566 != 0B;
    D.17559 = (MonoBoolean) D.17567;
    return D.17559;
  }
  <D.17561>:
  if (counter == 0B) goto <D.17568>; else goto <D.17569>;
  <D.17568>:
  D.17559 = 1;
  return D.17559;
  <D.17569>:
  D.17570 = get_counter_in_category (cdesc, counter);
  if (D.17570 != 0B) goto <D.17571>; else goto <D.17572>;
  <D.17571>:
  D.17559 = 1;
  return D.17559;
  <D.17572>:
  D.17559 = 0;
  return D.17559;
}


mono_perfcounter_create (struct MonoString * category, struct MonoString * help, int type, struct MonoArray * items)
{
  unsigned int D.17574;
  int D.17575;
  int D.17577;
  unsigned int num_counters.46;
  unsigned int D.17580;
  unsigned int D.17581;
  unsigned int D.17582;
  unsigned int D.17583;
  unsigned int D.17584;
  unsigned int i.47;
  char * D.17586;
  unsigned int i.48;
  unsigned int D.17588;
  char * * D.17589;
  struct MonoString * D.17590;
  char * D.17591;
  int D.17592;
  sizetype i.49;
  sizetype D.17595;
  sizetype D.17596;
  char * * D.17597;
  struct MonoString * D.17598;
  char * D.17599;
  int D.17600;
  unsigned int size.50;
  unsigned int D.17603;
  unsigned int D.17604;
  char * * D.17605;
  char * D.17606;
  unsigned int D.17608;
  unsigned int size.51;
  unsigned int D.17610;
  unsigned int D.17611;
  int D.17612;
  _Bool D.17616;
  long int D.17617;
  long int D.17618;
  _Bool D.17625;
  long int D.17626;
  long int D.17627;
  unsigned char D.17630;
  short unsigned int D.17631;
  short unsigned int D.17632;
  short unsigned int D.17633;
  unsigned int D.17634;
  sizetype D.17635;
  unsigned int D.17636;
  sizetype D.17637;
  char * D.17638;
  char * p.52;
  int D.17640;
  int D.17641;
  char D.17642;
  char * p.53;
  char D.17644;
  char * D.17645;
  unsigned int D.17646;
  sizetype D.17647;
  char * D.17648;
  unsigned int D.17649;
  sizetype D.17650;
  _Bool D.17653;
  long int D.17654;
  long int D.17655;
  MonoBoolean D.17660;
  struct MonoError error;
  int result;
  int i;
  int size;
  int num_counters;
  int counters_data_size;
  char * name;
  char * chelp;
  char * * counter_info;
  unsigned char * ptr;
  char * p;
  struct SharedCategory * cat;
  void failure = <<< error >>>;

  try
    {
      result = 0;
      D.17574 = mono_array_length (items);
      num_counters = (int) D.17574;
      name = 0B;
      chelp = 0B;
      counter_info = 0B;
      mono_error_init (&error);
      name = mono_string_to_utf8_checked (category, &error);
      D.17575 = mono_error_ok (&error);
      if (D.17575 == 0) goto failure; else goto <D.17576>;
      <D.17576>:
      chelp = mono_string_to_utf8_checked (help, &error);
      D.17577 = mono_error_ok (&error);
      if (D.17577 == 0) goto failure; else goto <D.17578>;
      <D.17578>:
      num_counters.46 = (unsigned int) num_counters;
      D.17580 = num_counters.46 * 8;
      counter_info = monoeg_malloc0 (D.17580);
      D.17581 = strlen (name);
      D.17582 = strlen (chelp);
      D.17583 = D.17581 + D.17582;
      D.17584 = D.17583 + 14;
      size = (int) D.17584;
      i = 0;
      goto <D.16780>;
      <D.16779>:
      {
        struct CounterCreationData * data;

        i.47 = (unsigned int) i;
        D.17586 = mono_array_addr_with_size (items, 4, i.47);
        data = MEM[(struct CounterCreationData * *)D.17586];
        i.48 = (unsigned int) i;
        D.17588 = i.48 * 8;
        D.17589 = counter_info + D.17588;
        D.17590 = data->name;
        D.17591 = mono_string_to_utf8_checked (D.17590, &error);
        *D.17589 = D.17591;
        D.17592 = mono_error_ok (&error);
        if (D.17592 == 0) goto failure; else goto <D.17593>;
        <D.17593>:
        i.49 = (sizetype) i;
        D.17595 = i.49 * 8;
        D.17596 = D.17595 + 4;
        D.17597 = counter_info + D.17596;
        D.17598 = data->help;
        D.17599 = mono_string_to_utf8_checked (D.17598, &error);
        *D.17597 = D.17599;
        D.17600 = mono_error_ok (&error);
        if (D.17600 == 0) goto failure; else goto <D.17601>;
        <D.17601>:
        size.50 = (unsigned int) size;
        D.17603 = size.50 + 4;
        size = (int) D.17603;
      }
      i = i + 1;
      <D.16780>:
      if (i < num_counters) goto <D.16779>; else goto <D.16781>;
      <D.16781>:
      i = 0;
      goto <D.16783>;
      <D.16782>:
      i.48 = (unsigned int) i;
      D.17604 = i.48 * 4;
      D.17605 = counter_info + D.17604;
      D.17606 = *D.17605;
      if (D.17606 == 0B) goto failure; else goto <D.17607>;
      <D.17607>:
      i.48 = (unsigned int) i;
      D.17604 = i.48 * 4;
      D.17605 = counter_info + D.17604;
      D.17606 = *D.17605;
      D.17608 = strlen (D.17606);
      size.51 = (unsigned int) size;
      D.17610 = D.17608 + size.51;
      D.17611 = D.17610 + 1;
      size = (int) D.17611;
      i = i + 1;
      <D.16783>:
      D.17612 = num_counters * 2;
      if (D.17612 > i) goto <D.16782>; else goto <D.16784>;
      <D.16784>:
      size = size + 7;
      size = size & -8;
      counters_data_size = num_counters * 8;
      if (size > 65535) goto failure; else goto <D.17613>;
      <D.17613>:
      {
        int ret;

        ret = pthread_mutex_lock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17614>; else goto <D.17615>;
        <D.17614>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.17615>:
        D.17616 = ret != 0;
        D.17617 = (long int) D.17616;
        D.17618 = __builtin_expect (D.17617, 0);
        if (D.17618 != 0) goto <D.17619>; else goto <D.17620>;
        <D.17619>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1421, "ret == 0");
        <D.17620>:
      }
      ptr = shared_data_find_room (size);
      if (ptr == 0B) goto <D.17621>; else goto <D.17622>;
      <D.17621>:
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17623>; else goto <D.17624>;
        <D.17623>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.17624>:
        D.17625 = ret != 0;
        D.17626 = (long int) D.17625;
        D.17627 = __builtin_expect (D.17626, 0);
        if (D.17627 != 0) goto <D.17628>; else goto <D.17629>;
        <D.17628>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1424, "ret == 0");
        <D.17629>:
      }
      goto failure;
      <D.17622>:
      cat = ptr;
      D.17630 = (unsigned char) type;
      cat->header.extra = D.17630;
      D.17631 = (short unsigned int) size;
      cat->header.size = D.17631;
      D.17632 = (short unsigned int) num_counters;
      cat->num_counters = D.17632;
      D.17633 = (short unsigned int) counters_data_size;
      cat->counters_data_size = D.17633;
      p = &cat->name;
      strcpy (p, name);
      D.17634 = strlen (name);
      D.17635 = D.17634 + 1;
      p = p + D.17635;
      strcpy (p, chelp);
      D.17636 = strlen (chelp);
      D.17637 = D.17636 + 1;
      p = p + D.17637;
      i = 0;
      goto <D.16789>;
      <D.16788>:
      {
        struct CounterCreationData * data;

        i.47 = (unsigned int) i;
        D.17638 = mono_array_addr_with_size (items, 4, i.47);
        data = MEM[(struct CounterCreationData * *)D.17638];
        p.52 = p;
        p = p.52 + 1;
        D.17640 = data->type;
        D.17641 = perfctr_type_compress (D.17640);
        D.17642 = (char) D.17641;
        *p.52 = D.17642;
        p.53 = p;
        p = p.53 + 1;
        D.17644 = (char) i;
        *p.53 = D.17644;
        i.48 = (unsigned int) i;
        D.17588 = i.48 * 8;
        D.17589 = counter_info + D.17588;
        D.17645 = *D.17589;
        strcpy (p, D.17645);
        i.48 = (unsigned int) i;
        D.17588 = i.48 * 8;
        D.17589 = counter_info + D.17588;
        D.17645 = *D.17589;
        D.17646 = strlen (D.17645);
        D.17647 = D.17646 + 1;
        p = p + D.17647;
        i.49 = (sizetype) i;
        D.17595 = i.49 * 8;
        D.17596 = D.17595 + 4;
        D.17597 = counter_info + D.17596;
        D.17648 = *D.17597;
        strcpy (p, D.17648);
        i.49 = (sizetype) i;
        D.17595 = i.49 * 8;
        D.17596 = D.17595 + 4;
        D.17597 = counter_info + D.17596;
        D.17648 = *D.17597;
        D.17649 = strlen (D.17648);
        D.17650 = D.17649 + 1;
        p = p + D.17650;
      }
      i = i + 1;
      <D.16789>:
      if (i < num_counters) goto <D.16788>; else goto <D.16790>;
      <D.16790>:
      cat->header.ftype = 67;
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17651>; else goto <D.17652>;
        <D.17651>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.17652>:
        D.17653 = ret != 0;
        D.17654 = (long int) D.17653;
        D.17655 = __builtin_expect (D.17654, 0);
        if (D.17655 != 0) goto <D.17656>; else goto <D.17657>;
        <D.17656>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1450, "ret == 0");
        <D.17657>:
      }
      result = 1;
      failure:
      if (counter_info != 0B) goto <D.17658>; else goto <D.17659>;
      <D.17658>:
      i = 0;
      goto <D.16793>;
      <D.16792>:
      i.48 = (unsigned int) i;
      D.17604 = i.48 * 4;
      D.17605 = counter_info + D.17604;
      D.17606 = *D.17605;
      monoeg_g_free (D.17606);
      i = i + 1;
      <D.16793>:
      D.17612 = num_counters * 2;
      if (D.17612 > i) goto <D.16792>; else goto <D.16794>;
      <D.16794>:
      monoeg_g_free (counter_info);
      <D.17659>:
      monoeg_g_free (name);
      monoeg_g_free (chelp);
      mono_error_cleanup (&error);
      D.17660 = (MonoBoolean) result;
      return D.17660;
    }
  finally
    {
      error = {CLOBBER};
    }
}


perfctr_type_compress (int type)
{
  int D.17663;
  int D.17666;
  unsigned int i.54;
  int i;

  i = 0;
  goto <D.16373>;
  <D.16372>:
  D.17663 = simple_type_to_type[i];
  if (D.17663 == type) goto <D.17664>; else goto <D.17665>;
  <D.17664>:
  D.17666 = i;
  return D.17666;
  <D.17665>:
  i = i + 1;
  <D.16373>:
  i.54 = (unsigned int) i;
  if (i.54 <= 27) goto <D.16372>; else goto <D.16374>;
  <D.16374>:
  D.17666 = 2;
  return D.17666;
}


mono_perfcounter_instance_exists (struct MonoString * instance, struct MonoString * category, struct MonoString * machine)
{
  int D.17673;
  struct SharedInstance * D.17674;
  const struct CategoryDesc * cdesc;

  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17669>; else goto <D.17670>;
  <D.17669>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17671>; else goto <D.17672>;
    <D.17671>:
    D.17673 = 0;
    return D.17673;
    <D.17672>:
    D.17674 = find_custom_instance (scat, instance);
    if (D.17674 != 0B) goto <D.17675>; else goto <D.17676>;
    <D.17675>:
    D.17673 = 1;
    return D.17673;
    <D.17676>:
  }
  goto <D.17677>;
  <D.17670>:
  <D.17677>:
  D.17673 = 0;
  return D.17673;
}


mono_perfcounter_category_names (struct MonoString * machine)
{
  int D.17679;
  struct MonoArray * D.17682;
  struct MonoClass * D.17683;
  _Bool D.17686;
  long int D.17687;
  long int D.17688;
  unsigned int D.17691;
  unsigned int D.17692;
  struct MonoClass * D.17693;
  unsigned int i.55;
  const char * D.17695;
  struct MonoString * D.17696;
  char[1] * D.17697;
  struct MonoString * D.17698;
  _Bool D.17701;
  long int D.17702;
  long int D.17703;
  int i;
  struct MonoArray * res;
  struct MonoDomain * domain;
  struct GSList * custom_categories;
  struct GSList * tmp;

  domain = mono_domain_get ();
  D.17679 = mono_string_compare_ascii (machine, ".");
  if (D.17679 != 0) goto <D.17680>; else goto <D.17681>;
  <D.17680>:
  D.17683 = mono_get_string_class ();
  D.17682 = mono_array_new (domain, D.17683, 0);
  return D.17682;
  <D.17681>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17684>; else goto <D.17685>;
    <D.17684>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17685>:
    D.17686 = ret != 0;
    D.17687 = (long int) D.17686;
    D.17688 = __builtin_expect (D.17687, 0);
    if (D.17688 != 0) goto <D.17689>; else goto <D.17690>;
    <D.17689>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1497, "ret == 0");
    <D.17690>:
  }
  custom_categories = get_custom_categories ();
  D.17691 = monoeg_g_slist_length (custom_categories);
  D.17692 = D.17691 + 14;
  D.17693 = mono_get_string_class ();
  res = mono_array_new (domain, D.17693, D.17692);
  i = 0;
  goto <D.16814>;
  <D.16813>:
  {
    const struct CategoryDesc * cdesc;

    cdesc = &predef_categories[i];
    {
      void * * __p;

      i.55 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.55);
      D.17695 = cdesc->name;
      D.17696 = mono_string_new (domain, D.17695);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17696);
    }
  }
  i = i + 1;
  <D.16814>:
  if (i <= 13) goto <D.16813>; else goto <D.16815>;
  <D.16815>:
  tmp = custom_categories;
  goto <D.16819>;
  <D.16818>:
  {
    struct SharedCategory * scat;

    scat = tmp->data;
    {
      void * * __p;

      i.55 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.55);
      D.17697 = &scat->name;
      D.17698 = mono_string_new (domain, D.17697);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17698);
    }
    i = i + 1;
  }
  tmp = tmp->next;
  <D.16819>:
  if (tmp != 0B) goto <D.16818>; else goto <D.16820>;
  <D.16820>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17699>; else goto <D.17700>;
    <D.17699>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17700>:
    D.17701 = ret != 0;
    D.17702 = (long int) D.17701;
    D.17703 = __builtin_expect (D.17702, 0);
    if (D.17703 != 0) goto <D.17704>; else goto <D.17705>;
    <D.17704>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1509, "ret == 0");
    <D.17705>:
  }
  monoeg_g_slist_free (custom_categories);
  D.17682 = res;
  return D.17682;
}


get_custom_categories ()
{
  struct GSList * D.17707;
  struct GSList * list;

  try
    {
      list = 0B;
      foreach_shared_item (category_collect, &list);
      D.17707 = list;
      return D.17707;
    }
  finally
    {
      list = {CLOBBER};
    }
}


category_collect (struct SharedHeader * header, void * data)
{
  unsigned char D.17710;
  struct GSList * D.17713;
  struct GSList * D.17714;
  gboolean D.17715;
  struct GSList * * list;

  list = data;
  D.17710 = header->ftype;
  if (D.17710 == 67) goto <D.17711>; else goto <D.17712>;
  <D.17711>:
  D.17713 = *list;
  D.17714 = monoeg_g_slist_prepend (D.17713, header);
  *list = D.17714;
  <D.17712>:
  D.17715 = 1;
  return D.17715;
}


mono_perfcounter_counter_names (struct MonoString * category, struct MonoString * machine)
{
  int D.17717;
  struct MonoArray * D.17720;
  struct MonoClass * D.17721;
  const struct CategoryDesc * D.17724;
  short int D.17725;
  int D.17726;
  short int D.17727;
  int D.17728;
  int D.17729;
  unsigned int D.17730;
  struct MonoClass * D.17731;
  int D.17732;
  unsigned int D.17733;
  const char * D.17734;
  struct MonoString * D.17735;
  _Bool D.17738;
  long int D.17739;
  long int D.17740;
  short unsigned int D.17745;
  unsigned int D.17746;
  struct MonoClass * D.17747;
  unsigned int i.56;
  const char * D.17749;
  struct MonoString * D.17750;
  unsigned int D.17751;
  sizetype D.17752;
  unsigned int D.17753;
  sizetype D.17754;
  int D.17755;
  _Bool D.17758;
  long int D.17759;
  long int D.17760;
  _Bool D.17765;
  long int D.17766;
  long int D.17767;
  struct MonoClass * D.17770;
  int i;
  struct SharedCategory * scat;
  const struct CategoryDesc * cdesc;
  struct MonoArray * res;
  struct MonoDomain * domain;

  domain = mono_domain_get ();
  D.17717 = mono_string_compare_ascii (machine, ".");
  if (D.17717 != 0) goto <D.17718>; else goto <D.17719>;
  <D.17718>:
  D.17721 = mono_get_string_class ();
  D.17720 = mono_array_new (domain, D.17721, 0);
  return D.17720;
  <D.17719>:
  cdesc = find_category (category);
  if (cdesc != 0B) goto <D.17722>; else goto <D.17723>;
  <D.17722>:
  D.17724 = cdesc + 12;
  D.17725 = D.17724->first_counter;
  D.17726 = (int) D.17725;
  D.17727 = cdesc->first_counter;
  D.17728 = (int) D.17727;
  D.17729 = D.17726 - D.17728;
  D.17730 = (unsigned int) D.17729;
  D.17731 = mono_get_string_class ();
  res = mono_array_new (domain, D.17731, D.17730);
  D.17727 = cdesc->first_counter;
  i = (int) D.17727;
  goto <D.16834>;
  <D.16833>:
  {
    const struct CounterDesc * desc;

    desc = &predef_counters[i];
    {
      void * * __p;

      D.17727 = cdesc->first_counter;
      D.17728 = (int) D.17727;
      D.17732 = i - D.17728;
      D.17733 = (unsigned int) D.17732;
      __p = mono_array_addr_with_size (res, 4, D.17733);
      D.17734 = desc->name;
      D.17735 = mono_string_new (domain, D.17734);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17735);
    }
  }
  i = i + 1;
  <D.16834>:
  D.17724 = cdesc + 12;
  D.17725 = D.17724->first_counter;
  D.17726 = (int) D.17725;
  if (D.17726 > i) goto <D.16833>; else goto <D.16835>;
  <D.16835>:
  D.17720 = res;
  return D.17720;
  <D.17723>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17736>; else goto <D.17737>;
    <D.17736>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17737>:
    D.17738 = ret != 0;
    D.17739 = (long int) D.17738;
    D.17740 = __builtin_expect (D.17739, 0);
    if (D.17740 != 0) goto <D.17741>; else goto <D.17742>;
    <D.17741>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1534, "ret == 0");
    <D.17742>:
  }
  scat = find_custom_category (category);
  if (scat != 0B) goto <D.17743>; else goto <D.17744>;
  <D.17743>:
  {
    char * p;
    int i;

    p = custom_category_counters (scat);
    D.17745 = scat->num_counters;
    D.17746 = (unsigned int) D.17745;
    D.17747 = mono_get_string_class ();
    res = mono_array_new (domain, D.17747, D.17746);
    i = 0;
    goto <D.16841>;
    <D.16840>:
    {
      void * * __p;

      i.56 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.56);
      D.17749 = p + 1;
      D.17750 = mono_string_new (domain, D.17749);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17750);
    }
    D.17749 = p + 1;
    D.17751 = strlen (D.17749);
    D.17752 = D.17751 + 2;
    p = p + D.17752;
    D.17753 = strlen (p);
    D.17754 = D.17753 + 1;
    p = p + D.17754;
    i = i + 1;
    <D.16841>:
    D.17745 = scat->num_counters;
    D.17755 = (int) D.17745;
    if (D.17755 > i) goto <D.16840>; else goto <D.16842>;
    <D.16842>:
    {
      int ret;

      ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
      if (ret != 0) goto <D.17756>; else goto <D.17757>;
      <D.17756>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.17757>:
      D.17758 = ret != 0;
      D.17759 = (long int) D.17758;
      D.17760 = __builtin_expect (D.17759, 0);
      if (D.17760 != 0) goto <D.17761>; else goto <D.17762>;
      <D.17761>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1545, "ret == 0");
      <D.17762>:
    }
    D.17720 = res;
    return D.17720;
  }
  <D.17744>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17763>; else goto <D.17764>;
    <D.17763>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17764>:
    D.17765 = ret != 0;
    D.17766 = (long int) D.17765;
    D.17767 = __builtin_expect (D.17766, 0);
    if (D.17767 != 0) goto <D.17768>; else goto <D.17769>;
    <D.17768>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1548, "ret == 0");
    <D.17769>:
  }
  D.17770 = mono_get_string_class ();
  D.17720 = mono_array_new (domain, D.17770, 0);
  return D.17720;
}


mono_perfcounter_instance_names (struct MonoString * category, struct MonoString * machine)
{
  int D.17772;
  struct MonoArray * D.17775;
  struct MonoClass * D.17776;
  struct MonoDomain * D.17777;
  <unnamed-unsigned:6> D.17780;
  int D.17781;
  struct MonoClass * D.17782;
  struct MonoDomain * D.17783;
  const struct CategoryDesc * cat;

  D.17772 = mono_string_compare_ascii (machine, ".");
  if (D.17772 != 0) goto <D.17773>; else goto <D.17774>;
  <D.17773>:
  D.17776 = mono_get_string_class ();
  D.17777 = mono_domain_get ();
  D.17775 = mono_array_new (D.17777, D.17776, 0);
  return D.17775;
  <D.17774>:
  cat = find_category (category);
  if (cat == 0B) goto <D.17778>; else goto <D.17779>;
  <D.17778>:
  D.17775 = get_custom_instances (category);
  return D.17775;
  <D.17779>:
  D.17780 = cat->instance_type;
  D.17781 = (int) D.17780;
  switch (D.17781) <default: <D.16927>, case 0: <D.16924>, case 1: <D.16926>, case 2: <D.16923>, case 3: <D.16922>, case 4: <D.16925>>
  <D.16922>:
  D.17775 = get_mono_instances ();
  return D.17775;
  <D.16923>:
  D.17775 = get_cpu_instances ();
  return D.17775;
  <D.16924>:
  D.17775 = get_processes_instances ();
  return D.17775;
  <D.16925>:
  D.17775 = get_networkinterface_instances ();
  return D.17775;
  <D.16926>:
  <D.16927>:
  D.17782 = mono_get_string_class ();
  D.17783 = mono_domain_get ();
  D.17775 = mono_array_new (D.17783, D.17782, 0);
  return D.17775;
}


get_custom_instances (struct MonoString * category)
{
  unsigned int D.17787;
  struct MonoClass * D.17788;
  struct MonoDomain * D.17789;
  unsigned int i.57;
  char[1] * D.17791;
  struct MonoDomain * D.17792;
  struct MonoString * D.17793;
  struct MonoArray * D.17794;
  struct MonoClass * D.17795;
  struct MonoDomain * D.17796;
  struct SharedCategory * scat;

  scat = find_custom_category (category);
  if (scat != 0B) goto <D.17785>; else goto <D.17786>;
  <D.17785>:
  {
    struct GSList * list;
    struct GSList * tmp;
    int i;
    struct MonoArray * array;

    list = get_custom_instances_list (scat);
    i = 0;
    D.17787 = monoeg_g_slist_length (list);
    D.17788 = mono_get_string_class ();
    D.17789 = mono_domain_get ();
    array = mono_array_new (D.17789, D.17788, D.17787);
    tmp = list;
    goto <D.16915>;
    <D.16914>:
    {
      struct SharedInstance * inst;

      inst = tmp->data;
      {
        void * * __p;

        i.57 = (unsigned int) i;
        __p = mono_array_addr_with_size (array, 4, i.57);
        D.17791 = &inst->instance_name;
        D.17792 = mono_domain_get ();
        D.17793 = mono_string_new (D.17792, D.17791);
        mono_gc_wbarrier_set_arrayref (array, __p, D.17793);
      }
      i = i + 1;
    }
    tmp = tmp->next;
    <D.16915>:
    if (tmp != 0B) goto <D.16914>; else goto <D.16916>;
    <D.16916>:
    monoeg_g_slist_free (list);
    D.17794 = array;
    return D.17794;
  }
  <D.17786>:
  D.17795 = mono_get_string_class ();
  D.17796 = mono_domain_get ();
  D.17794 = mono_array_new (D.17796, D.17795, 0);
  return D.17794;
}


get_custom_instances_list (struct SharedCategory * cat)
{
  int cat.58;
  struct MonoSharedArea * shared_area.59;
  int shared_area.60;
  int D.17801;
  unsigned int D.17802;
  struct GSList * D.17803;
  struct InstanceSearch search;

  try
    {
      cat.58 = (int) cat;
      shared_area.59 = shared_area;
      shared_area.60 = (int) shared_area.59;
      D.17801 = cat.58 - shared_area.60;
      D.17802 = (unsigned int) D.17801;
      search.cat_offset = D.17802;
      search.cat = cat;
      search.instance = 0B;
      search.list = 0B;
      search.result = 0B;
      foreach_shared_item (instance_search, &search);
      D.17803 = search.list;
      return D.17803;
    }
  finally
    {
      search = {CLOBBER};
    }
}


get_mono_instances ()
{
  unsigned int count.61;
  unsigned int D.17807;
  struct MonoArray * D.17808;
  int count;
  int res;
  void * * buf;
  struct MonoArray * array;

  count = 64;
  buf = 0B;
  <D.16879>:
  count = count * 2;
  monoeg_g_free (buf);
  count.61 = (unsigned int) count;
  D.17807 = count.61 * 4;
  buf = monoeg_malloc (D.17807);
  res = mono_shared_area_instances (buf, count);
  if (res == count) goto <D.16879>; else goto <D.16880>;
  <D.16880>:
  array = get_string_array (buf, res, 1);
  monoeg_g_free (buf);
  D.17808 = array;
  return D.17808;
}


get_string_array (void * * array, int count, gboolean is_process)
{
  unsigned int count.62;
  struct MonoClass * D.17811;
  struct MonoDomain * D.17812;
  unsigned int i.63;
  unsigned int D.17816;
  void * * D.17817;
  void * D.17818;
  int D.17819;
  unsigned int i.64;
  struct MonoString * D.17822;
  struct MonoArray * D.17825;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  count.62 = (unsigned int) count;
  D.17811 = mono_get_string_class ();
  D.17812 = mono_domain_get ();
  res = mono_array_new (D.17812, D.17811, count.62);
  i = 0;
  goto <D.16858>;
  <D.16857>:
  {
    char buf[128];
    char * p;

    try
      {
        if (is_process != 0) goto <D.17813>; else goto <D.17814>;
        <D.17813>:
        {
          char * pname;

          i.63 = (unsigned int) i;
          D.17816 = i.63 * 4;
          D.17817 = array + D.17816;
          D.17818 = *D.17817;
          pname = mono_process_get_name (D.17818, &buf, 128);
          i.63 = (unsigned int) i;
          D.17816 = i.63 * 4;
          D.17817 = array + D.17816;
          D.17818 = *D.17817;
          D.17819 = (int) D.17818;
          p = monoeg_g_strdup_printf ("%d/%s", D.17819, pname);
        }
        goto <D.17820>;
        <D.17814>:
        i.63 = (unsigned int) i;
        D.17816 = i.63 * 4;
        D.17817 = array + D.17816;
        D.17818 = *D.17817;
        D.17819 = (int) D.17818;
        sprintf (&buf, "%d", D.17819);
        p = &buf;
        <D.17820>:
        {
          void * * __p;

          i.64 = (unsigned int) i;
          __p = mono_array_addr_with_size (res, 4, i.64);
          D.17822 = mono_string_new (domain, p);
          mono_gc_wbarrier_set_arrayref (res, __p, D.17822);
        }
        if (&buf != p) goto <D.17823>; else goto <D.17824>;
        <D.17823>:
        monoeg_g_free (p);
        <D.17824>:
      }
    finally
      {
        buf = {CLOBBER};
      }
  }
  i = i + 1;
  <D.16858>:
  if (i < count) goto <D.16857>; else goto <D.16859>;
  <D.16859>:
  D.17825 = res;
  return D.17825;
}


sprintf (char * restrict __s, const char * restrict __fmt)
{
  int D.17827;
  unsigned int D.17828;

  D.17828 = __builtin_object_size (__s, 1);
  D.17827 = __builtin___sprintf_chk (__s, 1, D.17828, __fmt, __builtin_va_arg_pack ());
  return D.17827;
}


get_cpu_instances ()
{
  int D.17830;
  unsigned int count.65;
  unsigned int D.17832;
  unsigned int i.66;
  unsigned int D.17834;
  void * * D.17835;
  int D.17836;
  void * D.17837;
  struct MonoDomain * D.17838;
  struct MonoString * D.17839;
  struct MonoArray * D.17840;
  void * * buf;
  int i;
  int count;
  struct MonoArray * array;

  buf = 0B;
  D.17830 = mono_cpu_count ();
  count = D.17830 + 1;
  count.65 = (unsigned int) count;
  D.17832 = count.65 * 4;
  buf = monoeg_malloc (D.17832);
  i = 0;
  goto <D.16889>;
  <D.16888>:
  i.66 = (unsigned int) i;
  D.17834 = i.66 * 4;
  D.17835 = buf + D.17834;
  D.17836 = i + -1;
  D.17837 = (void *) D.17836;
  *D.17835 = D.17837;
  i = i + 1;
  <D.16889>:
  if (i < count) goto <D.16888>; else goto <D.16890>;
  <D.16890>:
  array = get_string_array (buf, count, 0);
  monoeg_g_free (buf);
  {
    void * * __p;

    __p = mono_array_addr_with_size (array, 4, 0);
    D.17838 = mono_domain_get ();
    D.17839 = mono_string_new (D.17838, "_Total");
    mono_gc_wbarrier_set_arrayref (array, __p, D.17839);
  }
  D.17840 = array;
  return D.17840;
}


get_processes_instances ()
{
  struct MonoArray * D.17844;
  int count.67;
  struct MonoArray * array;
  int count;
  void * * buf;

  try
    {
      count = 0;
      buf = mono_process_list (&count);
      if (buf == 0B) goto <D.17842>; else goto <D.17843>;
      <D.17842>:
      D.17844 = get_string_array (0B, 0, 0);
      return D.17844;
      <D.17843>:
      count.67 = count;
      array = get_string_array (buf, count.67, 1);
      monoeg_g_free (buf);
      D.17844 = array;
      return D.17844;
    }
  finally
    {
      count = {CLOBBER};
    }
}


get_networkinterface_instances ()
{
  struct MonoArray * D.17850;
  int count.68;
  struct MonoArray * array;
  int count;
  void * * buf;

  try
    {
      count = 0;
      buf = mono_networkinterface_list (&count);
      if (buf == 0B) goto <D.17848>; else goto <D.17849>;
      <D.17848>:
      D.17850 = get_string_array_of_strings (0B, 0);
      return D.17850;
      <D.17849>:
      count.68 = count;
      array = get_string_array_of_strings (buf, count.68);
      monoeg_g_strfreev (buf);
      D.17850 = array;
      return D.17850;
    }
  finally
    {
      count = {CLOBBER};
    }
}


get_string_array_of_strings (void * * array, int count)
{
  unsigned int count.69;
  struct MonoClass * D.17855;
  struct MonoDomain * D.17856;
  unsigned int i.70;
  unsigned int D.17858;
  void * * D.17859;
  unsigned int i.71;
  struct MonoString * D.17861;
  struct MonoArray * D.17862;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  count.69 = (unsigned int) count;
  D.17855 = mono_get_string_class ();
  D.17856 = mono_domain_get ();
  res = mono_array_new (D.17856, D.17855, count.69);
  i = 0;
  goto <D.16870>;
  <D.16869>:
  {
    char * p;

    i.70 = (unsigned int) i;
    D.17858 = i.70 * 4;
    D.17859 = array + D.17858;
    p = *D.17859;
    {
      void * * __p;

      i.71 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.71);
      D.17861 = mono_string_new (domain, p);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17861);
    }
  }
  i = i + 1;
  <D.16870>:
  if (i < count) goto <D.16869>; else goto <D.16871>;
  <D.16871>:
  D.17862 = res;
  return D.17862;
}


