undefined4 FUN_00407ea0(void *param_1,undefined4 param_2,int param_3)

{
  int __fd;
  int iVar1;
  ssize_t sVar2;
  undefined4 uVar3;
  char acStack_50 [64];
  
  sprintf(acStack_50,"%s/%d","/var/session",param_2)   //possible issue identified - semgrep
  if (param_3 == 0) {
    __fd = open(acStack_50,2)   //possible issue identified - semgrep
    if (__fd == 0) {
      return 0xffffffff;
    }
    iVar1 = lockf(__fd,1,0);
    uVar3 = 0xffffffff;
    if (iVar1 != 0) goto LAB_00407fd0;
    sVar2 = read(__fd,param_1,0xe8)   //possible issue identified - semgrep
    uVar3 = 0;
    if (sVar2 == 0xe8) goto LAB_00407fd0;
  }
  else {
    if ((param_3 != 1) || (__fd = open(acStack_50,0x302,0x1ff), __fd == 0)) {   //possible issue identified - semgrep
      return 0xffffffff;
    }
    iVar1 = lockf(__fd,1,0);
    uVar3 = 0xffffffff;
    if (iVar1 != 0) goto LAB_00407fd0;
    sVar2 = write(__fd,param_1,0xe8);
    uVar3 = 0;
    if (sVar2 != 0) goto LAB_00407fd0;
  }
  uVar3 = 0xffffffff;
LAB_00407fd0:
  close(__fd);
  return uVar3;
}