void AP_AMPDU_Frame_Tx(int param_1,byte *param_2)

{
  char cVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  byte bVar5;
  int *piVar6;
  int iVar7;
  byte bVar8;
  uint uVar9;
  undefined4 uVar10;
  void *__src;
  byte *pbVar11;
  byte *__s;
  void *__dest;
  undefined2 local_28 [4];
  
  local_28[0] = 1;
  if (param_2 == (byte *)0x0) {
    printk("<4>/home/eric/release/dir600b5/progs.priv/rt2860v2/build/rt2860v2_ap/../rt2860v2/ap/ap_data.c:%d assert pTxBlkfailed\n"
           ,0x45d);
  }
  piVar6 = *(int **)(param_2 + 8);
  if (piVar6 != (int *)0x0) {
    iVar2 = *piVar6;
    *piVar6 = 0;
    *(int *)(param_2 + 8) = iVar2;
    if (iVar2 == 0) {
      param_2[0xc] = 0;
      param_2[0xd] = 0;
      param_2[0xe] = 0;
      param_2[0xf] = 0;
    }
    *(int *)(param_2 + 0x10) = *(int *)(param_2 + 0x10) + -1;
  }
  *(int **)(param_2 + 0x1c) = piVar6;
  iVar2 = RTMP_FillTxBlkInfo(param_1,param_2);
  if (iVar2 != 1) {
    iVar2 = *(int *)(param_2 + 0xd0);
    if (iVar2 == 0) {
      uVar10 = *(undefined4 *)(param_2 + 0x1c);
    }
    else {
      *(int *)(iVar2 + 0x78) = *(int *)(iVar2 + 0x78) + 1;
      uVar10 = *(undefined4 *)(param_2 + 0x1c);
    }
    RTMPFreeNdisPacket(param_1,uVar10);
    return;
  }
  iVar2 = *(int *)(param_2 + 0x14);
  if (*(char *)(iVar2 + 4) == '\0') {
    uVar9 = (uint)param_2[0xb6];
    if ((*(byte *)(*(int *)(param_2 + 0x1c) + 0x2d) & 2) != 0) {
LAB_0007ce0c:
      uVar4 = *(uint *)(param_2 + 200);
      goto LAB_0007ce10;
    }
    iVar3 = uVar9 * 0x1140 + param_1;
    iVar7 = *(int *)(iVar3 + 0x51e0);
    if (iVar7 == 0) {
      if (*(char *)(iVar3 + 0x52b5) == '\x01') {
        uVar4 = *(uint *)(param_2 + 200);
        goto LAB_0007ce10;
      }
LAB_0007ce90:
      bVar8 = *(byte *)(uVar9 * 0x1140 + param_1 + 0x5240);
      iVar7 = (uint)bVar8 * 0x43 + uVar9 * 0x10c;
      bVar5 = *(byte *)(param_1 + iVar7 + 0x755d4);
      iVar3 = 0;
      if (bVar5 != 0) {
        iVar3 = param_1 + 0x75594 + iVar7;
      }
    }
    else {
      if (iVar7 == 4) {
        uVar4 = *(uint *)(param_2 + 200);
LAB_0007ce10:
        if ((uVar4 & 0x100) != 0) {
          if (2 < RTDebugLevel) {
            printk("APHardTransmit --> clear eap frame !!!\n");
          }
          goto LAB_0007ced8;
        }
        if (iVar2 == 0) goto LAB_0007ce90;
        bVar5 = *(byte *)(param_1 + (uint)param_2[0xb7] * 0xa20 + 0x5d170);
        if (bVar5 == 0) {
          iVar3 = 0;
        }
        else {
          iVar3 = param_1 + (uint)param_2[0xb7] * 0xa20 + 0x5d130;
        }
      }
      else {
        if (iVar7 == 6) {
          uVar4 = *(uint *)(param_2 + 200);
          goto LAB_0007ce10;
        }
        if (iVar7 == 8) goto LAB_0007ce0c;
        if (iVar7 == 0) goto LAB_0007ce90;
LAB_0007ced8:
        bVar5 = 0;
        iVar3 = 0;
      }
      bVar8 = 0;
    }
    iVar7 = *(int *)(param_2 + 0xb0);
    *(int *)(param_2 + 0xc0) = iVar3;
    param_2[0xb4] = 0x18;
    param_2[0xbc] = bVar5;
    param_2[0xc4] = bVar8;
    memset((void *)(iVar7 + 0x10),0,0x18)   //possible issue identified - semgrep
    *(byte *)(iVar7 + 0x11) = *(byte *)(iVar7 + 0x11) & 0xfd | 2;
    bVar5 = *(byte *)(iVar7 + 0x10);
    *(byte *)(iVar7 + 0x10) = bVar5 & 0xf3 | 8;
    iVar3 = 8;
    if ((*(uint *)(param_2 + 200) & 0x80) == 0) {
      iVar3 = 0;
    }
    *(byte *)(iVar7 + 0x10) = bVar5 & 3 | 8 | (byte)(iVar3 << 4);
    iVar3 = *(int *)(param_2 + 0x14);
    if (iVar3 == 0) {
      *(byte *)(iVar7 + 0x26) =
           *(byte *)(iVar7 + 0x26) & 0xf | (byte)((*(uint *)(param_1 + 0x76910) & 0xf) << 4);
      *(char *)(iVar7 + 0x27) = (char)((uint)(*(int *)(param_1 + 0x76910) << 0x14) >> 0x18);
      *(ushort *)(param_1 + 0x76910) = *(short *)(param_1 + 0x76910) + 1U & 0xfff;
    }
    else if ((*(uint *)(param_2 + 200) & 0x10) == 0) {
      iVar3 = iVar3 + (param_2[0xb8] + 0x23c) * 2;
      *(byte *)(iVar7 + 0x26) =
           *(byte *)(iVar7 + 0x26) & 0xf | (byte)((*(ushort *)(iVar3 + 4) & 0xf) << 4);
      *(char *)(iVar7 + 0x27) = (char)(((uint)*(ushort *)(iVar3 + 4) << 0x14) >> 0x18);
      iVar3 = *(int *)(param_2 + 0x14) + (param_2[0xb8] + 0x23c) * 2;
      *(ushort *)(iVar3 + 4) = *(short *)(iVar3 + 4) + 1U & 0xfff;
    }
    else {
      *(byte *)(iVar7 + 0x26) =
           *(byte *)(iVar7 + 0x26) & 0xf | (byte)((*(uint *)(iVar3 + 0x48c) & 0xf) << 4);
      *(char *)(iVar7 + 0x27) = (char)((uint)(*(int *)(iVar3 + 0x48c) << 0x14) >> 0x18);
      *(ushort *)(*(int *)(param_2 + 0x14) + 0x48c) =
           *(short *)(*(int *)(param_2 + 0x14) + 0x48c) + 1U & 0xfff;
    }
    *(byte *)(iVar7 + 0x26) = *(byte *)(iVar7 + 0x26) & 0xf0;
    *(byte *)(iVar7 + 0x11) =
         *(byte *)(iVar7 + 0x11) & 0xdf |
         (byte)(((uint)(*(int *)(param_2 + 200) << 0x19) >> 0x1f) << 5);
    memcpy((void *)(iVar7 + 0x14),*(void **)(param_2 + 0x20),6)   //possible issue identified - semgrep
    memcpy((void *)(iVar7 + 0x1a),(void *)((uint)param_2[0xb6] * 0x1140 + param_1 + 0x51ac),6)   //possible issue identified - semgrep
    memcpy((void *)(iVar7 + 0x20),(void *)(*(int *)(param_2 + 0x20) + 6),6)   //possible issue identified - semgrep
    if (param_2[0xbc] == 0) {
      iVar7 = *(int *)(param_2 + 0xb0);
    }
    else {
      *(byte *)(iVar7 + 0x11) = *(byte *)(iVar7 + 0x11) & 0xbf | 0x40;
      iVar7 = *(int *)(param_2 + 0xb0);
    }
    iVar7 = iVar7 + 0x10;
    cVar1 = *(char *)(iVar2 + 4)   //possible issue identified - semgrep
  }
  else {
    *(int *)(param_2 + 0xb0) = iVar2 + 0x980;
    param_2[0xb4] = 0x18;
    iVar7 = iVar2 + 0x990;
    *(byte *)(iVar2 + 0x991) =
         *(byte *)(iVar2 + 0x991) & 0xdf |
         (byte)(((uint)(*(int *)(param_2 + 200) << 0x19) >> 0x1f) << 5);
    iVar3 = iVar2 + (param_2[0xb8] + 0x23c) * 2;
    *(byte *)(iVar2 + 0x9a6) =
         *(byte *)(iVar2 + 0x9a6) & 0xf | (byte)((*(ushort *)(iVar3 + 4) & 0xf) << 4);
    *(char *)(iVar2 + 0x9a7) = (char)(((uint)*(ushort *)(iVar3 + 4) << 0x14) >> 0x18);
    iVar3 = iVar2 + (param_2[0xb8] + 0x23c) * 2;
    *(ushort *)(iVar3 + 4) = *(short *)(iVar3 + 4) + 1U & 0xfff;
    memcpy((void *)(iVar2 + 0x9a0),(void *)(*(int *)(param_2 + 0x20) + 6),6)   //possible issue identified - semgrep
    cVar1 = *(char *)(iVar2 + 4)   //possible issue identified - semgrep
  }
  if (cVar1 == '\0') {
    uVar9 = (uint)param_2[0xb4];
LAB_0007d184:
    bVar5 = param_2[0xb8];
    pbVar11 = (byte *)(iVar7 + uVar9);
    *pbVar11 = bVar5 & 0xf;
    if ((*(uint *)(*(int *)(param_2 + 0x14) + 0x414) & 0x800) == 0) {
      pbVar11[1] = 0;
    }
    else if ((*(uint *)(param_2 + 200) & 0x800) == 0) {
      pbVar11[1] = 0;
    }
    else {
      *pbVar11 = bVar5 & 0xf | 0x10;
      pbVar11[1] = 0;
    }
    param_2[0xb4] = param_2[0xb4] + 2;
    __s = pbVar11 + 2;
    if (*(char *)(param_1 + 0x16a88) == '\x01') {
      if ((*(uint *)(*(int *)(param_2 + 0x14) + 0x414) & 0x200) != 0) {
        *(byte *)(iVar7 + 1) = *(byte *)(iVar7 + 1) & 0x7f | 0x80;
        memset(__s,0,4)   //possible issue identified - semgrep
        pbVar11[5] = pbVar11[5] | 0x80;
        __s = pbVar11 + 6;
        param_2[0xb4] = param_2[0xb4] + 4;
        goto LAB_0007d240;
      }
      bVar5 = param_2[0xb4];
    }
    else {
LAB_0007d240:
      bVar5 = param_2[0xb4];
    }
    if (bVar5 < 0x18) {
      printk("<4>/home/eric/release/dir600b5/progs.priv/rt2860v2/build/rt2860v2_ap/../rt2860v2/ap/ap_data.c:%d assert pTxBlk->MpduHeaderLen >= 24failed\n"
             ,0x4fb);
      iVar3 = *(int *)(param_2 + 0x28);
    }
    else {
      iVar3 = *(int *)(param_2 + 0x28);
    }
    *(int *)(param_2 + 0x24) = *(int *)(param_2 + 0x20) + 0xe;
    *(int *)(param_2 + 0x28) = iVar3 + -0xe;
    if ((*(byte *)(*(int *)(param_2 + 0x1c) + 0x2d) & 0x10) != 0) {
      *(int *)(param_2 + 0x24) = *(int *)(param_2 + 0x20) + 0x12;
      *(int *)(param_2 + 0x28) = iVar3 + -0x12;
    }
    __dest = (void *)((uint)(__s + 3) & 0xfffffffc);
    bVar5 = (char)__dest - (char)__s   //possible issue identified - semgrep
    param_2[0xb5] = bVar5;
    *(byte *)(iVar2 + 0xa00) = bVar5;
    iVar3 = *(int *)(param_2 + 0x24);
    if ((uint)*(byte *)(iVar3 + -2) * 0x100 + (uint)*(byte *)(iVar3 + -1) < 0x5dd) {
      param_2[0x2c] = 0;
      param_2[0x2d] = 0;
      param_2[0x2e] = 0;
      param_2[0x2f] = 0;
LAB_0007d33c:
      __src = *(void **)(param_2 + 0x2c);
    }
    else {
      *(undefined6 **)(param_2 + 0x2c) = &SNAP_802_1H;
      iVar3 = memcmp(&IPX,(void *)(iVar3 + -2),2);
      if ((iVar3 == 0) ||
         (iVar3 = memcmp(&APPLE_TALK,(void *)(*(int *)(param_2 + 0x24) + -2),2), iVar3 == 0)) {
        *(undefined6 **)(param_2 + 0x2c) = &SNAP_BRIDGE_TUNNEL;
        goto LAB_0007d33c;
      }
      __src = *(void **)(param_2 + 0x2c);
    }
    if (__src != (void *)0x0) {
      memmove(__dest,__src,6)   //possible issue identified - semgrep
      memmove((void *)((int)__dest + 6),(void *)(*(int *)(param_2 + 0x24) + -2),2)   //possible issue identified - semgrep
      __dest = (void *)((int)__dest + 8);
      param_2[0xb4] = param_2[0xb4] + 8;
    }
    *(ushort *)(iVar2 + 0xa02) =
         (ushort)(((int)*(char *)(*(int *)(param_2 + 0x1c) + 0x3a) & 0xffffU) << 8) |
         (ushort)*(byte *)(*(int *)(param_2 + 0x1c) + 0x39);
    *(byte *)(iVar2 + 0xa01) = param_2[0xb4];
  }
  else {
    uVar9 = (uint)param_2[0xb4];
    if (*(short *)(iVar2 + 0xa02) != *(short *)(*(int *)(param_2 + 0x1c) + 0x39)) goto LAB_0007d184;
    bVar5 = param_2[0xb8];
    *(byte *)(iVar7 + uVar9) = bVar5 & 0xf;
    if ((*(uint *)(*(int *)(param_2 + 0x14) + 0x414) & 0x800) == 0) {
      uVar9 = (uint)*(byte *)(iVar2 + 0xa01);
    }
    else if ((*(uint *)(param_2 + 200) & 0x800) == 0) {
      uVar9 = (uint)*(byte *)(iVar2 + 0xa01);
    }
    else {
      *(byte *)(iVar7 + uVar9) = bVar5 & 0xf | 0x10;
      uVar9 = (uint)*(byte *)(iVar2 + 0xa01);
    }
    iVar3 = *(int *)(param_2 + 0x28);
    param_2[0xb4] = (byte)uVar9;
    param_2[0xb5] = *(byte *)(iVar2 + 0xa00);
    *(int *)(param_2 + 0x24) = *(int *)(param_2 + 0x20) + 0xe;
    *(int *)(param_2 + 0x28) = iVar3 + -0xe;
    __dest = (void *)(iVar7 + uVar9);
    if ((*(byte *)(*(int *)(param_2 + 0x1c) + 0x2d) & 0x10) != 0) {
      *(int *)(param_2 + 0x24) = *(int *)(param_2 + 0x20) + 0x12;
      *(int *)(param_2 + 0x28) = iVar3 + -0x12;
    }
  }
  if (*(char *)(iVar2 + 4) == '\0') {
    RTMPWriteTxWI_Data(param_1,*(undefined4 *)(param_2 + 0xb0),param_2);
    memset((void *)(iVar2 + 0x2f8),0,0x40)   //possible issue identified - semgrep
    memmove((void *)(iVar2 + 0x2f8),*(void **)(param_2 + 0xb0),
            (int)__dest - (int)*(void **)(param_2 + 0xb0))   //possible issue identified - semgrep
    memset((void *)(iVar2 + 0x980),0,0x80)   //possible issue identified - semgrep
    memmove((void *)(iVar2 + 0x980),*(void **)(param_2 + 0xb0),
            (int)__dest - (int)*(void **)(param_2 + 0xb0))   //possible issue identified - semgrep
    *(undefined1 *)(iVar2 + 4) = 1;
  }
  else {
    RTMPWriteTxWI_Cache(param_1,*(undefined4 *)(param_2 + 0xb0),param_2);
  }
  *(int *)(param_1 + 0x76800) = *(int *)(param_1 + 0x76800) + 1;
  uVar9 = *(uint *)(param_2 + 0x28) + *(int *)(param_1 + 0x76808);
  *(uint *)(param_1 + 0x7680c) =
       (uint)(uVar9 < *(uint *)(param_2 + 0x28)) + *(int *)(param_1 + 0x7680c);
  *(uint *)(param_1 + 0x76808) = uVar9;
  iVar3 = *(int *)(param_2 + 0xd0);
  if (iVar3 == 0) {
    iVar3 = *(int *)(iVar2 + 0x274);
    goto LAB_0007d4e8;
  }
  *(int *)(iVar3 + 0x4c) = *(int *)(iVar3 + 0x4c) + *(int *)(param_2 + 0x28);
  *(int *)(iVar3 + 0x40) = *(int *)(iVar3 + 0x40) + 1;
  bVar5 = **(byte **)(param_2 + 0x20);
  if ((bVar5 & 1) == 0) {
    if (bVar5 == 0xff) {
      iVar7 = *(int *)(iVar3 + 0x8c);
      goto LAB_0007d4d0;
    }
    *(int *)(iVar3 + 0x7c) = *(int *)(iVar3 + 0x7c) + 1;
  }
  else if (bVar5 == 0xff) {
    iVar7 = *(int *)(iVar3 + 0x8c);
LAB_0007d4d0:
    *(int *)(iVar3 + 0x8c) = iVar7 + 1;
  }
  else {
    *(int *)(iVar3 + 0x84) = *(int *)(iVar3 + 0x84) + 1;
  }
  iVar3 = *(int *)(iVar2 + 0x274);
LAB_0007d4e8:
  if (iVar3 == 2) {
    uVar9 = *(uint *)(iVar2 + 0xa08) + 1;
    *(uint *)(iVar2 + 0xa0c) = (uint)(uVar9 < *(uint *)(iVar2 + 0xa08)) + *(int *)(iVar2 + 0xa0c);
    *(uint *)(iVar2 + 0xa08) = uVar9;
    *(int *)(iVar2 + 0xa18) = *(int *)(iVar2 + 0xa18) + *(int *)(param_2 + 0x28);
  }
  RtmpPCI_WriteSingleTxResource(param_1,param_2,1,local_28);
  if (*(char *)(param_1 + 0xec) == '\0') {
    *(undefined4 *)(*(int *)(param_1 + 0xdc) + (uint)*param_2 * 0x10 + 0x238) =
         *(undefined4 *)((uint)*param_2 * 0x80c + param_1 + 0x980);
  }
  *(int *)(param_1 + 0x76740) = *(int *)(param_1 + 0x76740) + 1;
  *(int *)(param_1 + 0x76774) = *(int *)(param_1 + 0x76774) + 1;
  return;
}