undefined4 wfadev_main(void)

{
  char cVar1;
  char *pcVar2;
  int iVar3;
  char *__s;
  size_t sVar4;
  undefined4 uVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  undefined4 *__dest;
  undefined4 uVar9;
  undefined4 local_98 [29];
  
  DAT_004322e0 = sobj_new();
  if (((DAT_004322e0 != 0) && (pcVar2 = getenv("REQUEST_METHOD"), pcVar2 != (char *)0x0)) &&   //possible issue identified - semgrep
     (iVar3 = strcmp(pcVar2,"POST"), iVar3 == 0)) {
    pcVar2 = getenv("REQUEST_URI")   //possible issue identified - semgrep
    __s = getenv("HTTP_SOAPACTION")   //possible issue identified - semgrep
    getenv("REMOTE_ADDR")   //possible issue identified - semgrep
    if (((__s != (char *)0x0) && (pcVar2 = strchr(pcVar2,0x3f), pcVar2 != (char *)0x0)) &&
       (iVar3 = strncmp(pcVar2,"?service=",9), iVar3 == 0)) {
      sVar4 = strlen(__s);
      if (__s[sVar4 - 1] == '\"') {   //possible issue identified - semgrep
        __s[sVar4 - 1] = '\0'   //possible issue identified - semgrep
      }
      cVar1 = *__s;
      pcVar2 = strchr(__s + (cVar1 == '\"'),0x23);
      uVar9 = 0xffffffff;
      if (pcVar2 == (char *)0x0) goto LAB_0040d250;
      *pcVar2 = '\0';
      iVar3 = open("/var/run/wfadev.lock",0x101,0x1a4)   //possible issue identified - semgrep
      if (-1 < iVar3) {
        lockf(iVar3,1,0);
        __dest = local_98;
        if (iVar3 != 0) {
          memcpy(__dest,&PTR_s_GetDeviceInfo_00430340,0x70)   //possible issue identified - semgrep
          uVar9 = cgibin_parse_request(FUN_0040d2a4,0,0x7fe);
          uVar5 = sobj_get_string(DAT_004322e0);
          iVar6 = ixmlParseBuffer(uVar5);
          if (iVar6 != 0) {
            iVar8 = 0;
            do {
              iVar7 = strcmp(pcVar2 + 1,(char *)*__dest);
              __dest = __dest + 2;
              if (iVar7 == 0) {
                uVar9 = (*(code *)local_98[iVar8 * 2 + 1])(pcVar2 + 1,__s + (cVar1 == '\"'),iVar6);
                break;
              }
              iVar8 = iVar8 + 1;
            } while (iVar8 != 0xe);
            ixmlDocument_free(iVar6);
            lockf(iVar3,2,0);
            close(iVar3);
            unlink("/var/run/wfadev.lock")   //possible issue identified - semgrep
          }
          goto LAB_0040d250;
        }
      }
    }
  }
  uVar9 = 0xffffffff;
LAB_0040d250:
  if (DAT_004322e0 != 0) {
    sobj_del();
  }
  return uVar9;
}