mono_process_list (int * size)
{
  void * * D.8528;
  char * nend.0;
  char D.8534;
  unsigned int count.1;
  unsigned int D.8541;
  int i.2;
  unsigned int i.3;
  unsigned int D.8544;
  void * * D.8545;
  void * pid.4;
  const char * name;
  void * * buf;
  int count;
  int i;
  struct GDir * dir;

  buf = 0B;
  count = 0;
  i = 0;
  dir = monoeg_g_dir_open ("/proc/", 0, 0B);
  if (dir == 0B) goto <D.8524>; else goto <D.8525>;
  <D.8524>:
  if (size != 0B) goto <D.8526>; else goto <D.8527>;
  <D.8526>:
  *size = 0;
  <D.8527>:
  D.8528 = 0B;
  return D.8528;
  <D.8525>:
  goto <D.8347>;
  <D.8348>:
  {
    int pid;
    char * nend;

    try
      {
        pid = strtol (name, &nend, 10);
        if (pid <= 0) goto <D.8529>; else goto <D.8531>;
        <D.8531>:
        nend.0 = nend;
        if (nend.0 == name) goto <D.8529>; else goto <D.8533>;
        <D.8533>:
        nend.0 = nend;
        D.8534 = *nend.0;
        if (D.8534 != 0) goto <D.8529>; else goto <D.8530>;
        <D.8529>:
        // predicted unlikely by continue predictor.
        goto <D.8347>;
        <D.8530>:
        if (i >= count) goto <D.8535>; else goto <D.8536>;
        <D.8535>:
        if (count == 0) goto <D.8537>; else goto <D.8538>;
        <D.8537>:
        count = 16;
        goto <D.8539>;
        <D.8538>:
        count = count * 2;
        <D.8539>:
        count.1 = (unsigned int) count;
        D.8541 = count.1 * 4;
        buf = monoeg_realloc (buf, D.8541);
        <D.8536>:
        i.2 = i;
        i = i.2 + 1;
        i.3 = (unsigned int) i.2;
        D.8544 = i.3 * 4;
        D.8545 = buf + D.8544;
        pid.4 = (void *) pid;
        *D.8545 = pid.4;
      }
    finally
      {
        nend = {CLOBBER};
      }
  }
  <D.8347>:
  name = monoeg_g_dir_read_name (dir);
  if (name != 0B) goto <D.8348>; else goto <D.8349>;
  <D.8349>:
  monoeg_g_dir_close (dir);
  if (size != 0B) goto <D.8547>; else goto <D.8548>;
  <D.8547>:
  *size = i;
  <D.8548>:
  D.8528 = buf;
  return D.8528;
}


mono_process_get_name (void * pid, char * buf, int len)
{
  int pid.5;
  char * D.8555;
  int D.8556;
  unsigned int D.8557;
  unsigned int D.8558;
  sizetype r.6;
  char * D.8560;
  char fname[128];
  struct FILE * file;
  char * p;
  int r;

  try
    {
      pid.5 = (int) pid;
      sprintf (&fname, "/proc/%d/cmdline", pid.5);
      *buf = 0;
      file = fopen (&fname, "r");
      if (file == 0B) goto <D.8553>; else goto <D.8554>;
      <D.8553>:
      D.8555 = buf;
      return D.8555;
      <D.8554>:
      D.8556 = len + -1;
      D.8557 = (unsigned int) D.8556;
      D.8558 = fread (buf, 1, D.8557, file);
      r = (int) D.8558;
      fclose (file);
      r.6 = (sizetype) r;
      D.8560 = buf + r.6;
      *D.8560 = 0;
      p = strrchr (buf, 47);
      if (p != 0B) goto <D.8561>; else goto <D.8562>;
      <D.8561>:
      D.8555 = p + 1;
      return D.8555;
      <D.8562>:
      if (r == 0) goto <D.8563>; else goto <D.8564>;
      <D.8563>:
      pid.5 = (int) pid;
      D.8555 = get_pid_status_item_buf (pid.5, "Name", buf, len, 0B);
      return D.8555;
      <D.8564>:
      D.8555 = buf;
      return D.8555;
    }
  finally
    {
      fname = {CLOBBER};
    }
}


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

  D.8568 = __builtin_object_size (__s, 1);
  D.8567 = __builtin___sprintf_chk (__s, 1, D.8568, __fmt, __builtin_va_arg_pack ());
  return D.8567;
}


fread (void * restrict __ptr, size_t __size, size_t __n, struct FILE * restrict __stream)
{
  unsigned int D.8570;
  int D.8575;
  int D.8577;
  unsigned int D.8579;
  size_t D.8580;
  unsigned int D.8581;
  unsigned int D.8582;
  unsigned int D.8583;
  unsigned int D.8586;

  D.8570 = __builtin_object_size (__ptr, 0);
  if (D.8570 != 4294967295) goto <D.8571>; else goto <D.8572>;
  <D.8571>:
  D.8575 = __builtin_constant_p (__size);
  if (D.8575 == 0) goto <D.8573>; else goto <D.8576>;
  <D.8576>:
  D.8577 = __builtin_constant_p (__n);
  if (D.8577 == 0) goto <D.8573>; else goto <D.8578>;
  <D.8578>:
  D.8579 = __size | __n;
  if (D.8579 > 65535) goto <D.8573>; else goto <D.8574>;
  <D.8573>:
  D.8581 = __builtin_object_size (__ptr, 0);
  D.8580 = __fread_chk (__ptr, D.8581, __size, __n, __stream);
  return D.8580;
  <D.8574>:
  D.8582 = __size * __n;
  D.8583 = __builtin_object_size (__ptr, 0);
  if (D.8582 > D.8583) goto <D.8584>; else goto <D.8585>;
  <D.8584>:
  D.8586 = __builtin_object_size (__ptr, 0);
  D.8580 = __fread_chk_warn (__ptr, D.8586, __size, __n, __stream);
  return D.8580;
  <D.8585>:
  <D.8572>:
  D.8580 = __fread_alias (__ptr, __size, __n, __stream);
  return D.8580;
}


get_pid_status_item_buf (int pid, const char * item, char * rbuf, int blen, MonoProcessError * error)
{
  unsigned int D.8588;
  char * D.8593;
  char D.8594;
  char D.8595;
  unsigned int len.7;
  int D.8599;
  sizetype len.8;
  const short unsigned int * * D.8603;
  const short unsigned int * D.8604;
  char D.8605;
  unsigned int D.8606;
  unsigned int D.8607;
  const short unsigned int * D.8608;
  short unsigned int D.8609;
  int D.8610;
  int D.8611;
  char * s.9;
  char D.8613;
  unsigned int D.8616;
  int D.8617;
  unsigned int D.8618;
  sizetype iftmp.10;
  sizetype blen.11;
  char * D.8624;
  char buf[256];
  char * s;
  struct FILE * f;
  int len;

  try
    {
      D.8588 = strlen (item);
      len = (int) D.8588;
      monoeg_g_snprintf (&buf, 256, "/proc/%d/status", pid);
      f = fopen (&buf, "r");
      if (f == 0B) goto <D.8589>; else goto <D.8590>;
      <D.8589>:
      if (error != 0B) goto <D.8591>; else goto <D.8592>;
      <D.8591>:
      *error = 1;
      <D.8592>:
      D.8593 = 0B;
      return D.8593;
      <D.8590>:
      goto <D.8361>;
      <D.8377>:
      D.8594 = *item;
      D.8595 = buf[0];
      if (D.8594 != D.8595) goto <D.8596>; else goto <D.8597>;
      <D.8596>:
      // predicted unlikely by continue predictor.
      goto <D.8361>;
      <D.8597>:
      len.7 = (unsigned int) len;
      D.8599 = strncmp (&buf, item, len.7);
      if (D.8599 != 0) goto <D.8600>; else goto <D.8601>;
      <D.8600>:
      // predicted unlikely by continue predictor.
      goto <D.8361>;
      <D.8601>:
      len.8 = (sizetype) len;
      s = &buf + len.8;
      goto <D.8372>;
      <D.8371>:
      s = s + 1;
      <D.8372>:
      D.8603 = __ctype_b_loc ();
      D.8604 = *D.8603;
      D.8605 = *s;
      D.8606 = (unsigned int) D.8605;
      D.8607 = D.8606 * 2;
      D.8608 = D.8604 + D.8607;
      D.8609 = *D.8608;
      D.8610 = (int) D.8609;
      D.8611 = D.8610 & 8192;
      if (D.8611 != 0) goto <D.8371>; else goto <D.8373>;
      <D.8373>:
      s.9 = s;
      s = s.9 + 1;
      D.8613 = *s.9;
      if (D.8613 != 58) goto <D.8614>; else goto <D.8615>;
      <D.8614>:
      // predicted unlikely by continue predictor.
      goto <D.8361>;
      <D.8615>:
      goto <D.8375>;
      <D.8374>:
      s = s + 1;
      <D.8375>:
      D.8603 = __ctype_b_loc ();
      D.8604 = *D.8603;
      D.8605 = *s;
      D.8606 = (unsigned int) D.8605;
      D.8607 = D.8606 * 2;
      D.8608 = D.8604 + D.8607;
      D.8609 = *D.8608;
      D.8610 = (int) D.8609;
      D.8611 = D.8610 & 8192;
      if (D.8611 != 0) goto <D.8374>; else goto <D.8376>;
      <D.8376>:
      fclose (f);
      D.8616 = strlen (s);
      len = (int) D.8616;
      D.8617 = MIN_EXPR <blen, len>;
      D.8618 = (unsigned int) D.8617;
      strncpy (rbuf, s, D.8618);
      if (len < blen) goto <D.8620>; else goto <D.8621>;
      <D.8620>:
      len.8 = (sizetype) len;
      iftmp.10 = len.8 + 4294967295;
      goto <D.8622>;
      <D.8621>:
      blen.11 = (sizetype) blen;
      iftmp.10 = blen.11 + 4294967295;
      <D.8622>:
      D.8624 = rbuf + iftmp.10;
      *D.8624 = 0;
      if (error != 0B) goto <D.8625>; else goto <D.8626>;
      <D.8625>:
      *error = 0;
      <D.8626>:
      D.8593 = rbuf;
      return D.8593;
      <D.8361>:
      s = fgets (&buf, blen, f);
      if (s != 0B) goto <D.8377>; else goto <D.8378>;
      <D.8378>:
      fclose (f);
      if (error != 0B) goto <D.8627>; else goto <D.8628>;
      <D.8627>:
      *error = 2;
      <D.8628>:
      D.8593 = 0B;
      return D.8593;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


strncpy (char * restrict __dest, const char * restrict __src, size_t __len)
{
  char * D.8631;
  unsigned int D.8632;

  D.8632 = __builtin_object_size (__dest, 1);
  D.8631 = __builtin___strncpy_chk (__dest, __src, __len, D.8632);
  return D.8631;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  unsigned int D.8634;
  int D.8639;
  char * D.8641;
  unsigned int D.8642;
  unsigned int __n.12;
  unsigned int D.8644;
  unsigned int D.8647;

  D.8634 = __builtin_object_size (__s, 1);
  if (D.8634 != 4294967295) goto <D.8635>; else goto <D.8636>;
  <D.8635>:
  D.8639 = __builtin_constant_p (__n);
  if (D.8639 == 0) goto <D.8637>; else goto <D.8640>;
  <D.8640>:
  if (__n <= 0) goto <D.8637>; else goto <D.8638>;
  <D.8637>:
  D.8642 = __builtin_object_size (__s, 1);
  D.8641 = __fgets_chk (__s, D.8642, __n, __stream);
  return D.8641;
  <D.8638>:
  __n.12 = (unsigned int) __n;
  D.8644 = __builtin_object_size (__s, 1);
  if (__n.12 > D.8644) goto <D.8645>; else goto <D.8646>;
  <D.8645>:
  D.8647 = __builtin_object_size (__s, 1);
  D.8641 = __fgets_chk_warn (__s, D.8647, __n, __stream);
  return D.8641;
  <D.8646>:
  <D.8636>:
  D.8641 = __fgets_alias (__s, __n, __stream);
  return D.8641;
}


mono_process_get_data_with_error (void * pid, MonoProcessData data, MonoProcessError * error)
{
  gint64 D.8651;
  long long int D.8656;
  int D.8657;
  long long int D.8658;
  gint64 val;
  int rpid;

  rpid = (int) pid;
  if (error != 0B) goto <D.8649>; else goto <D.8650>;
  <D.8649>:
  *error = 2;
  <D.8650>:
  switch (data) <default: <D.8659>, case 0: <D.8445>, case 1: <D.8446>, case 2: <D.8447>, case 3: <D.8448>, case 4: <D.8449>, case 5: <D.8450>, case 6: <D.8451>, case 7: <D.8452>, case 8: <D.8453>, case 9: <D.8454>, case 10: <D.8455>, case 11: <D.8456>, case 12: <D.8457>>
  <D.8445>:
  D.8651 = get_pid_status_item (rpid, "Threads", error, 1);
  return D.8651;
  <D.8446>:
  D.8651 = get_process_stat_time (rpid, 10, 0, error);
  return D.8651;
  <D.8447>:
  D.8651 = get_process_stat_time (rpid, 11, 0, error);
  return D.8651;
  <D.8448>:
  D.8651 = get_process_stat_time (rpid, 10, 1, error);
  return D.8651;
  <D.8449>:
  D.8651 = get_pid_status_item (rpid, "VmRSS", error, 1024);
  return D.8651;
  <D.8450>:
  val = get_pid_status_item (rpid, "VmHWM", error, 1024);
  if (val == 0) goto <D.8652>; else goto <D.8653>;
  <D.8652>:
  val = get_pid_status_item (rpid, "VmRSS", error, 1024);
  <D.8653>:
  D.8651 = val;
  return D.8651;
  <D.8451>:
  D.8651 = get_pid_status_item (rpid, "VmData", error, 1024);
  return D.8651;
  <D.8452>:
  D.8651 = get_pid_status_item (rpid, "VmSize", error, 1024);
  return D.8651;
  <D.8453>:
  val = get_pid_status_item (rpid, "VmPeak", error, 1024);
  if (val == 0) goto <D.8654>; else goto <D.8655>;
  <D.8654>:
  val = get_pid_status_item (rpid, "VmSize", error, 1024);
  <D.8655>:
  D.8651 = val;
  return D.8651;
  <D.8454>:
  D.8651 = get_process_stat_item (rpid, 6, 1, error);
  return D.8651;
  <D.8455>:
  D.8656 = get_process_stat_item (rpid, 18, 0, error);
  D.8657 = get_user_hz ();
  D.8658 = (long long int) D.8657;
  D.8651 = D.8656 / D.8658;
  return D.8651;
  <D.8456>:
  D.8651 = get_process_stat_time (rpid, 0, 0, error);
  return D.8651;
  <D.8457>:
  D.8651 = 0;
  return D.8651;
  <D.8659>:
  D.8651 = 0;
  return D.8651;
}


get_pid_status_item (int pid, const char * item, MonoProcessError * error, int multiplier)
{
  gint64 D.8663;
  long int D.8664;
  long long int D.8665;
  long long int D.8666;
  char buf[64];
  char * s;

  try
    {
      s = get_pid_status_item_buf (pid, item, &buf, 64, error);
      if (s != 0B) goto <D.8661>; else goto <D.8662>;
      <D.8661>:
      D.8664 = atol (s);
      D.8665 = (long long int) D.8664;
      D.8666 = (long long int) multiplier;
      D.8663 = D.8665 * D.8666;
      return D.8663;
      <D.8662>:
      D.8663 = 0;
      return D.8663;
    }
  finally
    {
      buf = {CLOBBER};
    }
}


atol (const char * __nptr)
{
  long int D.8669;

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


get_process_stat_item (int pid, int pos, int sum, MonoProcessError * error)
{
  gint64 D.8675;
  unsigned int D.8676;
  const short unsigned int * * D.8685;
  const short unsigned int * D.8686;
  char D.8687;
  unsigned int D.8688;
  unsigned int D.8689;
  const short unsigned int * D.8690;
  short unsigned int D.8691;
  int D.8692;
  int D.8693;
  long unsigned int D.8712;
  long unsigned int D.8719;
  long long int D.8720;
  char buf[512];
  char * s;
  char * end;
  struct FILE * f;
  int len;
  int i;
  gint64 value;

  try
    {
      monoeg_g_snprintf (&buf, 512, "/proc/%d/stat", pid);
      f = fopen (&buf, "r");
      if (f == 0B) goto <D.8671>; else goto <D.8672>;
      <D.8671>:
      if (error != 0B) goto <D.8673>; else goto <D.8674>;
      <D.8673>:
      *error = 1;
      <D.8674>:
      D.8675 = 0;
      return D.8675;
      <D.8672>:
      D.8676 = fread (&buf, 1, 512, f);
      len = (int) D.8676;
      fclose (f);
      if (len <= 0) goto <D.8677>; else goto <D.8678>;
      <D.8677>:
      if (error != 0B) goto <D.8679>; else goto <D.8680>;
      <D.8679>:
      *error = 2;
      <D.8680>:
      D.8675 = 0;
      return D.8675;
      <D.8678>:
      s = __builtin_strchr (&buf, 41);
      if (s == 0B) goto <D.8681>; else goto <D.8682>;
      <D.8681>:
      if (error != 0B) goto <D.8683>; else goto <D.8684>;
      <D.8683>:
      *error = 2;
      <D.8684>:
      D.8675 = 0;
      return D.8675;
      <D.8682>:
      s = s + 1;
      goto <D.8402>;
      <D.8401>:
      s = s + 1;
      <D.8402>:
      D.8685 = __ctype_b_loc ();
      D.8686 = *D.8685;
      D.8687 = *s;
      D.8688 = (unsigned int) D.8687;
      D.8689 = D.8688 * 2;
      D.8690 = D.8686 + D.8689;
      D.8691 = *D.8690;
      D.8692 = (int) D.8691;
      D.8693 = D.8692 & 8192;
      if (D.8693 != 0) goto <D.8401>; else goto <D.8403>;
      <D.8403>:
      D.8687 = *s;
      if (D.8687 == 0) goto <D.8694>; else goto <D.8695>;
      <D.8694>:
      if (error != 0B) goto <D.8696>; else goto <D.8697>;
      <D.8696>:
      *error = 2;
      <D.8697>:
      D.8675 = 0;
      return D.8675;
      <D.8695>:
      goto <D.8405>;
      <D.8404>:
      s = s + 1;
      <D.8405>:
      D.8687 = *s;
      if (D.8687 != 0) goto <D.8698>; else goto <D.8406>;
      <D.8698>:
      D.8685 = __ctype_b_loc ();
      D.8686 = *D.8685;
      D.8687 = *s;
      D.8688 = (unsigned int) D.8687;
      D.8689 = D.8688 * 2;
      D.8690 = D.8686 + D.8689;
      D.8691 = *D.8690;
      D.8692 = (int) D.8691;
      D.8693 = D.8692 & 8192;
      if (D.8693 == 0) goto <D.8404>; else goto <D.8406>;
      <D.8406>:
      D.8687 = *s;
      if (D.8687 == 0) goto <D.8699>; else goto <D.8700>;
      <D.8699>:
      if (error != 0B) goto <D.8701>; else goto <D.8702>;
      <D.8701>:
      *error = 2;
      <D.8702>:
      D.8675 = 0;
      return D.8675;
      <D.8700>:
      i = 0;
      goto <D.8414>;
      <D.8413>:
      goto <D.8408>;
      <D.8407>:
      s = s + 1;
      <D.8408>:
      D.8685 = __ctype_b_loc ();
      D.8686 = *D.8685;
      D.8687 = *s;
      D.8688 = (unsigned int) D.8687;
      D.8689 = D.8688 * 2;
      D.8690 = D.8686 + D.8689;
      D.8691 = *D.8690;
      D.8692 = (int) D.8691;
      D.8693 = D.8692 & 8192;
      if (D.8693 != 0) goto <D.8407>; else goto <D.8409>;
      <D.8409>:
      D.8687 = *s;
      if (D.8687 == 0) goto <D.8703>; else goto <D.8704>;
      <D.8703>:
      if (error != 0B) goto <D.8705>; else goto <D.8706>;
      <D.8705>:
      *error = 2;
      <D.8706>:
      D.8675 = 0;
      return D.8675;
      <D.8704>:
      goto <D.8411>;
      <D.8410>:
      s = s + 1;
      <D.8411>:
      D.8687 = *s;
      if (D.8687 != 0) goto <D.8707>; else goto <D.8412>;
      <D.8707>:
      D.8685 = __ctype_b_loc ();
      D.8686 = *D.8685;
      D.8687 = *s;
      D.8688 = (unsigned int) D.8687;
      D.8689 = D.8688 * 2;
      D.8690 = D.8686 + D.8689;
      D.8691 = *D.8690;
      D.8692 = (int) D.8691;
      D.8693 = D.8692 & 8192;
      if (D.8693 == 0) goto <D.8410>; else goto <D.8412>;
      <D.8412>:
      D.8687 = *s;
      if (D.8687 == 0) goto <D.8708>; else goto <D.8709>;
      <D.8708>:
      if (error != 0B) goto <D.8710>; else goto <D.8711>;
      <D.8710>:
      *error = 2;
      <D.8711>:
      D.8675 = 0;
      return D.8675;
      <D.8709>:
      i = i + 1;
      <D.8414>:
      if (i < pos) goto <D.8413>; else goto <D.8415>;
      <D.8415>:
      D.8712 = strtoul (s, &end, 0);
      value = (gint64) D.8712;
      if (sum != 0) goto <D.8713>; else goto <D.8714>;
      <D.8713>:
      goto <D.8417>;
      <D.8416>:
      s = s + 1;
      <D.8417>:
      D.8685 = __ctype_b_loc ();
      D.8686 = *D.8685;
      D.8687 = *s;
      D.8688 = (unsigned int) D.8687;
      D.8689 = D.8688 * 2;
      D.8690 = D.8686 + D.8689;
      D.8691 = *D.8690;
      D.8692 = (int) D.8691;
      D.8693 = D.8692 & 8192;
      if (D.8693 != 0) goto <D.8416>; else goto <D.8418>;
      <D.8418>:
      D.8687 = *s;
      if (D.8687 == 0) goto <D.8715>; else goto <D.8716>;
      <D.8715>:
      if (error != 0B) goto <D.8717>; else goto <D.8718>;
      <D.8717>:
      *error = 2;
      <D.8718>:
      D.8675 = 0;
      return D.8675;
      <D.8716>:
      D.8719 = strtoul (s, &end, 0);
      D.8720 = (long long int) D.8719;
      value = D.8720 + value;
      <D.8714>:
      if (error != 0B) goto <D.8721>; else goto <D.8722>;
      <D.8721>:
      *error = 0;
      <D.8722>:
      D.8675 = value;
      return D.8675;
    }
  finally
    {
      buf = {CLOBBER};
      end = {CLOBBER};
    }
}


get_user_hz ()
{
  int user_hz.13;
  long int user_hz.14;
  int D.8731;
  static int user_hz = 0;

  user_hz.13 = user_hz;
  if (user_hz.13 == 0) goto <D.8726>; else goto <D.8727>;
  <D.8726>:
  user_hz.14 = sysconf (2);
  user_hz = user_hz.14;
  user_hz.13 = user_hz;
  if (user_hz.13 == 0) goto <D.8729>; else goto <D.8730>;
  <D.8729>:
  user_hz = 100;
  <D.8730>:
  <D.8727>:
  D.8731 = user_hz;
  return D.8731;
}


get_process_stat_time (int pid, int pos, int sum, MonoProcessError * error)
{
  gint64 D.8733;
  long long int D.8734;
  int D.8735;
  long long int D.8736;
  gint64 val;

  val = get_process_stat_item (pid, pos, sum, error);
  D.8734 = val * 10000000;
  D.8735 = get_user_hz ();
  D.8736 = (long long int) D.8735;
  D.8733 = D.8734 / D.8736;
  return D.8733;
}


mono_process_get_data (void * pid, MonoProcessData data)
{
  gint64 D.8738;
  MonoProcessError error;

  try
    {
      D.8738 = mono_process_get_data_with_error (pid, data, &error);
      return D.8738;
    }
  finally
    {
      error = {CLOBBER};
    }
}


mono_cpu_count ()
{
  int D.8743;
  int count;

  count = 0;
  count = sysconf (84);
  if (count > 0) goto <D.8741>; else goto <D.8742>;
  <D.8741>:
  D.8743 = count;
  return D.8743;
  <D.8742>:
  D.8743 = 1;
  return D.8743;
}


mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError * error)
{
  gint64 D.8747;
  gint64 value;

  try
    {
      value = 0;
      if (error != 0B) goto <D.8745>; else goto <D.8746>;
      <D.8745>:
      *error = 0;
      <D.8746>:
      switch (data) <default: <D.8748>, case 0: <D.8514>, case 1: <D.8516>, case 2: <D.8517>, case 3: <D.8518>, case 4: <D.8519>, case 5: <D.8520>>
      <D.8514>:
      get_cpu_times (cpu_id, &value, 0B, 0B, 0B, 0B);
      goto <D.8515>;
      <D.8516>:
      get_cpu_times (cpu_id, 0B, &value, 0B, 0B, 0B);
      goto <D.8515>;
      <D.8517>:
      get_cpu_times (cpu_id, 0B, 0B, &value, 0B, 0B);
      goto <D.8515>;
      <D.8518>:
      get_cpu_times (cpu_id, 0B, 0B, 0B, &value, 0B);
      goto <D.8515>;
      <D.8519>:
      get_cpu_times (cpu_id, 0B, 0B, 0B, 0B, &value);
      goto <D.8515>;
      <D.8520>:
      D.8747 = 0;
      return D.8747;
      <D.8748>:
      <D.8515>:
      D.8747 = value;
      return D.8747;
    }
  finally
    {
      value = {CLOBBER};
    }
}


get_cpu_times (int cpu_id, gint64 * user, gint64 * systemt, gint64 * irq, gint64 * sirq, gint64 * idle)
{
  int D.8755;
  int D.8759;
  const short unsigned int * * D.8761;
  const short unsigned int * D.8762;
  char * D.8763;
  char D.8764;
  unsigned int D.8765;
  unsigned int D.8766;
  const short unsigned int * D.8767;
  short unsigned int D.8768;
  int D.8769;
  int D.8770;
  char * data.15;
  int D.8776;
  long int D.8778;
  char * data.16;
  char * data.17;
  long long unsigned int D.8786;
  long long unsigned int D.8787;
  long long unsigned int D.8788;
  long long unsigned int D.8789;
  long long int D.8790;
  long long unsigned int D.8793;
  long long unsigned int D.8794;
  long long int D.8795;
  long long unsigned int D.8798;
  long long unsigned int D.8799;
  long long int D.8800;
  long long unsigned int D.8803;
  long long unsigned int D.8804;
  long long int D.8805;
  long long unsigned int D.8808;
  long long unsigned int D.8809;
  long long int D.8810;
  char buf[256];
  char * s;
  int hz;
  guint64 user_ticks;
  guint64 nice_ticks;
  guint64 system_ticks;
  guint64 idle_ticks;
  guint64 iowait_ticks;
  guint64 irq_ticks;
  guint64 sirq_ticks;
  struct FILE * f;

  try
    {
      hz = get_user_hz ();
      user_ticks = 0;
      nice_ticks = 0;
      system_ticks = 0;
      idle_ticks = 0;
      irq_ticks = 0;
      sirq_ticks = 0;
      f = fopen ("/proc/stat", "r");
      if (f == 0B) goto <D.8751>; else goto <D.8752>;
      <D.8751>:
      return;
      <D.8752>:
      if (cpu_id < 0) goto <D.8753>; else goto <D.8754>;
      <D.8753>:
      D.8755 = mono_cpu_count ();
      hz = D.8755 * hz;
      <D.8754>:
      goto <D.8505>;
      <D.8507>:
      {
        char * data;

        try
          {
            data = 0B;
            if (cpu_id < 0) goto <D.8758>; else goto <D.8756>;
            <D.8758>:
            D.8759 = strncmp (s, "cpu", 3);
            if (D.8759 == 0) goto <D.8760>; else goto <D.8756>;
            <D.8760>:
            D.8761 = __ctype_b_loc ();
            D.8762 = *D.8761;
            D.8763 = s + 3;
            D.8764 = *D.8763;
            D.8765 = (unsigned int) D.8764;
            D.8766 = D.8765 * 2;
            D.8767 = D.8762 + D.8766;
            D.8768 = *D.8767;
            D.8769 = (int) D.8768;
            D.8770 = D.8769 & 8192;
            if (D.8770 != 0) goto <D.8771>; else goto <D.8756>;
            <D.8771>:
            data.15 = s + 4;
            data = data.15;
            goto <D.8757>;
            <D.8756>:
            if (cpu_id >= 0) goto <D.8775>; else goto <D.8773>;
            <D.8775>:
            D.8776 = strncmp (s, "cpu", 3);
            if (D.8776 == 0) goto <D.8777>; else goto <D.8773>;
            <D.8777>:
            D.8763 = s + 3;
            D.8778 = strtol (D.8763, &data, 10);
            if (D.8778 == cpu_id) goto <D.8779>; else goto <D.8773>;
            <D.8779>:
            D.8763 = s + 3;
            data.16 = data;
            if (D.8763 == data.16) goto <D.8781>; else goto <D.8782>;
            <D.8781>:
            // predicted unlikely by continue predictor.
            goto <D.8505>;
            <D.8782>:
            data.16 = data;
            data.17 = data.16 + 1;
            data = data.17;
            goto <D.8774>;
            <D.8773>:
            // predicted unlikely by continue predictor.
            goto <D.8505>;
            <D.8774>:
            <D.8757>:
            data.16 = data;
            user_ticks = strtoull (data.16, &data, 10);
            data.16 = data;
            nice_ticks = strtoull (data.16, &data, 10);
            data.16 = data;
            system_ticks = strtoull (data.16, &data, 10);
            data.16 = data;
            idle_ticks = strtoull (data.16, &data, 10);
            data.16 = data;
            iowait_ticks = strtoull (data.16, &data, 10);
            data.16 = data;
            irq_ticks = strtoull (data.16, &data, 10);
            data.16 = data;
            sirq_ticks = strtoull (data.16, &data, 10);
            goto <D.8506>;
          }
        finally
          {
            data = {CLOBBER};
          }
      }
      <D.8505>:
      s = fgets (&buf, 256, f);
      if (s != 0B) goto <D.8507>; else goto <D.8506>;
      <D.8506>:
      fclose (f);
      if (user != 0B) goto <D.8784>; else goto <D.8785>;
      <D.8784>:
      D.8786 = user_ticks + nice_ticks;
      D.8787 = D.8786 * 10000000;
      D.8788 = (long long unsigned int) hz;
      D.8789 = D.8787 / D.8788;
      D.8790 = (long long int) D.8789;
      *user = D.8790;
      <D.8785>:
      if (systemt != 0B) goto <D.8791>; else goto <D.8792>;
      <D.8791>:
      D.8793 = system_ticks * 10000000;
      D.8788 = (long long unsigned int) hz;
      D.8794 = D.8793 / D.8788;
      D.8795 = (long long int) D.8794;
      *systemt = D.8795;
      <D.8792>:
      if (irq != 0B) goto <D.8796>; else goto <D.8797>;
      <D.8796>:
      D.8798 = irq_ticks * 10000000;
      D.8788 = (long long unsigned int) hz;
      D.8799 = D.8798 / D.8788;
      D.8800 = (long long int) D.8799;
      *irq = D.8800;
      <D.8797>:
      if (sirq != 0B) goto <D.8801>; else goto <D.8802>;
      <D.8801>:
      D.8803 = sirq_ticks * 10000000;
      D.8788 = (long long unsigned int) hz;
      D.8804 = D.8803 / D.8788;
      D.8805 = (long long int) D.8804;
      *sirq = D.8805;
      <D.8802>:
      if (idle != 0B) goto <D.8806>; else goto <D.8807>;
      <D.8806>:
      D.8808 = idle_ticks * 10000000;
      D.8788 = (long long unsigned int) hz;
      D.8809 = D.8808 / D.8788;
      D.8810 = (long long int) D.8809;
      *idle = D.8810;
      <D.8807>:
    }
  finally
    {
      buf = {CLOBBER};
    }
}


