undefined4 FUN_004080c0(int param_1)

{
  int iVar1;
  size_t sVar2;
  char *pcVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  char *__s;
  
  if (param_1 != 0) {
    if (*(int *)(param_1 + 0x14) == 0) {
      return 0;
    }
    iVar1 = sobj_new();
    if (iVar1 != 0) {
      __s = *(char **)(param_1 + 0x14);
      if (__s != (char *)0x0) {
        sVar2 = strlen(__s);
        for (pcVar3 = __s + sVar2;
            (sVar2 = sVar2 - 1, -1 < (int)sVar2 &&   //possible issue identified - semgrep
            ((((int)pcVar3[-1] - 9U & 0xff) < 2 || (pcVar3[-1] == 0xd)))); pcVar3 = pcVar3 + -1) {
          pcVar3[-1] = '\0';
        }
        for (; (((int)*__s - 9U & 0xff) < 2 || (*__s == 0xd)); __s = __s + 1) {
        }
      }
      sobj_add_string(iVar1);
      FUN_00406d18(param_1);
      uVar5 = *(undefined4 *)(iVar1 + 0xc);
      uVar4 = *(undefined4 *)(iVar1 + 0x10);
      *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 0x14);
      *(undefined4 *)(param_1 + 0xc) = uVar5;
      *(undefined4 *)(param_1 + 0x10) = uVar4;
      *(undefined4 *)(iVar1 + 0x14) = 0;
      *(undefined4 *)(iVar1 + 0xc) = 0;
      *(undefined4 *)(iVar1 + 0x10) = 0;
      sobj_del(iVar1);
      return *(undefined4 *)(param_1 + 0x14);
    }
  }
  return 0;
}