clean up the following decompiled C code. use context clues to properly name variables. 
/* WARNING: Function: _guard_dispatch_icall replaced with injection: guard_dispatch_icall */
/* WARNING: Type propagation algorithm not settling */

void IppReceiveHeaderBatch(longlong param_1,undefined8 *param_2)

{
  longlong *plVar1;
  undefined8 *puVar2;
  longlong ********pppppppplVar3;
  longlong ********pppppppplVar4;
  longlong ******pppppplVar5;
  undefined8 *puVar6;
  char cVar7;
  int iVar8;
  int iVar9;
  char *pcVar10;
  longlong *******ppppppplVar11;
  longlong lVar12;
  longlong ********pppppppplVar13;
  undefined **ppuVar14;
  uint uVar15;
  longlong ******pppppplVar16;
  ulonglong uVar17;
  ulonglong uVar18;
  longlong unaff_GS_OFFSET;
  undefined auStack_f8 [32];
  undefined8 local_d8;
  longlong *******local_d0;
  longlong *******local_c8;
  longlong ********local_c0;
  uint local_b8;
  longlong ********local_b0;
  longlong ********local_a8;
  longlong *******local_a0;
  longlong ********local_98;
  longlong *******local_90;
  longlong ********local_88;
  longlong ********local_80;
  longlong ********local_78;
  longlong local_70;
  longlong *******local_68;
  longlong *****local_60;
  undefined local_58 [16];
  ulonglong local_48;
  
  local_48 = __security_cookie ^ (ulonglong)auStack_f8;
  uVar17 = 0;
  local_a8 = (longlong ********)&local_b0;
  local_98 = &local_a0;
  local_78 = (longlong ********)&local_80;
  local_c0 = &local_c8;
  local_b0 = (longlong ********)0x0;
  local_a0 = (longlong *******)0x0;
  local_80 = (longlong ********)0x0;
  local_c8 = (longlong *******)0x0;
  puVar6 = (undefined8 *)*param_2;
  while (pppppppplVar3 = local_b0, puVar6 != (undefined8 *)0x0) {
    puVar2 = (undefined8 *)*puVar6;
    local_d0 = (longlong *******)&local_c8;
    local_d8 = (longlong ********)&local_80;
    *puVar6 = 0;
    IppReceiveHeadersHelper(puVar6,param_1,&local_b0,&local_a0);
    puVar6 = puVar2;
  }
joined_r0x0001c00443af:
  do {
    if (pppppppplVar3 == (longlong ********)0x0) break;
    ppppppplVar11 = pppppppplVar3[1];
    if ((ppppppplVar11 != (longlong *******)0x0) &&
       (*(int *)((longlong)ppppppplVar11 + 0x8c) == 0x105)) {
      iVar9 = *(int *)((longlong)pppppppplVar3 + 0x2c);
      if ((iVar9 == 0x11) && (*(short *)(*(longlong *)(param_1 + 0x10) + 4) == 2)) {
        pppppplVar16 = ppppppplVar11[1];
        local_68 = (longlong *******)0x0;
        local_b8 = 0;
        local_d8 = (longlong ********)((ulonglong)local_d8 & 0xffffffff00000000);
        local_70 = NdisGetDataBuffer(pppppplVar16,8,0,1);
        if ((local_70 != 0) && (*(short *)(local_70 + 2) != -0x6bef)) goto LAB_1c0044481;
        local_d0 = (longlong *******)&local_b8;
        local_d8 = &local_68;
        iVar8 = IppDecomposeUdpPacket(pppppplVar16,local_58);
        if ((iVar8 < 0) ||
           ((*(short *)(local_70 + 2) != -0x6bef || ((3 < local_b8 && (*(int *)local_68 == 0))))))
        goto LAB_1c0044481;
        ppuVar14 = &PTR_IppReceiveUdpEspList_1c0200508;
        pcVar10 = &DAT_1c0200530;
      }
      else {
LAB_1c0044481:
        ppuVar14 = (undefined **)(param_1 + 0x1f8 + (longlong)iVar9 * 0x48);
        pcVar10 = (char *)(param_1 + 0x220 + (longlong)iVar9 * 0x48);
      }
      if (*pcVar10 != '\0') {
        (*(code *)*ppuVar14)(pppppppplVar3);
        goto joined_r0x0001c00443af;
      }
      IppValidateHeaderChain(param_1,pppppppplVar3);
    }
    pppppppplVar3 = (longlong ********)*pppppppplVar3;
  } while( true );
  local_88 = &local_90;
  local_90 = (longlong *******)0x0;
  uVar18 = uVar17;
  do {
    while( true ) {
      pppppppplVar3 = local_b0;
      if (local_b0 == (longlong ********)0x0) {
        if (local_90 != (longlong *******)0x0) {
          local_d0 = (longlong *******)&local_c8;
          local_d8 = (longlong ********)&local_80;
          IppProcessDeliverList(param_1,uVar18,&local_90,&local_a0);
        }
        ppppppplVar11 = local_c8;
        if (local_a0 != (longlong *******)0x0) {
          local_d0 = (longlong *******)&local_c8;
          local_d8 = (longlong ********)&local_80;
          IppProcessDeliverList(param_1,0x101,&local_a0,0);
          ppppppplVar11 = local_c8;
        }
        for (; ppppppplVar11 != (longlong *******)0x0;
            ppppppplVar11 = (longlong *******)*ppppppplVar11) {
          uVar17 = (ulonglong)((int)uVar17 + 1);
        }
        plVar1 = (longlong *)
                 ((ulonglong)*(uint *)(unaff_GS_OFFSET + 0x1a4) * 0xc0 +
                  *(longlong *)(param_1 + 0x4f60) + 0x18);
        *plVar1 = *plVar1 + uVar17;
        ppppppplVar11 = local_c8;
        pppppppplVar3 = local_80;
        while (local_c8 = ppppppplVar11, pppppppplVar3 != (longlong ********)0x0) {
          pppppppplVar4 = (longlong ********)*pppppppplVar3;
          *pppppppplVar3 = (longlong *******)0x0;
          *(undefined4 *)((longlong)pppppppplVar3[1] + 0x8c) = 0;
          uVar17 = (ulonglong)local_d8 >> 0x20;
          local_d8 = (longlong ********)
                     CONCAT44((int)uVar17,*(undefined4 *)((longlong)pppppppplVar3 + 300));
          IppSendErrorListForDiscardReason
                    (0,param_1,pppppppplVar3,*(undefined4 *)(pppppppplVar3 + 0x25));
          if (pppppppplVar3[1] != (longlong *******)0x0) {
            *(undefined4 *)((longlong)pppppppplVar3[1] + 0x8c) = 0;
          }
          *local_c0 = (longlong *******)pppppppplVar3;
          ppppppplVar11 = local_c8;
          local_c0 = pppppppplVar3;
          pppppppplVar3 = pppppppplVar4;
        }
        if (ppppppplVar11 != (longlong *******)0x0) {
          local_60 = (longlong *****)0x0;
          pppppplVar16 = &local_60;
          do {
            pppppplVar5 = ppppppplVar11[1];
            ppppppplVar11 = (longlong *******)*ppppppplVar11;
            if (pppppplVar5 != (longlong ******)0x0) {
              *pppppplVar16 = (longlong *****)pppppplVar5;
              pppppplVar16 = pppppplVar5;
            }
            IppFreePacket();
          } while (ppppppplVar11 != (longlong *******)0x0);
          if (local_60 != (longlong *****)0x0) {
            NetioDereferenceNetBufferListChain(local_60,0);
          }
        }
        __security_check_cookie(local_48 ^ (ulonglong)auStack_f8);
        return;
      }
      pppppppplVar4 = (longlong ********)*local_b0;
      *local_b0 = (longlong *******)0x0;
      pppppppplVar13 = (longlong ********)&local_b0;
      if (local_a8 != local_b0) {
        pppppppplVar13 = local_a8;
      }
      ppppppplVar11 = local_b0[1];
      local_a8 = pppppppplVar13;
      if (ppppppplVar11 != (longlong *******)0x0) break;
LAB_1c004451e:
      *local_c0 = (longlong *******)local_b0;
      local_b0 = pppppppplVar4;
      local_c0 = pppppppplVar3;
    }
    if ((*(int *)((longlong)ppppppplVar11 + 0x8c) != 0x105) &&
       (*(int *)((longlong)ppppppplVar11 + 0x8c) != -0x3ffffdc2)) {
      *(undefined4 *)((longlong)ppppppplVar11 + 0x8c) = 0;
      goto LAB_1c004451e;
    }
    *(undefined4 *)((longlong)ppppppplVar11 + 0x8c) = 0;
    *(undefined *)((longlong)local_b0 + 0x11) = 0;
    if ((*(byte *)(local_b0 + 0x16) & 4) == 0) {
      pppppppplVar13 = local_b0 + 0x1a;
      pppppplVar16 = (*pppppppplVar13)[1];
      if (((*(int *)(pppppplVar16 + 0x36) != 0) ||
          ((local_b0 = pppppppplVar4, *(int *)(*pppppppplVar13 + 3) == 3 &&
           (*(int *)(pppppplVar16 + 0x37) != 0)))) &&
         (local_b0 = pppppppplVar4,
         ppppppplVar11 = (longlong *******)IppCreateClonePacketForRaw(pppppppplVar3,param_1,0),
         ppppppplVar11 != (longlong *******)0x0)) {
        *(byte *)(ppppppplVar11 + 0x16) = *(byte *)(ppppppplVar11 + 0x16) | 4;
        *(undefined4 *)((longlong)ppppppplVar11[1] + 0x8c) = 0xc000023e;
        pppppppplVar3[0x24] = ppppppplVar11;
      }
      ppppppplVar11 = pppppppplVar3[1];
      uVar15 = *(uint *)((longlong)pppppppplVar3 + 0x2c);
      lVar12 = WfpNblInfoGet(ppppppplVar11);
      if ((((lVar12 != 0) && (lVar12 != *(longlong *)MmBadPointer_exref)) &&
          (lVar12 = *(longlong *)(lVar12 + 0x18), lVar12 != 0)) &&
         ((iVar9 = IPSecIsOutboundContextTunnel(lVar12), iVar9 != 0 &&
          (cVar7 = IPSecPacketIsContextRcvPass1(ppppppplVar11), cVar7 != '\0')))) {
        *(uint *)(lVar12 + 0x1e0) = uVar15;
        uVar15 = 0x102;
      }
      if (uVar15 != (uint)uVar18) {
        if (local_90 != (longlong *******)0x0) {
          local_d0 = (longlong *******)&local_c8;
          local_d8 = (longlong ********)&local_80;
          IppProcessDeliverList(param_1,uVar18,&local_90,&local_a0);
        }
        uVar18 = (ulonglong)uVar15;
      }
      *(undefined4 *)(pppppppplVar3 + 0x27) = *(undefined4 *)(pppppppplVar3 + 6);
      *local_88 = (longlong *******)pppppppplVar3;
      local_88 = pppppppplVar3;
    }
    else {
      *(undefined4 *)((longlong)local_b0[1] + 0x8c) = 0xc000023e;
      *local_98 = (longlong *******)local_b0;
      local_b0 = pppppppplVar4;
      local_98 = pppppppplVar3;
    }
  } while( true );
}