void RT5350_RxSensitivityTuning(int param_1)
{
byte bVar1;
char cVar2;
char cVar3;
int iVar4;
uint uVar5;
int iVar6;
uint uVar7;
uVar5 = Status;
bVar1 = *(byte *)(param_1 + 0x4be0);
if (bVar1 < 0xf) {
cVar2 = *(char *)(param_1 + 0x50e4) //possible issue identified - semgrep
}
else if (bVar1 < 0x41) {
cVar2 = *(char *)(param_1 + 0x50e5) //possible issue identified - semgrep
}
else if (bVar1 < 0x81) {
cVar2 = *(char *)(param_1 + 0x50e6) //possible issue identified - semgrep
}
else {
cVar2 = *(char *)(param_1 + 0x50e7) //possible issue identified - semgrep
}
if (*(char *)(param_1 + 0x76a0c) != -0x80) {
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
iVar6 = 0;
if ((*(uint *)(param_1 + 0x4a94) & 0xffff0000) != 0x53500000) {
LAB_000c38b4:
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar5 & 0x20000) != 0) goto code_r0x000c38cc;
if (bVar1 < 0xf) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e4);
}
else if (bVar1 < 0x41) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e5);
}
else if (bVar1 < 0x81) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e6);
}
else {
uVar5 = (uint)*(byte *)(param_1 + 0x50e7);
}
if (cVar3 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = uVar5 + 0x26 & 0xff | 0xa4200;
}
bVar1 = *(byte *)(param_1 + 0x4be0);
if (bVar1 < 0xf) {
cVar3 = *(char *)(param_1 + 0x50e4) //possible issue identified - semgrep
}
else if (bVar1 < 0x41) {
cVar3 = *(char *)(param_1 + 0x50e5) //possible issue identified - semgrep
}
else if (bVar1 < 0x81) {
cVar3 = *(char *)(param_1 + 0x50e6) //possible issue identified - semgrep
}
else {
cVar3 = *(char *)(param_1 + 0x50e7) //possible issue identified - semgrep
}
*(char *)(param_1 + 0x4b0b) = cVar3 + '&';
joined_r0x000c3980:
if (iVar6 != 100) goto LAB_000c4174;
goto LAB_000c399c;
}
iVar6 = 0;
do {
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar5 & 0x20000) == 0) {
if (cVar3 == '\0') {
*(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x101c) = 0xa1b00;
}
*(undefined1 *)(param_1 + 0x4ae4) = 0;
if (iVar6 != 100) goto LAB_000c37ac;
break;
}
iVar6 = iVar6 + 1;
} while (iVar6 != 100);
if (RTDebugLevel == 0) {
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
else {
printk("BBP write R%d fail\n",0x1b);
LAB_000c37ac:
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
iVar6 = 0;
do {
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar5 & 0x20000) == 0) {
bVar1 = *(byte *)(param_1 + 0x4be0);
if (bVar1 < 0xf) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e4);
}
else if (bVar1 < 0x41) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e5);
}
else if (bVar1 < 0x81) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e6);
}
else {
uVar5 = (uint)*(byte *)(param_1 + 0x50e7);
}
if (cVar3 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = uVar5 + 0x26 & 0xff | 0xa4200;
}
bVar1 = *(byte *)(param_1 + 0x4be0);
if (bVar1 < 0xf) {
cVar3 = *(char *)(param_1 + 0x50e4) //possible issue identified - semgrep
}
else if (bVar1 < 0x41) {
cVar3 = *(char *)(param_1 + 0x50e5) //possible issue identified - semgrep
}
else if (bVar1 < 0x81) {
cVar3 = *(char *)(param_1 + 0x50e6) //possible issue identified - semgrep
}
else {
cVar3 = *(char *)(param_1 + 0x50e7) //possible issue identified - semgrep
}
*(char *)(param_1 + 0x4b0b) = cVar3 + '&';
goto joined_r0x000c3980;
}
iVar6 = iVar6 + 1;
} while (iVar6 != 100);
LAB_000c399c:
if (RTDebugLevel != 0) {
printk("BBP write R%d fail\n",0x42);
}
goto LAB_000c4174;
}
if ((*(uint *)(param_1 + 0x4a94) & 0xffff0000) != 0x53500000) {
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;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
while( true ) {
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar5 & 0x20000) == 0) {
bVar1 = *(byte *)(param_1 + 0x4be0);
goto LAB_000c3e50;
}
iVar6 = iVar6 + 1;
printk(&_LC5) //possible issue identified - semgrep
if (iVar6 == 100) break;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
LAB_000c3f08:
printk("ERROR!!! ");
printk("BBP write R%d fail\n",0x42);
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
uVar7 = 0;
if (*(char *)(param_1 + 0xad) == '\x01') {
Status = Status & 0xfffffffe;
uVar7 = uVar5 & 1;
}
iVar6 = 1;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
while( true ) {
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
}
if ((uVar5 & 0x20000) == 0) {
bVar1 = *(byte *)(param_1 + 0x4be0);
goto LAB_000c3fe0;
}
iVar4 = iVar6 % 0x14;
iVar6 = iVar6 + 1;
if ((iVar4 == 0) && (cVar3 == '\0')) {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
}
printk(&_LC5) //possible issue identified - semgrep
if (iVar6 == 100) break;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
LAB_000c4104:
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;
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
}
joined_r0x000c4154:
if ((cVar3 == '\x01') && (Status = Status & 0xfffffffe, uVar7 != 0)) {
Status = Status | 1;
}
}
goto LAB_000c4174;
}
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;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
while( true ) {
uVar5 = 0;
if (cVar3 == '\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_000c3aa8;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
if (cVar3 == '\0') {
*(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x101c) = 0xa1b00;
}
*(undefined1 *)(param_1 + 0x4ae4) = 0;
if (iVar6 != 100) goto LAB_000c3ac8;
LAB_000c3aa8:
printk("ERROR!!! ");
printk("BBP write R%d fail\n",0x1b);
LAB_000c3ac8:
if (*(char *)(param_1 + 0xad) == '\x01') {
LAB_000c3c84:
Status = Status & 0xfffffffe;
if (uVar7 != 0) {
Status = Status | 1;
}
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
else {
cVar3 = *(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;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
while( true ) {
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
}
if ((uVar5 & 0x20000) == 0) break;
iVar4 = iVar6 % 0x14;
iVar6 = iVar6 + 1;
if ((iVar4 == 0) && (cVar3 == '\0')) {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
}
printk(&_LC5) //possible issue identified - semgrep
if (iVar6 == 100) goto LAB_000c3c28;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
if (cVar3 == '\0') {
*(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x7028) = 0xa1b00;
}
iVar4 = AsicSendCommandToMcuBBP(param_1,0x80,0xff,0,0,0);
if (*(char *)(param_1 + 0x16964) == '\x01') {
RTMPusecDelay(1000);
}
if ((iVar4 == 0) && (*(char *)(param_1 + 0xec) == '\0')) {
*(undefined4 *)(*(int *)(param_1 + 0xdc) + 0x7028) = 0x81b00;
}
*(undefined1 *)(param_1 + 0x4ae4) = 0;
if (iVar6 != 100) goto LAB_000c3c70;
LAB_000c3c28:
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_000c3c70:
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
if (cVar3 == '\x01') goto LAB_000c3c84;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
}
else {
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
uVar5 = Status;
if (cVar3 == '\0') {
if (*(int *)(param_1 + 0x29f8) != 4) {
uVar7 = 0;
if (*(char *)(param_1 + 0xad) == '\x01') {
Status = Status & 0xfffffffe;
uVar7 = uVar5 & 1;
}
iVar6 = 1;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_000c3d60:
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x7028);
}
if ((uVar5 & 0x20000) == 0) {
bVar1 = *(byte *)(param_1 + 0x4be0);
LAB_000c3fe0:
if (bVar1 < 0xf) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e4);
}
else if (bVar1 < 0x41) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e5);
}
else if (bVar1 < 0x81) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e6);
}
else {
uVar5 = (uint)*(byte *)(param_1 + 0x50e7);
}
uVar5 = uVar5 + 0x26 & 0xff;
if (cVar3 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 | 0xa4200;
}
iVar4 = AsicSendCommandToMcuBBP(param_1,0x80,0xff,0,0,0);
if (*(char *)(param_1 + 0x16964) == '\x01') {
RTMPusecDelay(1000);
}
if (iVar4 == 0) {
if (*(char *)(param_1 + 0xec) == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 | 0x84200;
}
bVar1 = *(byte *)(param_1 + 0x4be0);
}
else {
bVar1 = *(byte *)(param_1 + 0x4be0);
}
if (bVar1 < 0xf) {
cVar3 = *(char *)(param_1 + 0x50e4) //possible issue identified - semgrep
}
else if (bVar1 < 0x41) {
cVar3 = *(char *)(param_1 + 0x50e5) //possible issue identified - semgrep
}
else if (bVar1 < 0x81) {
cVar3 = *(char *)(param_1 + 0x50e6) //possible issue identified - semgrep
}
else {
cVar3 = *(char *)(param_1 + 0x50e7) //possible issue identified - semgrep
}
*(char *)(param_1 + 0x4b0b) = cVar3 + '&';
if (iVar6 == 100) goto LAB_000c4104;
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
goto joined_r0x000c4154;
}
iVar4 = iVar6 % 0x14;
iVar6 = iVar6 + 1;
if ((iVar4 == 0) && (cVar3 == '\0')) {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x7028) = uVar5 & 0xfffdffff;
}
printk(&_LC5) //possible issue identified - semgrep
if (iVar6 != 100) goto code_r0x000c3dbc;
goto LAB_000c4104;
}
uVar7 = 0;
if (*(char *)(param_1 + 0xad) == '\x01') {
Status = Status & 0xfffffffe;
uVar7 = uVar5 & 1;
}
iVar6 = 1;
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_000c3ce8:
uVar5 = 0;
if (cVar3 == '\0') {
uVar5 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar5 & 0x20000) == 0) {
bVar1 = *(byte *)(param_1 + 0x4be0);
LAB_000c3e50:
if (bVar1 < 0xf) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e4);
}
else if (bVar1 < 0x41) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e5);
}
else if (bVar1 < 0x81) {
uVar5 = (uint)*(byte *)(param_1 + 0x50e6);
}
else {
uVar5 = (uint)*(byte *)(param_1 + 0x50e7);
}
if (cVar3 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = uVar5 + 0x26 & 0xff | 0xa4200;
}
bVar1 = *(byte *)(param_1 + 0x4be0);
if (bVar1 < 0xf) {
cVar3 = *(char *)(param_1 + 0x50e4) //possible issue identified - semgrep
}
else if (bVar1 < 0x41) {
cVar3 = *(char *)(param_1 + 0x50e5) //possible issue identified - semgrep
}
else if (bVar1 < 0x81) {
cVar3 = *(char *)(param_1 + 0x50e6) //possible issue identified - semgrep
}
else {
cVar3 = *(char *)(param_1 + 0x50e7) //possible issue identified - semgrep
}
*(char *)(param_1 + 0x4b0b) = cVar3 + '&';
if (iVar6 == 100) goto LAB_000c3f08;
cVar3 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
goto joined_r0x000c4154;
}
iVar6 = iVar6 + 1;
printk(&_LC5) //possible issue identified - semgrep
if (iVar6 != 100) goto code_r0x000c3d1c;
goto LAB_000c3f08;
}
LAB_000c4174:
if (RTDebugLevel < 3) {
return;
}
printk("turn off R17 tuning, restore to 0x%02x\n",cVar2 + '&');
return;
code_r0x000c38cc:
iVar6 = iVar6 + 1;
if (iVar6 == 100) goto LAB_000c399c;
goto LAB_000c38b4;
code_r0x000c3dbc:
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_000c3d60;
code_r0x000c3d1c:
cVar3 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_000c3ce8;
}