undefined4 RTEnqueueInternalCmd(int param_1,undefined4 param_2,void *param_3,size_t param_4)
{
bool bVar1;
int iVar2;
undefined4 uVar3;
undefined4 *local_28 [3];
local_28[0] = (undefined4 *)0x0;
iVar2 = os_alloc_mem(param_1,local_28,0x14);
if ((iVar2 == 0) && (local_28[0] != (undefined4 *)0x0)) {
memset(local_28[0],0,0x14) //possible issue identified - semgrep
if (param_4 == 0) {
local_28[0][1] = 0;
local_28[0][2] = 0;
}
else {
iVar2 = os_alloc_mem(param_1,local_28[0] + 1,param_4) //possible issue identified - semgrep
if ((iVar2 != 0) || ((void *)local_28[0][1] == (void *)0x0)) {
os_free_mem(param_1,local_28[0]);
return 3;
}
memmove((void *)local_28[0][1],param_3,param_4) //possible issue identified - semgrep
local_28[0][2] = param_4;
}
*local_28[0] = param_2;
*(undefined1 *)(local_28[0] + 3) = 0;
uVar3 = 0;
if (local_28[0] != (undefined4 *)0x0) {
local_bh_disable();
if ((*(uint *)(param_1 + 0x29c8) & 3) == 0) {
bVar1 = true;
}
else {
if (*(int *)(param_1 + 0x29bc) == 0) {
*(undefined4 **)(param_1 + 0x29c0) = local_28[0];
}
else {
*(undefined4 **)(*(int *)(param_1 + 0x29c4) + 0x10) = local_28[0];
}
*(undefined4 **)(param_1 + 0x29c4) = local_28[0];
local_28[0][4] = 0;
*(int *)(param_1 + 0x29bc) = *(int *)(param_1 + 0x29bc) + 1;
bVar1 = false;
}
local_bh_enable();
if (bVar1) {
if (local_28[0][1] != 0) {
os_free_mem(param_1);
}
os_free_mem(param_1,local_28[0]);
uVar3 = 0;
}
else {
RtmpOsCmdUp(param_1 + 0x29cc);
uVar3 = 0;
}
}
}
else {
uVar3 = 3;
}
return uVar3;
}