user: Converte this assembly snippet into its equivalent C code:

```asm
<simplify>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  movl   $0x0,-0x1c(%rbp)
  jmp    L45
L149:
  mov    -0x20(%rbp),%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L158
  mov    -0x20(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L118
  mov    -0x20(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L118
  cmpl   $0x0,-0x20(%rbp)
  jne    L126
  addl   $0x1,-0x20(%rbp)
  jmp    L45
L126:
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L128
L61:
  mov    -0x18(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x1c(%rbp)
  addl   $0x1,-0x18(%rbp)
L128:
  mov    -0x20(%rbp),%eax
  lea    0x2(%rax),%edx
  mov    -0x18(%rbp),%eax
  cmp    %eax,%edx
  jae    L61
  mov    -0x20(%rbp),%eax
  add    $0x3,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L50
  mov    -0x20(%rbp),%eax
  add    $0x3,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x1c(%rbp)
  jmp    L50
L118:
  mov    -0x20(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L50
  mov    -0x20(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x1c(%rbp)
  mov    -0x20(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  jne    L50
  mov    -0x20(%rbp),%eax
  add    $0x2,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  addl   $0x1,-0x1c(%rbp)
L50:
  mov    -0x20(%rbp),%eax
  mov    %eax,-0x24(%rbp)
L158:
  addl   $0x1,-0x20(%rbp)
L45:
  mov    -0x20(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jne    L149
  mov    -0xc(%rbp),%eax
  sub    -0x1c(%rbp),%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x14(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L156
L10:
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  test   %al,%al
  je     L52
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x14(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x14(%rbp)
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  movzbl (%rcx),%eax
  mov    %al,(%rdx)
L52:
  addl   $0x1,-0x10(%rbp)
L156:
  mov    -0x10(%rbp),%eax
  cmp    %eax,-0xc(%rbp)
  ja     L10
  mov    -0x8(%rbp),%rax
  leave
  ret
```

assistant: ```c
char *simplify(char *path) {
  unsigned int len_path = strlen(path);
  unsigned int last_slash = 0;
  unsigned int pointer = 0;
  unsigned int removed = 0;
  while (pointer != len_path) {
    if (path[pointer] == '/') {
      if (path[pointer + 1] == '.' && path[pointer + 2] == '.') {
        if (pointer == 0) {
          pointer++;
          continue;
        }
        for (int i = last_slash + 1; i <= pointer + 2; i++) {
          path[i] = 0;
          removed++;
        }
        if (path[pointer + 3] == '/') {
          path[pointer + 3] = 0;
          removed++;
        }
      } else if (path[pointer + 1] == '.') {
        path[pointer + 1] = 0;
        removed++;
        if (path[pointer + 2] == '/') {
          path[pointer + 2] = 0;
          removed++;
        }
      }
      last_slash = pointer;
    }
    pointer++;
  }
  char *tmp = malloc(len_path - removed);
  unsigned int j = 0;
  for (int i = 0; i < len_path; i++) {
    if (path[i] != 0) {
      tmp[j++] = path[i];
    }
  }
  return tmp;
}
```