/* WARNING: Removing unreachable block (ram,0x004015c0) */
/* WARNING: Removing unreachable block (ram,0x00401584) */
/* WARNING: Removing unreachable block (ram,0x004015ec) */

void FUN_004014fc(int param_1)

{
  int iVar1;
  tm *__tp;
  char *pcVar2;
  undefined4 *puVar3;
  void *pvVar4;
  undefined4 *puVar5;
  uint uVar6;
  undefined4 *puVar7;
  int iVar8;
  char acStack_70 [48];
  uint local_40;
  time_t local_3c;
  uint local_38;
  uint local_34;
  uint local_30;
  
  signal(param_1,(__sighandler_t)0x1)   //possible issue identified - semgrep
  local_3c = time((time_t *)0x0);
  local_40 = local_3c - *(int *)(g_conf + 0x48);
  local_38 = local_40 / 0x15180;
  iVar8 = 0;
  local_40 = local_40 % 0x15180;
  local_34 = local_40 / 0xe10;
  local_40 = local_40 % 0xe10;
  local_30 = local_40 / 0x3c;
  rewind(*(FILE **)(g_conf + 0x44));
  iVar1 = fileno(*(FILE **)(g_conf + 0x44));
  ftruncate(iVar1,0)   //possible issue identified - semgrep
  fputs("*** Subscription Information Dump\n",*(FILE **)(g_conf + 0x44));
  fputc(10,*(FILE **)(g_conf + 0x44));
  for (puVar7 = (undefined4 *)**(undefined4 **)(g_conf + 0xc); puVar7 != (undefined4 *)0x0;
      puVar7 = (undefined4 *)*puVar7) {
    pvVar4 = (void *)puVar7[2];
    if (pvVar4 != (void *)0x0) {
      inet_ntop(10,pvVar4,acStack_70,0x2e)   //possible issue identified - semgrep
      fprintf(*(FILE **)(g_conf + 0x44),"Group : %s\n",acStack_70);
      fprintf(*(FILE **)(g_conf + 0x44),"\tBytes  : %llu\n",*(undefined4 *)((int)pvVar4 + 0x18),
              *(undefined4 *)((int)pvVar4 + 0x1c));
      fprintf(*(FILE **)(g_conf + 0x44),"\tPackets: %llu\n",*(undefined4 *)((int)pvVar4 + 0x20),
              *(undefined4 *)((int)pvVar4 + 0x24));
      for (puVar5 = (undefined4 *)**(undefined4 **)((int)pvVar4 + 0x10); puVar5 != (undefined4 *)0x0
          ; puVar5 = (undefined4 *)*puVar5) {
        puVar3 = (undefined4 *)puVar5[2];
        if ((puVar3 != (undefined4 *)0x0) && (iVar1 = int_find(*puVar3), iVar1 != 0)) {
          fprintf(*(FILE **)(g_conf + 0x44),"\tInterface: %s (%d)\n",iVar1 + 4,
                  *(undefined4 *)(puVar3[1] + 8));
          for (puVar3 = *(undefined4 **)puVar3[1]; puVar3 != (undefined4 *)0x0;
              puVar3 = (undefined4 *)*puVar3) {
            pvVar4 = (void *)puVar3[2];
            if (pvVar4 != (void *)0x0) {
              iVar1 = local_3c - *(int *)((int)pvVar4 + 0x14);
              iVar8 = iVar8 + 1;
              if (iVar1 < 0) {
                iVar1 = -param_1;
              }
              inet_ntop(10,pvVar4,acStack_70,0x2e)   //possible issue identified - semgrep
              pcVar2 = "EXCLUDE";
              if (*(int *)((int)pvVar4 + 0x10) == 1) {
                pcVar2 = "INCLUDE";
              }
              fprintf(*(FILE **)(g_conf + 0x44),"\t\t%s %s (%u seconds old)\n",acStack_70,pcVar2,
                      iVar1);
            }
          }
        }
      }
      fputc(10,*(FILE **)(g_conf + 0x44));
    }
  }
  fprintf(*(FILE **)(g_conf + 0x44),
          "*** Subscription Information Dump (end - %u groups, %u subscriptions)\n",
          *(undefined4 *)(*(int *)(g_conf + 0xc) + 8),iVar8);
  fputc(10,*(FILE **)(g_conf + 0x44));
  fputs("*** Interface Dump\n",*(FILE **)(g_conf + 0x44));
  fputc(10,*(FILE **)(g_conf + 0x44));
  uVar6 = 0;
  iVar1 = 0;
  while( true ) {
    if (*(uint *)(g_conf + 4) <= uVar6) break;
    puVar7 = (undefined4 *)(*(int *)(g_conf + 8) + uVar6 * 0x90);
    if (puVar7[6] != 0) {
      fprintf(*(FILE **)(g_conf + 0x44),"Interface: %s\n",puVar7 + 1);
      fprintf(*(FILE **)(g_conf + 0x44),"  Index number           : %u\n",*puVar7);
      fprintf(*(FILE **)(g_conf + 0x44),"  MTU                    : %u\n",puVar7[6]);
      pcVar2 = "Ethernet";
      if ((*(short *)(puVar7 + 9) != 1) && (pcVar2 = "Unknown", *(short *)(puVar7 + 9) == 0x308)) {
        pcVar2 = "sit";
      }
      fprintf(*(FILE **)(g_conf + 0x44),"  Interface Type         : %s (%u)\n",pcVar2);
      inet_ntop(10,puVar7 + 0xd,acStack_70,0x2e)   //possible issue identified - semgrep
      fprintf(*(FILE **)(g_conf + 0x44),"  Link-local address     : %s\n",acStack_70);
      inet_ntop(10,puVar7 + 0x11,acStack_70,0x2e)   //possible issue identified - semgrep
      fprintf(*(FILE **)(g_conf + 0x44),"  Global unicast address : %s\n",acStack_70);
      if (puVar7[7] == 0) {
        fputs("  MLD version            : none\n",*(FILE **)(g_conf + 0x44));
      }
      else {
        fprintf(*(FILE **)(g_conf + 0x44),"  MLD version            : v%u\n");
      }
      fprintf(*(FILE **)(g_conf + 0x44),"  Packets received       : %llu\n",puVar7[0x16],
              puVar7[0x17]);
      fprintf(*(FILE **)(g_conf + 0x44),"  Packets sent           : %llu\n",puVar7[0x18],
              puVar7[0x19]);
      fprintf(*(FILE **)(g_conf + 0x44),"  Bytes received         : %llu\n",puVar7[0x1a],
              puVar7[0x1b]);
      fprintf(*(FILE **)(g_conf + 0x44),"  Bytes sent             : %llu\n",puVar7[0x1c],
              puVar7[0x1d]);
      fprintf(*(FILE **)(g_conf + 0x44),"  ICMP\'s received        : %llu\n",puVar7[0x1e],
              puVar7[0x1f]);
      fprintf(*(FILE **)(g_conf + 0x44),"  ICMP\'s sent            : %llu\n",puVar7[0x20],
              puVar7[0x21]);
      fputc(10,*(FILE **)(g_conf + 0x44));
      iVar1 = iVar1 + 1;
    }
    uVar6 = uVar6 + 1;
  }
  fprintf(*(FILE **)(g_conf + 0x44),"*** Interface Dump (end - %u interfaces)\n",iVar1);
  fputc(10,*(FILE **)(g_conf + 0x44));
  __tp = gmtime((time_t *)(g_conf + 0x48));
  strftime(acStack_70,0x2e,"%Y-%m-%d %H:%M:%S",__tp);
  fputs("*** Statistics Dump\n",*(FILE **)(g_conf + 0x44));
  fputc(10,*(FILE **)(g_conf + 0x44));
  fprintf(*(FILE **)(g_conf + 0x44),"Version              : ecmh %s\n","2005.02.09");
  fprintf(*(FILE **)(g_conf + 0x44),"Started              : %s GMT\n",acStack_70);
  fprintf(*(FILE **)(g_conf + 0x44),"Uptime               : %u days %02u:%02u:%02u\n",local_38,
          local_34,local_30,local_40 + local_30 * -0x3c);
  fputc(10,*(FILE **)(g_conf + 0x44));
  fprintf(*(FILE **)(g_conf + 0x44),"Interfaces Monitored : %u\n",iVar1);
  fprintf(*(FILE **)(g_conf + 0x44),"Groups Managed       : %u\n",
          *(undefined4 *)(*(int *)(g_conf + 0xc) + 8));
  fprintf(*(FILE **)(g_conf + 0x44),"Total Subscriptions  : %u\n",iVar8);
  fprintf(*(FILE **)(g_conf + 0x44),"v2 Robustness Factor : %u\n",2);
  fprintf(*(FILE **)(g_conf + 0x44),"Subscription Timeout : %u\n",0xfa);
  fputc(10,*(FILE **)(g_conf + 0x44));
  fprintf(*(FILE **)(g_conf + 0x44),"Packets Received     : %llu\n",*(undefined4 *)(g_conf + 0x50),
          *(undefined4 *)(g_conf + 0x54));
  fprintf(*(FILE **)(g_conf + 0x44),"Packets Sent         : %llu\n",*(undefined4 *)(g_conf + 0x58),
          *(undefined4 *)(g_conf + 0x5c));
  fprintf(*(FILE **)(g_conf + 0x44),"Bytes Received       : %llu\n",*(undefined4 *)(g_conf + 0x60),
          *(undefined4 *)(g_conf + 100));
  fprintf(*(FILE **)(g_conf + 0x44),"Bytes Sent           : %llu\n",*(undefined4 *)(g_conf + 0x68),
          *(undefined4 *)(g_conf + 0x6c));
  fprintf(*(FILE **)(g_conf + 0x44),"ICMP\'s received      : %llu\n",*(undefined4 *)(g_conf + 0x70),
          *(undefined4 *)(g_conf + 0x74));
  fprintf(*(FILE **)(g_conf + 0x44),"ICMP\'s sent          : %llu\n",*(undefined4 *)(g_conf + 0x78),
          *(undefined4 *)(g_conf + 0x7c));
  fprintf(*(FILE **)(g_conf + 0x44),"Hop Limit Exceeded   : %llu\n",*(undefined4 *)(g_conf + 0x80),
          *(undefined4 *)(g_conf + 0x84));
  fputc(10,*(FILE **)(g_conf + 0x44));
  fputs("*** Statistics Dump (end)\n",*(FILE **)(g_conf + 0x44));
  fflush(*(FILE **)(g_conf + 0x44));
  dolog(6,"Dumped statistics into %s\n","/var/run/ecmh.dump");
  signal(param_1,FUN_004014fc)   //possible issue identified - semgrep
  return;
}