mono_networkinterface_list (int * size)
{
  void * * D.7252;
  char * D.7253;
  char * D.7255;
  char * ptr.0;
  int D.7259;
  unsigned int count.1;
  unsigned int D.7267;
  int i.2;
  unsigned int i.3;
  unsigned int D.7270;
  void * * D.7271;
  gchar * D.7272;
  char * D.7273;
  unsigned int i.4;
  unsigned int D.7281;
  void * * D.7282;
  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.7250>; else goto <D.7251>;
      <D.7250>:
      D.7252 = 0B;
      return D.7252;
      <D.7251>:
      D.7253 = fgets (&buf, 512, f);
      if (D.7253 == 0B) goto out; else goto <D.7254>;
      <D.7254>:
      D.7255 = fgets (&buf, 512, f);
      if (D.7255 == 0B) goto out; else goto <D.7256>;
      <D.7256>:
      goto <D.7205>;
      <D.7204>:
      {
        char * ptr;

        buf[511] = 0;
        ptr = __builtin_strchr (&buf, 58);
        if (ptr == 0B) goto out; else goto <D.7257>;
        <D.7257>:
        ptr.0 = ptr;
        ptr = ptr.0 + 1;
        *ptr.0 = 0;
        D.7259 = sscanf (&buf, "%s", &name);
        if (D.7259 != 1) goto out; else goto <D.7260>;
        <D.7260>:
        if (i >= count) goto <D.7261>; else goto <D.7262>;
        <D.7261>:
        if (count == 0) goto <D.7263>; else goto <D.7264>;
        <D.7263>:
        count = 16;
        goto <D.7265>;
        <D.7264>:
        count = count * 2;
        <D.7265>:
        <D.7262>:
        count.1 = (unsigned int) count;
        D.7267 = count.1 * 4;
        nilist = monoeg_realloc (nilist, D.7267);
        i.2 = i;
        i = i.2 + 1;
        i.3 = (unsigned int) i.2;
        D.7270 = i.3 * 4;
        D.7271 = nilist + D.7270;
        D.7272 = monoeg_strdup (&name);
        *D.7271 = D.7272;
      }
      <D.7205>:
      D.7273 = fgets (&buf, 512, f);
      if (D.7273 != 0B) goto <D.7204>; else goto <D.7206>;
      <D.7206>:
      out:
      if (f != 0B) goto <D.7274>; else goto <D.7275>;
      <D.7274>:
      fclose (f);
      <D.7275>:
      if (size != 0B) goto <D.7276>; else goto <D.7277>;
      <D.7276>:
      *size = i;
      <D.7277>:
      if (nilist == 0B) goto <D.7278>; else goto <D.7279>;
      <D.7278>:
      nilist = monoeg_malloc (4);
      <D.7279>:
      i.4 = (unsigned int) i;
      D.7281 = i.4 * 4;
      D.7282 = nilist + D.7281;
      *D.7282 = 0B;
      D.7252 = nilist;
      return D.7252;
    }
  finally
    {
      buf = {CLOBBER};
      name = {CLOBBER};
    }
}


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

  if (str != 0B) goto <D.7285>; else goto <D.7286>;
  <D.7285>:
  D.7287 = __strdup (str);
  return D.7287;
  <D.7286>:
  D.7287 = 0B;
  return D.7287;
}


fgets (char * restrict __s, int __n, struct FILE * restrict __stream)
{
  unsigned int D.7289;
  int D.7294;
  char * D.7296;
  unsigned int D.7297;
  unsigned int __n.5;
  unsigned int D.7299;
  unsigned int D.7302;

  D.7289 = __builtin_object_size (__s, 1);
  if (D.7289 != 4294967295) goto <D.7290>; else goto <D.7291>;
  <D.7290>:
  D.7294 = __builtin_constant_p (__n);
  if (D.7294 == 0) goto <D.7292>; else goto <D.7295>;
  <D.7295>:
  if (__n <= 0) goto <D.7292>; else goto <D.7293>;
  <D.7292>:
  D.7297 = __builtin_object_size (__s, 1);
  D.7296 = __fgets_chk (__s, D.7297, __n, __stream);
  return D.7296;
  <D.7293>:
  __n.5 = (unsigned int) __n;
  D.7299 = __builtin_object_size (__s, 1);
  if (__n.5 > D.7299) goto <D.7300>; else goto <D.7301>;
  <D.7300>:
  D.7302 = __builtin_object_size (__s, 1);
  D.7296 = __fgets_chk_warn (__s, D.7302, __n, __stream);
  return D.7296;
  <D.7301>:
  <D.7291>:
  D.7296 = __fgets_alias (__s, __n, __stream);
  return D.7296;
}


mono_network_get_data (char * name, MonoNetworkData data, MonoNetworkError * error)
{
  gint64 D.7306;
  char * D.7307;
  char * D.7309;
  char * ptr.6;
  int D.7313;
  int D.7240;
  int D.7317;
  long unsigned int tx_bytes.7;
  long unsigned int rx_bytes.8;
  long unsigned int D.7321;
  char * D.7323;
  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.7304>; else goto <D.7305>;
      <D.7304>:
      D.7306 = -1;
      return D.7306;
      <D.7305>:
      D.7307 = fgets (&buf, 512, f);
      if (D.7307 == 0B) goto out; else goto <D.7308>;
      <D.7308>:
      D.7309 = fgets (&buf, 512, f);
      if (D.7309 == 0B) goto out; else goto <D.7310>;
      <D.7310>:
      goto <D.7241>;
      <D.7245>:
      {
        char * ptr;

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

          D.7240 = __builtin_strcmp (name, &cname);
        }
        if (D.7240 != 0) goto <D.7315>; else goto <D.7316>;
        <D.7315>:
        // predicted unlikely by continue predictor.
        goto <D.7241>;
        <D.7316>:
        D.7317 = 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.7317 != 14) goto out; else goto <D.7318>;
        <D.7318>:
        switch (data) <default: <D.7322>, case 0: <D.7243>, case 1: <D.7242>, case 2: <D.7244>>
        <D.7242>:
        tx_bytes.7 = tx_bytes;
        val = (gint64) tx_bytes.7;
        *error = 0;
        goto out;
        <D.7243>:
        rx_bytes.8 = rx_bytes;
        val = (gint64) rx_bytes.8;
        *error = 0;
        goto out;
        <D.7244>:
        rx_bytes.8 = rx_bytes;
        tx_bytes.7 = tx_bytes;
        D.7321 = rx_bytes.8 + tx_bytes.7;
        val = (gint64) D.7321;
        *error = 0;
        goto out;
        <D.7322>:
      }
      <D.7241>:
      D.7323 = fgets (&buf, 512, f);
      if (D.7323 != 0B) goto <D.7245>; else goto <D.7246>;
      <D.7246>:
      out:
      if (f != 0B) goto <D.7324>; else goto <D.7325>;
      <D.7324>:
      fclose (f);
      <D.7325>:
      D.7306 = val;
      return D.7306;
    }
  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};
    }
}


