void FUN_00402594(undefined4 param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5,
                 short param_6)

{
  undefined *puVar1;
  int iVar2;
  size_t sVar3;
  int iVar4;
  uint uVar5;
  FILE *__stream;
  char *pcVar6;
  short *psVar7;
  int iVar8;
  undefined4 *puVar9;
  int iVar10;
  int iVar11;
  int iVar12;
  int iVar13;
  int local_1f0;
  undefined1 auStack_1ec [4];
  undefined1 auStack_1e8 [4];
  undefined1 auStack_1e4 [4];
  undefined1 auStack_1e0 [4];
  undefined4 *local_1dc;
  undefined1 uStack_1d8;
  undefined1 uStack_1d7;
  undefined1 uStack_1d6;
  undefined1 uStack_1d5;
  undefined1 uStack_1d4;
  undefined1 uStack_1d3;
  undefined1 uStack_1d2;
  undefined1 uStack_1d1;
  undefined1 uStack_1d0;
  undefined1 uStack_1cf;
  undefined1 uStack_1ce;
  undefined1 uStack_1cd;
  undefined1 uStack_1cc;
  undefined1 uStack_1cb;
  undefined1 uStack_1ca;
  undefined1 uStack_1c9;
  char acStack_1c8 [16];
  char acStack_1b8 [256];
  int local_b8;
  char *local_b4;
  undefined1 *local_b0;
  undefined1 *local_ac;
  undefined1 *local_a8;
  undefined1 *local_a4;
  undefined1 *local_a0;
  undefined1 *local_9c;
  undefined1 *local_98;
  undefined1 *local_94;
  undefined1 *local_90;
  undefined1 *local_8c;
  undefined1 *local_88;
  undefined1 *local_84;
  undefined1 *local_80;
  undefined1 *local_7c;
  char *local_78;
  undefined1 *local_74;
  undefined1 *local_70;
  undefined1 *local_6c;
  undefined1 *local_68;
  undefined1 *local_64;
  undefined1 *local_60;
  undefined1 *local_5c;
  undefined1 *local_58;
  undefined1 *local_54;
  undefined1 *local_50;
  undefined1 *local_4c;
  undefined1 *local_48;
  undefined1 *local_44;
  undefined1 *local_40;
  int local_3c;
  int *local_38;
  int local_34;
  int *local_30;
  
  iVar13 = param_4 + param_5 + 0x10;
  memset(acStack_1b8,0,0x100)   //possible issue identified - semgrep
  verbose("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n"
         );
  if (param_6 == 1) {
    pcVar6 = "TYPE_A";
  }
  else if (param_6 == 0x1c) {
    pcVar6 = "TYPE_AAAA";
  }
  else {
    pcVar6 = "TYPE_ANY";
  }
  verbose("<< %s: response for %s\n","rrec_process",pcVar6);
  if (param_6 == 0x1c) {
    __stream = fopen(o_ifinet6,"r")   //possible issue identified - semgrep
    if (__stream != (FILE *)0x0) {
      local_b4 = acStack_1b8;
      local_b0 = &uStack_1d8;
      local_ac = &uStack_1d7;
      local_a8 = &uStack_1d6;
      local_a4 = &uStack_1d5;
      local_a0 = &uStack_1d4;
      local_9c = &uStack_1d3;
      local_98 = &uStack_1d2;
      local_94 = &uStack_1d1;
      local_90 = &uStack_1d0;
      local_8c = &uStack_1cf;
      local_88 = &uStack_1ce;
      local_84 = &uStack_1cd;
      local_80 = &uStack_1cc;
      local_7c = &uStack_1cb;
      iVar8 = 0;
      iVar12 = -1;
      iVar10 = 0;
      iVar2 = 0;
      while( true ) {
        pcVar6 = fgets(local_b4,0x100,__stream)   //possible issue identified - semgrep
        if (pcVar6 == (char *)0x0) break;
        iVar11 = sscanf(local_b4,
                        "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx %x %x %x %x %8s"
                        ,local_b0,local_ac,local_a8,local_a4,local_a0,local_9c,local_98,local_94,
                        local_90,local_8c,local_88,local_84,local_80,local_7c,&uStack_1ca,
                        &uStack_1c9,auStack_1ec,auStack_1e8,auStack_1e4,auStack_1e0,acStack_1c8)   //possible issue identified - semgrep
        puVar1 = o_interface;
        if (iVar11 == 0x15) {
          sVar3 = strlen(o_interface);
          iVar11 = strncmp(puVar1,acStack_1c8,sVar3)   //possible issue identified - semgrep
          if (iVar11 == 0) {
            iVar11 = param_5 + 0x1a;
            iVar8 = iVar8 + iVar11;
            if (max_udp_pdu_size < (uint)(param_5 + 0x10 + iVar8)) {
              verbose("<< %s: WARNING, max_udp_pdu_size(%d) exceed! (TYPE_AAAA)\n","rrec_process");
              iVar8 = iVar8 - iVar11;
              break;
            }
            uVar5 = ((*(ushort *)(param_4 + 6) & 0xff) << 8 | (uint)(*(ushort *)(param_4 + 6) >> 8))
                    + 1 & 0xffff;
            *(ushort *)(param_4 + 6) = (ushort)(uVar5 << 8) | (ushort)(uVar5 >> 8);
            iVar13 = iVar13 + iVar2;
            *(ushort *)(param_4 + 2) = *(ushort *)(param_4 + 2) & 0xff7f | 0x80;
            FUN_00402480(param_4,param_5,iVar13,local_b0,0x10,0x1c);
            memset(local_b4,0,0x100)   //possible issue identified - semgrep
            iVar10 = iVar10 + 1;
            iVar12 = 0;
            iVar2 = iVar11;
          }
        }
        else {
          verbose("<< %s: WARNING, %s has a broken line, ignoring","rrec_process",o_ifinet6);
        }
      }
      goto LAB_00403088;
    }
    verbose("<< %s: Couldn\'t open %s to get ipv6 address\n","rrec_process",o_ifinet6);
  }
  else {
    if (param_6 == 0xff) {
      iVar2 = getifaddrs(&local_1dc);
      if (iVar2 == -1) {
        verbose("<< %s: can\'t get all interface address via getifaddrs()\n","rrec_process");
        iVar11 = 0;
        iVar8 = 0;
        iVar12 = -1;
        iVar10 = 0;
      }
      else {
        local_3c = param_5 + 0xe;
        iVar2 = 0;
        iVar8 = 0;
        iVar12 = -1;
        iVar10 = 0;
        local_38 = &local_1f0;
        for (puVar9 = local_1dc; puVar1 = o_interface, iVar11 = iVar2, puVar9 != (undefined4 *)0x0;
            puVar9 = (undefined4 *)*puVar9) {
          psVar7 = (short *)puVar9[3];
          if ((psVar7 != (short *)0x0) && (*psVar7 == 2)) {
            sVar3 = strlen(o_interface);
            iVar4 = strncmp((char *)puVar9[1],puVar1,sVar3)   //possible issue identified - semgrep
            iVar11 = local_3c;
            if ((iVar4 == 0) && (local_1f0 = *(int *)(psVar7 + 2), local_1f0 != 0)) {
              iVar13 = iVar13 + iVar2;
              iVar8 = iVar8 + local_3c;
              if (max_udp_pdu_size < (uint)(param_5 + 0x10 + iVar8)) {
                verbose("<< %s: max_udp_pdu_size(%d) exceed! (TYPE_A)\n","rrec_process",
                        max_udp_pdu_size);
                iVar8 = iVar8 - iVar11;
                break;
              }
              iVar10 = iVar10 + 1;
              uVar5 = ((*(ushort *)(param_4 + 6) & 0xff) << 8 |
                      (uint)(*(ushort *)(param_4 + 6) >> 8)) + 1 & 0xffff;
              *(ushort *)(param_4 + 6) = (ushort)(uVar5 << 8) | (ushort)(uVar5 >> 8);
              *(ushort *)(param_4 + 2) = *(ushort *)(param_4 + 2) | 0x80;
              FUN_00402480(param_4,param_5,iVar13,local_38,4,0xff);
              iVar12 = 0;
              iVar2 = iVar11;
            }
          }
        }
        freeifaddrs(local_1dc);
      }
      __stream = fopen(o_ifinet6,"r")   //possible issue identified - semgrep
      if (__stream == (FILE *)0x0) {
        verbose("<< %s: Couldn\'t open %s to get ipv6 address\n","rrec_process",o_ifinet6);
        goto LAB_00402fe4;
      }
      local_78 = acStack_1b8;
      local_74 = &uStack_1d8;
      local_70 = &uStack_1d7;
      local_6c = &uStack_1d6;
      local_68 = &uStack_1d5;
      local_64 = &uStack_1d4;
      local_60 = &uStack_1d3;
      local_5c = &uStack_1d2;
      local_58 = &uStack_1d1;
      local_54 = &uStack_1d0;
      local_50 = &uStack_1cf;
      local_4c = &uStack_1ce;
      local_48 = &uStack_1cd;
      local_44 = &uStack_1cc;
      local_40 = &uStack_1cb;
      while( true ) {
        pcVar6 = fgets(local_78,0x100,__stream)   //possible issue identified - semgrep
        if (pcVar6 == (char *)0x0) break;
        iVar2 = sscanf(local_78,
                       "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx %x %x %x %x %8s"
                       ,local_74,local_70,local_6c,local_68,local_64,local_60,local_5c,local_58,
                       local_54,local_50,local_4c,local_48,local_44,local_40,&uStack_1ca,&uStack_1c9
                       ,auStack_1ec,auStack_1e8,auStack_1e4,auStack_1e0,acStack_1c8)   //possible issue identified - semgrep
        puVar1 = o_interface;
        if (iVar2 == 0x15) {
          sVar3 = strlen(o_interface);
          iVar2 = strncmp(puVar1,acStack_1c8,sVar3)   //possible issue identified - semgrep
          if (iVar2 == 0) {
            iVar2 = param_5 + 0x1a;
            iVar8 = iVar8 + iVar2;
            if (max_udp_pdu_size < (uint)(param_5 + 0x10 + iVar8)) {
              verbose("<< %s: WARNING, max_udp_pdu_size(%d) exceed! (TYPE_AAAA)\n","rrec_process");
              iVar8 = iVar8 - iVar2;
              break;
            }
            uVar5 = ((*(ushort *)(param_4 + 6) & 0xff) << 8 | (uint)(*(ushort *)(param_4 + 6) >> 8))
                    + 1 & 0xffff;
            iVar13 = iVar13 + iVar11;
            *(ushort *)(param_4 + 2) = *(ushort *)(param_4 + 2) & 0xff7f | 0x80;
            *(ushort *)(param_4 + 6) = (ushort)(uVar5 << 8) | (ushort)(uVar5 >> 8);
            FUN_00402480(param_4,param_5,iVar13,local_74,0,0x1c);
            memset(local_78,0,0x100)   //possible issue identified - semgrep
            iVar10 = iVar10 + 1;
            iVar12 = 0;
            iVar11 = iVar2;
          }
        }
        else {
          verbose("<< %s: WARNING, %s has a broken line, ignoring","rrec_process",o_ifinet6);
        }
      }
LAB_00403088:
      fclose(__stream);
      goto LAB_00402fe4;
    }
    if (param_6 == 1) {
      iVar2 = getifaddrs(&local_1dc);
      if (iVar2 != -1) {
        local_34 = param_5 + 0x10;
        iVar8 = 0;
        iVar12 = -1;
        iVar10 = 0;
        iVar11 = param_5 + 0xe;
        iVar2 = 0;
        local_30 = &local_1f0;
        for (puVar9 = local_1dc; puVar1 = o_interface, puVar9 != (undefined4 *)0x0;
            puVar9 = (undefined4 *)*puVar9) {
          psVar7 = (short *)puVar9[3];
          local_b8 = iVar2;
          if ((psVar7 != (short *)0x0) && (*psVar7 == 2)) {
            sVar3 = strlen(o_interface);
            iVar4 = strncmp((char *)puVar9[1],puVar1,sVar3)   //possible issue identified - semgrep
            if ((iVar4 == 0) && (local_1f0 = *(int *)(psVar7 + 2), local_1f0 != 0)) {
              iVar8 = iVar8 + iVar11;
              iVar13 = iVar13 + iVar2;
              local_b8 = iVar11;
              if (max_udp_pdu_size < (uint)(local_34 + iVar8)) {
                verbose("<< %s: max_udp_pdu_size(%d) exceed! (TYPE_A)\n","rrec_process",
                        max_udp_pdu_size);
                iVar8 = iVar8 - iVar11;
                break;
              }
              iVar10 = iVar10 + 1;
              uVar5 = ((*(ushort *)(param_4 + 6) & 0xff) << 8 |
                      (uint)(*(ushort *)(param_4 + 6) >> 8)) + 1 & 0xffff;
              *(ushort *)(param_4 + 6) = (ushort)(uVar5 << 8) | (ushort)(uVar5 >> 8);
              *(ushort *)(param_4 + 2) = *(ushort *)(param_4 + 2) | 0x80;
              FUN_00402480(param_4,param_5,iVar13,local_30,4,1);
              iVar12 = 0;
            }
          }
          iVar2 = local_b8;
        }
        freeifaddrs(local_1dc);
        goto LAB_00402fe4;
      }
      verbose("<< %s: can\'t get all interface address via getifaddrs()\n","rrec_process");
    }
  }
  iVar8 = 0;
  iVar12 = -1;
  iVar10 = 0;
LAB_00402fe4:
  verbose("<< %s: send=%d, total_append_len=%d, number of rrec=%d\n","rrec_process",iVar12,iVar8,
          iVar10);
  if (((iVar12 == 0) && (0 < iVar8)) && ((uint)(param_5 + 0x10 + iVar8) <= max_udp_pdu_size)) {
    llmnresp_send(param_1,param_2,param_3,param_4,param_5,iVar8);
  }
  return;
}