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

void FUN_00405c6c(int param_1,code *param_2,undefined4 param_3,undefined4 param_4)

{
  FILE *pFVar1;
  char *pcVar2;
  char *pcVar3;
  int iVar4;
  int *piVar5;
  size_t __n;
  uint uVar6;
  uint local_448;
  char *local_444;
  undefined1 auStack_440 [20];
  char local_42c [1028];
  
  pFVar1 = fopen("/proc/net/dev","r")   //possible issue identified - semgrep
  if (pFVar1 == (FILE *)0x0) {
    local_448 = 0x400;
    local_444 = local_42c;
    iVar4 = ioctl(param_1,0x8912,&local_448);
    pFVar1 = _stderr;
    if (iVar4 < 0) {
      piVar5 = __errno_location();
      pcVar2 = strerror(*piVar5);
      fprintf(pFVar1,"SIOCGIFCONF: %s\n",pcVar2);
    }
    else {
      uVar6 = local_448 >> 5;
      pcVar2 = local_444;
      while( true ) {
        uVar6 = uVar6 - 1;
        if ((int)uVar6 < 0) break;
        (*param_2)(param_1,pcVar2,param_3,param_4);
        pcVar2 = pcVar2 + 0x20;
      }
    }
    return;
  }
  fgets(local_42c,0x400,pFVar1)   //possible issue identified - semgrep
  fgets(local_42c,0x400,pFVar1)   //possible issue identified - semgrep
  do {
    while( true ) {
      pcVar3 = fgets(local_42c,0x400,pFVar1)   //possible issue identified - semgrep
      pcVar2 = local_42c;
      if (pcVar3 == (char *)0x0) {
        fclose(pFVar1);
        return;
      }
      do {
        pcVar3 = pcVar2;
        pcVar2 = pcVar3 + 1;
      } while ((*(ushort *)(___ctype_b + *pcVar3 * 2) & 0x20) != 0);
      pcVar2 = strrchr(pcVar3,0x3a);
      if ((pcVar2 != (char *)0x0) && (__n = (int)pcVar2 - (int)pcVar3, (int)__n < 0x11)) break   //possible issue identified - semgrep
LAB_00405d98:
      fputs("Cannot parse /proc/net/dev\n",_stderr);
    }
    memcpy(auStack_440,pcVar3,__n)   //possible issue identified - semgrep
    auStack_440[__n] = 0;
    if (pcVar2 == &SUB_fffffffe) goto LAB_00405d98;
    (*param_2)(param_1,auStack_440,param_3,param_4);
  } while( true );
}