/* WARNING: Restarted to delay deadcode elimination for space: register */
uint RTMPAPIoctlBBP(int param_1,uint *param_2)
{
char cVar1;
uint uVar2;
size_t sVar3;
char *pcVar4;
int iVar5;
char *pcVar6;
uint uVar7;
int iVar8;
size_t __n;
uint uVar9;
char *__s;
int unaff_gp;
void *local_40;
char *local_3c;
uint local_38;
uint local_34;
uint local_30;
os_alloc_mem(0,&local_40,0x110c);
uVar2 = 0xe0000;
if (local_40 != (void *)0x0) {
memset(local_40,0,0x110c) //possible issue identified - semgrep
local_30 = ((*(ushort *)((int)param_2 + 6) ^ 2) << 0x1e) >> 0x1f;
__s = (char *)((int)local_40 + 3U & 0xfffffffc);
sVar3 = strlen((char *)*param_2);
if (0 < (int)sVar3) {
__n = 0xff //possible issue identified - semgrep
if ((int)sVar3 < 0x100) {
__n = sVar3;
}
memmove(__s + 0x1000,(void *)*param_2,__n) //possible issue identified - semgrep
local_3c = __s + 0x1000;
sprintf(__s,"\n") //possible issue identified - semgrep
uVar2 = 0;
LAB_0008883c:
do {
pcVar6 = strsep(&local_3c,",");
if (pcVar6 == (char *)0x0) goto LAB_00088b88;
if (*pcVar6 != '\0') {
pcVar4 = strchr(pcVar6,0x3d);
if (pcVar4 == (char *)0x0) {
LAB_00087f38:
iVar5 = sscanf(pcVar6,"%d",&local_38) //possible issue identified - semgrep
uVar7 = Status;
if ((iVar5 != 1) || (*(uint *)(param_1 + 0xa8) < local_38)) goto LAB_00088864;
iVar5 = 0;
if (*(char *)(param_1 + 0x76a0c) != -0x80) {
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_00087f94:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) == 0) {
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) == 0) && ((uVar7 << 0x10) >> 0x18 == local_38)) {
uVar2 = uVar7 & 0xff;
LAB_00088454:
if ((int)(uVar7 << 0xe) < 0) {
if (RTDebugLevel != 0) {
printk("BBP read R%d fail\n",local_38);
}
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
}
sVar3 = strlen(__s);
sprintf(__s + sVar3,"%03d = %02X\n",local_38,uVar2) //possible issue identified - semgrep
goto LAB_0008883c;
}
}
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_00088454;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_00087f94;
}
uVar9 = 0;
if (*(char *)(param_1 + 0xad) == '\x01') {
Status = Status & 0xfffffffe;
uVar9 = uVar7 & 1;
}
iVar5 = 0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_0008806c:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) != 0) {
LAB_0008810c:
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_00088114;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_0008806c;
}
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) != 0) || ((uVar7 << 0x10) >> 0x18 != local_38))
goto LAB_0008810c;
uVar2 = uVar7 & 0xff;
LAB_00088114:
if ((int)(uVar7 << 0xe) < 0) {
printk("ERROR!!! ");
printk("BBP(viaMCU=%d) read R%d fail\n",0,local_38);
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
if ((cVar1 == '\x01') && (Status = Status & 0xfffffffe, uVar9 != 0)) {
Status = Status | 1;
}
sVar3 = strlen(__s);
pcVar6 = "R%02d[0x%02x]:%02X ";
}
else {
*pcVar4 = '\0';
if ((pcVar4 + 1 == (char *)0x0) || (pcVar4[1] == '\0')) goto LAB_00087f38;
iVar5 = sscanf(pcVar6,"%d",&local_38) //possible issue identified - semgrep
if ((iVar5 != 1) ||
((iVar5 = sscanf(pcVar4 + 1,"%lx",&local_34), uVar7 = Status, iVar5 != 1 || //possible issue identified - semgrep
(*(uint *)(param_1 + 0xa8) < local_38)))) goto LAB_00088864;
iVar5 = 0;
if (*(char *)(param_1 + 0x76a0c) != -0x80) {
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_00088208:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) == 0) {
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) == 0) && ((uVar7 << 0x10) >> 0x18 == local_38)) {
uVar2 = uVar7 & 0xff;
LAB_000882b0:
if ((int)(uVar7 << 0xe) < 0) {
if (RTDebugLevel != 0) {
printk("BBP read R%d fail\n",local_38);
}
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
iVar5 = 0;
do {
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) == 0) {
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) =
local_34 & 0xff | 0xa0000 | (local_38 & 0xff) << 8;
}
*(char *)(param_1 + (local_38 & 0xff) + 0x4ac9) = (char)local_34;
if (iVar5 != 100) goto LAB_00088398;
break;
}
iVar5 = iVar5 + 1;
} while (iVar5 != 100);
if (RTDebugLevel != 0) {
printk("BBP write R%d fail\n",local_38 & 0xff);
}
LAB_00088398:
iVar5 = 0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
do {
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) == 0) {
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) =
(local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) == 0) && ((uVar7 << 0x10) >> 0x18 == local_38)) {
uVar2 = uVar7 & 0xff;
goto LAB_00088454;
}
}
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_00088454;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
} while( true );
}
}
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_000882b0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_00088208;
}
uVar9 = 0;
if (*(char *)(param_1 + 0xad) == '\x01') {
Status = Status & 0xfffffffe;
uVar9 = uVar7 & 1;
}
iVar5 = 0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_000884e0:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) != 0) {
LAB_00088580:
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_00088588;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_000884e0;
}
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) != 0) || ((uVar7 << 0x10) >> 0x18 != local_38))
goto LAB_00088580;
uVar2 = uVar7 & 0xff;
LAB_00088588:
if ((int)(uVar7 << 0xe) < 0) {
printk("ERROR!!! ");
printk("BBP(viaMCU=%d) read R%d fail\n",0,local_38);
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
if (cVar1 == '\x01') {
Status = Status & 0xfffffffe;
if (uVar9 != 0) {
Status = Status | 1;
}
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
uVar7 = Status;
uVar9 = 0;
if (cVar1 == '\x01') {
Status = Status & 0xfffffffe;
uVar9 = uVar7 & 1;
}
iVar5 = 1;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
while( true ) {
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) == 0) break;
iVar5 = iVar5 + 1;
printk(&_LC223) //possible issue identified - semgrep
if (iVar5 == 100) goto LAB_000886a0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
}
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) =
local_34 & 0xff | 0xa0000 | (local_38 & 0xff) << 8;
}
*(char *)(param_1 + (local_38 & 0xff) + 0x4ac9) = (char)local_34;
if (iVar5 != 100) {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
goto LAB_000886bc;
}
LAB_000886a0:
printk("ERROR!!! ");
printk("BBP write R%d fail\n",local_38 & 0xff);
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
LAB_000886bc:
if (cVar1 == '\x01') {
Status = Status & 0xfffffffe;
if (uVar9 != 0) {
Status = Status | 1;
}
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
uVar7 = Status;
uVar9 = 0;
if (cVar1 == '\x01') {
Status = Status & 0xfffffffe;
uVar9 = uVar7 & 1;
}
iVar5 = 0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_0008870c:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) != 0) {
LAB_000887ac:
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_000887b4;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_0008870c;
}
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) != 0) || ((uVar7 << 0x10) >> 0x18 != local_38))
goto LAB_000887ac;
uVar2 = uVar7 & 0xff;
LAB_000887b4:
if ((int)(uVar7 << 0xe) < 0) {
printk("ERROR!!! ");
printk("BBP(viaMCU=%d) read R%d fail\n",0,local_38);
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
if ((cVar1 == '\x01') && (Status = Status & 0xfffffffe, uVar9 != 0)) {
Status = Status | 1;
}
sVar3 = strlen(__s);
pcVar6 = "R%02d[0x%02X]:%02X\n";
}
sprintf(__s + sVar3,pcVar6,local_38,local_38,uVar2) //possible issue identified - semgrep
}
} while( true );
}
uVar2 = 0;
LAB_00088864:
memset(__s,0,0x1000) //possible issue identified - semgrep
sprintf(__s,"\n") //possible issue identified - semgrep
for (local_38 = 0; uVar7 = Status, local_38 <= *(uint *)(param_1 + 0xa8);
local_38 = local_38 + 1) {
iVar5 = 0;
if (*(char *)(param_1 + 0x76a0c) == -0x80) {
uVar9 = 0;
if (*(char *)(param_1 + 0xad) == '\x01') {
Status = Status & 0xfffffffe;
uVar9 = uVar7 & 1;
}
iVar5 = 0;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_00088a0c:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) != 0) {
LAB_00088aac:
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_00088ab4;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_00088a0c;
}
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) != 0) || ((uVar7 << 0x10) >> 0x18 != local_38)) goto LAB_00088aac;
uVar2 = uVar7 & 0xff;
LAB_00088ab4:
if ((int)(uVar7 << 0xe) < 0) {
printk("ERROR!!! ");
printk("BBP(viaMCU=%d) read R%d fail\n",0,local_38);
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
else {
cVar1 = *(char *)(param_1 + 0xad) //possible issue identified - semgrep
}
if ((cVar1 == '\x01') && (Status = Status & 0xfffffffe, uVar9 != 0)) {
Status = Status | 1;
}
sVar3 = strlen(__s);
sprintf(__s + sVar3,"R%02d[0x%02X]:%02X ",local_38,local_38,uVar2) //possible issue identified - semgrep
if ((int)local_38 % 5 == 4) {
sVar3 = strlen(__s);
sprintf(__s + sVar3,"\n") //possible issue identified - semgrep
}
}
else {
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
LAB_000888dc:
uVar7 = 0;
if (cVar1 == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if ((uVar7 & 0x20000) != 0) {
LAB_0008897c:
iVar5 = iVar5 + 1;
if (iVar5 == 100) goto LAB_00088984;
cVar1 = *(char *)(param_1 + 0xec) //possible issue identified - semgrep
goto LAB_000888dc;
}
if (cVar1 == '\0') {
*(uint *)(*(int *)(param_1 + 0xdc) + 0x101c) = (local_38 & 0xff) << 8 | 0xb0000;
}
iVar8 = 1;
while( true ) {
uVar7 = 0;
if (*(char *)(param_1 + 0xec) == '\0') {
uVar7 = *(uint *)(*(int *)(param_1 + 0xdc) + 0x101c);
}
if (((uVar7 & 0x20000) == 0) || (iVar8 == 100)) break;
iVar8 = iVar8 + 1;
}
if (((uVar7 & 0x20000) != 0) || ((uVar7 << 0x10) >> 0x18 != local_38)) goto LAB_0008897c;
uVar2 = uVar7 & 0xff;
LAB_00088984:
if ((int)(uVar7 << 0xe) < 0) {
if (RTDebugLevel != 0) {
printk("BBP read R%d fail\n",local_38);
}
uVar2 = (uint)*(byte *)(param_1 + local_38 + 0x4ac9);
}
sVar3 = strlen(__s);
sprintf(__s + sVar3,"%03d = %02X\n",local_38,uVar2) //possible issue identified - semgrep
}
}
LAB_00088b88:
sVar3 = strlen(__s);
uVar2 = sVar3 & 0xffff;
uVar7 = *param_2;
*(short *)(param_2 + 1) = (short)sVar3;
if (((uVar7 + uVar2 | uVar7 | uVar2) & *(uint *)(unaff_gp + 0x18)) == 0) {
__copy_user(uVar7,__s);
}
if ((uVar2 != 0) && (2 < RTDebugLevel)) {
printk("%s: copy_to_user() fail\n","RTMPAPIoctlBBP");
}
if (local_30 == 0) {
if (RTDebugLevel != 0) {
sVar3 = strlen(__s);
printk("Dump BBP msg[%d]=\n",sVar3);
}
printk(&_LC160,__s) //possible issue identified - semgrep
}
os_free_mem(0,local_40);
uVar2 = 0xe0000;
if ((local_30 == 0) && (uVar2 = (uint)(RTDebugLevel < 3), uVar2 == 0)) {
uVar2 = printk("<==RTMPIoctlBBP\n\n");
}
}
return uVar2;
}