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

  d_offset = 296;
  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 = 32;
  shared_area.1 = shared_area;
  shared_area.1->counters_size = 264;
  shared_area.1 = shared_area;
  D.16911 = (short unsigned int) d_offset;
  shared_area.1->data_start = D.16911;
  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.16913;
  void * D.16916;
  unsigned char D.16921;
  int D.16922;
  const struct CategoryDesc * cdesc;

  D.16913 = mono_string_compare_ascii (machine, ".");
  if (D.16913 != 0) goto <D.16914>; else goto <D.16915>;
  <D.16914>:
  D.16916 = 0B;
  return D.16916;
  <D.16915>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.16917>; else goto <D.16918>;
  <D.16917>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.16919>; else goto <D.16920>;
    <D.16919>:
    D.16916 = 0B;
    return D.16916;
    <D.16920>:
    *custom = 1;
    D.16916 = custom_get_impl (scat, counter, instance, type);
    return D.16916;
  }
  <D.16918>:
  D.16921 = cdesc->id;
  D.16922 = (int) D.16921;
  switch (D.16922) <default: <D.16923>, case 0: <D.16682>, case 1: <D.16683>, case 2: <D.16684>, case 3: <D.16694>, case 4: <D.16686>, case 5: <D.16687>, case 6: <D.16688>, case 7: <D.16689>, case 8: <D.16690>, case 9: <D.16691>, case 10: <D.16692>, case 11: <D.16693>, case 12: <D.16695>, case 13: <D.16685>>
  <D.16682>:
  D.16916 = cpu_get_impl (counter, instance, type, custom);
  return D.16916;
  <D.16683>:
  D.16916 = process_get_impl (counter, instance, type, custom);
  return D.16916;
  <D.16684>:
  D.16916 = mono_mem_get_impl (counter, instance, type, custom);
  return D.16916;
  <D.16685>:
  D.16916 = network_get_impl (counter, instance, type, custom);
  return D.16916;
  <D.16686>:
  <D.16687>:
  <D.16688>:
  <D.16689>:
  <D.16690>:
  <D.16691>:
  <D.16692>:
  <D.16693>:
  <D.16694>:
  <D.16695>:
  D.16921 = cdesc->id;
  D.16922 = (int) D.16921;
  D.16916 = predef_writable_get_impl (D.16922, counter, instance, type, custom);
  return D.16916;
  <D.16923>:
  D.16916 = 0B;
  return D.16916;
}


mono_string_compare_ascii (struct MonoString * str, const char * ascii_str)
{
  short unsigned int D.16925;
  int D.16928;
  int D.16929;
  const char * ascii_str.3;
  char D.16931;
  int D.16932;
  const unsigned char * D.16933;
  unsigned char D.16934;
  int D.16935;
  guint16 * strc;

  strc = mono_string_chars (str);
  goto <D.16389>;
  <D.16388>:
  D.16925 = *strc;
  if (D.16925 == 0) goto <D.16926>; else goto <D.16927>;
  <D.16926>:
  D.16928 = 0;
  return D.16928;
  <D.16927>:
  strc = strc + 2;
  <D.16389>:
  D.16925 = *strc;
  D.16929 = (int) D.16925;
  ascii_str.3 = ascii_str;
  ascii_str = ascii_str.3 + 1;
  D.16931 = *ascii_str.3;
  D.16932 = (int) D.16931;
  if (D.16929 == D.16932) goto <D.16388>; else goto <D.16390>;
  <D.16390>:
  D.16925 = *strc;
  D.16929 = (int) D.16925;
  D.16933 = ascii_str + 4294967295;
  D.16934 = *D.16933;
  D.16935 = (int) D.16934;
  D.16928 = D.16929 - D.16935;
  return D.16928;
}


find_category (struct MonoString * category)
{
  const char * D.16937;
  int D.16938;
  const struct CategoryDesc * D.16941;
  int i;

  i = 0;
  goto <D.16670>;
  <D.16669>:
  D.16937 = predef_categories[i].name;
  D.16938 = mono_string_compare_ascii (category, D.16937);
  if (D.16938 == 0) goto <D.16939>; else goto <D.16940>;
  <D.16939>:
  D.16941 = &predef_categories[i];
  return D.16941;
  <D.16940>:
  i = i + 1;
  <D.16670>:
  if (i <= 13) goto <D.16669>; else goto <D.16671>;
  <D.16671>:
  D.16941 = 0B;
  return D.16941;
}


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

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


category_search (struct SharedHeader * header, void * data)
{
  unsigned char D.16946;
  struct MonoString * D.16949;
  char[1] * D.16950;
  int D.16951;
  gboolean D.16954;
  struct CatSearch * search;

  search = data;
  D.16946 = header->ftype;
  if (D.16946 == 67) goto <D.16947>; else goto <D.16948>;
  <D.16947>:
  {
    struct SharedCategory * cat;

    cat = header;
    D.16949 = search->name;
    D.16950 = &cat->name;
    D.16951 = mono_string_compare_ascii (D.16949, D.16950);
    if (D.16951 == 0) goto <D.16952>; else goto <D.16953>;
    <D.16952>:
    search->cat = cat;
    D.16954 = 0;
    return D.16954;
    <D.16953>:
  }
  <D.16948>:
  D.16954 = 1;
  return D.16954;
}


foreach_shared_item (gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  struct MonoSharedArea * shared_area.4;
  short unsigned int D.16957;
  sizetype D.16958;
  int D.16959;
  sizetype D.16960;
  unsigned char * p;
  unsigned char * end;

  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.16957 = shared_area.4->data_start;
  D.16958 = (sizetype) D.16957;
  p = shared_area.4 + D.16958;
  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.16959 = shared_area.4->size;
  D.16960 = (sizetype) D.16959;
  end = shared_area.4 + D.16960;
  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.16961;
  int D.16964;
  unsigned char D.16967;
  short unsigned int D.16970;
  sizetype D.16971;

  goto <D.16375>;
  <D.16374>:
  {
    short unsigned int * next;

    D.16961 = p + 4;
    if (D.16961 > end) goto <D.16962>; else goto <D.16963>;
    <D.16962>:
    return;
    <D.16963>:
    next = p + 2;
    D.16964 = func (p, data);
    if (D.16964 == 0) goto <D.16965>; else goto <D.16966>;
    <D.16965>:
    return;
    <D.16966>:
    D.16967 = *p;
    if (D.16967 == 0) goto <D.16968>; else goto <D.16969>;
    <D.16968>:
    return;
    <D.16969>:
    D.16970 = *next;
    D.16971 = (sizetype) D.16970;
    p = p + D.16971;
  }
  <D.16375>:
  if (p < end) goto <D.16374>; else goto <D.16376>;
  <D.16376>:
}


custom_get_impl (struct SharedCategory * cat, struct MonoString * counter, struct MonoString * instance, int * type)
{
  void * D.16975;
  unsigned char D.16976;
  int D.16977;
  int D.16978;
  char[1] * D.16981;
  unsigned int D.16982;
  unsigned int D.16983;
  unsigned char D.16984;
  unsigned int D.16985;
  unsigned int D.16986;
  sizetype size.5;
  sizetype D.16988;
  char * D.16989;
  struct SharedCounter * scounter;
  struct SharedInstance * inst;
  int size;

  scounter = find_custom_counter (cat, counter);
  if (scounter == 0B) goto <D.16973>; else goto <D.16974>;
  <D.16973>:
  D.16975 = 0B;
  return D.16975;
  <D.16974>:
  D.16976 = scounter->type;
  D.16977 = (int) D.16976;
  D.16978 = simple_type_to_type[D.16977];
  *type = D.16978;
  inst = custom_get_instance (cat, scounter, instance);
  if (inst == 0B) goto <D.16979>; else goto <D.16980>;
  <D.16979>:
  D.16975 = 0B;
  return D.16975;
  <D.16980>:
  D.16981 = &inst->instance_name;
  D.16982 = strlen (D.16981);
  D.16983 = D.16982 + 12;
  size = (int) D.16983;
  size = size + 7;
  size = size & -8;
  D.16984 = scounter->seq_num;
  D.16985 = (unsigned int) D.16984;
  D.16986 = D.16985 * 8;
  size.5 = (sizetype) size;
  D.16988 = D.16986 + size.5;
  D.16989 = inst + D.16988;
  D.16975 = custom_vtable (scounter, inst, D.16989);
  return D.16975;
}


find_custom_counter (struct SharedCategory * cat, struct MonoString * name)
{
  char[1] * D.16991;
  int D.16992;
  struct SharedCounter * D.16995;
  const char * D.16996;
  unsigned int D.16997;
  sizetype D.16998;
  unsigned int D.16999;
  sizetype D.17000;
  short unsigned int D.17001;
  int D.17002;
  int i;
  char * p;

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

    counter = p;
    D.16991 = &counter->name;
    D.16992 = mono_string_compare_ascii (name, D.16991);
    if (D.16992 == 0) goto <D.16993>; else goto <D.16994>;
    <D.16993>:
    D.16995 = counter;
    return D.16995;
    <D.16994>:
    D.16996 = p + 1;
    D.16997 = strlen (D.16996);
    D.16998 = D.16997 + 2;
    p = p + D.16998;
    D.16999 = strlen (p);
    D.17000 = D.16999 + 1;
    p = p + D.17000;
  }
  i = i + 1;
  <D.16426>:
  D.17001 = cat->num_counters;
  D.17002 = (int) D.17001;
  if (D.17002 > i) goto <D.16425>; else goto <D.16427>;
  <D.16427>:
  D.16995 = 0B;
  return D.16995;
}


custom_category_counters (struct SharedCategory * cat)
{
  char[1] * D.17004;
  unsigned int D.17005;
  sizetype D.17006;
  unsigned int D.17007;
  sizetype D.17008;
  char * D.17009;
  char * p;

  D.17004 = &cat->name;
  D.17005 = strlen (D.17004);
  D.17006 = D.17005 + 1;
  p = &cat->name[D.17006];
  D.17007 = strlen (p);
  D.17008 = D.17007 + 1;
  p = p + D.17008;
  D.17009 = p;
  return D.17009;
}


custom_get_instance (struct SharedCategory * cat, struct SharedCounter * scounter, struct MonoString * instance)
{
  struct SharedInstance * D.17013;
  unsigned int D.17014;
  unsigned int D.17015;
  short unsigned int D.17016;
  unsigned int D.17017;
  unsigned int D.17018;
  unsigned int size.6;
  unsigned int D.17020;
  _Bool D.17023;
  long int D.17024;
  long int D.17025;
  _Bool D.17032;
  long int D.17033;
  long int D.17034;
  short unsigned int D.17037;
  int cat.7;
  struct MonoSharedArea * shared_area.8;
  int shared_area.9;
  int D.17041;
  unsigned int D.17042;
  int D.17043;
  int D.17044;
  unsigned int D.17045;
  sizetype D.17046;
  _Bool D.17049;
  long int D.17050;
  long int D.17051;
  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.17011>; else goto <D.17012>;
  <D.17011>:
  D.17013 = inst;
  return D.17013;
  <D.17012>:
  name = mono_string_to_utf8 (instance);
  D.17014 = strlen (name);
  D.17015 = D.17014 + 12;
  size = (int) D.17015;
  size = size + 7;
  size = size & -8;
  data_offset = size;
  D.17016 = cat->num_counters;
  D.17017 = (unsigned int) D.17016;
  D.17018 = D.17017 * 8;
  size.6 = (unsigned int) size;
  D.17020 = D.17018 + size.6;
  size = (int) D.17020;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17021>; else goto <D.17022>;
    <D.17021>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17022>:
    D.17023 = ret != 0;
    D.17024 = (long int) D.17023;
    D.17025 = __builtin_expect (D.17024, 0);
    if (D.17025 != 0) goto <D.17026>; else goto <D.17027>;
    <D.17026>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1159, "ret == 0");
    <D.17027>:
  }
  ptr = shared_data_find_room (size);
  if (ptr == 0B) goto <D.17028>; else goto <D.17029>;
  <D.17028>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17030>; else goto <D.17031>;
    <D.17030>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17031>:
    D.17032 = ret != 0;
    D.17033 = (long int) D.17032;
    D.17034 = __builtin_expect (D.17033, 0);
    if (D.17034 != 0) goto <D.17035>; else goto <D.17036>;
    <D.17035>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1162, "ret == 0");
    <D.17036>:
  }
  monoeg_g_free (name);
  D.17013 = 0B;
  return D.17013;
  <D.17029>:
  inst = ptr;
  inst->header.extra = 0;
  D.17037 = (short unsigned int) size;
  inst->header.size = D.17037;
  cat.7 = (int) cat;
  shared_area.8 = shared_area;
  shared_area.9 = (int) shared_area.8;
  D.17041 = cat.7 - shared_area.9;
  D.17042 = (unsigned int) D.17041;
  inst->category_offset = D.17042;
  D.17043 = cat->num_instances;
  D.17044 = D.17043 + 1;
  cat->num_instances = D.17044;
  p = &inst->instance_name;
  strcpy (p, name);
  D.17045 = strlen (name);
  D.17046 = D.17045 + 1;
  p = p + D.17046;
  inst->header.ftype = 73;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17047>; else goto <D.17048>;
    <D.17047>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17048>:
    D.17049 = ret != 0;
    D.17050 = (long int) D.17049;
    D.17051 = __builtin_expect (D.17050, 0);
    if (D.17051 != 0) goto <D.17052>; else goto <D.17053>;
    <D.17052>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1176, "ret == 0");
    <D.17053>:
  }
  monoeg_g_free (name);
  D.17013 = inst;
  return D.17013;
}


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

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


instance_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17063;
  unsigned int D.17066;
  unsigned int D.17067;
  struct MonoString * D.17070;
  char[1] * D.17073;
  int D.17074;
  gboolean D.17077;
  struct GSList * D.17079;
  struct GSList * D.17080;
  struct InstanceSearch * search;

  search = data;
  D.17063 = header->ftype;
  if (D.17063 == 73) goto <D.17064>; else goto <D.17065>;
  <D.17064>:
  {
    struct SharedInstance * ins;

    ins = header;
    D.17066 = search->cat_offset;
    D.17067 = ins->category_offset;
    if (D.17066 == D.17067) goto <D.17068>; else goto <D.17069>;
    <D.17068>:
    D.17070 = search->instance;
    if (D.17070 != 0B) goto <D.17071>; else goto <D.17072>;
    <D.17071>:
    D.17070 = search->instance;
    D.17073 = &ins->instance_name;
    D.17074 = mono_string_compare_ascii (D.17070, D.17073);
    if (D.17074 == 0) goto <D.17075>; else goto <D.17076>;
    <D.17075>:
    search->result = ins;
    D.17077 = 0;
    return D.17077;
    <D.17076>:
    goto <D.17078>;
    <D.17072>:
    D.17079 = search->list;
    D.17080 = monoeg_g_slist_prepend (D.17079, ins);
    search->list = D.17080;
    <D.17078>:
    <D.17069>:
  }
  <D.17065>:
  D.17077 = 1;
  return D.17077;
}


shared_data_find_room (int size)
{
  struct MonoSharedArea * shared_area.13;
  short unsigned int D.17083;
  sizetype D.17084;
  int D.17085;
  sizetype D.17086;
  unsigned char D.17087;
  int end.14;
  int p.15;
  int D.17092;
  unsigned char * D.17095;
  unsigned char * D.17096;
  short unsigned int D.17101;
  int D.17102;
  sizetype D.17105;
  unsigned char * p;
  unsigned char * end;

  shared_area.13 = shared_area;
  shared_area.13 = shared_area;
  D.17083 = shared_area.13->data_start;
  D.17084 = (sizetype) D.17083;
  p = shared_area.13 + D.17084;
  shared_area.13 = shared_area;
  shared_area.13 = shared_area;
  D.17085 = shared_area.13->size;
  D.17086 = (sizetype) D.17085;
  end = shared_area.13 + D.17086;
  size = size + 7;
  size = size & -8;
  goto <D.16362>;
  <D.16361>:
  {
    short unsigned int * next;

    D.17087 = *p;
    if (D.17087 == 0) goto <D.17088>; else goto <D.17089>;
    <D.17088>:
    end.14 = (int) end;
    p.15 = (int) p;
    D.17092 = end.14 - p.15;
    if (D.17092 > size) goto <D.17093>; else goto <D.17094>;
    <D.17093>:
    D.17095 = p;
    return D.17095;
    <D.17094>:
    D.17095 = 0B;
    return D.17095;
    <D.17089>:
    D.17096 = p + 4;
    if (D.17096 > end) goto <D.17097>; else goto <D.17098>;
    <D.17097>:
    D.17095 = 0B;
    return D.17095;
    <D.17098>:
    next = p + 2;
    D.17087 = *p;
    if (D.17087 == 68) goto <D.17099>; else goto <D.17100>;
    <D.17099>:
    D.17101 = *next;
    D.17102 = (int) D.17101;
    if (D.17102 == size) goto <D.17103>; else goto <D.17104>;
    <D.17103>:
    D.17095 = p;
    return D.17095;
    <D.17104>:
    <D.17100>:
    D.17101 = *next;
    D.17105 = (sizetype) D.17101;
    p = p + D.17105;
  }
  <D.16362>:
  if (p < end) goto <D.16361>; else goto <D.16363>;
  <D.16363>:
  D.17095 = 0B;
  return D.17095;
}


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

  D.17108 = __builtin_object_size (__dest, 1);
  D.17107 = __builtin___strcpy_chk (__dest, __src, D.17108);
  return D.17107;
}


custom_vtable (struct SharedCounter * scounter, struct SharedInstance * inst, char * data)
{
  struct ImplVtable * D.17110;
  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.17110 = vtable;
  return D.17110;
}


custom_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  long long unsigned int D.17116;
  long long unsigned int value.16;
  long long unsigned int D.17118;
  gint64 D.17119;
  long long unsigned int value.17;
  guint64 * ptr;

  ptr = vtable->arg;
  if (ptr != 0B) goto <D.17112>; else goto <D.17113>;
  <D.17112>:
  if (do_incr != 0) goto <D.17114>; else goto <D.17115>;
  <D.17114>:
  D.17116 = *ptr;
  value.16 = (long long unsigned int) value;
  D.17118 = D.17116 + value.16;
  *ptr = D.17118;
  D.17116 = *ptr;
  D.17119 = (gint64) D.17116;
  return D.17119;
  <D.17115>:
  value.17 = (long long unsigned int) value;
  *ptr = value.17;
  D.17119 = value;
  return D.17119;
  <D.17113>:
  D.17119 = 0;
  return D.17119;
}


custom_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  struct SharedCounter * D.17124;
  unsigned char D.17125;
  int D.17126;
  int D.17127;
  void * D.17128;
  long long unsigned int D.17132;
  long long int D.17133;
  MonoBoolean D.17134;
  struct CustomVTable * counter_data;

  counter_data = vtable;
  if (only_value == 0) goto <D.17122>; else goto <D.17123>;
  <D.17122>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17123>:
  D.17124 = counter_data->counter_desc;
  D.17125 = D.17124->type;
  D.17126 = (int) D.17125;
  D.17127 = simple_type_to_type[D.17126];
  sample->counterType = D.17127;
  D.17128 = vtable->arg;
  if (D.17128 == 0B) goto <D.17129>; else goto <D.17130>;
  <D.17129>:
  sample->rawValue = 0;
  goto <D.17131>;
  <D.17130>:
  D.17128 = vtable->arg;
  D.17132 = MEM[(guint64 *)D.17128];
  D.17133 = (long long int) D.17132;
  sample->rawValue = D.17133;
  <D.17131>:
  D.17134 = 1;
  return D.17134;
}


fill_sample (struct MonoCounterSample * sample)
{
  long long int D.17136;
  long long int D.17137;

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


cpu_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17138;
  int D.17141;
  void * D.17142;
  short int D.17143;
  int D.17144;
  int D.17145;
  void * D.17146;
  int id;
  const struct CounterDesc * cdesc;

  D.17138 = id_from_string (instance, 0);
  id = D.17138 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[0], counter);
  if (cdesc != 0B) goto <D.17139>; else goto <D.17140>;
  <D.17139>:
  D.17141 = cdesc->type;
  *type = D.17141;
  D.17143 = cdesc->id;
  D.17144 = (int) D.17143;
  D.17145 = D.17144 | id;
  D.17146 = (void *) D.17145;
  D.17142 = create_vtable (D.17146, get_cpu_counter, 0B);
  return D.17142;
  <D.17140>:
  D.17142 = 0B;
  return D.17142;
}


get_cpu_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17148;
  short int D.17151;
  int D.17152;
  int D.17153;
  int D.17154;
  long long int D.17155;
  MonoBoolean D.17156;
  long long int D.17157;
  long long int D.17158;
  long long int D.17159;
  long long int D.17160;
  MonoProcessError error;
  int id;
  int pid;

  try
    {
      D.17148 = vtable->arg;
      id = (int) D.17148;
      pid = id >> 5;
      id = id & 31;
      if (only_value == 0) goto <D.17149>; else goto <D.17150>;
      <D.17149>:
      fill_sample (sample);
      sample->baseValue = 1;
      <D.17150>:
      D.17151 = 0;
      D.17152 = (int) D.17151;
      D.17153 = D.17152 + id;
      D.17154 = predef_counters[D.17153].type;
      sample->counterType = D.17154;
      switch (id) <default: <D.17161>, case 0: <D.16480>, case 1: <D.16481>, case 2: <D.16482>, case 3: <D.16483>, case 4: <D.16484>>
      <D.16480>:
      D.17155 = mono_cpu_get_data (pid, 0, &error);
      sample->rawValue = D.17155;
      D.17156 = 1;
      return D.17156;
      <D.16481>:
      D.17157 = mono_cpu_get_data (pid, 1, &error);
      sample->rawValue = D.17157;
      D.17156 = 1;
      return D.17156;
      <D.16482>:
      D.17158 = mono_cpu_get_data (pid, 2, &error);
      sample->rawValue = D.17158;
      D.17156 = 1;
      return D.17156;
      <D.16483>:
      D.17159 = mono_cpu_get_data (pid, 3, &error);
      sample->rawValue = D.17159;
      D.17156 = 1;
      return D.17156;
      <D.16484>:
      D.17160 = mono_cpu_get_data (pid, 4, &error);
      sample->rawValue = D.17160;
      D.17156 = 1;
      return D.17156;
      <D.17161>:
      D.17156 = 0;
      return D.17156;
    }
  finally
    {
      error = {CLOBBER};
    }
}


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

  id = -1;
  D.17164 = mono_string_length (instance);
  if (D.17164 != 0) goto <D.17165>; else goto <D.17166>;
  <D.17165>:
  {
    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.17168>; else goto <D.17169>;
        <D.17168>:
        if (is_process == 0) goto <D.17170>; else goto <D.17171>;
        <D.17170>:
        id = -1;
        <D.17171>:
        <D.17169>:
        monoeg_g_free (id_str);
      }
    finally
      {
        end = {CLOBBER};
      }
  }
  <D.17166>:
  D.17172 = id;
  return D.17172;
}


get_counter_in_category (const struct CategoryDesc * desc, struct MonoString * counter)
{
  short int D.17174;
  int D.17175;
  const struct CategoryDesc * D.17176;
  short int D.17177;
  int D.17178;
  const char * D.17179;
  int D.17180;
  const struct CounterDesc * D.17183;
  const struct CounterDesc * cdesc;
  const struct CounterDesc * end;

  D.17174 = desc->first_counter;
  D.17175 = (int) D.17174;
  cdesc = &predef_counters[D.17175];
  D.17176 = desc + 12;
  D.17177 = D.17176->first_counter;
  D.17178 = (int) D.17177;
  end = &predef_counters[D.17178];
  goto <D.16460>;
  <D.16459>:
  D.17179 = cdesc->name;
  D.17180 = mono_string_compare_ascii (counter, D.17179);
  if (D.17180 == 0) goto <D.17181>; else goto <D.17182>;
  <D.17181>:
  D.17183 = cdesc;
  return D.17183;
  <D.17182>:
  cdesc = cdesc + 16;
  <D.16460>:
  if (cdesc < end) goto <D.16459>; else goto <D.16461>;
  <D.16461>:
  D.17183 = 0B;
  return D.17183;
}


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

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


process_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17187;
  int D.17190;
  void * D.17191;
  short int D.17192;
  int D.17193;
  int D.17194;
  void * D.17195;
  int id;
  const struct CounterDesc * cdesc;

  D.17187 = id_from_string (instance, 1);
  id = D.17187 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[1], counter);
  if (cdesc != 0B) goto <D.17188>; else goto <D.17189>;
  <D.17188>:
  D.17190 = cdesc->type;
  *type = D.17190;
  D.17192 = cdesc->id;
  D.17193 = (int) D.17192;
  D.17194 = D.17193 | id;
  D.17195 = (void *) D.17194;
  D.17191 = create_vtable (D.17195, get_process_counter, 0B);
  return D.17191;
  <D.17189>:
  D.17191 = 0B;
  return D.17191;
}


get_process_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17197;
  MonoBoolean D.17200;
  short int D.17203;
  int D.17204;
  int D.17205;
  int D.17206;
  void * pid.19;
  long long int D.17208;
  long long int D.17209;
  long long int D.17210;
  long long int D.17211;
  long long int D.17212;
  long long int D.17213;
  long long int D.17214;
  int id;
  int pid;

  D.17197 = vtable->arg;
  id = (int) D.17197;
  pid = id >> 5;
  if (pid < 0) goto <D.17198>; else goto <D.17199>;
  <D.17198>:
  D.17200 = 0;
  return D.17200;
  <D.17199>:
  id = id & 31;
  if (only_value == 0) goto <D.17201>; else goto <D.17202>;
  <D.17201>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17202>:
  D.17203 = 5;
  D.17204 = (int) D.17203;
  D.17205 = D.17204 + id;
  D.17206 = predef_counters[D.17205].type;
  sample->counterType = D.17206;
  switch (id) <default: <D.17215>, case 0: <D.16525>, case 1: <D.16526>, case 2: <D.16527>, case 3: <D.16528>, case 4: <D.16529>, case 5: <D.16530>, case 6: <D.16531>>
  <D.16525>:
  pid.19 = (void *) pid;
  D.17208 = mono_process_get_data (pid.19, 1);
  sample->rawValue = D.17208;
  D.17200 = 1;
  return D.17200;
  <D.16526>:
  pid.19 = (void *) pid;
  D.17209 = mono_process_get_data (pid.19, 2);
  sample->rawValue = D.17209;
  D.17200 = 1;
  return D.17200;
  <D.16527>:
  pid.19 = (void *) pid;
  D.17210 = mono_process_get_data (pid.19, 3);
  sample->rawValue = D.17210;
  D.17200 = 1;
  return D.17200;
  <D.16528>:
  pid.19 = (void *) pid;
  D.17211 = mono_process_get_data (pid.19, 0);
  sample->rawValue = D.17211;
  D.17200 = 1;
  return D.17200;
  <D.16529>:
  pid.19 = (void *) pid;
  D.17212 = mono_process_get_data (pid.19, 7);
  sample->rawValue = D.17212;
  D.17200 = 1;
  return D.17200;
  <D.16530>:
  pid.19 = (void *) pid;
  D.17213 = mono_process_get_data (pid.19, 4);
  sample->rawValue = D.17213;
  D.17200 = 1;
  return D.17200;
  <D.16531>:
  pid.19 = (void *) pid;
  D.17214 = mono_process_get_data (pid.19, 6);
  sample->rawValue = D.17214;
  D.17200 = 1;
  return D.17200;
  <D.17215>:
  D.17200 = 0;
  return D.17200;
}


mono_mem_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17219;
  void * D.17220;
  short int D.17221;
  int D.17222;
  void * D.17223;
  const struct CounterDesc * cdesc;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[2], counter);
  if (cdesc != 0B) goto <D.17217>; else goto <D.17218>;
  <D.17217>:
  D.17219 = cdesc->type;
  *type = D.17219;
  D.17221 = cdesc->id;
  D.17222 = (int) D.17221;
  D.17223 = (void *) D.17222;
  D.17220 = create_vtable (D.17223, mono_mem_counter, 0B);
  return D.17220;
  <D.17218>:
  D.17220 = 0B;
  return D.17220;
}


mono_mem_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17225;
  short int D.17228;
  int D.17229;
  int D.17230;
  int D.17231;
  long long unsigned int D.17232;
  long long int D.17233;
  MonoBoolean D.17234;
  long long unsigned int D.17235;
  long long int D.17236;
  int id;

  D.17225 = vtable->arg;
  id = (int) D.17225;
  if (only_value == 0) goto <D.17226>; else goto <D.17227>;
  <D.17226>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17227>:
  D.17228 = 12;
  D.17229 = (int) D.17228;
  D.17230 = D.17229 + id;
  D.17231 = predef_counters[D.17230].type;
  sample->counterType = D.17231;
  switch (id) <default: <D.17237>, case 0: <D.16546>, case 1: <D.16547>>
  <D.16546>:
  D.17232 = mono_stats.new_object_count;
  D.17233 = (long long int) D.17232;
  sample->rawValue = D.17233;
  D.17234 = 1;
  return D.17234;
  <D.16547>:
  D.17235 = mono_determine_physical_ram_size ();
  D.17236 = (long long int) D.17235;
  sample->rawValue = D.17236;
  D.17234 = 1;
  return D.17234;
  <D.17237>:
  D.17234 = 0;
  return D.17234;
}


mono_determine_physical_ram_size ()
{
  long int D.17239;
  long int D.17240;
  guint64 D.17244;
  guint64 page_size;
  guint64 num_pages;

  page_size = 0;
  num_pages = 0;
  D.17239 = sysconf (30);
  page_size = (guint64) D.17239;
  D.17240 = sysconf (85);
  num_pages = (guint64) D.17240;
  if (page_size == 0) goto <D.17241>; else goto <D.17243>;
  <D.17243>:
  if (num_pages == 0) goto <D.17241>; else goto <D.17242>;
  <D.17241>:
  monoeg_g_log (0B, 16, "Your operating system\'s sysconf (3) function doesn\'t correctly report physical memory size!");
  D.17244 = 134217728;
  return D.17244;
  <D.17242>:
  D.17244 = page_size * num_pages;
  return D.17244;
}


network_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  short int D.17248;
  int D.17249;
  int D.17250;
  void * D.17251;
  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.17246>; else goto <D.17247>;
  <D.17246>:
  instance_name = mono_string_to_utf8 (instance);
  narg = monoeg_malloc0 (8);
  D.17248 = cdesc->id;
  D.17249 = (int) D.17248;
  narg->id = D.17249;
  narg->name = instance_name;
  D.17250 = cdesc->type;
  *type = D.17250;
  vtable = create_vtable (narg, get_network_counter, 0B);
  vtable->cleanup = network_cleanup;
  D.17251 = vtable;
  return D.17251;
  <D.17247>:
  D.17251 = 0B;
  return D.17251;
}


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

  if (vtable == 0B) goto <D.17253>; else goto <D.17254>;
  <D.17253>:
  return;
  <D.17254>:
  narg = vtable->arg;
  if (narg == 0B) goto <D.17255>; else goto <D.17256>;
  <D.17255>:
  return;
  <D.17256>:
  D.17257 = narg->name;
  monoeg_g_free (D.17257);
  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.17261;
  int D.17262;
  int D.17263;
  int D.17264;
  int D.17265;
  char * D.17266;
  long long int D.17267;
  long long int D.17268;
  long long int D.17269;
  <unnamed type> error.20;
  MonoBoolean D.17274;
  MonoNetworkError error;
  struct NetworkVtableArg * narg;

  try
    {
      error = 2;
      narg = vtable->arg;
      if (only_value == 0) goto <D.17259>; else goto <D.17260>;
      <D.17259>:
      fill_sample (sample);
      <D.17260>:
      D.17261 = 93;
      D.17262 = (int) D.17261;
      D.17263 = narg->id;
      D.17264 = D.17262 + D.17263;
      D.17265 = predef_counters[D.17264].type;
      sample->counterType = D.17265;
      D.17263 = narg->id;
      switch (D.17263) <default: <D.17270>, case 0: <D.16500>, case 1: <D.16502>, case 2: <D.16503>>
      <D.16500>:
      D.17266 = narg->name;
      D.17267 = mono_network_get_data (D.17266, 0, &error);
      sample->rawValue = D.17267;
      goto <D.16501>;
      <D.16502>:
      D.17266 = narg->name;
      D.17268 = mono_network_get_data (D.17266, 1, &error);
      sample->rawValue = D.17268;
      goto <D.16501>;
      <D.16503>:
      D.17266 = narg->name;
      D.17269 = mono_network_get_data (D.17266, 2, &error);
      sample->rawValue = D.17269;
      goto <D.16501>;
      <D.17270>:
      <D.16501>:
      error.20 = error;
      if (error.20 == 0) goto <D.17272>; else goto <D.17273>;
      <D.17272>:
      D.17274 = 1;
      return D.17274;
      <D.17273>:
      D.17274 = 0;
      return D.17274;
    }
  finally
    {
      error = {CLOBBER};
    }
}


predef_writable_get_impl (int cat, struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  const struct CategoryDesc * D.17277;
  int D.17280;
  int D.17284;
  void * D.17285;
  short int D.17286;
  int D.17287;
  int D.17288;
  int D.17289;
  void * D.17290;
  const struct CounterDesc * cdesc;

  *custom = 1;
  D.17277 = &predef_categories[cat];
  cdesc = get_counter_in_category (D.17277, counter);
  if (cdesc != 0B) goto <D.17278>; else goto <D.17279>;
  <D.17278>:
  D.17280 = cdesc->type;
  *type = D.17280;
  if (instance == 0B) goto <D.17281>; else goto <D.17283>;
  <D.17283>:
  D.17284 = mono_string_compare_ascii (instance, "");
  if (D.17284 == 0) goto <D.17281>; else goto <D.17282>;
  <D.17281>:
  D.17286 = cdesc->id;
  D.17287 = (int) D.17286;
  D.17288 = D.17287 << 16;
  D.17289 = D.17288 | cat;
  D.17290 = (void *) D.17289;
  D.17285 = create_vtable (D.17290, predef_writable_counter, predef_writable_update);
  return D.17285;
  <D.17282>:
  D.17286 = cdesc->id;
  D.17287 = (int) D.17286;
  D.17288 = D.17287 << 16;
  D.17289 = D.17288 | cat;
  D.17290 = (void *) D.17289;
  D.17285 = predef_vtable (D.17290, instance);
  return D.17285;
  <D.17279>:
  D.17285 = 0B;
  return D.17285;
}


predef_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  void * D.17292;
  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.17310;
  guint32 * ptr.29;
  int D.17312;
  guint32 * ptr.30;
  int D.17316;
  guint32 * ptr.31;
  unsigned int D.17318;
  unsigned int D.17319;
  unsigned int D.17320;
  guint32 * ptr.32;
  unsigned int D.17322;
  guint32 * ptr.33;
  gint64 * ptr64.34;
  gint64 * ptr64.35;
  long long int D.17330;
  long long int D.17331;
  gint64 * ptr64.36;
  gint64 * ptr64.37;
  guint32 * volatile ptr;
  gint64 * volatile ptr64;
  int cat_id;
  int id;

  ptr = 0B;
  ptr64 = 0B;
  D.17292 = vtable->arg;
  cat_id = (int) D.17292;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  switch (cat_id) <default: <D.17302>, case 3: <D.16605>, case 12: <D.16610>>
  <D.16605>:
  switch (id) <default: <D.17296>, case 0: <D.16606>, case 1: <D.16608>>
  <D.16606>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.22 = &mono_perfcounters.21->aspnet_requests_queued;
  ptr = ptr.22;
  goto <D.16607>;
  <D.16608>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.23 = &mono_perfcounters.21->aspnet_requests;
  ptr = ptr.23;
  goto <D.16607>;
  <D.17296>:
  <D.16607>:
  goto <D.16609>;
  <D.16610>:
  switch (id) <default: <D.17301>, case 0: <D.16611>, case 2: <D.16613>, case 4: <D.16614>, case 5: <D.16615>>
  <D.16611>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr64.24 = &mono_perfcounters.21->threadpool_workitems;
  ptr64 = ptr64.24;
  goto <D.16612>;
  <D.16613>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr64.25 = &mono_perfcounters.21->threadpool_ioworkitems;
  ptr64 = ptr64.25;
  goto <D.16612>;
  <D.16614>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.26 = &mono_perfcounters.21->threadpool_threads;
  ptr = ptr.26;
  goto <D.16612>;
  <D.16615>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.27 = &mono_perfcounters.21->threadpool_iothreads;
  ptr = ptr.27;
  goto <D.16612>;
  <D.17301>:
  <D.16612>:
  goto <D.16609>;
  <D.17302>:
  <D.16609>:
  ptr.28 = ptr;
  if (ptr.28 != 0B) goto <D.17304>; else goto <D.17305>;
  <D.17304>:
  if (do_incr != 0) goto <D.17306>; else goto <D.17307>;
  <D.17306>:
  if (value == 1) goto <D.17308>; else goto <D.17309>;
  <D.17308>:
  ptr.29 = ptr;
  D.17312 = InterlockedIncrement (ptr.29);
  D.17310 = (gint64) D.17312;
  return D.17310;
  <D.17309>:
  if (value == -1) goto <D.17313>; else goto <D.17314>;
  <D.17313>:
  ptr.30 = ptr;
  D.17316 = InterlockedDecrement (ptr.30);
  D.17310 = (gint64) D.17316;
  return D.17310;
  <D.17314>:
  ptr.31 = ptr;
  D.17318 = *ptr.31;
  D.17319 = (unsigned int) value;
  D.17320 = D.17318 + D.17319;
  *ptr.31 = D.17320;
  ptr.32 = ptr;
  D.17322 = *ptr.32;
  D.17310 = (gint64) D.17322;
  return D.17310;
  <D.17307>:
  ptr.33 = ptr;
  D.17319 = (unsigned int) value;
  *ptr.33 = D.17319;
  D.17310 = value;
  return D.17310;
  <D.17305>:
  ptr64.34 = ptr64;
  if (ptr64.34 != 0B) goto <D.17325>; else goto <D.17326>;
  <D.17325>:
  if (do_incr != 0) goto <D.17327>; else goto <D.17328>;
  <D.17327>:
  ptr64.35 = ptr64;
  D.17330 = *ptr64.35;
  D.17331 = D.17330 + value;
  *ptr64.35 = D.17331;
  ptr64.36 = ptr64;
  D.17310 = *ptr64.36;
  return D.17310;
  <D.17328>:
  ptr64.37 = ptr64;
  *ptr64.37 = value;
  D.17310 = value;
  return D.17310;
  <D.17326>:
  D.17310 = 0;
  return D.17310;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.17335;
  unsigned int D.17336;

  D.17336 = __sync_add_and_fetch_4 (val, 1);
  D.17335 = (gint32) D.17336;
  return D.17335;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.17338;
  unsigned int D.17339;

  D.17339 = __sync_sub_and_fetch_4 (val, 1);
  D.17338 = (gint32) D.17339;
  return D.17338;
}


predef_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17341;
  short int D.17344;
  int D.17345;
  int D.17346;
  int D.17347;
  struct MonoPerfCounters * mono_perfcounters.38;
  unsigned int D.17349;
  long long int D.17350;
  MonoBoolean D.17351;
  unsigned int D.17353;
  long long int D.17354;
  unsigned int D.17355;
  long long int D.17356;
  long long unsigned int D.17358;
  long long int D.17359;
  long long unsigned int D.17360;
  long long int D.17361;
  unsigned int D.17362;
  long long int D.17363;
  unsigned int D.17364;
  long long int D.17365;
  unsigned int D.17367;
  long long int D.17368;
  unsigned int D.17369;
  long long int D.17370;
  unsigned int D.17371;
  long long int D.17372;
  unsigned int D.17373;
  long long int D.17374;
  int cat_id;
  int id;

  D.17341 = vtable->arg;
  cat_id = (int) D.17341;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17342>; else goto <D.17343>;
  <D.17342>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17343>:
  D.17344 = predef_categories[cat_id].first_counter;
  D.17345 = (int) D.17344;
  D.17346 = D.17345 + id;
  D.17347 = predef_counters[D.17346].type;
  sample->counterType = D.17347;
  switch (cat_id) <default: <D.17376>, case 3: <D.16582>, case 4: <D.16590>, case 5: <D.16579>, case 12: <D.16585>>
  <D.16579>:
  switch (id) <default: <D.17352>, case 0: <D.16580>>
  <D.16580>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17349 = mono_perfcounters.38->exceptions_thrown;
  D.17350 = (long long int) D.17349;
  sample->rawValue = D.17350;
  D.17351 = 1;
  return D.17351;
  <D.17352>:
  goto <D.16581>;
  <D.16582>:
  switch (id) <default: <D.17357>, case 0: <D.16583>, case 1: <D.16584>>
  <D.16583>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17353 = mono_perfcounters.38->aspnet_requests_queued;
  D.17354 = (long long int) D.17353;
  sample->rawValue = D.17354;
  D.17351 = 1;
  return D.17351;
  <D.16584>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17355 = mono_perfcounters.38->aspnet_requests;
  D.17356 = (long long int) D.17355;
  sample->rawValue = D.17356;
  D.17351 = 1;
  return D.17351;
  <D.17357>:
  goto <D.16581>;
  <D.16585>:
  switch (id) <default: <D.17366>, case 0: <D.16586>, case 2: <D.16587>, case 4: <D.16588>, case 5: <D.16589>>
  <D.16586>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17358 = mono_perfcounters.38->threadpool_workitems;
  D.17359 = (long long int) D.17358;
  sample->rawValue = D.17359;
  D.17351 = 1;
  return D.17351;
  <D.16587>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17360 = mono_perfcounters.38->threadpool_ioworkitems;
  D.17361 = (long long int) D.17360;
  sample->rawValue = D.17361;
  D.17351 = 1;
  return D.17351;
  <D.16588>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17362 = mono_perfcounters.38->threadpool_threads;
  D.17363 = (long long int) D.17362;
  sample->rawValue = D.17363;
  D.17351 = 1;
  return D.17351;
  <D.16589>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17364 = mono_perfcounters.38->threadpool_iothreads;
  D.17365 = (long long int) D.17364;
  sample->rawValue = D.17365;
  D.17351 = 1;
  return D.17351;
  <D.17366>:
  goto <D.16581>;
  <D.16590>:
  switch (id) <default: <D.17375>, case 0: <D.16591>, case 1: <D.16592>, case 2: <D.16593>, case 3: <D.16594>, case 4: <D.16595>>
  <D.16591>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17367 = mono_perfcounters.38->jit_bytes;
  D.17368 = (long long int) D.17367;
  sample->rawValue = D.17368;
  D.17351 = 1;
  return D.17351;
  <D.16592>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17369 = mono_perfcounters.38->jit_methods;
  D.17370 = (long long int) D.17369;
  sample->rawValue = D.17370;
  D.17351 = 1;
  return D.17351;
  <D.16593>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17371 = mono_perfcounters.38->jit_time;
  D.17372 = (long long int) D.17371;
  sample->rawValue = D.17372;
  D.17351 = 1;
  return D.17351;
  <D.16594>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17367 = mono_perfcounters.38->jit_bytes;
  D.17368 = (long long int) D.17367;
  sample->rawValue = D.17368;
  D.17351 = 1;
  return D.17351;
  <D.16595>:
  mono_perfcounters.38 = mono_perfcounters;
  D.17373 = mono_perfcounters.38->jit_failures;
  D.17374 = (long long int) D.17373;
  sample->rawValue = D.17374;
  D.17351 = 1;
  return D.17351;
  <D.17375>:
  goto <D.16581>;
  <D.17376>:
  <D.16581>:
  D.17351 = 0;
  return D.17351;
}


predef_vtable (void * arg, struct MonoString * instance)
{
  struct ImplVtable * D.17380;
  short unsigned int D.17381;
  sizetype D.17382;
  struct MonoPerfCounters * D.17383;
  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.17378>; else goto <D.17379>;
  <D.17378>:
  D.17380 = 0B;
  return D.17380;
  <D.17379>:
  vtable = monoeg_malloc (24);
  vtable->vtable.arg = arg;
  vtable->vtable.sample = predef_readonly_counter;
  vtable->vtable.cleanup = predef_cleanup;
  D.17381 = area->counters_start;
  D.17382 = (sizetype) D.17381;
  D.17383 = area + D.17382;
  vtable->counters = D.17383;
  vtable->pid = pid;
  D.17380 = vtable;
  return D.17380;
}


predef_cleanup (struct ImplVtable * vtable)
{
  _Bool D.17387;
  long int D.17388;
  long int D.17389;
  struct GHashTable * pid_to_shared_area.39;
  _Bool D.17397;
  long int D.17398;
  long int D.17399;
  int D.17402;
  _Bool D.17405;
  long int D.17406;
  long int D.17407;
  struct PredefVtable * vt;

  vt = vtable;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17385>; else goto <D.17386>;
    <D.17385>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17386>:
    D.17387 = ret != 0;
    D.17388 = (long int) D.17387;
    D.17389 = __builtin_expect (D.17388, 0);
    if (D.17389 != 0) goto <D.17390>; else goto <D.17391>;
    <D.17390>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 389, "ret == 0");
    <D.17391>:
  }
  pid_to_shared_area.39 = pid_to_shared_area;
  if (pid_to_shared_area.39 == 0B) goto <D.17393>; else goto <D.17394>;
  <D.17393>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17395>; else goto <D.17396>;
    <D.17395>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17396>:
    D.17397 = ret != 0;
    D.17398 = (long int) D.17397;
    D.17399 = __builtin_expect (D.17398, 0);
    if (D.17399 != 0) goto <D.17400>; else goto <D.17401>;
    <D.17400>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 391, "ret == 0");
    <D.17401>:
  }
  return;
  <D.17394>:
  D.17402 = vt->pid;
  unref_pid_unlocked (D.17402);
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17403>; else goto <D.17404>;
    <D.17403>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17404>:
    D.17405 = ret != 0;
    D.17406 = (long int) D.17405;
    D.17407 = __builtin_expect (D.17406, 0);
    if (D.17407 != 0) goto <D.17408>; else goto <D.17409>;
    <D.17408>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 395, "ret == 0");
    <D.17409>:
  }
}


unref_pid_unlocked (int pid)
{
  struct GHashTable * pid_to_shared_area.40;
  const void * pid.41;
  int D.17415;
  int D.17416;
  void * D.17419;
  struct ExternalSArea * data;

  pid_to_shared_area.40 = pid_to_shared_area;
  pid.41 = (const void *) pid;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.40, pid.41);
  if (data != 0B) goto <D.17413>; else goto <D.17414>;
  <D.17413>:
  D.17415 = data->refcount;
  D.17416 = D.17415 + -1;
  data->refcount = D.17416;
  D.17415 = data->refcount;
  if (D.17415 == 0) goto <D.17417>; else goto <D.17418>;
  <D.17417>:
  pid_to_shared_area.40 = pid_to_shared_area;
  pid.41 = (const void *) pid;
  monoeg_g_hash_table_remove (pid_to_shared_area.40, pid.41);
  D.17419 = data->sarea;
  mono_shared_area_unload (D.17419);
  monoeg_g_free (data);
  <D.17418>:
  <D.17414>:
}


predef_readonly_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17420;
  short int D.17423;
  int D.17424;
  int D.17425;
  int D.17426;
  struct MonoPerfCounters * D.17427;
  short unsigned int D.17428;
  sizetype D.17429;
  guint32 * D.17430;
  unsigned int D.17431;
  long long int D.17432;
  MonoBoolean D.17433;
  struct PredefVtable * vt;
  const struct CounterDesc * desc;
  int cat_id;
  int id;

  vt = vtable;
  D.17420 = vtable->arg;
  cat_id = (int) D.17420;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17421>; else goto <D.17422>;
  <D.17421>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17422>:
  D.17423 = predef_categories[cat_id].first_counter;
  D.17424 = (int) D.17423;
  D.17425 = D.17424 + id;
  desc = &predef_counters[D.17425];
  D.17426 = desc->type;
  sample->counterType = D.17426;
  D.17427 = vt->counters;
  D.17428 = desc->offset;
  D.17429 = (sizetype) D.17428;
  D.17430 = D.17427 + D.17429;
  D.17431 = *D.17430;
  D.17432 = (long long int) D.17431;
  sample->rawValue = D.17432;
  D.17433 = 1;
  return D.17433;
}


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

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


load_sarea_for_pid (int pid)
{
  _Bool D.17439;
  long int D.17440;
  long int D.17441;
  struct GHashTable * pid_to_shared_area.42;
  struct GHashTable * pid_to_shared_area.43;
  const void * pid.44;
  void * pid.45;
  int D.17455;
  int D.17456;
  _Bool D.17459;
  long int D.17460;
  long int D.17461;
  struct MonoSharedArea * D.17464;
  struct ExternalSArea * data;
  struct MonoSharedArea * area;

  area = 0B;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17437>; else goto <D.17438>;
    <D.17437>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17438>:
    D.17439 = ret != 0;
    D.17440 = (long int) D.17439;
    D.17441 = __builtin_expect (D.17440, 0);
    if (D.17441 != 0) goto <D.17442>; else goto <D.17443>;
    <D.17442>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 348, "ret == 0");
    <D.17443>:
  }
  pid_to_shared_area.42 = pid_to_shared_area;
  if (pid_to_shared_area.42 == 0B) goto <D.17445>; else goto <D.17446>;
  <D.17445>:
  pid_to_shared_area.43 = monoeg_g_hash_table_new (0B, 0B);
  pid_to_shared_area = pid_to_shared_area.43;
  <D.17446>:
  pid_to_shared_area.42 = pid_to_shared_area;
  pid.44 = (const void *) pid;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.42, pid.44);
  if (data == 0B) goto <D.17449>; else goto <D.17450>;
  <D.17449>:
  pid.45 = (void *) pid;
  area = mono_shared_area_for_pid (pid.45);
  if (area != 0B) goto <D.17452>; else goto <D.17453>;
  <D.17452>:
  data = monoeg_malloc (8);
  data->sarea = area;
  data->refcount = 1;
  pid_to_shared_area.42 = pid_to_shared_area;
  pid.45 = (void *) pid;
  monoeg_g_hash_table_insert_replace (pid_to_shared_area.42, pid.45, data, 0);
  <D.17453>:
  goto <D.17454>;
  <D.17450>:
  area = data->sarea;
  D.17455 = data->refcount;
  D.17456 = D.17455 + 1;
  data->refcount = D.17456;
  <D.17454>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17457>; else goto <D.17458>;
    <D.17457>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17458>:
    D.17459 = ret != 0;
    D.17460 = (long int) D.17459;
    D.17461 = __builtin_expect (D.17460, 0);
    if (D.17461 != 0) goto <D.17462>; else goto <D.17463>;
    <D.17462>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 364, "ret == 0");
    <D.17463>:
  }
  D.17464 = area;
  return D.17464;
}


mono_perfcounter_get_sample (void * impl, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  MonoBoolean (*<T2acc>) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) D.17468;
  MonoBoolean D.17471;
  int D.17472;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17466>; else goto <D.17467>;
  <D.17466>:
  D.17468 = vtable->sample;
  if (D.17468 != 0B) goto <D.17469>; else goto <D.17470>;
  <D.17469>:
  D.17468 = vtable->sample;
  D.17472 = (int) only_value;
  D.17471 = D.17468 (vtable, D.17472, sample);
  return D.17471;
  <D.17470>:
  <D.17467>:
  D.17471 = 0;
  return D.17471;
}


mono_perfcounter_update_value (void * impl, MonoBoolean do_incr, gint64 value)
{
  gint64 (*<T2ad1>) (struct ImplVtable *, MonoBoolean, gint64) D.17476;
  gint64 D.17479;
  int D.17480;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17474>; else goto <D.17475>;
  <D.17474>:
  D.17476 = vtable->update;
  if (D.17476 != 0B) goto <D.17477>; else goto <D.17478>;
  <D.17477>:
  D.17476 = vtable->update;
  D.17480 = (int) do_incr;
  D.17479 = D.17476 (vtable, D.17480, value);
  return D.17479;
  <D.17478>:
  <D.17475>:
  D.17479 = 0;
  return D.17479;
}


mono_perfcounter_free_data (void * impl)
{
  void (*<T2ad6>) (struct ImplVtable *) D.17484;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17482>; else goto <D.17483>;
  <D.17482>:
  D.17484 = vtable->cleanup;
  if (D.17484 != 0B) goto <D.17485>; else goto <D.17486>;
  <D.17485>:
  D.17484 = vtable->cleanup;
  D.17484 (vtable);
  <D.17486>:
  <D.17483>:
  monoeg_g_free (impl);
}


mono_perfcounter_category_del (struct MonoString * name)
{
  MonoBoolean D.17489;
  _Bool D.17492;
  long int D.17493;
  long int D.17494;
  int D.17500;
  _Bool D.17503;
  long int D.17504;
  long int D.17505;
  _Bool D.17510;
  long int D.17511;
  long int D.17512;
  const struct CategoryDesc * cdesc;
  struct SharedCategory * cat;

  cdesc = find_category (name);
  if (cdesc != 0B) goto <D.17487>; else goto <D.17488>;
  <D.17487>:
  D.17489 = 0;
  return D.17489;
  <D.17488>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17490>; else goto <D.17491>;
    <D.17490>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17491>:
    D.17492 = ret != 0;
    D.17493 = (long int) D.17492;
    D.17494 = __builtin_expect (D.17493, 0);
    if (D.17494 != 0) goto <D.17495>; else goto <D.17496>;
    <D.17495>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1304, "ret == 0");
    <D.17496>:
  }
  cat = find_custom_category (name);
  if (cat == 0B) goto <D.17497>; else goto <D.17499>;
  <D.17499>:
  D.17500 = cat->num_instances;
  if (D.17500 != 0) goto <D.17497>; else goto <D.17498>;
  <D.17497>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17501>; else goto <D.17502>;
    <D.17501>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17502>:
    D.17503 = ret != 0;
    D.17504 = (long int) D.17503;
    D.17505 = __builtin_expect (D.17504, 0);
    if (D.17505 != 0) goto <D.17506>; else goto <D.17507>;
    <D.17506>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1308, "ret == 0");
    <D.17507>:
  }
  D.17489 = 0;
  return D.17489;
  <D.17498>:
  cat->header.ftype = 68;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17508>; else goto <D.17509>;
    <D.17508>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17509>:
    D.17510 = ret != 0;
    D.17511 = (long int) D.17510;
    D.17512 = __builtin_expect (D.17511, 0);
    if (D.17512 != 0) goto <D.17513>; else goto <D.17514>;
    <D.17513>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1312, "ret == 0");
    <D.17514>:
  }
  D.17489 = 1;
  return D.17489;
}


mono_perfcounter_category_help (struct MonoString * category, struct MonoString * machine)
{
  int D.17516;
  struct MonoString * D.17519;
  struct MonoDomain * D.17524;
  char * D.17525;
  struct MonoDomain * D.17526;
  const char * D.17527;
  const struct CategoryDesc * cdesc;

  D.17516 = mono_string_compare_ascii (machine, ".");
  if (D.17516 != 0) goto <D.17517>; else goto <D.17518>;
  <D.17517>:
  D.17519 = 0B;
  return D.17519;
  <D.17518>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17520>; else goto <D.17521>;
  <D.17520>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17522>; else goto <D.17523>;
    <D.17522>:
    D.17519 = 0B;
    return D.17519;
    <D.17523>:
    D.17524 = mono_domain_get ();
    D.17525 = custom_category_help (scat);
    D.17519 = mono_string_new (D.17524, D.17525);
    return D.17519;
  }
  <D.17521>:
  D.17526 = mono_domain_get ();
  D.17527 = cdesc->help;
  D.17519 = mono_string_new (D.17526, D.17527);
  return D.17519;
}


custom_category_help (struct SharedCategory * cat)
{
  char * D.17529;
  char[1] * D.17530;
  unsigned int D.17531;
  sizetype D.17532;

  D.17530 = &cat->name;
  D.17531 = strlen (D.17530);
  D.17532 = D.17531 + 1;
  D.17529 = &cat->name[D.17532];
  return D.17529;
}


mono_perfcounter_category_exists (struct MonoString * counter, struct MonoString * category, struct MonoString * machine)
{
  int D.17534;
  MonoBoolean D.17537;
  struct SharedCounter * D.17544;
  _Bool D.17545;
  const struct CounterDesc * D.17548;
  const struct CategoryDesc * cdesc;

  D.17534 = mono_string_compare_ascii (machine, ".");
  if (D.17534 != 0) goto <D.17535>; else goto <D.17536>;
  <D.17535>:
  D.17537 = 0;
  return D.17537;
  <D.17536>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17538>; else goto <D.17539>;
  <D.17538>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17540>; else goto <D.17541>;
    <D.17540>:
    D.17537 = 0;
    return D.17537;
    <D.17541>:
    if (counter == 0B) goto <D.17542>; else goto <D.17543>;
    <D.17542>:
    D.17537 = 1;
    return D.17537;
    <D.17543>:
    D.17544 = find_custom_counter (scat, counter);
    D.17545 = D.17544 != 0B;
    D.17537 = (MonoBoolean) D.17545;
    return D.17537;
  }
  <D.17539>:
  if (counter == 0B) goto <D.17546>; else goto <D.17547>;
  <D.17546>:
  D.17537 = 1;
  return D.17537;
  <D.17547>:
  D.17548 = get_counter_in_category (cdesc, counter);
  if (D.17548 != 0B) goto <D.17549>; else goto <D.17550>;
  <D.17549>:
  D.17537 = 1;
  return D.17537;
  <D.17550>:
  D.17537 = 0;
  return D.17537;
}


mono_perfcounter_create (struct MonoString * category, struct MonoString * help, int type, struct MonoArray * items)
{
  unsigned int D.17552;
  int D.17553;
  int D.17555;
  unsigned int num_counters.46;
  unsigned int D.17558;
  unsigned int D.17559;
  unsigned int D.17560;
  unsigned int D.17561;
  unsigned int D.17562;
  unsigned int i.47;
  char * D.17564;
  unsigned int i.48;
  unsigned int D.17566;
  char * * D.17567;
  struct MonoString * D.17568;
  char * D.17569;
  int D.17570;
  sizetype i.49;
  sizetype D.17573;
  sizetype D.17574;
  char * * D.17575;
  struct MonoString * D.17576;
  char * D.17577;
  int D.17578;
  unsigned int size.50;
  unsigned int D.17581;
  unsigned int D.17582;
  char * * D.17583;
  char * D.17584;
  unsigned int D.17586;
  unsigned int size.51;
  unsigned int D.17588;
  unsigned int D.17589;
  int D.17590;
  _Bool D.17594;
  long int D.17595;
  long int D.17596;
  _Bool D.17603;
  long int D.17604;
  long int D.17605;
  unsigned char D.17608;
  short unsigned int D.17609;
  short unsigned int D.17610;
  short unsigned int D.17611;
  unsigned int D.17612;
  sizetype D.17613;
  unsigned int D.17614;
  sizetype D.17615;
  char * D.17616;
  char * p.52;
  int D.17618;
  int D.17619;
  char D.17620;
  char * p.53;
  char D.17622;
  char * D.17623;
  unsigned int D.17624;
  sizetype D.17625;
  char * D.17626;
  unsigned int D.17627;
  sizetype D.17628;
  _Bool D.17631;
  long int D.17632;
  long int D.17633;
  MonoBoolean D.17638;
  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.17552 = mono_array_length (items);
      num_counters = (int) D.17552;
      name = 0B;
      chelp = 0B;
      counter_info = 0B;
      mono_error_init (&error);
      name = mono_string_to_utf8_checked (category, &error);
      D.17553 = mono_error_ok (&error);
      if (D.17553 == 0) goto failure; else goto <D.17554>;
      <D.17554>:
      chelp = mono_string_to_utf8_checked (help, &error);
      D.17555 = mono_error_ok (&error);
      if (D.17555 == 0) goto failure; else goto <D.17556>;
      <D.17556>:
      num_counters.46 = (unsigned int) num_counters;
      D.17558 = num_counters.46 * 8;
      counter_info = monoeg_malloc0 (D.17558);
      D.17559 = strlen (name);
      D.17560 = strlen (chelp);
      D.17561 = D.17559 + D.17560;
      D.17562 = D.17561 + 14;
      size = (int) D.17562;
      i = 0;
      goto <D.16760>;
      <D.16759>:
      {
        struct CounterCreationData * data;

        i.47 = (unsigned int) i;
        D.17564 = mono_array_addr_with_size (items, 4, i.47);
        data = MEM[(struct CounterCreationData * *)D.17564];
        i.48 = (unsigned int) i;
        D.17566 = i.48 * 8;
        D.17567 = counter_info + D.17566;
        D.17568 = data->name;
        D.17569 = mono_string_to_utf8_checked (D.17568, &error);
        *D.17567 = D.17569;
        D.17570 = mono_error_ok (&error);
        if (D.17570 == 0) goto failure; else goto <D.17571>;
        <D.17571>:
        i.49 = (sizetype) i;
        D.17573 = i.49 * 8;
        D.17574 = D.17573 + 4;
        D.17575 = counter_info + D.17574;
        D.17576 = data->help;
        D.17577 = mono_string_to_utf8_checked (D.17576, &error);
        *D.17575 = D.17577;
        D.17578 = mono_error_ok (&error);
        if (D.17578 == 0) goto failure; else goto <D.17579>;
        <D.17579>:
        size.50 = (unsigned int) size;
        D.17581 = size.50 + 4;
        size = (int) D.17581;
      }
      i = i + 1;
      <D.16760>:
      if (i < num_counters) goto <D.16759>; else goto <D.16761>;
      <D.16761>:
      i = 0;
      goto <D.16763>;
      <D.16762>:
      i.48 = (unsigned int) i;
      D.17582 = i.48 * 4;
      D.17583 = counter_info + D.17582;
      D.17584 = *D.17583;
      if (D.17584 == 0B) goto failure; else goto <D.17585>;
      <D.17585>:
      i.48 = (unsigned int) i;
      D.17582 = i.48 * 4;
      D.17583 = counter_info + D.17582;
      D.17584 = *D.17583;
      D.17586 = strlen (D.17584);
      size.51 = (unsigned int) size;
      D.17588 = D.17586 + size.51;
      D.17589 = D.17588 + 1;
      size = (int) D.17589;
      i = i + 1;
      <D.16763>:
      D.17590 = num_counters * 2;
      if (D.17590 > i) goto <D.16762>; else goto <D.16764>;
      <D.16764>:
      size = size + 7;
      size = size & -8;
      counters_data_size = num_counters * 8;
      if (size > 65535) goto failure; else goto <D.17591>;
      <D.17591>:
      {
        int ret;

        ret = pthread_mutex_lock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17592>; else goto <D.17593>;
        <D.17592>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.17593>:
        D.17594 = ret != 0;
        D.17595 = (long int) D.17594;
        D.17596 = __builtin_expect (D.17595, 0);
        if (D.17596 != 0) goto <D.17597>; else goto <D.17598>;
        <D.17597>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1421, "ret == 0");
        <D.17598>:
      }
      ptr = shared_data_find_room (size);
      if (ptr == 0B) goto <D.17599>; else goto <D.17600>;
      <D.17599>:
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17601>; else goto <D.17602>;
        <D.17601>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.17602>:
        D.17603 = ret != 0;
        D.17604 = (long int) D.17603;
        D.17605 = __builtin_expect (D.17604, 0);
        if (D.17605 != 0) goto <D.17606>; else goto <D.17607>;
        <D.17606>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1424, "ret == 0");
        <D.17607>:
      }
      goto failure;
      <D.17600>:
      cat = ptr;
      D.17608 = (unsigned char) type;
      cat->header.extra = D.17608;
      D.17609 = (short unsigned int) size;
      cat->header.size = D.17609;
      D.17610 = (short unsigned int) num_counters;
      cat->num_counters = D.17610;
      D.17611 = (short unsigned int) counters_data_size;
      cat->counters_data_size = D.17611;
      p = &cat->name;
      strcpy (p, name);
      D.17612 = strlen (name);
      D.17613 = D.17612 + 1;
      p = p + D.17613;
      strcpy (p, chelp);
      D.17614 = strlen (chelp);
      D.17615 = D.17614 + 1;
      p = p + D.17615;
      i = 0;
      goto <D.16769>;
      <D.16768>:
      {
        struct CounterCreationData * data;

        i.47 = (unsigned int) i;
        D.17616 = mono_array_addr_with_size (items, 4, i.47);
        data = MEM[(struct CounterCreationData * *)D.17616];
        p.52 = p;
        p = p.52 + 1;
        D.17618 = data->type;
        D.17619 = perfctr_type_compress (D.17618);
        D.17620 = (char) D.17619;
        *p.52 = D.17620;
        p.53 = p;
        p = p.53 + 1;
        D.17622 = (char) i;
        *p.53 = D.17622;
        i.48 = (unsigned int) i;
        D.17566 = i.48 * 8;
        D.17567 = counter_info + D.17566;
        D.17623 = *D.17567;
        strcpy (p, D.17623);
        i.48 = (unsigned int) i;
        D.17566 = i.48 * 8;
        D.17567 = counter_info + D.17566;
        D.17623 = *D.17567;
        D.17624 = strlen (D.17623);
        D.17625 = D.17624 + 1;
        p = p + D.17625;
        i.49 = (sizetype) i;
        D.17573 = i.49 * 8;
        D.17574 = D.17573 + 4;
        D.17575 = counter_info + D.17574;
        D.17626 = *D.17575;
        strcpy (p, D.17626);
        i.49 = (sizetype) i;
        D.17573 = i.49 * 8;
        D.17574 = D.17573 + 4;
        D.17575 = counter_info + D.17574;
        D.17626 = *D.17575;
        D.17627 = strlen (D.17626);
        D.17628 = D.17627 + 1;
        p = p + D.17628;
      }
      i = i + 1;
      <D.16769>:
      if (i < num_counters) goto <D.16768>; else goto <D.16770>;
      <D.16770>:
      cat->header.ftype = 67;
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17629>; else goto <D.17630>;
        <D.17629>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.17630>:
        D.17631 = ret != 0;
        D.17632 = (long int) D.17631;
        D.17633 = __builtin_expect (D.17632, 0);
        if (D.17633 != 0) goto <D.17634>; else goto <D.17635>;
        <D.17634>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1450, "ret == 0");
        <D.17635>:
      }
      result = 1;
      failure:
      if (counter_info != 0B) goto <D.17636>; else goto <D.17637>;
      <D.17636>:
      i = 0;
      goto <D.16773>;
      <D.16772>:
      i.48 = (unsigned int) i;
      D.17582 = i.48 * 4;
      D.17583 = counter_info + D.17582;
      D.17584 = *D.17583;
      monoeg_g_free (D.17584);
      i = i + 1;
      <D.16773>:
      D.17590 = num_counters * 2;
      if (D.17590 > i) goto <D.16772>; else goto <D.16774>;
      <D.16774>:
      monoeg_g_free (counter_info);
      <D.17637>:
      monoeg_g_free (name);
      monoeg_g_free (chelp);
      mono_error_cleanup (&error);
      D.17638 = (MonoBoolean) result;
      return D.17638;
    }
  finally
    {
      error = {CLOBBER};
    }
}


perfctr_type_compress (int type)
{
  int D.17641;
  int D.17644;
  unsigned int i.54;
  int i;

  i = 0;
  goto <D.16353>;
  <D.16352>:
  D.17641 = simple_type_to_type[i];
  if (D.17641 == type) goto <D.17642>; else goto <D.17643>;
  <D.17642>:
  D.17644 = i;
  return D.17644;
  <D.17643>:
  i = i + 1;
  <D.16353>:
  i.54 = (unsigned int) i;
  if (i.54 <= 27) goto <D.16352>; else goto <D.16354>;
  <D.16354>:
  D.17644 = 2;
  return D.17644;
}


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

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

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17649>; else goto <D.17650>;
    <D.17649>:
    D.17651 = 0;
    return D.17651;
    <D.17650>:
    D.17652 = find_custom_instance (scat, instance);
    if (D.17652 != 0B) goto <D.17653>; else goto <D.17654>;
    <D.17653>:
    D.17651 = 1;
    return D.17651;
    <D.17654>:
  }
  goto <D.17655>;
  <D.17648>:
  <D.17655>:
  D.17651 = 0;
  return D.17651;
}


mono_perfcounter_category_names (struct MonoString * machine)
{
  int D.17657;
  struct MonoArray * D.17660;
  struct MonoClass * D.17661;
  _Bool D.17664;
  long int D.17665;
  long int D.17666;
  struct MonoClass * D.17669;
  unsigned int D.17670;
  unsigned int D.17671;
  unsigned int i.55;
  const char * D.17673;
  struct MonoString * D.17674;
  char[1] * D.17675;
  struct MonoString * D.17676;
  _Bool D.17679;
  long int D.17680;
  long int D.17681;
  int i;
  struct MonoArray * res;
  struct MonoDomain * domain;
  struct GSList * custom_categories;
  struct GSList * tmp;

  domain = mono_domain_get ();
  D.17657 = mono_string_compare_ascii (machine, ".");
  if (D.17657 != 0) goto <D.17658>; else goto <D.17659>;
  <D.17658>:
  D.17661 = mono_get_string_class ();
  D.17660 = mono_array_new (domain, D.17661, 0);
  return D.17660;
  <D.17659>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17662>; else goto <D.17663>;
    <D.17662>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17663>:
    D.17664 = ret != 0;
    D.17665 = (long int) D.17664;
    D.17666 = __builtin_expect (D.17665, 0);
    if (D.17666 != 0) goto <D.17667>; else goto <D.17668>;
    <D.17667>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1497, "ret == 0");
    <D.17668>:
  }
  custom_categories = get_custom_categories ();
  D.17669 = mono_get_string_class ();
  D.17670 = monoeg_g_slist_length (custom_categories);
  D.17671 = D.17670 + 14;
  res = mono_array_new (domain, D.17669, D.17671);
  i = 0;
  goto <D.16794>;
  <D.16793>:
  {
    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.17673 = cdesc->name;
      D.17674 = mono_string_new (domain, D.17673);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17674);
    }
  }
  i = i + 1;
  <D.16794>:
  if (i <= 13) goto <D.16793>; else goto <D.16795>;
  <D.16795>:
  tmp = custom_categories;
  goto <D.16799>;
  <D.16798>:
  {
    struct SharedCategory * scat;

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

      i.55 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.55);
      D.17675 = &scat->name;
      D.17676 = mono_string_new (domain, D.17675);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17676);
    }
    i = i + 1;
  }
  tmp = tmp->next;
  <D.16799>:
  if (tmp != 0B) goto <D.16798>; else goto <D.16800>;
  <D.16800>:
  {
    int ret;

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


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

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


category_collect (struct SharedHeader * header, void * data)
{
  unsigned char D.17688;
  struct GSList * D.17691;
  struct GSList * D.17692;
  gboolean D.17693;
  struct GSList * * list;

  list = data;
  D.17688 = header->ftype;
  if (D.17688 == 67) goto <D.17689>; else goto <D.17690>;
  <D.17689>:
  D.17691 = *list;
  D.17692 = monoeg_g_slist_prepend (D.17691, header);
  *list = D.17692;
  <D.17690>:
  D.17693 = 1;
  return D.17693;
}


mono_perfcounter_counter_names (struct MonoString * category, struct MonoString * machine)
{
  int D.17695;
  struct MonoArray * D.17698;
  struct MonoClass * D.17699;
  struct MonoClass * D.17702;
  const struct CategoryDesc * D.17703;
  short int D.17704;
  int D.17705;
  short int D.17706;
  int D.17707;
  int D.17708;
  unsigned int D.17709;
  int D.17710;
  unsigned int D.17711;
  const char * D.17712;
  struct MonoString * D.17713;
  _Bool D.17716;
  long int D.17717;
  long int D.17718;
  struct MonoClass * D.17723;
  short unsigned int D.17724;
  unsigned int D.17725;
  unsigned int i.56;
  const char * D.17727;
  struct MonoString * D.17728;
  unsigned int D.17729;
  sizetype D.17730;
  unsigned int D.17731;
  sizetype D.17732;
  int D.17733;
  _Bool D.17736;
  long int D.17737;
  long int D.17738;
  _Bool D.17743;
  long int D.17744;
  long int D.17745;
  struct MonoClass * D.17748;
  int i;
  struct SharedCategory * scat;
  const struct CategoryDesc * cdesc;
  struct MonoArray * res;
  struct MonoDomain * domain;

  domain = mono_domain_get ();
  D.17695 = mono_string_compare_ascii (machine, ".");
  if (D.17695 != 0) goto <D.17696>; else goto <D.17697>;
  <D.17696>:
  D.17699 = mono_get_string_class ();
  D.17698 = mono_array_new (domain, D.17699, 0);
  return D.17698;
  <D.17697>:
  cdesc = find_category (category);
  if (cdesc != 0B) goto <D.17700>; else goto <D.17701>;
  <D.17700>:
  D.17702 = mono_get_string_class ();
  D.17703 = cdesc + 12;
  D.17704 = D.17703->first_counter;
  D.17705 = (int) D.17704;
  D.17706 = cdesc->first_counter;
  D.17707 = (int) D.17706;
  D.17708 = D.17705 - D.17707;
  D.17709 = (unsigned int) D.17708;
  res = mono_array_new (domain, D.17702, D.17709);
  D.17706 = cdesc->first_counter;
  i = (int) D.17706;
  goto <D.16814>;
  <D.16813>:
  {
    const struct CounterDesc * desc;

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

      D.17706 = cdesc->first_counter;
      D.17707 = (int) D.17706;
      D.17710 = i - D.17707;
      D.17711 = (unsigned int) D.17710;
      __p = mono_array_addr_with_size (res, 4, D.17711);
      D.17712 = desc->name;
      D.17713 = mono_string_new (domain, D.17712);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17713);
    }
  }
  i = i + 1;
  <D.16814>:
  D.17703 = cdesc + 12;
  D.17704 = D.17703->first_counter;
  D.17705 = (int) D.17704;
  if (D.17705 > i) goto <D.16813>; else goto <D.16815>;
  <D.16815>:
  D.17698 = res;
  return D.17698;
  <D.17701>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17714>; else goto <D.17715>;
    <D.17714>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17715>:
    D.17716 = ret != 0;
    D.17717 = (long int) D.17716;
    D.17718 = __builtin_expect (D.17717, 0);
    if (D.17718 != 0) goto <D.17719>; else goto <D.17720>;
    <D.17719>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1534, "ret == 0");
    <D.17720>:
  }
  scat = find_custom_category (category);
  if (scat != 0B) goto <D.17721>; else goto <D.17722>;
  <D.17721>:
  {
    char * p;
    int i;

    p = custom_category_counters (scat);
    D.17723 = mono_get_string_class ();
    D.17724 = scat->num_counters;
    D.17725 = (unsigned int) D.17724;
    res = mono_array_new (domain, D.17723, D.17725);
    i = 0;
    goto <D.16821>;
    <D.16820>:
    {
      void * * __p;

      i.56 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.56);
      D.17727 = p + 1;
      D.17728 = mono_string_new (domain, D.17727);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17728);
    }
    D.17727 = p + 1;
    D.17729 = strlen (D.17727);
    D.17730 = D.17729 + 2;
    p = p + D.17730;
    D.17731 = strlen (p);
    D.17732 = D.17731 + 1;
    p = p + D.17732;
    i = i + 1;
    <D.16821>:
    D.17724 = scat->num_counters;
    D.17733 = (int) D.17724;
    if (D.17733 > i) goto <D.16820>; else goto <D.16822>;
    <D.16822>:
    {
      int ret;

      ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
      if (ret != 0) goto <D.17734>; else goto <D.17735>;
      <D.17734>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.17735>:
      D.17736 = ret != 0;
      D.17737 = (long int) D.17736;
      D.17738 = __builtin_expect (D.17737, 0);
      if (D.17738 != 0) goto <D.17739>; else goto <D.17740>;
      <D.17739>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1545, "ret == 0");
      <D.17740>:
    }
    D.17698 = res;
    return D.17698;
  }
  <D.17722>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17741>; else goto <D.17742>;
    <D.17741>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17742>:
    D.17743 = ret != 0;
    D.17744 = (long int) D.17743;
    D.17745 = __builtin_expect (D.17744, 0);
    if (D.17745 != 0) goto <D.17746>; else goto <D.17747>;
    <D.17746>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1548, "ret == 0");
    <D.17747>:
  }
  D.17748 = mono_get_string_class ();
  D.17698 = mono_array_new (domain, D.17748, 0);
  return D.17698;
}


mono_perfcounter_instance_names (struct MonoString * category, struct MonoString * machine)
{
  int D.17750;
  struct MonoArray * D.17753;
  struct MonoDomain * D.17754;
  struct MonoClass * D.17755;
  <unnamed-unsigned:6> D.17758;
  int D.17759;
  struct MonoDomain * D.17760;
  struct MonoClass * D.17761;
  const struct CategoryDesc * cat;

  D.17750 = mono_string_compare_ascii (machine, ".");
  if (D.17750 != 0) goto <D.17751>; else goto <D.17752>;
  <D.17751>:
  D.17754 = mono_domain_get ();
  D.17755 = mono_get_string_class ();
  D.17753 = mono_array_new (D.17754, D.17755, 0);
  return D.17753;
  <D.17752>:
  cat = find_category (category);
  if (cat == 0B) goto <D.17756>; else goto <D.17757>;
  <D.17756>:
  D.17753 = get_custom_instances (category);
  return D.17753;
  <D.17757>:
  D.17758 = cat->instance_type;
  D.17759 = (int) D.17758;
  switch (D.17759) <default: <D.16907>, case 0: <D.16904>, case 1: <D.16906>, case 2: <D.16903>, case 3: <D.16902>, case 4: <D.16905>>
  <D.16902>:
  D.17753 = get_mono_instances ();
  return D.17753;
  <D.16903>:
  D.17753 = get_cpu_instances ();
  return D.17753;
  <D.16904>:
  D.17753 = get_processes_instances ();
  return D.17753;
  <D.16905>:
  D.17753 = get_networkinterface_instances ();
  return D.17753;
  <D.16906>:
  <D.16907>:
  D.17760 = mono_domain_get ();
  D.17761 = mono_get_string_class ();
  D.17753 = mono_array_new (D.17760, D.17761, 0);
  return D.17753;
}


get_custom_instances (struct MonoString * category)
{
  struct MonoDomain * D.17765;
  struct MonoClass * D.17766;
  unsigned int D.17767;
  unsigned int i.57;
  struct MonoDomain * D.17769;
  char[1] * D.17770;
  struct MonoString * D.17771;
  struct MonoArray * D.17772;
  struct MonoDomain * D.17773;
  struct MonoClass * D.17774;
  struct SharedCategory * scat;

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

    list = get_custom_instances_list (scat);
    i = 0;
    D.17765 = mono_domain_get ();
    D.17766 = mono_get_string_class ();
    D.17767 = monoeg_g_slist_length (list);
    array = mono_array_new (D.17765, D.17766, D.17767);
    tmp = list;
    goto <D.16895>;
    <D.16894>:
    {
      struct SharedInstance * inst;

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

        i.57 = (unsigned int) i;
        __p = mono_array_addr_with_size (array, 4, i.57);
        D.17769 = mono_domain_get ();
        D.17770 = &inst->instance_name;
        D.17771 = mono_string_new (D.17769, D.17770);
        mono_gc_wbarrier_set_arrayref (array, __p, D.17771);
      }
      i = i + 1;
    }
    tmp = tmp->next;
    <D.16895>:
    if (tmp != 0B) goto <D.16894>; else goto <D.16896>;
    <D.16896>:
    monoeg_g_slist_free (list);
    D.17772 = array;
    return D.17772;
  }
  <D.17764>:
  D.17773 = mono_domain_get ();
  D.17774 = mono_get_string_class ();
  D.17772 = mono_array_new (D.17773, D.17774, 0);
  return D.17772;
}


get_custom_instances_list (struct SharedCategory * cat)
{
  int cat.58;
  struct MonoSharedArea * shared_area.59;
  int shared_area.60;
  int D.17779;
  unsigned int D.17780;
  struct GSList * D.17781;
  struct InstanceSearch search;

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


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

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


get_string_array (void * * array, int count, gboolean is_process)
{
  struct MonoDomain * D.17788;
  struct MonoClass * D.17789;
  unsigned int count.62;
  unsigned int i.63;
  unsigned int D.17794;
  void * * D.17795;
  void * D.17796;
  int D.17797;
  unsigned int i.64;
  struct MonoString * D.17800;
  struct MonoArray * D.17803;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.17788 = mono_domain_get ();
  D.17789 = mono_get_string_class ();
  count.62 = (unsigned int) count;
  res = mono_array_new (D.17788, D.17789, count.62);
  i = 0;
  goto <D.16838>;
  <D.16837>:
  {
    char buf[128];
    char * p;

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

          i.63 = (unsigned int) i;
          D.17794 = i.63 * 4;
          D.17795 = array + D.17794;
          D.17796 = *D.17795;
          pname = mono_process_get_name (D.17796, &buf, 128);
          i.63 = (unsigned int) i;
          D.17794 = i.63 * 4;
          D.17795 = array + D.17794;
          D.17796 = *D.17795;
          D.17797 = (int) D.17796;
          p = monoeg_g_strdup_printf ("%d/%s", D.17797, pname);
        }
        goto <D.17798>;
        <D.17792>:
        i.63 = (unsigned int) i;
        D.17794 = i.63 * 4;
        D.17795 = array + D.17794;
        D.17796 = *D.17795;
        D.17797 = (int) D.17796;
        sprintf (&buf, "%d", D.17797);
        p = &buf;
        <D.17798>:
        {
          void * * __p;

          i.64 = (unsigned int) i;
          __p = mono_array_addr_with_size (res, 4, i.64);
          D.17800 = mono_string_new (domain, p);
          mono_gc_wbarrier_set_arrayref (res, __p, D.17800);
        }
        if (&buf != p) goto <D.17801>; else goto <D.17802>;
        <D.17801>:
        monoeg_g_free (p);
        <D.17802>:
      }
    finally
      {
        buf = {CLOBBER};
      }
  }
  i = i + 1;
  <D.16838>:
  if (i < count) goto <D.16837>; else goto <D.16839>;
  <D.16839>:
  D.17803 = res;
  return D.17803;
}


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

  D.17806 = __builtin_object_size (__s, 1);
  D.17805 = __builtin___sprintf_chk (__s, 1, D.17806, __fmt, __builtin_va_arg_pack ());
  return D.17805;
}


get_cpu_instances ()
{
  int D.17808;
  unsigned int count.65;
  unsigned int D.17810;
  unsigned int i.66;
  unsigned int D.17812;
  void * * D.17813;
  int D.17814;
  void * D.17815;
  struct MonoDomain * D.17816;
  struct MonoString * D.17817;
  struct MonoArray * D.17818;
  void * * buf;
  int i;
  int count;
  struct MonoArray * array;

  buf = 0B;
  D.17808 = mono_cpu_count ();
  count = D.17808 + 1;
  count.65 = (unsigned int) count;
  D.17810 = count.65 * 4;
  buf = monoeg_malloc (D.17810);
  i = 0;
  goto <D.16869>;
  <D.16868>:
  i.66 = (unsigned int) i;
  D.17812 = i.66 * 4;
  D.17813 = buf + D.17812;
  D.17814 = i + -1;
  D.17815 = (void *) D.17814;
  *D.17813 = D.17815;
  i = i + 1;
  <D.16869>:
  if (i < count) goto <D.16868>; else goto <D.16870>;
  <D.16870>:
  array = get_string_array (buf, count, 0);
  monoeg_g_free (buf);
  {
    void * * __p;

    __p = mono_array_addr_with_size (array, 4, 0);
    D.17816 = mono_domain_get ();
    D.17817 = mono_string_new (D.17816, "_Total");
    mono_gc_wbarrier_set_arrayref (array, __p, D.17817);
  }
  D.17818 = array;
  return D.17818;
}


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

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


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

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


get_string_array_of_strings (void * * array, int count)
{
  struct MonoDomain * D.17832;
  struct MonoClass * D.17833;
  unsigned int count.69;
  unsigned int i.70;
  unsigned int D.17836;
  void * * D.17837;
  unsigned int i.71;
  struct MonoString * D.17839;
  struct MonoArray * D.17840;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.17832 = mono_domain_get ();
  D.17833 = mono_get_string_class ();
  count.69 = (unsigned int) count;
  res = mono_array_new (D.17832, D.17833, count.69);
  i = 0;
  goto <D.16850>;
  <D.16849>:
  {
    char * p;

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

      i.71 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.71);
      D.17839 = mono_string_new (domain, p);
      mono_gc_wbarrier_set_arrayref (res, __p, D.17839);
    }
  }
  i = i + 1;
  <D.16850>:
  if (i < count) goto <D.16849>; else goto <D.16851>;
  <D.16851>:
  D.17840 = res;
  return D.17840;
}


