user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<remove_dot_segments>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x18(%rbp)
  mov    %rsi,-0x20(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x18(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x20(%rbp),%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  movq   $0x0,(%rax)
  jmp    L8
L139:
  mov    -0x10(%rbp),%rax
  mov    (%rax),%eax
  cmp    $0x2e,%eax
  je     L27
  cmp    $0x2f,%eax
  je     L237
  jmp    L55
L27:
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x2f,%eax
  je     L70
  cmp    $0x2f,%eax
  jg     L160
  test   %eax,%eax
  je     L141
  cmp    $0x2e,%eax
  je     L14
  jmp    L160
L70:
  addq   $0x8,-0x10(%rbp)
  jmp    L166
L14:
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L271
  cmp    $0x2f,%eax
  je     L32
  jmp    L207
L271:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  addq   $0x8,-0x10(%rbp)
  jmp    L87
L32:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  addq   $0xc,-0x10(%rbp)
  jmp    L87
L207:
  mov    -0x10(%rbp),%rax
  jmp    L150
L87:
  jmp    L166
L141:
  addq   $0x4,-0x10(%rbp)
L160:
  mov    -0x10(%rbp),%rax
  jmp    L150
L166:
  jmp    L8
L237:
  mov    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    (%rax),%eax
  cmp    $0x2e,%eax
  jne    L55
  mov    -0x10(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%eax
  cmp    $0x2e,%eax
  je     L21
  cmp    $0x2f,%eax
  jne    L90
  addq   $0x8,-0x10(%rbp)
  jmp    L55
L21:
  mov    -0x10(%rbp),%rax
  add    $0xc,%rax
  mov    (%rax),%eax
  cmp    $0x2f,%eax
  jne    L177
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  lea    0x1(%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rdx,(%rax)
  addq   $0xc,-0x10(%rbp)
  jmp    L177
L90:
  mov    -0x10(%rbp),%rax
  jmp    L150
L177:
  nop
L55:
  mov    -0x10(%rbp),%rax
  jmp    L150
L8:
  mov    -0x10(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  jb     L139
  mov    -0x10(%rbp),%rax
L150:
  pop    %rbp
  ret
```

assistant: ```c
const uint8_t *remove_dot_segments(const uint8_t *path, size_t len, size_t *up) {
  const uint8_t *begin = path;
  const uint8_t *const end = path + len;
  *up = 0;
  while (begin < end) {
    switch (begin[0]) {
    case '.':
      switch (begin[1]) {
      case '/':
        begin += 2;
        break;
      case '.':
        switch (begin[2]) {
        case '\0':
          ++*up;
          begin += 2;
          break;
        case '/':
          ++*up;
          begin += 3;
          break;
        default:
          return begin;
        }
        break;
      case '\0':
        ++begin;
      default:
        return begin;
      }
      break;
    case '/':
      switch (begin[1]) {
      case '.':
        switch (begin[2]) {
        case '/':
          begin += 2;
          break;
        case '.':
          switch (begin[3]) {
          case '/':
            ++*up;
            begin += 3;
          }
          break;
        default:
          return begin;
        }
      }
    default:
      return begin;
    }
  }
  return begin;
}
```