mono_networkinterface_list (int * size)
{
  void * * D.5507;
  char * D.5508;
  char * D.5510;
  char * ptr.0;
  int D.5514;
  long unsigned int D.5521;
  long unsigned int D.5522;
  int i.1;
  long unsigned int D.5524;
  long unsigned int D.5525;
  void * * D.5526;
  gchar * D.5527;
  char * D.5528;
  long unsigned int D.5535;
  long unsigned int D.5536;
  void * * D.5537;
  int i;
  int count;
  void * * nilist;
  char buf[512];
  struct FILE * f;
  char name[256];
  void out = <<< error >>>;

  try
    {
      i = 0;
      count = 0;
      nilist = 0B;
      f = fopen ("/proc/net/dev", "r");
      if (f == 0B) goto <D.5505>; else goto <D.5506>;
      <D.5505>:
      D.5507 = 0B;
      return D.5507;
      <D.5506>:
      D.5508 = fgets (&buf, 512, f);
      if (D.5508 == 0B) goto out; else goto <D.5509>;
      <D.5509>:
      D.5510 = fgets (&buf, 512, f);
      if (D.5510 == 0B) goto out; else goto <D.5511>;
      <D.5511>:
      goto <D.5462>;
      <D.5461>:
      {
        char * ptr;

        buf[511] = 0;
        ptr = __builtin_strchr (&buf, 58);
        if (ptr == 0B) goto out; else goto <D.5512>;
        <D.5512>:
        ptr.0 = ptr;
        ptr = ptr.0 + 1;
        *ptr.0 = 0;
        D.5514 = sscanf (&buf, "%s", &name);
        if (D.5514 != 1) goto out; else goto <D.5515>;
        <D.5515>:
        if (i >= count) goto <D.5516>; else goto <D.5517>;
        <D.5516>:
        if (count == 0) goto <D.5518>; else goto <D.5519>;
        <D.5518>:
        count = 16;
        goto <D.5520>;
        <D.5519>:
        count = count * 2;
        <D.5520>:
        <D.5517>:
        D.5521 = (long unsigned int) count;
        D.5522 = D.5521 * 8;
        nilist = monoeg_realloc (nilist, D.5522);
        i.1 = i;
        i = i.1 + 1;
        D.5524 = (long unsigned int) i.1;
        D.5525 = D.5524 * 8;
        D.5526 = nilist + D.5525;
        D.5527 = monoeg_strdup (&name);
        *D.5526 = D.5527;
      }
      <D.5462>:
      D.5528 = fgets (&buf, 512, f);
      if (D.5528 != 0B) goto <D.5461>; else goto <D.5463>;
      <D.5463>:
      out:
      if (f != 0B) goto <D.5529>; else goto <D.5530>;
      <D.5529>:
      fclose (f);
      <D.5530>:
      if (size != 0B) goto <D.5531>; else goto <D.5532>;
      <D.5531>:
      *size = i;
      <D.5532>:
      if (nilist == 0B) goto <D.5533>; else goto <D.5534>;
      <D.5533>:
      nilist = monoeg_malloc (8);
      <D.5534>:
      D.5535 = (long unsigned int) i;
      D.5536 = D.5535 * 8;
      D.5537 = nilist + D.5536;
      *D.5537 = 0B;
      D.5507 = nilist;
      return D.5507;
    }
  finally
    {
      buf = {CLOBBER};
      name = {CLOBBER};
    }
}


monoeg_strdup (const gchar * str)
{
  gchar * D.5542;

  if (str != 0B) goto <D.5540>; else goto <D.5541>;
  <D.5540>:
  D.5542 = __strdup (str);
  return D.5542;
  <D.5541>:
  D.5542 = 0B;
  return D.5542;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  long unsigned int D.5544;
  int D.5549;
  char * D.5551;
  long unsigned int D.5552;
  long unsigned int D.5553;
  long unsigned int D.5554;
  long unsigned int D.5557;

  D.5544 = __builtin_object_size (__s, 1);
  if (D.5544 != 18446744073709551615) goto <D.5545>; else goto <D.5546>;
  <D.5545>:
  D.5549 = __builtin_constant_p (__n);
  if (D.5549 == 0) goto <D.5547>; else goto <D.5550>;
  <D.5550>:
  if (__n <= 0) goto <D.5547>; else goto <D.5548>;
  <D.5547>:
  D.5552 = __builtin_object_size (__s, 1);
  D.5551 = __fgets_chk (__s, D.5552, __n, __stream);
  return D.5551;
  <D.5548>:
  D.5553 = (long unsigned int) __n;
  D.5554 = __builtin_object_size (__s, 1);
  if (D.5553 > D.5554) goto <D.5555>; else goto <D.5556>;
  <D.5555>:
  D.5557 = __builtin_object_size (__s, 1);
  D.5551 = __fgets_chk_warn (__s, D.5557, __n, __stream);
  return D.5551;
  <D.5556>:
  <D.5546>:
  D.5551 = __fgets_alias (__s, __n, __stream);
  return D.5551;
}


mono_network_get_data (char * name, MonoNetworkData data, MonoNetworkError * error)
{
  gint64 D.5561;
  char * D.5562;
  char * D.5564;
  char * ptr.2;
  int D.5568;
  int D.5497;
  int D.5572;
  long unsigned int tx_bytes.3;
  long unsigned int rx_bytes.4;
  long unsigned int D.5576;
  char * D.5578;
  gint64 val;
  char buf[512];
  char cname[256];
  struct FILE * f;
  long unsigned int rx_bytes;
  long unsigned int rx_packets;
  long unsigned int rx_errs;
  long unsigned int rx_drops;
  long unsigned int rx_fifo;
  long unsigned int rx_frame;
  long unsigned int tx_bytes;
  long unsigned int tx_packets;
  long unsigned int tx_errs;
  long unsigned int tx_drops;
  long unsigned int tx_fifo;
  long unsigned int tx_colls;
  long unsigned int tx_carrier;
  long unsigned int rx_multi;
  void out = <<< error >>>;

  try
    {
      val = 0;
      *error = 2;
      f = fopen ("/proc/net/dev", "r");
      if (f == 0B) goto <D.5559>; else goto <D.5560>;
      <D.5559>:
      D.5561 = -1;
      return D.5561;
      <D.5560>:
      D.5562 = fgets (&buf, 512, f);
      if (D.5562 == 0B) goto out; else goto <D.5563>;
      <D.5563>:
      D.5564 = fgets (&buf, 512, f);
      if (D.5564 == 0B) goto out; else goto <D.5565>;
      <D.5565>:
      goto <D.5498>;
      <D.5502>:
      {
        char * ptr;

        buf[511] = 0;
        ptr = __builtin_strchr (&buf, 58);
        if (ptr == 0B) goto out; else goto <D.5566>;
        <D.5566>:
        ptr.2 = ptr;
        ptr = ptr.2 + 1;
        *ptr.2 = 0;
        D.5568 = sscanf (&buf, "%s", &cname);
        if (D.5568 != 1) goto out; else goto <D.5569>;
        <D.5569>:
        {
          size_t __s1_len;
          size_t __s2_len;

          D.5497 = __builtin_strcmp (name, &cname);
        }
        if (D.5497 != 0) goto <D.5570>; else goto <D.5571>;
        <D.5570>:
        // predicted unlikely by continue predictor.
        goto <D.5498>;
        <D.5571>:
        D.5572 = sscanf (ptr, "%ld%ld%ld%ld%ld%ld%ld%*d%ld%ld%ld%ld%ld%ld%ld", &rx_bytes, &rx_packets, &rx_errs, &rx_drops, &rx_fifo, &rx_frame, &rx_multi, &tx_bytes, &tx_packets, &tx_errs, &tx_drops, &tx_fifo, &tx_colls, &tx_carrier);
        if (D.5572 != 14) goto out; else goto <D.5573>;
        <D.5573>:
        switch (data) <default: <D.5577>, case 0: <D.5500>, case 1: <D.5499>, case 2: <D.5501>>
        <D.5499>:
        tx_bytes.3 = tx_bytes;
        val = (gint64) tx_bytes.3;
        *error = 0;
        goto out;
        <D.5500>:
        rx_bytes.4 = rx_bytes;
        val = (gint64) rx_bytes.4;
        *error = 0;
        goto out;
        <D.5501>:
        rx_bytes.4 = rx_bytes;
        tx_bytes.3 = tx_bytes;
        D.5576 = rx_bytes.4 + tx_bytes.3;
        val = (gint64) D.5576;
        *error = 0;
        goto out;
        <D.5577>:
      }
      <D.5498>:
      D.5578 = fgets (&buf, 512, f);
      if (D.5578 != 0B) goto <D.5502>; else goto <D.5503>;
      <D.5503>:
      out:
      if (f != 0B) goto <D.5579>; else goto <D.5580>;
      <D.5579>:
      fclose (f);
      <D.5580>:
      D.5561 = val;
      return D.5561;
    }
  finally
    {
      buf = {CLOBBER};
      cname = {CLOBBER};
      rx_bytes = {CLOBBER};
      rx_packets = {CLOBBER};
      rx_errs = {CLOBBER};
      rx_drops = {CLOBBER};
      rx_fifo = {CLOBBER};
      rx_frame = {CLOBBER};
      tx_bytes = {CLOBBER};
      tx_packets = {CLOBBER};
      tx_errs = {CLOBBER};
      tx_drops = {CLOBBER};
      tx_fifo = {CLOBBER};
      tx_colls = {CLOBBER};
      tx_carrier = {CLOBBER};
      rx_multi = {CLOBBER};
    }
}


