/* WARNING: Restarted to delay deadcode elimination for space: register */

void RtmpDrvSendWirelessEvent(int param_1,uint param_2,byte *param_3,uint param_4,char param_5)

{
  int iVar1;
  code *pcVar2;
  char *pcVar3;
  undefined4 uVar4;
  char *pcVar5;
  undefined4 uVar6;
  uint uVar7;
  uint uVar8;
  char *local_38;
  undefined2 local_34;
  undefined1 auStack_32 [18];
  
  uVar8 = param_2 & 0xffff;
  param_4 = param_4 & 0xff;
  local_38 = (char *)0x0;
  if (*(char *)(param_1 + 0x16e11) == '\0') {
    return;
  }
  uVar7 = param_2 & 0xff00;
  if (uVar7 != 0x200) {
    if (RTDebugLevel == 0) {
      return;
    }
    pcVar3 = "%s : The type(%0x02x) is not valid.\n";
LAB_000906ec:
    printk(pcVar3,"RtmpDrvSendWirelessEvent",uVar7);
    return;
  }
  uVar7 = param_2 & 0xff;
  if (0x1b < uVar7) {
    if (RTDebugLevel == 0) {
      return;
    }
    pcVar3 = "%s : The event(%0x02x) is not valid.\n";
    goto LAB_000906ec;
  }
  if (uVar8 == 0x200) {
    memset(&local_34,0,0x10)   //possible issue identified - semgrep
    memcpy(auStack_32,param_3,6)   //possible issue identified - semgrep
    local_34 = 1;
    if (2 < RTDebugLevel) {
      printk("%s : IWEVREGISTERED - BssIdx=[%d].\n","RtmpDrvSendWirelessEvent",param_4);
    }
    uVar6 = 0x8c03;
    uVar4 = *(undefined4 *)(param_4 * 0x1140 + param_1 + 0x51d8);
  }
  else {
    if ((uVar8 < 0x200) || (0x203 < uVar8)) goto LAB_00090838;
    memset(&local_34,0,0x10)   //possible issue identified - semgrep
    memcpy(auStack_32,param_3,6)   //possible issue identified - semgrep
    local_34 = 1;
    if (2 < RTDebugLevel) {
      printk("%s : IWEVEXPIRED - BssIdx=[%d].\n","RtmpDrvSendWirelessEvent",param_4);
    }
    uVar6 = 0x8c04;
    uVar4 = *(undefined4 *)(param_4 * 0x1140 + param_1 + 0x51d8);
  }
  wireless_send_event(uVar4,uVar6,&local_34,0);
LAB_00090838:
  os_alloc_mem(0,&local_38,0xff);
  if (local_38 == (char *)0x0) {
    if (RTDebugLevel == 0) {
      return;
    }
    pcVar5 = "%s : Can\'t allocate memory for wireless event.\n";
    pcVar3 = "RtmpDrvSendWirelessEvent";
    pcVar2 = printk;
  }
  else {
    memset(local_38,0,0xff)   //possible issue identified - semgrep
    pcVar3 = local_38;
    if (param_3 == (byte *)0x0) {
      if (param_4 == 0) {
        iVar1 = sprintf(local_38,"(RT2860) BSS(ra%d) ",0)   //possible issue identified - semgrep
        pcVar3 = pcVar3 + iVar1;
      }
      else {
        iVar1 = sprintf(local_38,"(RT2860) ")   //possible issue identified - semgrep
        pcVar3 = pcVar3 + iVar1;
      }
    }
    else {
      iVar1 = sprintf(local_38,"(RT2860) STA(%02x:%02x:%02x:%02x:%02x:%02x) ",(uint)*param_3,
                      (uint)param_3[1],(uint)param_3[2],(uint)param_3[3],(uint)param_3[4],
                      (uint)param_3[5])   //possible issue identified - semgrep
      pcVar3 = pcVar3 + iVar1;
    }
    iVar1 = sprintf(pcVar3,"%s",*(undefined4 *)(pWirelessSysEventText + uVar7 * 4))   //possible issue identified - semgrep
    pcVar3 = pcVar3 + iVar1;
    if (uVar8 == 0x213) {
      iVar1 = sprintf(pcVar3,"%3d",(int)param_5)   //possible issue identified - semgrep
      pcVar3 = pcVar3 + iVar1;
    }
    *(undefined1 *)((int)pcVar3 * 2 - (int)local_38) = 0;
    RtmpOSWrielessEventSend
              (*(undefined4 *)(param_1 + 4),1,uVar8,0,local_38,(int)pcVar3 - (int)local_38 & 0xffff)   //possible issue identified - semgrep
    ;
    pcVar5 = (char *)0x0;
    pcVar2 = os_free_mem;
    pcVar3 = local_38;
  }
  (*pcVar2)(pcVar5,pcVar3);
  return;
}