user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<cleanname>:
  endbr64
  lea    D0(%rip),%r8
  test   %rdi,%rdi
  je     L404
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x8,%rsp
  movzbl (%rdi),%eax
  test   %al,%al
  je     L156
  mov    %rdi,%rcx
  mov    %rdi,%rdx
  mov    $0x1,%esi
  jmp    L373
  nopl   (%rax)
L50:
  cmp    $0x2e,%al
  jne    L291
  test   %esi,%esi
  jne    L274
L291:
  mov    %al,(%rdx)
  xor    %esi,%esi
  mov    %rcx,%rax
  add    $0x1,%rdx
L90:
  lea    0x1(%rax),%rcx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  je     L305
L373:
  cmp    $0x2f,%al
  jne    L50
  cmp    %rdx,%rbp
  je     L333
  cmpb   $0x2f,-0x1(%rdx)
  je     L16
L333:
  mov    %rcx,%rax
  movb   $0x2f,(%rdx)
  mov    $0x1,%esi
  add    $0x1,%rdx
  lea    0x1(%rax),%rcx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  jne    L373
L305:
  lea    0x1(%rbp),%r13
  cmp    %rdx,%r13
  jae    L179
  cmpb   $0x2f,-0x1(%rdx)
  je     L385
L179:
  cmp    %rbp,%rdx
  je     L121
  movb   $0x0,(%rdx)
  movzbl 0x0(%rbp),%edx
  test   %dl,%dl
  je     L327
L330:
  mov    %rbp,%rbx
  mov    %rbp,%rdi
  mov    $0x1,%eax
  xor    %r12d,%r12d
  lea    D26(%rip),%r15
  lea    D29(%rip),%r14
  jmp    L363
  cs nopw 0x0(%rax,%rax,1)
L131:
  cmp    $0x2e,%dl
  jne    L361
  test   %eax,%eax
  jne    L110
L361:
  mov    %dl,(%rdi)
  movzbl 0x1(%rbx),%edx
  add    $0x1,%rdi
  xor    %eax,%eax
L192:
  add    $0x1,%rbx
  test   %dl,%dl
  je     L30
L363:
  cmp    $0x2f,%dl
  jne    L131
  movb   $0x2f,(%rdi)
  movzbl 0x1(%rbx),%edx
  add    $0x1,%r12
  add    $0x1,%rdi
  mov    $0x1,%eax
  add    $0x1,%rbx
  test   %dl,%dl
  jne    L363
L30:
  cmp    %rdi,%r13
  jae    L218
  cmpb   $0x2f,-0x1(%rdi)
  je     L96
L218:
  cmpb   $0x0,0x0(%rbp)
  jne    L267
L327:
  movb   $0x2f,0x0(%rbp)
  mov    %r13,%rdi
L267:
  movb   $0x0,(%rdi)
  mov    %rbp,%r8
L156:
  add    $0x8,%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L110:
  cmpb   $0x2e,0x1(%rbx)
  jne    L361
  movzbl 0x2(%rbx),%eax
  cmp    $0x2f,%al
  je     L382
  test   %al,%al
  jne    L361
L382:
  test   %r12,%r12
  jne    L149
  test   %al,%al
  mov    %r14,%rsi
  cmovne %r15,%rsi
  call   <stpcpy@plt>
  cmpb   $0x0,0x2(%rbx)
  mov    %rax,%rdi
  je     L30
  movzbl 0x3(%rbx),%edx
  mov    $0x1,%eax
  add    $0x2,%rbx
  jmp    L192
L274:
  movzbl 0x1(%rcx),%esi
  cmp    $0x2f,%sil
  je     L141
  test   %sil,%sil
  jne    L291
L141:
  cmp    $0x1,%sil
  mov    %rcx,%rax
  mov    $0x1,%esi
  sbb    $0xffffffffffffffff,%rax
  jmp    L90
  nopl   0x0(%rax,%rax,1)
L16:
  mov    %rcx,%rax
  mov    $0x1,%esi
  jmp    L90
  nopl   (%rax)
L121:
  movb   $0x2e,(%rdx)
  add    $0x1,%rdx
  movb   $0x0,(%rdx)
  movzbl 0x0(%rbp),%edx
  test   %dl,%dl
  jne    L330
  jmp    L327
  nopl   0x0(%rax,%rax,1)
L96:
  movb   $0x0,-0x1(%rdi)
  sub    $0x1,%rdi
  jmp    L218
  nopl   (%rax)
L385:
  movb   $0x0,-0x1(%rdx)
  sub    $0x1,%rdx
  jmp    L179
  nopl   (%rax)
L404:
  mov    %r8,%rax
  ret
L149:
  cmp    $0x1,%al
  sbb    $0xfffffffffffffffe,%rbx
  xor    %eax,%eax
  cmpb   $0x2f,0x0(%rbp)
  setne  %al
  sub    %rax,%r12
  cmp    %rdi,%r13
  jb     L292
L157:
  movzbl 0x1(%rbx),%edx
  mov    $0x1,%eax
  jmp    L192
  nopl   0x0(%rax)
L292:
  sub    $0x1,%rdi
  movb   $0x0,(%rdi)
  cmpb   $0x2f,-0x1(%rdi)
  je     L157
  sub    $0x1,%rdi
  movb   $0x0,(%rdi)
  cmpb   $0x2f,-0x1(%rdi)
  jne    L292
  jmp    L157
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D0
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D26
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D29
type_guessed: string

tool: D0: .

tool: D26: ../

tool: D29: ..

assistant: ```c
char *cleanname(char *filename) {
  size_t parts = 0;
  int start;
  char *w;
  char *r;
  if ((filename == NULL) || !*filename)
    return ".";
  for (w = r = filename, start = 1; *r; r++)
    if (*r == '/') {
      if ((w == filename) || (w[-1] != '/'))
        *w++ = '/';
      start = 1;
    } else if (start && ((r[0] == '.') && (r[1 - 1] == '.') && (((r[1]) == '/') || !(r[1]))))
      r += r[1] ? 1 : 0;
    else
      *w++ = *r, start = 0;
  if ((w > filename + 1) && (w[-1] == '/'))
    *--w = 0;
  if (w == filename)
    *w++ = '.';
  *w = 0;
  for (w = r = filename, start = 1; *r; r++)
    if (*r == '/')
      *w++ = '/', start = 1, parts++;
    else if (start && ((r[0] == '.') && (r[2 - 1] == '.') && (((r[2]) == '/') || !(r[2])))) {
      if (!parts)
        w = stpcpy(w, r[2] ? "../" : "..");
      r += r[2] ? 2 : 1;
      if (!parts)
        continue;
      parts -= (*filename != '/');
      if (w > filename + 1)
        do
          *--w = 0;
        while (w[-1] != '/');
    } else
      *w++ = *r, start = 0;
  if ((w > filename + 1) && (w[-1] == '/'))
    *--w = 0;
  if (!*filename)
    w = filename, *w++ = '/';
  *w = 0;
  return filename;
}
```