mono_perfcounters_init ()
{
  void * shared_area.0;
  struct MonoSharedArea * shared_area.1;
  short unsigned int D.17295;
  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.17295 = (short unsigned int) d_offset;
  shared_area.1->data_start = D.17295;
  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.17297;
  void * D.17300;
  unsigned char D.17305;
  int D.17306;
  const struct CategoryDesc * cdesc;

  D.17297 = mono_string_compare_ascii (machine, ".");
  if (D.17297 != 0) goto <D.17298>; else goto <D.17299>;
  <D.17298>:
  D.17300 = 0B;
  return D.17300;
  <D.17299>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17301>; else goto <D.17302>;
  <D.17301>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17303>; else goto <D.17304>;
    <D.17303>:
    D.17300 = 0B;
    return D.17300;
    <D.17304>:
    *custom = 1;
    D.17300 = custom_get_impl (scat, counter, instance, type);
    return D.17300;
  }
  <D.17302>:
  D.17305 = cdesc->id;
  D.17306 = (int) D.17305;
  switch (D.17306) <default: <D.17307>, case 0: <D.17066>, case 1: <D.17067>, case 2: <D.17068>, case 3: <D.17078>, case 4: <D.17070>, case 5: <D.17071>, case 6: <D.17072>, case 7: <D.17073>, case 8: <D.17074>, case 9: <D.17075>, case 10: <D.17076>, case 11: <D.17077>, case 12: <D.17079>, case 13: <D.17069>>
  <D.17066>:
  D.17300 = cpu_get_impl (counter, instance, type, custom);
  return D.17300;
  <D.17067>:
  D.17300 = process_get_impl (counter, instance, type, custom);
  return D.17300;
  <D.17068>:
  D.17300 = mono_mem_get_impl (counter, instance, type, custom);
  return D.17300;
  <D.17069>:
  D.17300 = network_get_impl (counter, instance, type, custom);
  return D.17300;
  <D.17070>:
  <D.17071>:
  <D.17072>:
  <D.17073>:
  <D.17074>:
  <D.17075>:
  <D.17076>:
  <D.17077>:
  <D.17078>:
  <D.17079>:
  D.17305 = cdesc->id;
  D.17306 = (int) D.17305;
  D.17300 = predef_writable_get_impl (D.17306, counter, instance, type, custom);
  return D.17300;
  <D.17307>:
  D.17300 = 0B;
  return D.17300;
}


mono_string_compare_ascii (struct MonoString * str, const char * ascii_str)
{
  short unsigned int D.17309;
  int D.17312;
  int D.17313;
  const char * ascii_str.3;
  char D.17315;
  int D.17316;
  const unsigned char * D.17317;
  unsigned char D.17318;
  int D.17319;
  guint16 * strc;

  strc = mono_string_chars (str);
  goto <D.16773>;
  <D.16772>:
  D.17309 = *strc;
  if (D.17309 == 0) goto <D.17310>; else goto <D.17311>;
  <D.17310>:
  D.17312 = 0;
  return D.17312;
  <D.17311>:
  strc = strc + 2;
  <D.16773>:
  D.17309 = *strc;
  D.17313 = (int) D.17309;
  ascii_str.3 = ascii_str;
  ascii_str = ascii_str.3 + 1;
  D.17315 = *ascii_str.3;
  D.17316 = (int) D.17315;
  if (D.17313 == D.17316) goto <D.16772>; else goto <D.16774>;
  <D.16774>:
  D.17309 = *strc;
  D.17313 = (int) D.17309;
  D.17317 = ascii_str + 18446744073709551615;
  D.17318 = *D.17317;
  D.17319 = (int) D.17318;
  D.17312 = D.17313 - D.17319;
  return D.17312;
}


find_category (struct MonoString * category)
{
  const char * D.17321;
  int D.17322;
  const struct CategoryDesc * D.17325;
  int i;

  i = 0;
  goto <D.17054>;
  <D.17053>:
  D.17321 = predef_categories[i].name;
  D.17322 = mono_string_compare_ascii (category, D.17321);
  if (D.17322 == 0) goto <D.17323>; else goto <D.17324>;
  <D.17323>:
  D.17325 = &predef_categories[i];
  return D.17325;
  <D.17324>:
  i = i + 1;
  <D.17054>:
  if (i <= 13) goto <D.17053>; else goto <D.17055>;
  <D.17055>:
  D.17325 = 0B;
  return D.17325;
}


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

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


category_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17330;
  char[1] * D.17333;
  struct MonoString * D.17334;
  int D.17335;
  gboolean D.17338;
  struct CatSearch * search;

  search = data;
  D.17330 = header->ftype;
  if (D.17330 == 67) goto <D.17331>; else goto <D.17332>;
  <D.17331>:
  {
    struct SharedCategory * cat;

    cat = header;
    D.17333 = &cat->name;
    D.17334 = search->name;
    D.17335 = mono_string_compare_ascii (D.17334, D.17333);
    if (D.17335 == 0) goto <D.17336>; else goto <D.17337>;
    <D.17336>:
    search->cat = cat;
    D.17338 = 0;
    return D.17338;
    <D.17337>:
  }
  <D.17332>:
  D.17338 = 1;
  return D.17338;
}


foreach_shared_item (gboolean (*SharedFunc) (struct SharedHeader *, void *) func, void * data)
{
  struct MonoSharedArea * shared_area.4;
  short unsigned int D.17341;
  sizetype D.17342;
  int D.17343;
  sizetype D.17344;
  unsigned char * p;
  unsigned char * end;

  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.17341 = shared_area.4->data_start;
  D.17342 = (sizetype) D.17341;
  p = shared_area.4 + D.17342;
  shared_area.4 = shared_area;
  shared_area.4 = shared_area;
  D.17343 = shared_area.4->size;
  D.17344 = (sizetype) D.17343;
  end = shared_area.4 + D.17344;
  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.17345;
  int D.17348;
  unsigned char D.17351;
  short unsigned int D.17354;
  sizetype D.17355;

  goto <D.16759>;
  <D.16758>:
  {
    short unsigned int * next;

    D.17345 = p + 4;
    if (D.17345 > end) goto <D.17346>; else goto <D.17347>;
    <D.17346>:
    return;
    <D.17347>:
    next = p + 2;
    D.17348 = func (p, data);
    if (D.17348 == 0) goto <D.17349>; else goto <D.17350>;
    <D.17349>:
    return;
    <D.17350>:
    D.17351 = *p;
    if (D.17351 == 0) goto <D.17352>; else goto <D.17353>;
    <D.17352>:
    return;
    <D.17353>:
    D.17354 = *next;
    D.17355 = (sizetype) D.17354;
    p = p + D.17355;
  }
  <D.16759>:
  if (p < end) goto <D.16758>; else goto <D.16760>;
  <D.16760>:
}


custom_get_impl (struct SharedCategory * cat, struct MonoString * counter, struct MonoString * instance, int * type)
{
  void * D.17359;
  unsigned char D.17360;
  int D.17361;
  int D.17362;
  char[1] * D.17365;
  long unsigned int D.17366;
  unsigned int D.17367;
  unsigned int D.17368;
  sizetype D.17369;
  unsigned char D.17370;
  long unsigned int D.17371;
  long unsigned int D.17372;
  sizetype D.17373;
  char * D.17374;
  struct SharedCounter * scounter;
  struct SharedInstance * inst;
  int size;

  scounter = find_custom_counter (cat, counter);
  if (scounter == 0B) goto <D.17357>; else goto <D.17358>;
  <D.17357>:
  D.17359 = 0B;
  return D.17359;
  <D.17358>:
  D.17360 = scounter->type;
  D.17361 = (int) D.17360;
  D.17362 = simple_type_to_type[D.17361];
  *type = D.17362;
  inst = custom_get_instance (cat, scounter, instance);
  if (inst == 0B) goto <D.17363>; else goto <D.17364>;
  <D.17363>:
  D.17359 = 0B;
  return D.17359;
  <D.17364>:
  D.17365 = &inst->instance_name;
  D.17366 = strlen (D.17365);
  D.17367 = (unsigned int) D.17366;
  D.17368 = D.17367 + 12;
  size = (int) D.17368;
  size = size + 7;
  size = size & -8;
  D.17369 = (sizetype) size;
  D.17370 = scounter->seq_num;
  D.17371 = (long unsigned int) D.17370;
  D.17372 = D.17371 * 8;
  D.17373 = D.17369 + D.17372;
  D.17374 = inst + D.17373;
  D.17359 = custom_vtable (scounter, inst, D.17374);
  return D.17359;
}


find_custom_counter (struct SharedCategory * cat, struct MonoString * name)
{
  char[1] * D.17376;
  int D.17377;
  struct SharedCounter * D.17380;
  const char * D.17381;
  long unsigned int D.17382;
  sizetype D.17383;
  long unsigned int D.17384;
  sizetype D.17385;
  short unsigned int D.17386;
  int D.17387;
  int i;
  char * p;

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

    counter = p;
    D.17376 = &counter->name;
    D.17377 = mono_string_compare_ascii (name, D.17376);
    if (D.17377 == 0) goto <D.17378>; else goto <D.17379>;
    <D.17378>:
    D.17380 = counter;
    return D.17380;
    <D.17379>:
    D.17381 = p + 1;
    D.17382 = strlen (D.17381);
    D.17383 = D.17382 + 2;
    p = p + D.17383;
    D.17384 = strlen (p);
    D.17385 = D.17384 + 1;
    p = p + D.17385;
  }
  i = i + 1;
  <D.16810>:
  D.17386 = cat->num_counters;
  D.17387 = (int) D.17386;
  if (D.17387 > i) goto <D.16809>; else goto <D.16811>;
  <D.16811>:
  D.17380 = 0B;
  return D.17380;
}


custom_category_counters (struct SharedCategory * cat)
{
  char[1] * D.17389;
  long unsigned int D.17390;
  sizetype D.17391;
  long unsigned int D.17392;
  sizetype D.17393;
  char * D.17394;
  char * p;

  D.17389 = &cat->name;
  D.17390 = strlen (D.17389);
  D.17391 = D.17390 + 1;
  p = &cat->name[D.17391];
  D.17392 = strlen (p);
  D.17393 = D.17392 + 1;
  p = p + D.17393;
  D.17394 = p;
  return D.17394;
}


custom_get_instance (struct SharedCategory * cat, struct SharedCounter * scounter, struct MonoString * instance)
{
  struct SharedInstance * D.17398;
  long unsigned int D.17399;
  unsigned int D.17400;
  unsigned int D.17401;
  short unsigned int D.17402;
  unsigned int D.17403;
  unsigned int D.17404;
  unsigned int size.5;
  unsigned int D.17406;
  _Bool D.17409;
  long int D.17410;
  long int D.17411;
  _Bool D.17418;
  long int D.17419;
  long int D.17420;
  short unsigned int D.17423;
  long int cat.6;
  struct MonoSharedArea * shared_area.7;
  long int shared_area.8;
  long int D.17427;
  unsigned int D.17428;
  int D.17429;
  int D.17430;
  long unsigned int D.17431;
  sizetype D.17432;
  _Bool D.17435;
  long int D.17436;
  long int D.17437;
  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.17396>; else goto <D.17397>;
  <D.17396>:
  D.17398 = inst;
  return D.17398;
  <D.17397>:
  name = mono_string_to_utf8 (instance);
  D.17399 = strlen (name);
  D.17400 = (unsigned int) D.17399;
  D.17401 = D.17400 + 12;
  size = (int) D.17401;
  size = size + 7;
  size = size & -8;
  data_offset = size;
  D.17402 = cat->num_counters;
  D.17403 = (unsigned int) D.17402;
  D.17404 = D.17403 * 8;
  size.5 = (unsigned int) size;
  D.17406 = D.17404 + size.5;
  size = (int) D.17406;
  {
    int ret;

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

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17416>; else goto <D.17417>;
    <D.17416>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17417>:
    D.17418 = ret != 0;
    D.17419 = (long int) D.17418;
    D.17420 = __builtin_expect (D.17419, 0);
    if (D.17420 != 0) goto <D.17421>; else goto <D.17422>;
    <D.17421>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1162, "ret == 0");
    <D.17422>:
  }
  monoeg_g_free (name);
  D.17398 = 0B;
  return D.17398;
  <D.17415>:
  inst = ptr;
  inst->header.extra = 0;
  D.17423 = (short unsigned int) size;
  inst->header.size = D.17423;
  cat.6 = (long int) cat;
  shared_area.7 = shared_area;
  shared_area.8 = (long int) shared_area.7;
  D.17427 = cat.6 - shared_area.8;
  D.17428 = (unsigned int) D.17427;
  inst->category_offset = D.17428;
  D.17429 = cat->num_instances;
  D.17430 = D.17429 + 1;
  cat->num_instances = D.17430;
  p = &inst->instance_name;
  strcpy (p, name);
  D.17431 = strlen (name);
  D.17432 = D.17431 + 1;
  p = p + D.17432;
  inst->header.ftype = 73;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17433>; else goto <D.17434>;
    <D.17433>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17434>:
    D.17435 = ret != 0;
    D.17436 = (long int) D.17435;
    D.17437 = __builtin_expect (D.17436, 0);
    if (D.17437 != 0) goto <D.17438>; else goto <D.17439>;
    <D.17438>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1176, "ret == 0");
    <D.17439>:
  }
  monoeg_g_free (name);
  D.17398 = inst;
  return D.17398;
}


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

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


instance_search (struct SharedHeader * header, void * data)
{
  unsigned char D.17449;
  unsigned int D.17452;
  unsigned int D.17453;
  struct MonoString * D.17456;
  char[1] * D.17459;
  int D.17460;
  gboolean D.17463;
  struct GSList * D.17465;
  struct GSList * D.17466;
  struct InstanceSearch * search;

  search = data;
  D.17449 = header->ftype;
  if (D.17449 == 73) goto <D.17450>; else goto <D.17451>;
  <D.17450>:
  {
    struct SharedInstance * ins;

    ins = header;
    D.17452 = search->cat_offset;
    D.17453 = ins->category_offset;
    if (D.17452 == D.17453) goto <D.17454>; else goto <D.17455>;
    <D.17454>:
    D.17456 = search->instance;
    if (D.17456 != 0B) goto <D.17457>; else goto <D.17458>;
    <D.17457>:
    D.17459 = &ins->instance_name;
    D.17456 = search->instance;
    D.17460 = mono_string_compare_ascii (D.17456, D.17459);
    if (D.17460 == 0) goto <D.17461>; else goto <D.17462>;
    <D.17461>:
    search->result = ins;
    D.17463 = 0;
    return D.17463;
    <D.17462>:
    goto <D.17464>;
    <D.17458>:
    D.17465 = search->list;
    D.17466 = monoeg_g_slist_prepend (D.17465, ins);
    search->list = D.17466;
    <D.17464>:
    <D.17455>:
  }
  <D.17451>:
  D.17463 = 1;
  return D.17463;
}


shared_data_find_room (int size)
{
  struct MonoSharedArea * shared_area.12;
  short unsigned int D.17469;
  sizetype D.17470;
  int D.17471;
  sizetype D.17472;
  unsigned char D.17473;
  long int D.17476;
  long int end.13;
  long int p.14;
  long int D.17479;
  unsigned char * D.17482;
  unsigned char * D.17483;
  short unsigned int D.17488;
  int D.17489;
  sizetype D.17492;
  unsigned char * p;
  unsigned char * end;

  shared_area.12 = shared_area;
  shared_area.12 = shared_area;
  D.17469 = shared_area.12->data_start;
  D.17470 = (sizetype) D.17469;
  p = shared_area.12 + D.17470;
  shared_area.12 = shared_area;
  shared_area.12 = shared_area;
  D.17471 = shared_area.12->size;
  D.17472 = (sizetype) D.17471;
  end = shared_area.12 + D.17472;
  size = size + 7;
  size = size & -8;
  goto <D.16746>;
  <D.16745>:
  {
    short unsigned int * next;

    D.17473 = *p;
    if (D.17473 == 0) goto <D.17474>; else goto <D.17475>;
    <D.17474>:
    D.17476 = (long int) size;
    end.13 = (long int) end;
    p.14 = (long int) p;
    D.17479 = end.13 - p.14;
    if (D.17476 < D.17479) goto <D.17480>; else goto <D.17481>;
    <D.17480>:
    D.17482 = p;
    return D.17482;
    <D.17481>:
    D.17482 = 0B;
    return D.17482;
    <D.17475>:
    D.17483 = p + 4;
    if (D.17483 > end) goto <D.17484>; else goto <D.17485>;
    <D.17484>:
    D.17482 = 0B;
    return D.17482;
    <D.17485>:
    next = p + 2;
    D.17473 = *p;
    if (D.17473 == 68) goto <D.17486>; else goto <D.17487>;
    <D.17486>:
    D.17488 = *next;
    D.17489 = (int) D.17488;
    if (D.17489 == size) goto <D.17490>; else goto <D.17491>;
    <D.17490>:
    D.17482 = p;
    return D.17482;
    <D.17491>:
    <D.17487>:
    D.17488 = *next;
    D.17492 = (sizetype) D.17488;
    p = p + D.17492;
  }
  <D.16746>:
  if (p < end) goto <D.16745>; else goto <D.16747>;
  <D.16747>:
  D.17482 = 0B;
  return D.17482;
}


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

  D.17495 = __builtin_object_size (__dest, 1);
  D.17494 = __builtin___strcpy_chk (__dest, __src, D.17495);
  return D.17494;
}


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


custom_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  long unsigned int D.17503;
  long unsigned int value.15;
  long unsigned int D.17505;
  gint64 D.17506;
  long unsigned int value.16;
  guint64 * ptr;

  ptr = vtable->arg;
  if (ptr != 0B) goto <D.17499>; else goto <D.17500>;
  <D.17499>:
  if (do_incr != 0) goto <D.17501>; else goto <D.17502>;
  <D.17501>:
  D.17503 = *ptr;
  value.15 = (long unsigned int) value;
  D.17505 = D.17503 + value.15;
  *ptr = D.17505;
  D.17503 = *ptr;
  D.17506 = (gint64) D.17503;
  return D.17506;
  <D.17502>:
  value.16 = (long unsigned int) value;
  *ptr = value.16;
  D.17506 = value;
  return D.17506;
  <D.17500>:
  D.17506 = 0;
  return D.17506;
}


custom_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  struct SharedCounter * D.17511;
  unsigned char D.17512;
  int D.17513;
  int D.17514;
  void * D.17515;
  long unsigned int D.17519;
  long int D.17520;
  MonoBoolean D.17521;
  struct CustomVTable * counter_data;

  counter_data = vtable;
  if (only_value == 0) goto <D.17509>; else goto <D.17510>;
  <D.17509>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17510>:
  D.17511 = counter_data->counter_desc;
  D.17512 = D.17511->type;
  D.17513 = (int) D.17512;
  D.17514 = simple_type_to_type[D.17513];
  sample->counterType = D.17514;
  D.17515 = vtable->arg;
  if (D.17515 == 0B) goto <D.17516>; else goto <D.17517>;
  <D.17516>:
  sample->rawValue = 0;
  goto <D.17518>;
  <D.17517>:
  D.17515 = vtable->arg;
  D.17519 = MEM[(guint64 *)D.17515];
  D.17520 = (long int) D.17519;
  sample->rawValue = D.17520;
  <D.17518>:
  D.17521 = 1;
  return D.17521;
}


fill_sample (struct MonoCounterSample * sample)
{
  long int D.17523;
  long int D.17524;

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


cpu_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17525;
  int D.17528;
  void * D.17529;
  short int D.17530;
  int D.17531;
  int D.17532;
  long int D.17533;
  void * D.17534;
  int id;
  const struct CounterDesc * cdesc;

  D.17525 = id_from_string (instance, 0);
  id = D.17525 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[0], counter);
  if (cdesc != 0B) goto <D.17526>; else goto <D.17527>;
  <D.17526>:
  D.17528 = cdesc->type;
  *type = D.17528;
  D.17530 = cdesc->id;
  D.17531 = (int) D.17530;
  D.17532 = D.17531 | id;
  D.17533 = (long int) D.17532;
  D.17534 = (void *) D.17533;
  D.17529 = create_vtable (D.17534, get_cpu_counter, 0B);
  return D.17529;
  <D.17527>:
  D.17529 = 0B;
  return D.17529;
}


get_cpu_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17536;
  long int D.17537;
  short int D.17540;
  int D.17541;
  int D.17542;
  int D.17543;
  long int D.17544;
  MonoBoolean D.17545;
  long int D.17546;
  long int D.17547;
  long int D.17548;
  long int D.17549;
  MonoProcessError error;
  int id;
  int pid;

  try
    {
      D.17536 = vtable->arg;
      D.17537 = (long int) D.17536;
      id = (int) D.17537;
      pid = id >> 5;
      id = id & 31;
      if (only_value == 0) goto <D.17538>; else goto <D.17539>;
      <D.17538>:
      fill_sample (sample);
      sample->baseValue = 1;
      <D.17539>:
      D.17540 = 0;
      D.17541 = (int) D.17540;
      D.17542 = D.17541 + id;
      D.17543 = predef_counters[D.17542].type;
      sample->counterType = D.17543;
      switch (id) <default: <D.17550>, case 0: <D.16864>, case 1: <D.16865>, case 2: <D.16866>, case 3: <D.16867>, case 4: <D.16868>>
      <D.16864>:
      D.17544 = mono_cpu_get_data (pid, 0, &error);
      sample->rawValue = D.17544;
      D.17545 = 1;
      return D.17545;
      <D.16865>:
      D.17546 = mono_cpu_get_data (pid, 1, &error);
      sample->rawValue = D.17546;
      D.17545 = 1;
      return D.17545;
      <D.16866>:
      D.17547 = mono_cpu_get_data (pid, 2, &error);
      sample->rawValue = D.17547;
      D.17545 = 1;
      return D.17545;
      <D.16867>:
      D.17548 = mono_cpu_get_data (pid, 3, &error);
      sample->rawValue = D.17548;
      D.17545 = 1;
      return D.17545;
      <D.16868>:
      D.17549 = mono_cpu_get_data (pid, 4, &error);
      sample->rawValue = D.17549;
      D.17545 = 1;
      return D.17545;
      <D.17550>:
      D.17545 = 0;
      return D.17545;
    }
  finally
    {
      error = {CLOBBER};
    }
}


id_from_string (struct MonoString * instance, gboolean is_process)
{
  int D.17553;
  long int D.17556;
  char * end.17;
  int D.17562;
  int id;

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

    try
      {
        id_str = mono_string_to_utf8 (instance);
        D.17556 = strtol (id_str, &end, 0);
        id = (int) D.17556;
        end.17 = end;
        if (end.17 == id_str) goto <D.17558>; else goto <D.17559>;
        <D.17558>:
        if (is_process == 0) goto <D.17560>; else goto <D.17561>;
        <D.17560>:
        id = -1;
        <D.17561>:
        <D.17559>:
        monoeg_g_free (id_str);
      }
    finally
      {
        end = {CLOBBER};
      }
  }
  <D.17555>:
  D.17562 = id;
  return D.17562;
}


get_counter_in_category (const struct CategoryDesc * desc, struct MonoString * counter)
{
  short int D.17564;
  int D.17565;
  const struct CategoryDesc * D.17566;
  short int D.17567;
  int D.17568;
  const char * D.17569;
  int D.17570;
  const struct CounterDesc * D.17573;
  const struct CounterDesc * cdesc;
  const struct CounterDesc * end;

  D.17564 = desc->first_counter;
  D.17565 = (int) D.17564;
  cdesc = &predef_counters[D.17565];
  D.17566 = desc + 24;
  D.17567 = D.17566->first_counter;
  D.17568 = (int) D.17567;
  end = &predef_counters[D.17568];
  goto <D.16844>;
  <D.16843>:
  D.17569 = cdesc->name;
  D.17570 = mono_string_compare_ascii (counter, D.17569);
  if (D.17570 == 0) goto <D.17571>; else goto <D.17572>;
  <D.17571>:
  D.17573 = cdesc;
  return D.17573;
  <D.17572>:
  cdesc = cdesc + 24;
  <D.16844>:
  if (cdesc < end) goto <D.16843>; else goto <D.16845>;
  <D.16845>:
  D.17573 = 0B;
  return D.17573;
}


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

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


process_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17577;
  int D.17580;
  void * D.17581;
  short int D.17582;
  int D.17583;
  int D.17584;
  long int D.17585;
  void * D.17586;
  int id;
  const struct CounterDesc * cdesc;

  D.17577 = id_from_string (instance, 1);
  id = D.17577 << 5;
  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[1], counter);
  if (cdesc != 0B) goto <D.17578>; else goto <D.17579>;
  <D.17578>:
  D.17580 = cdesc->type;
  *type = D.17580;
  D.17582 = cdesc->id;
  D.17583 = (int) D.17582;
  D.17584 = D.17583 | id;
  D.17585 = (long int) D.17584;
  D.17586 = (void *) D.17585;
  D.17581 = create_vtable (D.17586, get_process_counter, 0B);
  return D.17581;
  <D.17579>:
  D.17581 = 0B;
  return D.17581;
}


get_process_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17588;
  long int D.17589;
  MonoBoolean D.17592;
  short int D.17595;
  int D.17596;
  int D.17597;
  int D.17598;
  long int D.17599;
  void * D.17600;
  long int D.17601;
  long int D.17602;
  long int D.17603;
  long int D.17604;
  long int D.17605;
  long int D.17606;
  long int D.17607;
  int id;
  int pid;

  D.17588 = vtable->arg;
  D.17589 = (long int) D.17588;
  id = (int) D.17589;
  pid = id >> 5;
  if (pid < 0) goto <D.17590>; else goto <D.17591>;
  <D.17590>:
  D.17592 = 0;
  return D.17592;
  <D.17591>:
  id = id & 31;
  if (only_value == 0) goto <D.17593>; else goto <D.17594>;
  <D.17593>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17594>:
  D.17595 = 5;
  D.17596 = (int) D.17595;
  D.17597 = D.17596 + id;
  D.17598 = predef_counters[D.17597].type;
  sample->counterType = D.17598;
  switch (id) <default: <D.17608>, case 0: <D.16909>, case 1: <D.16910>, case 2: <D.16911>, case 3: <D.16912>, case 4: <D.16913>, case 5: <D.16914>, case 6: <D.16915>>
  <D.16909>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17601 = mono_process_get_data (D.17600, 1);
  sample->rawValue = D.17601;
  D.17592 = 1;
  return D.17592;
  <D.16910>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17602 = mono_process_get_data (D.17600, 2);
  sample->rawValue = D.17602;
  D.17592 = 1;
  return D.17592;
  <D.16911>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17603 = mono_process_get_data (D.17600, 3);
  sample->rawValue = D.17603;
  D.17592 = 1;
  return D.17592;
  <D.16912>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17604 = mono_process_get_data (D.17600, 0);
  sample->rawValue = D.17604;
  D.17592 = 1;
  return D.17592;
  <D.16913>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17605 = mono_process_get_data (D.17600, 7);
  sample->rawValue = D.17605;
  D.17592 = 1;
  return D.17592;
  <D.16914>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17606 = mono_process_get_data (D.17600, 4);
  sample->rawValue = D.17606;
  D.17592 = 1;
  return D.17592;
  <D.16915>:
  D.17599 = (long int) pid;
  D.17600 = (void *) D.17599;
  D.17607 = mono_process_get_data (D.17600, 6);
  sample->rawValue = D.17607;
  D.17592 = 1;
  return D.17592;
  <D.17608>:
  D.17592 = 0;
  return D.17592;
}


mono_mem_get_impl (struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  int D.17612;
  void * D.17613;
  short int D.17614;
  long int D.17615;
  void * D.17616;
  const struct CounterDesc * cdesc;

  *custom = 0;
  cdesc = get_counter_in_category (&predef_categories[2], counter);
  if (cdesc != 0B) goto <D.17610>; else goto <D.17611>;
  <D.17610>:
  D.17612 = cdesc->type;
  *type = D.17612;
  D.17614 = cdesc->id;
  D.17615 = (long int) D.17614;
  D.17616 = (void *) D.17615;
  D.17613 = create_vtable (D.17616, mono_mem_counter, 0B);
  return D.17613;
  <D.17611>:
  D.17613 = 0B;
  return D.17613;
}


mono_mem_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17618;
  long int D.17619;
  short int D.17622;
  int D.17623;
  int D.17624;
  int D.17625;
  long unsigned int D.17626;
  long int D.17627;
  MonoBoolean D.17628;
  long unsigned int D.17629;
  long int D.17630;
  int id;

  D.17618 = vtable->arg;
  D.17619 = (long int) D.17618;
  id = (int) D.17619;
  if (only_value == 0) goto <D.17620>; else goto <D.17621>;
  <D.17620>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17621>:
  D.17622 = 12;
  D.17623 = (int) D.17622;
  D.17624 = D.17623 + id;
  D.17625 = predef_counters[D.17624].type;
  sample->counterType = D.17625;
  switch (id) <default: <D.17631>, case 0: <D.16930>, case 1: <D.16931>>
  <D.16930>:
  D.17626 = mono_stats.new_object_count;
  D.17627 = (long int) D.17626;
  sample->rawValue = D.17627;
  D.17628 = 1;
  return D.17628;
  <D.16931>:
  D.17629 = mono_determine_physical_ram_size ();
  D.17630 = (long int) D.17629;
  sample->rawValue = D.17630;
  D.17628 = 1;
  return D.17628;
  <D.17631>:
  D.17628 = 0;
  return D.17628;
}


mono_determine_physical_ram_size ()
{
  long int D.17633;
  long int D.17634;
  _Bool D.17635;
  _Bool D.17636;
  _Bool D.17637;
  guint64 D.17640;
  guint64 page_size;
  guint64 num_pages;

  page_size = 0;
  num_pages = 0;
  D.17633 = sysconf (30);
  page_size = (guint64) D.17633;
  D.17634 = sysconf (85);
  num_pages = (guint64) D.17634;
  D.17635 = page_size == 0;
  D.17636 = num_pages == 0;
  D.17637 = D.17635 | D.17636;
  if (D.17637 != 0) goto <D.17638>; else goto <D.17639>;
  <D.17638>:
  monoeg_g_log (0B, 16, "Your operating system\'s sysconf (3) function doesn\'t correctly report physical memory size!");
  D.17640 = 134217728;
  return D.17640;
  <D.17639>:
  D.17640 = page_size * num_pages;
  return D.17640;
}


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


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

  if (vtable == 0B) goto <D.17649>; else goto <D.17650>;
  <D.17649>:
  return;
  <D.17650>:
  narg = vtable->arg;
  if (narg == 0B) goto <D.17651>; else goto <D.17652>;
  <D.17651>:
  return;
  <D.17652>:
  D.17653 = narg->name;
  monoeg_g_free (D.17653);
  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.17657;
  int D.17658;
  int D.17659;
  int D.17660;
  int D.17661;
  char * D.17662;
  long int D.17663;
  long int D.17664;
  long int D.17665;
  <unnamed type> error.18;
  MonoBoolean D.17670;
  MonoNetworkError error;
  struct NetworkVtableArg * narg;

  try
    {
      error = 2;
      narg = vtable->arg;
      if (only_value == 0) goto <D.17655>; else goto <D.17656>;
      <D.17655>:
      fill_sample (sample);
      <D.17656>:
      D.17657 = 93;
      D.17658 = (int) D.17657;
      D.17659 = narg->id;
      D.17660 = D.17658 + D.17659;
      D.17661 = predef_counters[D.17660].type;
      sample->counterType = D.17661;
      D.17659 = narg->id;
      switch (D.17659) <default: <D.17666>, case 0: <D.16884>, case 1: <D.16886>, case 2: <D.16887>>
      <D.16884>:
      D.17662 = narg->name;
      D.17663 = mono_network_get_data (D.17662, 0, &error);
      sample->rawValue = D.17663;
      goto <D.16885>;
      <D.16886>:
      D.17662 = narg->name;
      D.17664 = mono_network_get_data (D.17662, 1, &error);
      sample->rawValue = D.17664;
      goto <D.16885>;
      <D.16887>:
      D.17662 = narg->name;
      D.17665 = mono_network_get_data (D.17662, 2, &error);
      sample->rawValue = D.17665;
      goto <D.16885>;
      <D.17666>:
      <D.16885>:
      error.18 = error;
      if (error.18 == 0) goto <D.17668>; else goto <D.17669>;
      <D.17668>:
      D.17670 = 1;
      return D.17670;
      <D.17669>:
      D.17670 = 0;
      return D.17670;
    }
  finally
    {
      error = {CLOBBER};
    }
}


predef_writable_get_impl (int cat, struct MonoString * counter, struct MonoString * instance, int * type, MonoBoolean * custom)
{
  const struct CategoryDesc * D.17673;
  int D.17676;
  int D.17680;
  void * D.17681;
  short int D.17682;
  int D.17683;
  int D.17684;
  int D.17685;
  long int D.17686;
  void * D.17687;
  const struct CounterDesc * cdesc;

  *custom = 1;
  D.17673 = &predef_categories[cat];
  cdesc = get_counter_in_category (D.17673, counter);
  if (cdesc != 0B) goto <D.17674>; else goto <D.17675>;
  <D.17674>:
  D.17676 = cdesc->type;
  *type = D.17676;
  if (instance == 0B) goto <D.17677>; else goto <D.17679>;
  <D.17679>:
  D.17680 = mono_string_compare_ascii (instance, "");
  if (D.17680 == 0) goto <D.17677>; else goto <D.17678>;
  <D.17677>:
  D.17682 = cdesc->id;
  D.17683 = (int) D.17682;
  D.17684 = D.17683 << 16;
  D.17685 = D.17684 | cat;
  D.17686 = (long int) D.17685;
  D.17687 = (void *) D.17686;
  D.17681 = create_vtable (D.17687, predef_writable_counter, predef_writable_update);
  return D.17681;
  <D.17678>:
  D.17682 = cdesc->id;
  D.17683 = (int) D.17682;
  D.17684 = D.17683 << 16;
  D.17685 = D.17684 | cat;
  D.17686 = (long int) D.17685;
  D.17687 = (void *) D.17686;
  D.17681 = predef_vtable (D.17687, instance);
  return D.17681;
  <D.17675>:
  D.17681 = 0B;
  return D.17681;
}


predef_writable_update (struct ImplVtable * vtable, MonoBoolean do_incr, gint64 value)
{
  void * D.17689;
  long int D.17690;
  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.17708;
  guint32 * ptr.27;
  int D.17710;
  guint32 * ptr.28;
  int D.17714;
  guint32 * ptr.29;
  unsigned int D.17716;
  unsigned int D.17717;
  unsigned int D.17718;
  guint32 * ptr.30;
  unsigned int D.17720;
  guint32 * ptr.31;
  gint64 * ptr64.32;
  gint64 * ptr64.33;
  long int D.17728;
  long int D.17729;
  gint64 * ptr64.34;
  gint64 * ptr64.35;
  guint32 * volatile ptr;
  gint64 * volatile ptr64;
  int cat_id;
  int id;

  ptr = 0B;
  ptr64 = 0B;
  D.17689 = vtable->arg;
  D.17690 = (long int) D.17689;
  cat_id = (int) D.17690;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  switch (cat_id) <default: <D.17700>, case 3: <D.16989>, case 12: <D.16994>>
  <D.16989>:
  switch (id) <default: <D.17694>, case 0: <D.16990>, case 1: <D.16992>>
  <D.16990>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.20 = &mono_perfcounters.19->aspnet_requests_queued;
  ptr = ptr.20;
  goto <D.16991>;
  <D.16992>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.21 = &mono_perfcounters.19->aspnet_requests;
  ptr = ptr.21;
  goto <D.16991>;
  <D.17694>:
  <D.16991>:
  goto <D.16993>;
  <D.16994>:
  switch (id) <default: <D.17699>, case 0: <D.16995>, case 2: <D.16997>, case 4: <D.16998>, case 5: <D.16999>>
  <D.16995>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr64.22 = &mono_perfcounters.19->threadpool_workitems;
  ptr64 = ptr64.22;
  goto <D.16996>;
  <D.16997>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr64.23 = &mono_perfcounters.19->threadpool_ioworkitems;
  ptr64 = ptr64.23;
  goto <D.16996>;
  <D.16998>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.24 = &mono_perfcounters.19->threadpool_threads;
  ptr = ptr.24;
  goto <D.16996>;
  <D.16999>:
  mono_perfcounters.19 = mono_perfcounters;
  ptr.25 = &mono_perfcounters.19->threadpool_iothreads;
  ptr = ptr.25;
  goto <D.16996>;
  <D.17699>:
  <D.16996>:
  goto <D.16993>;
  <D.17700>:
  <D.16993>:
  ptr.26 = ptr;
  if (ptr.26 != 0B) goto <D.17702>; else goto <D.17703>;
  <D.17702>:
  if (do_incr != 0) goto <D.17704>; else goto <D.17705>;
  <D.17704>:
  if (value == 1) goto <D.17706>; else goto <D.17707>;
  <D.17706>:
  ptr.27 = ptr;
  D.17710 = InterlockedIncrement (ptr.27);
  D.17708 = (gint64) D.17710;
  return D.17708;
  <D.17707>:
  if (value == -1) goto <D.17711>; else goto <D.17712>;
  <D.17711>:
  ptr.28 = ptr;
  D.17714 = InterlockedDecrement (ptr.28);
  D.17708 = (gint64) D.17714;
  return D.17708;
  <D.17712>:
  ptr.29 = ptr;
  D.17716 = *ptr.29;
  D.17717 = (unsigned int) value;
  D.17718 = D.17716 + D.17717;
  *ptr.29 = D.17718;
  ptr.30 = ptr;
  D.17720 = *ptr.30;
  D.17708 = (gint64) D.17720;
  return D.17708;
  <D.17705>:
  ptr.31 = ptr;
  D.17717 = (unsigned int) value;
  *ptr.31 = D.17717;
  D.17708 = value;
  return D.17708;
  <D.17703>:
  ptr64.32 = ptr64;
  if (ptr64.32 != 0B) goto <D.17723>; else goto <D.17724>;
  <D.17723>:
  if (do_incr != 0) goto <D.17725>; else goto <D.17726>;
  <D.17725>:
  ptr64.33 = ptr64;
  D.17728 = *ptr64.33;
  D.17729 = D.17728 + value;
  *ptr64.33 = D.17729;
  ptr64.34 = ptr64;
  D.17708 = *ptr64.34;
  return D.17708;
  <D.17726>:
  ptr64.35 = ptr64;
  *ptr64.35 = value;
  D.17708 = value;
  return D.17708;
  <D.17724>:
  D.17708 = 0;
  return D.17708;
}


InterlockedIncrement (volatile gint32 * val)
{
  gint32 D.17733;
  unsigned int D.17734;

  D.17734 = __sync_add_and_fetch_4 (val, 1);
  D.17733 = (gint32) D.17734;
  return D.17733;
}


InterlockedDecrement (volatile gint32 * val)
{
  gint32 D.17736;
  unsigned int D.17737;

  D.17737 = __sync_sub_and_fetch_4 (val, 1);
  D.17736 = (gint32) D.17737;
  return D.17736;
}


predef_writable_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17739;
  long int D.17740;
  short int D.17743;
  int D.17744;
  int D.17745;
  int D.17746;
  struct MonoPerfCounters * mono_perfcounters.36;
  unsigned int D.17748;
  long int D.17749;
  MonoBoolean D.17750;
  unsigned int D.17752;
  long int D.17753;
  unsigned int D.17754;
  long int D.17755;
  long unsigned int D.17757;
  long int D.17758;
  long unsigned int D.17759;
  long int D.17760;
  unsigned int D.17761;
  long int D.17762;
  unsigned int D.17763;
  long int D.17764;
  unsigned int D.17766;
  long int D.17767;
  unsigned int D.17768;
  long int D.17769;
  unsigned int D.17770;
  long int D.17771;
  unsigned int D.17772;
  long int D.17773;
  int cat_id;
  int id;

  D.17739 = vtable->arg;
  D.17740 = (long int) D.17739;
  cat_id = (int) D.17740;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17741>; else goto <D.17742>;
  <D.17741>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17742>:
  D.17743 = predef_categories[cat_id].first_counter;
  D.17744 = (int) D.17743;
  D.17745 = D.17744 + id;
  D.17746 = predef_counters[D.17745].type;
  sample->counterType = D.17746;
  switch (cat_id) <default: <D.17775>, case 3: <D.16966>, case 4: <D.16974>, case 5: <D.16963>, case 12: <D.16969>>
  <D.16963>:
  switch (id) <default: <D.17751>, case 0: <D.16964>>
  <D.16964>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17748 = mono_perfcounters.36->exceptions_thrown;
  D.17749 = (long int) D.17748;
  sample->rawValue = D.17749;
  D.17750 = 1;
  return D.17750;
  <D.17751>:
  goto <D.16965>;
  <D.16966>:
  switch (id) <default: <D.17756>, case 0: <D.16967>, case 1: <D.16968>>
  <D.16967>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17752 = mono_perfcounters.36->aspnet_requests_queued;
  D.17753 = (long int) D.17752;
  sample->rawValue = D.17753;
  D.17750 = 1;
  return D.17750;
  <D.16968>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17754 = mono_perfcounters.36->aspnet_requests;
  D.17755 = (long int) D.17754;
  sample->rawValue = D.17755;
  D.17750 = 1;
  return D.17750;
  <D.17756>:
  goto <D.16965>;
  <D.16969>:
  switch (id) <default: <D.17765>, case 0: <D.16970>, case 2: <D.16971>, case 4: <D.16972>, case 5: <D.16973>>
  <D.16970>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17757 = mono_perfcounters.36->threadpool_workitems;
  D.17758 = (long int) D.17757;
  sample->rawValue = D.17758;
  D.17750 = 1;
  return D.17750;
  <D.16971>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17759 = mono_perfcounters.36->threadpool_ioworkitems;
  D.17760 = (long int) D.17759;
  sample->rawValue = D.17760;
  D.17750 = 1;
  return D.17750;
  <D.16972>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17761 = mono_perfcounters.36->threadpool_threads;
  D.17762 = (long int) D.17761;
  sample->rawValue = D.17762;
  D.17750 = 1;
  return D.17750;
  <D.16973>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17763 = mono_perfcounters.36->threadpool_iothreads;
  D.17764 = (long int) D.17763;
  sample->rawValue = D.17764;
  D.17750 = 1;
  return D.17750;
  <D.17765>:
  goto <D.16965>;
  <D.16974>:
  switch (id) <default: <D.17774>, case 0: <D.16975>, case 1: <D.16976>, case 2: <D.16977>, case 3: <D.16978>, case 4: <D.16979>>
  <D.16975>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17766 = mono_perfcounters.36->jit_bytes;
  D.17767 = (long int) D.17766;
  sample->rawValue = D.17767;
  D.17750 = 1;
  return D.17750;
  <D.16976>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17768 = mono_perfcounters.36->jit_methods;
  D.17769 = (long int) D.17768;
  sample->rawValue = D.17769;
  D.17750 = 1;
  return D.17750;
  <D.16977>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17770 = mono_perfcounters.36->jit_time;
  D.17771 = (long int) D.17770;
  sample->rawValue = D.17771;
  D.17750 = 1;
  return D.17750;
  <D.16978>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17766 = mono_perfcounters.36->jit_bytes;
  D.17767 = (long int) D.17766;
  sample->rawValue = D.17767;
  D.17750 = 1;
  return D.17750;
  <D.16979>:
  mono_perfcounters.36 = mono_perfcounters;
  D.17772 = mono_perfcounters.36->jit_failures;
  D.17773 = (long int) D.17772;
  sample->rawValue = D.17773;
  D.17750 = 1;
  return D.17750;
  <D.17774>:
  goto <D.16965>;
  <D.17775>:
  <D.16965>:
  D.17750 = 0;
  return D.17750;
}


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


predef_cleanup (struct ImplVtable * vtable)
{
  _Bool D.17786;
  long int D.17787;
  long int D.17788;
  struct GHashTable * pid_to_shared_area.37;
  _Bool D.17796;
  long int D.17797;
  long int D.17798;
  int D.17801;
  _Bool D.17804;
  long int D.17805;
  long int D.17806;
  struct PredefVtable * vt;

  vt = vtable;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17784>; else goto <D.17785>;
    <D.17784>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17785>:
    D.17786 = ret != 0;
    D.17787 = (long int) D.17786;
    D.17788 = __builtin_expect (D.17787, 0);
    if (D.17788 != 0) goto <D.17789>; else goto <D.17790>;
    <D.17789>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 389, "ret == 0");
    <D.17790>:
  }
  pid_to_shared_area.37 = pid_to_shared_area;
  if (pid_to_shared_area.37 == 0B) goto <D.17792>; else goto <D.17793>;
  <D.17792>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17794>; else goto <D.17795>;
    <D.17794>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17795>:
    D.17796 = ret != 0;
    D.17797 = (long int) D.17796;
    D.17798 = __builtin_expect (D.17797, 0);
    if (D.17798 != 0) goto <D.17799>; else goto <D.17800>;
    <D.17799>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 391, "ret == 0");
    <D.17800>:
  }
  return;
  <D.17793>:
  D.17801 = vt->pid;
  unref_pid_unlocked (D.17801);
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17802>; else goto <D.17803>;
    <D.17802>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17803>:
    D.17804 = ret != 0;
    D.17805 = (long int) D.17804;
    D.17806 = __builtin_expect (D.17805, 0);
    if (D.17806 != 0) goto <D.17807>; else goto <D.17808>;
    <D.17807>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 395, "ret == 0");
    <D.17808>:
  }
}


unref_pid_unlocked (int pid)
{
  long int D.17810;
  const void * D.17811;
  struct GHashTable * pid_to_shared_area.38;
  int D.17815;
  int D.17816;
  void * D.17819;
  struct ExternalSArea * data;

  D.17810 = (long int) pid;
  D.17811 = (const void *) D.17810;
  pid_to_shared_area.38 = pid_to_shared_area;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.38, D.17811);
  if (data != 0B) goto <D.17813>; else goto <D.17814>;
  <D.17813>:
  D.17815 = data->refcount;
  D.17816 = D.17815 + -1;
  data->refcount = D.17816;
  D.17815 = data->refcount;
  if (D.17815 == 0) goto <D.17817>; else goto <D.17818>;
  <D.17817>:
  D.17810 = (long int) pid;
  D.17811 = (const void *) D.17810;
  pid_to_shared_area.38 = pid_to_shared_area;
  monoeg_g_hash_table_remove (pid_to_shared_area.38, D.17811);
  D.17819 = data->sarea;
  mono_shared_area_unload (D.17819);
  monoeg_g_free (data);
  <D.17818>:
  <D.17814>:
}


predef_readonly_counter (struct ImplVtable * vtable, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  void * D.17820;
  long int D.17821;
  short int D.17824;
  int D.17825;
  int D.17826;
  int D.17827;
  struct MonoPerfCounters * D.17828;
  short unsigned int D.17829;
  sizetype D.17830;
  guint32 * D.17831;
  unsigned int D.17832;
  long int D.17833;
  MonoBoolean D.17834;
  struct PredefVtable * vt;
  const struct CounterDesc * desc;
  int cat_id;
  int id;

  vt = vtable;
  D.17820 = vtable->arg;
  D.17821 = (long int) D.17820;
  cat_id = (int) D.17821;
  id = cat_id >> 16;
  cat_id = cat_id & 65535;
  if (only_value == 0) goto <D.17822>; else goto <D.17823>;
  <D.17822>:
  fill_sample (sample);
  sample->baseValue = 1;
  <D.17823>:
  D.17824 = predef_categories[cat_id].first_counter;
  D.17825 = (int) D.17824;
  D.17826 = D.17825 + id;
  desc = &predef_counters[D.17826];
  D.17827 = desc->type;
  sample->counterType = D.17827;
  D.17828 = vt->counters;
  D.17829 = desc->offset;
  D.17830 = (sizetype) D.17829;
  D.17831 = D.17828 + D.17830;
  D.17832 = *D.17831;
  D.17833 = (long int) D.17832;
  sample->rawValue = D.17833;
  D.17834 = 1;
  return D.17834;
}


atoi (const char * __nptr)
{
  int D.17836;
  long int D.17837;

  D.17837 = strtol (__nptr, 0B, 10);
  D.17836 = (int) D.17837;
  return D.17836;
}


load_sarea_for_pid (int pid)
{
  _Bool D.17841;
  long int D.17842;
  long int D.17843;
  struct GHashTable * pid_to_shared_area.39;
  struct GHashTable * pid_to_shared_area.40;
  long int D.17850;
  const void * D.17851;
  void * D.17854;
  int D.17858;
  int D.17859;
  _Bool D.17862;
  long int D.17863;
  long int D.17864;
  struct MonoSharedArea * D.17867;
  struct ExternalSArea * data;
  struct MonoSharedArea * area;

  area = 0B;
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17839>; else goto <D.17840>;
    <D.17839>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17840>:
    D.17841 = ret != 0;
    D.17842 = (long int) D.17841;
    D.17843 = __builtin_expect (D.17842, 0);
    if (D.17843 != 0) goto <D.17844>; else goto <D.17845>;
    <D.17844>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 348, "ret == 0");
    <D.17845>:
  }
  pid_to_shared_area.39 = pid_to_shared_area;
  if (pid_to_shared_area.39 == 0B) goto <D.17847>; else goto <D.17848>;
  <D.17847>:
  pid_to_shared_area.40 = monoeg_g_hash_table_new (0B, 0B);
  pid_to_shared_area = pid_to_shared_area.40;
  <D.17848>:
  D.17850 = (long int) pid;
  D.17851 = (const void *) D.17850;
  pid_to_shared_area.39 = pid_to_shared_area;
  data = monoeg_g_hash_table_lookup (pid_to_shared_area.39, D.17851);
  if (data == 0B) goto <D.17852>; else goto <D.17853>;
  <D.17852>:
  D.17850 = (long int) pid;
  D.17854 = (void *) D.17850;
  area = mono_shared_area_for_pid (D.17854);
  if (area != 0B) goto <D.17855>; else goto <D.17856>;
  <D.17855>:
  data = monoeg_malloc (16);
  data->sarea = area;
  data->refcount = 1;
  D.17850 = (long int) pid;
  D.17854 = (void *) D.17850;
  pid_to_shared_area.39 = pid_to_shared_area;
  monoeg_g_hash_table_insert_replace (pid_to_shared_area.39, D.17854, data, 0);
  <D.17856>:
  goto <D.17857>;
  <D.17853>:
  area = data->sarea;
  D.17858 = data->refcount;
  D.17859 = D.17858 + 1;
  data->refcount = D.17859;
  <D.17857>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17860>; else goto <D.17861>;
    <D.17860>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17861>:
    D.17862 = ret != 0;
    D.17863 = (long int) D.17862;
    D.17864 = __builtin_expect (D.17863, 0);
    if (D.17864 != 0) goto <D.17865>; else goto <D.17866>;
    <D.17865>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 364, "ret == 0");
    <D.17866>:
  }
  D.17867 = area;
  return D.17867;
}


mono_perfcounter_get_sample (void * impl, MonoBoolean only_value, struct MonoCounterSample * sample)
{
  MonoBoolean (*<T2b7e>) (struct ImplVtable *, MonoBoolean, struct MonoCounterSample *) D.17871;
  MonoBoolean D.17874;
  int D.17875;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17869>; else goto <D.17870>;
  <D.17869>:
  D.17871 = vtable->sample;
  if (D.17871 != 0B) goto <D.17872>; else goto <D.17873>;
  <D.17872>:
  D.17871 = vtable->sample;
  D.17875 = (int) only_value;
  D.17874 = D.17871 (vtable, D.17875, sample);
  return D.17874;
  <D.17873>:
  <D.17870>:
  D.17874 = 0;
  return D.17874;
}


mono_perfcounter_update_value (void * impl, MonoBoolean do_incr, gint64 value)
{
  gint64 (*<T2b83>) (struct ImplVtable *, MonoBoolean, gint64) D.17879;
  gint64 D.17882;
  int D.17883;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17877>; else goto <D.17878>;
  <D.17877>:
  D.17879 = vtable->update;
  if (D.17879 != 0B) goto <D.17880>; else goto <D.17881>;
  <D.17880>:
  D.17879 = vtable->update;
  D.17883 = (int) do_incr;
  D.17882 = D.17879 (vtable, D.17883, value);
  return D.17882;
  <D.17881>:
  <D.17878>:
  D.17882 = 0;
  return D.17882;
}


mono_perfcounter_free_data (void * impl)
{
  void (*<T2b88>) (struct ImplVtable *) D.17887;
  struct ImplVtable * vtable;

  vtable = impl;
  if (vtable != 0B) goto <D.17885>; else goto <D.17886>;
  <D.17885>:
  D.17887 = vtable->cleanup;
  if (D.17887 != 0B) goto <D.17888>; else goto <D.17889>;
  <D.17888>:
  D.17887 = vtable->cleanup;
  D.17887 (vtable);
  <D.17889>:
  <D.17886>:
  monoeg_g_free (impl);
}


mono_perfcounter_category_del (struct MonoString * name)
{
  MonoBoolean D.17892;
  _Bool D.17895;
  long int D.17896;
  long int D.17897;
  int D.17903;
  _Bool D.17906;
  long int D.17907;
  long int D.17908;
  _Bool D.17913;
  long int D.17914;
  long int D.17915;
  const struct CategoryDesc * cdesc;
  struct SharedCategory * cat;

  cdesc = find_category (name);
  if (cdesc != 0B) goto <D.17890>; else goto <D.17891>;
  <D.17890>:
  D.17892 = 0;
  return D.17892;
  <D.17891>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17893>; else goto <D.17894>;
    <D.17893>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.17894>:
    D.17895 = ret != 0;
    D.17896 = (long int) D.17895;
    D.17897 = __builtin_expect (D.17896, 0);
    if (D.17897 != 0) goto <D.17898>; else goto <D.17899>;
    <D.17898>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1304, "ret == 0");
    <D.17899>:
  }
  cat = find_custom_category (name);
  if (cat == 0B) goto <D.17900>; else goto <D.17902>;
  <D.17902>:
  D.17903 = cat->num_instances;
  if (D.17903 != 0) goto <D.17900>; else goto <D.17901>;
  <D.17900>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17904>; else goto <D.17905>;
    <D.17904>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17905>:
    D.17906 = ret != 0;
    D.17907 = (long int) D.17906;
    D.17908 = __builtin_expect (D.17907, 0);
    if (D.17908 != 0) goto <D.17909>; else goto <D.17910>;
    <D.17909>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1308, "ret == 0");
    <D.17910>:
  }
  D.17892 = 0;
  return D.17892;
  <D.17901>:
  cat->header.ftype = 68;
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.17911>; else goto <D.17912>;
    <D.17911>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.17912>:
    D.17913 = ret != 0;
    D.17914 = (long int) D.17913;
    D.17915 = __builtin_expect (D.17914, 0);
    if (D.17915 != 0) goto <D.17916>; else goto <D.17917>;
    <D.17916>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1312, "ret == 0");
    <D.17917>:
  }
  D.17892 = 1;
  return D.17892;
}


mono_perfcounter_category_help (struct MonoString * category, struct MonoString * machine)
{
  int D.17919;
  struct MonoString * D.17922;
  char * D.17927;
  struct MonoDomain * D.17928;
  const char * D.17929;
  struct MonoDomain * D.17930;
  const struct CategoryDesc * cdesc;

  D.17919 = mono_string_compare_ascii (machine, ".");
  if (D.17919 != 0) goto <D.17920>; else goto <D.17921>;
  <D.17920>:
  D.17922 = 0B;
  return D.17922;
  <D.17921>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17923>; else goto <D.17924>;
  <D.17923>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17925>; else goto <D.17926>;
    <D.17925>:
    D.17922 = 0B;
    return D.17922;
    <D.17926>:
    D.17927 = custom_category_help (scat);
    D.17928 = mono_domain_get ();
    D.17922 = mono_string_new (D.17928, D.17927);
    return D.17922;
  }
  <D.17924>:
  D.17929 = cdesc->help;
  D.17930 = mono_domain_get ();
  D.17922 = mono_string_new (D.17930, D.17929);
  return D.17922;
}


custom_category_help (struct SharedCategory * cat)
{
  char * D.17932;
  char[1] * D.17933;
  long unsigned int D.17934;
  sizetype D.17935;

  D.17933 = &cat->name;
  D.17934 = strlen (D.17933);
  D.17935 = D.17934 + 1;
  D.17932 = &cat->name[D.17935];
  return D.17932;
}


mono_perfcounter_category_exists (struct MonoString * counter, struct MonoString * category, struct MonoString * machine)
{
  int D.17937;
  MonoBoolean D.17940;
  struct SharedCounter * D.17947;
  _Bool D.17948;
  const struct CounterDesc * D.17951;
  const struct CategoryDesc * cdesc;

  D.17937 = mono_string_compare_ascii (machine, ".");
  if (D.17937 != 0) goto <D.17938>; else goto <D.17939>;
  <D.17938>:
  D.17940 = 0;
  return D.17940;
  <D.17939>:
  cdesc = find_category (category);
  if (cdesc == 0B) goto <D.17941>; else goto <D.17942>;
  <D.17941>:
  {
    struct SharedCategory * scat;

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.17943>; else goto <D.17944>;
    <D.17943>:
    D.17940 = 0;
    return D.17940;
    <D.17944>:
    if (counter == 0B) goto <D.17945>; else goto <D.17946>;
    <D.17945>:
    D.17940 = 1;
    return D.17940;
    <D.17946>:
    D.17947 = find_custom_counter (scat, counter);
    D.17948 = D.17947 != 0B;
    D.17940 = (MonoBoolean) D.17948;
    return D.17940;
  }
  <D.17942>:
  if (counter == 0B) goto <D.17949>; else goto <D.17950>;
  <D.17949>:
  D.17940 = 1;
  return D.17940;
  <D.17950>:
  D.17951 = get_counter_in_category (cdesc, counter);
  if (D.17951 != 0B) goto <D.17952>; else goto <D.17953>;
  <D.17952>:
  D.17940 = 1;
  return D.17940;
  <D.17953>:
  D.17940 = 0;
  return D.17940;
}


mono_perfcounter_create (struct MonoString * category, struct MonoString * help, int type, struct MonoArray * items)
{
  long unsigned int D.17955;
  int D.17956;
  int D.17958;
  int D.17960;
  long unsigned int D.17961;
  long unsigned int D.17962;
  long unsigned int D.17963;
  unsigned int D.17964;
  long unsigned int D.17965;
  unsigned int D.17966;
  unsigned int D.17967;
  unsigned int D.17968;
  long unsigned int D.17969;
  char * D.17970;
  int D.17971;
  long unsigned int D.17972;
  long unsigned int D.17973;
  char * * D.17974;
  struct MonoString * D.17975;
  char * D.17976;
  int D.17977;
  sizetype D.17979;
  sizetype D.17980;
  sizetype D.17981;
  char * * D.17982;
  struct MonoString * D.17983;
  char * D.17984;
  int D.17985;
  unsigned int size.41;
  unsigned int D.17988;
  long unsigned int D.17989;
  long unsigned int D.17990;
  char * * D.17991;
  char * D.17992;
  long unsigned int D.17994;
  unsigned int D.17995;
  unsigned int D.17996;
  unsigned int D.17997;
  _Bool D.18001;
  long int D.18002;
  long int D.18003;
  _Bool D.18010;
  long int D.18011;
  long int D.18012;
  unsigned char D.18015;
  short unsigned int D.18016;
  short unsigned int D.18017;
  short unsigned int D.18018;
  long unsigned int D.18019;
  sizetype D.18020;
  long unsigned int D.18021;
  sizetype D.18022;
  char * D.18023;
  char * p.42;
  int D.18025;
  int D.18026;
  char D.18027;
  char * p.43;
  char D.18029;
  char * D.18030;
  long unsigned int D.18031;
  sizetype D.18032;
  char * D.18033;
  long unsigned int D.18034;
  sizetype D.18035;
  _Bool D.18038;
  long int D.18039;
  long int D.18040;
  MonoBoolean D.18045;
  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.17955 = mono_array_length (items);
      num_counters = (int) D.17955;
      name = 0B;
      chelp = 0B;
      counter_info = 0B;
      mono_error_init (&error);
      name = mono_string_to_utf8_checked (category, &error);
      D.17956 = mono_error_ok (&error);
      if (D.17956 == 0) goto failure; else goto <D.17957>;
      <D.17957>:
      chelp = mono_string_to_utf8_checked (help, &error);
      D.17958 = mono_error_ok (&error);
      if (D.17958 == 0) goto failure; else goto <D.17959>;
      <D.17959>:
      D.17960 = num_counters * 2;
      D.17961 = (long unsigned int) D.17960;
      D.17962 = D.17961 * 8;
      counter_info = monoeg_malloc0 (D.17962);
      D.17963 = strlen (name);
      D.17964 = (unsigned int) D.17963;
      D.17965 = strlen (chelp);
      D.17966 = (unsigned int) D.17965;
      D.17967 = D.17964 + D.17966;
      D.17968 = D.17967 + 14;
      size = (int) D.17968;
      i = 0;
      goto <D.17144>;
      <D.17143>:
      {
        struct CounterCreationData * data;

        D.17969 = (long unsigned int) i;
        D.17970 = mono_array_addr_with_size (items, 8, D.17969);
        data = MEM[(struct CounterCreationData * *)D.17970];
        D.17971 = i * 2;
        D.17972 = (long unsigned int) D.17971;
        D.17973 = D.17972 * 8;
        D.17974 = counter_info + D.17973;
        D.17975 = data->name;
        D.17976 = mono_string_to_utf8_checked (D.17975, &error);
        *D.17974 = D.17976;
        D.17977 = mono_error_ok (&error);
        if (D.17977 == 0) goto failure; else goto <D.17978>;
        <D.17978>:
        D.17971 = i * 2;
        D.17979 = (sizetype) D.17971;
        D.17980 = D.17979 + 1;
        D.17981 = D.17980 * 8;
        D.17982 = counter_info + D.17981;
        D.17983 = data->help;
        D.17984 = mono_string_to_utf8_checked (D.17983, &error);
        *D.17982 = D.17984;
        D.17985 = mono_error_ok (&error);
        if (D.17985 == 0) goto failure; else goto <D.17986>;
        <D.17986>:
        size.41 = (unsigned int) size;
        D.17988 = size.41 + 4;
        size = (int) D.17988;
      }
      i = i + 1;
      <D.17144>:
      if (i < num_counters) goto <D.17143>; else goto <D.17145>;
      <D.17145>:
      i = 0;
      goto <D.17147>;
      <D.17146>:
      D.17989 = (long unsigned int) i;
      D.17990 = D.17989 * 8;
      D.17991 = counter_info + D.17990;
      D.17992 = *D.17991;
      if (D.17992 == 0B) goto failure; else goto <D.17993>;
      <D.17993>:
      D.17989 = (long unsigned int) i;
      D.17990 = D.17989 * 8;
      D.17991 = counter_info + D.17990;
      D.17992 = *D.17991;
      D.17994 = strlen (D.17992);
      D.17995 = (unsigned int) D.17994;
      size.41 = (unsigned int) size;
      D.17996 = D.17995 + size.41;
      D.17997 = D.17996 + 1;
      size = (int) D.17997;
      i = i + 1;
      <D.17147>:
      D.17960 = num_counters * 2;
      if (D.17960 > i) goto <D.17146>; else goto <D.17148>;
      <D.17148>:
      size = size + 7;
      size = size & -8;
      counters_data_size = num_counters * 8;
      if (size > 65535) goto failure; else goto <D.17998>;
      <D.17998>:
      {
        int ret;

        ret = pthread_mutex_lock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.17999>; else goto <D.18000>;
        <D.17999>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
        <D.18000>:
        D.18001 = ret != 0;
        D.18002 = (long int) D.18001;
        D.18003 = __builtin_expect (D.18002, 0);
        if (D.18003 != 0) goto <D.18004>; else goto <D.18005>;
        <D.18004>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1421, "ret == 0");
        <D.18005>:
      }
      ptr = shared_data_find_room (size);
      if (ptr == 0B) goto <D.18006>; else goto <D.18007>;
      <D.18006>:
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18008>; else goto <D.18009>;
        <D.18008>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18009>:
        D.18010 = ret != 0;
        D.18011 = (long int) D.18010;
        D.18012 = __builtin_expect (D.18011, 0);
        if (D.18012 != 0) goto <D.18013>; else goto <D.18014>;
        <D.18013>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1424, "ret == 0");
        <D.18014>:
      }
      goto failure;
      <D.18007>:
      cat = ptr;
      D.18015 = (unsigned char) type;
      cat->header.extra = D.18015;
      D.18016 = (short unsigned int) size;
      cat->header.size = D.18016;
      D.18017 = (short unsigned int) num_counters;
      cat->num_counters = D.18017;
      D.18018 = (short unsigned int) counters_data_size;
      cat->counters_data_size = D.18018;
      p = &cat->name;
      strcpy (p, name);
      D.18019 = strlen (name);
      D.18020 = D.18019 + 1;
      p = p + D.18020;
      strcpy (p, chelp);
      D.18021 = strlen (chelp);
      D.18022 = D.18021 + 1;
      p = p + D.18022;
      i = 0;
      goto <D.17153>;
      <D.17152>:
      {
        struct CounterCreationData * data;

        D.17969 = (long unsigned int) i;
        D.18023 = mono_array_addr_with_size (items, 8, D.17969);
        data = MEM[(struct CounterCreationData * *)D.18023];
        p.42 = p;
        p = p.42 + 1;
        D.18025 = data->type;
        D.18026 = perfctr_type_compress (D.18025);
        D.18027 = (char) D.18026;
        *p.42 = D.18027;
        p.43 = p;
        p = p.43 + 1;
        D.18029 = (char) i;
        *p.43 = D.18029;
        D.17971 = i * 2;
        D.17972 = (long unsigned int) D.17971;
        D.17973 = D.17972 * 8;
        D.17974 = counter_info + D.17973;
        D.18030 = *D.17974;
        strcpy (p, D.18030);
        D.17971 = i * 2;
        D.17972 = (long unsigned int) D.17971;
        D.17973 = D.17972 * 8;
        D.17974 = counter_info + D.17973;
        D.18030 = *D.17974;
        D.18031 = strlen (D.18030);
        D.18032 = D.18031 + 1;
        p = p + D.18032;
        D.17971 = i * 2;
        D.17979 = (sizetype) D.17971;
        D.17980 = D.17979 + 1;
        D.17981 = D.17980 * 8;
        D.17982 = counter_info + D.17981;
        D.18033 = *D.17982;
        strcpy (p, D.18033);
        D.17971 = i * 2;
        D.17979 = (sizetype) D.17971;
        D.17980 = D.17979 + 1;
        D.17981 = D.17980 * 8;
        D.17982 = counter_info + D.17981;
        D.18033 = *D.17982;
        D.18034 = strlen (D.18033);
        D.18035 = D.18034 + 1;
        p = p + D.18035;
      }
      i = i + 1;
      <D.17153>:
      if (i < num_counters) goto <D.17152>; else goto <D.17154>;
      <D.17154>:
      cat->header.ftype = 67;
      {
        int ret;

        ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
        if (ret != 0) goto <D.18036>; else goto <D.18037>;
        <D.18036>:
        monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
        <D.18037>:
        D.18038 = ret != 0;
        D.18039 = (long int) D.18038;
        D.18040 = __builtin_expect (D.18039, 0);
        if (D.18040 != 0) goto <D.18041>; else goto <D.18042>;
        <D.18041>:
        monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1450, "ret == 0");
        <D.18042>:
      }
      result = 1;
      failure:
      if (counter_info != 0B) goto <D.18043>; else goto <D.18044>;
      <D.18043>:
      i = 0;
      goto <D.17157>;
      <D.17156>:
      D.17989 = (long unsigned int) i;
      D.17990 = D.17989 * 8;
      D.17991 = counter_info + D.17990;
      D.17992 = *D.17991;
      monoeg_g_free (D.17992);
      i = i + 1;
      <D.17157>:
      D.17960 = num_counters * 2;
      if (D.17960 > i) goto <D.17156>; else goto <D.17158>;
      <D.17158>:
      monoeg_g_free (counter_info);
      <D.18044>:
      monoeg_g_free (name);
      monoeg_g_free (chelp);
      mono_error_cleanup (&error);
      D.18045 = (MonoBoolean) result;
      return D.18045;
    }
  finally
    {
      error = {CLOBBER};
    }
}


perfctr_type_compress (int type)
{
  int D.18048;
  int D.18051;
  unsigned int i.44;
  int i;

  i = 0;
  goto <D.16737>;
  <D.16736>:
  D.18048 = simple_type_to_type[i];
  if (D.18048 == type) goto <D.18049>; else goto <D.18050>;
  <D.18049>:
  D.18051 = i;
  return D.18051;
  <D.18050>:
  i = i + 1;
  <D.16737>:
  i.44 = (unsigned int) i;
  if (i.44 <= 27) goto <D.16736>; else goto <D.16738>;
  <D.16738>:
  D.18051 = 2;
  return D.18051;
}


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

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

    scat = find_custom_category (category);
    if (scat == 0B) goto <D.18056>; else goto <D.18057>;
    <D.18056>:
    D.18058 = 0;
    return D.18058;
    <D.18057>:
    D.18059 = find_custom_instance (scat, instance);
    if (D.18059 != 0B) goto <D.18060>; else goto <D.18061>;
    <D.18060>:
    D.18058 = 1;
    return D.18058;
    <D.18061>:
  }
  goto <D.18062>;
  <D.18055>:
  <D.18062>:
  D.18058 = 0;
  return D.18058;
}


mono_perfcounter_category_names (struct MonoString * machine)
{
  int D.18064;
  struct MonoArray * D.18067;
  struct MonoClass * D.18068;
  _Bool D.18071;
  long int D.18072;
  long int D.18073;
  unsigned int D.18076;
  unsigned int D.18077;
  long unsigned int D.18078;
  struct MonoClass * D.18079;
  long unsigned int D.18080;
  const char * D.18081;
  struct MonoString * D.18082;
  char[1] * D.18083;
  struct MonoString * D.18084;
  _Bool D.18087;
  long int D.18088;
  long int D.18089;
  int i;
  struct MonoArray * res;
  struct MonoDomain * domain;
  struct GSList * custom_categories;
  struct GSList * tmp;

  domain = mono_domain_get ();
  D.18064 = mono_string_compare_ascii (machine, ".");
  if (D.18064 != 0) goto <D.18065>; else goto <D.18066>;
  <D.18065>:
  D.18068 = mono_get_string_class ();
  D.18067 = mono_array_new (domain, D.18068, 0);
  return D.18067;
  <D.18066>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18069>; else goto <D.18070>;
    <D.18069>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18070>:
    D.18071 = ret != 0;
    D.18072 = (long int) D.18071;
    D.18073 = __builtin_expect (D.18072, 0);
    if (D.18073 != 0) goto <D.18074>; else goto <D.18075>;
    <D.18074>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1497, "ret == 0");
    <D.18075>:
  }
  custom_categories = get_custom_categories ();
  D.18076 = monoeg_g_slist_length (custom_categories);
  D.18077 = D.18076 + 14;
  D.18078 = (long unsigned int) D.18077;
  D.18079 = mono_get_string_class ();
  res = mono_array_new (domain, D.18079, D.18078);
  i = 0;
  goto <D.17178>;
  <D.17177>:
  {
    const struct CategoryDesc * cdesc;

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

      D.18080 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18080);
      D.18081 = cdesc->name;
      D.18082 = mono_string_new (domain, D.18081);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18082);
    }
  }
  i = i + 1;
  <D.17178>:
  if (i <= 13) goto <D.17177>; else goto <D.17179>;
  <D.17179>:
  tmp = custom_categories;
  goto <D.17183>;
  <D.17182>:
  {
    struct SharedCategory * scat;

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

      D.18080 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18080);
      D.18083 = &scat->name;
      D.18084 = mono_string_new (domain, D.18083);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18084);
    }
    i = i + 1;
  }
  tmp = tmp->next;
  <D.17183>:
  if (tmp != 0B) goto <D.17182>; else goto <D.17184>;
  <D.17184>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18085>; else goto <D.18086>;
    <D.18085>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18086>:
    D.18087 = ret != 0;
    D.18088 = (long int) D.18087;
    D.18089 = __builtin_expect (D.18088, 0);
    if (D.18089 != 0) goto <D.18090>; else goto <D.18091>;
    <D.18090>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1509, "ret == 0");
    <D.18091>:
  }
  monoeg_g_slist_free (custom_categories);
  D.18067 = res;
  return D.18067;
}


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

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


category_collect (struct SharedHeader * header, void * data)
{
  unsigned char D.18096;
  struct GSList * D.18099;
  struct GSList * D.18100;
  gboolean D.18101;
  struct GSList * * list;

  list = data;
  D.18096 = header->ftype;
  if (D.18096 == 67) goto <D.18097>; else goto <D.18098>;
  <D.18097>:
  D.18099 = *list;
  D.18100 = monoeg_g_slist_prepend (D.18099, header);
  *list = D.18100;
  <D.18098>:
  D.18101 = 1;
  return D.18101;
}


mono_perfcounter_counter_names (struct MonoString * category, struct MonoString * machine)
{
  int D.18103;
  struct MonoArray * D.18106;
  struct MonoClass * D.18107;
  const struct CategoryDesc * D.18110;
  short int D.18111;
  int D.18112;
  short int D.18113;
  int D.18114;
  int D.18115;
  long unsigned int D.18116;
  struct MonoClass * D.18117;
  int D.18118;
  long unsigned int D.18119;
  const char * D.18120;
  struct MonoString * D.18121;
  _Bool D.18124;
  long int D.18125;
  long int D.18126;
  short unsigned int D.18131;
  long unsigned int D.18132;
  struct MonoClass * D.18133;
  long unsigned int D.18134;
  const char * D.18135;
  struct MonoString * D.18136;
  long unsigned int D.18137;
  sizetype D.18138;
  long unsigned int D.18139;
  sizetype D.18140;
  int D.18141;
  _Bool D.18144;
  long int D.18145;
  long int D.18146;
  _Bool D.18151;
  long int D.18152;
  long int D.18153;
  struct MonoClass * D.18156;
  int i;
  struct SharedCategory * scat;
  const struct CategoryDesc * cdesc;
  struct MonoArray * res;
  struct MonoDomain * domain;

  domain = mono_domain_get ();
  D.18103 = mono_string_compare_ascii (machine, ".");
  if (D.18103 != 0) goto <D.18104>; else goto <D.18105>;
  <D.18104>:
  D.18107 = mono_get_string_class ();
  D.18106 = mono_array_new (domain, D.18107, 0);
  return D.18106;
  <D.18105>:
  cdesc = find_category (category);
  if (cdesc != 0B) goto <D.18108>; else goto <D.18109>;
  <D.18108>:
  D.18110 = cdesc + 24;
  D.18111 = D.18110->first_counter;
  D.18112 = (int) D.18111;
  D.18113 = cdesc->first_counter;
  D.18114 = (int) D.18113;
  D.18115 = D.18112 - D.18114;
  D.18116 = (long unsigned int) D.18115;
  D.18117 = mono_get_string_class ();
  res = mono_array_new (domain, D.18117, D.18116);
  D.18113 = cdesc->first_counter;
  i = (int) D.18113;
  goto <D.17198>;
  <D.17197>:
  {
    const struct CounterDesc * desc;

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

      D.18113 = cdesc->first_counter;
      D.18114 = (int) D.18113;
      D.18118 = i - D.18114;
      D.18119 = (long unsigned int) D.18118;
      __p = mono_array_addr_with_size (res, 8, D.18119);
      D.18120 = desc->name;
      D.18121 = mono_string_new (domain, D.18120);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18121);
    }
  }
  i = i + 1;
  <D.17198>:
  D.18110 = cdesc + 24;
  D.18111 = D.18110->first_counter;
  D.18112 = (int) D.18111;
  if (D.18112 > i) goto <D.17197>; else goto <D.17199>;
  <D.17199>:
  D.18106 = res;
  return D.18106;
  <D.18109>:
  {
    int ret;

    ret = pthread_mutex_lock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18122>; else goto <D.18123>;
    <D.18122>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_lock result %d", ret);
    <D.18123>:
    D.18124 = ret != 0;
    D.18125 = (long int) D.18124;
    D.18126 = __builtin_expect (D.18125, 0);
    if (D.18126 != 0) goto <D.18127>; else goto <D.18128>;
    <D.18127>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1534, "ret == 0");
    <D.18128>:
  }
  scat = find_custom_category (category);
  if (scat != 0B) goto <D.18129>; else goto <D.18130>;
  <D.18129>:
  {
    char * p;
    int i;

    p = custom_category_counters (scat);
    D.18131 = scat->num_counters;
    D.18132 = (long unsigned int) D.18131;
    D.18133 = mono_get_string_class ();
    res = mono_array_new (domain, D.18133, D.18132);
    i = 0;
    goto <D.17205>;
    <D.17204>:
    {
      void * * __p;

      D.18134 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18134);
      D.18135 = p + 1;
      D.18136 = mono_string_new (domain, D.18135);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18136);
    }
    D.18135 = p + 1;
    D.18137 = strlen (D.18135);
    D.18138 = D.18137 + 2;
    p = p + D.18138;
    D.18139 = strlen (p);
    D.18140 = D.18139 + 1;
    p = p + D.18140;
    i = i + 1;
    <D.17205>:
    D.18131 = scat->num_counters;
    D.18141 = (int) D.18131;
    if (D.18141 > i) goto <D.17204>; else goto <D.17206>;
    <D.17206>:
    {
      int ret;

      ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
      if (ret != 0) goto <D.18142>; else goto <D.18143>;
      <D.18142>:
      monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
      <D.18143>:
      D.18144 = ret != 0;
      D.18145 = (long int) D.18144;
      D.18146 = __builtin_expect (D.18145, 0);
      if (D.18146 != 0) goto <D.18147>; else goto <D.18148>;
      <D.18147>:
      monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1545, "ret == 0");
      <D.18148>:
    }
    D.18106 = res;
    return D.18106;
  }
  <D.18130>:
  {
    int ret;

    ret = pthread_mutex_unlock (&perfctr_mutex.mutex);
    if (ret != 0) goto <D.18149>; else goto <D.18150>;
    <D.18149>:
    monoeg_g_log (0B, 16, "Bad call to mono_mutex_unlock result %d", ret);
    <D.18150>:
    D.18151 = ret != 0;
    D.18152 = (long int) D.18151;
    D.18153 = __builtin_expect (D.18152, 0);
    if (D.18153 != 0) goto <D.18154>; else goto <D.18155>;
    <D.18154>:
    monoeg_assertion_message ("* Assertion at %s:%d, condition `%s\' not met\n", "mono-perfcounters.c", 1548, "ret == 0");
    <D.18155>:
  }
  D.18156 = mono_get_string_class ();
  D.18106 = mono_array_new (domain, D.18156, 0);
  return D.18106;
}


mono_perfcounter_instance_names (struct MonoString * category, struct MonoString * machine)
{
  int D.18158;
  struct MonoArray * D.18161;
  struct MonoClass * D.18162;
  struct MonoDomain * D.18163;
  <unnamed-unsigned:6> D.18166;
  int D.18167;
  struct MonoClass * D.18168;
  struct MonoDomain * D.18169;
  const struct CategoryDesc * cat;

  D.18158 = mono_string_compare_ascii (machine, ".");
  if (D.18158 != 0) goto <D.18159>; else goto <D.18160>;
  <D.18159>:
  D.18162 = mono_get_string_class ();
  D.18163 = mono_domain_get ();
  D.18161 = mono_array_new (D.18163, D.18162, 0);
  return D.18161;
  <D.18160>:
  cat = find_category (category);
  if (cat == 0B) goto <D.18164>; else goto <D.18165>;
  <D.18164>:
  D.18161 = get_custom_instances (category);
  return D.18161;
  <D.18165>:
  D.18166 = cat->instance_type;
  D.18167 = (int) D.18166;
  switch (D.18167) <default: <D.17291>, case 0: <D.17288>, case 1: <D.17290>, case 2: <D.17287>, case 3: <D.17286>, case 4: <D.17289>>
  <D.17286>:
  D.18161 = get_mono_instances ();
  return D.18161;
  <D.17287>:
  D.18161 = get_cpu_instances ();
  return D.18161;
  <D.17288>:
  D.18161 = get_processes_instances ();
  return D.18161;
  <D.17289>:
  D.18161 = get_networkinterface_instances ();
  return D.18161;
  <D.17290>:
  <D.17291>:
  D.18168 = mono_get_string_class ();
  D.18169 = mono_domain_get ();
  D.18161 = mono_array_new (D.18169, D.18168, 0);
  return D.18161;
}


get_custom_instances (struct MonoString * category)
{
  unsigned int D.18173;
  long unsigned int D.18174;
  struct MonoClass * D.18175;
  struct MonoDomain * D.18176;
  long unsigned int D.18177;
  char[1] * D.18178;
  struct MonoDomain * D.18179;
  struct MonoString * D.18180;
  struct MonoArray * D.18181;
  struct MonoClass * D.18182;
  struct MonoDomain * D.18183;
  struct SharedCategory * scat;

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

    list = get_custom_instances_list (scat);
    i = 0;
    D.18173 = monoeg_g_slist_length (list);
    D.18174 = (long unsigned int) D.18173;
    D.18175 = mono_get_string_class ();
    D.18176 = mono_domain_get ();
    array = mono_array_new (D.18176, D.18175, D.18174);
    tmp = list;
    goto <D.17279>;
    <D.17278>:
    {
      struct SharedInstance * inst;

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

        D.18177 = (long unsigned int) i;
        __p = mono_array_addr_with_size (array, 8, D.18177);
        D.18178 = &inst->instance_name;
        D.18179 = mono_domain_get ();
        D.18180 = mono_string_new (D.18179, D.18178);
        mono_gc_wbarrier_set_arrayref (array, __p, D.18180);
      }
      i = i + 1;
    }
    tmp = tmp->next;
    <D.17279>:
    if (tmp != 0B) goto <D.17278>; else goto <D.17280>;
    <D.17280>:
    monoeg_g_slist_free (list);
    D.18181 = array;
    return D.18181;
  }
  <D.18172>:
  D.18182 = mono_get_string_class ();
  D.18183 = mono_domain_get ();
  D.18181 = mono_array_new (D.18183, D.18182, 0);
  return D.18181;
}


get_custom_instances_list (struct SharedCategory * cat)
{
  long int cat.45;
  struct MonoSharedArea * shared_area.46;
  long int shared_area.47;
  long int D.18188;
  unsigned int D.18189;
  struct GSList * D.18190;
  struct InstanceSearch search;

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


get_mono_instances ()
{
  long unsigned int D.18193;
  long unsigned int D.18194;
  struct MonoArray * D.18195;
  int count;
  int res;
  void * * buf;
  struct MonoArray * array;

  count = 64;
  buf = 0B;
  <D.17243>:
  count = count * 2;
  monoeg_g_free (buf);
  D.18193 = (long unsigned int) count;
  D.18194 = D.18193 * 8;
  buf = monoeg_malloc (D.18194);
  res = mono_shared_area_instances (buf, count);
  if (res == count) goto <D.17243>; else goto <D.17244>;
  <D.17244>:
  array = get_string_array (buf, res, 1);
  monoeg_g_free (buf);
  D.18195 = array;
  return D.18195;
}


get_string_array (void * * array, int count, gboolean is_process)
{
  long unsigned int D.18197;
  struct MonoClass * D.18198;
  struct MonoDomain * D.18199;
  long unsigned int D.18202;
  long unsigned int D.18203;
  void * * D.18204;
  void * D.18205;
  long int D.18206;
  int D.18207;
  long unsigned int D.18209;
  struct MonoString * D.18210;
  struct MonoArray * D.18213;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.18197 = (long unsigned int) count;
  D.18198 = mono_get_string_class ();
  D.18199 = mono_domain_get ();
  res = mono_array_new (D.18199, D.18198, D.18197);
  i = 0;
  goto <D.17222>;
  <D.17221>:
  {
    char buf[128];
    char * p;

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

          D.18202 = (long unsigned int) i;
          D.18203 = D.18202 * 8;
          D.18204 = array + D.18203;
          D.18205 = *D.18204;
          pname = mono_process_get_name (D.18205, &buf, 128);
          D.18202 = (long unsigned int) i;
          D.18203 = D.18202 * 8;
          D.18204 = array + D.18203;
          D.18205 = *D.18204;
          D.18206 = (long int) D.18205;
          D.18207 = (int) D.18206;
          p = monoeg_g_strdup_printf ("%d/%s", D.18207, pname);
        }
        goto <D.18208>;
        <D.18201>:
        D.18202 = (long unsigned int) i;
        D.18203 = D.18202 * 8;
        D.18204 = array + D.18203;
        D.18205 = *D.18204;
        D.18206 = (long int) D.18205;
        D.18207 = (int) D.18206;
        sprintf (&buf, "%d", D.18207);
        p = &buf;
        <D.18208>:
        {
          void * * __p;

          D.18209 = (long unsigned int) i;
          __p = mono_array_addr_with_size (res, 8, D.18209);
          D.18210 = mono_string_new (domain, p);
          mono_gc_wbarrier_set_arrayref (res, __p, D.18210);
        }
        if (&buf != p) goto <D.18211>; else goto <D.18212>;
        <D.18211>:
        monoeg_g_free (p);
        <D.18212>:
      }
    finally
      {
        buf = {CLOBBER};
      }
  }
  i = i + 1;
  <D.17222>:
  if (i < count) goto <D.17221>; else goto <D.17223>;
  <D.17223>:
  D.18213 = res;
  return D.18213;
}


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

  D.18216 = __builtin_object_size (__s, 1);
  D.18215 = __builtin___sprintf_chk (__s, 1, D.18216, __fmt, __builtin_va_arg_pack ());
  return D.18215;
}


get_cpu_instances ()
{
  int D.18218;
  long unsigned int D.18219;
  long unsigned int D.18220;
  long unsigned int D.18221;
  long unsigned int D.18222;
  void * * D.18223;
  int D.18224;
  long int D.18225;
  void * D.18226;
  struct MonoDomain * D.18227;
  struct MonoString * D.18228;
  struct MonoArray * D.18229;
  void * * buf;
  int i;
  int count;
  struct MonoArray * array;

  buf = 0B;
  D.18218 = mono_cpu_count ();
  count = D.18218 + 1;
  D.18219 = (long unsigned int) count;
  D.18220 = D.18219 * 8;
  buf = monoeg_malloc (D.18220);
  i = 0;
  goto <D.17253>;
  <D.17252>:
  D.18221 = (long unsigned int) i;
  D.18222 = D.18221 * 8;
  D.18223 = buf + D.18222;
  D.18224 = i + -1;
  D.18225 = (long int) D.18224;
  D.18226 = (void *) D.18225;
  *D.18223 = D.18226;
  i = i + 1;
  <D.17253>:
  if (i < count) goto <D.17252>; else goto <D.17254>;
  <D.17254>:
  array = get_string_array (buf, count, 0);
  monoeg_g_free (buf);
  {
    void * * __p;

    __p = mono_array_addr_with_size (array, 8, 0);
    D.18227 = mono_domain_get ();
    D.18228 = mono_string_new (D.18227, "_Total");
    mono_gc_wbarrier_set_arrayref (array, __p, D.18228);
  }
  D.18229 = array;
  return D.18229;
}


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

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


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

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


get_string_array_of_strings (void * * array, int count)
{
  long unsigned int D.18243;
  struct MonoClass * D.18244;
  struct MonoDomain * D.18245;
  long unsigned int D.18246;
  long unsigned int D.18247;
  void * * D.18248;
  long unsigned int D.18249;
  struct MonoString * D.18250;
  struct MonoArray * D.18251;
  int i;
  struct MonoDomain * domain;
  struct MonoArray * res;

  domain = mono_domain_get ();
  D.18243 = (long unsigned int) count;
  D.18244 = mono_get_string_class ();
  D.18245 = mono_domain_get ();
  res = mono_array_new (D.18245, D.18244, D.18243);
  i = 0;
  goto <D.17234>;
  <D.17233>:
  {
    char * p;

    D.18246 = (long unsigned int) i;
    D.18247 = D.18246 * 8;
    D.18248 = array + D.18247;
    p = *D.18248;
    {
      void * * __p;

      D.18249 = (long unsigned int) i;
      __p = mono_array_addr_with_size (res, 8, D.18249);
      D.18250 = mono_string_new (domain, p);
      mono_gc_wbarrier_set_arrayref (res, __p, D.18250);
    }
  }
  i = i + 1;
  <D.17234>:
  if (i < count) goto <D.17233>; else goto <D.17235>;
  <D.17235>:
  D.18251 = res;
  return D.18251;
}


