/* WARNING: Restarted to delay deadcode elimination for space: register */
void RTMPAPIoctlRF(int param_1,uint *param_2)
{
char *pcVar1;
int iVar2;
char *pcVar3;
size_t sVar4;
uint uVar5;
uint uVar6;
char *__s;
int unaff_gp;
byte local_48 [4];
void *local_44;
char *local_40;
uint local_3c;
undefined1 local_38 [8];
uint local_30;
int local_2c;
local_48[0] = 0;
local_2c = *(int *)(param_1 + 0xa4);
os_alloc_mem(0,&local_44,0x90c);
if (local_44 == (void *)0x0) {
return;
}
local_30 = *(byte *)((int)param_2 + 6) & 1;
memset(local_44,0,0x90c) //possible issue identified - semgrep
uVar6 = (uint)(ushort)param_2[1];
__s = (char *)((int)local_44 + 3U & 0xfffffffc);
if (1 < uVar6) {
sVar4 = 0xff //possible issue identified - semgrep
if (uVar6 < 0x100) {
sVar4 = uVar6;
}
memmove(__s + 0x800,(void *)*param_2,sVar4) //possible issue identified - semgrep
local_40 = __s + 0x800;
sprintf(__s,"\n") //possible issue identified - semgrep
LAB_00089080:
do {
pcVar3 = strsep(&local_40,",");
if (pcVar3 == (char *)0x0) goto LAB_00089324;
if (*pcVar3 != '\0') {
pcVar1 = strchr(pcVar3,0x3d);
if (pcVar1 == (char *)0x0) {
LAB_00088ee4:
iVar2 = sscanf(pcVar3,"%d",&local_3c) //possible issue identified - semgrep
if ((iVar2 != 1) || (*(uint *)(param_1 + 0xa4) < local_3c)) break;
uVar6 = local_3c & 0xff;
if (*(char *)(param_1 + 0x76a0c) == -0x80) {
RT30xxReadRFRegister(param_1,uVar6,local_48);
sVar4 = strlen(__s);
pcVar3 = "R%02d[0x%02x]:%02X ";
LAB_00089070:
sprintf(__s + sVar4,pcVar3,local_3c,local_3c,(uint)local_48[0]) //possible issue identified - semgrep
goto LAB_00089080;
}
}
else {
*pcVar1 = '\0';
if ((pcVar1 + 1 == (char *)0x0) || (pcVar1[1] == '\0')) goto LAB_00088ee4;
iVar2 = sscanf(pcVar3,"%d",&local_3c) //possible issue identified - semgrep
if ((iVar2 != 1) ||
((iVar2 = sscanf(pcVar1 + 1,"%lx",local_38), iVar2 != 1 || //possible issue identified - semgrep
(*(uint *)(param_1 + 0xa4) < local_3c)))) break;
if (*(char *)(param_1 + 0x76a0c) == -0x80) {
RT30xxReadRFRegister(param_1,local_3c & 0xff,local_48);
RT30xxWriteRFRegister(param_1,local_3c & 0xff,local_38[0],RT30xxWriteRFRegister);
RT30xxReadRFRegister(param_1,local_3c & 0xff,local_48);
sVar4 = strlen(__s);
pcVar3 = "R%02d[0x%02X]:%02X\n";
goto LAB_00089070;
}
RT30xxReadRFRegister(param_1,local_3c & 0xff,local_48);
RT30xxWriteRFRegister(param_1,local_3c & 0xff,local_38[0]);
uVar6 = local_3c & 0xff;
}
RT30xxReadRFRegister(param_1,uVar6,local_48);
sVar4 = strlen(__s);
sprintf(__s + sVar4,"%03d = %02X\n",local_3c,(uint)local_48[0]) //possible issue identified - semgrep
}
} while( true );
}
memset(__s,0,0x800) //possible issue identified - semgrep
sprintf(__s,"\n") //possible issue identified - semgrep
for (local_3c = 0; (int)local_3c <= local_2c; local_3c = local_3c + 1) {
if (*(char *)(param_1 + 0x76a0c) == -0x80) {
RT30xxReadRFRegister(param_1,local_3c & 0xff,local_48);
sVar4 = strlen(__s);
sprintf(__s + sVar4,"R%02d[0x%02X]:%02X ",local_3c,local_3c << 1,(uint)local_48[0]) //possible issue identified - semgrep
if ((int)local_3c % 5 == 4) {
sVar4 = strlen(__s);
sprintf(__s + sVar4,"\n") //possible issue identified - semgrep
}
}
else {
RT30xxReadRFRegister(param_1,local_3c & 0xff,local_48);
sVar4 = strlen(__s);
sprintf(__s + sVar4,"%03d = %02X\n",local_3c,(uint)local_48[0]) //possible issue identified - semgrep
}
}
sVar4 = strlen(__s);
uVar5 = *param_2;
uVar6 = sVar4 & 0xffff;
*(short *)(param_2 + 1) = (short)sVar4;
if (((uVar5 + uVar6 | uVar5 | uVar6) & *(uint *)(unaff_gp + 0x18)) == 0) {
__copy_user(uVar5,__s);
}
LAB_00089244:
if ((uVar6 != 0) && (2 < RTDebugLevel)) {
printk("%s: copy_to_user() fail\n","RTMPAPIoctlRF");
}
if (local_30 == 0) {
if (RTDebugLevel != 0) {
sVar4 = strlen(__s);
printk("Dump RF msg[%d]=\n",sVar4);
}
printk(&_LC160,__s) //possible issue identified - semgrep
}
os_free_mem(0,local_44);
if ((local_30 == 0) && (2 < RTDebugLevel)) {
printk("<==RTMPIoctlRF\n\n");
}
return;
LAB_00089324:
sVar4 = strlen(__s);
uVar5 = *param_2;
uVar6 = sVar4 & 0xffff;
*(short *)(param_2 + 1) = (short)sVar4;
if (((uVar5 + uVar6 | uVar5 | uVar6) & *(uint *)(unaff_gp + 0x18)) == 0) {
__copy_user(uVar5,__s);
}
goto LAB_00089244;
}