mono_perfcounters_init ()
{
  void * D.17437;
  struct MonoSharedArea * shared_area.0;
  short unsigned int D.17439;
  struct MonoPerfCounters * D.17440;
  int d_offset;

  d_offset = 296;
  d_offset = d_offset + 7;
  d_offset = d_offset & -8;
  InitializeCriticalSection (&perfctr_mutex);
  D.17437 = mono_shared_area ();
  shared_area = D.17437;
  shared_area.0 = shared_area;
  shared_area.0->counters_start = 32;
  shared_area.0 = shared_area;
  shared_area.0->counters_size = 264;
  shared_area.0 = shared_area;
  D.17439 = (short unsigned int) d_offset;
  shared_area.0->data_start = D.17439;
  shared_area.0 = shared_area;
  shared_area.0->size = 4096;
  shared_area.0 = shared_area;
  D.17440 = &shared_area.0->counters;
  mono_perfcounters = D.17440;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_get_impl (struct MonoString * category, struct MonoString * counter, struct MonoString * instance, struct MonoString * machine, int * type, MonoBoolean * custom)
{
  int D.17441;
  void * D.17444;
  unsigned char D.17449;
  int D.17450;
  const struct CategoryDesc * cdesc;

  D.17441 = mono_string_compare_ascii (machine, ".");
  if (D.17441 != 0) goto <D.17442>; else goto <D.17443>;
  <D.17442>:
  D.17444 = 0B;
  return D.17444;
  <D.17443>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17445>; else goto <D.17446>;
  <D.17445>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17447>; else goto <D.17448>;
    <D.17447>:
    D.17444 = 0B;
    return D.17444;
    <D.17448>:
    *custom = 1;
    D.17444 = custom_get_impl (scat, counter, instance, type);
    return D.17444;
  }
  <D.17446>:
  D.17449 = cdesc->id;
  D.17450 = (int) D.17449;
  switch (D.17450) <default: <D.17451>, case 0: <D.17210>, case 1: <D.17211>, case 2: <D.17212>, case 3: <D.17222>, case 4: <D.17214>, case 5: <D.17215>, case 6: <D.17216>, case 7: <D.17217>, case 8: <D.17218>, case 9: <D.17219>, case 10: <D.17220>, case 11: <D.17221>, case 12: <D.17223>, case 13: <D.17213>>
  <D.17210>:
  D.17444 = cpu_get_impl (counter, instance, type, custom);
  return D.17444;
  <D.17211>:
  D.17444 = process_get_impl (counter, instance, type, custom);
  return D.17444;
  <D.17212>:
  D.17444 = mono_mem_get_impl (counter, instance, type, custom);
  return D.17444;
  <D.17213>:
  D.17444 = network_get_impl (counter, instance, type, custom);
  return D.17444;
  <D.17214>:
  <D.17215>:
  <D.17216>:
  <D.17217>:
  <D.17218>:
  <D.17219>:
  <D.17220>:
  <D.17221>:
  <D.17222>:
  <D.17223>:
  D.17449 = cdesc->id;
  D.17450 = (int) D.17449;
  D.17444 = predef_writable_get_impl (D.17450, counter, instance, type, custom);
  return D.17444;
  <D.17451>:
  D.17444 = 0B;
  return D.17444;
}


mono_string_compare_ascii (struct MonoString * str, const char * ascii_str)
{
  short unsigned int D.17453;
  int D.17456;
  const char * ascii_str.1;
  char D.17458;
  short unsigned int D.17459;
  int D.17460;
  const char * D.17461;
  unsigned char D.17462;
  int D.17463;
  guint16 * strc;

  strc = mono_string_chars (str);
  goto <D.16917>;
  <D.16916>:
  D.17453 = *strc;
  if (D.17453 == 0) goto <D.17454>; else goto <D.17455>;
  <D.17454>:
  D.17456 = 0;
  return D.17456;
  <D.17455>:
  strc = strc + 2;
  <D.16917>:
  D.17453 = *strc;
  ascii_str.1 = ascii_str;
  ascii_str = ascii_str.1 + 1;
  D.17458 = *ascii_str.1;
  D.17459 = (short unsigned int) D.17458;
  if (D.17453 == D.17459) goto <D.16916>; else goto <D.16918>;
  <D.16918>:
  D.17453 = *strc;
  D.17460 = (int) D.17453;
  D.17461 = ascii_str + 18446744073709551615;
  D.17462 = MEM[(const unsigned char *)D.17461];
  D.17463 = (int) D.17462;
  D.17456 = D.17460 - D.17463;
  return D.17456;
}


find_category (struct MonoString * category)
{
  const char * D.17465;
  int D.17466;
  const struct CategoryDesc * D.17469;
  int i;

  i = 0;
  goto <D.17198>;
  <D.17197>:
  D.17465 = predef_categories[i].name;
  D.17466 = mono_string_compare_ascii (category, D.17465);
  if (D.17466 == 0) goto <D.17467>; else goto <D.17468>;
  <D.17467>:
  D.17469 = &predef_categories[i];
  return D.17469;
  <D.17468>:
  i = i + 1;
  <D.17198>:
  if (i <= 13) goto <D.17197>; else goto <D.17199>;
  <D.17199>:
  D.17469 = 0B;
  return D.17469;
}


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

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


category_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17474;
  struct MonoString * D.17477;
  char[1] * D.17478;
  int D.17479;
  gboolean D.17482;
  struct CatSearch * search;

  search = data;
  D.17474 = header->ftype;
  if (D.17474 == 67) goto <D.17475>; else goto <D.17476>;
  <D.17475>:
  {
    struct SharedCategory * cat;

    cat = header;
    D.17477 = search->name;
    D.17478 = &cat->name;
    D.17479 = mono_string_compare_ascii (D.17477, D.17478);
    if (D.17479 == 0) goto <D.17480>; else goto <D.17481>;
    <D.17480>:
    search->cat = cat;
    D.17482 = 0;
    return D.17482;
    <D.17481>:
  }
  <D.17476>:
  D.17482 = 1;
  return D.17482;
}


foreach_shared_item (gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  struct MonoSharedArea * shared_area.2;
  short unsigned int D.17485;
  sizetype D.17486;
  int D.17487;
  sizetype D.17488;
  unsigned char * p;
  unsigned char * end;

  shared_area.2 = shared_area;
  shared_area.2 = shared_area;
  D.17485 = shared_area.2->data_start;
  D.17486 = (sizetype) D.17485;
  p = shared_area.2 + D.17486;
  shared_area.2 = shared_area;
  shared_area.2 = shared_area;
  D.17487 = shared_area.2->size;
  D.17488 = (sizetype) D.17487;
  end = shared_area.2 + D.17488;
  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.17489;
  int D.17492;
  unsigned char D.17495;
  short unsigned int D.17498;
  sizetype D.17499;

  goto <D.16903>;
  <D.16902>:
  {
    short unsigned int * next;

    D.17489 = p + 4;
    if (D.17489 > end) goto <D.17490>; else goto <D.17491>;
    <D.17490>:
    return;
    <D.17491>:
    next = p + 2;
    D.17492 = func (p, data);
    if (D.17492 == 0) goto <D.17493>; else goto <D.17494>;
    <D.17493>:
    return;
    <D.17494>:
    D.17495 = *p;
    if (D.17495 == 0) goto <D.17496>; else goto <D.17497>;
    <D.17496>:
    return;
    <D.17497>:
    D.17498 = *next;
    D.17499 = (sizetype) D.17498;
    p = p + D.17499;
  }
  <D.16903>:
  if (p < end) goto <D.16902>; else goto <D.16904>;
  <D.16904>:
}


custom_get_impl (struct SharedCategory * cat, struct MonoString * counter, struct MonoString * instance, int * type)
{
  void * D.17503;
  unsigned char D.17504;
  int D.17505;
  int D.17506;
  char[1] * D.17509;
  long unsigned int D.17510;
  unsigned int D.17511;
  unsigned int D.17512;
  sizetype D.17513;
  unsigned char D.17514;
  long unsigned int D.17515;
  long unsigned int D.17516;
  sizetype D.17517;
  char * D.17518;
  struct SharedCounter * scounter;
  struct SharedInstance * inst;
  int size;

  scounter = find_custom_counter (cat, counter);
  if (scounter == 0B) goto <D.17501>; else goto <D.17502>;
  <D.17501>:
  D.17503 = 0B;
  return D.17503;
  <D.17502>:
  D.17504 = scounter->type;
  D.17505 = (int) D.17504;
  D.17506 = simple_type_to_type[D.17505];
  *type = D.17506;
  inst = custom_get_instance (cat, scounter, instance);
  if (inst == 0B) goto <D.17507>; else goto <D.17508>;
  <D.17507>:
  D.17503 = 0B;
  return D.17503;
  <D.17508>:
  D.17509 = &inst->instance_name;
  D.17510 = __strlen_g (D.17509);
  D.17511 = (unsigned int) D.17510;
  D.17512 = D.17511 + 12;
  size = (int) D.17512;
  size = size + 7;
  size = size & -8;
  D.17513 = (sizetype) size;
  D.17514 = scounter->seq_num;
  D.17515 = (long unsigned int) D.17514;
  D.17516 = D.17515 * 8;
  D.17517 = D.17513 + D.17516;
  D.17518 = inst + D.17517;
  D.17503 = custom_vtable (scounter, inst, D.17518);
  return D.17503;
}


find_custom_counter (struct SharedCategory * cat, struct MonoString * name)
{
  char[1] * D.17520;
  int D.17521;
  struct SharedCounter * D.17524;
  char * D.17525;
  long unsigned int D.17526;
  long unsigned int D.17527;
  long unsigned int D.17528;
  long unsigned int D.17529;
  short unsigned int D.17530;
  int D.17531;
  int i;
  char * p;

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

    counter = p;
    D.17520 = &counter->name;
    D.17521 = mono_string_compare_ascii (name, D.17520);
    if (D.17521 == 0) goto <D.17522>; else goto <D.17523>;
    <D.17522>:
    D.17524 = counter;
    return D.17524;
    <D.17523>:
    D.17525 = p + 1;
    D.17526 = __strlen_g (D.17525);
    D.17527 = D.17526 + 2;
    p = p + D.17527;
    D.17528 = __strlen_g (p);
    D.17529 = D.17528 + 1;
    p = p + D.17529;
  }
  i = i + 1;
  <D.16954>:
  D.17530 = cat->num_counters;
  D.17531 = (int) D.17530;
  if (D.17531 > i) goto <D.16953>; else goto <D.16955>;
  <D.16955>:
  D.17524 = 0B;
  return D.17524;
}


custom_category_counters (struct SharedCategory * cat)
{
  char[1] * D.17533;
  long unsigned int D.17534;
  sizetype D.17535;
  long unsigned int D.17536;
  long unsigned int D.17537;
  char * D.17538;
  char * p;

  D.17533 = &cat->name;
  D.17533 = &cat->name;
  D.17534 = __strlen_g (D.17533);
  D.17535 = D.17534 + 1;
  p = D.17533 + D.17535;
  D.17536 = __strlen_g (p);
  D.17537 = D.17536 + 1;
  p = p + D.17537;
  D.17538 = p;
  return D.17538;
}


custom_get_instance (struct SharedCategory * cat, struct SharedCounter * scounter, struct MonoString * instance)
{
  struct SharedInstance * D.17542;
  long unsigned int D.17543;
  unsigned int D.17544;
  unsigned int D.17545;
  short unsigned int D.17546;
  unsigned int D.17547;
  unsigned int D.17548;
  unsigned int size.3;
  unsigned int D.17550;
  _Bool D.17553;
  long int D.17554;
  long int D.17555;
  _Bool D.17562;
  long int D.17563;
  long int D.17564;
  short unsigned int D.17567;
  long int cat.4;
  struct MonoSharedArea * shared_area.5;
  long int shared_area.6;
  long int D.17571;
  unsigned int D.17572;
  int D.17573;
  int D.17574;
  long unsigned int D.17575;
  long unsigned int D.17576;
  _Bool D.17579;
  long int D.17580;
  long int D.17581;
  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.17540>; else goto <D.17541>;
  <D.17540>:
  D.17542 = inst;
  return D.17542;
  <D.17541>:
  name = mono_string_to_utf8 (instance);
  D.17543 = __strlen_g (name);
  D.17544 = (unsigned int) D.17543;
  D.17545 = D.17544 + 12;
  size = (int) D.17545;
  size = size + 7;
  size = size & -8;
  data_offset = size;
  D.17546 = cat->num_counters;
  D.17547 = (unsigned int) D.17546;
  D.17548 = D.17547 * 8;
  size.3 = (unsigned int) size;
  D.17550 = D.17548 + size.3;
  size = (int) D.17550;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17551>; else goto <D.17552>;
    <D.17551>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17552>:
    D.17553 = ret != 0;
    D.17554 = (long int) D.17553;
    D.17555 = __builtin_expect (D.17554, 0);
    if (D.17555 != 0) goto <D.17556>; else goto <D.17557>;
    <D.17556>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1159, "ret == 0");
    <D.17557>:
  }
  ptr = shared_data_find_room (size);
  if (ptr == 0B) goto <D.17558>; else goto <D.17559>;
  <D.17558>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17560>; else goto <D.17561>;
    <D.17560>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17561>:
    D.17562 = ret != 0;
    D.17563 = (long int) D.17562;
    D.17564 = __builtin_expect (D.17563, 0);
    if (D.17564 != 0) goto <D.17565>; else goto <D.17566>;
    <D.17565>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1162, "ret == 0");
    <D.17566>:
  }
  monoeg_g_free (name);
  D.17542 = 0B;
  return D.17542;
  <D.17559>:
  inst = ptr;
  inst->header.extra = 0;
  D.17567 = (short unsigned int) size;
  inst->header.size = D.17567;
  cat.4 = (long int) cat;
  shared_area.5 = shared_area;
  shared_area.6 = (long int) shared_area.5;
  D.17571 = cat.4 - shared_area.6;
  D.17572 = (unsigned int) D.17571;
  inst->category_offset = D.17572;
  D.17573 = cat->num_instances;
  D.17574 = D.17573 + 1;
  cat->num_instances = D.17574;
  p = &inst->instance_name;
  strcpy (p, name);
  D.17575 = __strlen_g (name);
  D.17576 = D.17575 + 1;
  p = p + D.17576;
  inst->header.ftype = 73;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17577>; else goto <D.17578>;
    <D.17577>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17578>:
    D.17579 = ret != 0;
    D.17580 = (long int) D.17579;
    D.17581 = __builtin_expect (D.17580, 0);
    if (D.17581 != 0) goto <D.17582>; else goto <D.17583>;
    <D.17582>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1176, "ret == 0");
    <D.17583>:
  }
  monoeg_g_free (name);
  D.17542 = inst;
  return D.17542;
}


find_custom_instance (struct SharedCategory * cat, struct MonoString * instance)
{
  long int cat.7;
  struct MonoSharedArea * shared_area.8;
  long int shared_area.9;
  long int D.17588;
  unsigned int D.17589;
  struct SharedInstance * D.17590;
  struct InstanceSearch search;

  try
    {
      cat.7 = (long int) cat;
      shared_area.8 = shared_area;
      shared_area.9 = (long int) shared_area.8;
      D.17588 = cat.7 - shared_area.9;
      D.17589 = (unsigned int) D.17588;
      search.cat_offset = D.17589;
      search.cat = cat;
      search.instance = instance;
      search.list = 0B;
      search.result = 0B;
      foreach_shared_item (instance_search, &search);
      D.17590 = search.result;
      return D.17590;
    }
  finally
    {
      search = {CLOBBER};
    }
}


instance_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17593;
  unsigned int D.17596;
  unsigned int D.17597;
  struct MonoString * D.17600;
  char[1] * D.17603;
  int D.17604;
  gboolean D.17607;
  struct GSList * D.17609;
  struct GSList * D.17610;
  struct InstanceSearch * search;

  search = data;
  D.17593 = header->ftype;
  if (D.17593 == 73) goto <D.17594>; else goto <D.17595>;
  <D.17594>:
  {
    struct SharedInstance * ins;

    ins = header;
    D.17596 = search->cat_offset;
    D.17597 = ins->category_offset;
    if (D.17596 == D.17597) goto <D.17598>; else goto <D.17599>;
    <D.17598>:
    D.17600 = search->instance;
    if (D.17600 != 0B) goto <D.17601>; else goto <D.17602>;
    <D.17601>:
    D.17600 = search->instance;
    D.17603 = &ins->instance_name;
    D.17604 = mono_string_compare_ascii (D.17600, D.17603);
    if (D.17604 == 0) goto <D.17605>; else goto <D.17606>;
    <D.17605>:
    search->result = ins;
    D.17607 = 0;
    return D.17607;
    <D.17606>:
    goto <D.17608>;
    <D.17602>:
    D.17609 = search->list;
    D.17610 = monoeg_g_slist_prepend (D.17609, ins);
    search->list = D.17610;
    <D.17608>:
    <D.17599>:
  }
  <D.17595>:
  D.17607 = 1;
  return D.17607;
}


shared_data_find_room (int size)
{
  struct MonoSharedArea * shared_area.10;
  short unsigned int D.17613;
  sizetype D.17614;
  int D.17615;
  sizetype D.17616;
  unsigned char D.17617;
  long int D.17620;
  long int end.11;
  long int p.12;
  long int D.17623;
  unsigned char * D.17626;
  unsigned char * D.17627;
  short unsigned int D.17632;
  int D.17633;
  sizetype D.17636;
  unsigned char * p;
  unsigned char * end;

  shared_area.10 = shared_area;
  shared_area.10 = shared_area;
  D.17613 = shared_area.10->data_start;
  D.17614 = (sizetype) D.17613;
  p = shared_area.10 + D.17614;
  shared_area.10 = shared_area;
  shared_area.10 = shared_area;
  D.17615 = shared_area.10->size;
  D.17616 = (sizetype) D.17615;
  end = shared_area.10 + D.17616;
  size = size + 7;
  size = size & -8;
  goto <D.16890>;
  <D.16889>:
  {
    short unsigned int * next;

    D.17617 = *p;
    if (D.17617 == 0) goto <D.17618>; else goto <D.17619>;
    <D.17618>:
    D.17620 = (long int) size;
    end.11 = (long int) end;
    p.12 = (long int) p;
    D.17623 = end.11 - p.12;
    if (D.17620 < D.17623) goto <D.17624>; else goto <D.17625>;
    <D.17624>:
    D.17626 = p;
    return D.17626;
    <D.17625>:
    D.17626 = 0B;
    return D.17626;
    <D.17619>:
    D.17627 = p + 4;
    if (D.17627 > end) goto <D.17628>; else goto <D.17629>;
    <D.17628>:
    D.17626 = 0B;
    return D.17626;
    <D.17629>:
    next = p + 2;
    D.17617 = *p;
    if (D.17617 == 68) goto <D.17630>; else goto <D.17631>;
    <D.17630>:
    D.17632 = *next;
    D.17633 = (int) D.17632;
    if (D.17633 == size) goto <D.17634>; else goto <D.17635>;
    <D.17634>:
    D.17626 = p;
    return D.17626;
    <D.17635>:
    <D.17631>:
    D.17632 = *next;
    D.17636 = (sizetype) D.17632;
    p = p + D.17636;
  }
  <D.16890>:
  if (p < end) goto <D.16889>; else goto <D.16891>;
  <D.16891>:
  D.17626 = 0B;
  return D.17626;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __nothrow__, __leaf__))
strcpy (char * restrict __dest, const char * restrict __src)
{
  char * D.17638;
  long unsigned int D.17639;

  D.17639 = __builtin_object_size (__dest, 1);
  D.17638 = __builtin___strcpy_chk (__dest, __src, D.17639);
  return D.17638;
}


__attribute__((__gnu_inline__))
__strlen_g (const char * __str)
{
  size_t D.17641;
  long int __ptr.13;
  long int __str.14;
  long int D.17644;
  char * __ptr;
  char * __tmp;

  __ptr = 0B;
  __tmp = __str;
  __asm__ __volatile__("   la    0,0
0: srst  %0,%1
   jo    0b
" : "=&a" __ptr, "=&a" __tmp : "0" __ptr, "1" __tmp : "0", "memory", "cc");
  __ptr.13 = (long int) __ptr;
  __str.14 = (long int) __str;
  D.17644 = __ptr.13 - __str.14;
  D.17641 = (size_t) D.17644;
  return D.17641;
}


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


custom_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  long unsigned int D.17652;
  long unsigned int value.15;
  long unsigned int D.17654;
  gint64 D.17655;
  long unsigned int value.16;
  guint64 * ptr;

  ptr = vtable->arg;
  if (ptr != 0B) goto <D.17648>; else goto <D.17649>;
  <D.17648>:
  if (do_incr != 0) goto <D.17650>; else goto <D.17651>;
  <D.17650>:
  D.17652 = *ptr;
  value.15 = (long unsigned int) value;
  D.17654 = D.17652 + value.15;
  *ptr = D.17654;
  D.17652 = *ptr;
  D.17655 = (gint64) D.17652;
  return D.17655;
  <D.17651>:
  value.16 = (long unsigned int) value;
  *ptr = value.16;
  D.17655 = value;
  return D.17655;
  <D.17649>:
  D.17655 = 0;
  return D.17655;
}


custom_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  struct SharedCounter * D.17660;
  unsigned char D.17661;
  int D.17662;
  int D.17663;
  void * D.17664;
  long unsigned int D.17668;
  long int D.17669;
  MonoBoolean D.17670;
  struct CustomVTable * counter_data;

  counter_data = vtable;
  if (only_value == 0) goto <D.17658>; else goto <D.17659>;
  <D.17658>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17659>:
  D.17660 = counter_data->counter_desc;
  D.17661 = D.17660->type;
  D.17662 = (int) D.17661;
  D.17663 = simple_type_to_type[D.17662];
  sample->counterType = D.17663;
  D.17664 = vtable->arg;
  if (D.17664 == 0B) goto <D.17665>; else goto <D.17666>;
  <D.17665>:
  sample->rawValue = 0;
  goto <D.17667>;
  <D.17666>:
  D.17664 = vtable->arg;
  D.17668 = MEM[(guint64 *)D.17664];
  D.17669 = (long int) D.17668;
  sample->rawValue = D.17669;
  <D.17667>:
  D.17670 = 1;
  return D.17670;
}


fill_sample (struct MonoCounterSample * sample)
{
  long int D.17672;
  long int D.17673;

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


cpu_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17674;
  int D.17677;
  void * D.17678;
  short int D.17679;
  int D.17680;
  int D.17681;
  long int D.17682;
  void * D.17683;
  int id;
  const struct CounterDesc * cdesc;

  D.17674 = id_from_string (instance, 0);
  id = D.17674 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[0], counter);
  if (cdesc != 0B) goto <D.17675>; else goto <D.17676>;
  <D.17675>:
  D.17677 = cdesc->type;
  *type = D.17677;
  D.17679 = cdesc->id;
  D.17680 = (int) D.17679;
  D.17681 = D.17680 | id;
  D.17682 = (long int) D.17681;
  D.17683 = (void *) D.17682;
  D.17678 = create_vtable (D.17683, get_cpu_counter, 0B);
  return D.17678;
  <D.17676>:
  D.17678 = 0B;
  return D.17678;
}


get_cpu_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17685;
  long int D.17686;
  short int D.17689;
  int D.17690;
  int D.17691;
  int D.17692;
  long int D.17693;
  MonoBoolean D.17694;
  long int D.17695;
  long int D.17696;
  long int D.17697;
  long int D.17698;
  MonoProcessError error;
  int id;
  int pid;

  try
    {
      D.17685 = vtable->arg;
      D.17686 = (long int) D.17685;
      id = (int) D.17686;
      pid = id >> 5;
      id = id & 31;
      if (only_value == 0) goto <D.17687>; else goto <D.17688>;
      <D.17687>:
      fill_sample (sample);
      sample->baseValue = 1;
      <D.17688>:
      D.17689 = 0;
      D.17690 = (int) D.17689;
      D.17691 = D.17690 + id;
      D.17692 = predef_counters[D.17691].type;
      sample->counterType = D.17692;
      switch (id) <default: <D.17699>, case 0: <D.17008>, case 1: <D.17009>, case 2: <D.17010>, case 3: <D.17011>, case 4: <D.17012>>
      <D.17008>:
      D.17693 = mono_cpu_get_data (pid, 0, &error);
      sample->rawValue = D.17693;
      D.17694 = 1;
      return D.17694;
      <D.17009>:
      D.17695 = mono_cpu_get_data (pid, 1, &error);
      sample->rawValue = D.17695;
      D.17694 = 1;
      return D.17694;
      <D.17010>:
      D.17696 = mono_cpu_get_data (pid, 2, &error);
      sample->rawValue = D.17696;
      D.17694 = 1;
      return D.17694;
      <D.17011>:
      D.17697 = mono_cpu_get_data (pid, 3, &error);
      sample->rawValue = D.17697;
      D.17694 = 1;
      return D.17694;
      <D.17012>:
      D.17698 = mono_cpu_get_data (pid, 4, &error);
      sample->rawValue = D.17698;
      D.17694 = 1;
      return D.17694;
      <D.17699>:
      D.17694 = 0;
      return D.17694;
    }
  finally
    {
      error = {CLOBBER};
    }
}


id_from_string (struct MonoString * instance, gboolean is_process)
{
  int D.17702;
  long int D.17705;
  char * end.17;
  int D.17711;
  int id;

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

    try
      {
        id_str = mono_string_to_utf8 (instance);
        D.17705 = strtol (id_str, &end, 0);
        id = (int) D.17705;
        end.17 = end;
        if (end.17 == id_str) goto <D.17707>; else goto <D.17708>;
        <D.17707>:
        if (is_process == 0) goto <D.17709>; else goto <D.17710>;
        <D.17709>:
        id = -1;
        <D.17710>:
        <D.17708>:
        monoeg_g_free (id_str);
      }
    finally
      {
        end = {CLOBBER};
      }
  }
  <D.17704>:
  D.17711 = id;
  return D.17711;
}


get_counter_in_category (const struct CategoryDesc * desc, struct MonoString * counter)
{
  short int D.17713;
  int D.17714;
  const struct CategoryDesc * D.17715;
  short int D.17716;
  int D.17717;
  const char * D.17718;
  int D.17719;
  const struct CounterDesc * D.17722;
  const struct CounterDesc * cdesc;
  const struct CounterDesc * end;

  D.17713 = desc->first_counter;
  D.17714 = (int) D.17713;
  cdesc = &predef_counters[D.17714];
  D.17715 = desc + 24;
  D.17716 = D.17715->first_counter;
  D.17717 = (int) D.17716;
  end = &predef_counters[D.17717];
  goto <D.16988>;
  <D.16987>:
  D.17718 = cdesc->name;
  D.17719 = mono_string_compare_ascii (counter, D.17718);
  if (D.17719 == 0) goto <D.17720>; else goto <D.17721>;
  <D.17720>:
  D.17722 = cdesc;
  return D.17722;
  <D.17721>:
  cdesc = cdesc + 24;
  <D.16988>:
  if (cdesc < end) goto <D.16987>; else goto <D.16989>;
  <D.16989>:
  D.17722 = 0B;
  return D.17722;
}


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

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


process_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17726;
  int D.17729;
  void * D.17730;
  short int D.17731;
  int D.17732;
  int D.17733;
  long int D.17734;
  void * D.17735;
  int id;
  const struct CounterDesc * cdesc;

  D.17726 = id_from_string (instance, 1);
  id = D.17726 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[1], counter);
  if (cdesc != 0B) goto <D.17727>; else goto <D.17728>;
  <D.17727>:
  D.17729 = cdesc->type;
  *type = D.17729;
  D.17731 = cdesc->id;
  D.17732 = (int) D.17731;
  D.17733 = D.17732 | id;
  D.17734 = (long int) D.17733;
  D.17735 = (void *) D.17734;
  D.17730 = create_vtable (D.17735, get_process_counter, 0B);
  return D.17730;
  <D.17728>:
  D.17730 = 0B;
  return D.17730;
}


get_process_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17737;
  long int D.17738;
  MonoBoolean D.17741;
  short int D.17744;
  int D.17745;
  int D.17746;
  int D.17747;
  long int D.17748;
  void * D.17749;
  long int D.17750;
  long int D.17751;
  long int D.17752;
  long int D.17753;
  long int D.17754;
  long int D.17755;
  long int D.17756;
  int id;
  int pid;

  D.17737 = vtable->arg;
  D.17738 = (long int) D.17737;
  id = (int) D.17738;
  pid = id >> 5;
  if (pid < 0) goto <D.17739>; else goto <D.17740>;
  <D.17739>:
  D.17741 = 0;
  return D.17741;
  <D.17740>:
  id = id & 31;
  if (only_value == 0) goto <D.17742>; else goto <D.17743>;
  <D.17742>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17743>:
  D.17744 = 5;
  D.17745 = (int) D.17744;
  D.17746 = D.17745 + id;
  D.17747 = predef_counters[D.17746].type;
  sample->counterType = D.17747;
  switch (id) <default: <D.17757>, case 0: <D.17053>, case 1: <D.17054>, case 2: <D.17055>, case 3: <D.17056>, case 4: <D.17057>, case 5: <D.17058>, case 6: <D.17059>>
  <D.17053>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17750 = mono_process_get_data (D.17749, 1);
  sample->rawValue = D.17750;
  D.17741 = 1;
  return D.17741;
  <D.17054>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17751 = mono_process_get_data (D.17749, 2);
  sample->rawValue = D.17751;
  D.17741 = 1;
  return D.17741;
  <D.17055>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17752 = mono_process_get_data (D.17749, 3);
  sample->rawValue = D.17752;
  D.17741 = 1;
  return D.17741;
  <D.17056>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17753 = mono_process_get_data (D.17749, 0);
  sample->rawValue = D.17753;
  D.17741 = 1;
  return D.17741;
  <D.17057>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17754 = mono_process_get_data (D.17749, 7);
  sample->rawValue = D.17754;
  D.17741 = 1;
  return D.17741;
  <D.17058>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17755 = mono_process_get_data (D.17749, 4);
  sample->rawValue = D.17755;
  D.17741 = 1;
  return D.17741;
  <D.17059>:
  D.17748 = (long int) pid;
  D.17749 = (void *) D.17748;
  D.17756 = mono_process_get_data (D.17749, 6);
  sample->rawValue = D.17756;
  D.17741 = 1;
  return D.17741;
  <D.17757>:
  D.17741 = 0;
  return D.17741;
}


mono_mem_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17761;
  void * D.17762;
  short int D.17763;
  long int D.17764;
  void * D.17765;
  const struct CounterDesc * cdesc;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[2], counter);
  if (cdesc != 0B) goto <D.17759>; else goto <D.17760>;
  <D.17759>:
  D.17761 = cdesc->type;
  *type = D.17761;
  D.17763 = cdesc->id;
  D.17764 = (long int) D.17763;
  D.17765 = (void *) D.17764;
  D.17762 = create_vtable (D.17765, mono_mem_counter, 0B);
  return D.17762;
  <D.17760>:
  D.17762 = 0B;
  return D.17762;
}


mono_mem_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17767;
  long int D.17768;
  short int D.17771;
  int D.17772;
  int D.17773;
  int D.17774;
  long unsigned int D.17775;
  long int D.17776;
  MonoBoolean D.17777;
  long unsigned int D.17778;
  long int D.17779;
  int id;

  D.17767 = vtable->arg;
  D.17768 = (long int) D.17767;
  id = (int) D.17768;
  if (only_value == 0) goto <D.17769>; else goto <D.17770>;
  <D.17769>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17770>:
  D.17771 = 12;
  D.17772 = (int) D.17771;
  D.17773 = D.17772 + id;
  D.17774 = predef_counters[D.17773].type;
  sample->counterType = D.17774;
  switch (id) <default: <D.17780>, case 0: <D.17074>, case 1: <D.17075>>
  <D.17074>:
  D.17775 = mono_stats.new_object_count;
  D.17776 = (long int) D.17775;
  sample->rawValue = D.17776;
  D.17777 = 1;
  return D.17777;
  <D.17075>:
  D.17778 = mono_determine_physical_ram_size ();
  D.17779 = (long int) D.17778;
  sample->rawValue = D.17779;
  D.17777 = 1;
  return D.17777;
  <D.17780>:
  D.17777 = 0;
  return D.17777;
}


mono_determine_physical_ram_size ()
{
  long int D.17782;
  long int D.17783;
  guint64 D.17787;
  guint64 page_size;
  guint64 num_pages;

  page_size = 0;
  num_pages = 0;
  D.17782 = sysconf (30);
  page_size = (guint64) D.17782;
  D.17783 = sysconf (85);
  num_pages = (guint64) D.17783;
  if (page_size == 0) goto <D.17784>; else goto <D.17786>;
  <D.17786>:
  if (num_pages == 0) goto <D.17784>; else goto <D.17785>;
  <D.17784>:
  monoeg_g_log (0B, 16, "Your operating system\'s sysconf (3) function doesn\'t correctly report physical memory size!");
  D.17787 = 134217728;
  return D.17787;
  <D.17785>:
  D.17787 = page_size * num_pages;
  return D.17787;
}


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


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

  if (vtable == 0B) goto <D.17796>; else goto <D.17797>;
  <D.17796>:
  return;
  <D.17797>:
  narg = vtable->arg;
  if (narg == 0B) goto <D.17798>; else goto <D.17799>;
  <D.17798>:
  return;
  <D.17799>:
  D.17800 = narg->name;
  monoeg_g_free (D.17800);
  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.17804;
  int D.17805;
  int D.17806;
  int D.17807;
  int D.17808;
  char * D.17809;
  long int D.17810;
  long int D.17811;
  long int D.17812;
  <unnamed type> error.18;
  MonoBoolean D.17817;
  MonoNetworkError error;
  struct NetworkVtableArg * narg;

  try
    {
      error = 2;
      narg = vtable->arg;
      if (only_value == 0) goto <D.17802>; else goto <D.17803>;
      <D.17802>:
      fill_sample (sample);
      <D.17803>:
      D.17804 = 93;
      D.17805 = (int) D.17804;
      D.17806 = narg->id;
      D.17807 = D.17805 + D.17806;
      D.17808 = predef_counters[D.17807].type;
      sample->counterType = D.17808;
      D.17806 = narg->id;
      switch (D.17806) <default: <D.17813>, case 0: <D.17028>, case 1: <D.17030>, case 2: <D.17031>>
      <D.17028>:
      D.17809 = narg->name;
      D.17810 = mono_network_get_data (D.17809, 0, &error);
      sample->rawValue = D.17810;
      goto <D.17029>;
      <D.17030>:
      D.17809 = narg->name;
      D.17811 = mono_network_get_data (D.17809, 1, &error);
      sample->rawValue = D.17811;
      goto <D.17029>;
      <D.17031>:
      D.17809 = narg->name;
      D.17812 = mono_network_get_data (D.17809, 2, &error);
      sample->rawValue = D.17812;
      goto <D.17029>;
      <D.17813>:
      <D.17029>:
      error.18 = error;
      if (error.18 == 0) goto <D.17815>; else goto <D.17816>;
      <D.17815>:
      D.17817 = 1;
      return D.17817;
      <D.17816>:
      D.17817 = 0;
      return D.17817;
    }
  finally
    {
      error = {CLOBBER};
    }
}


predef_writable_get_impl (int cat, struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  const struct CategoryDesc * D.17820;
  int D.17823;
  int D.17827;
  void * D.17828;
  short int D.17829;
  int D.17830;
  int D.17831;
  int D.17832;
  long int D.17833;
  void * D.17834;
  const struct CounterDesc * cdesc;

  *custom = 1;
  D.17820 = &predef_categories[cat];
  cdesc = get_counter_in_category (D.17820, counter);
  if (cdesc != 0B) goto <D.17821>; else goto <D.17822>;
  <D.17821>:
  D.17823 = cdesc->type;
  *type = D.17823;
  if (instance == 0B) goto <D.17824>; else goto <D.17826>;
  <D.17826>:
  D.17827 = mono_string_compare_ascii (instance, "");
  if (D.17827 == 0) goto <D.17824>; else goto <D.17825>;
  <D.17824>:
  D.17829 = cdesc->id;
  D.17830 = (int) D.17829;
  D.17831 = D.17830 << 16;
  D.17832 = D.17831 | cat;
  D.17833 = (long int) D.17832;
  D.17834 = (void *) D.17833;
  D.17828 = create_vtable (D.17834, predef_writable_counter, predef_writable_update);
  return D.17828;
  <D.17825>:
  D.17829 = cdesc->id;
  D.17830 = (int) D.17829;
  D.17831 = D.17830 << 16;
  D.17832 = D.17831 | cat;
  D.17833 = (long int) D.17832;
  D.17834 = (void *) D.17833;
  D.17828 = predef_vtable (D.17834, instance);
  return D.17828;
  <D.17822>:
  D.17828 = 0B;
  return D.17828;
}


predef_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  void * D.17836;
  long int D.17837;
  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.17855;
  guint32 * ptr.27;
  int D.17857;
  guint32 * ptr.28;
  int D.17861;
  guint32 * ptr.29;
  unsigned int D.17863;
  unsigned int D.17864;
  unsigned int D.17865;
  guint32 * ptr.30;
  unsigned int D.17867;
  guint32 * ptr.31;
  gint64 * ptr64.32;
  gint64 * ptr64.33;
  long int D.17875;
  long int D.17876;
  gint64 * ptr64.34;
  gint64 * ptr64.35;
  guint32 * volatile ptr;
  gint64 * volatile ptr64;
  int cat_id;
  int id;

  ptr = 0B;
  ptr64 = 0B;
  D.17836 = vtable->arg;
  D.17837 = (long int) D.17836;
  cat_id = (int) D.17837;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  switch (cat_id) <default: <D.17847>, case 3: <D.17133>, case 12: <D.17138>>
  <D.17133>:
  switch (id) <default: <D.17841>, case 0: <D.17134>, case 1: <D.17136>>
  <D.17134>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.20 = &mono_perfcounters.19->aspnet_requests_queued;
  ptr = ptr.20;
  goto <D.17135>;
  <D.17136>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.21 = &mono_perfcounters.19->aspnet_requests;
  ptr = ptr.21;
  goto <D.17135>;
  <D.17841>:
  <D.17135>:
  goto <D.17137>;
  <D.17138>:
  switch (id) <default: <D.17846>, case 0: <D.17139>, case 2: <D.17141>, case 4: <D.17142>, case 5: <D.17143>>
  <D.17139>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr64.22 = &mono_perfcounters.19->threadpool_workitems;
  ptr64 = ptr64.22;
  goto <D.17140>;
  <D.17141>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr64.23 = &mono_perfcounters.19->threadpool_ioworkitems;
  ptr64 = ptr64.23;
  goto <D.17140>;
  <D.17142>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.24 = &mono_perfcounters.19->threadpool_threads;
  ptr = ptr.24;
  goto <D.17140>;
  <D.17143>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.25 = &mono_perfcounters.19->threadpool_iothreads;
  ptr = ptr.25;
  goto <D.17140>;
  <D.17846>:
  <D.17140>:
  goto <D.17137>;
  <D.17847>:
  <D.17137>:
  ptr.26 = ptr;
  if (ptr.26 != 0B) goto <D.17849>; else goto <D.17850>;
  <D.17849>:
  if (do_incr != 0) goto <D.17851>; else goto <D.17852>;
  <D.17851>:
  if (value == 1) goto <D.17853>; else goto <D.17854>;
  <D.17853>:
  ptr.27 = ptr;
  D.17857 = InterlockedIncrement (ptr.27);
  D.17855 = (gint64) D.17857;
  return D.17855;
  <D.17854>:
  if (value == -1) goto <D.17858>; else goto <D.17859>;
  <D.17858>:
  ptr.28 = ptr;
  D.17861 = InterlockedDecrement (ptr.28);
  D.17855 = (gint64) D.17861;
  return D.17855;
  <D.17859>:
  ptr.29 = ptr;
  D.17863 = *ptr.29;
  D.17864 = (unsigned int) value;
  D.17865 = D.17863 + D.17864;
  *ptr.29 = D.17865;
  ptr.30 = ptr;
  D.17867 = *ptr.30;
  D.17855 = (gint64) D.17867;
  return D.17855;
  <D.17852>:
  ptr.31 = ptr;
  D.17864 = (unsigned int) value;
  *ptr.31 = D.17864;
  D.17855 = value;
  return D.17855;
  <D.17850>:
  ptr64.32 = ptr64;
  if (ptr64.32 != 0B) goto <D.17870>; else goto <D.17871>;
  <D.17870>:
  if (do_incr != 0) goto <D.17872>; else goto <D.17873>;
  <D.17872>:
  ptr64.33 = ptr64;
  D.17875 = *ptr64.33;
  D.17876 = D.17875 + value;
  *ptr64.33 = D.17876;
  ptr64.34 = ptr64;
  D.17855 = *ptr64.34;
  return D.17855;
  <D.17873>:
  ptr64.35 = ptr64;
  *ptr64.35 = value;
  D.17855 = value;
  return D.17855;
  <D.17871>:
  D.17855 = 0;
  return D.17855;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.17880;
  unsigned int D.17881;

  D.17881 = __sync_add_and_fetch_4 (val, 1);
  D.17880 = (gint32) D.17881;
  return D.17880;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.17883;
  unsigned int D.17884;

  D.17884 = __sync_sub_and_fetch_4 (val, 1);
  D.17883 = (gint32) D.17884;
  return D.17883;
}


predef_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17886;
  long int D.17887;
  short int D.17890;
  int D.17891;
  int D.17892;
  int D.17893;
  struct MonoPerfCounters * mono_perfcounters.36;
  unsigned int D.17895;
  long int D.17896;
  MonoBoolean D.17897;
  unsigned int D.17899;
  long int D.17900;
  unsigned int D.17901;
  long int D.17902;
  long unsigned int D.17904;
  long int D.17905;
  long unsigned int D.17906;
  long int D.17907;
  unsigned int D.17908;
  long int D.17909;
  unsigned int D.17910;
  long int D.17911;
  unsigned int D.17913;
  long int D.17914;
  unsigned int D.17915;
  long int D.17916;
  unsigned int D.17917;
  long int D.17918;
  unsigned int D.17919;
  long int D.17920;
  int cat_id;
  int id;

  D.17886 = vtable->arg;
  D.17887 = (long int) D.17886;
  cat_id = (int) D.17887;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17888>; else goto <D.17889>;
  <D.17888>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17889>:
  D.17890 = predef_categories[cat_id].first_counter;
  D.17891 = (int) D.17890;
  D.17892 = D.17891 + id;
  D.17893 = predef_counters[D.17892].type;
  sample->counterType = D.17893;
  switch (cat_id) <default: <D.17922>, case 3: <D.17110>, case 4: <D.17118>, case 5: <D.17107>, case 12: <D.17113>>
  <D.17107>:
  switch (id) <default: <D.17898>, case 0: <D.17108>>
  <D.17108>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17895 = mono_perfcounters.36->exceptions_thrown;
  D.17896 = (long int) D.17895;
  sample->rawValue = D.17896;
  D.17897 = 1;
  return D.17897;
  <D.17898>:
  goto <D.17109>;
  <D.17110>:
  switch (id) <default: <D.17903>, case 0: <D.17111>, case 1: <D.17112>>
  <D.17111>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17899 = mono_perfcounters.36->aspnet_requests_queued;
  D.17900 = (long int) D.17899;
  sample->rawValue = D.17900;
  D.17897 = 1;
  return D.17897;
  <D.17112>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17901 = mono_perfcounters.36->aspnet_requests;
  D.17902 = (long int) D.17901;
  sample->rawValue = D.17902;
  D.17897 = 1;
  return D.17897;
  <D.17903>:
  goto <D.17109>;
  <D.17113>:
  switch (id) <default: <D.17912>, case 0: <D.17114>, case 2: <D.17115>, case 4: <D.17116>, case 5: <D.17117>>
  <D.17114>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17904 = mono_perfcounters.36->threadpool_workitems;
  D.17905 = (long int) D.17904;
  sample->rawValue = D.17905;
  D.17897 = 1;
  return D.17897;
  <D.17115>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17906 = mono_perfcounters.36->threadpool_ioworkitems;
  D.17907 = (long int) D.17906;
  sample->rawValue = D.17907;
  D.17897 = 1;
  return D.17897;
  <D.17116>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17908 = mono_perfcounters.36->threadpool_threads;
  D.17909 = (long int) D.17908;
  sample->rawValue = D.17909;
  D.17897 = 1;
  return D.17897;
  <D.17117>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17910 = mono_perfcounters.36->threadpool_iothreads;
  D.17911 = (long int) D.17910;
  sample->rawValue = D.17911;
  D.17897 = 1;
  return D.17897;
  <D.17912>:
  goto <D.17109>;
  <D.17118>:
  switch (id) <default: <D.17921>, case 0: <D.17119>, case 1: <D.17120>, case 2: <D.17121>, case 3: <D.17122>, case 4: <D.17123>>
  <D.17119>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17913 = mono_perfcounters.36->jit_bytes;
  D.17914 = (long int) D.17913;
  sample->rawValue = D.17914;
  D.17897 = 1;
  return D.17897;
  <D.17120>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17915 = mono_perfcounters.36->jit_methods;
  D.17916 = (long int) D.17915;
  sample->rawValue = D.17916;
  D.17897 = 1;
  return D.17897;
  <D.17121>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17917 = mono_perfcounters.36->jit_time;
  D.17918 = (long int) D.17917;
  sample->rawValue = D.17918;
  D.17897 = 1;
  return D.17897;
  <D.17122>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17913 = mono_perfcounters.36->jit_bytes;
  D.17914 = (long int) D.17913;
  sample->rawValue = D.17914;
  D.17897 = 1;
  return D.17897;
  <D.17123>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17919 = mono_perfcounters.36->jit_failures;
  D.17920 = (long int) D.17919;
  sample->rawValue = D.17920;
  D.17897 = 1;
  return D.17897;
  <D.17921>:
  goto <D.17109>;
  <D.17922>:
  <D.17109>:
  D.17897 = 0;
  return D.17897;
}


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


predef_cleanup (struct ImplVtable * vtable)
{
  _Bool D.17933;
  long int D.17934;
  long int D.17935;
  struct GHashTable * pid_to_shared_area.37;
  _Bool D.17943;
  long int D.17944;
  long int D.17945;
  int D.17948;
  _Bool D.17951;
  long int D.17952;
  long int D.17953;
  struct PredefVtable * vt;

  vt = vtable;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17931>; else goto <D.17932>;
    <D.17931>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17932>:
    D.17933 = ret != 0;
    D.17934 = (long int) D.17933;
    D.17935 = __builtin_expect (D.17934, 0);
    if (D.17935 != 0) goto <D.17936>; else goto <D.17937>;
    <D.17936>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 389, "ret == 0");
    <D.17937>:
  }
  pid_to_shared_area.37 = pid_to_shared_area;
  if (pid_to_shared_area.37 == 0B) goto <D.17939>; else goto <D.17940>;
  <D.17939>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17941>; else goto <D.17942>;
    <D.17941>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17942>:
    D.17943 = ret != 0;
    D.17944 = (long int) D.17943;
    D.17945 = __builtin_expect (D.17944, 0);
    if (D.17945 != 0) goto <D.17946>; else goto <D.17947>;
    <D.17946>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 391, "ret == 0");
    <D.17947>:
  }
  return;
  <D.17940>:
  D.17948 = vt->pid;
  unref_pid_unlocked (D.17948);
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17949>; else goto <D.17950>;
    <D.17949>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17950>:
    D.17951 = ret != 0;
    D.17952 = (long int) D.17951;
    D.17953 = __builtin_expect (D.17952, 0);
    if (D.17953 != 0) goto <D.17954>; else goto <D.17955>;
    <D.17954>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 395, "ret == 0");
    <D.17955>:
  }
}


unref_pid_unlocked (int pid)
{
  struct GHashTable * pid_to_shared_area.38;
  long int D.17958;
  const void * D.17959;
  int D.17962;
  int D.17963;
  void * D.17966;
  struct ExternalSArea * data;

  pid_to_shared_area.38 = pid_to_shared_area;
  D.17958 = (long int) pid;
  D.17959 = (const void *) D.17958;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.38, D.17959);
  if (data != 0B) goto <D.17960>; else goto <D.17961>;
  <D.17960>:
  D.17962 = data->refcount;
  D.17963 = D.17962 + -1;
  data->refcount = D.17963;
  D.17962 = data->refcount;
  if (D.17962 == 0) goto <D.17964>; else goto <D.17965>;
  <D.17964>:
  pid_to_shared_area.38 = pid_to_shared_area;
  D.17958 = (long int) pid;
  D.17959 = (const void *) D.17958;
  monoeg_g_hash_table_remove (pid_to_shared_area.38, D.17959);
  D.17966 = data->sarea;
  mono_shared_area_unload (D.17966);
  monoeg_g_free (data);
  <D.17965>:
  <D.17961>:
}


predef_readonly_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17967;
  long int D.17968;
  short int D.17971;
  int D.17972;
  int D.17973;
  int D.17974;
  struct MonoPerfCounters * D.17975;
  short unsigned int D.17976;
  sizetype D.17977;
  guint32 * D.17978;
  unsigned int D.17979;
  long int D.17980;
  MonoBoolean D.17981;
  struct PredefVtable * vt;
  const struct CounterDesc * desc;
  int cat_id;
  int id;

  vt = vtable;
  D.17967 = vtable->arg;
  D.17968 = (long int) D.17967;
  cat_id = (int) D.17968;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17969>; else goto <D.17970>;
  <D.17969>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17970>:
  D.17971 = predef_categories[cat_id].first_counter;
  D.17972 = (int) D.17971;
  D.17973 = D.17972 + id;
  desc = &predef_counters[D.17973];
  D.17974 = desc->type;
  sample->counterType = D.17974;
  D.17975 = vt->counters;
  D.17976 = desc->offset;
  D.17977 = (sizetype) D.17976;
  D.17978 = D.17975 + D.17977;
  D.17979 = *D.17978;
  D.17980 = (long int) D.17979;
  sample->rawValue = D.17980;
  D.17981 = 1;
  return D.17981;
}


__attribute__((__gnu_inline__, __pure__, __leaf__, __nothrow__))
atoi (const char * __nptr)
{
  int D.17983;
  long int D.17984;

  D.17984 = strtol (__nptr, 0B, 10);
  D.17983 = (int) D.17984;
  return D.17983;
}


load_sarea_for_pid (int pid)
{
  _Bool D.17988;
  long int D.17989;
  long int D.17990;
  struct GHashTable * pid_to_shared_area.39;
  struct GHashTable * D.17996;
  long int D.17997;
  const void * D.17998;
  void * D.18001;
  int D.18005;
  int D.18006;
  _Bool D.18009;
  long int D.18010;
  long int D.18011;
  struct MonoSharedArea * D.18014;
  struct ExternalSArea * data;
  struct MonoSharedArea * area;

  area = 0B;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17986>; else goto <D.17987>;
    <D.17986>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17987>:
    D.17988 = ret != 0;
    D.17989 = (long int) D.17988;
    D.17990 = __builtin_expect (D.17989, 0);
    if (D.17990 != 0) goto <D.17991>; else goto <D.17992>;
    <D.17991>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 348, "ret == 0");
    <D.17992>:
  }
  pid_to_shared_area.39 = pid_to_shared_area;
  if (pid_to_shared_area.39 == 0B) goto <D.17994>; else goto <D.17995>;
  <D.17994>:
  D.17996 = monoeg_g_hash_table_new (0B, 0B);
  pid_to_shared_area = D.17996;
  <D.17995>:
  pid_to_shared_area.39 = pid_to_shared_area;
  D.17997 = (long int) pid;
  D.17998 = (const void *) D.17997;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.39, D.17998);
  if (data == 0B) goto <D.17999>; else goto <D.18000>;
  <D.17999>:
  D.17997 = (long int) pid;
  D.18001 = (void *) D.17997;
  area = mono_shared_area_for_pid (D.18001);
  if (area != 0B) goto <D.18002>; else goto <D.18003>;
  <D.18002>:
  data = monoeg_malloc (16);
  data->sarea = area;
  data->refcount = 1;
  pid_to_shared_area.39 = pid_to_shared_area;
  D.17997 = (long int) pid;
  D.18001 = (void *) D.17997;
  monoeg_g_hash_table_insert_replace (pid_to_shared_area.39, D.18001, data, 0);
  <D.18003>:
  goto <D.18004>;
  <D.18000>:
  area = data->sarea;
  D.18005 = data->refcount;
  D.18006 = D.18005 + 1;
  data->refcount = D.18006;
  <D.18004>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18007>; else goto <D.18008>;
    <D.18007>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18008>:
    D.18009 = ret != 0;
    D.18010 = (long int) D.18009;
    D.18011 = __builtin_expect (D.18010, 0);
    if (D.18011 != 0) goto <D.18012>; else goto <D.18013>;
    <D.18012>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 364, "ret == 0");
    <D.18013>:
  }
  D.18014 = area;
  return D.18014;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_get_sample (void * impl, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  MonoBoolean (*<T2cc2>) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) D.18018;
  MonoBoolean D.18021;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.18016>; else goto <D.18017>;
  <D.18016>:
  D.18018 = vtable->sample;
  if (D.18018 != 0B) goto <D.18019>; else goto <D.18020>;
  <D.18019>:
  D.18018 = vtable->sample;
  D.18021 = D.18018 (vtable, only_value, sample);
  return D.18021;
  <D.18020>:
  <D.18017>:
  D.18021 = 0;
  return D.18021;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_update_value (void * impl, MonoBoolean do_incr, gint64 value)
{
  gint64 (*<T2cc7>) (struct ImplVtable *, MonoBoolean, gint64) D.18025;
  gint64 D.18028;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.18023>; else goto <D.18024>;
  <D.18023>:
  D.18025 = vtable->update;
  if (D.18025 != 0B) goto <D.18026>; else goto <D.18027>;
  <D.18026>:
  D.18025 = vtable->update;
  D.18028 = D.18025 (vtable, do_incr, value);
  return D.18028;
  <D.18027>:
  <D.18024>:
  D.18028 = 0;
  return D.18028;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_free_data (void * impl)
{
  void (*<T2ccc>) (struct ImplVtable *) D.18032;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.18030>; else goto <D.18031>;
  <D.18030>:
  D.18032 = vtable->cleanup;
  if (D.18032 != 0B) goto <D.18033>; else goto <D.18034>;
  <D.18033>:
  D.18032 = vtable->cleanup;
  D.18032 (vtable);
  <D.18034>:
  <D.18031>:
  monoeg_g_free (impl);
}


__attribute__((visibility ("hidden")))
mono_perfcounter_category_del (struct MonoString * name)
{
  MonoBoolean D.18037;
  _Bool D.18040;
  long int D.18041;
  long int D.18042;
  int D.18048;
  _Bool D.18051;
  long int D.18052;
  long int D.18053;
  _Bool D.18058;
  long int D.18059;
  long int D.18060;
  const struct CategoryDesc * cdesc;
  struct SharedCategory * cat;

  cdesc = find_category (name);
  if (cdesc != 0B) goto <D.18035>; else goto <D.18036>;
  <D.18035>:
  D.18037 = 0;
  return D.18037;
  <D.18036>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18038>; else goto <D.18039>;
    <D.18038>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18039>:
    D.18040 = ret != 0;
    D.18041 = (long int) D.18040;
    D.18042 = __builtin_expect (D.18041, 0);
    if (D.18042 != 0) goto <D.18043>; else goto <D.18044>;
    <D.18043>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1304, "ret == 0");
    <D.18044>:
  }
  cat = find_custom_category (name);
  if (cat == 0B) goto <D.18045>; else goto <D.18047>;
  <D.18047>:
  D.18048 = cat->num_instances;
  if (D.18048 != 0) goto <D.18045>; else goto <D.18046>;
  <D.18045>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18049>; else goto <D.18050>;
    <D.18049>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18050>:
    D.18051 = ret != 0;
    D.18052 = (long int) D.18051;
    D.18053 = __builtin_expect (D.18052, 0);
    if (D.18053 != 0) goto <D.18054>; else goto <D.18055>;
    <D.18054>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1308, "ret == 0");
    <D.18055>:
  }
  D.18037 = 0;
  return D.18037;
  <D.18046>:
  cat->header.ftype = 68;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18056>; else goto <D.18057>;
    <D.18056>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18057>:
    D.18058 = ret != 0;
    D.18059 = (long int) D.18058;
    D.18060 = __builtin_expect (D.18059, 0);
    if (D.18060 != 0) goto <D.18061>; else goto <D.18062>;
    <D.18061>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1312, "ret == 0");
    <D.18062>:
  }
  D.18037 = 1;
  return D.18037;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_category_help (struct MonoString * category, struct MonoString * machine)
{
  int D.18064;
  struct MonoString * D.18067;
  struct MonoDomain * D.18072;
  char * D.18073;
  struct MonoDomain * D.18074;
  const char * D.18075;
  const struct CategoryDesc * cdesc;

  D.18064 = mono_string_compare_ascii (machine, ".");
  if (D.18064 != 0) goto <D.18065>; else goto <D.18066>;
  <D.18065>:
  D.18067 = 0B;
  return D.18067;
  <D.18066>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.18068>; else goto <D.18069>;
  <D.18068>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18070>; else goto <D.18071>;
    <D.18070>:
    D.18067 = 0B;
    return D.18067;
    <D.18071>:
    D.18072 = mono_domain_get ();
    D.18073 = custom_category_help (scat);
    D.18067 = mono_string_new (D.18072, D.18073);
    return D.18067;
  }
  <D.18069>:
  D.18074 = mono_domain_get ();
  D.18075 = cdesc->help;
  D.18067 = mono_string_new (D.18074, D.18075);
  return D.18067;
}


custom_category_help (struct SharedCategory * cat)
{
  char * D.18077;
  char[1] * D.18078;
  long unsigned int D.18079;
  sizetype D.18080;

  D.18078 = &cat->name;
  D.18078 = &cat->name;
  D.18079 = __strlen_g (D.18078);
  D.18080 = D.18079 + 1;
  D.18077 = D.18078 + D.18080;
  return D.18077;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_category_exists (struct MonoString * counter, struct MonoString * category, struct MonoString * machine)
{
  int D.18082;
  MonoBoolean D.18085;
  struct SharedCounter * D.18092;
  _Bool D.18093;
  const struct CounterDesc * D.18096;
  const struct CategoryDesc * cdesc;

  D.18082 = mono_string_compare_ascii (machine, ".");
  if (D.18082 != 0) goto <D.18083>; else goto <D.18084>;
  <D.18083>:
  D.18085 = 0;
  return D.18085;
  <D.18084>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.18086>; else goto <D.18087>;
  <D.18086>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18088>; else goto <D.18089>;
    <D.18088>:
    D.18085 = 0;
    return D.18085;
    <D.18089>:
    if (counter == 0B) goto <D.18090>; else goto <D.18091>;
    <D.18090>:
    D.18085 = 1;
    return D.18085;
    <D.18091>:
    D.18092 = find_custom_counter (scat, counter);
    D.18093 = D.18092 != 0B;
    D.18085 = (MonoBoolean) D.18093;
    return D.18085;
  }
  <D.18087>:
  if (counter == 0B) goto <D.18094>; else goto <D.18095>;
  <D.18094>:
  D.18085 = 1;
  return D.18085;
  <D.18095>:
  D.18096 = get_counter_in_category (cdesc, counter);
  if (D.18096 != 0B) goto <D.18097>; else goto <D.18098>;
  <D.18097>:
  D.18085 = 1;
  return D.18085;
  <D.18098>:
  D.18085 = 0;
  return D.18085;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_create (struct MonoString * category, struct MonoString * help, int type, struct MonoArray * items)
{
  long unsigned int D.18100;
  int D.18101;
  int D.18103;
  int D.18105;
  long unsigned int D.18106;
  long unsigned int D.18107;
  long unsigned int D.18108;
  unsigned int D.18109;
  long unsigned int D.18110;
  unsigned int D.18111;
  unsigned int D.18112;
  unsigned int D.18113;
  long unsigned int D.18114;
  char * D.18115;
  int D.18116;
  long unsigned int D.18117;
  long unsigned int D.18118;
  char * * D.18119;
  struct MonoString * D.18120;
  char * D.18121;
  int D.18122;
  sizetype D.18124;
  sizetype D.18125;
  sizetype D.18126;
  char * * D.18127;
  struct MonoString * D.18128;
  char * D.18129;
  int D.18130;
  unsigned int size.40;
  unsigned int D.18133;
  long unsigned int D.18134;
  long unsigned int D.18135;
  char * * D.18136;
  char * D.18137;
  long unsigned int D.18139;
  long unsigned int D.18140;
  unsigned int D.18141;
  unsigned int D.18142;
  _Bool D.18146;
  long int D.18147;
  long int D.18148;
  _Bool D.18155;
  long int D.18156;
  long int D.18157;
  unsigned char D.18160;
  short unsigned int D.18161;
  short unsigned int D.18162;
  short unsigned int D.18163;
  long unsigned int D.18164;
  long unsigned int D.18165;
  long unsigned int D.18166;
  long unsigned int D.18167;
  char * D.18168;
  char * p.41;
  int D.18170;
  int D.18171;
  char D.18172;
  char * p.42;
  char D.18174;
  char * D.18175;
  long unsigned int D.18176;
  long unsigned int D.18177;
  char * D.18178;
  long unsigned int D.18179;
  long unsigned int D.18180;
  _Bool D.18183;
  long int D.18184;
  long int D.18185;
  MonoBoolean D.18190;
  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.18100 = mono_array_length (items);
      num_counters = (int) D.18100;
      name = 0B;
      chelp = 0B;
      counter_info = 0B;
      mono_error_init (&error);
      name = mono_string_to_utf8_checked (category, &error);
      D.18101 = mono_error_ok (&error);
      if (D.18101 == 0) goto failure; else goto <D.18102>;
      <D.18102>:
      chelp = mono_string_to_utf8_checked (help, &error);
      D.18103 = mono_error_ok (&error);
      if (D.18103 == 0) goto failure; else goto <D.18104>;
      <D.18104>:
      D.18105 = num_counters * 2;
      D.18106 = (long unsigned int) D.18105;
      D.18107 = D.18106 * 8;
      counter_info = monoeg_malloc0 (D.18107);
      D.18108 = __strlen_g (name);
      D.18109 = (unsigned int) D.18108;
      D.18110 = __strlen_g (chelp);
      D.18111 = (unsigned int) D.18110;
      D.18112 = D.18109 + D.18111;
      D.18113 = D.18112 + 14;
      size = (int) D.18113;
      i = 0;
      goto <D.17288>;
      <D.17287>:
      {
        struct CounterCreationData * data;

        D.18114 = (long unsigned int) i;
        D.18115 = mono_array_addr_with_size (items, 8, D.18114);
        data = MEM[(struct CounterCreationData * *)D.18115];
        D.18116 = i * 2;
        D.18117 = (long unsigned int) D.18116;
        D.18118 = D.18117 * 8;
        D.18119 = counter_info + D.18118;
        D.18120 = data->name;
        D.18121 = mono_string_to_utf8_checked (D.18120, &error);
        *D.18119 = D.18121;
        D.18122 = mono_error_ok (&error);
        if (D.18122 == 0) goto failure; else goto <D.18123>;
        <D.18123>:
        D.18116 = i * 2;
        D.18124 = (sizetype) D.18116;
        D.18125 = D.18124 + 1;
        D.18126 = D.18125 * 8;
        D.18127 = counter_info + D.18126;
        D.18128 = data->help;
        D.18129 = mono_string_to_utf8_checked (D.18128, &error);
        *D.18127 = D.18129;
        D.18130 = mono_error_ok (&error);
        if (D.18130 == 0) goto failure; else goto <D.18131>;
        <D.18131>:
        size.40 = (unsigned int) size;
        D.18133 = size.40 + 4;
        size = (int) D.18133;
      }
      i = i + 1;
      <D.17288>:
      if (i < num_counters) goto <D.17287>; else goto <D.17289>;
      <D.17289>:
      i = 0;
      goto <D.17291>;
      <D.17290>:
      D.18134 = (long unsigned int) i;
      D.18135 = D.18134 * 8;
      D.18136 = counter_info + D.18135;
      D.18137 = *D.18136;
      if (D.18137 == 0B) goto failure; else goto <D.18138>;
      <D.18138>:
      D.18134 = (long unsigned int) i;
      D.18135 = D.18134 * 8;
      D.18136 = counter_info + D.18135;
      D.18137 = *D.18136;
      D.18139 = __strlen_g (D.18137);
      D.18140 = D.18139 + 1;
      D.18141 = (unsigned int) D.18140;
      size.40 = (unsigned int) size;
      D.18142 = D.18141 + size.40;
      size = (int) D.18142;
      i = i + 1;
      <D.17291>:
      D.18105 = num_counters * 2;
      if (D.18105 > i) goto <D.17290>; else goto <D.17292>;
      <D.17292>:
      size = size + 7;
      size = size & -8;
      counters_data_size = num_counters * 8;
      if (size > 65535) goto failure; else goto <D.18143>;
      <D.18143>:
      {
        int ret;

        ret = pthread_mutex_lock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18144>; else goto <D.18145>;
        <D.18144>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.18145>:
        D.18146 = ret != 0;
        D.18147 = (long int) D.18146;
        D.18148 = __builtin_expect (D.18147, 0);
        if (D.18148 != 0) goto <D.18149>; else goto <D.18150>;
        <D.18149>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1421, "ret == 0");
        <D.18150>:
      }
      ptr = shared_data_find_room (size);
      if (ptr == 0B) goto <D.18151>; else goto <D.18152>;
      <D.18151>:
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18153>; else goto <D.18154>;
        <D.18153>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18154>:
        D.18155 = ret != 0;
        D.18156 = (long int) D.18155;
        D.18157 = __builtin_expect (D.18156, 0);
        if (D.18157 != 0) goto <D.18158>; else goto <D.18159>;
        <D.18158>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1424, "ret == 0");
        <D.18159>:
      }
      goto failure;
      <D.18152>:
      cat = ptr;
      D.18160 = (unsigned char) type;
      cat->header.extra = D.18160;
      D.18161 = (short unsigned int) size;
      cat->header.size = D.18161;
      D.18162 = (short unsigned int) num_counters;
      cat->num_counters = D.18162;
      D.18163 = (short unsigned int) counters_data_size;
      cat->counters_data_size = D.18163;
      p = &cat->name;
      strcpy (p, name);
      D.18164 = __strlen_g (name);
      D.18165 = D.18164 + 1;
      p = p + D.18165;
      strcpy (p, chelp);
      D.18166 = __strlen_g (chelp);
      D.18167 = D.18166 + 1;
      p = p + D.18167;
      i = 0;
      goto <D.17297>;
      <D.17296>:
      {
        struct CounterCreationData * data;

        D.18114 = (long unsigned int) i;
        D.18168 = mono_array_addr_with_size (items, 8, D.18114);
        data = MEM[(struct CounterCreationData * *)D.18168];
        p.41 = p;
        p = p.41 + 1;
        D.18170 = data->type;
        D.18171 = perfctr_type_compress (D.18170);
        D.18172 = (char) D.18171;
        *p.41 = D.18172;
        p.42 = p;
        p = p.42 + 1;
        D.18174 = (char) i;
        *p.42 = D.18174;
        D.18116 = i * 2;
        D.18117 = (long unsigned int) D.18116;
        D.18118 = D.18117 * 8;
        D.18119 = counter_info + D.18118;
        D.18175 = *D.18119;
        strcpy (p, D.18175);
        D.18116 = i * 2;
        D.18117 = (long unsigned int) D.18116;
        D.18118 = D.18117 * 8;
        D.18119 = counter_info + D.18118;
        D.18175 = *D.18119;
        D.18176 = __strlen_g (D.18175);
        D.18177 = D.18176 + 1;
        p = p + D.18177;
        D.18116 = i * 2;
        D.18124 = (sizetype) D.18116;
        D.18125 = D.18124 + 1;
        D.18126 = D.18125 * 8;
        D.18127 = counter_info + D.18126;
        D.18178 = *D.18127;
        strcpy (p, D.18178);
        D.18116 = i * 2;
        D.18124 = (sizetype) D.18116;
        D.18125 = D.18124 + 1;
        D.18126 = D.18125 * 8;
        D.18127 = counter_info + D.18126;
        D.18178 = *D.18127;
        D.18179 = __strlen_g (D.18178);
        D.18180 = D.18179 + 1;
        p = p + D.18180;
      }
      i = i + 1;
      <D.17297>:
      if (i < num_counters) goto <D.17296>; else goto <D.17298>;
      <D.17298>:
      cat->header.ftype = 67;
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18181>; else goto <D.18182>;
        <D.18181>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18182>:
        D.18183 = ret != 0;
        D.18184 = (long int) D.18183;
        D.18185 = __builtin_expect (D.18184, 0);
        if (D.18185 != 0) goto <D.18186>; else goto <D.18187>;
        <D.18186>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1450, "ret == 0");
        <D.18187>:
      }
      result = 1;
      failure:
      if (counter_info != 0B) goto <D.18188>; else goto <D.18189>;
      <D.18188>:
      i = 0;
      goto <D.17301>;
      <D.17300>:
      D.18134 = (long unsigned int) i;
      D.18135 = D.18134 * 8;
      D.18136 = counter_info + D.18135;
      D.18137 = *D.18136;
      monoeg_g_free (D.18137);
      i = i + 1;
      <D.17301>:
      D.18105 = num_counters * 2;
      if (D.18105 > i) goto <D.17300>; else goto <D.17302>;
      <D.17302>:
      monoeg_g_free (counter_info);
      <D.18189>:
      monoeg_g_free (name);
      monoeg_g_free (chelp);
      mono_error_cleanup (&error);
      D.18190 = (MonoBoolean) result;
      return D.18190;
    }
  finally
    {
      error = {CLOBBER};
    }
}


perfctr_type_compress (int type)
{
  int D.18193;
  int D.18196;
  unsigned int i.43;
  int i;

  i = 0;
  goto <D.16881>;
  <D.16880>:
  D.18193 = simple_type_to_type[i];
  if (D.18193 == type) goto <D.18194>; else goto <D.18195>;
  <D.18194>:
  D.18196 = i;
  return D.18196;
  <D.18195>:
  i = i + 1;
  <D.16881>:
  i.43 = (unsigned int) i;
  if (i.43 <= 27) goto <D.16880>; else goto <D.16882>;
  <D.16882>:
  D.18196 = 2;
  return D.18196;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_instance_exists (struct MonoString * instance, struct MonoString * category, struct MonoString * machine)
{
  int D.18203;
  struct SharedInstance * D.18204;
  const struct CategoryDesc * cdesc;

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

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18201>; else goto <D.18202>;
    <D.18201>:
    D.18203 = 0;
    return D.18203;
    <D.18202>:
    D.18204 = find_custom_instance (scat, instance);
    if (D.18204 != 0B) goto <D.18205>; else goto <D.18206>;
    <D.18205>:
    D.18203 = 1;
    return D.18203;
    <D.18206>:
  }
  goto <D.18207>;
  <D.18200>:
  <D.18207>:
  D.18203 = 0;
  return D.18203;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_category_names (struct MonoString * machine)
{
  int D.18209;
  struct MonoArray * D.18212;
  struct MonoClass * D.18213;
  _Bool D.18216;
  long int D.18217;
  long int D.18218;
  struct MonoClass * D.18221;
  unsigned int D.18222;
  unsigned int D.18223;
  long unsigned int D.18224;
  long unsigned int D.18225;
  const char * D.18226;
  struct MonoString * D.18227;
  char[1] * D.18228;
  struct MonoString * D.18229;
  _Bool D.18232;
  long int D.18233;
  long int D.18234;
  int i;
  struct MonoArray * res;
  struct MonoDomain * domain;
  struct GSList * custom_categories;
  struct GSList * tmp;

  domain = mono_domain_get ();
  D.18209 = mono_string_compare_ascii (machine, ".");
  if (D.18209 != 0) goto <D.18210>; else goto <D.18211>;
  <D.18210>:
  D.18213 = mono_get_string_class ();
  D.18212 = mono_array_new (domain, D.18213, 0);
  return D.18212;
  <D.18211>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18214>; else goto <D.18215>;
    <D.18214>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18215>:
    D.18216 = ret != 0;
    D.18217 = (long int) D.18216;
    D.18218 = __builtin_expect (D.18217, 0);
    if (D.18218 != 0) goto <D.18219>; else goto <D.18220>;
    <D.18219>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1497, "ret == 0");
    <D.18220>:
  }
  custom_categories = get_custom_categories ();
  D.18221 = mono_get_string_class ();
  D.18222 = monoeg_g_slist_length (custom_categories);
  D.18223 = D.18222 + 14;
  D.18224 = (long unsigned int) D.18223;
  res = mono_array_new (domain, D.18221, D.18224);
  i = 0;
  goto <D.17322>;
  <D.17321>:
  {
    const struct CategoryDesc * cdesc;

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

      D.18225 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18225);
      D.18226 = cdesc->name;
      D.18227 = mono_string_new (domain, D.18226);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18227);
    }
  }
  i = i + 1;
  <D.17322>:
  if (i <= 13) goto <D.17321>; else goto <D.17323>;
  <D.17323>:
  tmp = custom_categories;
  goto <D.17327>;
  <D.17326>:
  {
    struct SharedCategory * scat;

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

      D.18225 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18225);
      D.18228 = &scat->name;
      D.18229 = mono_string_new (domain, D.18228);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18229);
    }
    i = i + 1;
  }
  tmp = tmp->next;
  <D.17327>:
  if (tmp != 0B) goto <D.17326>; else goto <D.17328>;
  <D.17328>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18230>; else goto <D.18231>;
    <D.18230>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18231>:
    D.18232 = ret != 0;
    D.18233 = (long int) D.18232;
    D.18234 = __builtin_expect (D.18233, 0);
    if (D.18234 != 0) goto <D.18235>; else goto <D.18236>;
    <D.18235>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1509, "ret == 0");
    <D.18236>:
  }
  monoeg_g_slist_free (custom_categories);
  D.18212 = res;
  return D.18212;
}


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

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


category_collect (struct SharedHeader * header, void * data)
{
  unsigned char D.18241;
  struct GSList * D.18244;
  struct GSList * D.18245;
  gboolean D.18246;
  struct GSList * * list;

  list = data;
  D.18241 = header->ftype;
  if (D.18241 == 67) goto <D.18242>; else goto <D.18243>;
  <D.18242>:
  D.18244 = *list;
  D.18245 = monoeg_g_slist_prepend (D.18244, header);
  *list = D.18245;
  <D.18243>:
  D.18246 = 1;
  return D.18246;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_counter_names (struct MonoString * category, struct MonoString * machine)
{
  int D.18248;
  struct MonoArray * D.18251;
  struct MonoClass * D.18252;
  struct MonoClass * D.18255;
  const struct CategoryDesc * D.18256;
  short int D.18257;
  int D.18258;
  short int D.18259;
  int D.18260;
  int D.18261;
  long unsigned int D.18262;
  int D.18263;
  long unsigned int D.18264;
  const char * D.18265;
  struct MonoString * D.18266;
  _Bool D.18269;
  long int D.18270;
  long int D.18271;
  struct MonoClass * D.18276;
  short unsigned int D.18277;
  long unsigned int D.18278;
  long unsigned int D.18279;
  char * D.18280;
  struct MonoString * D.18281;
  long unsigned int D.18282;
  long unsigned int D.18283;
  long unsigned int D.18284;
  long unsigned int D.18285;
  int D.18286;
  _Bool D.18289;
  long int D.18290;
  long int D.18291;
  _Bool D.18296;
  long int D.18297;
  long int D.18298;
  struct MonoClass * D.18301;
  int i;
  struct SharedCategory * scat;
  const struct CategoryDesc * cdesc;
  struct MonoArray * res;
  struct MonoDomain * domain;

  domain = mono_domain_get ();
  D.18248 = mono_string_compare_ascii (machine, ".");
  if (D.18248 != 0) goto <D.18249>; else goto <D.18250>;
  <D.18249>:
  D.18252 = mono_get_string_class ();
  D.18251 = mono_array_new (domain, D.18252, 0);
  return D.18251;
  <D.18250>:
  cdesc = find_category (category);
  if (cdesc != 0B) goto <D.18253>; else goto <D.18254>;
  <D.18253>:
  D.18255 = mono_get_string_class ();
  D.18256 = cdesc + 24;
  D.18257 = D.18256->first_counter;
  D.18258 = (int) D.18257;
  D.18259 = cdesc->first_counter;
  D.18260 = (int) D.18259;
  D.18261 = D.18258 - D.18260;
  D.18262 = (long unsigned int) D.18261;
  res = mono_array_new (domain, D.18255, D.18262);
  D.18259 = cdesc->first_counter;
  i = (int) D.18259;
  goto <D.17342>;
  <D.17341>:
  {
    const struct CounterDesc * desc;

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

      D.18259 = cdesc->first_counter;
      D.18260 = (int) D.18259;
      D.18263 = i - D.18260;
      D.18264 = (long unsigned int) D.18263;
      __p = mono_array_addr_with_size (res, 8, D.18264);
      D.18265 = desc->name;
      D.18266 = mono_string_new (domain, D.18265);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18266);
    }
  }
  i = i + 1;
  <D.17342>:
  D.18256 = cdesc + 24;
  D.18257 = D.18256->first_counter;
  D.18258 = (int) D.18257;
  if (D.18258 > i) goto <D.17341>; else goto <D.17343>;
  <D.17343>:
  D.18251 = res;
  return D.18251;
  <D.18254>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18267>; else goto <D.18268>;
    <D.18267>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18268>:
    D.18269 = ret != 0;
    D.18270 = (long int) D.18269;
    D.18271 = __builtin_expect (D.18270, 0);
    if (D.18271 != 0) goto <D.18272>; else goto <D.18273>;
    <D.18272>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1534, "ret == 0");
    <D.18273>:
  }
  scat = find_custom_category (category);
  if (scat != 0B) goto <D.18274>; else goto <D.18275>;
  <D.18274>:
  {
    char * p;
    int i;

    p = custom_category_counters (scat);
    D.18276 = mono_get_string_class ();
    D.18277 = scat->num_counters;
    D.18278 = (long unsigned int) D.18277;
    res = mono_array_new (domain, D.18276, D.18278);
    i = 0;
    goto <D.17349>;
    <D.17348>:
    {
      void * * __p;

      D.18279 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18279);
      D.18280 = p + 1;
      D.18281 = mono_string_new (domain, D.18280);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18281);
    }
    D.18280 = p + 1;
    D.18282 = __strlen_g (D.18280);
    D.18283 = D.18282 + 2;
    p = p + D.18283;
    D.18284 = __strlen_g (p);
    D.18285 = D.18284 + 1;
    p = p + D.18285;
    i = i + 1;
    <D.17349>:
    D.18277 = scat->num_counters;
    D.18286 = (int) D.18277;
    if (D.18286 > i) goto <D.17348>; else goto <D.17350>;
    <D.17350>:
    {
      int ret;

      ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
      if (ret != 0) goto <D.18287>; else goto <D.18288>;
      <D.18287>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.18288>:
      D.18289 = ret != 0;
      D.18290 = (long int) D.18289;
      D.18291 = __builtin_expect (D.18290, 0);
      if (D.18291 != 0) goto <D.18292>; else goto <D.18293>;
      <D.18292>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1545, "ret == 0");
      <D.18293>:
    }
    D.18251 = res;
    return D.18251;
  }
  <D.18275>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18294>; else goto <D.18295>;
    <D.18294>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18295>:
    D.18296 = ret != 0;
    D.18297 = (long int) D.18296;
    D.18298 = __builtin_expect (D.18297, 0);
    if (D.18298 != 0) goto <D.18299>; else goto <D.18300>;
    <D.18299>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1548, "ret == 0");
    <D.18300>:
  }
  D.18301 = mono_get_string_class ();
  D.18251 = mono_array_new (domain, D.18301, 0);
  return D.18251;
}


__attribute__((visibility ("hidden")))
mono_perfcounter_instance_names (struct MonoString * category, struct MonoString * machine)
{
  int D.18303;
  struct MonoArray * D.18306;
  struct MonoDomain * D.18307;
  struct MonoClass * D.18308;
  <unnamed-unsigned:6> D.18311;
  int D.18312;
  struct MonoDomain * D.18313;
  struct MonoClass * D.18314;
  const struct CategoryDesc * cat;

  D.18303 = mono_string_compare_ascii (machine, ".");
  if (D.18303 != 0) goto <D.18304>; else goto <D.18305>;
  <D.18304>:
  D.18307 = mono_domain_get ();
  D.18308 = mono_get_string_class ();
  D.18306 = mono_array_new (D.18307, D.18308, 0);
  return D.18306;
  <D.18305>:
  cat = find_category (category);
  if (cat == 0B) goto <D.18309>; else goto <D.18310>;
  <D.18309>:
  D.18306 = get_custom_instances (category);
  return D.18306;
  <D.18310>:
  D.18311 = cat->instance_type;
  D.18312 = (int) D.18311;
  switch (D.18312) <default: <D.17435>, case 0: <D.17432>, case 1: <D.17434>, case 2: <D.17431>, case 3: <D.17430>, case 4: <D.17433>>
  <D.17430>:
  D.18306 = get_mono_instances ();
  return D.18306;
  <D.17431>:
  D.18306 = get_cpu_instances ();
  return D.18306;
  <D.17432>:
  D.18306 = get_processes_instances ();
  return D.18306;
  <D.17433>:
  D.18306 = get_networkinterface_instances ();
  return D.18306;
  <D.17434>:
  <D.17435>:
  D.18313 = mono_domain_get ();
  D.18314 = mono_get_string_class ();
  D.18306 = mono_array_new (D.18313, D.18314, 0);
  return D.18306;
}


get_custom_instances (struct MonoString * category)
{
  struct MonoDomain * D.18318;
  struct MonoClass * D.18319;
  unsigned int D.18320;
  long unsigned int D.18321;
  long unsigned int D.18322;
  struct MonoDomain * D.18323;
  char[1] * D.18324;
  struct MonoString * D.18325;
  struct MonoArray * D.18326;
  struct MonoDomain * D.18327;
  struct MonoClass * D.18328;
  struct SharedCategory * scat;

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

    list = get_custom_instances_list (scat);
    i = 0;
    D.18318 = mono_domain_get ();
    D.18319 = mono_get_string_class ();
    D.18320 = monoeg_g_slist_length (list);
    D.18321 = (long unsigned int) D.18320;
    array = mono_array_new (D.18318, D.18319, D.18321);
    tmp = list;
    goto <D.17423>;
    <D.17422>:
    {
      struct SharedInstance * inst;

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

        D.18322 = (long unsigned int) i;
        __p = mono_array_addr_with_size (array, 8, D.18322);
        D.18323 = mono_domain_get ();
        D.18324 = &inst->instance_name;
        D.18325 = mono_string_new (D.18323, D.18324);
        mono_gc_wbarrier_set_arrayref (array, __p, D.18325);
      }
      i = i + 1;
    }
    tmp = tmp->next;
    <D.17423>:
    if (tmp != 0B) goto <D.17422>; else goto <D.17424>;
    <D.17424>:
    monoeg_g_slist_free (list);
    D.18326 = array;
    return D.18326;
  }
  <D.18317>:
  D.18327 = mono_domain_get ();
  D.18328 = mono_get_string_class ();
  D.18326 = mono_array_new (D.18327, D.18328, 0);
  return D.18326;
}


get_custom_instances_list (struct SharedCategory * cat)
{
  long int cat.44;
  struct MonoSharedArea * shared_area.45;
  long int shared_area.46;
  long int D.18333;
  unsigned int D.18334;
  struct GSList * D.18335;
  struct InstanceSearch search;

  try
    {
      cat.44 = (long int) cat;
      shared_area.45 = shared_area;
      shared_area.46 = (long int) shared_area.45;
      D.18333 = cat.44 - shared_area.46;
      D.18334 = (unsigned int) D.18333;
      search.cat_offset = D.18334;
      search.cat = cat;
      search.instance = 0B;
      search.list = 0B;
      search.result = 0B;
      foreach_shared_item (instance_search, &search);
      D.18335 = search.list;
      return D.18335;
    }
  finally
    {
      search = {CLOBBER};
    }
}


get_mono_instances ()
{
  long unsigned int D.18338;
  long unsigned int D.18339;
  struct MonoArray * D.18340;
  int count;
  int res;
  void * * buf;
  struct MonoArray * array;

  count = 64;
  buf = 0B;
  <D.17387>:
  count = count * 2;
  monoeg_g_free (buf);
  D.18338 = (long unsigned int) count;
  D.18339 = D.18338 * 8;
  buf = monoeg_malloc (D.18339);
  res = mono_shared_area_instances (buf, count);
  if (res == count) goto <D.17387>; else goto <D.17388>;
  <D.17388>:
  array = get_string_array (buf, res, 1);
  monoeg_g_free (buf);
  D.18340 = array;
  return D.18340;
}


get_string_array (void * * array, int count, gboolean is_process)
{
  struct MonoDomain * D.18342;
  struct MonoClass * D.18343;
  long unsigned int D.18344;
  long unsigned int D.18347;
  long unsigned int D.18348;
  void * * D.18349;
  void * D.18350;
  long int D.18351;
  int D.18352;
  long unsigned int D.18354;
  struct MonoString * D.18355;
  struct MonoArray * D.18358;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.18342 = mono_domain_get ();
  D.18343 = mono_get_string_class ();
  D.18344 = (long unsigned int) count;
  res = mono_array_new (D.18342, D.18343, D.18344);
  i = 0;
  goto <D.17366>;
  <D.17365>:
  {
    char buf[128];
    char * p;

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

          D.18347 = (long unsigned int) i;
          D.18348 = D.18347 * 8;
          D.18349 = array + D.18348;
          D.18350 = *D.18349;
          pname = mono_process_get_name (D.18350, &buf, 128);
          D.18347 = (long unsigned int) i;
          D.18348 = D.18347 * 8;
          D.18349 = array + D.18348;
          D.18350 = *D.18349;
          D.18351 = (long int) D.18350;
          D.18352 = (int) D.18351;
          p = monoeg_g_strdup_printf ("%d/%s", D.18352, pname);
        }
        goto <D.18353>;
        <D.18346>:
        D.18347 = (long unsigned int) i;
        D.18348 = D.18347 * 8;
        D.18349 = array + D.18348;
        D.18350 = *D.18349;
        D.18351 = (long int) D.18350;
        D.18352 = (int) D.18351;
        sprintf (&buf, "%d", D.18352);
        p = &buf;
        <D.18353>:
        {
          void * * __p;

          D.18354 = (long unsigned int) i;
          __p = mono_array_addr_with_size (res, 8, D.18354);
          D.18355 = mono_string_new (domain, p);
          mono_gc_wbarrier_set_arrayref (res, __p, D.18355);
        }
        if (&buf != p) goto <D.18356>; else goto <D.18357>;
        <D.18356>:
        monoeg_g_free (p);
        <D.18357>:
      }
    finally
      {
        buf = {CLOBBER};
      }
  }
  i = i + 1;
  <D.17366>:
  if (i < count) goto <D.17365>; else goto <D.17367>;
  <D.17367>:
  D.18358 = res;
  return D.18358;
}


__attribute__((__artificial__, __gnu_inline__, __always_inline__, __leaf__, __nothrow__))
sprintf (char * restrict __s, const char * restrict __fmt)
{
  int D.18360;
  long unsigned int D.18361;

  D.18361 = __builtin_object_size (__s, 1);
  D.18360 = __builtin___sprintf_chk (__s, 1, D.18361, __fmt, __builtin_va_arg_pack ());
  return D.18360;
}


get_cpu_instances ()
{
  int D.18363;
  long unsigned int D.18364;
  long unsigned int D.18365;
  long unsigned int D.18366;
  long unsigned int D.18367;
  void * * D.18368;
  int D.18369;
  long int D.18370;
  void * D.18371;
  struct MonoDomain * D.18372;
  struct MonoString * D.18373;
  struct MonoArray * D.18374;
  void * * buf;
  int i;
  int count;
  struct MonoArray * array;

  buf = 0B;
  D.18363 = mono_cpu_count ();
  count = D.18363 + 1;
  D.18364 = (long unsigned int) count;
  D.18365 = D.18364 * 8;
  buf = monoeg_malloc (D.18365);
  i = 0;
  goto <D.17397>;
  <D.17396>:
  D.18366 = (long unsigned int) i;
  D.18367 = D.18366 * 8;
  D.18368 = buf + D.18367;
  D.18369 = i + -1;
  D.18370 = (long int) D.18369;
  D.18371 = (void *) D.18370;
  *D.18368 = D.18371;
  i = i + 1;
  <D.17397>:
  if (i < count) goto <D.17396>; else goto <D.17398>;
  <D.17398>:
  array = get_string_array (buf, count, 0);
  monoeg_g_free (buf);
  {
    void * * __p;

    __p = mono_array_addr_with_size (array, 8, 0);
    D.18372 = mono_domain_get ();
    D.18373 = mono_string_new (D.18372, "_Total");
    mono_gc_wbarrier_set_arrayref (array, __p, D.18373);
  }
  D.18374 = array;
  return D.18374;
}


get_processes_instances ()
{
  struct MonoArray * D.18378;
  int count.47;
  struct MonoArray * array;
  int count;
  void * * buf;

  try
    {
      count = 0;
      buf = mono_process_list (&count);
      if (buf == 0B) goto <D.18376>; else goto <D.18377>;
      <D.18376>:
      D.18378 = get_string_array (0B, 0, 0);
      return D.18378;
      <D.18377>:
      count.47 = count;
      array = get_string_array (buf, count.47, 1);
      monoeg_g_free (buf);
      D.18378 = array;
      return D.18378;
    }
  finally
    {
      count = {CLOBBER};
    }
}


get_networkinterface_instances ()
{
  struct MonoArray * D.18384;
  int count.48;
  struct MonoArray * array;
  int count;
  void * * buf;

  try
    {
      count = 0;
      buf = mono_networkinterface_list (&count);
      if (buf == 0B) goto <D.18382>; else goto <D.18383>;
      <D.18382>:
      D.18384 = get_string_array_of_strings (0B, 0);
      return D.18384;
      <D.18383>:
      count.48 = count;
      array = get_string_array_of_strings (buf, count.48);
      monoeg_g_strfreev (buf);
      D.18384 = array;
      return D.18384;
    }
  finally
    {
      count = {CLOBBER};
    }
}


get_string_array_of_strings (void * * array, int count)
{
  struct MonoDomain * D.18388;
  struct MonoClass * D.18389;
  long unsigned int D.18390;
  long unsigned int D.18391;
  long unsigned int D.18392;
  void * * D.18393;
  long unsigned int D.18394;
  struct MonoString * D.18395;
  struct MonoArray * D.18396;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.18388 = mono_domain_get ();
  D.18389 = mono_get_string_class ();
  D.18390 = (long unsigned int) count;
  res = mono_array_new (D.18388, D.18389, D.18390);
  i = 0;
  goto <D.17378>;
  <D.17377>:
  {
    char * p;

    D.18391 = (long unsigned int) i;
    D.18392 = D.18391 * 8;
    D.18393 = array + D.18392;
    p = *D.18393;
    {
      void * * __p;

      D.18394 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18394);
      D.18395 = mono_string_new (domain, p);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18395);
    }
  }
  i = i + 1;
  <D.17378>:
  if (i < count) goto <D.17377>; else goto <D.17379>;
  <D.17379>:
  D.18396 = res;
  return D.18396;
}


