mono_networkinterface_list (int * size)
{
  void * * D.4643;
  char * D.4644;
  char * D.4646;
  char * ptr.0;
  int D.4650;
  unsigned int count.1;
  unsigned int D.4658;
  int i.2;
  unsigned int i.3;
  unsigned int D.4661;
  void * * D.4662;
  gchar * D.4663;
  char * D.4664;
  unsigned int i.4;
  unsigned int D.4672;
  void * * D.4673;
  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.4641>; else goto <D.4642>;
      <D.4641>:
      D.4643 = 0B;
      return D.4643;
      <D.4642>:
      D.4644 = fgets (&buf, 512, f);
      if (D.4644 == 0B) goto out; else goto <D.4645>;
      <D.4645>:
      D.4646 = fgets (&buf, 512, f);
      if (D.4646 == 0B) goto out; else goto <D.4647>;
      <D.4647>:
      goto <D.4598>;
      <D.4597>:
      {
        char * ptr;

        buf[511] = 0;
        ptr = __builtin_strchr (&buf, 58);
        if (ptr == 0B) goto out; else goto <D.4648>;
        <D.4648>:
        ptr.0 = ptr;
        ptr = ptr.0 + 1;
        *ptr.0 = 0;
        D.4650 = sscanf (&buf, "%s", &name);
        if (D.4650 != 1) goto out; else goto <D.4651>;
        <D.4651>:
        if (i >= count) goto <D.4652>; else goto <D.4653>;
        <D.4652>:
        if (count == 0) goto <D.4654>; else goto <D.4655>;
        <D.4654>:
        count = 16;
        goto <D.4656>;
        <D.4655>:
        count = count * 2;
        <D.4656>:
        <D.4653>:
        count.1 = (unsigned int) count;
        D.4658 = count.1 * 4;
        nilist = monoeg_realloc (nilist, D.4658);
        i.2 = i;
        i = i.2 + 1;
        i.3 = (unsigned int) i.2;
        D.4661 = i.3 * 4;
        D.4662 = nilist + D.4661;
        D.4663 = monoeg_strdup (&name);
        *D.4662 = D.4663;
      }
      <D.4598>:
      D.4664 = fgets (&buf, 512, f);
      if (D.4664 != 0B) goto <D.4597>; else goto <D.4599>;
      <D.4599>:
      out:
      if (f != 0B) goto <D.4665>; else goto <D.4666>;
      <D.4665>:
      fclose (f);
      <D.4666>:
      if (size != 0B) goto <D.4667>; else goto <D.4668>;
      <D.4667>:
      *size = i;
      <D.4668>:
      if (nilist == 0B) goto <D.4669>; else goto <D.4670>;
      <D.4669>:
      nilist = monoeg_malloc (4);
      <D.4670>:
      i.4 = (unsigned int) i;
      D.4672 = i.4 * 4;
      D.4673 = nilist + D.4672;
      *D.4673 = 0B;
      D.4643 = nilist;
      return D.4643;
    }
  finally
    {
      buf = {CLOBBER};
      name = {CLOBBER};
    }
}


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

  if (str != 0B) goto <D.4676>; else goto <D.4677>;
  <D.4676>:
  D.4678 = __strdup (str);
  return D.4678;
  <D.4677>:
  D.4678 = 0B;
  return D.4678;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  unsigned int D.4680;
  int D.4685;
  char * D.4687;
  unsigned int D.4688;
  unsigned int __n.5;
  unsigned int D.4690;
  unsigned int D.4693;

  D.4680 = __builtin_object_size (__s, 1);
  if (D.4680 != 4294967295) goto <D.4681>; else goto <D.4682>;
  <D.4681>:
  D.4685 = __builtin_constant_p (__n);
  if (D.4685 == 0) goto <D.4683>; else goto <D.4686>;
  <D.4686>:
  if (__n <= 0) goto <D.4683>; else goto <D.4684>;
  <D.4683>:
  D.4688 = __builtin_object_size (__s, 1);
  D.4687 = __fgets_chk (__s, D.4688, __n, __stream);
  return D.4687;
  <D.4684>:
  __n.5 = (unsigned int) __n;
  D.4690 = __builtin_object_size (__s, 1);
  if (__n.5 > D.4690) goto <D.4691>; else goto <D.4692>;
  <D.4691>:
  D.4693 = __builtin_object_size (__s, 1);
  D.4687 = __fgets_chk_warn (__s, D.4693, __n, __stream);
  return D.4687;
  <D.4692>:
  <D.4682>:
  D.4687 = __fgets_alias (__s, __n, __stream);
  return D.4687;
}


mono_network_get_data (char * name, MonoNetworkData data, MonoNetworkError * error)
{
  gint64 D.4697;
  char * D.4698;
  char * D.4700;
  char * ptr.6;
  int D.4704;
  int D.4633;
  int D.4708;
  long unsigned int tx_bytes.7;
  long unsigned int rx_bytes.8;
  long unsigned int D.4712;
  char * D.4714;
  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.4695>; else goto <D.4696>;
      <D.4695>:
      D.4697 = -1;
      return D.4697;
      <D.4696>:
      D.4698 = fgets (&buf, 512, f);
      if (D.4698 == 0B) goto out; else goto <D.4699>;
      <D.4699>:
      D.4700 = fgets (&buf, 512, f);
      if (D.4700 == 0B) goto out; else goto <D.4701>;
      <D.4701>:
      goto <D.4634>;
      <D.4638>:
      {
        char * ptr;

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

          D.4633 = __builtin_strcmp (name, &cname);
        }
        if (D.4633 != 0) goto <D.4706>; else goto <D.4707>;
        <D.4706>:
        // predicted unlikely by continue predictor.
        goto <D.4634>;
        <D.4707>:
        D.4708 = 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.4708 != 14) goto out; else goto <D.4709>;
        <D.4709>:
        switch (data) <default: <D.4713>, case 0: <D.4636>, case 1: <D.4635>, case 2: <D.4637>>
        <D.4635>:
        tx_bytes.7 = tx_bytes;
        val = (gint64) tx_bytes.7;
        *error = 0;
        goto out;
        <D.4636>:
        rx_bytes.8 = rx_bytes;
        val = (gint64) rx_bytes.8;
        *error = 0;
        goto out;
        <D.4637>:
        rx_bytes.8 = rx_bytes;
        tx_bytes.7 = tx_bytes;
        D.4712 = rx_bytes.8 + tx_bytes.7;
        val = (gint64) D.4712;
        *error = 0;
        goto out;
        <D.4713>:
      }
      <D.4634>:
      D.4714 = fgets (&buf, 512, f);
      if (D.4714 != 0B) goto <D.4638>; else goto <D.4639>;
      <D.4639>:
      out:
      if (f != 0B) goto <D.4715>; else goto <D.4716>;
      <D.4715>:
      fclose (f);
      <D.4716>:
      D.4697 = val;
      return D.4697;
    }
  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};
    }
}


