mono_perfcounters_init ()
{
  void * shared_area.0;
  struct MonoSharedArea * shared_area.1;
  short unsigned int D.17825;
  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.17825 = (short unsigned int) d_offset;
  shared_area.1->data_start = D.17825;
  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.17827;
  void * D.17830;
  unsigned char D.17835;
  int D.17836;
  const struct CategoryDesc * cdesc;

  D.17827 = mono_string_compare_ascii (machine, ".");
  if (D.17827 != 0) goto <D.17828>; else goto <D.17829>;
  <D.17828>:
  D.17830 = 0B;
  return D.17830;
  <D.17829>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17831>; else goto <D.17832>;
  <D.17831>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17833>; else goto <D.17834>;
    <D.17833>:
    D.17830 = 0B;
    return D.17830;
    <D.17834>:
    *custom = 1;
    D.17830 = custom_get_impl (scat, counter, instance, type);
    return D.17830;
  }
  <D.17832>:
  D.17835 = cdesc->id;
  D.17836 = (int) D.17835;
  switch (D.17836) <default: <D.17837>, case 0: <D.17596>, case 1: <D.17597>, case 2: <D.17598>, case 3: <D.17608>, case 4: <D.17600>, case 5: <D.17601>, case 6: <D.17602>, case 7: <D.17603>, case 8: <D.17604>, case 9: <D.17605>, case 10: <D.17606>, case 11: <D.17607>, case 12: <D.17609>, case 13: <D.17599>>
  <D.17596>:
  D.17830 = cpu_get_impl (counter, instance, type, custom);
  return D.17830;
  <D.17597>:
  D.17830 = process_get_impl (counter, instance, type, custom);
  return D.17830;
  <D.17598>:
  D.17830 = mono_mem_get_impl (counter, instance, type, custom);
  return D.17830;
  <D.17599>:
  D.17830 = network_get_impl (counter, instance, type, custom);
  return D.17830;
  <D.17600>:
  <D.17601>:
  <D.17602>:
  <D.17603>:
  <D.17604>:
  <D.17605>:
  <D.17606>:
  <D.17607>:
  <D.17608>:
  <D.17609>:
  D.17835 = cdesc->id;
  D.17836 = (int) D.17835;
  D.17830 = predef_writable_get_impl (D.17836, counter, instance, type, custom);
  return D.17830;
  <D.17837>:
  D.17830 = 0B;
  return D.17830;
}


mono_string_compare_ascii (struct MonoString * str, const char * ascii_str)
{
  short unsigned int D.17839;
  int D.17842;
  const char * ascii_str.3;
  char D.17844;
  short unsigned int D.17845;
  int D.17846;
  const unsigned char * D.17847;
  unsigned char D.17848;
  int D.17849;
  guint16 * strc;

  strc = mono_string_chars (str);
  goto <D.17303>;
  <D.17302>:
  D.17839 = *strc;
  if (D.17839 == 0) goto <D.17840>; else goto <D.17841>;
  <D.17840>:
  D.17842 = 0;
  return D.17842;
  <D.17841>:
  strc = strc + 2;
  <D.17303>:
  D.17839 = *strc;
  ascii_str.3 = ascii_str;
  ascii_str = ascii_str.3 + 1;
  D.17844 = *ascii_str.3;
  D.17845 = (short unsigned int) D.17844;
  if (D.17839 == D.17845) goto <D.17302>; else goto <D.17304>;
  <D.17304>:
  D.17839 = *strc;
  D.17846 = (int) D.17839;
  D.17847 = ascii_str + 18446744073709551615;
  D.17848 = *D.17847;
  D.17849 = (int) D.17848;
  D.17842 = D.17846 - D.17849;
  return D.17842;
}


find_category (struct MonoString * category)
{
  const char * D.17851;
  int D.17852;
  const struct CategoryDesc * D.17855;
  int i;

  i = 0;
  goto <D.17584>;
  <D.17583>:
  D.17851 = predef_categories[i].name;
  D.17852 = mono_string_compare_ascii (category, D.17851);
  if (D.17852 == 0) goto <D.17853>; else goto <D.17854>;
  <D.17853>:
  D.17855 = &predef_categories[i];
  return D.17855;
  <D.17854>:
  i = i + 1;
  <D.17584>:
  if (i <= 13) goto <D.17583>; else goto <D.17585>;
  <D.17585>:
  D.17855 = 0B;
  return D.17855;
}


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

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


category_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17860;
  struct MonoString * D.17863;
  char[1] * D.17864;
  int D.17865;
  gboolean D.17868;
  struct CatSearch * search;

  search = data;
  D.17860 = header->ftype;
  if (D.17860 == 67) goto <D.17861>; else goto <D.17862>;
  <D.17861>:
  {
    struct SharedCategory * cat;

    cat = header;
    D.17863 = search->name;
    D.17864 = &cat->name;
    D.17865 = mono_string_compare_ascii (D.17863, D.17864);
    if (D.17865 == 0) goto <D.17866>; else goto <D.17867>;
    <D.17866>:
    search->cat = cat;
    D.17868 = 0;
    return D.17868;
    <D.17867>:
  }
  <D.17862>:
  D.17868 = 1;
  return D.17868;
}


foreach_shared_item (gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  struct MonoSharedArea * shared_area.4;
  short unsigned int D.17871;
  sizetype D.17872;
  int D.17873;
  sizetype D.17874;
  unsigned char * p;
  unsigned char * end;

  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.17871 = shared_area.4->data_start;
  D.17872 = (sizetype) D.17871;
  p = shared_area.4 + D.17872;
  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.17873 = shared_area.4->size;
  D.17874 = (sizetype) D.17873;
  end = shared_area.4 + D.17874;
  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.17875;
  int D.17878;
  unsigned char D.17881;
  short unsigned int D.17884;
  sizetype D.17885;

  goto <D.17289>;
  <D.17288>:
  {
    short unsigned int * next;

    D.17875 = p + 4;
    if (D.17875 > end) goto <D.17876>; else goto <D.17877>;
    <D.17876>:
    return;
    <D.17877>:
    next = p + 2;
    D.17878 = func (p, data);
    if (D.17878 == 0) goto <D.17879>; else goto <D.17880>;
    <D.17879>:
    return;
    <D.17880>:
    D.17881 = *p;
    if (D.17881 == 0) goto <D.17882>; else goto <D.17883>;
    <D.17882>:
    return;
    <D.17883>:
    D.17884 = *next;
    D.17885 = (sizetype) D.17884;
    p = p + D.17885;
  }
  <D.17289>:
  if (p < end) goto <D.17288>; else goto <D.17290>;
  <D.17290>:
}


custom_get_impl (struct SharedCategory * cat, struct MonoString * counter, struct MonoString * instance, int * type)
{
  void * D.17889;
  unsigned char D.17890;
  int D.17891;
  int D.17892;
  char[1] * D.17895;
  long unsigned int D.17896;
  unsigned int D.17897;
  unsigned int D.17898;
  sizetype D.17899;
  unsigned char D.17900;
  long unsigned int D.17901;
  long unsigned int D.17902;
  sizetype D.17903;
  char * D.17904;
  struct SharedCounter * scounter;
  struct SharedInstance * inst;
  int size;

  scounter = find_custom_counter (cat, counter);
  if (scounter == 0B) goto <D.17887>; else goto <D.17888>;
  <D.17887>:
  D.17889 = 0B;
  return D.17889;
  <D.17888>:
  D.17890 = scounter->type;
  D.17891 = (int) D.17890;
  D.17892 = simple_type_to_type[D.17891];
  *type = D.17892;
  inst = custom_get_instance (cat, scounter, instance);
  if (inst == 0B) goto <D.17893>; else goto <D.17894>;
  <D.17893>:
  D.17889 = 0B;
  return D.17889;
  <D.17894>:
  D.17895 = &inst->instance_name;
  D.17896 = strlen (D.17895);
  D.17897 = (unsigned int) D.17896;
  D.17898 = D.17897 + 12;
  size = (int) D.17898;
  size = size + 7;
  size = size & -8;
  D.17899 = (sizetype) size;
  D.17900 = scounter->seq_num;
  D.17901 = (long unsigned int) D.17900;
  D.17902 = D.17901 * 8;
  D.17903 = D.17899 + D.17902;
  D.17904 = inst + D.17903;
  D.17889 = custom_vtable (scounter, inst, D.17904);
  return D.17889;
}


find_custom_counter (struct SharedCategory * cat, struct MonoString * name)
{
  char[1] * D.17906;
  int D.17907;
  struct SharedCounter * D.17910;
  const char * D.17911;
  long unsigned int D.17912;
  sizetype D.17913;
  long unsigned int D.17914;
  sizetype D.17915;
  short unsigned int D.17916;
  int D.17917;
  int i;
  char * p;

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

    counter = p;
    D.17906 = &counter->name;
    D.17907 = mono_string_compare_ascii (name, D.17906);
    if (D.17907 == 0) goto <D.17908>; else goto <D.17909>;
    <D.17908>:
    D.17910 = counter;
    return D.17910;
    <D.17909>:
    D.17911 = p + 1;
    D.17912 = strlen (D.17911);
    D.17913 = D.17912 + 2;
    p = p + D.17913;
    D.17914 = strlen (p);
    D.17915 = D.17914 + 1;
    p = p + D.17915;
  }
  i = i + 1;
  <D.17340>:
  D.17916 = cat->num_counters;
  D.17917 = (int) D.17916;
  if (D.17917 > i) goto <D.17339>; else goto <D.17341>;
  <D.17341>:
  D.17910 = 0B;
  return D.17910;
}


custom_category_counters (struct SharedCategory * cat)
{
  char[1] * D.17919;
  long unsigned int D.17920;
  sizetype D.17921;
  long unsigned int D.17922;
  sizetype D.17923;
  char * D.17924;
  char * p;

  D.17919 = &cat->name;
  D.17920 = strlen (D.17919);
  D.17921 = D.17920 + 1;
  p = &cat->name[D.17921];
  D.17922 = strlen (p);
  D.17923 = D.17922 + 1;
  p = p + D.17923;
  D.17924 = p;
  return D.17924;
}


custom_get_instance (struct SharedCategory * cat, struct SharedCounter * scounter, struct MonoString * instance)
{
  struct SharedInstance * D.17928;
  long unsigned int D.17929;
  unsigned int D.17930;
  unsigned int D.17931;
  short unsigned int D.17932;
  unsigned int D.17933;
  unsigned int D.17934;
  unsigned int size.5;
  unsigned int D.17936;
  _Bool D.17939;
  long int D.17940;
  long int D.17941;
  _Bool D.17948;
  long int D.17949;
  long int D.17950;
  short unsigned int D.17953;
  long int cat.6;
  struct MonoSharedArea * shared_area.7;
  long int shared_area.8;
  long int D.17957;
  unsigned int D.17958;
  int D.17959;
  int D.17960;
  long unsigned int D.17961;
  sizetype D.17962;
  _Bool D.17965;
  long int D.17966;
  long int D.17967;
  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.17926>; else goto <D.17927>;
  <D.17926>:
  D.17928 = inst;
  return D.17928;
  <D.17927>:
  name = mono_string_to_utf8 (instance);
  D.17929 = strlen (name);
  D.17930 = (unsigned int) D.17929;
  D.17931 = D.17930 + 12;
  size = (int) D.17931;
  size = size + 7;
  size = size & -8;
  data_offset = size;
  D.17932 = cat->num_counters;
  D.17933 = (unsigned int) D.17932;
  D.17934 = D.17933 * 8;
  size.5 = (unsigned int) size;
  D.17936 = D.17934 + size.5;
  size = (int) D.17936;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17937>; else goto <D.17938>;
    <D.17937>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17938>:
    D.17939 = ret != 0;
    D.17940 = (long int) D.17939;
    D.17941 = __builtin_expect (D.17940, 0);
    if (D.17941 != 0) goto <D.17942>; else goto <D.17943>;
    <D.17942>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1159, "ret == 0");
    <D.17943>:
  }
  ptr = shared_data_find_room (size);
  if (ptr == 0B) goto <D.17944>; else goto <D.17945>;
  <D.17944>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17946>; else goto <D.17947>;
    <D.17946>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17947>:
    D.17948 = ret != 0;
    D.17949 = (long int) D.17948;
    D.17950 = __builtin_expect (D.17949, 0);
    if (D.17950 != 0) goto <D.17951>; else goto <D.17952>;
    <D.17951>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1162, "ret == 0");
    <D.17952>:
  }
  monoeg_g_free (name);
  D.17928 = 0B;
  return D.17928;
  <D.17945>:
  inst = ptr;
  inst->header.extra = 0;
  D.17953 = (short unsigned int) size;
  inst->header.size = D.17953;
  cat.6 = (long int) cat;
  shared_area.7 = shared_area;
  shared_area.8 = (long int) shared_area.7;
  D.17957 = cat.6 - shared_area.8;
  D.17958 = (unsigned int) D.17957;
  inst->category_offset = D.17958;
  D.17959 = cat->num_instances;
  D.17960 = D.17959 + 1;
  cat->num_instances = D.17960;
  p = &inst->instance_name;
  strcpy (p, name);
  D.17961 = strlen (name);
  D.17962 = D.17961 + 1;
  p = p + D.17962;
  inst->header.ftype = 73;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17963>; else goto <D.17964>;
    <D.17963>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17964>:
    D.17965 = ret != 0;
    D.17966 = (long int) D.17965;
    D.17967 = __builtin_expect (D.17966, 0);
    if (D.17967 != 0) goto <D.17968>; else goto <D.17969>;
    <D.17968>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1176, "ret == 0");
    <D.17969>:
  }
  monoeg_g_free (name);
  D.17928 = inst;
  return D.17928;
}


find_custom_instance (struct SharedCategory * cat, struct MonoString * instance)
{
  long int cat.9;
  struct MonoSharedArea * shared_area.10;
  long int shared_area.11;
  long int D.17974;
  unsigned int D.17975;
  struct SharedInstance * D.17976;
  struct InstanceSearch search;

  try
    {
      cat.9 = (long int) cat;
      shared_area.10 = shared_area;
      shared_area.11 = (long int) shared_area.10;
      D.17974 = cat.9 - shared_area.11;
      D.17975 = (unsigned int) D.17974;
      search.cat_offset = D.17975;
      search.cat = cat;
      search.instance = instance;
      search.list = 0B;
      search.result = 0B;
      foreach_shared_item (instance_search, &search);
      D.17976 = search.result;
      return D.17976;
    }
  finally
    {
      search = {CLOBBER};
    }
}


instance_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17979;
  unsigned int D.17982;
  unsigned int D.17983;
  struct MonoString * D.17986;
  char[1] * D.17989;
  int D.17990;
  gboolean D.17993;
  struct GSList * D.17995;
  struct GSList * D.17996;
  struct InstanceSearch * search;

  search = data;
  D.17979 = header->ftype;
  if (D.17979 == 73) goto <D.17980>; else goto <D.17981>;
  <D.17980>:
  {
    struct SharedInstance * ins;

    ins = header;
    D.17982 = search->cat_offset;
    D.17983 = ins->category_offset;
    if (D.17982 == D.17983) goto <D.17984>; else goto <D.17985>;
    <D.17984>:
    D.17986 = search->instance;
    if (D.17986 != 0B) goto <D.17987>; else goto <D.17988>;
    <D.17987>:
    D.17986 = search->instance;
    D.17989 = &ins->instance_name;
    D.17990 = mono_string_compare_ascii (D.17986, D.17989);
    if (D.17990 == 0) goto <D.17991>; else goto <D.17992>;
    <D.17991>:
    search->result = ins;
    D.17993 = 0;
    return D.17993;
    <D.17992>:
    goto <D.17994>;
    <D.17988>:
    D.17995 = search->list;
    D.17996 = monoeg_g_slist_prepend (D.17995, ins);
    search->list = D.17996;
    <D.17994>:
    <D.17985>:
  }
  <D.17981>:
  D.17993 = 1;
  return D.17993;
}


shared_data_find_room (int size)
{
  struct MonoSharedArea * shared_area.12;
  short unsigned int D.17999;
  sizetype D.18000;
  int D.18001;
  sizetype D.18002;
  unsigned char D.18003;
  long int D.18006;
  long int end.13;
  long int p.14;
  long int D.18009;
  unsigned char * D.18012;
  unsigned char * D.18013;
  short unsigned int D.18018;
  int D.18019;
  sizetype D.18022;
  unsigned char * p;
  unsigned char * end;

  shared_area.12 = shared_area;
  shared_area.12 = shared_area;
  D.17999 = shared_area.12->data_start;
  D.18000 = (sizetype) D.17999;
  p = shared_area.12 + D.18000;
  shared_area.12 = shared_area;
  shared_area.12 = shared_area;
  D.18001 = shared_area.12->size;
  D.18002 = (sizetype) D.18001;
  end = shared_area.12 + D.18002;
  size = size + 7;
  size = size & -8;
  goto <D.17276>;
  <D.17275>:
  {
    short unsigned int * next;

    D.18003 = *p;
    if (D.18003 == 0) goto <D.18004>; else goto <D.18005>;
    <D.18004>:
    D.18006 = (long int) size;
    end.13 = (long int) end;
    p.14 = (long int) p;
    D.18009 = end.13 - p.14;
    if (D.18006 < D.18009) goto <D.18010>; else goto <D.18011>;
    <D.18010>:
    D.18012 = p;
    return D.18012;
    <D.18011>:
    D.18012 = 0B;
    return D.18012;
    <D.18005>:
    D.18013 = p + 4;
    if (D.18013 > end) goto <D.18014>; else goto <D.18015>;
    <D.18014>:
    D.18012 = 0B;
    return D.18012;
    <D.18015>:
    next = p + 2;
    D.18003 = *p;
    if (D.18003 == 68) goto <D.18016>; else goto <D.18017>;
    <D.18016>:
    D.18018 = *next;
    D.18019 = (int) D.18018;
    if (D.18019 == size) goto <D.18020>; else goto <D.18021>;
    <D.18020>:
    D.18012 = p;
    return D.18012;
    <D.18021>:
    <D.18017>:
    D.18018 = *next;
    D.18022 = (sizetype) D.18018;
    p = p + D.18022;
  }
  <D.17276>:
  if (p < end) goto <D.17275>; else goto <D.17277>;
  <D.17277>:
  D.18012 = 0B;
  return D.18012;
}


strcpy (char * restrict __dest, const char * restrict __src)
{
  char * D.18024;
  long unsigned int D.18025;

  D.18025 = __builtin_object_size (__dest, 1);
  D.18024 = __builtin___strcpy_chk (__dest, __src, D.18025);
  return D.18024;
}


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

  vtable = monoeg_malloc0 (48);
  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.18027 = vtable;
  return D.18027;
}


custom_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  long unsigned int D.18033;
  long unsigned int value.15;
  long unsigned int D.18035;
  gint64 D.18036;
  long unsigned int value.16;
  guint64 * ptr;

  ptr = vtable->arg;
  if (ptr != 0B) goto <D.18029>; else goto <D.18030>;
  <D.18029>:
  if (do_incr != 0) goto <D.18031>; else goto <D.18032>;
  <D.18031>:
  D.18033 = *ptr;
  value.15 = (long unsigned int) value;
  D.18035 = D.18033 + value.15;
  *ptr = D.18035;
  D.18033 = *ptr;
  D.18036 = (gint64) D.18033;
  return D.18036;
  <D.18032>:
  value.16 = (long unsigned int) value;
  *ptr = value.16;
  D.18036 = value;
  return D.18036;
  <D.18030>:
  D.18036 = 0;
  return D.18036;
}


custom_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  struct SharedCounter * D.18041;
  unsigned char D.18042;
  int D.18043;
  int D.18044;
  void * D.18045;
  long unsigned int D.18049;
  long int D.18050;
  MonoBoolean D.18051;
  struct CustomVTable * counter_data;

  counter_data = vtable;
  if (only_value == 0) goto <D.18039>; else goto <D.18040>;
  <D.18039>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.18040>:
  D.18041 = counter_data->counter_desc;
  D.18042 = D.18041->type;
  D.18043 = (int) D.18042;
  D.18044 = simple_type_to_type[D.18043];
  sample->counterType = D.18044;
  D.18045 = vtable->arg;
  if (D.18045 == 0B) goto <D.18046>; else goto <D.18047>;
  <D.18046>:
  sample->rawValue = 0;
  goto <D.18048>;
  <D.18047>:
  D.18045 = vtable->arg;
  D.18049 = MEM[(guint64 *)D.18045];
  D.18050 = (long int) D.18049;
  sample->rawValue = D.18050;
  <D.18048>:
  D.18051 = 1;
  return D.18051;
}


fill_sample (struct MonoCounterSample * sample)
{
  long int D.18053;
  long int D.18054;

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


cpu_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.18055;
  int D.18058;
  void * D.18059;
  short int D.18060;
  int D.18061;
  int D.18062;
  long int D.18063;
  void * D.18064;
  int id;
  const struct CounterDesc * cdesc;

  D.18055 = id_from_string (instance, 0);
  id = D.18055 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[0], counter);
  if (cdesc != 0B) goto <D.18056>; else goto <D.18057>;
  <D.18056>:
  D.18058 = cdesc->type;
  *type = D.18058;
  D.18060 = cdesc->id;
  D.18061 = (int) D.18060;
  D.18062 = D.18061 | id;
  D.18063 = (long int) D.18062;
  D.18064 = (void *) D.18063;
  D.18059 = create_vtable (D.18064, get_cpu_counter, 0B);
  return D.18059;
  <D.18057>:
  D.18059 = 0B;
  return D.18059;
}


get_cpu_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.18066;
  long int D.18067;
  short int D.18070;
  int D.18071;
  int D.18072;
  int D.18073;
  long int D.18074;
  MonoBoolean D.18075;
  long int D.18076;
  long int D.18077;
  long int D.18078;
  long int D.18079;
  MonoProcessError error;
  int id;
  int pid;

  try
    {
      D.18066 = vtable->arg;
      D.18067 = (long int) D.18066;
      id = (int) D.18067;
      pid = id >> 5;
      id = id & 31;
      if (only_value == 0) goto <D.18068>; else goto <D.18069>;
      <D.18068>:
      fill_sample (sample);
      sample->baseValue = 1;
      <D.18069>:
      D.18070 = 0;
      D.18071 = (int) D.18070;
      D.18072 = D.18071 + id;
      D.18073 = predef_counters[D.18072].type;
      sample->counterType = D.18073;
      switch (id) <default: <D.18080>, case 0: <D.17394>, case 1: <D.17395>, case 2: <D.17396>, case 3: <D.17397>, case 4: <D.17398>>
      <D.17394>:
      D.18074 = mono_cpu_get_data (pid, 0, &error);
      sample->rawValue = D.18074;
      D.18075 = 1;
      return D.18075;
      <D.17395>:
      D.18076 = mono_cpu_get_data (pid, 1, &error);
      sample->rawValue = D.18076;
      D.18075 = 1;
      return D.18075;
      <D.17396>:
      D.18077 = mono_cpu_get_data (pid, 2, &error);
      sample->rawValue = D.18077;
      D.18075 = 1;
      return D.18075;
      <D.17397>:
      D.18078 = mono_cpu_get_data (pid, 3, &error);
      sample->rawValue = D.18078;
      D.18075 = 1;
      return D.18075;
      <D.17398>:
      D.18079 = mono_cpu_get_data (pid, 4, &error);
      sample->rawValue = D.18079;
      D.18075 = 1;
      return D.18075;
      <D.18080>:
      D.18075 = 0;
      return D.18075;
    }
  finally
    {
      error = {CLOBBER};
    }
}


id_from_string (struct MonoString * instance, gboolean is_process)
{
  int D.18083;
  long int D.18086;
  char * end.17;
  int D.18092;
  int id;

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

    try
      {
        id_str = mono_string_to_utf8 (instance);
        D.18086 = strtol (id_str, &end, 0);
        id = (int) D.18086;
        end.17 = end;
        if (end.17 == id_str) goto <D.18088>; else goto <D.18089>;
        <D.18088>:
        if (is_process == 0) goto <D.18090>; else goto <D.18091>;
        <D.18090>:
        id = -1;
        <D.18091>:
        <D.18089>:
        monoeg_g_free (id_str);
      }
    finally
      {
        end = {CLOBBER};
      }
  }
  <D.18085>:
  D.18092 = id;
  return D.18092;
}


get_counter_in_category (const struct CategoryDesc * desc, struct MonoString * counter)
{
  short int D.18094;
  int D.18095;
  const struct CategoryDesc * D.18096;
  short int D.18097;
  int D.18098;
  const char * D.18099;
  int D.18100;
  const struct CounterDesc * D.18103;
  const struct CounterDesc * cdesc;
  const struct CounterDesc * end;

  D.18094 = desc->first_counter;
  D.18095 = (int) D.18094;
  cdesc = &predef_counters[D.18095];
  D.18096 = desc + 24;
  D.18097 = D.18096->first_counter;
  D.18098 = (int) D.18097;
  end = &predef_counters[D.18098];
  goto <D.17374>;
  <D.17373>:
  D.18099 = cdesc->name;
  D.18100 = mono_string_compare_ascii (counter, D.18099);
  if (D.18100 == 0) goto <D.18101>; else goto <D.18102>;
  <D.18101>:
  D.18103 = cdesc;
  return D.18103;
  <D.18102>:
  cdesc = cdesc + 24;
  <D.17374>:
  if (cdesc < end) goto <D.17373>; else goto <D.17375>;
  <D.17375>:
  D.18103 = 0B;
  return D.18103;
}


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

  vtable = monoeg_malloc0 (32);
  vtable->arg = arg;
  vtable->sample = sample;
  vtable->update = update;
  D.18105 = vtable;
  return D.18105;
}


process_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.18107;
  int D.18110;
  void * D.18111;
  short int D.18112;
  int D.18113;
  int D.18114;
  long int D.18115;
  void * D.18116;
  int id;
  const struct CounterDesc * cdesc;

  D.18107 = id_from_string (instance, 1);
  id = D.18107 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[1], counter);
  if (cdesc != 0B) goto <D.18108>; else goto <D.18109>;
  <D.18108>:
  D.18110 = cdesc->type;
  *type = D.18110;
  D.18112 = cdesc->id;
  D.18113 = (int) D.18112;
  D.18114 = D.18113 | id;
  D.18115 = (long int) D.18114;
  D.18116 = (void *) D.18115;
  D.18111 = create_vtable (D.18116, get_process_counter, 0B);
  return D.18111;
  <D.18109>:
  D.18111 = 0B;
  return D.18111;
}


get_process_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.18118;
  long int D.18119;
  MonoBoolean D.18122;
  short int D.18125;
  int D.18126;
  int D.18127;
  int D.18128;
  long int D.18129;
  void * D.18130;
  long int D.18131;
  long int D.18132;
  long int D.18133;
  long int D.18134;
  long int D.18135;
  long int D.18136;
  long int D.18137;
  int id;
  int pid;

  D.18118 = vtable->arg;
  D.18119 = (long int) D.18118;
  id = (int) D.18119;
  pid = id >> 5;
  if (pid < 0) goto <D.18120>; else goto <D.18121>;
  <D.18120>:
  D.18122 = 0;
  return D.18122;
  <D.18121>:
  id = id & 31;
  if (only_value == 0) goto <D.18123>; else goto <D.18124>;
  <D.18123>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.18124>:
  D.18125 = 5;
  D.18126 = (int) D.18125;
  D.18127 = D.18126 + id;
  D.18128 = predef_counters[D.18127].type;
  sample->counterType = D.18128;
  switch (id) <default: <D.18138>, case 0: <D.17439>, case 1: <D.17440>, case 2: <D.17441>, case 3: <D.17442>, case 4: <D.17443>, case 5: <D.17444>, case 6: <D.17445>>
  <D.17439>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18131 = mono_process_get_data (D.18130, 1);
  sample->rawValue = D.18131;
  D.18122 = 1;
  return D.18122;
  <D.17440>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18132 = mono_process_get_data (D.18130, 2);
  sample->rawValue = D.18132;
  D.18122 = 1;
  return D.18122;
  <D.17441>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18133 = mono_process_get_data (D.18130, 3);
  sample->rawValue = D.18133;
  D.18122 = 1;
  return D.18122;
  <D.17442>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18134 = mono_process_get_data (D.18130, 0);
  sample->rawValue = D.18134;
  D.18122 = 1;
  return D.18122;
  <D.17443>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18135 = mono_process_get_data (D.18130, 7);
  sample->rawValue = D.18135;
  D.18122 = 1;
  return D.18122;
  <D.17444>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18136 = mono_process_get_data (D.18130, 4);
  sample->rawValue = D.18136;
  D.18122 = 1;
  return D.18122;
  <D.17445>:
  D.18129 = (long int) pid;
  D.18130 = (void *) D.18129;
  D.18137 = mono_process_get_data (D.18130, 6);
  sample->rawValue = D.18137;
  D.18122 = 1;
  return D.18122;
  <D.18138>:
  D.18122 = 0;
  return D.18122;
}


mono_mem_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.18142;
  void * D.18143;
  short int D.18144;
  long int D.18145;
  void * D.18146;
  const struct CounterDesc * cdesc;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[2], counter);
  if (cdesc != 0B) goto <D.18140>; else goto <D.18141>;
  <D.18140>:
  D.18142 = cdesc->type;
  *type = D.18142;
  D.18144 = cdesc->id;
  D.18145 = (long int) D.18144;
  D.18146 = (void *) D.18145;
  D.18143 = create_vtable (D.18146, mono_mem_counter, 0B);
  return D.18143;
  <D.18141>:
  D.18143 = 0B;
  return D.18143;
}


mono_mem_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.18148;
  long int D.18149;
  short int D.18152;
  int D.18153;
  int D.18154;
  int D.18155;
  long unsigned int D.18156;
  long int D.18157;
  MonoBoolean D.18158;
  long unsigned int D.18159;
  long int D.18160;
  int id;

  D.18148 = vtable->arg;
  D.18149 = (long int) D.18148;
  id = (int) D.18149;
  if (only_value == 0) goto <D.18150>; else goto <D.18151>;
  <D.18150>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.18151>:
  D.18152 = 12;
  D.18153 = (int) D.18152;
  D.18154 = D.18153 + id;
  D.18155 = predef_counters[D.18154].type;
  sample->counterType = D.18155;
  switch (id) <default: <D.18161>, case 0: <D.17460>, case 1: <D.17461>>
  <D.17460>:
  D.18156 = mono_stats.new_object_count;
  D.18157 = (long int) D.18156;
  sample->rawValue = D.18157;
  D.18158 = 1;
  return D.18158;
  <D.17461>:
  D.18159 = mono_determine_physical_ram_size ();
  D.18160 = (long int) D.18159;
  sample->rawValue = D.18160;
  D.18158 = 1;
  return D.18158;
  <D.18161>:
  D.18158 = 0;
  return D.18158;
}


mono_determine_physical_ram_size ()
{
  long int D.18163;
  long int D.18164;
  guint64 D.18168;
  guint64 page_size;
  guint64 num_pages;

  page_size = 0;
  num_pages = 0;
  D.18163 = sysconf (30);
  page_size = (guint64) D.18163;
  D.18164 = sysconf (85);
  num_pages = (guint64) D.18164;
  if (page_size == 0) goto <D.18165>; else goto <D.18167>;
  <D.18167>:
  if (num_pages == 0) goto <D.18165>; else goto <D.18166>;
  <D.18165>:
  monoeg_g_log (0B, 16, "Your operating system\'s sysconf (3) function doesn\'t correctly report physical memory size!");
  D.18168 = 134217728;
  return D.18168;
  <D.18166>:
  D.18168 = page_size * num_pages;
  return D.18168;
}


network_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  short int D.18172;
  int D.18173;
  int D.18174;
  void * D.18175;
  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.18170>; else goto <D.18171>;
  <D.18170>:
  instance_name = mono_string_to_utf8 (instance);
  narg = monoeg_malloc0 (16);
  D.18172 = cdesc->id;
  D.18173 = (int) D.18172;
  narg->id = D.18173;
  narg->name = instance_name;
  D.18174 = cdesc->type;
  *type = D.18174;
  vtable = create_vtable (narg, get_network_counter, 0B);
  vtable->cleanup = network_cleanup;
  D.18175 = vtable;
  return D.18175;
  <D.18171>:
  D.18175 = 0B;
  return D.18175;
}


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

  if (vtable == 0B) goto <D.18177>; else goto <D.18178>;
  <D.18177>:
  return;
  <D.18178>:
  narg = vtable->arg;
  if (narg == 0B) goto <D.18179>; else goto <D.18180>;
  <D.18179>:
  return;
  <D.18180>:
  D.18181 = narg->name;
  monoeg_g_free (D.18181);
  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.18185;
  int D.18186;
  int D.18187;
  int D.18188;
  int D.18189;
  char * D.18190;
  long int D.18191;
  long int D.18192;
  long int D.18193;
  <unnamed type> error.18;
  MonoBoolean D.18198;
  MonoNetworkError error;
  struct NetworkVtableArg * narg;

  try
    {
      error = 2;
      narg = vtable->arg;
      if (only_value == 0) goto <D.18183>; else goto <D.18184>;
      <D.18183>:
      fill_sample (sample);
      <D.18184>:
      D.18185 = 93;
      D.18186 = (int) D.18185;
      D.18187 = narg->id;
      D.18188 = D.18186 + D.18187;
      D.18189 = predef_counters[D.18188].type;
      sample->counterType = D.18189;
      D.18187 = narg->id;
      switch (D.18187) <default: <D.18194>, case 0: <D.17414>, case 1: <D.17416>, case 2: <D.17417>>
      <D.17414>:
      D.18190 = narg->name;
      D.18191 = mono_network_get_data (D.18190, 0, &error);
      sample->rawValue = D.18191;
      goto <D.17415>;
      <D.17416>:
      D.18190 = narg->name;
      D.18192 = mono_network_get_data (D.18190, 1, &error);
      sample->rawValue = D.18192;
      goto <D.17415>;
      <D.17417>:
      D.18190 = narg->name;
      D.18193 = mono_network_get_data (D.18190, 2, &error);
      sample->rawValue = D.18193;
      goto <D.17415>;
      <D.18194>:
      <D.17415>:
      error.18 = error;
      if (error.18 == 0) goto <D.18196>; else goto <D.18197>;
      <D.18196>:
      D.18198 = 1;
      return D.18198;
      <D.18197>:
      D.18198 = 0;
      return D.18198;
    }
  finally
    {
      error = {CLOBBER};
    }
}


predef_writable_get_impl (int cat, struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  const struct CategoryDesc * D.18201;
  int D.18204;
  int D.18208;
  void * D.18209;
  short int D.18210;
  int D.18211;
  int D.18212;
  int D.18213;
  long int D.18214;
  void * D.18215;
  const struct CounterDesc * cdesc;

  *custom = 1;
  D.18201 = &predef_categories[cat];
  cdesc = get_counter_in_category (D.18201, counter);
  if (cdesc != 0B) goto <D.18202>; else goto <D.18203>;
  <D.18202>:
  D.18204 = cdesc->type;
  *type = D.18204;
  if (instance == 0B) goto <D.18205>; else goto <D.18207>;
  <D.18207>:
  D.18208 = mono_string_compare_ascii (instance, "");
  if (D.18208 == 0) goto <D.18205>; else goto <D.18206>;
  <D.18205>:
  D.18210 = cdesc->id;
  D.18211 = (int) D.18210;
  D.18212 = D.18211 << 16;
  D.18213 = D.18212 | cat;
  D.18214 = (long int) D.18213;
  D.18215 = (void *) D.18214;
  D.18209 = create_vtable (D.18215, predef_writable_counter, predef_writable_update);
  return D.18209;
  <D.18206>:
  D.18210 = cdesc->id;
  D.18211 = (int) D.18210;
  D.18212 = D.18211 << 16;
  D.18213 = D.18212 | cat;
  D.18214 = (long int) D.18213;
  D.18215 = (void *) D.18214;
  D.18209 = predef_vtable (D.18215, instance);
  return D.18209;
  <D.18203>:
  D.18209 = 0B;
  return D.18209;
}


predef_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  void * D.18217;
  long int D.18218;
  struct MonoPerfCounters * mono_perfcounters.19;
  guint32 * ptr.20;
  guint32 * ptr.21;
  guint64 * ptr64.22;
  guint64 * ptr64.23;
  guint * ptr.24;
  guint * ptr.25;
  guint32 * ptr.26;
  gint64 D.18236;
  guint32 * ptr.27;
  int D.18238;
  guint32 * ptr.28;
  int D.18242;
  guint32 * ptr.29;
  unsigned int D.18244;
  unsigned int D.18245;
  unsigned int D.18246;
  guint32 * ptr.30;
  unsigned int D.18248;
  guint32 * ptr.31;
  gint64 * ptr64.32;
  gint64 * ptr64.33;
  long int D.18256;
  long int D.18257;
  gint64 * ptr64.34;
  gint64 * ptr64.35;
  guint32 * volatile ptr;
  gint64 * volatile ptr64;
  int cat_id;
  int id;

  ptr = 0B;
  ptr64 = 0B;
  D.18217 = vtable->arg;
  D.18218 = (long int) D.18217;
  cat_id = (int) D.18218;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  switch (cat_id) <default: <D.18228>, case 3: <D.17519>, case 12: <D.17524>>
  <D.17519>:
  switch (id) <default: <D.18222>, case 0: <D.17520>, case 1: <D.17522>>
  <D.17520>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.20 = &mono_perfcounters.19->aspnet_requests_queued;
  ptr = ptr.20;
  goto <D.17521>;
  <D.17522>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.21 = &mono_perfcounters.19->aspnet_requests;
  ptr = ptr.21;
  goto <D.17521>;
  <D.18222>:
  <D.17521>:
  goto <D.17523>;
  <D.17524>:
  switch (id) <default: <D.18227>, case 0: <D.17525>, case 2: <D.17527>, case 4: <D.17528>, case 5: <D.17529>>
  <D.17525>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr64.22 = &mono_perfcounters.19->threadpool_workitems;
  ptr64 = ptr64.22;
  goto <D.17526>;
  <D.17527>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr64.23 = &mono_perfcounters.19->threadpool_ioworkitems;
  ptr64 = ptr64.23;
  goto <D.17526>;
  <D.17528>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.24 = &mono_perfcounters.19->threadpool_threads;
  ptr = ptr.24;
  goto <D.17526>;
  <D.17529>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.25 = &mono_perfcounters.19->threadpool_iothreads;
  ptr = ptr.25;
  goto <D.17526>;
  <D.18227>:
  <D.17526>:
  goto <D.17523>;
  <D.18228>:
  <D.17523>:
  ptr.26 = ptr;
  if (ptr.26 != 0B) goto <D.18230>; else goto <D.18231>;
  <D.18230>:
  if (do_incr != 0) goto <D.18232>; else goto <D.18233>;
  <D.18232>:
  if (value == 1) goto <D.18234>; else goto <D.18235>;
  <D.18234>:
  ptr.27 = ptr;
  D.18238 = InterlockedIncrement (ptr.27);
  D.18236 = (gint64) D.18238;
  return D.18236;
  <D.18235>:
  if (value == -1) goto <D.18239>; else goto <D.18240>;
  <D.18239>:
  ptr.28 = ptr;
  D.18242 = InterlockedDecrement (ptr.28);
  D.18236 = (gint64) D.18242;
  return D.18236;
  <D.18240>:
  ptr.29 = ptr;
  D.18244 = *ptr.29;
  D.18245 = (unsigned int) value;
  D.18246 = D.18244 + D.18245;
  *ptr.29 = D.18246;
  ptr.30 = ptr;
  D.18248 = *ptr.30;
  D.18236 = (gint64) D.18248;
  return D.18236;
  <D.18233>:
  ptr.31 = ptr;
  D.18245 = (unsigned int) value;
  *ptr.31 = D.18245;
  D.18236 = value;
  return D.18236;
  <D.18231>:
  ptr64.32 = ptr64;
  if (ptr64.32 != 0B) goto <D.18251>; else goto <D.18252>;
  <D.18251>:
  if (do_incr != 0) goto <D.18253>; else goto <D.18254>;
  <D.18253>:
  ptr64.33 = ptr64;
  D.18256 = *ptr64.33;
  D.18257 = D.18256 + value;
  *ptr64.33 = D.18257;
  ptr64.34 = ptr64;
  D.18236 = *ptr64.34;
  return D.18236;
  <D.18254>:
  ptr64.35 = ptr64;
  *ptr64.35 = value;
  D.18236 = value;
  return D.18236;
  <D.18252>:
  D.18236 = 0;
  return D.18236;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.18261;
  unsigned int D.18262;

  D.18262 = __sync_add_and_fetch_4 (val, 1);
  D.18261 = (gint32) D.18262;
  return D.18261;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.18264;
  unsigned int D.18265;

  D.18265 = __sync_sub_and_fetch_4 (val, 1);
  D.18264 = (gint32) D.18265;
  return D.18264;
}


predef_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.18267;
  long int D.18268;
  short int D.18271;
  int D.18272;
  int D.18273;
  int D.18274;
  struct MonoPerfCounters * mono_perfcounters.36;
  unsigned int D.18276;
  long int D.18277;
  MonoBoolean D.18278;
  unsigned int D.18280;
  long int D.18281;
  unsigned int D.18282;
  long int D.18283;
  long unsigned int D.18285;
  long int D.18286;
  long unsigned int D.18287;
  long int D.18288;
  unsigned int D.18289;
  long int D.18290;
  unsigned int D.18291;
  long int D.18292;
  unsigned int D.18294;
  long int D.18295;
  unsigned int D.18296;
  long int D.18297;
  unsigned int D.18298;
  long int D.18299;
  unsigned int D.18300;
  long int D.18301;
  int cat_id;
  int id;

  D.18267 = vtable->arg;
  D.18268 = (long int) D.18267;
  cat_id = (int) D.18268;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.18269>; else goto <D.18270>;
  <D.18269>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.18270>:
  D.18271 = predef_categories[cat_id].first_counter;
  D.18272 = (int) D.18271;
  D.18273 = D.18272 + id;
  D.18274 = predef_counters[D.18273].type;
  sample->counterType = D.18274;
  switch (cat_id) <default: <D.18303>, case 3: <D.17496>, case 4: <D.17504>, case 5: <D.17493>, case 12: <D.17499>>
  <D.17493>:
  switch (id) <default: <D.18279>, case 0: <D.17494>>
  <D.17494>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18276 = mono_perfcounters.36->exceptions_thrown;
  D.18277 = (long int) D.18276;
  sample->rawValue = D.18277;
  D.18278 = 1;
  return D.18278;
  <D.18279>:
  goto <D.17495>;
  <D.17496>:
  switch (id) <default: <D.18284>, case 0: <D.17497>, case 1: <D.17498>>
  <D.17497>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18280 = mono_perfcounters.36->aspnet_requests_queued;
  D.18281 = (long int) D.18280;
  sample->rawValue = D.18281;
  D.18278 = 1;
  return D.18278;
  <D.17498>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18282 = mono_perfcounters.36->aspnet_requests;
  D.18283 = (long int) D.18282;
  sample->rawValue = D.18283;
  D.18278 = 1;
  return D.18278;
  <D.18284>:
  goto <D.17495>;
  <D.17499>:
  switch (id) <default: <D.18293>, case 0: <D.17500>, case 2: <D.17501>, case 4: <D.17502>, case 5: <D.17503>>
  <D.17500>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18285 = mono_perfcounters.36->threadpool_workitems;
  D.18286 = (long int) D.18285;
  sample->rawValue = D.18286;
  D.18278 = 1;
  return D.18278;
  <D.17501>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18287 = mono_perfcounters.36->threadpool_ioworkitems;
  D.18288 = (long int) D.18287;
  sample->rawValue = D.18288;
  D.18278 = 1;
  return D.18278;
  <D.17502>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18289 = mono_perfcounters.36->threadpool_threads;
  D.18290 = (long int) D.18289;
  sample->rawValue = D.18290;
  D.18278 = 1;
  return D.18278;
  <D.17503>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18291 = mono_perfcounters.36->threadpool_iothreads;
  D.18292 = (long int) D.18291;
  sample->rawValue = D.18292;
  D.18278 = 1;
  return D.18278;
  <D.18293>:
  goto <D.17495>;
  <D.17504>:
  switch (id) <default: <D.18302>, case 0: <D.17505>, case 1: <D.17506>, case 2: <D.17507>, case 3: <D.17508>, case 4: <D.17509>>
  <D.17505>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18294 = mono_perfcounters.36->jit_bytes;
  D.18295 = (long int) D.18294;
  sample->rawValue = D.18295;
  D.18278 = 1;
  return D.18278;
  <D.17506>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18296 = mono_perfcounters.36->jit_methods;
  D.18297 = (long int) D.18296;
  sample->rawValue = D.18297;
  D.18278 = 1;
  return D.18278;
  <D.17507>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18298 = mono_perfcounters.36->jit_time;
  D.18299 = (long int) D.18298;
  sample->rawValue = D.18299;
  D.18278 = 1;
  return D.18278;
  <D.17508>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18294 = mono_perfcounters.36->jit_bytes;
  D.18295 = (long int) D.18294;
  sample->rawValue = D.18295;
  D.18278 = 1;
  return D.18278;
  <D.17509>:
  mono_perfcounters.36 = mono_perfcounters;
  D.18300 = mono_perfcounters.36->jit_failures;
  D.18301 = (long int) D.18300;
  sample->rawValue = D.18301;
  D.18278 = 1;
  return D.18278;
  <D.18302>:
  goto <D.17495>;
  <D.18303>:
  <D.17495>:
  D.18278 = 0;
  return D.18278;
}


predef_vtable (void * arg, struct MonoString * instance)
{
  struct ImplVtable * D.18307;
  short unsigned int D.18308;
  sizetype D.18309;
  struct MonoPerfCounters * D.18310;
  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.18305>; else goto <D.18306>;
  <D.18305>:
  D.18307 = 0B;
  return D.18307;
  <D.18306>:
  vtable = monoeg_malloc (48);
  vtable->vtable.arg = arg;
  vtable->vtable.sample = predef_readonly_counter;
  vtable->vtable.cleanup = predef_cleanup;
  D.18308 = area->counters_start;
  D.18309 = (sizetype) D.18308;
  D.18310 = area + D.18309;
  vtable->counters = D.18310;
  vtable->pid = pid;
  D.18307 = vtable;
  return D.18307;
}


predef_cleanup (struct ImplVtable * vtable)
{
  _Bool D.18314;
  long int D.18315;
  long int D.18316;
  struct GHashTable * pid_to_shared_area.37;
  _Bool D.18324;
  long int D.18325;
  long int D.18326;
  int D.18329;
  _Bool D.18332;
  long int D.18333;
  long int D.18334;
  struct PredefVtable * vt;

  vt = vtable;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18312>; else goto <D.18313>;
    <D.18312>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18313>:
    D.18314 = ret != 0;
    D.18315 = (long int) D.18314;
    D.18316 = __builtin_expect (D.18315, 0);
    if (D.18316 != 0) goto <D.18317>; else goto <D.18318>;
    <D.18317>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 389, "ret == 0");
    <D.18318>:
  }
  pid_to_shared_area.37 = pid_to_shared_area;
  if (pid_to_shared_area.37 == 0B) goto <D.18320>; else goto <D.18321>;
  <D.18320>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18322>; else goto <D.18323>;
    <D.18322>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18323>:
    D.18324 = ret != 0;
    D.18325 = (long int) D.18324;
    D.18326 = __builtin_expect (D.18325, 0);
    if (D.18326 != 0) goto <D.18327>; else goto <D.18328>;
    <D.18327>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 391, "ret == 0");
    <D.18328>:
  }
  return;
  <D.18321>:
  D.18329 = vt->pid;
  unref_pid_unlocked (D.18329);
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18330>; else goto <D.18331>;
    <D.18330>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18331>:
    D.18332 = ret != 0;
    D.18333 = (long int) D.18332;
    D.18334 = __builtin_expect (D.18333, 0);
    if (D.18334 != 0) goto <D.18335>; else goto <D.18336>;
    <D.18335>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 395, "ret == 0");
    <D.18336>:
  }
}


unref_pid_unlocked (int pid)
{
  struct GHashTable * pid_to_shared_area.38;
  long int D.18339;
  const void * D.18340;
  int D.18343;
  int D.18344;
  void * D.18347;
  struct ExternalSArea * data;

  pid_to_shared_area.38 = pid_to_shared_area;
  D.18339 = (long int) pid;
  D.18340 = (const void *) D.18339;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.38, D.18340);
  if (data != 0B) goto <D.18341>; else goto <D.18342>;
  <D.18341>:
  D.18343 = data->refcount;
  D.18344 = D.18343 + -1;
  data->refcount = D.18344;
  D.18343 = data->refcount;
  if (D.18343 == 0) goto <D.18345>; else goto <D.18346>;
  <D.18345>:
  pid_to_shared_area.38 = pid_to_shared_area;
  D.18339 = (long int) pid;
  D.18340 = (const void *) D.18339;
  monoeg_g_hash_table_remove (pid_to_shared_area.38, D.18340);
  D.18347 = data->sarea;
  mono_shared_area_unload (D.18347);
  monoeg_g_free (data);
  <D.18346>:
  <D.18342>:
}


predef_readonly_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.18348;
  long int D.18349;
  short int D.18352;
  int D.18353;
  int D.18354;
  int D.18355;
  struct MonoPerfCounters * D.18356;
  short unsigned int D.18357;
  sizetype D.18358;
  guint32 * D.18359;
  unsigned int D.18360;
  long int D.18361;
  MonoBoolean D.18362;
  struct PredefVtable * vt;
  const struct CounterDesc * desc;
  int cat_id;
  int id;

  vt = vtable;
  D.18348 = vtable->arg;
  D.18349 = (long int) D.18348;
  cat_id = (int) D.18349;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.18350>; else goto <D.18351>;
  <D.18350>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.18351>:
  D.18352 = predef_categories[cat_id].first_counter;
  D.18353 = (int) D.18352;
  D.18354 = D.18353 + id;
  desc = &predef_counters[D.18354];
  D.18355 = desc->type;
  sample->counterType = D.18355;
  D.18356 = vt->counters;
  D.18357 = desc->offset;
  D.18358 = (sizetype) D.18357;
  D.18359 = D.18356 + D.18358;
  D.18360 = *D.18359;
  D.18361 = (long int) D.18360;
  sample->rawValue = D.18361;
  D.18362 = 1;
  return D.18362;
}


atoi (const char * __nptr)
{
  int D.18364;
  long int D.18365;

  D.18365 = strtol (__nptr, 0B, 10);
  D.18364 = (int) D.18365;
  return D.18364;
}


load_sarea_for_pid (int pid)
{
  _Bool D.18369;
  long int D.18370;
  long int D.18371;
  struct GHashTable * pid_to_shared_area.39;
  struct GHashTable * pid_to_shared_area.40;
  long int D.18378;
  const void * D.18379;
  void * D.18382;
  int D.18386;
  int D.18387;
  _Bool D.18390;
  long int D.18391;
  long int D.18392;
  struct MonoSharedArea * D.18395;
  struct ExternalSArea * data;
  struct MonoSharedArea * area;

  area = 0B;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18367>; else goto <D.18368>;
    <D.18367>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18368>:
    D.18369 = ret != 0;
    D.18370 = (long int) D.18369;
    D.18371 = __builtin_expect (D.18370, 0);
    if (D.18371 != 0) goto <D.18372>; else goto <D.18373>;
    <D.18372>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 348, "ret == 0");
    <D.18373>:
  }
  pid_to_shared_area.39 = pid_to_shared_area;
  if (pid_to_shared_area.39 == 0B) goto <D.18375>; else goto <D.18376>;
  <D.18375>:
  pid_to_shared_area.40 = monoeg_g_hash_table_new (0B, 0B);
  pid_to_shared_area = pid_to_shared_area.40;
  <D.18376>:
  pid_to_shared_area.39 = pid_to_shared_area;
  D.18378 = (long int) pid;
  D.18379 = (const void *) D.18378;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.39, D.18379);
  if (data == 0B) goto <D.18380>; else goto <D.18381>;
  <D.18380>:
  D.18378 = (long int) pid;
  D.18382 = (void *) D.18378;
  area = mono_shared_area_for_pid (D.18382);
  if (area != 0B) goto <D.18383>; else goto <D.18384>;
  <D.18383>:
  data = monoeg_malloc (16);
  data->sarea = area;
  data->refcount = 1;
  pid_to_shared_area.39 = pid_to_shared_area;
  D.18378 = (long int) pid;
  D.18382 = (void *) D.18378;
  monoeg_g_hash_table_insert_replace (pid_to_shared_area.39, D.18382, data, 0);
  <D.18384>:
  goto <D.18385>;
  <D.18381>:
  area = data->sarea;
  D.18386 = data->refcount;
  D.18387 = D.18386 + 1;
  data->refcount = D.18387;
  <D.18385>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18388>; else goto <D.18389>;
    <D.18388>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18389>:
    D.18390 = ret != 0;
    D.18391 = (long int) D.18390;
    D.18392 = __builtin_expect (D.18391, 0);
    if (D.18392 != 0) goto <D.18393>; else goto <D.18394>;
    <D.18393>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 364, "ret == 0");
    <D.18394>:
  }
  D.18395 = area;
  return D.18395;
}


mono_perfcounter_get_sample (void * impl, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  MonoBoolean (*<T2c06>) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) D.18399;
  MonoBoolean D.18402;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.18397>; else goto <D.18398>;
  <D.18397>:
  D.18399 = vtable->sample;
  if (D.18399 != 0B) goto <D.18400>; else goto <D.18401>;
  <D.18400>:
  D.18399 = vtable->sample;
  D.18402 = D.18399 (vtable, only_value, sample);
  return D.18402;
  <D.18401>:
  <D.18398>:
  D.18402 = 0;
  return D.18402;
}


mono_perfcounter_update_value (void * impl, MonoBoolean do_incr, gint64 value)
{
  gint64 (*<T2c0b>) (struct ImplVtable *, MonoBoolean, gint64) D.18406;
  gint64 D.18409;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.18404>; else goto <D.18405>;
  <D.18404>:
  D.18406 = vtable->update;
  if (D.18406 != 0B) goto <D.18407>; else goto <D.18408>;
  <D.18407>:
  D.18406 = vtable->update;
  D.18409 = D.18406 (vtable, do_incr, value);
  return D.18409;
  <D.18408>:
  <D.18405>:
  D.18409 = 0;
  return D.18409;
}


mono_perfcounter_free_data (void * impl)
{
  void (*<T2c10>) (struct ImplVtable *) D.18413;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.18411>; else goto <D.18412>;
  <D.18411>:
  D.18413 = vtable->cleanup;
  if (D.18413 != 0B) goto <D.18414>; else goto <D.18415>;
  <D.18414>:
  D.18413 = vtable->cleanup;
  D.18413 (vtable);
  <D.18415>:
  <D.18412>:
  monoeg_g_free (impl);
}


mono_perfcounter_category_del (struct MonoString * name)
{
  MonoBoolean D.18418;
  _Bool D.18421;
  long int D.18422;
  long int D.18423;
  int D.18429;
  _Bool D.18432;
  long int D.18433;
  long int D.18434;
  _Bool D.18439;
  long int D.18440;
  long int D.18441;
  const struct CategoryDesc * cdesc;
  struct SharedCategory * cat;

  cdesc = find_category (name);
  if (cdesc != 0B) goto <D.18416>; else goto <D.18417>;
  <D.18416>:
  D.18418 = 0;
  return D.18418;
  <D.18417>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18419>; else goto <D.18420>;
    <D.18419>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18420>:
    D.18421 = ret != 0;
    D.18422 = (long int) D.18421;
    D.18423 = __builtin_expect (D.18422, 0);
    if (D.18423 != 0) goto <D.18424>; else goto <D.18425>;
    <D.18424>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1304, "ret == 0");
    <D.18425>:
  }
  cat = find_custom_category (name);
  if (cat == 0B) goto <D.18426>; else goto <D.18428>;
  <D.18428>:
  D.18429 = cat->num_instances;
  if (D.18429 != 0) goto <D.18426>; else goto <D.18427>;
  <D.18426>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18430>; else goto <D.18431>;
    <D.18430>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18431>:
    D.18432 = ret != 0;
    D.18433 = (long int) D.18432;
    D.18434 = __builtin_expect (D.18433, 0);
    if (D.18434 != 0) goto <D.18435>; else goto <D.18436>;
    <D.18435>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1308, "ret == 0");
    <D.18436>:
  }
  D.18418 = 0;
  return D.18418;
  <D.18427>:
  cat->header.ftype = 68;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18437>; else goto <D.18438>;
    <D.18437>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18438>:
    D.18439 = ret != 0;
    D.18440 = (long int) D.18439;
    D.18441 = __builtin_expect (D.18440, 0);
    if (D.18441 != 0) goto <D.18442>; else goto <D.18443>;
    <D.18442>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1312, "ret == 0");
    <D.18443>:
  }
  D.18418 = 1;
  return D.18418;
}


mono_perfcounter_category_help (struct MonoString * category, struct MonoString * machine)
{
  int D.18445;
  struct MonoString * D.18448;
  struct MonoDomain * D.18453;
  char * D.18454;
  struct MonoDomain * D.18455;
  const char * D.18456;
  const struct CategoryDesc * cdesc;

  D.18445 = mono_string_compare_ascii (machine, ".");
  if (D.18445 != 0) goto <D.18446>; else goto <D.18447>;
  <D.18446>:
  D.18448 = 0B;
  return D.18448;
  <D.18447>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.18449>; else goto <D.18450>;
  <D.18449>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18451>; else goto <D.18452>;
    <D.18451>:
    D.18448 = 0B;
    return D.18448;
    <D.18452>:
    D.18453 = mono_domain_get ();
    D.18454 = custom_category_help (scat);
    D.18448 = mono_string_new (D.18453, D.18454);
    return D.18448;
  }
  <D.18450>:
  D.18455 = mono_domain_get ();
  D.18456 = cdesc->help;
  D.18448 = mono_string_new (D.18455, D.18456);
  return D.18448;
}


custom_category_help (struct SharedCategory * cat)
{
  char * D.18458;
  char[1] * D.18459;
  long unsigned int D.18460;
  sizetype D.18461;

  D.18459 = &cat->name;
  D.18460 = strlen (D.18459);
  D.18461 = D.18460 + 1;
  D.18458 = &cat->name[D.18461];
  return D.18458;
}


mono_perfcounter_category_exists (struct MonoString * counter, struct MonoString * category, struct MonoString * machine)
{
  int D.18463;
  MonoBoolean D.18466;
  struct SharedCounter * D.18473;
  _Bool D.18474;
  const struct CounterDesc * D.18477;
  const struct CategoryDesc * cdesc;

  D.18463 = mono_string_compare_ascii (machine, ".");
  if (D.18463 != 0) goto <D.18464>; else goto <D.18465>;
  <D.18464>:
  D.18466 = 0;
  return D.18466;
  <D.18465>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.18467>; else goto <D.18468>;
  <D.18467>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18469>; else goto <D.18470>;
    <D.18469>:
    D.18466 = 0;
    return D.18466;
    <D.18470>:
    if (counter == 0B) goto <D.18471>; else goto <D.18472>;
    <D.18471>:
    D.18466 = 1;
    return D.18466;
    <D.18472>:
    D.18473 = find_custom_counter (scat, counter);
    D.18474 = D.18473 != 0B;
    D.18466 = (MonoBoolean) D.18474;
    return D.18466;
  }
  <D.18468>:
  if (counter == 0B) goto <D.18475>; else goto <D.18476>;
  <D.18475>:
  D.18466 = 1;
  return D.18466;
  <D.18476>:
  D.18477 = get_counter_in_category (cdesc, counter);
  if (D.18477 != 0B) goto <D.18478>; else goto <D.18479>;
  <D.18478>:
  D.18466 = 1;
  return D.18466;
  <D.18479>:
  D.18466 = 0;
  return D.18466;
}


mono_perfcounter_create (struct MonoString * category, struct MonoString * help, int type, struct MonoArray * items)
{
  long unsigned int D.18481;
  int D.18482;
  int D.18484;
  int D.18486;
  long unsigned int D.18487;
  long unsigned int D.18488;
  long unsigned int D.18489;
  unsigned int D.18490;
  long unsigned int D.18491;
  unsigned int D.18492;
  unsigned int D.18493;
  unsigned int D.18494;
  long unsigned int D.18495;
  char * D.18496;
  int D.18497;
  long unsigned int D.18498;
  long unsigned int D.18499;
  char * * D.18500;
  struct MonoString * D.18501;
  char * D.18502;
  int D.18503;
  sizetype D.18505;
  sizetype D.18506;
  sizetype D.18507;
  char * * D.18508;
  struct MonoString * D.18509;
  char * D.18510;
  int D.18511;
  unsigned int size.41;
  unsigned int D.18514;
  long unsigned int D.18515;
  long unsigned int D.18516;
  char * * D.18517;
  char * D.18518;
  long unsigned int D.18520;
  unsigned int D.18521;
  unsigned int D.18522;
  unsigned int D.18523;
  _Bool D.18527;
  long int D.18528;
  long int D.18529;
  _Bool D.18536;
  long int D.18537;
  long int D.18538;
  unsigned char D.18541;
  short unsigned int D.18542;
  short unsigned int D.18543;
  short unsigned int D.18544;
  long unsigned int D.18545;
  sizetype D.18546;
  long unsigned int D.18547;
  sizetype D.18548;
  char * D.18549;
  char * p.42;
  int D.18551;
  int D.18552;
  char D.18553;
  char * p.43;
  char D.18555;
  char * D.18556;
  long unsigned int D.18557;
  sizetype D.18558;
  char * D.18559;
  long unsigned int D.18560;
  sizetype D.18561;
  _Bool D.18564;
  long int D.18565;
  long int D.18566;
  MonoBoolean D.18571;
  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.18481 = mono_array_length (items);
      num_counters = (int) D.18481;
      name = 0B;
      chelp = 0B;
      counter_info = 0B;
      mono_error_init (&error);
      name = mono_string_to_utf8_checked (category, &error);
      D.18482 = mono_error_ok (&error);
      if (D.18482 == 0) goto failure; else goto <D.18483>;
      <D.18483>:
      chelp = mono_string_to_utf8_checked (help, &error);
      D.18484 = mono_error_ok (&error);
      if (D.18484 == 0) goto failure; else goto <D.18485>;
      <D.18485>:
      D.18486 = num_counters * 2;
      D.18487 = (long unsigned int) D.18486;
      D.18488 = D.18487 * 8;
      counter_info = monoeg_malloc0 (D.18488);
      D.18489 = strlen (name);
      D.18490 = (unsigned int) D.18489;
      D.18491 = strlen (chelp);
      D.18492 = (unsigned int) D.18491;
      D.18493 = D.18490 + D.18492;
      D.18494 = D.18493 + 14;
      size = (int) D.18494;
      i = 0;
      goto <D.17674>;
      <D.17673>:
      {
        struct CounterCreationData * data;

        D.18495 = (long unsigned int) i;
        D.18496 = mono_array_addr_with_size (items, 8, D.18495);
        data = MEM[(struct CounterCreationData * *)D.18496];
        D.18497 = i * 2;
        D.18498 = (long unsigned int) D.18497;
        D.18499 = D.18498 * 8;
        D.18500 = counter_info + D.18499;
        D.18501 = data->name;
        D.18502 = mono_string_to_utf8_checked (D.18501, &error);
        *D.18500 = D.18502;
        D.18503 = mono_error_ok (&error);
        if (D.18503 == 0) goto failure; else goto <D.18504>;
        <D.18504>:
        D.18497 = i * 2;
        D.18505 = (sizetype) D.18497;
        D.18506 = D.18505 + 1;
        D.18507 = D.18506 * 8;
        D.18508 = counter_info + D.18507;
        D.18509 = data->help;
        D.18510 = mono_string_to_utf8_checked (D.18509, &error);
        *D.18508 = D.18510;
        D.18511 = mono_error_ok (&error);
        if (D.18511 == 0) goto failure; else goto <D.18512>;
        <D.18512>:
        size.41 = (unsigned int) size;
        D.18514 = size.41 + 4;
        size = (int) D.18514;
      }
      i = i + 1;
      <D.17674>:
      if (i < num_counters) goto <D.17673>; else goto <D.17675>;
      <D.17675>:
      i = 0;
      goto <D.17677>;
      <D.17676>:
      D.18515 = (long unsigned int) i;
      D.18516 = D.18515 * 8;
      D.18517 = counter_info + D.18516;
      D.18518 = *D.18517;
      if (D.18518 == 0B) goto failure; else goto <D.18519>;
      <D.18519>:
      D.18515 = (long unsigned int) i;
      D.18516 = D.18515 * 8;
      D.18517 = counter_info + D.18516;
      D.18518 = *D.18517;
      D.18520 = strlen (D.18518);
      D.18521 = (unsigned int) D.18520;
      size.41 = (unsigned int) size;
      D.18522 = D.18521 + size.41;
      D.18523 = D.18522 + 1;
      size = (int) D.18523;
      i = i + 1;
      <D.17677>:
      D.18486 = num_counters * 2;
      if (D.18486 > i) goto <D.17676>; else goto <D.17678>;
      <D.17678>:
      size = size + 7;
      size = size & -8;
      counters_data_size = num_counters * 8;
      if (size > 65535) goto failure; else goto <D.18524>;
      <D.18524>:
      {
        int ret;

        ret = pthread_mutex_lock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18525>; else goto <D.18526>;
        <D.18525>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.18526>:
        D.18527 = ret != 0;
        D.18528 = (long int) D.18527;
        D.18529 = __builtin_expect (D.18528, 0);
        if (D.18529 != 0) goto <D.18530>; else goto <D.18531>;
        <D.18530>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1421, "ret == 0");
        <D.18531>:
      }
      ptr = shared_data_find_room (size);
      if (ptr == 0B) goto <D.18532>; else goto <D.18533>;
      <D.18532>:
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18534>; else goto <D.18535>;
        <D.18534>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18535>:
        D.18536 = ret != 0;
        D.18537 = (long int) D.18536;
        D.18538 = __builtin_expect (D.18537, 0);
        if (D.18538 != 0) goto <D.18539>; else goto <D.18540>;
        <D.18539>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1424, "ret == 0");
        <D.18540>:
      }
      goto failure;
      <D.18533>:
      cat = ptr;
      D.18541 = (unsigned char) type;
      cat->header.extra = D.18541;
      D.18542 = (short unsigned int) size;
      cat->header.size = D.18542;
      D.18543 = (short unsigned int) num_counters;
      cat->num_counters = D.18543;
      D.18544 = (short unsigned int) counters_data_size;
      cat->counters_data_size = D.18544;
      p = &cat->name;
      strcpy (p, name);
      D.18545 = strlen (name);
      D.18546 = D.18545 + 1;
      p = p + D.18546;
      strcpy (p, chelp);
      D.18547 = strlen (chelp);
      D.18548 = D.18547 + 1;
      p = p + D.18548;
      i = 0;
      goto <D.17683>;
      <D.17682>:
      {
        struct CounterCreationData * data;

        D.18495 = (long unsigned int) i;
        D.18549 = mono_array_addr_with_size (items, 8, D.18495);
        data = MEM[(struct CounterCreationData * *)D.18549];
        p.42 = p;
        p = p.42 + 1;
        D.18551 = data->type;
        D.18552 = perfctr_type_compress (D.18551);
        D.18553 = (char) D.18552;
        *p.42 = D.18553;
        p.43 = p;
        p = p.43 + 1;
        D.18555 = (char) i;
        *p.43 = D.18555;
        D.18497 = i * 2;
        D.18498 = (long unsigned int) D.18497;
        D.18499 = D.18498 * 8;
        D.18500 = counter_info + D.18499;
        D.18556 = *D.18500;
        strcpy (p, D.18556);
        D.18497 = i * 2;
        D.18498 = (long unsigned int) D.18497;
        D.18499 = D.18498 * 8;
        D.18500 = counter_info + D.18499;
        D.18556 = *D.18500;
        D.18557 = strlen (D.18556);
        D.18558 = D.18557 + 1;
        p = p + D.18558;
        D.18497 = i * 2;
        D.18505 = (sizetype) D.18497;
        D.18506 = D.18505 + 1;
        D.18507 = D.18506 * 8;
        D.18508 = counter_info + D.18507;
        D.18559 = *D.18508;
        strcpy (p, D.18559);
        D.18497 = i * 2;
        D.18505 = (sizetype) D.18497;
        D.18506 = D.18505 + 1;
        D.18507 = D.18506 * 8;
        D.18508 = counter_info + D.18507;
        D.18559 = *D.18508;
        D.18560 = strlen (D.18559);
        D.18561 = D.18560 + 1;
        p = p + D.18561;
      }
      i = i + 1;
      <D.17683>:
      if (i < num_counters) goto <D.17682>; else goto <D.17684>;
      <D.17684>:
      cat->header.ftype = 67;
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18562>; else goto <D.18563>;
        <D.18562>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18563>:
        D.18564 = ret != 0;
        D.18565 = (long int) D.18564;
        D.18566 = __builtin_expect (D.18565, 0);
        if (D.18566 != 0) goto <D.18567>; else goto <D.18568>;
        <D.18567>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1450, "ret == 0");
        <D.18568>:
      }
      result = 1;
      failure:
      if (counter_info != 0B) goto <D.18569>; else goto <D.18570>;
      <D.18569>:
      i = 0;
      goto <D.17687>;
      <D.17686>:
      D.18515 = (long unsigned int) i;
      D.18516 = D.18515 * 8;
      D.18517 = counter_info + D.18516;
      D.18518 = *D.18517;
      monoeg_g_free (D.18518);
      i = i + 1;
      <D.17687>:
      D.18486 = num_counters * 2;
      if (D.18486 > i) goto <D.17686>; else goto <D.17688>;
      <D.17688>:
      monoeg_g_free (counter_info);
      <D.18570>:
      monoeg_g_free (name);
      monoeg_g_free (chelp);
      mono_error_cleanup (&error);
      D.18571 = (MonoBoolean) result;
      return D.18571;
    }
  finally
    {
      error = {CLOBBER};
    }
}


perfctr_type_compress (int type)
{
  int D.18574;
  int D.18577;
  unsigned int i.44;
  int i;

  i = 0;
  goto <D.17267>;
  <D.17266>:
  D.18574 = simple_type_to_type[i];
  if (D.18574 == type) goto <D.18575>; else goto <D.18576>;
  <D.18575>:
  D.18577 = i;
  return D.18577;
  <D.18576>:
  i = i + 1;
  <D.17267>:
  i.44 = (unsigned int) i;
  if (i.44 <= 27) goto <D.17266>; else goto <D.17268>;
  <D.17268>:
  D.18577 = 2;
  return D.18577;
}


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

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

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18582>; else goto <D.18583>;
    <D.18582>:
    D.18584 = 0;
    return D.18584;
    <D.18583>:
    D.18585 = find_custom_instance (scat, instance);
    if (D.18585 != 0B) goto <D.18586>; else goto <D.18587>;
    <D.18586>:
    D.18584 = 1;
    return D.18584;
    <D.18587>:
  }
  goto <D.18588>;
  <D.18581>:
  <D.18588>:
  D.18584 = 0;
  return D.18584;
}


mono_perfcounter_category_names (struct MonoString * machine)
{
  int D.18590;
  struct MonoArray * D.18593;
  struct MonoClass * D.18594;
  _Bool D.18597;
  long int D.18598;
  long int D.18599;
  struct MonoClass * D.18602;
  unsigned int D.18603;
  unsigned int D.18604;
  long unsigned int D.18605;
  long unsigned int D.18606;
  const char * D.18607;
  struct MonoString * D.18608;
  char[1] * D.18609;
  struct MonoString * D.18610;
  _Bool D.18613;
  long int D.18614;
  long int D.18615;
  int i;
  struct MonoArray * res;
  struct MonoDomain * domain;
  struct GSList * custom_categories;
  struct GSList * tmp;

  domain = mono_domain_get ();
  D.18590 = mono_string_compare_ascii (machine, ".");
  if (D.18590 != 0) goto <D.18591>; else goto <D.18592>;
  <D.18591>:
  D.18594 = mono_get_string_class ();
  D.18593 = mono_array_new (domain, D.18594, 0);
  return D.18593;
  <D.18592>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18595>; else goto <D.18596>;
    <D.18595>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18596>:
    D.18597 = ret != 0;
    D.18598 = (long int) D.18597;
    D.18599 = __builtin_expect (D.18598, 0);
    if (D.18599 != 0) goto <D.18600>; else goto <D.18601>;
    <D.18600>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1497, "ret == 0");
    <D.18601>:
  }
  custom_categories = get_custom_categories ();
  D.18602 = mono_get_string_class ();
  D.18603 = monoeg_g_slist_length (custom_categories);
  D.18604 = D.18603 + 14;
  D.18605 = (long unsigned int) D.18604;
  res = mono_array_new (domain, D.18602, D.18605);
  i = 0;
  goto <D.17708>;
  <D.17707>:
  {
    const struct CategoryDesc * cdesc;

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

      D.18606 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18606);
      D.18607 = cdesc->name;
      D.18608 = mono_string_new (domain, D.18607);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18608);
    }
  }
  i = i + 1;
  <D.17708>:
  if (i <= 13) goto <D.17707>; else goto <D.17709>;
  <D.17709>:
  tmp = custom_categories;
  goto <D.17713>;
  <D.17712>:
  {
    struct SharedCategory * scat;

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

      D.18606 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18606);
      D.18609 = &scat->name;
      D.18610 = mono_string_new (domain, D.18609);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18610);
    }
    i = i + 1;
  }
  tmp = tmp->next;
  <D.17713>:
  if (tmp != 0B) goto <D.17712>; else goto <D.17714>;
  <D.17714>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18611>; else goto <D.18612>;
    <D.18611>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18612>:
    D.18613 = ret != 0;
    D.18614 = (long int) D.18613;
    D.18615 = __builtin_expect (D.18614, 0);
    if (D.18615 != 0) goto <D.18616>; else goto <D.18617>;
    <D.18616>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1509, "ret == 0");
    <D.18617>:
  }
  monoeg_g_slist_free (custom_categories);
  D.18593 = res;
  return D.18593;
}


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

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


category_collect (struct SharedHeader * header, void * data)
{
  unsigned char D.18622;
  struct GSList * D.18625;
  struct GSList * D.18626;
  gboolean D.18627;
  struct GSList * * list;

  list = data;
  D.18622 = header->ftype;
  if (D.18622 == 67) goto <D.18623>; else goto <D.18624>;
  <D.18623>:
  D.18625 = *list;
  D.18626 = monoeg_g_slist_prepend (D.18625, header);
  *list = D.18626;
  <D.18624>:
  D.18627 = 1;
  return D.18627;
}


mono_perfcounter_counter_names (struct MonoString * category, struct MonoString * machine)
{
  int D.18629;
  struct MonoArray * D.18632;
  struct MonoClass * D.18633;
  struct MonoClass * D.18636;
  const struct CategoryDesc * D.18637;
  short int D.18638;
  int D.18639;
  short int D.18640;
  int D.18641;
  int D.18642;
  long unsigned int D.18643;
  int D.18644;
  long unsigned int D.18645;
  const char * D.18646;
  struct MonoString * D.18647;
  _Bool D.18650;
  long int D.18651;
  long int D.18652;
  struct MonoClass * D.18657;
  short unsigned int D.18658;
  long unsigned int D.18659;
  long unsigned int D.18660;
  const char * D.18661;
  struct MonoString * D.18662;
  long unsigned int D.18663;
  sizetype D.18664;
  long unsigned int D.18665;
  sizetype D.18666;
  int D.18667;
  _Bool D.18670;
  long int D.18671;
  long int D.18672;
  _Bool D.18677;
  long int D.18678;
  long int D.18679;
  struct MonoClass * D.18682;
  int i;
  struct SharedCategory * scat;
  const struct CategoryDesc * cdesc;
  struct MonoArray * res;
  struct MonoDomain * domain;

  domain = mono_domain_get ();
  D.18629 = mono_string_compare_ascii (machine, ".");
  if (D.18629 != 0) goto <D.18630>; else goto <D.18631>;
  <D.18630>:
  D.18633 = mono_get_string_class ();
  D.18632 = mono_array_new (domain, D.18633, 0);
  return D.18632;
  <D.18631>:
  cdesc = find_category (category);
  if (cdesc != 0B) goto <D.18634>; else goto <D.18635>;
  <D.18634>:
  D.18636 = mono_get_string_class ();
  D.18637 = cdesc + 24;
  D.18638 = D.18637->first_counter;
  D.18639 = (int) D.18638;
  D.18640 = cdesc->first_counter;
  D.18641 = (int) D.18640;
  D.18642 = D.18639 - D.18641;
  D.18643 = (long unsigned int) D.18642;
  res = mono_array_new (domain, D.18636, D.18643);
  D.18640 = cdesc->first_counter;
  i = (int) D.18640;
  goto <D.17728>;
  <D.17727>:
  {
    const struct CounterDesc * desc;

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

      D.18640 = cdesc->first_counter;
      D.18641 = (int) D.18640;
      D.18644 = i - D.18641;
      D.18645 = (long unsigned int) D.18644;
      __p = mono_array_addr_with_size (res, 8, D.18645);
      D.18646 = desc->name;
      D.18647 = mono_string_new (domain, D.18646);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18647);
    }
  }
  i = i + 1;
  <D.17728>:
  D.18637 = cdesc + 24;
  D.18638 = D.18637->first_counter;
  D.18639 = (int) D.18638;
  if (D.18639 > i) goto <D.17727>; else goto <D.17729>;
  <D.17729>:
  D.18632 = res;
  return D.18632;
  <D.18635>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18648>; else goto <D.18649>;
    <D.18648>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18649>:
    D.18650 = ret != 0;
    D.18651 = (long int) D.18650;
    D.18652 = __builtin_expect (D.18651, 0);
    if (D.18652 != 0) goto <D.18653>; else goto <D.18654>;
    <D.18653>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1534, "ret == 0");
    <D.18654>:
  }
  scat = find_custom_category (category);
  if (scat != 0B) goto <D.18655>; else goto <D.18656>;
  <D.18655>:
  {
    char * p;
    int i;

    p = custom_category_counters (scat);
    D.18657 = mono_get_string_class ();
    D.18658 = scat->num_counters;
    D.18659 = (long unsigned int) D.18658;
    res = mono_array_new (domain, D.18657, D.18659);
    i = 0;
    goto <D.17735>;
    <D.17734>:
    {
      void * * __p;

      D.18660 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18660);
      D.18661 = p + 1;
      D.18662 = mono_string_new (domain, D.18661);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18662);
    }
    D.18661 = p + 1;
    D.18663 = strlen (D.18661);
    D.18664 = D.18663 + 2;
    p = p + D.18664;
    D.18665 = strlen (p);
    D.18666 = D.18665 + 1;
    p = p + D.18666;
    i = i + 1;
    <D.17735>:
    D.18658 = scat->num_counters;
    D.18667 = (int) D.18658;
    if (D.18667 > i) goto <D.17734>; else goto <D.17736>;
    <D.17736>:
    {
      int ret;

      ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
      if (ret != 0) goto <D.18668>; else goto <D.18669>;
      <D.18668>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.18669>:
      D.18670 = ret != 0;
      D.18671 = (long int) D.18670;
      D.18672 = __builtin_expect (D.18671, 0);
      if (D.18672 != 0) goto <D.18673>; else goto <D.18674>;
      <D.18673>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1545, "ret == 0");
      <D.18674>:
    }
    D.18632 = res;
    return D.18632;
  }
  <D.18656>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18675>; else goto <D.18676>;
    <D.18675>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18676>:
    D.18677 = ret != 0;
    D.18678 = (long int) D.18677;
    D.18679 = __builtin_expect (D.18678, 0);
    if (D.18679 != 0) goto <D.18680>; else goto <D.18681>;
    <D.18680>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1548, "ret == 0");
    <D.18681>:
  }
  D.18682 = mono_get_string_class ();
  D.18632 = mono_array_new (domain, D.18682, 0);
  return D.18632;
}


mono_perfcounter_instance_names (struct MonoString * category, struct MonoString * machine)
{
  int D.18684;
  struct MonoArray * D.18687;
  struct MonoDomain * D.18688;
  struct MonoClass * D.18689;
  <unnamed-unsigned:6> D.18692;
  int D.18693;
  struct MonoDomain * D.18694;
  struct MonoClass * D.18695;
  const struct CategoryDesc * cat;

  D.18684 = mono_string_compare_ascii (machine, ".");
  if (D.18684 != 0) goto <D.18685>; else goto <D.18686>;
  <D.18685>:
  D.18688 = mono_domain_get ();
  D.18689 = mono_get_string_class ();
  D.18687 = mono_array_new (D.18688, D.18689, 0);
  return D.18687;
  <D.18686>:
  cat = find_category (category);
  if (cat == 0B) goto <D.18690>; else goto <D.18691>;
  <D.18690>:
  D.18687 = get_custom_instances (category);
  return D.18687;
  <D.18691>:
  D.18692 = cat->instance_type;
  D.18693 = (int) D.18692;
  switch (D.18693) <default: <D.17821>, case 0: <D.17818>, case 1: <D.17820>, case 2: <D.17817>, case 3: <D.17816>, case 4: <D.17819>>
  <D.17816>:
  D.18687 = get_mono_instances ();
  return D.18687;
  <D.17817>:
  D.18687 = get_cpu_instances ();
  return D.18687;
  <D.17818>:
  D.18687 = get_processes_instances ();
  return D.18687;
  <D.17819>:
  D.18687 = get_networkinterface_instances ();
  return D.18687;
  <D.17820>:
  <D.17821>:
  D.18694 = mono_domain_get ();
  D.18695 = mono_get_string_class ();
  D.18687 = mono_array_new (D.18694, D.18695, 0);
  return D.18687;
}


get_custom_instances (struct MonoString * category)
{
  struct MonoDomain * D.18699;
  struct MonoClass * D.18700;
  unsigned int D.18701;
  long unsigned int D.18702;
  long unsigned int D.18703;
  struct MonoDomain * D.18704;
  char[1] * D.18705;
  struct MonoString * D.18706;
  struct MonoArray * D.18707;
  struct MonoDomain * D.18708;
  struct MonoClass * D.18709;
  struct SharedCategory * scat;

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

    list = get_custom_instances_list (scat);
    i = 0;
    D.18699 = mono_domain_get ();
    D.18700 = mono_get_string_class ();
    D.18701 = monoeg_g_slist_length (list);
    D.18702 = (long unsigned int) D.18701;
    array = mono_array_new (D.18699, D.18700, D.18702);
    tmp = list;
    goto <D.17809>;
    <D.17808>:
    {
      struct SharedInstance * inst;

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

        D.18703 = (long unsigned int) i;
        __p = mono_array_addr_with_size (array, 8, D.18703);
        D.18704 = mono_domain_get ();
        D.18705 = &inst->instance_name;
        D.18706 = mono_string_new (D.18704, D.18705);
        mono_gc_wbarrier_set_arrayref (array, __p, D.18706);
      }
      i = i + 1;
    }
    tmp = tmp->next;
    <D.17809>:
    if (tmp != 0B) goto <D.17808>; else goto <D.17810>;
    <D.17810>:
    monoeg_g_slist_free (list);
    D.18707 = array;
    return D.18707;
  }
  <D.18698>:
  D.18708 = mono_domain_get ();
  D.18709 = mono_get_string_class ();
  D.18707 = mono_array_new (D.18708, D.18709, 0);
  return D.18707;
}


get_custom_instances_list (struct SharedCategory * cat)
{
  long int cat.45;
  struct MonoSharedArea * shared_area.46;
  long int shared_area.47;
  long int D.18714;
  unsigned int D.18715;
  struct GSList * D.18716;
  struct InstanceSearch search;

  try
    {
      cat.45 = (long int) cat;
      shared_area.46 = shared_area;
      shared_area.47 = (long int) shared_area.46;
      D.18714 = cat.45 - shared_area.47;
      D.18715 = (unsigned int) D.18714;
      search.cat_offset = D.18715;
      search.cat = cat;
      search.instance = 0B;
      search.list = 0B;
      search.result = 0B;
      foreach_shared_item (instance_search, &search);
      D.18716 = search.list;
      return D.18716;
    }
  finally
    {
      search = {CLOBBER};
    }
}


get_mono_instances ()
{
  long unsigned int D.18719;
  long unsigned int D.18720;
  struct MonoArray * D.18721;
  int count;
  int res;
  void * * buf;
  struct MonoArray * array;

  count = 64;
  buf = 0B;
  <D.17773>:
  count = count * 2;
  monoeg_g_free (buf);
  D.18719 = (long unsigned int) count;
  D.18720 = D.18719 * 8;
  buf = monoeg_malloc (D.18720);
  res = mono_shared_area_instances (buf, count);
  if (res == count) goto <D.17773>; else goto <D.17774>;
  <D.17774>:
  array = get_string_array (buf, res, 1);
  monoeg_g_free (buf);
  D.18721 = array;
  return D.18721;
}


get_string_array (void * * array, int count, gboolean is_process)
{
  struct MonoDomain * D.18723;
  struct MonoClass * D.18724;
  long unsigned int D.18725;
  long unsigned int D.18728;
  long unsigned int D.18729;
  void * * D.18730;
  void * D.18731;
  long int D.18732;
  int D.18733;
  long unsigned int D.18735;
  struct MonoString * D.18736;
  struct MonoArray * D.18739;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.18723 = mono_domain_get ();
  D.18724 = mono_get_string_class ();
  D.18725 = (long unsigned int) count;
  res = mono_array_new (D.18723, D.18724, D.18725);
  i = 0;
  goto <D.17752>;
  <D.17751>:
  {
    char buf[128];
    char * p;

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

          D.18728 = (long unsigned int) i;
          D.18729 = D.18728 * 8;
          D.18730 = array + D.18729;
          D.18731 = *D.18730;
          pname = mono_process_get_name (D.18731, &buf, 128);
          D.18728 = (long unsigned int) i;
          D.18729 = D.18728 * 8;
          D.18730 = array + D.18729;
          D.18731 = *D.18730;
          D.18732 = (long int) D.18731;
          D.18733 = (int) D.18732;
          p = monoeg_g_strdup_printf ("%d/%s", D.18733, pname);
        }
        goto <D.18734>;
        <D.18727>:
        D.18728 = (long unsigned int) i;
        D.18729 = D.18728 * 8;
        D.18730 = array + D.18729;
        D.18731 = *D.18730;
        D.18732 = (long int) D.18731;
        D.18733 = (int) D.18732;
        sprintf (&buf, "%d", D.18733);
        p = &buf;
        <D.18734>:
        {
          void * * __p;

          D.18735 = (long unsigned int) i;
          __p = mono_array_addr_with_size (res, 8, D.18735);
          D.18736 = mono_string_new (domain, p);
          mono_gc_wbarrier_set_arrayref (res, __p, D.18736);
        }
        if (&buf != p) goto <D.18737>; else goto <D.18738>;
        <D.18737>:
        monoeg_g_free (p);
        <D.18738>:
      }
    finally
      {
        buf = {CLOBBER};
      }
  }
  i = i + 1;
  <D.17752>:
  if (i < count) goto <D.17751>; else goto <D.17753>;
  <D.17753>:
  D.18739 = res;
  return D.18739;
}


sprintf (char * restrict __s, const char * restrict __fmt)
{
  int D.18741;
  long unsigned int D.18742;

  D.18742 = __builtin_object_size (__s, 1);
  D.18741 = __builtin___sprintf_chk (__s, 1, D.18742, __fmt, __builtin_va_arg_pack ());
  return D.18741;
}


get_cpu_instances ()
{
  int D.18744;
  long unsigned int D.18745;
  long unsigned int D.18746;
  long unsigned int D.18747;
  long unsigned int D.18748;
  void * * D.18749;
  int D.18750;
  long int D.18751;
  void * D.18752;
  struct MonoDomain * D.18753;
  struct MonoString * D.18754;
  struct MonoArray * D.18755;
  void * * buf;
  int i;
  int count;
  struct MonoArray * array;

  buf = 0B;
  D.18744 = mono_cpu_count ();
  count = D.18744 + 1;
  D.18745 = (long unsigned int) count;
  D.18746 = D.18745 * 8;
  buf = monoeg_malloc (D.18746);
  i = 0;
  goto <D.17783>;
  <D.17782>:
  D.18747 = (long unsigned int) i;
  D.18748 = D.18747 * 8;
  D.18749 = buf + D.18748;
  D.18750 = i + -1;
  D.18751 = (long int) D.18750;
  D.18752 = (void *) D.18751;
  *D.18749 = D.18752;
  i = i + 1;
  <D.17783>:
  if (i < count) goto <D.17782>; else goto <D.17784>;
  <D.17784>:
  array = get_string_array (buf, count, 0);
  monoeg_g_free (buf);
  {
    void * * __p;

    __p = mono_array_addr_with_size (array, 8, 0);
    D.18753 = mono_domain_get ();
    D.18754 = mono_string_new (D.18753, "_Total");
    mono_gc_wbarrier_set_arrayref (array, __p, D.18754);
  }
  D.18755 = array;
  return D.18755;
}


get_processes_instances ()
{
  struct MonoArray * D.18759;
  int count.48;
  struct MonoArray * array;
  int count;
  void * * buf;

  try
    {
      count = 0;
      buf = mono_process_list (&count);
      if (buf == 0B) goto <D.18757>; else goto <D.18758>;
      <D.18757>:
      D.18759 = get_string_array (0B, 0, 0);
      return D.18759;
      <D.18758>:
      count.48 = count;
      array = get_string_array (buf, count.48, 1);
      monoeg_g_free (buf);
      D.18759 = array;
      return D.18759;
    }
  finally
    {
      count = {CLOBBER};
    }
}


get_networkinterface_instances ()
{
  struct MonoArray * D.18765;
  int count.49;
  struct MonoArray * array;
  int count;
  void * * buf;

  try
    {
      count = 0;
      buf = mono_networkinterface_list (&count);
      if (buf == 0B) goto <D.18763>; else goto <D.18764>;
      <D.18763>:
      D.18765 = get_string_array_of_strings (0B, 0);
      return D.18765;
      <D.18764>:
      count.49 = count;
      array = get_string_array_of_strings (buf, count.49);
      monoeg_g_strfreev (buf);
      D.18765 = array;
      return D.18765;
    }
  finally
    {
      count = {CLOBBER};
    }
}


get_string_array_of_strings (void * * array, int count)
{
  struct MonoDomain * D.18769;
  struct MonoClass * D.18770;
  long unsigned int D.18771;
  long unsigned int D.18772;
  long unsigned int D.18773;
  void * * D.18774;
  long unsigned int D.18775;
  struct MonoString * D.18776;
  struct MonoArray * D.18777;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.18769 = mono_domain_get ();
  D.18770 = mono_get_string_class ();
  D.18771 = (long unsigned int) count;
  res = mono_array_new (D.18769, D.18770, D.18771);
  i = 0;
  goto <D.17764>;
  <D.17763>:
  {
    char * p;

    D.18772 = (long unsigned int) i;
    D.18773 = D.18772 * 8;
    D.18774 = array + D.18773;
    p = *D.18774;
    {
      void * * __p;

      D.18775 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18775);
      D.18776 = mono_string_new (domain, p);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18776);
    }
  }
  i = i + 1;
  <D.17764>:
  if (i < count) goto <D.17763>; else goto <D.17765>;
  <D.17765>:
  D.18777 = res;
  return D.18777;
}


