mono_perfcounters_init ()
{
  void * shared_area.0;
  struct MonoSharedArea * shared_area.1;
  short unsigned int D.19496;
  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.19496 = (short unsigned int) d_offset;
  shared_area.1->data_start = D.19496;
  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.19498;
  void * D.19501;
  unsigned char D.19506;
  int D.19507;
  const struct CategoryDesc * cdesc;

  D.19498 = mono_string_compare_ascii (machine, ".");
  if (D.19498 != 0) goto <D.19499>; else goto <D.19500>;
  <D.19499>:
  D.19501 = 0B;
  return D.19501;
  <D.19500>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.19502>; else goto <D.19503>;
  <D.19502>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.19504>; else goto <D.19505>;
    <D.19504>:
    D.19501 = 0B;
    return D.19501;
    <D.19505>:
    *custom = 1;
    D.19501 = custom_get_impl (scat, counter, instance, type);
    return D.19501;
  }
  <D.19503>:
  D.19506 = cdesc->id;
  D.19507 = (int) D.19506;
  switch (D.19507) <default: <D.19508>, case 0: <D.19265>, case 1: <D.19266>, case 2: <D.19267>, case 3: <D.19277>, case 4: <D.19269>, case 5: <D.19270>, case 6: <D.19271>, case 7: <D.19272>, case 8: <D.19273>, case 9: <D.19274>, case 10: <D.19275>, case 11: <D.19276>, case 12: <D.19278>, case 13: <D.19268>>
  <D.19265>:
  D.19501 = cpu_get_impl (counter, instance, type, custom);
  return D.19501;
  <D.19266>:
  D.19501 = process_get_impl (counter, instance, type, custom);
  return D.19501;
  <D.19267>:
  D.19501 = mono_mem_get_impl (counter, instance, type, custom);
  return D.19501;
  <D.19268>:
  D.19501 = network_get_impl (counter, instance, type, custom);
  return D.19501;
  <D.19269>:
  <D.19270>:
  <D.19271>:
  <D.19272>:
  <D.19273>:
  <D.19274>:
  <D.19275>:
  <D.19276>:
  <D.19277>:
  <D.19278>:
  D.19506 = cdesc->id;
  D.19507 = (int) D.19506;
  D.19501 = predef_writable_get_impl (D.19507, counter, instance, type, custom);
  return D.19501;
  <D.19508>:
  D.19501 = 0B;
  return D.19501;
}


mono_string_compare_ascii (struct MonoString * str, const char * ascii_str)
{
  short unsigned int D.19510;
  int D.19513;
  const char * ascii_str.3;
  char D.19515;
  short unsigned int D.19516;
  int D.19517;
  const unsigned char * D.19518;
  unsigned char D.19519;
  int D.19520;
  guint16 * strc;

  strc = mono_string_chars (str);
  goto <D.18972>;
  <D.18971>:
  D.19510 = *strc;
  if (D.19510 == 0) goto <D.19511>; else goto <D.19512>;
  <D.19511>:
  D.19513 = 0;
  return D.19513;
  <D.19512>:
  strc = strc + 2;
  <D.18972>:
  D.19510 = *strc;
  ascii_str.3 = ascii_str;
  ascii_str = ascii_str.3 + 1;
  D.19515 = *ascii_str.3;
  D.19516 = (short unsigned int) D.19515;
  if (D.19510 == D.19516) goto <D.18971>; else goto <D.18973>;
  <D.18973>:
  D.19510 = *strc;
  D.19517 = (int) D.19510;
  D.19518 = ascii_str + 4294967295;
  D.19519 = *D.19518;
  D.19520 = (int) D.19519;
  D.19513 = D.19517 - D.19520;
  return D.19513;
}


find_category (struct MonoString * category)
{
  const char * D.19522;
  int D.19523;
  const struct CategoryDesc * D.19526;
  int i;

  i = 0;
  goto <D.19253>;
  <D.19252>:
  D.19522 = predef_categories[i].name;
  D.19523 = mono_string_compare_ascii (category, D.19522);
  if (D.19523 == 0) goto <D.19524>; else goto <D.19525>;
  <D.19524>:
  D.19526 = &predef_categories[i];
  return D.19526;
  <D.19525>:
  i = i + 1;
  <D.19253>:
  if (i <= 13) goto <D.19252>; else goto <D.19254>;
  <D.19254>:
  D.19526 = 0B;
  return D.19526;
}


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

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


category_search (struct SharedHeader * header, void * data)
{
  unsigned char D.19531;
  struct MonoString * D.19534;
  char[1] * D.19535;
  int D.19536;
  gboolean D.19539;
  struct CatSearch * search;

  search = data;
  D.19531 = header->ftype;
  if (D.19531 == 67) goto <D.19532>; else goto <D.19533>;
  <D.19532>:
  {
    struct SharedCategory * cat;

    cat = header;
    D.19534 = search->name;
    D.19535 = &cat->name;
    D.19536 = mono_string_compare_ascii (D.19534, D.19535);
    if (D.19536 == 0) goto <D.19537>; else goto <D.19538>;
    <D.19537>:
    search->cat = cat;
    D.19539 = 0;
    return D.19539;
    <D.19538>:
  }
  <D.19533>:
  D.19539 = 1;
  return D.19539;
}


foreach_shared_item (gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  struct MonoSharedArea * shared_area.4;
  short unsigned int D.19542;
  sizetype D.19543;
  int D.19544;
  sizetype D.19545;
  unsigned char * p;
  unsigned char * end;

  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.19542 = shared_area.4->data_start;
  D.19543 = (sizetype) D.19542;
  p = shared_area.4 + D.19543;
  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.19544 = shared_area.4->size;
  D.19545 = (sizetype) D.19544;
  end = shared_area.4 + D.19545;
  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.19546;
  int D.19549;
  unsigned char D.19552;
  short unsigned int D.19555;
  sizetype D.19556;

  goto <D.18958>;
  <D.18957>:
  {
    short unsigned int * next;

    D.19546 = p + 4;
    if (D.19546 > end) goto <D.19547>; else goto <D.19548>;
    <D.19547>:
    return;
    <D.19548>:
    next = p + 2;
    D.19549 = func (p, data);
    if (D.19549 == 0) goto <D.19550>; else goto <D.19551>;
    <D.19550>:
    return;
    <D.19551>:
    D.19552 = *p;
    if (D.19552 == 0) goto <D.19553>; else goto <D.19554>;
    <D.19553>:
    return;
    <D.19554>:
    D.19555 = *next;
    D.19556 = (sizetype) D.19555;
    p = p + D.19556;
  }
  <D.18958>:
  if (p < end) goto <D.18957>; else goto <D.18959>;
  <D.18959>:
}


custom_get_impl (struct SharedCategory * cat, struct MonoString * counter, struct MonoString * instance, int * type)
{
  void * D.19560;
  unsigned char D.19561;
  int D.19562;
  int D.19563;
  char[1] * D.19566;
  unsigned int D.19567;
  unsigned int D.19568;
  unsigned char D.19569;
  unsigned int D.19570;
  unsigned int D.19571;
  sizetype size.5;
  sizetype D.19573;
  char * D.19574;
  struct SharedCounter * scounter;
  struct SharedInstance * inst;
  int size;

  scounter = find_custom_counter (cat, counter);
  if (scounter == 0B) goto <D.19558>; else goto <D.19559>;
  <D.19558>:
  D.19560 = 0B;
  return D.19560;
  <D.19559>:
  D.19561 = scounter->type;
  D.19562 = (int) D.19561;
  D.19563 = simple_type_to_type[D.19562];
  *type = D.19563;
  inst = custom_get_instance (cat, scounter, instance);
  if (inst == 0B) goto <D.19564>; else goto <D.19565>;
  <D.19564>:
  D.19560 = 0B;
  return D.19560;
  <D.19565>:
  D.19566 = &inst->instance_name;
  D.19567 = strlen (D.19566);
  D.19568 = D.19567 + 12;
  size = (int) D.19568;
  size = size + 7;
  size = size & -8;
  D.19569 = scounter->seq_num;
  D.19570 = (unsigned int) D.19569;
  D.19571 = D.19570 * 8;
  size.5 = (sizetype) size;
  D.19573 = D.19571 + size.5;
  D.19574 = inst + D.19573;
  D.19560 = custom_vtable (scounter, inst, D.19574);
  return D.19560;
}


find_custom_counter (struct SharedCategory * cat, struct MonoString * name)
{
  char[1] * D.19576;
  int D.19577;
  struct SharedCounter * D.19580;
  const char * D.19581;
  unsigned int D.19582;
  sizetype D.19583;
  unsigned int D.19584;
  sizetype D.19585;
  short unsigned int D.19586;
  int D.19587;
  int i;
  char * p;

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

    counter = p;
    D.19576 = &counter->name;
    D.19577 = mono_string_compare_ascii (name, D.19576);
    if (D.19577 == 0) goto <D.19578>; else goto <D.19579>;
    <D.19578>:
    D.19580 = counter;
    return D.19580;
    <D.19579>:
    D.19581 = p + 1;
    D.19582 = strlen (D.19581);
    D.19583 = D.19582 + 2;
    p = p + D.19583;
    D.19584 = strlen (p);
    D.19585 = D.19584 + 1;
    p = p + D.19585;
  }
  i = i + 1;
  <D.19009>:
  D.19586 = cat->num_counters;
  D.19587 = (int) D.19586;
  if (D.19587 > i) goto <D.19008>; else goto <D.19010>;
  <D.19010>:
  D.19580 = 0B;
  return D.19580;
}


custom_category_counters (struct SharedCategory * cat)
{
  char[1] * D.19589;
  unsigned int D.19590;
  sizetype D.19591;
  unsigned int D.19592;
  sizetype D.19593;
  char * D.19594;
  char * p;

  D.19589 = &cat->name;
  D.19590 = strlen (D.19589);
  D.19591 = D.19590 + 1;
  p = &cat->name[D.19591];
  D.19592 = strlen (p);
  D.19593 = D.19592 + 1;
  p = p + D.19593;
  D.19594 = p;
  return D.19594;
}


custom_get_instance (struct SharedCategory * cat, struct SharedCounter * scounter, struct MonoString * instance)
{
  struct SharedInstance * D.19598;
  unsigned int D.19599;
  unsigned int D.19600;
  short unsigned int D.19601;
  unsigned int D.19602;
  unsigned int D.19603;
  unsigned int size.6;
  unsigned int D.19605;
  _Bool D.19608;
  long int D.19609;
  long int D.19610;
  _Bool D.19617;
  long int D.19618;
  long int D.19619;
  short unsigned int D.19622;
  int cat.7;
  struct MonoSharedArea * shared_area.8;
  int shared_area.9;
  int D.19626;
  unsigned int D.19627;
  int D.19628;
  int D.19629;
  unsigned int D.19630;
  sizetype D.19631;
  _Bool D.19634;
  long int D.19635;
  long int D.19636;
  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.19596>; else goto <D.19597>;
  <D.19596>:
  D.19598 = inst;
  return D.19598;
  <D.19597>:
  name = mono_string_to_utf8 (instance);
  D.19599 = strlen (name);
  D.19600 = D.19599 + 12;
  size = (int) D.19600;
  size = size + 7;
  size = size & -8;
  data_offset = size;
  D.19601 = cat->num_counters;
  D.19602 = (unsigned int) D.19601;
  D.19603 = D.19602 * 8;
  size.6 = (unsigned int) size;
  D.19605 = D.19603 + size.6;
  size = (int) D.19605;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.19606>; else goto <D.19607>;
    <D.19606>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19607>:
    D.19608 = ret != 0;
    D.19609 = (long int) D.19608;
    D.19610 = __builtin_expect (D.19609, 0);
    if (D.19610 != 0) goto <D.19611>; else goto <D.19612>;
    <D.19611>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1159, "ret == 0");
    <D.19612>:
  }
  ptr = shared_data_find_room (size);
  if (ptr == 0B) goto <D.19613>; else goto <D.19614>;
  <D.19613>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.19615>; else goto <D.19616>;
    <D.19615>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19616>:
    D.19617 = ret != 0;
    D.19618 = (long int) D.19617;
    D.19619 = __builtin_expect (D.19618, 0);
    if (D.19619 != 0) goto <D.19620>; else goto <D.19621>;
    <D.19620>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1162, "ret == 0");
    <D.19621>:
  }
  monoeg_g_free (name);
  D.19598 = 0B;
  return D.19598;
  <D.19614>:
  inst = ptr;
  inst->header.extra = 0;
  D.19622 = (short unsigned int) size;
  inst->header.size = D.19622;
  cat.7 = (int) cat;
  shared_area.8 = shared_area;
  shared_area.9 = (int) shared_area.8;
  D.19626 = cat.7 - shared_area.9;
  D.19627 = (unsigned int) D.19626;
  inst->category_offset = D.19627;
  D.19628 = cat->num_instances;
  D.19629 = D.19628 + 1;
  cat->num_instances = D.19629;
  p = &inst->instance_name;
  strcpy (p, name);
  D.19630 = strlen (name);
  D.19631 = D.19630 + 1;
  p = p + D.19631;
  inst->header.ftype = 73;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.19632>; else goto <D.19633>;
    <D.19632>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19633>:
    D.19634 = ret != 0;
    D.19635 = (long int) D.19634;
    D.19636 = __builtin_expect (D.19635, 0);
    if (D.19636 != 0) goto <D.19637>; else goto <D.19638>;
    <D.19637>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1176, "ret == 0");
    <D.19638>:
  }
  monoeg_g_free (name);
  D.19598 = inst;
  return D.19598;
}


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

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


instance_search (struct SharedHeader * header, void * data)
{
  unsigned char D.19648;
  unsigned int D.19651;
  unsigned int D.19652;
  struct MonoString * D.19655;
  char[1] * D.19658;
  int D.19659;
  gboolean D.19662;
  struct GSList * D.19664;
  struct GSList * D.19665;
  struct InstanceSearch * search;

  search = data;
  D.19648 = header->ftype;
  if (D.19648 == 73) goto <D.19649>; else goto <D.19650>;
  <D.19649>:
  {
    struct SharedInstance * ins;

    ins = header;
    D.19651 = search->cat_offset;
    D.19652 = ins->category_offset;
    if (D.19651 == D.19652) goto <D.19653>; else goto <D.19654>;
    <D.19653>:
    D.19655 = search->instance;
    if (D.19655 != 0B) goto <D.19656>; else goto <D.19657>;
    <D.19656>:
    D.19655 = search->instance;
    D.19658 = &ins->instance_name;
    D.19659 = mono_string_compare_ascii (D.19655, D.19658);
    if (D.19659 == 0) goto <D.19660>; else goto <D.19661>;
    <D.19660>:
    search->result = ins;
    D.19662 = 0;
    return D.19662;
    <D.19661>:
    goto <D.19663>;
    <D.19657>:
    D.19664 = search->list;
    D.19665 = monoeg_g_slist_prepend (D.19664, ins);
    search->list = D.19665;
    <D.19663>:
    <D.19654>:
  }
  <D.19650>:
  D.19662 = 1;
  return D.19662;
}


shared_data_find_room (int size)
{
  struct MonoSharedArea * shared_area.13;
  short unsigned int D.19668;
  sizetype D.19669;
  int D.19670;
  sizetype D.19671;
  unsigned char D.19672;
  int end.14;
  int p.15;
  int D.19677;
  unsigned char * D.19680;
  unsigned char * D.19681;
  short unsigned int D.19686;
  int D.19687;
  sizetype D.19690;
  unsigned char * p;
  unsigned char * end;

  shared_area.13 = shared_area;
  shared_area.13 = shared_area;
  D.19668 = shared_area.13->data_start;
  D.19669 = (sizetype) D.19668;
  p = shared_area.13 + D.19669;
  shared_area.13 = shared_area;
  shared_area.13 = shared_area;
  D.19670 = shared_area.13->size;
  D.19671 = (sizetype) D.19670;
  end = shared_area.13 + D.19671;
  size = size + 7;
  size = size & -8;
  goto <D.18945>;
  <D.18944>:
  {
    short unsigned int * next;

    D.19672 = *p;
    if (D.19672 == 0) goto <D.19673>; else goto <D.19674>;
    <D.19673>:
    end.14 = (int) end;
    p.15 = (int) p;
    D.19677 = end.14 - p.15;
    if (D.19677 > size) goto <D.19678>; else goto <D.19679>;
    <D.19678>:
    D.19680 = p;
    return D.19680;
    <D.19679>:
    D.19680 = 0B;
    return D.19680;
    <D.19674>:
    D.19681 = p + 4;
    if (D.19681 > end) goto <D.19682>; else goto <D.19683>;
    <D.19682>:
    D.19680 = 0B;
    return D.19680;
    <D.19683>:
    next = p + 2;
    D.19672 = *p;
    if (D.19672 == 68) goto <D.19684>; else goto <D.19685>;
    <D.19684>:
    D.19686 = *next;
    D.19687 = (int) D.19686;
    if (D.19687 == size) goto <D.19688>; else goto <D.19689>;
    <D.19688>:
    D.19680 = p;
    return D.19680;
    <D.19689>:
    <D.19685>:
    D.19686 = *next;
    D.19690 = (sizetype) D.19686;
    p = p + D.19690;
  }
  <D.18945>:
  if (p < end) goto <D.18944>; else goto <D.18946>;
  <D.18946>:
  D.19680 = 0B;
  return D.19680;
}


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

  D.19693 = __builtin_object_size (__dest, 1);
  D.19692 = __builtin___strcpy_chk (__dest, __src, D.19693);
  return D.19692;
}


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


custom_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  long long unsigned int D.19701;
  long long unsigned int value.16;
  long long unsigned int D.19703;
  gint64 D.19704;
  long long unsigned int value.17;
  guint64 * ptr;

  ptr = vtable->arg;
  if (ptr != 0B) goto <D.19697>; else goto <D.19698>;
  <D.19697>:
  if (do_incr != 0) goto <D.19699>; else goto <D.19700>;
  <D.19699>:
  D.19701 = *ptr;
  value.16 = (long long unsigned int) value;
  D.19703 = D.19701 + value.16;
  *ptr = D.19703;
  D.19701 = *ptr;
  D.19704 = (gint64) D.19701;
  return D.19704;
  <D.19700>:
  value.17 = (long long unsigned int) value;
  *ptr = value.17;
  D.19704 = value;
  return D.19704;
  <D.19698>:
  D.19704 = 0;
  return D.19704;
}


custom_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  struct SharedCounter * D.19709;
  unsigned char D.19710;
  int D.19711;
  int D.19712;
  void * D.19713;
  long long unsigned int D.19717;
  long long int D.19718;
  MonoBoolean D.19719;
  struct CustomVTable * counter_data;

  counter_data = vtable;
  if (only_value == 0) goto <D.19707>; else goto <D.19708>;
  <D.19707>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.19708>:
  D.19709 = counter_data->counter_desc;
  D.19710 = D.19709->type;
  D.19711 = (int) D.19710;
  D.19712 = simple_type_to_type[D.19711];
  sample->counterType = D.19712;
  D.19713 = vtable->arg;
  if (D.19713 == 0B) goto <D.19714>; else goto <D.19715>;
  <D.19714>:
  sample->rawValue = 0;
  goto <D.19716>;
  <D.19715>:
  D.19713 = vtable->arg;
  D.19717 = MEM[(guint64 *)D.19713];
  D.19718 = (long long int) D.19717;
  sample->rawValue = D.19718;
  <D.19716>:
  D.19719 = 1;
  return D.19719;
}


fill_sample (struct MonoCounterSample * sample)
{
  long long int D.19721;
  long long int D.19722;

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


cpu_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.19723;
  int D.19726;
  void * D.19727;
  short int D.19728;
  int D.19729;
  int D.19730;
  void * D.19731;
  int id;
  const struct CounterDesc * cdesc;

  D.19723 = id_from_string (instance, 0);
  id = D.19723 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[0], counter);
  if (cdesc != 0B) goto <D.19724>; else goto <D.19725>;
  <D.19724>:
  D.19726 = cdesc->type;
  *type = D.19726;
  D.19728 = cdesc->id;
  D.19729 = (int) D.19728;
  D.19730 = D.19729 | id;
  D.19731 = (void *) D.19730;
  D.19727 = create_vtable (D.19731, get_cpu_counter, 0B);
  return D.19727;
  <D.19725>:
  D.19727 = 0B;
  return D.19727;
}


get_cpu_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.19733;
  short int D.19736;
  int D.19737;
  int D.19738;
  int D.19739;
  long long int D.19740;
  MonoBoolean D.19741;
  long long int D.19742;
  long long int D.19743;
  long long int D.19744;
  long long int D.19745;
  MonoProcessError error;
  int id;
  int pid;

  try
    {
      D.19733 = vtable->arg;
      id = (int) D.19733;
      pid = id >> 5;
      id = id & 31;
      if (only_value == 0) goto <D.19734>; else goto <D.19735>;
      <D.19734>:
      fill_sample (sample);
      sample->baseValue = 1;
      <D.19735>:
      D.19736 = 0;
      D.19737 = (int) D.19736;
      D.19738 = D.19737 + id;
      D.19739 = predef_counters[D.19738].type;
      sample->counterType = D.19739;
      switch (id) <default: <D.19746>, case 0: <D.19063>, case 1: <D.19064>, case 2: <D.19065>, case 3: <D.19066>, case 4: <D.19067>>
      <D.19063>:
      D.19740 = mono_cpu_get_data (pid, 0, &error);
      sample->rawValue = D.19740;
      D.19741 = 1;
      return D.19741;
      <D.19064>:
      D.19742 = mono_cpu_get_data (pid, 1, &error);
      sample->rawValue = D.19742;
      D.19741 = 1;
      return D.19741;
      <D.19065>:
      D.19743 = mono_cpu_get_data (pid, 2, &error);
      sample->rawValue = D.19743;
      D.19741 = 1;
      return D.19741;
      <D.19066>:
      D.19744 = mono_cpu_get_data (pid, 3, &error);
      sample->rawValue = D.19744;
      D.19741 = 1;
      return D.19741;
      <D.19067>:
      D.19745 = mono_cpu_get_data (pid, 4, &error);
      sample->rawValue = D.19745;
      D.19741 = 1;
      return D.19741;
      <D.19746>:
      D.19741 = 0;
      return D.19741;
    }
  finally
    {
      error = {CLOBBER};
    }
}


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

  id = -1;
  D.19749 = mono_string_length (instance);
  if (D.19749 != 0) goto <D.19750>; else goto <D.19751>;
  <D.19750>:
  {
    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.19753>; else goto <D.19754>;
        <D.19753>:
        if (is_process == 0) goto <D.19755>; else goto <D.19756>;
        <D.19755>:
        id = -1;
        <D.19756>:
        <D.19754>:
        monoeg_g_free (id_str);
      }
    finally
      {
        end = {CLOBBER};
      }
  }
  <D.19751>:
  D.19757 = id;
  return D.19757;
}


get_counter_in_category (const struct CategoryDesc * desc, struct MonoString * counter)
{
  short int D.19759;
  int D.19760;
  const struct CategoryDesc * D.19761;
  short int D.19762;
  int D.19763;
  const char * D.19764;
  int D.19765;
  const struct CounterDesc * D.19768;
  const struct CounterDesc * cdesc;
  const struct CounterDesc * end;

  D.19759 = desc->first_counter;
  D.19760 = (int) D.19759;
  cdesc = &predef_counters[D.19760];
  D.19761 = desc + 12;
  D.19762 = D.19761->first_counter;
  D.19763 = (int) D.19762;
  end = &predef_counters[D.19763];
  goto <D.19043>;
  <D.19042>:
  D.19764 = cdesc->name;
  D.19765 = mono_string_compare_ascii (counter, D.19764);
  if (D.19765 == 0) goto <D.19766>; else goto <D.19767>;
  <D.19766>:
  D.19768 = cdesc;
  return D.19768;
  <D.19767>:
  cdesc = cdesc + 16;
  <D.19043>:
  if (cdesc < end) goto <D.19042>; else goto <D.19044>;
  <D.19044>:
  D.19768 = 0B;
  return D.19768;
}


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

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


process_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.19772;
  int D.19775;
  void * D.19776;
  short int D.19777;
  int D.19778;
  int D.19779;
  void * D.19780;
  int id;
  const struct CounterDesc * cdesc;

  D.19772 = id_from_string (instance, 1);
  id = D.19772 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[1], counter);
  if (cdesc != 0B) goto <D.19773>; else goto <D.19774>;
  <D.19773>:
  D.19775 = cdesc->type;
  *type = D.19775;
  D.19777 = cdesc->id;
  D.19778 = (int) D.19777;
  D.19779 = D.19778 | id;
  D.19780 = (void *) D.19779;
  D.19776 = create_vtable (D.19780, get_process_counter, 0B);
  return D.19776;
  <D.19774>:
  D.19776 = 0B;
  return D.19776;
}


get_process_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.19782;
  MonoBoolean D.19785;
  short int D.19788;
  int D.19789;
  int D.19790;
  int D.19791;
  void * pid.19;
  long long int D.19793;
  long long int D.19794;
  long long int D.19795;
  long long int D.19796;
  long long int D.19797;
  long long int D.19798;
  long long int D.19799;
  int id;
  int pid;

  D.19782 = vtable->arg;
  id = (int) D.19782;
  pid = id >> 5;
  if (pid < 0) goto <D.19783>; else goto <D.19784>;
  <D.19783>:
  D.19785 = 0;
  return D.19785;
  <D.19784>:
  id = id & 31;
  if (only_value == 0) goto <D.19786>; else goto <D.19787>;
  <D.19786>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.19787>:
  D.19788 = 5;
  D.19789 = (int) D.19788;
  D.19790 = D.19789 + id;
  D.19791 = predef_counters[D.19790].type;
  sample->counterType = D.19791;
  switch (id) <default: <D.19800>, case 0: <D.19108>, case 1: <D.19109>, case 2: <D.19110>, case 3: <D.19111>, case 4: <D.19112>, case 5: <D.19113>, case 6: <D.19114>>
  <D.19108>:
  pid.19 = (void *) pid;
  D.19793 = mono_process_get_data (pid.19, 1);
  sample->rawValue = D.19793;
  D.19785 = 1;
  return D.19785;
  <D.19109>:
  pid.19 = (void *) pid;
  D.19794 = mono_process_get_data (pid.19, 2);
  sample->rawValue = D.19794;
  D.19785 = 1;
  return D.19785;
  <D.19110>:
  pid.19 = (void *) pid;
  D.19795 = mono_process_get_data (pid.19, 3);
  sample->rawValue = D.19795;
  D.19785 = 1;
  return D.19785;
  <D.19111>:
  pid.19 = (void *) pid;
  D.19796 = mono_process_get_data (pid.19, 0);
  sample->rawValue = D.19796;
  D.19785 = 1;
  return D.19785;
  <D.19112>:
  pid.19 = (void *) pid;
  D.19797 = mono_process_get_data (pid.19, 7);
  sample->rawValue = D.19797;
  D.19785 = 1;
  return D.19785;
  <D.19113>:
  pid.19 = (void *) pid;
  D.19798 = mono_process_get_data (pid.19, 4);
  sample->rawValue = D.19798;
  D.19785 = 1;
  return D.19785;
  <D.19114>:
  pid.19 = (void *) pid;
  D.19799 = mono_process_get_data (pid.19, 6);
  sample->rawValue = D.19799;
  D.19785 = 1;
  return D.19785;
  <D.19800>:
  D.19785 = 0;
  return D.19785;
}


mono_mem_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.19804;
  void * D.19805;
  short int D.19806;
  int D.19807;
  void * D.19808;
  const struct CounterDesc * cdesc;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[2], counter);
  if (cdesc != 0B) goto <D.19802>; else goto <D.19803>;
  <D.19802>:
  D.19804 = cdesc->type;
  *type = D.19804;
  D.19806 = cdesc->id;
  D.19807 = (int) D.19806;
  D.19808 = (void *) D.19807;
  D.19805 = create_vtable (D.19808, mono_mem_counter, 0B);
  return D.19805;
  <D.19803>:
  D.19805 = 0B;
  return D.19805;
}


mono_mem_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.19810;
  short int D.19813;
  int D.19814;
  int D.19815;
  int D.19816;
  long long unsigned int D.19817;
  long long int D.19818;
  MonoBoolean D.19819;
  long long unsigned int D.19820;
  long long int D.19821;
  int id;

  D.19810 = vtable->arg;
  id = (int) D.19810;
  if (only_value == 0) goto <D.19811>; else goto <D.19812>;
  <D.19811>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.19812>:
  D.19813 = 12;
  D.19814 = (int) D.19813;
  D.19815 = D.19814 + id;
  D.19816 = predef_counters[D.19815].type;
  sample->counterType = D.19816;
  switch (id) <default: <D.19822>, case 0: <D.19129>, case 1: <D.19130>>
  <D.19129>:
  D.19817 = mono_stats.new_object_count;
  D.19818 = (long long int) D.19817;
  sample->rawValue = D.19818;
  D.19819 = 1;
  return D.19819;
  <D.19130>:
  D.19820 = mono_determine_physical_ram_size ();
  D.19821 = (long long int) D.19820;
  sample->rawValue = D.19821;
  D.19819 = 1;
  return D.19819;
  <D.19822>:
  D.19819 = 0;
  return D.19819;
}


mono_determine_physical_ram_size ()
{
  long int D.19824;
  long int D.19825;
  _Bool D.19826;
  _Bool D.19827;
  _Bool D.19828;
  guint64 D.19831;
  guint64 page_size;
  guint64 num_pages;

  page_size = 0;
  num_pages = 0;
  D.19824 = sysconf (30);
  page_size = (guint64) D.19824;
  D.19825 = sysconf (85);
  num_pages = (guint64) D.19825;
  D.19826 = page_size == 0;
  D.19827 = num_pages == 0;
  D.19828 = D.19826 | D.19827;
  if (D.19828 != 0) goto <D.19829>; else goto <D.19830>;
  <D.19829>:
  monoeg_g_log (0B, 16, "Your operating system\'s sysconf (3) function doesn\'t correctly report physical memory size!");
  D.19831 = 134217728;
  return D.19831;
  <D.19830>:
  D.19831 = page_size * num_pages;
  return D.19831;
}


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


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

  if (vtable == 0B) goto <D.19840>; else goto <D.19841>;
  <D.19840>:
  return;
  <D.19841>:
  narg = vtable->arg;
  if (narg == 0B) goto <D.19842>; else goto <D.19843>;
  <D.19842>:
  return;
  <D.19843>:
  D.19844 = narg->name;
  monoeg_g_free (D.19844);
  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.19848;
  int D.19849;
  int D.19850;
  int D.19851;
  int D.19852;
  char * D.19853;
  long long int D.19854;
  long long int D.19855;
  long long int D.19856;
  <unnamed type> error.20;
  MonoBoolean D.19861;
  MonoNetworkError error;
  struct NetworkVtableArg * narg;

  try
    {
      error = 2;
      narg = vtable->arg;
      if (only_value == 0) goto <D.19846>; else goto <D.19847>;
      <D.19846>:
      fill_sample (sample);
      <D.19847>:
      D.19848 = 93;
      D.19849 = (int) D.19848;
      D.19850 = narg->id;
      D.19851 = D.19849 + D.19850;
      D.19852 = predef_counters[D.19851].type;
      sample->counterType = D.19852;
      D.19850 = narg->id;
      switch (D.19850) <default: <D.19857>, case 0: <D.19083>, case 1: <D.19085>, case 2: <D.19086>>
      <D.19083>:
      D.19853 = narg->name;
      D.19854 = mono_network_get_data (D.19853, 0, &error);
      sample->rawValue = D.19854;
      goto <D.19084>;
      <D.19085>:
      D.19853 = narg->name;
      D.19855 = mono_network_get_data (D.19853, 1, &error);
      sample->rawValue = D.19855;
      goto <D.19084>;
      <D.19086>:
      D.19853 = narg->name;
      D.19856 = mono_network_get_data (D.19853, 2, &error);
      sample->rawValue = D.19856;
      goto <D.19084>;
      <D.19857>:
      <D.19084>:
      error.20 = error;
      if (error.20 == 0) goto <D.19859>; else goto <D.19860>;
      <D.19859>:
      D.19861 = 1;
      return D.19861;
      <D.19860>:
      D.19861 = 0;
      return D.19861;
    }
  finally
    {
      error = {CLOBBER};
    }
}


predef_writable_get_impl (int cat, struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  const struct CategoryDesc * D.19864;
  int D.19867;
  int D.19871;
  void * D.19872;
  short int D.19873;
  int D.19874;
  int D.19875;
  int D.19876;
  void * D.19877;
  const struct CounterDesc * cdesc;

  *custom = 1;
  D.19864 = &predef_categories[cat];
  cdesc = get_counter_in_category (D.19864, counter);
  if (cdesc != 0B) goto <D.19865>; else goto <D.19866>;
  <D.19865>:
  D.19867 = cdesc->type;
  *type = D.19867;
  if (instance == 0B) goto <D.19868>; else goto <D.19870>;
  <D.19870>:
  D.19871 = mono_string_compare_ascii (instance, "");
  if (D.19871 == 0) goto <D.19868>; else goto <D.19869>;
  <D.19868>:
  D.19873 = cdesc->id;
  D.19874 = (int) D.19873;
  D.19875 = D.19874 << 16;
  D.19876 = D.19875 | cat;
  D.19877 = (void *) D.19876;
  D.19872 = create_vtable (D.19877, predef_writable_counter, predef_writable_update);
  return D.19872;
  <D.19869>:
  D.19873 = cdesc->id;
  D.19874 = (int) D.19873;
  D.19875 = D.19874 << 16;
  D.19876 = D.19875 | cat;
  D.19877 = (void *) D.19876;
  D.19872 = predef_vtable (D.19877, instance);
  return D.19872;
  <D.19866>:
  D.19872 = 0B;
  return D.19872;
}


predef_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  void * D.19879;
  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.19897;
  guint32 * ptr.29;
  int D.19899;
  guint32 * ptr.30;
  int D.19903;
  guint32 * ptr.31;
  unsigned int D.19905;
  unsigned int D.19906;
  unsigned int D.19907;
  guint32 * ptr.32;
  unsigned int D.19909;
  guint32 * ptr.33;
  gint64 * ptr64.34;
  gint64 * ptr64.35;
  long long int D.19917;
  long long int D.19918;
  gint64 * ptr64.36;
  gint64 * ptr64.37;
  guint32 * volatile ptr;
  gint64 * volatile ptr64;
  int cat_id;
  int id;

  ptr = 0B;
  ptr64 = 0B;
  D.19879 = vtable->arg;
  cat_id = (int) D.19879;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  switch (cat_id) <default: <D.19889>, case 3: <D.19188>, case 12: <D.19193>>
  <D.19188>:
  switch (id) <default: <D.19883>, case 0: <D.19189>, case 1: <D.19191>>
  <D.19189>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.22 = &mono_perfcounters.21->aspnet_requests_queued;
  ptr = ptr.22;
  goto <D.19190>;
  <D.19191>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.23 = &mono_perfcounters.21->aspnet_requests;
  ptr = ptr.23;
  goto <D.19190>;
  <D.19883>:
  <D.19190>:
  goto <D.19192>;
  <D.19193>:
  switch (id) <default: <D.19888>, case 0: <D.19194>, case 2: <D.19196>, case 4: <D.19197>, case 5: <D.19198>>
  <D.19194>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr64.24 = &mono_perfcounters.21->threadpool_workitems;
  ptr64 = ptr64.24;
  goto <D.19195>;
  <D.19196>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr64.25 = &mono_perfcounters.21->threadpool_ioworkitems;
  ptr64 = ptr64.25;
  goto <D.19195>;
  <D.19197>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.26 = &mono_perfcounters.21->threadpool_threads;
  ptr = ptr.26;
  goto <D.19195>;
  <D.19198>:
  mono_perfcounters.21 = mono_perfcounters;
  ptr.27 = &mono_perfcounters.21->threadpool_iothreads;
  ptr = ptr.27;
  goto <D.19195>;
  <D.19888>:
  <D.19195>:
  goto <D.19192>;
  <D.19889>:
  <D.19192>:
  ptr.28 = ptr;
  if (ptr.28 != 0B) goto <D.19891>; else goto <D.19892>;
  <D.19891>:
  if (do_incr != 0) goto <D.19893>; else goto <D.19894>;
  <D.19893>:
  if (value == 1) goto <D.19895>; else goto <D.19896>;
  <D.19895>:
  ptr.29 = ptr;
  D.19899 = InterlockedIncrement (ptr.29);
  D.19897 = (gint64) D.19899;
  return D.19897;
  <D.19896>:
  if (value == -1) goto <D.19900>; else goto <D.19901>;
  <D.19900>:
  ptr.30 = ptr;
  D.19903 = InterlockedDecrement (ptr.30);
  D.19897 = (gint64) D.19903;
  return D.19897;
  <D.19901>:
  ptr.31 = ptr;
  D.19905 = *ptr.31;
  D.19906 = (unsigned int) value;
  D.19907 = D.19905 + D.19906;
  *ptr.31 = D.19907;
  ptr.32 = ptr;
  D.19909 = *ptr.32;
  D.19897 = (gint64) D.19909;
  return D.19897;
  <D.19894>:
  ptr.33 = ptr;
  D.19906 = (unsigned int) value;
  *ptr.33 = D.19906;
  D.19897 = value;
  return D.19897;
  <D.19892>:
  ptr64.34 = ptr64;
  if (ptr64.34 != 0B) goto <D.19912>; else goto <D.19913>;
  <D.19912>:
  if (do_incr != 0) goto <D.19914>; else goto <D.19915>;
  <D.19914>:
  ptr64.35 = ptr64;
  D.19917 = *ptr64.35;
  D.19918 = D.19917 + value;
  *ptr64.35 = D.19918;
  ptr64.36 = ptr64;
  D.19897 = *ptr64.36;
  return D.19897;
  <D.19915>:
  ptr64.37 = ptr64;
  *ptr64.37 = value;
  D.19897 = value;
  return D.19897;
  <D.19913>:
  D.19897 = 0;
  return D.19897;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.19922;
  unsigned int D.19923;

  D.19923 = __sync_add_and_fetch_4 (val, 1);
  D.19922 = (gint32) D.19923;
  return D.19922;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.19925;
  unsigned int D.19926;

  D.19926 = __sync_sub_and_fetch_4 (val, 1);
  D.19925 = (gint32) D.19926;
  return D.19925;
}


predef_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.19928;
  short int D.19931;
  int D.19932;
  int D.19933;
  int D.19934;
  struct MonoPerfCounters * mono_perfcounters.38;
  unsigned int D.19936;
  long long int D.19937;
  MonoBoolean D.19938;
  unsigned int D.19940;
  long long int D.19941;
  unsigned int D.19942;
  long long int D.19943;
  long long unsigned int D.19945;
  long long int D.19946;
  long long unsigned int D.19947;
  long long int D.19948;
  unsigned int D.19949;
  long long int D.19950;
  unsigned int D.19951;
  long long int D.19952;
  unsigned int D.19954;
  long long int D.19955;
  unsigned int D.19956;
  long long int D.19957;
  unsigned int D.19958;
  long long int D.19959;
  unsigned int D.19960;
  long long int D.19961;
  int cat_id;
  int id;

  D.19928 = vtable->arg;
  cat_id = (int) D.19928;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.19929>; else goto <D.19930>;
  <D.19929>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.19930>:
  D.19931 = predef_categories[cat_id].first_counter;
  D.19932 = (int) D.19931;
  D.19933 = D.19932 + id;
  D.19934 = predef_counters[D.19933].type;
  sample->counterType = D.19934;
  switch (cat_id) <default: <D.19963>, case 3: <D.19165>, case 4: <D.19173>, case 5: <D.19162>, case 12: <D.19168>>
  <D.19162>:
  switch (id) <default: <D.19939>, case 0: <D.19163>>
  <D.19163>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19936 = mono_perfcounters.38->exceptions_thrown;
  D.19937 = (long long int) D.19936;
  sample->rawValue = D.19937;
  D.19938 = 1;
  return D.19938;
  <D.19939>:
  goto <D.19164>;
  <D.19165>:
  switch (id) <default: <D.19944>, case 0: <D.19166>, case 1: <D.19167>>
  <D.19166>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19940 = mono_perfcounters.38->aspnet_requests_queued;
  D.19941 = (long long int) D.19940;
  sample->rawValue = D.19941;
  D.19938 = 1;
  return D.19938;
  <D.19167>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19942 = mono_perfcounters.38->aspnet_requests;
  D.19943 = (long long int) D.19942;
  sample->rawValue = D.19943;
  D.19938 = 1;
  return D.19938;
  <D.19944>:
  goto <D.19164>;
  <D.19168>:
  switch (id) <default: <D.19953>, case 0: <D.19169>, case 2: <D.19170>, case 4: <D.19171>, case 5: <D.19172>>
  <D.19169>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19945 = mono_perfcounters.38->threadpool_workitems;
  D.19946 = (long long int) D.19945;
  sample->rawValue = D.19946;
  D.19938 = 1;
  return D.19938;
  <D.19170>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19947 = mono_perfcounters.38->threadpool_ioworkitems;
  D.19948 = (long long int) D.19947;
  sample->rawValue = D.19948;
  D.19938 = 1;
  return D.19938;
  <D.19171>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19949 = mono_perfcounters.38->threadpool_threads;
  D.19950 = (long long int) D.19949;
  sample->rawValue = D.19950;
  D.19938 = 1;
  return D.19938;
  <D.19172>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19951 = mono_perfcounters.38->threadpool_iothreads;
  D.19952 = (long long int) D.19951;
  sample->rawValue = D.19952;
  D.19938 = 1;
  return D.19938;
  <D.19953>:
  goto <D.19164>;
  <D.19173>:
  switch (id) <default: <D.19962>, case 0: <D.19174>, case 1: <D.19175>, case 2: <D.19176>, case 3: <D.19177>, case 4: <D.19178>>
  <D.19174>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19954 = mono_perfcounters.38->jit_bytes;
  D.19955 = (long long int) D.19954;
  sample->rawValue = D.19955;
  D.19938 = 1;
  return D.19938;
  <D.19175>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19956 = mono_perfcounters.38->jit_methods;
  D.19957 = (long long int) D.19956;
  sample->rawValue = D.19957;
  D.19938 = 1;
  return D.19938;
  <D.19176>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19958 = mono_perfcounters.38->jit_time;
  D.19959 = (long long int) D.19958;
  sample->rawValue = D.19959;
  D.19938 = 1;
  return D.19938;
  <D.19177>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19954 = mono_perfcounters.38->jit_bytes;
  D.19955 = (long long int) D.19954;
  sample->rawValue = D.19955;
  D.19938 = 1;
  return D.19938;
  <D.19178>:
  mono_perfcounters.38 = mono_perfcounters;
  D.19960 = mono_perfcounters.38->jit_failures;
  D.19961 = (long long int) D.19960;
  sample->rawValue = D.19961;
  D.19938 = 1;
  return D.19938;
  <D.19962>:
  goto <D.19164>;
  <D.19963>:
  <D.19164>:
  D.19938 = 0;
  return D.19938;
}


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


predef_cleanup (struct ImplVtable * vtable)
{
  _Bool D.19974;
  long int D.19975;
  long int D.19976;
  struct GHashTable * pid_to_shared_area.39;
  _Bool D.19984;
  long int D.19985;
  long int D.19986;
  int D.19989;
  _Bool D.19992;
  long int D.19993;
  long int D.19994;
  struct PredefVtable * vt;

  vt = vtable;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.19972>; else goto <D.19973>;
    <D.19972>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.19973>:
    D.19974 = ret != 0;
    D.19975 = (long int) D.19974;
    D.19976 = __builtin_expect (D.19975, 0);
    if (D.19976 != 0) goto <D.19977>; else goto <D.19978>;
    <D.19977>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 389, "ret == 0");
    <D.19978>:
  }
  pid_to_shared_area.39 = pid_to_shared_area;
  if (pid_to_shared_area.39 == 0B) goto <D.19980>; else goto <D.19981>;
  <D.19980>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.19982>; else goto <D.19983>;
    <D.19982>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19983>:
    D.19984 = ret != 0;
    D.19985 = (long int) D.19984;
    D.19986 = __builtin_expect (D.19985, 0);
    if (D.19986 != 0) goto <D.19987>; else goto <D.19988>;
    <D.19987>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 391, "ret == 0");
    <D.19988>:
  }
  return;
  <D.19981>:
  D.19989 = vt->pid;
  unref_pid_unlocked (D.19989);
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.19990>; else goto <D.19991>;
    <D.19990>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.19991>:
    D.19992 = ret != 0;
    D.19993 = (long int) D.19992;
    D.19994 = __builtin_expect (D.19993, 0);
    if (D.19994 != 0) goto <D.19995>; else goto <D.19996>;
    <D.19995>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 395, "ret == 0");
    <D.19996>:
  }
}


unref_pid_unlocked (int pid)
{
  struct GHashTable * pid_to_shared_area.40;
  const void * pid.41;
  int D.20002;
  int D.20003;
  void * D.20006;
  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.20000>; else goto <D.20001>;
  <D.20000>:
  D.20002 = data->refcount;
  D.20003 = D.20002 + -1;
  data->refcount = D.20003;
  D.20002 = data->refcount;
  if (D.20002 == 0) goto <D.20004>; else goto <D.20005>;
  <D.20004>:
  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.20006 = data->sarea;
  mono_shared_area_unload (D.20006);
  monoeg_g_free (data);
  <D.20005>:
  <D.20001>:
}


predef_readonly_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.20007;
  short int D.20010;
  int D.20011;
  int D.20012;
  int D.20013;
  struct MonoPerfCounters * D.20014;
  short unsigned int D.20015;
  sizetype D.20016;
  guint32 * D.20017;
  unsigned int D.20018;
  long long int D.20019;
  MonoBoolean D.20020;
  struct PredefVtable * vt;
  const struct CounterDesc * desc;
  int cat_id;
  int id;

  vt = vtable;
  D.20007 = vtable->arg;
  cat_id = (int) D.20007;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.20008>; else goto <D.20009>;
  <D.20008>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.20009>:
  D.20010 = predef_categories[cat_id].first_counter;
  D.20011 = (int) D.20010;
  D.20012 = D.20011 + id;
  desc = &predef_counters[D.20012];
  D.20013 = desc->type;
  sample->counterType = D.20013;
  D.20014 = vt->counters;
  D.20015 = desc->offset;
  D.20016 = (sizetype) D.20015;
  D.20017 = D.20014 + D.20016;
  D.20018 = *D.20017;
  D.20019 = (long long int) D.20018;
  sample->rawValue = D.20019;
  D.20020 = 1;
  return D.20020;
}


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

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


load_sarea_for_pid (int pid)
{
  _Bool D.20026;
  long int D.20027;
  long int D.20028;
  struct GHashTable * pid_to_shared_area.42;
  struct GHashTable * pid_to_shared_area.43;
  const void * pid.44;
  void * pid.45;
  int D.20042;
  int D.20043;
  _Bool D.20046;
  long int D.20047;
  long int D.20048;
  struct MonoSharedArea * D.20051;
  struct ExternalSArea * data;
  struct MonoSharedArea * area;

  area = 0B;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20024>; else goto <D.20025>;
    <D.20024>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20025>:
    D.20026 = ret != 0;
    D.20027 = (long int) D.20026;
    D.20028 = __builtin_expect (D.20027, 0);
    if (D.20028 != 0) goto <D.20029>; else goto <D.20030>;
    <D.20029>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 348, "ret == 0");
    <D.20030>:
  }
  pid_to_shared_area.42 = pid_to_shared_area;
  if (pid_to_shared_area.42 == 0B) goto <D.20032>; else goto <D.20033>;
  <D.20032>:
  pid_to_shared_area.43 = monoeg_g_hash_table_new (0B, 0B);
  pid_to_shared_area = pid_to_shared_area.43;
  <D.20033>:
  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.20036>; else goto <D.20037>;
  <D.20036>:
  pid.45 = (void *) pid;
  area = mono_shared_area_for_pid (pid.45);
  if (area != 0B) goto <D.20039>; else goto <D.20040>;
  <D.20039>:
  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.20040>:
  goto <D.20041>;
  <D.20037>:
  area = data->sarea;
  D.20042 = data->refcount;
  D.20043 = D.20042 + 1;
  data->refcount = D.20043;
  <D.20041>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20044>; else goto <D.20045>;
    <D.20044>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20045>:
    D.20046 = ret != 0;
    D.20047 = (long int) D.20046;
    D.20048 = __builtin_expect (D.20047, 0);
    if (D.20048 != 0) goto <D.20049>; else goto <D.20050>;
    <D.20049>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 364, "ret == 0");
    <D.20050>:
  }
  D.20051 = area;
  return D.20051;
}


mono_perfcounter_get_sample (void * impl, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  MonoBoolean (*<T353d>) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) D.20055;
  MonoBoolean D.20058;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.20053>; else goto <D.20054>;
  <D.20053>:
  D.20055 = vtable->sample;
  if (D.20055 != 0B) goto <D.20056>; else goto <D.20057>;
  <D.20056>:
  D.20055 = vtable->sample;
  D.20058 = D.20055 (vtable, only_value, sample);
  return D.20058;
  <D.20057>:
  <D.20054>:
  D.20058 = 0;
  return D.20058;
}


mono_perfcounter_update_value (void * impl, MonoBoolean do_incr, gint64 value)
{
  gint64 (*<T3542>) (struct ImplVtable *, MonoBoolean, gint64) D.20062;
  gint64 D.20065;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.20060>; else goto <D.20061>;
  <D.20060>:
  D.20062 = vtable->update;
  if (D.20062 != 0B) goto <D.20063>; else goto <D.20064>;
  <D.20063>:
  D.20062 = vtable->update;
  D.20065 = D.20062 (vtable, do_incr, value);
  return D.20065;
  <D.20064>:
  <D.20061>:
  D.20065 = 0;
  return D.20065;
}


mono_perfcounter_free_data (void * impl)
{
  void (*<T3547>) (struct ImplVtable *) D.20069;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.20067>; else goto <D.20068>;
  <D.20067>:
  D.20069 = vtable->cleanup;
  if (D.20069 != 0B) goto <D.20070>; else goto <D.20071>;
  <D.20070>:
  D.20069 = vtable->cleanup;
  D.20069 (vtable);
  <D.20071>:
  <D.20068>:
  monoeg_g_free (impl);
}


mono_perfcounter_category_del (struct MonoString * name)
{
  MonoBoolean D.20074;
  _Bool D.20077;
  long int D.20078;
  long int D.20079;
  int D.20085;
  _Bool D.20088;
  long int D.20089;
  long int D.20090;
  _Bool D.20095;
  long int D.20096;
  long int D.20097;
  const struct CategoryDesc * cdesc;
  struct SharedCategory * cat;

  cdesc = find_category (name);
  if (cdesc != 0B) goto <D.20072>; else goto <D.20073>;
  <D.20072>:
  D.20074 = 0;
  return D.20074;
  <D.20073>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20075>; else goto <D.20076>;
    <D.20075>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20076>:
    D.20077 = ret != 0;
    D.20078 = (long int) D.20077;
    D.20079 = __builtin_expect (D.20078, 0);
    if (D.20079 != 0) goto <D.20080>; else goto <D.20081>;
    <D.20080>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1304, "ret == 0");
    <D.20081>:
  }
  cat = find_custom_category (name);
  if (cat == 0B) goto <D.20082>; else goto <D.20084>;
  <D.20084>:
  D.20085 = cat->num_instances;
  if (D.20085 != 0) goto <D.20082>; else goto <D.20083>;
  <D.20082>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20086>; else goto <D.20087>;
    <D.20086>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20087>:
    D.20088 = ret != 0;
    D.20089 = (long int) D.20088;
    D.20090 = __builtin_expect (D.20089, 0);
    if (D.20090 != 0) goto <D.20091>; else goto <D.20092>;
    <D.20091>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1308, "ret == 0");
    <D.20092>:
  }
  D.20074 = 0;
  return D.20074;
  <D.20083>:
  cat->header.ftype = 68;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20093>; else goto <D.20094>;
    <D.20093>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20094>:
    D.20095 = ret != 0;
    D.20096 = (long int) D.20095;
    D.20097 = __builtin_expect (D.20096, 0);
    if (D.20097 != 0) goto <D.20098>; else goto <D.20099>;
    <D.20098>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1312, "ret == 0");
    <D.20099>:
  }
  D.20074 = 1;
  return D.20074;
}


mono_perfcounter_category_help (struct MonoString * category, struct MonoString * machine)
{
  int D.20101;
  struct MonoString * D.20104;
  struct MonoDomain * D.20109;
  char * D.20110;
  struct MonoDomain * D.20111;
  const char * D.20112;
  const struct CategoryDesc * cdesc;

  D.20101 = mono_string_compare_ascii (machine, ".");
  if (D.20101 != 0) goto <D.20102>; else goto <D.20103>;
  <D.20102>:
  D.20104 = 0B;
  return D.20104;
  <D.20103>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.20105>; else goto <D.20106>;
  <D.20105>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.20107>; else goto <D.20108>;
    <D.20107>:
    D.20104 = 0B;
    return D.20104;
    <D.20108>:
    D.20109 = mono_domain_get ();
    D.20110 = custom_category_help (scat);
    D.20104 = mono_string_new (D.20109, D.20110);
    return D.20104;
  }
  <D.20106>:
  D.20111 = mono_domain_get ();
  D.20112 = cdesc->help;
  D.20104 = mono_string_new (D.20111, D.20112);
  return D.20104;
}


custom_category_help (struct SharedCategory * cat)
{
  char * D.20114;
  char[1] * D.20115;
  unsigned int D.20116;
  sizetype D.20117;

  D.20115 = &cat->name;
  D.20116 = strlen (D.20115);
  D.20117 = D.20116 + 1;
  D.20114 = &cat->name[D.20117];
  return D.20114;
}


mono_perfcounter_category_exists (struct MonoString * counter, struct MonoString * category, struct MonoString * machine)
{
  int D.20119;
  MonoBoolean D.20122;
  struct SharedCounter * D.20129;
  _Bool D.20130;
  const struct CounterDesc * D.20133;
  const struct CategoryDesc * cdesc;

  D.20119 = mono_string_compare_ascii (machine, ".");
  if (D.20119 != 0) goto <D.20120>; else goto <D.20121>;
  <D.20120>:
  D.20122 = 0;
  return D.20122;
  <D.20121>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.20123>; else goto <D.20124>;
  <D.20123>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.20125>; else goto <D.20126>;
    <D.20125>:
    D.20122 = 0;
    return D.20122;
    <D.20126>:
    if (counter == 0B) goto <D.20127>; else goto <D.20128>;
    <D.20127>:
    D.20122 = 1;
    return D.20122;
    <D.20128>:
    D.20129 = find_custom_counter (scat, counter);
    D.20130 = D.20129 != 0B;
    D.20122 = (MonoBoolean) D.20130;
    return D.20122;
  }
  <D.20124>:
  if (counter == 0B) goto <D.20131>; else goto <D.20132>;
  <D.20131>:
  D.20122 = 1;
  return D.20122;
  <D.20132>:
  D.20133 = get_counter_in_category (cdesc, counter);
  if (D.20133 != 0B) goto <D.20134>; else goto <D.20135>;
  <D.20134>:
  D.20122 = 1;
  return D.20122;
  <D.20135>:
  D.20122 = 0;
  return D.20122;
}


mono_perfcounter_create (struct MonoString * category, struct MonoString * help, int type, struct MonoArray * items)
{
  unsigned int D.20137;
  int D.20138;
  int D.20140;
  unsigned int num_counters.46;
  unsigned int D.20143;
  unsigned int D.20144;
  unsigned int D.20145;
  unsigned int D.20146;
  unsigned int D.20147;
  unsigned int i.47;
  char * D.20149;
  unsigned int i.48;
  unsigned int D.20151;
  char * * D.20152;
  struct MonoString * D.20153;
  char * D.20154;
  int D.20155;
  sizetype i.49;
  sizetype D.20158;
  sizetype D.20159;
  char * * D.20160;
  struct MonoString * D.20161;
  char * D.20162;
  int D.20163;
  unsigned int size.50;
  unsigned int D.20166;
  unsigned int D.20167;
  char * * D.20168;
  char * D.20169;
  unsigned int D.20171;
  unsigned int size.51;
  unsigned int D.20173;
  unsigned int D.20174;
  int D.20175;
  _Bool D.20179;
  long int D.20180;
  long int D.20181;
  _Bool D.20188;
  long int D.20189;
  long int D.20190;
  unsigned char D.20193;
  short unsigned int D.20194;
  short unsigned int D.20195;
  short unsigned int D.20196;
  unsigned int D.20197;
  sizetype D.20198;
  unsigned int D.20199;
  sizetype D.20200;
  char * D.20201;
  char * p.52;
  int D.20203;
  int D.20204;
  char D.20205;
  char * p.53;
  char D.20207;
  char * D.20208;
  unsigned int D.20209;
  sizetype D.20210;
  char * D.20211;
  unsigned int D.20212;
  sizetype D.20213;
  _Bool D.20216;
  long int D.20217;
  long int D.20218;
  MonoBoolean D.20223;
  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.20137 = mono_array_length (items);
      num_counters = (int) D.20137;
      name = 0B;
      chelp = 0B;
      counter_info = 0B;
      mono_error_init (&error);
      name = mono_string_to_utf8_checked (category, &error);
      D.20138 = mono_error_ok (&error);
      if (D.20138 == 0) goto failure; else goto <D.20139>;
      <D.20139>:
      chelp = mono_string_to_utf8_checked (help, &error);
      D.20140 = mono_error_ok (&error);
      if (D.20140 == 0) goto failure; else goto <D.20141>;
      <D.20141>:
      num_counters.46 = (unsigned int) num_counters;
      D.20143 = num_counters.46 * 8;
      counter_info = monoeg_malloc0 (D.20143);
      D.20144 = strlen (name);
      D.20145 = strlen (chelp);
      D.20146 = D.20144 + D.20145;
      D.20147 = D.20146 + 14;
      size = (int) D.20147;
      i = 0;
      goto <D.19343>;
      <D.19342>:
      {
        struct CounterCreationData * data;

        i.47 = (unsigned int) i;
        D.20149 = mono_array_addr_with_size (items, 4, i.47);
        data = MEM[(struct CounterCreationData * *)D.20149];
        i.48 = (unsigned int) i;
        D.20151 = i.48 * 8;
        D.20152 = counter_info + D.20151;
        D.20153 = data->name;
        D.20154 = mono_string_to_utf8_checked (D.20153, &error);
        *D.20152 = D.20154;
        D.20155 = mono_error_ok (&error);
        if (D.20155 == 0) goto failure; else goto <D.20156>;
        <D.20156>:
        i.49 = (sizetype) i;
        D.20158 = i.49 * 8;
        D.20159 = D.20158 + 4;
        D.20160 = counter_info + D.20159;
        D.20161 = data->help;
        D.20162 = mono_string_to_utf8_checked (D.20161, &error);
        *D.20160 = D.20162;
        D.20163 = mono_error_ok (&error);
        if (D.20163 == 0) goto failure; else goto <D.20164>;
        <D.20164>:
        size.50 = (unsigned int) size;
        D.20166 = size.50 + 4;
        size = (int) D.20166;
      }
      i = i + 1;
      <D.19343>:
      if (i < num_counters) goto <D.19342>; else goto <D.19344>;
      <D.19344>:
      i = 0;
      goto <D.19346>;
      <D.19345>:
      i.48 = (unsigned int) i;
      D.20167 = i.48 * 4;
      D.20168 = counter_info + D.20167;
      D.20169 = *D.20168;
      if (D.20169 == 0B) goto failure; else goto <D.20170>;
      <D.20170>:
      i.48 = (unsigned int) i;
      D.20167 = i.48 * 4;
      D.20168 = counter_info + D.20167;
      D.20169 = *D.20168;
      D.20171 = strlen (D.20169);
      size.51 = (unsigned int) size;
      D.20173 = D.20171 + size.51;
      D.20174 = D.20173 + 1;
      size = (int) D.20174;
      i = i + 1;
      <D.19346>:
      D.20175 = num_counters * 2;
      if (D.20175 > i) goto <D.19345>; else goto <D.19347>;
      <D.19347>:
      size = size + 7;
      size = size & -8;
      counters_data_size = num_counters * 8;
      if (size > 65535) goto failure; else goto <D.20176>;
      <D.20176>:
      {
        int ret;

        ret = pthread_mutex_lock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.20177>; else goto <D.20178>;
        <D.20177>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.20178>:
        D.20179 = ret != 0;
        D.20180 = (long int) D.20179;
        D.20181 = __builtin_expect (D.20180, 0);
        if (D.20181 != 0) goto <D.20182>; else goto <D.20183>;
        <D.20182>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1421, "ret == 0");
        <D.20183>:
      }
      ptr = shared_data_find_room (size);
      if (ptr == 0B) goto <D.20184>; else goto <D.20185>;
      <D.20184>:
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.20186>; else goto <D.20187>;
        <D.20186>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20187>:
        D.20188 = ret != 0;
        D.20189 = (long int) D.20188;
        D.20190 = __builtin_expect (D.20189, 0);
        if (D.20190 != 0) goto <D.20191>; else goto <D.20192>;
        <D.20191>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1424, "ret == 0");
        <D.20192>:
      }
      goto failure;
      <D.20185>:
      cat = ptr;
      D.20193 = (unsigned char) type;
      cat->header.extra = D.20193;
      D.20194 = (short unsigned int) size;
      cat->header.size = D.20194;
      D.20195 = (short unsigned int) num_counters;
      cat->num_counters = D.20195;
      D.20196 = (short unsigned int) counters_data_size;
      cat->counters_data_size = D.20196;
      p = &cat->name;
      strcpy (p, name);
      D.20197 = strlen (name);
      D.20198 = D.20197 + 1;
      p = p + D.20198;
      strcpy (p, chelp);
      D.20199 = strlen (chelp);
      D.20200 = D.20199 + 1;
      p = p + D.20200;
      i = 0;
      goto <D.19352>;
      <D.19351>:
      {
        struct CounterCreationData * data;

        i.47 = (unsigned int) i;
        D.20201 = mono_array_addr_with_size (items, 4, i.47);
        data = MEM[(struct CounterCreationData * *)D.20201];
        p.52 = p;
        p = p.52 + 1;
        D.20203 = data->type;
        D.20204 = perfctr_type_compress (D.20203);
        D.20205 = (char) D.20204;
        *p.52 = D.20205;
        p.53 = p;
        p = p.53 + 1;
        D.20207 = (char) i;
        *p.53 = D.20207;
        i.48 = (unsigned int) i;
        D.20151 = i.48 * 8;
        D.20152 = counter_info + D.20151;
        D.20208 = *D.20152;
        strcpy (p, D.20208);
        i.48 = (unsigned int) i;
        D.20151 = i.48 * 8;
        D.20152 = counter_info + D.20151;
        D.20208 = *D.20152;
        D.20209 = strlen (D.20208);
        D.20210 = D.20209 + 1;
        p = p + D.20210;
        i.49 = (sizetype) i;
        D.20158 = i.49 * 8;
        D.20159 = D.20158 + 4;
        D.20160 = counter_info + D.20159;
        D.20211 = *D.20160;
        strcpy (p, D.20211);
        i.49 = (sizetype) i;
        D.20158 = i.49 * 8;
        D.20159 = D.20158 + 4;
        D.20160 = counter_info + D.20159;
        D.20211 = *D.20160;
        D.20212 = strlen (D.20211);
        D.20213 = D.20212 + 1;
        p = p + D.20213;
      }
      i = i + 1;
      <D.19352>:
      if (i < num_counters) goto <D.19351>; else goto <D.19353>;
      <D.19353>:
      cat->header.ftype = 67;
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.20214>; else goto <D.20215>;
        <D.20214>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.20215>:
        D.20216 = ret != 0;
        D.20217 = (long int) D.20216;
        D.20218 = __builtin_expect (D.20217, 0);
        if (D.20218 != 0) goto <D.20219>; else goto <D.20220>;
        <D.20219>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1450, "ret == 0");
        <D.20220>:
      }
      result = 1;
      failure:
      if (counter_info != 0B) goto <D.20221>; else goto <D.20222>;
      <D.20221>:
      i = 0;
      goto <D.19356>;
      <D.19355>:
      i.48 = (unsigned int) i;
      D.20167 = i.48 * 4;
      D.20168 = counter_info + D.20167;
      D.20169 = *D.20168;
      monoeg_g_free (D.20169);
      i = i + 1;
      <D.19356>:
      D.20175 = num_counters * 2;
      if (D.20175 > i) goto <D.19355>; else goto <D.19357>;
      <D.19357>:
      monoeg_g_free (counter_info);
      <D.20222>:
      monoeg_g_free (name);
      monoeg_g_free (chelp);
      mono_error_cleanup (&error);
      D.20223 = (MonoBoolean) result;
      return D.20223;
    }
  finally
    {
      error = {CLOBBER};
    }
}


perfctr_type_compress (int type)
{
  int D.20226;
  int D.20229;
  unsigned int i.54;
  int i;

  i = 0;
  goto <D.18936>;
  <D.18935>:
  D.20226 = simple_type_to_type[i];
  if (D.20226 == type) goto <D.20227>; else goto <D.20228>;
  <D.20227>:
  D.20229 = i;
  return D.20229;
  <D.20228>:
  i = i + 1;
  <D.18936>:
  i.54 = (unsigned int) i;
  if (i.54 <= 27) goto <D.18935>; else goto <D.18937>;
  <D.18937>:
  D.20229 = 2;
  return D.20229;
}


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

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

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.20234>; else goto <D.20235>;
    <D.20234>:
    D.20236 = 0;
    return D.20236;
    <D.20235>:
    D.20237 = find_custom_instance (scat, instance);
    if (D.20237 != 0B) goto <D.20238>; else goto <D.20239>;
    <D.20238>:
    D.20236 = 1;
    return D.20236;
    <D.20239>:
  }
  goto <D.20240>;
  <D.20233>:
  <D.20240>:
  D.20236 = 0;
  return D.20236;
}


mono_perfcounter_category_names (struct MonoString * machine)
{
  int D.20242;
  struct MonoArray * D.20245;
  struct MonoClass * D.20246;
  _Bool D.20249;
  long int D.20250;
  long int D.20251;
  struct MonoClass * D.20254;
  unsigned int D.20255;
  unsigned int D.20256;
  unsigned int i.55;
  const char * D.20258;
  struct MonoString * D.20259;
  char[1] * D.20260;
  struct MonoString * D.20261;
  _Bool D.20264;
  long int D.20265;
  long int D.20266;
  int i;
  struct MonoArray * res;
  struct MonoDomain * domain;
  struct GSList * custom_categories;
  struct GSList * tmp;

  domain = mono_domain_get ();
  D.20242 = mono_string_compare_ascii (machine, ".");
  if (D.20242 != 0) goto <D.20243>; else goto <D.20244>;
  <D.20243>:
  D.20246 = mono_get_string_class ();
  D.20245 = mono_array_new (domain, D.20246, 0);
  return D.20245;
  <D.20244>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20247>; else goto <D.20248>;
    <D.20247>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20248>:
    D.20249 = ret != 0;
    D.20250 = (long int) D.20249;
    D.20251 = __builtin_expect (D.20250, 0);
    if (D.20251 != 0) goto <D.20252>; else goto <D.20253>;
    <D.20252>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1497, "ret == 0");
    <D.20253>:
  }
  custom_categories = get_custom_categories ();
  D.20254 = mono_get_string_class ();
  D.20255 = monoeg_g_slist_length (custom_categories);
  D.20256 = D.20255 + 14;
  res = mono_array_new (domain, D.20254, D.20256);
  i = 0;
  goto <D.19377>;
  <D.19376>:
  {
    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.20258 = cdesc->name;
      D.20259 = mono_string_new (domain, D.20258);
      mono_gc_wbarrier_set_arrayref (res, __p, D.20259);
    }
  }
  i = i + 1;
  <D.19377>:
  if (i <= 13) goto <D.19376>; else goto <D.19378>;
  <D.19378>:
  tmp = custom_categories;
  goto <D.19382>;
  <D.19381>:
  {
    struct SharedCategory * scat;

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

      i.55 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.55);
      D.20260 = &scat->name;
      D.20261 = mono_string_new (domain, D.20260);
      mono_gc_wbarrier_set_arrayref (res, __p, D.20261);
    }
    i = i + 1;
  }
  tmp = tmp->next;
  <D.19382>:
  if (tmp != 0B) goto <D.19381>; else goto <D.19383>;
  <D.19383>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20262>; else goto <D.20263>;
    <D.20262>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20263>:
    D.20264 = ret != 0;
    D.20265 = (long int) D.20264;
    D.20266 = __builtin_expect (D.20265, 0);
    if (D.20266 != 0) goto <D.20267>; else goto <D.20268>;
    <D.20267>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1509, "ret == 0");
    <D.20268>:
  }
  monoeg_g_slist_free (custom_categories);
  D.20245 = res;
  return D.20245;
}


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

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


category_collect (struct SharedHeader * header, void * data)
{
  unsigned char D.20273;
  struct GSList * D.20276;
  struct GSList * D.20277;
  gboolean D.20278;
  struct GSList * * list;

  list = data;
  D.20273 = header->ftype;
  if (D.20273 == 67) goto <D.20274>; else goto <D.20275>;
  <D.20274>:
  D.20276 = *list;
  D.20277 = monoeg_g_slist_prepend (D.20276, header);
  *list = D.20277;
  <D.20275>:
  D.20278 = 1;
  return D.20278;
}


mono_perfcounter_counter_names (struct MonoString * category, struct MonoString * machine)
{
  int D.20280;
  struct MonoArray * D.20283;
  struct MonoClass * D.20284;
  struct MonoClass * D.20287;
  const struct CategoryDesc * D.20288;
  short int D.20289;
  int D.20290;
  short int D.20291;
  int D.20292;
  int D.20293;
  unsigned int D.20294;
  int D.20295;
  unsigned int D.20296;
  const char * D.20297;
  struct MonoString * D.20298;
  _Bool D.20301;
  long int D.20302;
  long int D.20303;
  struct MonoClass * D.20308;
  short unsigned int D.20309;
  unsigned int D.20310;
  unsigned int i.56;
  const char * D.20312;
  struct MonoString * D.20313;
  unsigned int D.20314;
  sizetype D.20315;
  unsigned int D.20316;
  sizetype D.20317;
  int D.20318;
  _Bool D.20321;
  long int D.20322;
  long int D.20323;
  _Bool D.20328;
  long int D.20329;
  long int D.20330;
  struct MonoClass * D.20333;
  int i;
  struct SharedCategory * scat;
  const struct CategoryDesc * cdesc;
  struct MonoArray * res;
  struct MonoDomain * domain;

  domain = mono_domain_get ();
  D.20280 = mono_string_compare_ascii (machine, ".");
  if (D.20280 != 0) goto <D.20281>; else goto <D.20282>;
  <D.20281>:
  D.20284 = mono_get_string_class ();
  D.20283 = mono_array_new (domain, D.20284, 0);
  return D.20283;
  <D.20282>:
  cdesc = find_category (category);
  if (cdesc != 0B) goto <D.20285>; else goto <D.20286>;
  <D.20285>:
  D.20287 = mono_get_string_class ();
  D.20288 = cdesc + 12;
  D.20289 = D.20288->first_counter;
  D.20290 = (int) D.20289;
  D.20291 = cdesc->first_counter;
  D.20292 = (int) D.20291;
  D.20293 = D.20290 - D.20292;
  D.20294 = (unsigned int) D.20293;
  res = mono_array_new (domain, D.20287, D.20294);
  D.20291 = cdesc->first_counter;
  i = (int) D.20291;
  goto <D.19397>;
  <D.19396>:
  {
    const struct CounterDesc * desc;

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

      D.20291 = cdesc->first_counter;
      D.20292 = (int) D.20291;
      D.20295 = i - D.20292;
      D.20296 = (unsigned int) D.20295;
      __p = mono_array_addr_with_size (res, 4, D.20296);
      D.20297 = desc->name;
      D.20298 = mono_string_new (domain, D.20297);
      mono_gc_wbarrier_set_arrayref (res, __p, D.20298);
    }
  }
  i = i + 1;
  <D.19397>:
  D.20288 = cdesc + 12;
  D.20289 = D.20288->first_counter;
  D.20290 = (int) D.20289;
  if (D.20290 > i) goto <D.19396>; else goto <D.19398>;
  <D.19398>:
  D.20283 = res;
  return D.20283;
  <D.20286>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20299>; else goto <D.20300>;
    <D.20299>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.20300>:
    D.20301 = ret != 0;
    D.20302 = (long int) D.20301;
    D.20303 = __builtin_expect (D.20302, 0);
    if (D.20303 != 0) goto <D.20304>; else goto <D.20305>;
    <D.20304>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1534, "ret == 0");
    <D.20305>:
  }
  scat = find_custom_category (category);
  if (scat != 0B) goto <D.20306>; else goto <D.20307>;
  <D.20306>:
  {
    char * p;
    int i;

    p = custom_category_counters (scat);
    D.20308 = mono_get_string_class ();
    D.20309 = scat->num_counters;
    D.20310 = (unsigned int) D.20309;
    res = mono_array_new (domain, D.20308, D.20310);
    i = 0;
    goto <D.19404>;
    <D.19403>:
    {
      void * * __p;

      i.56 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.56);
      D.20312 = p + 1;
      D.20313 = mono_string_new (domain, D.20312);
      mono_gc_wbarrier_set_arrayref (res, __p, D.20313);
    }
    D.20312 = p + 1;
    D.20314 = strlen (D.20312);
    D.20315 = D.20314 + 2;
    p = p + D.20315;
    D.20316 = strlen (p);
    D.20317 = D.20316 + 1;
    p = p + D.20317;
    i = i + 1;
    <D.19404>:
    D.20309 = scat->num_counters;
    D.20318 = (int) D.20309;
    if (D.20318 > i) goto <D.19403>; else goto <D.19405>;
    <D.19405>:
    {
      int ret;

      ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
      if (ret != 0) goto <D.20319>; else goto <D.20320>;
      <D.20319>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.20320>:
      D.20321 = ret != 0;
      D.20322 = (long int) D.20321;
      D.20323 = __builtin_expect (D.20322, 0);
      if (D.20323 != 0) goto <D.20324>; else goto <D.20325>;
      <D.20324>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1545, "ret == 0");
      <D.20325>:
    }
    D.20283 = res;
    return D.20283;
  }
  <D.20307>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.20326>; else goto <D.20327>;
    <D.20326>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.20327>:
    D.20328 = ret != 0;
    D.20329 = (long int) D.20328;
    D.20330 = __builtin_expect (D.20329, 0);
    if (D.20330 != 0) goto <D.20331>; else goto <D.20332>;
    <D.20331>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1548, "ret == 0");
    <D.20332>:
  }
  D.20333 = mono_get_string_class ();
  D.20283 = mono_array_new (domain, D.20333, 0);
  return D.20283;
}


mono_perfcounter_instance_names (struct MonoString * category, struct MonoString * machine)
{
  int D.20335;
  struct MonoArray * D.20338;
  struct MonoDomain * D.20339;
  struct MonoClass * D.20340;
  <unnamed-unsigned:6> D.20343;
  int D.20344;
  struct MonoDomain * D.20345;
  struct MonoClass * D.20346;
  const struct CategoryDesc * cat;

  D.20335 = mono_string_compare_ascii (machine, ".");
  if (D.20335 != 0) goto <D.20336>; else goto <D.20337>;
  <D.20336>:
  D.20339 = mono_domain_get ();
  D.20340 = mono_get_string_class ();
  D.20338 = mono_array_new (D.20339, D.20340, 0);
  return D.20338;
  <D.20337>:
  cat = find_category (category);
  if (cat == 0B) goto <D.20341>; else goto <D.20342>;
  <D.20341>:
  D.20338 = get_custom_instances (category);
  return D.20338;
  <D.20342>:
  D.20343 = cat->instance_type;
  D.20344 = (int) D.20343;
  switch (D.20344) <default: <D.19490>, case 0: <D.19487>, case 1: <D.19489>, case 2: <D.19486>, case 3: <D.19485>, case 4: <D.19488>>
  <D.19485>:
  D.20338 = get_mono_instances ();
  return D.20338;
  <D.19486>:
  D.20338 = get_cpu_instances ();
  return D.20338;
  <D.19487>:
  D.20338 = get_processes_instances ();
  return D.20338;
  <D.19488>:
  D.20338 = get_networkinterface_instances ();
  return D.20338;
  <D.19489>:
  <D.19490>:
  D.20345 = mono_domain_get ();
  D.20346 = mono_get_string_class ();
  D.20338 = mono_array_new (D.20345, D.20346, 0);
  return D.20338;
}


get_custom_instances (struct MonoString * category)
{
  struct MonoDomain * D.20350;
  struct MonoClass * D.20351;
  unsigned int D.20352;
  unsigned int i.57;
  struct MonoDomain * D.20354;
  char[1] * D.20355;
  struct MonoString * D.20356;
  struct MonoArray * D.20357;
  struct MonoDomain * D.20358;
  struct MonoClass * D.20359;
  struct SharedCategory * scat;

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

    list = get_custom_instances_list (scat);
    i = 0;
    D.20350 = mono_domain_get ();
    D.20351 = mono_get_string_class ();
    D.20352 = monoeg_g_slist_length (list);
    array = mono_array_new (D.20350, D.20351, D.20352);
    tmp = list;
    goto <D.19478>;
    <D.19477>:
    {
      struct SharedInstance * inst;

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

        i.57 = (unsigned int) i;
        __p = mono_array_addr_with_size (array, 4, i.57);
        D.20354 = mono_domain_get ();
        D.20355 = &inst->instance_name;
        D.20356 = mono_string_new (D.20354, D.20355);
        mono_gc_wbarrier_set_arrayref (array, __p, D.20356);
      }
      i = i + 1;
    }
    tmp = tmp->next;
    <D.19478>:
    if (tmp != 0B) goto <D.19477>; else goto <D.19479>;
    <D.19479>:
    monoeg_g_slist_free (list);
    D.20357 = array;
    return D.20357;
  }
  <D.20349>:
  D.20358 = mono_domain_get ();
  D.20359 = mono_get_string_class ();
  D.20357 = mono_array_new (D.20358, D.20359, 0);
  return D.20357;
}


get_custom_instances_list (struct SharedCategory * cat)
{
  int cat.58;
  struct MonoSharedArea * shared_area.59;
  int shared_area.60;
  int D.20364;
  unsigned int D.20365;
  struct GSList * D.20366;
  struct InstanceSearch search;

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


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

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


get_string_array (void * * array, int count, gboolean is_process)
{
  struct MonoDomain * D.20373;
  struct MonoClass * D.20374;
  unsigned int count.62;
  unsigned int i.63;
  unsigned int D.20379;
  void * * D.20380;
  void * D.20381;
  int D.20382;
  unsigned int i.64;
  struct MonoString * D.20385;
  struct MonoArray * D.20388;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.20373 = mono_domain_get ();
  D.20374 = mono_get_string_class ();
  count.62 = (unsigned int) count;
  res = mono_array_new (D.20373, D.20374, count.62);
  i = 0;
  goto <D.19421>;
  <D.19420>:
  {
    char buf[128];
    char * p;

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

          i.63 = (unsigned int) i;
          D.20379 = i.63 * 4;
          D.20380 = array + D.20379;
          D.20381 = *D.20380;
          pname = mono_process_get_name (D.20381, &buf, 128);
          i.63 = (unsigned int) i;
          D.20379 = i.63 * 4;
          D.20380 = array + D.20379;
          D.20381 = *D.20380;
          D.20382 = (int) D.20381;
          p = monoeg_g_strdup_printf ("%d/%s", D.20382, pname);
        }
        goto <D.20383>;
        <D.20377>:
        i.63 = (unsigned int) i;
        D.20379 = i.63 * 4;
        D.20380 = array + D.20379;
        D.20381 = *D.20380;
        D.20382 = (int) D.20381;
        sprintf (&buf, "%d", D.20382);
        p = &buf;
        <D.20383>:
        {
          void * * __p;

          i.64 = (unsigned int) i;
          __p = mono_array_addr_with_size (res, 4, i.64);
          D.20385 = mono_string_new (domain, p);
          mono_gc_wbarrier_set_arrayref (res, __p, D.20385);
        }
        if (&buf != p) goto <D.20386>; else goto <D.20387>;
        <D.20386>:
        monoeg_g_free (p);
        <D.20387>:
      }
    finally
      {
        buf = {CLOBBER};
      }
  }
  i = i + 1;
  <D.19421>:
  if (i < count) goto <D.19420>; else goto <D.19422>;
  <D.19422>:
  D.20388 = res;
  return D.20388;
}


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

  D.20391 = __builtin_object_size (__s, 1);
  D.20390 = __builtin___sprintf_chk (__s, 1, D.20391, __fmt, __builtin_va_arg_pack ());
  return D.20390;
}


get_cpu_instances ()
{
  int D.20393;
  unsigned int count.65;
  unsigned int D.20395;
  unsigned int i.66;
  unsigned int D.20397;
  void * * D.20398;
  int D.20399;
  void * D.20400;
  struct MonoDomain * D.20401;
  struct MonoString * D.20402;
  struct MonoArray * D.20403;
  void * * buf;
  int i;
  int count;
  struct MonoArray * array;

  buf = 0B;
  D.20393 = mono_cpu_count ();
  count = D.20393 + 1;
  count.65 = (unsigned int) count;
  D.20395 = count.65 * 4;
  buf = monoeg_malloc (D.20395);
  i = 0;
  goto <D.19452>;
  <D.19451>:
  i.66 = (unsigned int) i;
  D.20397 = i.66 * 4;
  D.20398 = buf + D.20397;
  D.20399 = i + -1;
  D.20400 = (void *) D.20399;
  *D.20398 = D.20400;
  i = i + 1;
  <D.19452>:
  if (i < count) goto <D.19451>; else goto <D.19453>;
  <D.19453>:
  array = get_string_array (buf, count, 0);
  monoeg_g_free (buf);
  {
    void * * __p;

    __p = mono_array_addr_with_size (array, 4, 0);
    D.20401 = mono_domain_get ();
    D.20402 = mono_string_new (D.20401, "_Total");
    mono_gc_wbarrier_set_arrayref (array, __p, D.20402);
  }
  D.20403 = array;
  return D.20403;
}


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

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


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

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


get_string_array_of_strings (void * * array, int count)
{
  struct MonoDomain * D.20417;
  struct MonoClass * D.20418;
  unsigned int count.69;
  unsigned int i.70;
  unsigned int D.20421;
  void * * D.20422;
  unsigned int i.71;
  struct MonoString * D.20424;
  struct MonoArray * D.20425;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.20417 = mono_domain_get ();
  D.20418 = mono_get_string_class ();
  count.69 = (unsigned int) count;
  res = mono_array_new (D.20417, D.20418, count.69);
  i = 0;
  goto <D.19433>;
  <D.19432>:
  {
    char * p;

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

      i.71 = (unsigned int) i;
      __p = mono_array_addr_with_size (res, 4, i.71);
      D.20424 = mono_string_new (domain, p);
      mono_gc_wbarrier_set_arrayref (res, __p, D.20424);
    }
  }
  i = i + 1;
  <D.19433>:
  if (i < count) goto <D.19432>; else goto <D.19434>;
  <D.19434>:
  D.20425 = res;
  return D.20425;
}


