/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

bool FUN_0040370c(char *param_1)

{
  FILE *__stream;
  int *piVar1;
  char *pcVar2;
  char *pcVar3;
  int iVar4;
  char *__s;
  
  memcpy(param_1,&DAT_0040d3d8,6)   //possible issue identified - semgrep
  __stream = fopen("/proc/net/dev","r")   //possible issue identified - semgrep
  if (__stream == (FILE *)0x0) {
    piVar1 = __errno_location();
    pcVar2 = strerror(*piVar1);
    warn("foreach_interface: open(\"/proc/net/dev\") for read failed: %s; not able to determine hostId, so no support for multiple NICs.\n"
         ,pcVar2);
  }
  else {
    fgets(&g_buf,0xa0,__stream)   //possible issue identified - semgrep
    fgets(&g_buf,0xa0,__stream)   //possible issue identified - semgrep
    while (pcVar2 = fgets(&g_buf,0xa0,__stream), iVar4 = ___ctype_b, pcVar2 != (char *)0x0) {   //possible issue identified - semgrep
      pcVar2 = &g_buf;
      do {
        __s = pcVar2;
        pcVar2 = __s + 1;
      } while ((*(ushort *)(___ctype_b + *__s * 2) & 0x20) != 0);
      pcVar3 = strchr(__s,0x3a);
      pcVar2 = pcVar3;
      if (pcVar3 == (char *)0x0) {
        pcVar2 = "foreach_interface: parse error reading /proc/net/dev: missing colon\n";
        goto LAB_004038f8;
      }
      do {
        pcVar2 = pcVar2 + 1;
      } while ((*(ushort *)(iVar4 + *pcVar2 * 2) & 8) != 0);
      if (*pcVar2 == 0x3a) {
        *pcVar2 = '\0';
      }
      else {
        *pcVar3 = '\0';
      }
      FUN_00403610(__s,param_1);
    }
    iVar4 = ferror(__stream);
    if (iVar4 == 0) {
      fclose(__stream);
      if (*param_1 != -1) {
        return true;
      }
      if (param_1[1] == -1) {
        if (param_1[2] != -1) {
          return true;
        }
        if (param_1[3] != -1) {
          return true;
        }
        if (param_1[4] == -1) {
          return param_1[5] != -1;
        }
      }
      return true;
    }
    pcVar2 = "foreach_interface: error during reading of /proc/net/dev\n";
LAB_004038f8:
    warn(pcVar2);
    fclose(__stream);
  }
  return false;
}