void RT5350_RTMPSetAGCInitValue(int param_1,char param_2)

{
  char cVar1;
  int iVar2;
  byte bVar3;
  char cVar4;
  uint uVar5;
  int iVar6;
  uint uVar7;
  uint uVar8;
  
  uVar5 = Status;
  bVar3 = *(byte *)(param_1 + 0x4be0);
  if (bVar3 < 0xf) {
    cVar4 = *(char *)(param_1 + 0x50e4)   //possible issue identified - semgrep
    if (*(char *)(param_1 + 0xec) == '\0') {
      if (*(int *)(param_1 + 0x29f8) == 4) {
        uVar7 = 0;
        if (*(char *)(param_1 + 0xad) == '\x01') {
          Status = Status & 0xfffffffe;
          uVar7 = uVar5 & 1;
        }
        iVar6 = 1;
        cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
        while( true ) {
          uVar5 = 0;
          if (cVar1 == '\0') {
            uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
          }
          if ((uVar5 & 0x20000) == 0) break;
          iVar6 = iVar6 + 1;
          printk(&_LC5)   //possible issue identified - semgrep
          if (iVar6 == 100) goto LAB_000b6c48;
          cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
        }
        if (cVar1 == '\0') {
          *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x101c) = 0xa1b00;
        }
        *(undefined1 *)(param_1 + 0x4ae4) = 0;
        if (iVar6 != 100) goto LAB_000b6c68;
LAB_000b6c48:
        printk("ERROR!!! ");
        printk("BBP write R%d fail\n",0x1b);
LAB_000b6c68:
        if (*(char *)(param_1 + 0xad) == '\x01') {
LAB_000b6e24:
          Status = Status & 0xfffffffe;
          if (uVar7 != 0) {
            Status = Status | 1;
          }
          goto LAB_000b6e34;
        }
        cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      }
      else {
        uVar7 = 0;
        if (*(char *)(param_1 + 0xad) == '\x01') {
          Status = Status & 0xfffffffe;
          uVar7 = uVar5 & 1;
        }
        iVar6 = 1;
        cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
        while( true ) {
          uVar5 = 0;
          if (cVar1 == '\0') {
            uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
          }
          if ((uVar5 & 0x20000) == 0) break;
          iVar2 = iVar6 % 0x14;
          iVar6 = iVar6 + 1;
          if ((iVar2 == 0) && (cVar1 == '\0')) {
            *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
          }
          printk(&_LC5)   //possible issue identified - semgrep
          if (iVar6 == 100) goto LAB_000b6dc8;
          cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
        }
        if (cVar1 == '\0') {
          *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x7028) = 0xa1b00;
        }
        iVar2 = AsicSendCommandToMcuBBP(param_1,0x80,0xff,0,0,0);
        if (*(char *)(param_1 + 0x16964) == '\x01') {
          RTMPusecDelay(1000);
        }
        if ((iVar2 == 0) && (*(char *)(param_1 + 0xec) == '\0')) {
          *(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x7028) = 0x81b00;
        }
        *(undefined1 *)(param_1 + 0x4ae4) = 0;
        if (iVar6 != 100) goto LAB_000b6e10;
LAB_000b6dc8:
        printk("ERROR!!! ");
        printk("BBP write R%d fail\n",0x1b);
        if (*(char *)(param_1 + 0xec) == '\0') {
          *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) =
               *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) & 0xfffdffff;
LAB_000b6e10:
          cVar1 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
        }
        else {
          cVar1 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
        }
        if (cVar1 == '\x01') goto LAB_000b6e24;
        cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      }
    }
    else {
LAB_000b6e34:
      cVar1 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    uVar5 = Status;
    if (cVar1 != '\0') {
      return;
    }
    bVar3 = cVar4 + 0x2e;
    uVar7 = (uint)bVar3;
    if (*(int *)(param_1 + 0x29f8) == 4) {
      uVar8 = 0;
      if (*(char *)(param_1 + 0xad) == '\x01') {
        Status = Status & 0xfffffffe;
        uVar8 = uVar5 & 1;
      }
      iVar6 = 1;
      cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      while( true ) {
        uVar5 = 0;
        if (cVar4 == '\0') {
          uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
        }
        if ((uVar5 & 0x20000) == 0) {
          if (cVar4 == '\0') {
            *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = uVar7 | 0xa4200;
            *(byte *)(param_1 + 0x4b0b) = bVar3;
          }
          else {
            *(byte *)(param_1 + 0x4b0b) = bVar3;
          }
          goto LAB_000b7310;
        }
        iVar6 = iVar6 + 1;
        printk(&_LC5)   //possible issue identified - semgrep
        if (iVar6 == 100) break;
        cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      }
      goto LAB_000b7320;
    }
    uVar8 = 0;
    if (*(char *)(param_1 + 0xad) == '\x01') {
      Status = Status & 0xfffffffe;
      uVar8 = uVar5 & 1;
    }
    iVar6 = 1;
    cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    while( true ) {
      uVar5 = 0;
      if (cVar4 == '\0') {
        uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
      }
      if ((uVar5 & 0x20000) == 0) break;
      iVar2 = iVar6 % 0x14;
      iVar6 = iVar6 + 1;
      if ((iVar2 == 0) && (cVar4 == '\0')) {
        *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
      }
      printk(&_LC5)   //possible issue identified - semgrep
      if (iVar6 == 100) goto LAB_000b704c;
      cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
    if (cVar4 == '\0') {
      *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar7 | 0xa4200;
    }
    iVar2 = AsicSendCommandToMcuBBP(param_1,0x80,0xff,0,0,0);
    if (*(char *)(param_1 + 0x16964) == '\x01') {
      RTMPusecDelay(1000);
    }
    if ((iVar2 == 0) && (*(char *)(param_1 + 0xec) == '\0')) {
      *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar7 | 0x84200;
    }
    *(byte *)(param_1 + 0x4b0b) = bVar3;
    if (iVar6 != 100) goto LAB_000b7094;
LAB_000b704c:
    printk("ERROR!!! ");
    printk("BBP write R%d fail\n",0x42);
    if (*(char *)(param_1 + 0xec) == '\0') {
      *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) =
           *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) & 0xfffdffff;
LAB_000b7094:
      cVar4 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
    }
    else {
      cVar4 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
    }
    goto joined_r0x000b74ec;
  }
  if (param_2 == '\0') {
    if (bVar3 < 0x41) {
      iVar6 = (int)*(char *)(param_1 + 0x50e5);
    }
    else if (bVar3 < 0x81) {
      iVar6 = (int)*(char *)(param_1 + 0x50e6);
    }
    else {
      iVar6 = (int)*(char *)(param_1 + 0x50e7);
    }
    uVar7 = (iVar6 * 5) / 3 + 0x32U & 0xff;
    if (*(char *)(param_1 + 0xec) != '\0') {
      return;
    }
    if (*(int *)(param_1 + 0x29f8) != 4) {
      uVar8 = 0;
      if (*(char *)(param_1 + 0xad) == '\x01') {
        Status = Status & 0xfffffffe;
        uVar8 = uVar5 & 1;
      }
      iVar6 = 1;
      cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      while( true ) {
        uVar5 = 0;
        if (cVar4 == '\0') {
          uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
        }
        if ((uVar5 & 0x20000) == 0) goto LAB_000b73f4;
        iVar2 = iVar6 % 0x14;
        iVar6 = iVar6 + 1;
        if ((iVar2 == 0) && (cVar4 == '\0')) {
          *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
        }
        printk(&_LC5)   //possible issue identified - semgrep
        if (iVar6 == 100) break;
        cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      }
LAB_000b749c:
      printk("ERROR!!! ");
      printk("BBP write R%d fail\n",0x42);
      if (*(char *)(param_1 + 0xec) == '\0') {
        *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) =
             *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) & 0xfffdffff;
        goto LAB_000b74e4;
      }
      cVar4 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
      goto joined_r0x000b74ec;
    }
    uVar8 = 0;
    if (*(char *)(param_1 + 0xad) == '\x01') {
      Status = Status & 0xfffffffe;
      uVar8 = uVar5 & 1;
    }
    iVar6 = 1;
    cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    while( true ) {
      uVar5 = 0;
      if (cVar4 == '\0') {
        uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
      }
      if ((uVar5 & 0x20000) == 0) goto LAB_000b72d8;
      iVar6 = iVar6 + 1;
      printk(&_LC5)   //possible issue identified - semgrep
      if (iVar6 == 100) break;
      cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
  }
  else {
    if (bVar3 < 0x41) {
      iVar6 = (int)*(char *)(param_1 + 0x50e5);
    }
    else if (bVar3 < 0x81) {
      iVar6 = (int)*(char *)(param_1 + 0x50e6);
    }
    else {
      iVar6 = (int)*(char *)(param_1 + 0x50e7);
    }
    uVar7 = (iVar6 * 5) / 3 + 0x3aU & 0xff;
    if (*(char *)(param_1 + 0xec) != '\0') {
      return;
    }
    if (*(int *)(param_1 + 0x29f8) != 4) {
      uVar8 = 0;
      if (*(char *)(param_1 + 0xad) == '\x01') {
        Status = Status & 0xfffffffe;
        uVar8 = uVar5 & 1;
      }
      iVar6 = 1;
      cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      while( true ) {
        uVar5 = 0;
        if (cVar4 == '\0') {
          uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
        }
        if ((uVar5 & 0x20000) == 0) goto LAB_000b73f4;
        iVar2 = iVar6 % 0x14;
        iVar6 = iVar6 + 1;
        if ((iVar2 == 0) && (cVar4 == '\0')) {
          *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
        }
        printk(&_LC5)   //possible issue identified - semgrep
        if (iVar6 == 100) break;
        cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
      }
      goto LAB_000b749c;
    }
    uVar8 = 0;
    if (*(char *)(param_1 + 0xad) == '\x01') {
      Status = Status & 0xfffffffe;
      uVar8 = uVar5 & 1;
    }
    iVar6 = 1;
    cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    while( true ) {
      uVar5 = 0;
      if (cVar4 == '\0') {
        uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
      }
      if ((uVar5 & 0x20000) == 0) goto LAB_000b72d8;
      iVar6 = iVar6 + 1;
      printk(&_LC5)   //possible issue identified - semgrep
      if (iVar6 == 100) break;
      cVar4 = *(char *)(param_1 + 0xec)   //possible issue identified - semgrep
    }
  }
LAB_000b7320:
  printk("ERROR!!! ");
  printk("BBP write R%d fail\n",0x42);
  cVar4 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
  goto LAB_000b7344;
LAB_000b73f4:
  if (cVar4 == '\0') {
    *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar7 | 0xa4200;
  }
  iVar2 = AsicSendCommandToMcuBBP(param_1,0x80,0xff,0,0,0);
  if (*(char *)(param_1 + 0x16964) == '\x01') {
    RTMPusecDelay(1000);
  }
  if ((iVar2 == 0) && (*(char *)(param_1 + 0xec) == '\0')) {
    *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar7 | 0x84200;
  }
  *(char *)(param_1 + 0x4b0b) = (char)uVar7;
  if (iVar6 == 100) goto LAB_000b749c;
LAB_000b74e4:
  cVar4 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
joined_r0x000b74ec:
  if (cVar4 != '\x01') {
    return;
  }
  goto LAB_000b74f8;
LAB_000b72d8:
  if (cVar4 == '\0') {
    *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = uVar7 | 0xa4200;
    *(char *)(param_1 + 0x4b0b) = (char)uVar7;
  }
  else {
    *(char *)(param_1 + 0x4b0b) = (char)uVar7;
  }
LAB_000b7310:
  if (iVar6 == 100) goto LAB_000b7320;
  cVar4 = *(char *)(param_1 + 0xad)   //possible issue identified - semgrep
LAB_000b7344:
  if (cVar4 == '\x01') {
LAB_000b74f8:
    Status = Status & 0xfffffffe;
    if (uVar8 != 0) {
      Status = Status | 1;
    }
  }
  return;
}