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

```asm
<cleanname>:
  endbr64
  lea    D20(%rip),%r8
  test   %rdi,%rdi
  je     L58
  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     L172
  mov    %rdi,%rcx
  mov    %rdi,%rdx
  mov    $0x1,%esi
  jmp    L25
  nopl   (%rax)
L98:
  cmp    $0x2e,%al
  jne    L290
  test   %esi,%esi
  jne    L407
L290:
  mov    %al,(%rdx)
  xor    %esi,%esi
  mov    %rcx,%rax
  add    $0x1,%rdx
L382:
  lea    0x1(%rax),%rcx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  je     L375
L25:
  cmp    $0x2f,%al
  jne    L98
  cmp    %rdx,%rbp
  je     L188
  cmpb   $0x2f,-0x1(%rdx)
  je     L47
L188:
  mov    %rcx,%rax
  movb   $0x2f,(%rdx)
  mov    $0x1,%esi
  add    $0x1,%rdx
  lea    0x1(%rax),%rcx
  movzbl 0x1(%rax),%eax
  test   %al,%al
  jne    L25
L375:
  lea    0x1(%rbp),%r13
  cmp    %rdx,%r13
  jae    L257
  cmpb   $0x2f,-0x1(%rdx)
  je     L383
L257:
  cmp    %rbp,%rdx
  je     L155
  movb   $0x0,(%rdx)
  movzbl 0x0(%rbp),%edx
  test   %dl,%dl
  je     L372
L352:
  mov    %rbp,%rbx
  mov    %rbp,%rdi
  mov    $0x1,%eax
  xor    %r12d,%r12d
  lea    D13(%rip),%r15
  lea    D7(%rip),%r14
  jmp    L219
  cs nopw 0x0(%rax,%rax,1)
L400:
  cmp    $0x2e,%dl
  jne    L276
  test   %eax,%eax
  jne    L120
L276:
  mov    %dl,(%rdi)
  movzbl 0x1(%rbx),%edx
  add    $0x1,%rdi
  xor    %eax,%eax
L169:
  add    $0x1,%rbx
  test   %dl,%dl
  je     L124
L219:
  cmp    $0x2f,%dl
  jne    L400
  movb   $0x2f,(%rdi)
  movzbl 0x1(%rbx),%edx
  add    $0x1,%r12
  add    $0x1,%rdi
  mov    $0x1,%eax
  add    $0x1,%rbx
  test   %dl,%dl
  jne    L219
L124:
  cmp    %rdi,%r13
  jae    L211
  cmpb   $0x2f,-0x1(%rdi)
  je     L376
L211:
  cmpb   $0x0,0x0(%rbp)
  jne    L77
L372:
  movb   $0x2f,0x0(%rbp)
  mov    %r13,%rdi
L77:
  movb   $0x0,(%rdi)
  mov    %rbp,%r8
L172:
  add    $0x8,%rsp
  mov    %r8,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L120:
  cmpb   $0x2e,0x1(%rbx)
  jne    L276
  movzbl 0x2(%rbx),%eax
  cmp    $0x2f,%al
  je     L297
  test   %al,%al
  jne    L276
L297:
  test   %r12,%r12
  jne    L32
  test   %al,%al
  mov    %r14,%rsi
  cmovne %r15,%rsi
  call   <stpcpy@plt>
  cmpb   $0x0,0x2(%rbx)
  mov    %rax,%rdi
  je     L124
  movzbl 0x3(%rbx),%edx
  mov    $0x1,%eax
  add    $0x2,%rbx
  jmp    L169
L407:
  movzbl 0x1(%rcx),%esi
  cmp    $0x2f,%sil
  je     L355
  test   %sil,%sil
  jne    L290
L355:
  cmp    $0x1,%sil
  mov    %rcx,%rax
  mov    $0x1,%esi
  sbb    $0xffffffffffffffff,%rax
  jmp    L382
  nopl   0x0(%rax,%rax,1)
L47:
  mov    %rcx,%rax
  mov    $0x1,%esi
  jmp    L382
  nopl   (%rax)
L155:
  movb   $0x2e,(%rdx)
  add    $0x1,%rdx
  movb   $0x0,(%rdx)
  movzbl 0x0(%rbp),%edx
  test   %dl,%dl
  jne    L352
  jmp    L372
  nopl   0x0(%rax,%rax,1)
L376:
  movb   $0x0,-0x1(%rdi)
  sub    $0x1,%rdi
  jmp    L211
  nopl   (%rax)
L383:
  movb   $0x0,-0x1(%rdx)
  sub    $0x1,%rdx
  jmp    L257
  nopl   (%rax)
L58:
  mov    %r8,%rax
  ret
L32:
  cmp    $0x1,%al
  sbb    $0xfffffffffffffffe,%rbx
  xor    %eax,%eax
  cmpb   $0x2f,0x0(%rbp)
  setne  %al
  sub    %rax,%r12
  cmp    %rdi,%r13
  jb     L340
L36:
  movzbl 0x1(%rbx),%edx
  mov    $0x1,%eax
  jmp    L169
  nopl   0x0(%rax)
L340:
  sub    $0x1,%rdi
  movb   $0x0,(%rdi)
  cmpb   $0x2f,-0x1(%rdi)
  je     L36
  sub    $0x1,%rdi
  movb   $0x0,(%rdi)
  cmpb   $0x2f,-0x1(%rdi)
  jne    L340
  jmp    L36
```

tool_calls: name: read_data
arguments: data_tag: D20
type_guessed: string
name: read_data
arguments: data_tag: D13
type_guessed: string
name: read_data
arguments: data_tag: D7
type_guessed: string

tool: D20: .

tool: D13: ../

tool: D7: ..

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