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

```asm
<tidy_path>:
  endbr64
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <strlen@plt>
  cltq
  lea    -0x1(%r13,%rax,1),%rax
  cmpb   $0x2f,(%rax)
  je     L174
  mov    $0x2f,%edx
  mov    %dx,0x1(%rax)
L174:
  xor    %r12d,%r12d
  lea    D27(%rip),%rbp
  lea    D36(%rip),%rbx
  jmp    L95
  xchg   %ax,%ax
L94:
  mov    $0x1,%r12d
L95:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <substr@plt>
  test   %rax,%rax
  jne    L94
  lea    D33(%rip),%rbx
  jmp    L14
  nopw   0x0(%rax,%rax,1)
L247:
  mov    $0x1,%r12d
L14:
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <substr@plt>
  test   %rax,%rax
  jne    L247
  lea    D7(%rip),%rbx
  mov    %r13,%rdi
  mov    %rbx,%rsi
  call   <strstr@plt>
  test   %rax,%rax
  je     L134
  nopl   0x0(%rax,%rax,1)
L41:
  lea    -0x1(%rax),%rdx
  cmp    %rdx,%r13
  jne    L11
  jmp    L122
  xchg   %ax,%ax
L160:
  sub    $0x1,%rdx
  cmp    %rdx,%r13
  je     L122
L11:
  cmpb   $0x2f,(%rdx)
  jne    L160
L155:
  xor    %ecx,%ecx
  nopl   0x0(%rax)
L183:
  movzbl 0x3(%rax,%rcx,1),%esi
  mov    $0x1,%r12d
  mov    %sil,(%rdx,%rcx,1)
  add    $0x1,%rcx
  test   %sil,%sil
  jne    L183
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <strstr@plt>
  test   %rax,%rax
  jne    L41
L134:
  cmpb   $0x0,0x0(%r13)
  je     L103
L106:
  mov    %r13,%rdi
  call   <strlen@plt>
  cltq
  lea    -0x1(%r13,%rax,1),%rdx
  cmp    %rdx,%r13
  je     L191
  cmpb   $0x2f,(%rdx)
  je     L149
L191:
  lea    D42(%rip),%rbx
  nopw   0x0(%rax,%rax,1)
L44:
  mov    $0x2,%edx
  mov    %rbx,%rsi
  mov    %r13,%rdi
  call   <strncmp@plt>
  test   %eax,%eax
  jne    L63
  lea    0x2(%r13),%rax
  nopl   0x0(%rax,%rax,1)
L62:
  movzbl (%rax),%edx
  add    $0x1,%rax
  mov    $0x1,%r12d
  mov    %dl,-0x3(%rax)
  test   %dl,%dl
  jne    L62
  jmp    L44
  cs nopw 0x0(%rax,%rax,1)
L122:
  cmpb   $0x2f,(%rdx)
  je     L155
  cmpb   $0x0,0x0(%r13)
  jne    L106
L103:
  mov    %rbp,%rsi
  mov    %r13,%rdi
  call   <strcpy@plt>
  jmp    L106
L63:
  add    $0x8,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L149:
  lea    -0x1(%rdx),%rax
  movb   $0x0,(%rdx)
  cmp    %rax,%r13
  je     L191
  movzbl -0x1(%rdx),%edx
  jmp    L161
  nopl   0x0(%rax)
L115:
  movzbl (%rax),%edx
  mov    $0x1,%r12d
L161:
  cmp    $0x2f,%dl
  jne    L191
  sub    $0x1,%rax
  movb   $0x0,0x1(%rax)
  cmp    %rax,%r13
  jne    L115
  mov    $0x1,%r12d
  jmp    L191
```

tool_calls: name: parse_data
arguments: label: D27
data_type: string
name: parse_data
arguments: label: D36
data_type: string
name: parse_data
arguments: label: D33
data_type: string
name: parse_data
arguments: label: D7
data_type: string
name: parse_data
arguments: label: D42
data_type: string

tool: D27: /

tool: D36: /./

tool: D33: //

tool: D7: /../

tool: D42: ./

assistant: ```c
int tidy_path(char *path) {
  int tidied = 0;
  char *s, *p;
  s = path + strlen(path) - 1;
  if (s[0] != '/') {
    s[1] = '/';
    s[2] = '\0';
  }
  while (substr(path, "/./", "/"))
    tidied = 1;
  while (substr(path, "//", "/"))
    tidied = 1;
  while ((p = strstr(path, "/../")) != NULL) {
    s = p + 3;
    for (p--; p != path; p--)
      if (*p == '/')
        break;
    if (*p != '/')
      break;
    while ((*p++ = *s++))
      ;
    tidied = 1;
  }
  if (*path == '\0')
    strcpy(path, "/");
  p = path + strlen(path) - 1;
  if (p != path && *p == '/')
    *p-- = '\0';
  while (p != path && *p == '/') {
    *p-- = '\0';
    tidied = 1;
  }
  while (!strncmp(path, "./", 2)) {
    for (p = path, s = path + 2; (*p++ = *s++);)
      ;
    tidied = 1;
  }
  return tidied;
}
```