undefined4 TXSTOP(undefined4 *param_1)

{
  byte bVar1;
  char cVar2;
  uint uVar3;
  int iVar4;
  int iVar5;
  undefined4 *puVar6;
  undefined4 *puVar7;
  
  if (2 < RTDebugLevel) {
    printk("ATE : ===> %s\n","TXSTOP");
  }
  bVar1 = *(byte *)(param_1 + 0x1da83);
  *(undefined1 *)((int)param_1 + 0x76a52) = 0;
  *(byte *)(param_1 + 0x1da83) = bVar1 & 0xe2;
  if (bVar1 == 9) {
    iVar5 = 0;
    cVar2 = *(char *)(param_1 + 0x3b)   //possible issue identified - semgrep
    do {
      uVar3 = 0;
      if (cVar2 == '\0') {
        uVar3 = *(uint *)(param_1[0x37] + 0x101c);
      }
      if ((uVar3 & 0x20000) == 0) {
        if (cVar2 == '\0') {
          *(undefined4 *)(param_1[0x37] + 0x101c) = 0xb1600;
        }
        iVar4 = 1;
        while( true ) {
          uVar3 = 0;
          if (*(char *)(param_1 + 0x3b) == '\0') {
            uVar3 = *(uint *)(param_1[0x37] + 0x101c);
          }
          if (((uVar3 & 0x20000) == 0) || (iVar4 == 100)) break;
          iVar4 = iVar4 + 1;
        }
        if ((uVar3 & 0x2ff00) == 0x1600) goto LAB_0009eb44;
      }
      iVar5 = iVar5 + 1;
      if (iVar5 == 100) goto LAB_0009eb44;
      cVar2 = *(char *)(param_1 + 0x3b)   //possible issue identified - semgrep
    } while( true );
  }
  if ((bVar1 != 0x11) && (((bVar1 & 1) != 0 || (bVar1 == 0x80)))) {
    RtmpDmaEnable(param_1,0);
    puVar6 = (undefined4 *)param_1[0x61];
    puVar7 = param_1;
    while( true ) {
      bVar1 = *(byte *)((int)puVar6 + 7);
      *(byte *)((int)puVar6 + 7) = bVar1 & 0x7f;
      iVar5 = puVar7[99];
      if (iVar5 != 0) {
        linux_pci_unmap_single
                  (*(undefined4 *)*param_1,*puVar6,
                   (bVar1 & 0x3f) << 8 | (uint)*(byte *)((int)puVar6 + 6),0xff00);
        RTMPFreeNdisPacket(param_1,iVar5);
      }
      iVar5 = puVar7[100];
      puVar7[99] = 0;
      if (iVar5 != 0) {
        linux_pci_unmap_single
                  (*(undefined4 *)*param_1,puVar6[2],
                   (*(byte *)((int)puVar6 + 5) & 0x3f) << 8 | (uint)*(byte *)(puVar6 + 1),0xff00);
        RTMPFreeNdisPacket(param_1,iVar5);
      }
      puVar7[100] = 0;
      if (puVar7 + 8 == param_1 + 0x200) break;
      puVar6 = (undefined4 *)puVar7[0x69];
      puVar7 = puVar7 + 8;
    }
    RtmpDmaEnable(param_1,1);
  }
  goto LAB_0009ed20;
LAB_0009eb44:
  if ((int)(uVar3 << 0xe) < 0) {
    if (RTDebugLevel == 0) {
      cVar2 = *(char *)(param_1 + 0x3b)   //possible issue identified - semgrep
    }
    else {
      printk("BBP read R%d fail\n",0x16);
      cVar2 = *(char *)(param_1 + 0x3b)   //possible issue identified - semgrep
    }
  }
  else {
    cVar2 = *(char *)(param_1 + 0x3b)   //possible issue identified - semgrep
  }
  iVar5 = 0;
  do {
    uVar3 = 0;
    if (cVar2 == '\0') {
      uVar3 = *(uint *)(param_1[0x37] + 0x101c);
    }
    if ((uVar3 & 0x20000) == 0) {
      if (cVar2 == '\0') {
        *(undefined4 *)(param_1[0x37] + 0x101c) = 0xa1600;
      }
      *(undefined1 *)((int)param_1 + 0x4adf) = 0;
      if (iVar5 != 100) goto LAB_0009ed20;
      break;
    }
    iVar5 = iVar5 + 1;
  } while (iVar5 != 100);
  if (RTDebugLevel != 0) {
    printk("BBP write R%d fail\n",0x16);
  }
LAB_0009ed20:
  *(undefined1 *)(param_1 + 0x1dac0) = 0;
  if (*(char *)(param_1 + 0x3b) == '\0') {
    *(uint *)(param_1[0x37] + 0x1004) = *(uint *)(param_1[0x37] + 0x1004) & 0xfffffffb;
  }
  if (2 < RTDebugLevel) {
    printk("ATE : <=== %s\n","TXSTOP");
  }
  return 0;
}