mono_networkinterface_list (int * size)
{
  void * * D.4663;
  char * D.4664;
  char * D.4666;
  char * ptr.0;
  int D.4670;
  unsigned int count.1;
  unsigned int D.4678;
  int i.2;
  unsigned int i.3;
  unsigned int D.4681;
  void * * D.4682;
  gchar * D.4683;
  char * D.4684;
  unsigned int i.4;
  unsigned int D.4692;
  void * * D.4693;
  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.4661>; else goto <D.4662>;
      <D.4661>:
      D.4663 = 0B;
      return D.4663;
      <D.4662>:
      D.4664 = fgets (&buf, 512, f);
      if (D.4664 == 0B) goto out; else goto <D.4665>;
      <D.4665>:
      D.4666 = fgets (&buf, 512, f);
      if (D.4666 == 0B) goto out; else goto <D.4667>;
      <D.4667>:
      goto <D.4618>;
      <D.4617>:
      {
        char * ptr;

        buf[511] = 0;
        ptr = __builtin_strchr (&buf, 58);
        if (ptr == 0B) goto out; else goto <D.4668>;
        <D.4668>:
        ptr.0 = ptr;
        ptr = ptr.0 + 1;
        *ptr.0 = 0;
        D.4670 = sscanf (&buf, "%s", &name);
        if (D.4670 != 1) goto out; else goto <D.4671>;
        <D.4671>:
        if (i >= count) goto <D.4672>; else goto <D.4673>;
        <D.4672>:
        if (count == 0) goto <D.4674>; else goto <D.4675>;
        <D.4674>:
        count = 16;
        goto <D.4676>;
        <D.4675>:
        count = count * 2;
        <D.4676>:
        <D.4673>:
        count.1 = (unsigned int) count;
        D.4678 = count.1 * 4;
        nilist = monoeg_realloc (nilist, D.4678);
        i.2 = i;
        i = i.2 + 1;
        i.3 = (unsigned int) i.2;
        D.4681 = i.3 * 4;
        D.4682 = nilist + D.4681;
        D.4683 = monoeg_strdup (&name);
        *D.4682 = D.4683;
      }
      <D.4618>:
      D.4684 = fgets (&buf, 512, f);
      if (D.4684 != 0B) goto <D.4617>; else goto <D.4619>;
      <D.4619>:
      out:
      if (f != 0B) goto <D.4685>; else goto <D.4686>;
      <D.4685>:
      fclose (f);
      <D.4686>:
      if (size != 0B) goto <D.4687>; else goto <D.4688>;
      <D.4687>:
      *size = i;
      <D.4688>:
      if (nilist == 0B) goto <D.4689>; else goto <D.4690>;
      <D.4689>:
      nilist = monoeg_malloc (4);
      <D.4690>:
      i.4 = (unsigned int) i;
      D.4692 = i.4 * 4;
      D.4693 = nilist + D.4692;
      *D.4693 = 0B;
      D.4663 = nilist;
      return D.4663;
    }
  finally
    {
      buf = {CLOBBER};
      name = {CLOBBER};
    }
}


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

  if (str != 0B) goto <D.4696>; else goto <D.4697>;
  <D.4696>:
  D.4698 = __strdup (str);
  return D.4698;
  <D.4697>:
  D.4698 = 0B;
  return D.4698;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  unsigned int D.4700;
  int D.4705;
  char * D.4707;
  unsigned int D.4708;
  unsigned int __n.5;
  unsigned int D.4710;
  unsigned int D.4713;

  D.4700 = __builtin_object_size (__s, 1);
  if (D.4700 != 4294967295) goto <D.4701>; else goto <D.4702>;
  <D.4701>:
  D.4705 = __builtin_constant_p (__n);
  if (D.4705 == 0) goto <D.4703>; else goto <D.4706>;
  <D.4706>:
  if (__n <= 0) goto <D.4703>; else goto <D.4704>;
  <D.4703>:
  D.4708 = __builtin_object_size (__s, 1);
  D.4707 = __fgets_chk (__s, D.4708, __n, __stream);
  return D.4707;
  <D.4704>:
  __n.5 = (unsigned int) __n;
  D.4710 = __builtin_object_size (__s, 1);
  if (__n.5 > D.4710) goto <D.4711>; else goto <D.4712>;
  <D.4711>:
  D.4713 = __builtin_object_size (__s, 1);
  D.4707 = __fgets_chk_warn (__s, D.4713, __n, __stream);
  return D.4707;
  <D.4712>:
  <D.4702>:
  D.4707 = __fgets_alias (__s, __n, __stream);
  return D.4707;
}


mono_network_get_data (char * name, MonoNetworkData data, MonoNetworkError * error)
{
  gint64 D.4717;
  char * D.4718;
  char * D.4720;
  char * ptr.6;
  int D.4724;
  int D.4653;
  int D.4728;
  long unsigned int tx_bytes.7;
  long unsigned int rx_bytes.8;
  long unsigned int D.4732;
  char * D.4734;
  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.4715>; else goto <D.4716>;
      <D.4715>:
      D.4717 = -1;
      return D.4717;
      <D.4716>:
      D.4718 = fgets (&buf, 512, f);
      if (D.4718 == 0B) goto out; else goto <D.4719>;
      <D.4719>:
      D.4720 = fgets (&buf, 512, f);
      if (D.4720 == 0B) goto out; else goto <D.4721>;
      <D.4721>:
      goto <D.4654>;
      <D.4658>:
      {
        char * ptr;

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

          D.4653 = __builtin_strcmp (name, &cname);
        }
        if (D.4653 != 0) goto <D.4726>; else goto <D.4727>;
        <D.4726>:
        // predicted unlikely by continue predictor.
        goto <D.4654>;
        <D.4727>:
        D.4728 = 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.4728 != 14) goto out; else goto <D.4729>;
        <D.4729>:
        switch (data) <default: <D.4733>, case 0: <D.4656>, case 1: <D.4655>, case 2: <D.4657>>
        <D.4655>:
        tx_bytes.7 = tx_bytes;
        val = (gint64) tx_bytes.7;
        *error = 0;
        goto out;
        <D.4656>:
        rx_bytes.8 = rx_bytes;
        val = (gint64) rx_bytes.8;
        *error = 0;
        goto out;
        <D.4657>:
        rx_bytes.8 = rx_bytes;
        tx_bytes.7 = tx_bytes;
        D.4732 = rx_bytes.8 + tx_bytes.7;
        val = (gint64) D.4732;
        *error = 0;
        goto out;
        <D.4733>:
      }
      <D.4654>:
      D.4734 = fgets (&buf, 512, f);
      if (D.4734 != 0B) goto <D.4658>; else goto <D.4659>;
      <D.4659>:
      out:
      if (f != 0B) goto <D.4735>; else goto <D.4736>;
      <D.4735>:
      fclose (f);
      <D.4736>:
      D.4717 = val;
      return D.4717;
    }
  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};
    }
}


