undefined4
RTMPSoftDecryptTKIP(int param_1,int param_2,uint param_3,int param_4,byte *param_5,ushort *param_6)

{
  byte bVar1;
  int iVar2;
  undefined1 *__dest;
  char *pcVar3;
  void *pvVar4;
  uint uVar5;
  void *__src;
  uint uVar6;
  int iVar7;
  uint local_188;
  undefined1 auStack_184 [8];
  undefined1 auStack_17c [8];
  undefined1 auStack_174 [8];
  undefined1 auStack_16c [8];
  undefined1 auStack_164 [8];
  undefined1 auStack_15c [16];
  undefined1 auStack_14c [20];
  undefined1 auStack_138 [264];
  uint local_30;
  
  local_30 = param_3 & 0xff;
  local_188 = 0;
  if (*(char *)(param_4 + 0x41) == '\0') {
    if (RTDebugLevel == 0) {
      return 0;
    }
    printk("%s : the key is empty)\n","RTMPSoftDecryptTKIP");
    return 0;
  }
  bVar1 = *(byte *)(param_2 + 1);
  iVar2 = (uint)bVar1 << 0x1e;
  if (((bVar1 & 1) == 0) && (iVar2 < 0)) {
    memmove(auStack_17c,(void *)(param_2 + 4),6)   //possible issue identified - semgrep
    memmove(auStack_184,(void *)(param_2 + 10),6)   //possible issue identified - semgrep
    pvVar4 = (void *)(param_2 + 0x10);
  }
  else {
    if (iVar2 < 0 || (bVar1 & 1) != 0) {
      if ((bVar1 & 1) == 0) {
        uVar5 = (uint)*param_5;
      }
      else {
        __src = (void *)(param_2 + 10);
        __dest = auStack_174;
        pvVar4 = (void *)(param_2 + 0x10);
        if (iVar2 < 0) {
          memmove(auStack_184,__src,6)   //possible issue identified - semgrep
          memmove(auStack_17c,pvVar4,6)   //possible issue identified - semgrep
          pvVar4 = (void *)(param_2 + 0x18);
        }
        else {
          memmove(__dest,__src,6)   //possible issue identified - semgrep
          memmove(auStack_184,__src,6)   //possible issue identified - semgrep
          __dest = auStack_17c;
        }
        memmove(__dest,pvVar4,6)   //possible issue identified - semgrep
        uVar5 = (uint)*param_5;
      }
      goto LAB_0002ebb4;
    }
    pvVar4 = (void *)(param_2 + 10);
    memmove(auStack_17c,(void *)(param_2 + 4),6)   //possible issue identified - semgrep
    memmove(auStack_184,pvVar4,6)   //possible issue identified - semgrep
  }
  memmove(auStack_174,pvVar4,6)   //possible issue identified - semgrep
  uVar5 = (uint)*param_5;
LAB_0002ebb4:
  RTMPTkipMixKey(param_4,auStack_184,(uint)param_5[2] | uVar5 << 8,*(undefined4 *)(param_5 + 4),
                 auStack_15c,auStack_14c);
  uVar6 = (uint)*param_6;
  ARC4_INIT(auStack_138,auStack_15c,0x10);
  ARC4_Compute(auStack_138,param_5 + 8,uVar6 - 8,param_5);
  memmove(&local_188,param_5 + (uVar6 - 0xc),4)   //possible issue identified - semgrep
  uVar5 = RTMP_CALC_FCS32(0xffffffff,param_5,uVar6 - 0xc);
  if (~uVar5 == local_188) {
    iVar7 = uVar6 - 0x14;
    memmove(auStack_164,param_5 + iVar7,8)   //possible issue identified - semgrep
    RTMPInitMICEngine(param_1,param_4,auStack_17c,auStack_174,local_30,param_4 + 0x18);
    RTMPTkipAppend(param_1 + 0x76894,param_5,iVar7);
    RTMPTkipGetMIC(param_1 + 0x76894);
    memmove(auStack_16c,(void *)(param_1 + 0x768c4),8)   //possible issue identified - semgrep
    iVar2 = memcmp(auStack_16c,auStack_164,8);
    if (iVar2 == 0) {
      *param_6 = (ushort)iVar7;
      return 1;
    }
    if (RTDebugLevel == 0) {
      return 0;
    }
    pcVar3 = "! TKIP MIC Error !\n";
  }
  else {
    if (RTDebugLevel == 0) {
      return 0;
    }
    pcVar3 = "! WEP Data CRC Error !\n";
  }
  printk(pcVar3);
  return 0;
}