char *filename_cleanup(const char *in_) {
  char *in = dupstr_(
      (in_), (__FUNCTION__),
      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
      "2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/file.c",
      __FUNCTION__, 563);
  for (;;) {
    if (strstr(in, "//")) {
      char *newname = strsub(in, "//", "/");
      myfree_((in),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/"
              "file.c",
              __FUNCTION__, 568);
      in = newname;
      continue;
    }
    if (strstr(in, "../")) {
      char *newname = strsub(in, "../", "/");
      myfree_((in),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/"
              "file.c",
              __FUNCTION__, 575);
      in = newname;
      continue;
    }
    if (strstr(in, "./")) {
      char *newname = strsub(in, "./", "/");
      myfree_((in),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/"
              "file.c",
              __FUNCTION__, 582);
      in = newname;
      continue;
    }
    if (strstr(in, "~/")) {
      char *newname = strsub(in, "~/", "/");
      myfree_((in),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/"
              "file.c",
              __FUNCTION__, 589);
      in = newname;
      continue;
    }
    break;
  }
  return (in);
}


x86 assembly (clang, -O0):
<filename_cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rcx
lea    0xeb3(%rip),%rdx
mov    $0x233,%r8d
mov    %rcx,%rsi
mov    $0x0,%al
call   1050 <dupstr_@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xf18(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     11d8 <filename_cleanup+0x98>
mov    -0x10(%rbp),%rdi
lea    0xefe(%rip),%rsi
lea    0xefc(%rip),%rdx
mov    $0x0,%al
call   1040 <strsub@plt>
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe59(%rip),%rsi
lea    0xe41(%rip),%rdx
mov    $0x238,%ecx
mov    $0x0,%al
call   1030 <myfree_@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <filename_cleanup+0x34>
mov    -0x10(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     123c <filename_cleanup+0xfc>
mov    -0x10(%rbp),%rdi
lea    0xe9d(%rip),%rsi
lea    0xe98(%rip),%rdx
mov    $0x0,%al
call   1040 <strsub@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xdf5(%rip),%rsi
lea    0xddd(%rip),%rdx
mov    $0x23f,%ecx
mov    $0x0,%al
call   1030 <myfree_@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <filename_cleanup+0x34>
mov    -0x10(%rbp),%rdi
lea    0xe54(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     12a0 <filename_cleanup+0x160>
mov    -0x10(%rbp),%rdi
lea    0xe3a(%rip),%rsi
lea    0xe34(%rip),%rdx
mov    $0x0,%al
call   1040 <strsub@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd91(%rip),%rsi
lea    0xd79(%rip),%rdx
mov    $0x246,%ecx
mov    $0x0,%al
call   1030 <myfree_@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <filename_cleanup+0x34>
mov    -0x10(%rbp),%rdi
lea    0xdf3(%rip),%rsi
call   1060 <strstr@plt>
cmp    $0x0,%rax
je     1304 <filename_cleanup+0x1c4>
mov    -0x10(%rbp),%rdi
lea    0xdd9(%rip),%rsi
lea    0xdd0(%rip),%rdx
mov    $0x0,%al
call   1040 <strsub@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xd2d(%rip),%rsi
lea    0xd15(%rip),%rdx
mov    $0x24d,%ecx
mov    $0x0,%al
call   1030 <myfree_@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1174 <filename_cleanup+0x34>
jmp    1309 <filename_cleanup+0x1c9>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_cleanup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebf(%rip),%rdx
lea    0xea7(%rip),%rcx
mov    %rcx,%rsi
mov    $0x233,%r8d
xor    %eax,%eax
call   1050 <dupstr_@plt>
mov    %eax,%r14d
lea    0xf24(%rip),%rbx
lea    0xf22(%rip),%r15
jmp    11ab <filename_cleanup+0x6b>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <strsub@plt>
mov    %eax,%r14d
mov    %r13,%rdi
lea    0xe77(%rip),%rsi
lea    0xe5f(%rip),%rdx
mov    %r12d,%ecx
xor    %eax,%eax
call   1030 <myfree_@plt>
movslq %r14d,%r13
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <strstr@plt>
mov    $0x238,%r12d
mov    %rbx,%rsi
test   %rax,%rax
jne    1180 <filename_cleanup+0x40>
mov    %r13,%rdi
lea    0xec9(%rip),%rbp
mov    %rbp,%rsi
call   1060 <strstr@plt>
mov    $0x23f,%r12d
mov    %rbp,%rsi
test   %rax,%rax
jne    1180 <filename_cleanup+0x40>
mov    %r13,%rdi
lea    0xeaa(%rip),%rbp
mov    %rbp,%rsi
call   1060 <strstr@plt>
mov    $0x246,%r12d
mov    %rbp,%rsi
test   %rax,%rax
jne    1180 <filename_cleanup+0x40>
mov    %r13,%rdi
lea    0xe89(%rip),%rbp
mov    %rbp,%rsi
call   1060 <strstr@plt>
mov    $0x24d,%r12d
mov    %rbp,%rsi
test   %rax,%rax
jne    1180 <filename_cleanup+0x40>
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__FUNCTION__.filename_cleanup = [17 x i8] c"filename_cleanup\00"
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/file.c\00"
@.str.1 = [3 x i8] c"//\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [4 x i8] c"../\00"
@.str.4 = [3 x i8] c"./\00"
@.str.5 = [3 x i8] c"~/\00"
define i8* @filename_cleanup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 (i8*, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @dupstr_ to i32 (i8*, i8*, i8*, i8*, i32, ...)*)(i8* %8, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 563)
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
br label %12
12: ; preds = %52, %40, %28, %16, %1
%13 = load i8*, i8** %3
%14 = call i8* @strstr(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %24
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @strsub to i32 (i8*, i8*, i8*, ...)*)(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %4
%21 = load i8*, i8** %3
%22 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @myfree_ to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %21, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 568)
%23 = load i8*, i8** %4
store i8* %23, i8** %3
br label %12
24: ; preds = %12
%25 = load i8*, i8** %3
%26 = call i8* @strstr(i8* %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %36
28: ; preds = %24
%29 = load i8*, i8** %3
%30 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @strsub to i32 (i8*, i8*, i8*, ...)*)(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = sext i32 %30 to i64
%32 = inttoptr i64 %31 to i8*
store i8* %32, i8** %5
%33 = load i8*, i8** %3
%34 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @myfree_ to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %33, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 575)
%35 = load i8*, i8** %5
store i8* %35, i8** %3
br label %12
36: ; preds = %24
%37 = load i8*, i8** %3
%38 = call i8* @strstr(i8* %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i8*, i8** %3
%42 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @strsub to i32 (i8*, i8*, i8*, ...)*)(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%43 = sext i32 %42 to i64
%44 = inttoptr i64 %43 to i8*
store i8* %44, i8** %6
%45 = load i8*, i8** %3
%46 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @myfree_ to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %45, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 582)
%47 = load i8*, i8** %6
store i8* %47, i8** %3
br label %12
48: ; preds = %36
%49 = load i8*, i8** %3
%50 = call i8* @strstr(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%51 = icmp ne i8* %50, null
br i1 %51, label %52, label %60
52: ; preds = %48
%53 = load i8*, i8** %3
%54 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @strsub to i32 (i8*, i8*, i8*, ...)*)(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%55 = sext i32 %54 to i64
%56 = inttoptr i64 %55 to i8*
store i8* %56, i8** %7
%57 = load i8*, i8** %3
%58 = call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @myfree_ to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %57, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 589)
%59 = load i8*, i8** %7
store i8* %59, i8** %3
br label %12
60: ; preds = %48
br label %61
61: ; preds = %60
%62 = load i8*, i8** %3
ret i8* %62
}

LLVM IR (-O2):
@__FUNCTION__.filename_cleanup = [17 x i8] c"filename_cleanup\00"
@.str = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/goblinhack/fatdisk/refs/heads/master/file.c\00"
@.str.1 = [3 x i8] c"//\00"
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [4 x i8] c"../\00"
@.str.4 = [3 x i8] c"./\00"
@.str.5 = [3 x i8] c"~/\00"
define i8* @filename_cleanup(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @dupstr_ to i32 (i8*, i8*, i8*, i8*, i32, ...)*)(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 563)
br label %3
3: ; preds = %9, %1
%4 = phi i32 [ %2, %1 ], [ %12, %9 ]
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = tail call i8* @strstr(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %14, label %9
9: ; preds = %3, %20, %17, %14
%10 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), %14 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %17 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %20 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %3 ]
%11 = phi i32 [ 575, %14 ], [ 582, %17 ], [ 589, %20 ], [ 568, %3 ]
%12 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @strsub to i32 (i8*, i8*, i8*, ...)*)(i8* %6, i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 (i8*, i8*, i8*, i32, ...) bitcast (i32 (...)* @myfree_ to i32 (i8*, i8*, i8*, i32, ...)*)(i8* %6, i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.filename_cleanup, i64 0, i64 0), i32 %11)
br label %3
14: ; preds = %3
%15 = tail call i8* @strstr(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %9
17: ; preds = %14
%18 = tail call i8* @strstr(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%19 = icmp eq i8* %18, null
br i1 %19, label %20, label %9
20: ; preds = %17
%21 = tail call i8* @strstr(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %9
23: ; preds = %20
%24 = inttoptr i64 %5 to i8*
ret i8* %24
}