user: 这段汇编代码用C语言表示是什么样的？

```asm
<___chdir>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x20,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L120
  mov    -0x20(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L99
L120:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  movslq %eax,%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  jmp    L160
L138:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L156
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L196
L156:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L63
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L63
  addq   $0x1,-0x20(%rbp)
  addq   $0x1,-0x20(%rbp)
  jmp    L160
L63:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L103
  mov    -0x20(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L103
  mov    -0x20(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L161
  mov    -0x20(%rbp),%rax
  add    $0x2,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L103
  jmp    L161
L111:
  subq   $0x1,-0x8(%rbp)
L161:
  mov    -0x8(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jbe    L27
  mov    -0x8(%rbp),%rax
  sub    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L111
L27:
  addq   $0x1,-0x20(%rbp)
  addq   $0x1,-0x20(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L220
  addq   $0x1,-0x20(%rbp)
  jmp    L160
L103:
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    %rdx,-0x8(%rbp)
  movb   $0x2f,(%rax)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L228
  addq   $0x1,-0x20(%rbp)
  jmp    L228
L85:
  mov    -0x20(%rbp),%rdx
  lea    0x1(%rdx),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x8(%rbp),%rax
  lea    0x1(%rax),%rcx
  mov    %rcx,-0x8(%rbp)
  movzbl (%rdx),%edx
  mov    %dl,(%rax)
L228:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L160
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L85
L160:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L138
  jmp    L17
L196:
  nop
  jmp    L17
L220:
  nop
L17:
  mov    -0x8(%rbp),%rax
  movb   $0x0,(%rax)
L99:
  leave
  ret
```

assistant: ```c
void ___chdir(char *dest, const char *src) {
  if (src[0] == '/') {
    strcpy(dest, src);
    return;
  }
  char *ptr = dest + strlen(dest);
  while (*src) {
    if (src[0] == '.' && src[1] == 0)
      break;
    if (src[0] == '.' && src[1] == '/') {
      ++src;
      ++src;
      continue;
    }
    if (src[0] == '.' && src[1] == '.' && (src[2] == 0 || src[2] == '/')) {
      while (ptr > dest && ptr[-1] != '/')
        --ptr;
      ++src;
      ++src;
      if (*src == 0)
        break;
      ++src;
      continue;
    }
    *ptr++ = '/';
    if (*src == '/')
      ++src;
    while (*src && *src != '/')
      *ptr++ = *src++;
  }
  *ptr = 0;
}
```