user: Translate the below assembly code into C programming language:

```asm
<cleanname>:
  endbr64
  lea    D6(%rip),%rdx
  test   %rdi,%rdi
  je     L295
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%rbx
  movzbl (%rdi),%eax
  test   %al,%al
  je     L357
  mov    %rdi,%rcx
  mov    %rdi,%rdx
  mov    $0x1,%esi
  mov    $0x0,%edi
  mov    $0x1,%r8d
  jmp    L23
L347:
  cmp    %rdx,%rbx
  je     L178
  cmpb   $0x2f,-0x1(%rdx)
  je     L99
L178:
  movb   $0x2f,(%rdx)
  mov    %rcx,%rax
  lea    0x1(%rdx),%rdx
  mov    %r8d,%esi
  jmp    L285
L328:
  mov    %al,(%rdx)
  mov    %rcx,%rax
  lea    0x1(%rdx),%rdx
  mov    %edi,%esi
L285:
  lea    0x1(%rax),%rcx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  je     L155
L23:
  cmp    $0x2f,%al
  je     L347
  cmp    $0x2e,%al
  jne    L328
  test   %esi,%esi
  je     L328
  movzbl 0x1(%rcx),%r9d
  cmp    $0x2f,%r9b
  je     L244
  test   %r9b,%r9b
  jne    L328
L244:
  cmp    $0x1,%r9b
  mov    %rcx,%rax
  sbb    $0xffffffffffffffff,%rax
  jmp    L285
L99:
  mov    %rcx,%rax
  mov    %r8d,%esi
  jmp    L285
L155:
  lea    0x1(%rbx),%r15
  cmp    %rdx,%r15
  jae    L317
  cmpb   $0x2f,-0x1(%rdx)
  je     L395
L317:
  cmp    %rbx,%rdx
  je     L89
L36:
  movb   $0x0,(%rdx)
  movzbl (%rbx),%edx
  test   %dl,%dl
  je     L327
  mov    %rbx,%rbp
  mov    %rbx,%rdi
  mov    $0x1,%r12d
  mov    $0x0,%r13d
  mov    $0x0,%r14d
  jmp    L274
L395:
  movb   $0x0,-0x1(%rdx)
  lea    -0x1(%rdx),%rdx
  jmp    L317
L89:
  movb   $0x2e,(%rdx)
  lea    0x1(%rdx),%rdx
  jmp    L36
L92:
  movb   $0x2f,(%rdi)
  add    $0x1,%r13
  mov    %rbp,%rax
  lea    0x1(%rdi),%rdi
  mov    $0x1,%r12d
  jmp    L214
L365:
  mov    %dl,(%rdi)
  mov    %rbp,%rax
  lea    0x1(%rdi),%rdi
  mov    %r14d,%r12d
L214:
  lea    0x1(%rax),%rbp
  movzbl 0x1(%rax),%edx
  test   %dl,%dl
  je     L142
L274:
  cmp    $0x2f,%dl
  je     L92
  cmp    $0x2e,%dl
  jne    L365
  test   %r12d,%r12d
  je     L365
  cmpb   $0x2e,0x1(%rbp)
  jne    L365
  movzbl 0x2(%rbp),%eax
  cmp    $0x2f,%al
  je     L381
  test   %al,%al
  jne    L365
L381:
  test   %r13,%r13
  jne    L111
  test   %al,%al
  lea    D27(%rip),%rsi
  lea    D15(%rip),%rax
  cmovne %rax,%rsi
  call   <stpcpy@plt>
  mov    %rax,%rdi
  lea    0x2(%rbp),%rax
  cmpb   $0x0,0x2(%rbp)
  jne    L214
  lea    0x1(%rbp),%rax
  jmp    L214
L142:
  cmp    %rdi,%r15
  jae    L108
  cmpb   $0x2f,-0x1(%rdi)
  je     L16
L108:
  cmpb   $0x0,(%rbx)
  je     L327
L30:
  movb   $0x0,(%rdi)
  mov    %rbx,%rdx
L357:
  mov    %rdx,%rax
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L16:
  movb   $0x0,-0x1(%rdi)
  lea    -0x1(%rdi),%rdi
  jmp    L108
L327:
  movb   $0x2f,(%rbx)
  mov    %r15,%rdi
  jmp    L30
L111:
  cmp    $0x1,%al
  mov    %rbp,%rax
  sbb    $0xfffffffffffffffe,%rax
  cmpb   $0x2f,(%rbx)
  setne  %dl
  movzbl %dl,%edx
  sub    %rdx,%r13
  cmp    %rdi,%r15
  jae    L214
L74:
  sub    $0x1,%rdi
  movb   $0x0,(%rdi)
  cmpb   $0x2f,-0x1(%rdi)
  jne    L74
  jmp    L214
L295:
  mov    %rdx,%rax
  ret
```

tool_calls: name: retrieve_data
arguments: tag: D6
type: string
name: retrieve_data
arguments: tag: D27
type: string
name: retrieve_data
arguments: tag: D15
type: string

tool: D6: .

tool: D27: ..

tool: D15: ../

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;
}
```