void WPAStart4WayHS(int param_1,int *param_2,undefined4 param_3)

{
  void *pvVar1;
  char cVar2;
  uint uVar3;
  int iVar4;
  char *pcVar5;
  char *pcVar6;
  uint uVar7;
  void *__src;
  void *local_40;
  undefined1 auStack_3c [6];
  undefined1 auStack_36 [6];
  undefined1 auStack_30 [12];
  
  if (2 < RTDebugLevel) {
    printk("===> WPAStart4WayHS\n");
  }
  if ((*(uint *)(param_1 + 0x76904) & 0xc0) == 0) {
    if ((param_2 == (int *)0x0) || (*param_2 != 1)) {
      if (RTDebugLevel == 0) {
        return;
      }
      pcVar5 = "[ERROR]WPAStart4WayHS : The entry doesn\'t exist.\n";
    }
    else {
      pcVar5 = (char *)(uint)*(byte *)((int)param_2 + 0x31);
      if ((char *)(uint)*(byte *)(param_1 + 0x51aa) <= pcVar5) {
        if (RTDebugLevel == 0) {
          return;
        }
        pcVar6 = "[ERROR]WPAStart4WayHS : The apidx(%d) is invalid.\n";
LAB_00044488:
        printk(pcVar6,pcVar5);
        return;
      }
      iVar4 = param_1 + (int)pcVar5 * 0x1140;
      __src = (void *)(iVar4 + 0x51ac);
      uVar7 = *(uint *)(iVar4 + 0x51e4);
      if (__src == (void *)0x0) {
        if (RTDebugLevel == 0) {
          return;
        }
        pcVar5 = "[ERROR]WPAStart4WayHS : No corresponding Authenticator.\n";
      }
      else if ((byte)((char)param_2[0x7c] - 6U) < 3) {
        uVar3 = 7;
        do {
          uVar3 = uVar3 & 0xff;
          cVar2 = *(char *)((int)param_2 + uVar3 + 0x172) + '\x01'   //possible issue identified - semgrep
          *(char *)((int)param_2 + uVar3 + 0x172) = cVar2;
          if (uVar3 == 0) break;
          uVar3 = uVar3 - 1;
        } while (cVar2 == '\0');
        GenRandom(param_1,__src,(int)param_2 + 0x132);
        os_alloc_mem(0,&local_40,0x5dc);
        pvVar1 = local_40;
        if (local_40 == (void *)0x0) {
          if (RTDebugLevel == 0) {
            return;
          }
          pcVar6 = "!!!%s : no memory!!!\n";
          pcVar5 = "WPAStart4WayHS";
          goto LAB_00044488;
        }
        memset(local_40,0,0x5dc)   //possible issue identified - semgrep
        ConstructEapolMsg(param_2,uVar7 & 0xff,1,0,(int)param_2 + 0x132,0,0,0,0,pvVar1);
        if ((param_2[0x79] == 6) && (param_2[0x90] != 0xff)) {
          *(undefined1 *)((int)pvVar1 + 99) = 0xdd;
          *(undefined1 *)((int)pvVar1 + 0x66) = 0xf;
          *(undefined1 *)((int)pvVar1 + 0x67) = 0xac;
          *(undefined1 *)((int)pvVar1 + 0x68) = 4;
          *(undefined1 *)((int)pvVar1 + 0x65) = 0;
          memmove((void *)((int)pvVar1 + 0x69),
                  (void *)(param_1 + ((int)pcVar5 * 0x45 + param_2[0x90]) * 0x40 + 0x5526),0x10)   //possible issue identified - semgrep
          memmove((void *)((int)pcVar5 * 0x1140 + param_1 + 0x5275),
                  (void *)(param_1 + ((int)pcVar5 * 0x45 + param_2[0x90]) * 0x40 + 0x5536),0x20)   //possible issue identified - semgrep
          uVar7 = CONCAT11(*(undefined1 *)((int)pvVar1 + 0x61),*(undefined1 *)((int)pvVar1 + 0x62))
                  + 0x16 & 0xffff;
          uVar3 = CONCAT11(*(undefined1 *)((int)pvVar1 + 2),*(undefined1 *)((int)pvVar1 + 3)) + 0x16
                  & 0xffff;
          *(undefined1 *)((int)pvVar1 + 100) = 0x14;
          *(char *)((int)pvVar1 + 0x61) = (char)(uVar7 >> 8);
          *(char *)((int)pvVar1 + 0x62) = (char)uVar7;
          *(char *)((int)pvVar1 + 2) = (char)(uVar3 >> 8);
          *(char *)((int)pvVar1 + 3) = (char)uVar3;
        }
        memmove(auStack_3c,param_2 + 0x96,6)   //possible issue identified - semgrep
        memmove(auStack_36,__src,6)   //possible issue identified - semgrep
        memmove(auStack_30,&EAPOL,2)   //possible issue identified - semgrep
        RTMPToWirelessSta(param_1,param_2,auStack_3c,0xe,pvVar1,
                          CONCAT11(*(undefined1 *)((int)pvVar1 + 2),*(undefined1 *)((int)pvVar1 + 3)
                                  ) + 4,*(short *)((int)param_2 + 0x1f2) != 1);
        RTMPModTimer(param_2 + 0x6f,param_3);
        *(undefined1 *)(param_2 + 0x7c) = 8;
        os_free_mem(0,local_40);
        if (RTDebugLevel < 3) {
          return;
        }
        pcVar5 = "<=== WPAStart4WayHS: send Msg1 of 4-way \n";
      }
      else {
        if (RTDebugLevel == 0) {
          return;
        }
        pcVar5 = "[ERROR]WPAStart4WayHS : Not expect calling\n";
      }
    }
  }
  else {
    if (RTDebugLevel == 0) {
      return;
    }
    pcVar5 = "[ERROR]WPAStart4WayHS : The interface is closed...\n";
  }
  printk(pcVar5);
  return;
}