mono_networkinterface_list (int * size)
{
  void * * D.4993;
  char * D.4994;
  char * D.4996;
  char * ptr.0;
  int D.5000;
  long unsigned int D.5007;
  long unsigned int D.5008;
  int i.1;
  long unsigned int D.5010;
  long unsigned int D.5011;
  void * * D.5012;
  gchar * D.5013;
  char * D.5014;
  long unsigned int D.5021;
  long unsigned int D.5022;
  void * * D.5023;
  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.4991>; else goto <D.4992>;
      <D.4991>:
      D.4993 = 0B;
      return D.4993;
      <D.4992>:
      D.4994 = fgets (&buf, 512, f);
      if (D.4994 == 0B) goto out; else goto <D.4995>;
      <D.4995>:
      D.4996 = fgets (&buf, 512, f);
      if (D.4996 == 0B) goto out; else goto <D.4997>;
      <D.4997>:
      goto <D.4948>;
      <D.4947>:
      {
        char * ptr;

        buf[511] = 0;
        ptr = __builtin_strchr (&buf, 58);
        if (ptr == 0B) goto out; else goto <D.4998>;
        <D.4998>:
        ptr.0 = ptr;
        ptr = ptr.0 + 1;
        *ptr.0 = 0;
        D.5000 = sscanf (&buf, "%s", &name);
        if (D.5000 != 1) goto out; else goto <D.5001>;
        <D.5001>:
        if (i >= count) goto <D.5002>; else goto <D.5003>;
        <D.5002>:
        if (count == 0) goto <D.5004>; else goto <D.5005>;
        <D.5004>:
        count = 16;
        goto <D.5006>;
        <D.5005>:
        count = count * 2;
        <D.5006>:
        <D.5003>:
        D.5007 = (long unsigned int) count;
        D.5008 = D.5007 * 8;
        nilist = monoeg_realloc (nilist, D.5008);
        i.1 = i;
        i = i.1 + 1;
        D.5010 = (long unsigned int) i.1;
        D.5011 = D.5010 * 8;
        D.5012 = nilist + D.5011;
        D.5013 = monoeg_strdup (&name);
        *D.5012 = D.5013;
      }
      <D.4948>:
      D.5014 = fgets (&buf, 512, f);
      if (D.5014 != 0B) goto <D.4947>; else goto <D.4949>;
      <D.4949>:
      out:
      if (f != 0B) goto <D.5015>; else goto <D.5016>;
      <D.5015>:
      fclose (f);
      <D.5016>:
      if (size != 0B) goto <D.5017>; else goto <D.5018>;
      <D.5017>:
      *size = i;
      <D.5018>:
      if (nilist == 0B) goto <D.5019>; else goto <D.5020>;
      <D.5019>:
      nilist = monoeg_malloc (8);
      <D.5020>:
      D.5021 = (long unsigned int) i;
      D.5022 = D.5021 * 8;
      D.5023 = nilist + D.5022;
      *D.5023 = 0B;
      D.4993 = nilist;
      return D.4993;
    }
  finally
    {
      buf = {CLOBBER};
      name = {CLOBBER};
    }
}


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

  if (str != 0B) goto <D.5026>; else goto <D.5027>;
  <D.5026>:
  D.5028 = __strdup (str);
  return D.5028;
  <D.5027>:
  D.5028 = 0B;
  return D.5028;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  long unsigned int D.5030;
  int D.5035;
  char * D.5037;
  long unsigned int D.5038;
  long unsigned int D.5039;
  long unsigned int D.5040;
  long unsigned int D.5043;

  D.5030 = __builtin_object_size (__s, 1);
  if (D.5030 != 18446744073709551615) goto <D.5031>; else goto <D.5032>;
  <D.5031>:
  D.5035 = __builtin_constant_p (__n);
  if (D.5035 == 0) goto <D.5033>; else goto <D.5036>;
  <D.5036>:
  if (__n <= 0) goto <D.5033>; else goto <D.5034>;
  <D.5033>:
  D.5038 = __builtin_object_size (__s, 1);
  D.5037 = __fgets_chk (__s, D.5038, __n, __stream);
  return D.5037;
  <D.5034>:
  D.5039 = (long unsigned int) __n;
  D.5040 = __builtin_object_size (__s, 1);
  if (D.5039 > D.5040) goto <D.5041>; else goto <D.5042>;
  <D.5041>:
  D.5043 = __builtin_object_size (__s, 1);
  D.5037 = __fgets_chk_warn (__s, D.5043, __n, __stream);
  return D.5037;
  <D.5042>:
  <D.5032>:
  D.5037 = __fgets_alias (__s, __n, __stream);
  return D.5037;
}


mono_network_get_data (char * name, MonoNetworkData data, MonoNetworkError * error)
{
  gint64 D.5047;
  char * D.5048;
  char * D.5050;
  char * ptr.2;
  int D.5054;
  int D.4983;
  int D.5058;
  long unsigned int tx_bytes.3;
  long unsigned int rx_bytes.4;
  long unsigned int D.5062;
  char * D.5064;
  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.5045>; else goto <D.5046>;
      <D.5045>:
      D.5047 = -1;
      return D.5047;
      <D.5046>:
      D.5048 = fgets (&buf, 512, f);
      if (D.5048 == 0B) goto out; else goto <D.5049>;
      <D.5049>:
      D.5050 = fgets (&buf, 512, f);
      if (D.5050 == 0B) goto out; else goto <D.5051>;
      <D.5051>:
      goto <D.4984>;
      <D.4988>:
      {
        char * ptr;

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

          D.4983 = __builtin_strcmp (name, &cname);
        }
        if (D.4983 != 0) goto <D.5056>; else goto <D.5057>;
        <D.5056>:
        // predicted unlikely by continue predictor.
        goto <D.4984>;
        <D.5057>:
        D.5058 = 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.5058 != 14) goto out; else goto <D.5059>;
        <D.5059>:
        switch (data) <default: <D.5063>, case 0: <D.4986>, case 1: <D.4985>, case 2: <D.4987>>
        <D.4985>:
        tx_bytes.3 = tx_bytes;
        val = (gint64) tx_bytes.3;
        *error = 0;
        goto out;
        <D.4986>:
        rx_bytes.4 = rx_bytes;
        val = (gint64) rx_bytes.4;
        *error = 0;
        goto out;
        <D.4987>:
        rx_bytes.4 = rx_bytes;
        tx_bytes.3 = tx_bytes;
        D.5062 = rx_bytes.4 + tx_bytes.3;
        val = (gint64) D.5062;
        *error = 0;
        goto out;
        <D.5063>:
      }
      <D.4984>:
      D.5064 = fgets (&buf, 512, f);
      if (D.5064 != 0B) goto <D.4988>; else goto <D.4989>;
      <D.4989>:
      out:
      if (f != 0B) goto <D.5065>; else goto <D.5066>;
      <D.5065>:
      fclose (f);
      <D.5066>:
      D.5047 = val;
      return D.5047;
    }
  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};
    }
}


