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

```asm
<crumb_canonize_path>:
  endbr64
  push   %r15
  push   %r14
  mov    %edx,%r14d
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x218,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x208(%rsp)
  xor    %eax,%eax
  call   <strlen@plt>
  movslq %eax,%rbp
  test   %ebp,%ebp
  jne    L204
  movb   $0x0,(%r12)
L124:
  mov    0x208(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L383
  add    $0x218,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L204:
  mov    %rsp,%rdi
  mov    $0x200,%esi
  xor    %r13d,%r13d
  call   <getcwd@plt>
  mov    $0x2f,%esi
  mov    %rbx,%rdi
  mov    %rax,%r15
  call   <strrchr@plt>
  mov    %rax,%r8
  lea    -0x1(%rbx,%rbp,1),%rax
  cmp    %rax,%r8
  sete   %r13b
  cmpb   $0x2f,(%rbx)
  je     L309
  mov    %r15,%rcx
  lea    D9(%rip),%rdx
  mov    %r14d,%esi
  mov    %r12,%rdi
  call   <snprintf@plt>
  mov    %r12,%rdi
  call   <strlen@plt>
  movslq %eax,%rbp
  add    %r12,%rbp
L187:
  cmpb   $0x0,(%rbx)
  mov    %r13d,%eax
  je     L354
  nopw   0x0(%rax,%rax,1)
L171:
  mov    $0x2f,%esi
  mov    %rbx,%rdi
  call   <strchrnul@plt>
  mov    %rax,%rcx
  cmp    %rbx,%rax
  jbe    L373
  mov    %rax,%rdx
  lea    0x1(%rbx),%rdi
  mov    %rbp,%rsi
  sub    %rbx,%rdx
  sub    %rdi,%rsi
  lea    -0x1(%rdx),%rax
  cmp    $0xe,%rsi
  jbe    L341
  cmp    $0x6,%rax
  jbe    L341
  cmp    $0xe,%rax
  jbe    L285
  mov    %rdx,%rsi
  xor    %eax,%eax
  and    $0xfffffffffffffff0,%rsi
  nopl   0x0(%rax)
L179:
  movdqu (%rbx,%rax,1),%xmm0
  movups %xmm0,0x0(%rbp,%rax,1)
  add    $0x10,%rax
  cmp    %rsi,%rax
  jne    L179
  mov    %rdx,%rdi
  and    $0xfffffffffffffff0,%rdi
  lea    (%rbx,%rdi,1),%rax
  lea    0x0(%rbp,%rdi,1),%rsi
  cmp    %rdi,%rdx
  je     L262
  mov    %rdx,%r8
  sub    %rdi,%r8
  lea    -0x1(%r8),%r9
  cmp    $0x6,%r9
  jbe    L86
L280:
  mov    (%rbx,%rdi,1),%r9
  mov    %r9,0x0(%rbp,%rdi,1)
  mov    %r8,%rdi
  and    $0xfffffffffffffff8,%rdi
  add    %rdi,%rax
  add    %rdi,%rsi
  cmp    %rdi,%r8
  je     L262
L86:
  movzbl (%rax),%edi
  mov    %dil,(%rsi)
  lea    0x1(%rax),%rdi
  cmp    %rdi,%rcx
  jbe    L262
  movzbl 0x1(%rax),%edi
  mov    %dil,0x1(%rsi)
  lea    0x2(%rax),%rdi
  cmp    %rdi,%rcx
  jbe    L262
  movzbl 0x2(%rax),%edi
  mov    %dil,0x2(%rsi)
  lea    0x3(%rax),%rdi
  cmp    %rdi,%rcx
  jbe    L262
  movzbl 0x3(%rax),%edi
  mov    %dil,0x3(%rsi)
  lea    0x4(%rax),%rdi
  cmp    %rdi,%rcx
  jbe    L262
  movzbl 0x4(%rax),%edi
  mov    %dil,0x4(%rsi)
  lea    0x5(%rax),%rdi
  cmp    %rdi,%rcx
  jbe    L262
  movzbl 0x5(%rax),%edi
  mov    %dil,0x5(%rsi)
  lea    0x6(%rax),%rdi
  cmp    %rdi,%rcx
  jbe    L262
  movzbl 0x6(%rax),%eax
  mov    %al,0x6(%rsi)
L262:
  add    %rbp,%rdx
  mov    %rcx,%rbx
L384:
  xor    %eax,%eax
  cmpb   $0x2f,(%rbx)
  movb   $0x0,(%rdx)
  sete   %al
  add    %rax,%rbx
  cmpb   $0x0,0x0(%rbp)
  je     L270
  cmpb   $0x2e,0x0(%rbp)
  jne    L263
  cmpb   $0x0,0x1(%rbp)
  jne    L263
  movb   $0x0,-0x1(%rdx)
  lea    -0x1(%rdx),%rbp
  mov    $0x1,%eax
L101:
  cmpb   $0x0,(%rbx)
  jne    L171
L354:
  cmp    %rbp,%r12
  jae    L124
  test   %eax,%eax
  jne    L124
  cmpb   $0x2f,-0x1(%rbp)
  jne    L124
  movb   $0x0,-0x1(%rbp)
  jmp    L124
  xchg   %ax,%ax
L263:
  cmpb   $0x2e,0x0(%rbp)
  jne    L162
  cmpb   $0x2e,0x1(%rbp)
  jne    L162
  cmpb   $0x0,0x2(%rbp)
  jne    L162
  movb   $0x0,-0x3(%rdx)
  mov    $0x2f,%esi
  mov    %r12,%rdi
  call   <strrchr@plt>
  test   %rax,%rax
  je     L338
  movb   $0x0,0x1(%rax)
  lea    0x1(%rax),%rbp
  mov    $0x1,%eax
  jmp    L101
  nopl   0x0(%rax,%rax,1)
L162:
  mov    $0x2f,%eax
  lea    0x1(%rdx),%rbp
  mov    %ax,(%rdx)
  mov    %r13d,%eax
  jmp    L101
  nopl   0x0(%rax)
L270:
  mov    %r13d,%eax
  mov    %rdx,%rbp
  jmp    L101
  nopl   0x0(%rax,%rax,1)
L341:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L365:
  movzbl (%rbx,%rax,1),%esi
  mov    %sil,0x0(%rbp,%rax,1)
  add    $0x1,%rax
  cmp    %rax,%rdx
  jne    L365
  jmp    L262
  nopw   0x0(%rax,%rax,1)
L373:
  mov    %rbp,%rdx
  jmp    L384
L285:
  mov    %rdx,%r8
  mov    %rbp,%rsi
  mov    %rbx,%rax
  xor    %edi,%edi
  jmp    L280
L309:
  mov    $0x2f,%edx
  lea    0x1(%r12),%rbp
  mov    %dx,(%r12)
  jmp    L187
L338:
  movb   $0x0,(%r12)
  mov    %r12,%rbp
  mov    $0x1,%eax
  jmp    L101
L383:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D9
type_infered: string

tool: D9: %s/

assistant: ```c
void crumb_canonize_path(const char *filename, char *ostr, int ostr_max) {
  char bcwd[0x200], *cwd;
  const char *b, *scan = filename;
  char *o, *x, *p;
  int dont_remove_slash = 0, last_is_dotted = 0;
  int lf = strlen(filename);
  if (lf == 0) {
    *ostr = '\0';
    return;
  }
  cwd = getcwd(bcwd, sizeof(bcwd));
  if (strrchr(filename, '/') == filename + lf - 1) {
    dont_remove_slash = 1;
  }
  if (filename[0] != '/') {
    snprintf(ostr, ostr_max, "%s/", cwd);
    o = ostr + strlen(ostr);
  } else {
    o = ostr;
    o[0] = '/';
    o[1] = '\0';
    o++;
  }
  while (*scan != '\0') {
    p = strchrnul(scan, '/');
    b = o;
    while (scan < p) {
      *o = *scan;
      o++;
      scan++;
    }
    if (*scan == '/')
      scan++;
    o[0] = '\0';
    last_is_dotted = 0;
    if (!strcmp(b, "")) {
      continue;
    }
    if (!strcmp(b, ".")) {
      o -= 1;
      o[0] = '\0';
      last_is_dotted = 1;
      continue;
    }
    if (!strcmp(b, "..")) {
      o -= 3;
      o[0] = '\0';
      x = strrchr(ostr, '/');
      if (x) {
        o = x + 1;
        *o = '\0';
      } else {
        o = ostr;
        *o = '\0';
      }
      last_is_dotted = 1;
      continue;
    }
    o[0] = '/';
    o++;
    o[0] = '\0';
  }
  if (!dont_remove_slash && !last_is_dotted) {
    if (o > ostr && o[-1] == '/')
      o[-1] = '\0';
  }
}
```