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

void RTMPAddPMKIDCache(int param_1,int param_2,undefined1 *param_3,void *param_4,void *param_5)

{
  undefined1 uVar1;
  undefined1 uVar2;
  undefined1 uVar3;
  undefined1 uVar4;
  undefined1 uVar5;
  undefined1 uVar6;
  char cVar7;
  int iVar8;
  int iVar9;
  char *pcVar10;
  uint uVar11;
  int iVar12;
  int iVar13;
  char *pcVar14;
  
  iVar8 = RTMPSearchPMKIDCache();
  if (iVar8 == -1) {
    iVar8 = 0;
    pcVar14 = (char *)(param_2 * 0x1140 + param_1 + 0x555c);
    cVar7 = *pcVar14;
    pcVar10 = pcVar14;
    while (pcVar10 = pcVar10 + 0x40, cVar7 != '\0') {
      iVar8 = iVar8 + 1;
      if (iVar8 == 8) goto LAB_000779d0;
      cVar7 = *pcVar10;
    }
    iVar13 = param_2 * 0x45 + iVar8;
    iVar12 = iVar13 * 0x40;
    iVar9 = param_1 + iVar12;
    *(undefined1 *)(iVar9 + 0x555c) = 1;
    *(undefined4 *)(iVar9 + 0x5558) = _jiffies;
    iVar9 = param_1 + iVar12 + 0x5518;
    memcpy((void *)(iVar9 + 8),param_3,6)   //possible issue identified - semgrep
    memmove((void *)(iVar9 + 0xe),param_4,0x10)   //possible issue identified - semgrep
    memmove((void *)(param_1 + iVar13 * 0x40 + 0x5536),param_5,0x20)   //possible issue identified - semgrep
    if (2 < RTDebugLevel) {
      printk("RTMPAddPMKIDCache add %02x:%02x:%02x:%02x:%02x:%02x cache(%d) from IF(ra%d)\n",
             *param_3,param_3[1],param_3[2],param_3[3],param_3[4],param_3[5],iVar8,param_2);
    }
    if (iVar8 != 8) {
      return;
    }
LAB_000779d0:
    if (2 < RTDebugLevel) {
      printk("RTMPAddPMKIDCache(IF(%d) Cache full\n",param_2);
    }
    uVar11 = 0;
    iVar8 = 0;
    iVar9 = 0;
    do {
      if (*pcVar14 != '\0') {
        if (uVar11 == 0 && iVar8 == 0) {
          uVar11 = *(uint *)(pcVar14 + -4);
          iVar8 = iVar9;
        }
        else if ((uVar11 != 0) && (uVar11 < *(uint *)(pcVar14 + -4))) {
          uVar11 = *(uint *)(pcVar14 + -4);
          iVar8 = iVar9;
        }
      }
      iVar9 = iVar9 + 1;
      pcVar14 = pcVar14 + 0x40;
    } while (iVar9 != 8);
    iVar13 = param_2 * 0x45 + iVar8;
    iVar12 = iVar13 * 0x40;
    iVar9 = param_1 + iVar12;
    *(undefined1 *)(iVar9 + 0x555c) = 1;
    *(undefined4 *)(iVar9 + 0x5558) = _jiffies;
    iVar9 = param_1 + iVar12 + 0x5518;
    memcpy((void *)(iVar9 + 8),param_3,6)   //possible issue identified - semgrep
    memmove((void *)(iVar9 + 0xe),param_4,0x10)   //possible issue identified - semgrep
    memmove((void *)(param_1 + iVar13 * 0x40 + 0x5536),param_5,0x20)   //possible issue identified - semgrep
    if (RTDebugLevel < 3) {
      return;
    }
    uVar1 = *param_3;
    uVar2 = param_3[1];
    uVar3 = param_3[2];
    uVar4 = param_3[5];
    uVar5 = param_3[3];
    uVar6 = param_3[4];
    pcVar10 = "RTMPAddPMKIDCache add %02x:%02x:%02x:%02x:%02x:%02x cache(%ld) from IF(ra%d)\n";
  }
  else {
    iVar12 = param_2 * 0x45 + iVar8;
    iVar9 = param_1 + iVar12 * 0x40;
    *(undefined4 *)(iVar9 + 0x5558) = _jiffies;
    memmove((void *)(iVar9 + 0x5526),param_4,0x10)   //possible issue identified - semgrep
    memmove((void *)(param_1 + iVar12 * 0x40 + 0x5536),param_5,0x20)   //possible issue identified - semgrep
    if (RTDebugLevel < 3) {
      return;
    }
    uVar1 = *param_3;
    uVar2 = param_3[1];
    uVar3 = param_3[2];
    uVar4 = param_3[5];
    uVar5 = param_3[3];
    uVar6 = param_3[4];
    pcVar10 = "RTMPAddPMKIDCache update %02x:%02x:%02x:%02x:%02x:%02x cache(%d) from IF(ra%d)\n";
  }
  printk(pcVar10,uVar1,uVar2,uVar3,uVar5,uVar6,uVar4,iVar8,param_2);
  return;
}