user: What is the c source code of the assembly code below:

```asm
<remove_dir_entries>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x30(%rbp)
  cmpq   $0x0,-0x30(%rbp)
  jne    L92
  mov    D8(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L143
L92:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  add    $0x9,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x38(%rbp)
  cmpq   $0x0,-0x38(%rbp)
  jne    L21
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    D19(%rip),%rax
  mov    (%rax),%eax
  neg    %eax
  jmp    L143
L21:
  mov    -0x58(%rbp),%rdx
  mov    -0x38(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x38(%rbp),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2f,%al
  je     L3
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movw   $0x2f,(%rax)
L3:
  lea    -0x40(%rbp),%rdx
  lea    -0x20(%rbp),%rcx
  mov    -0x30(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <readdir_r@plt>
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jne    L80
  mov    -0x40(%rbp),%rax
  test   %rax,%rax
  je     L80
  mov    -0x20(%rbp),%rax
  mov    -0x28(%rbp),%rdx
  lea    0x1(%rdx),%rcx
  mov    -0x38(%rbp),%rdx
  add    %rcx,%rdx
  mov    %rax,%rsi
  mov    %rdx,%rdi
  call   <strcpy@plt>
  mov    %rax,-0x38(%rbp)
  mov    -0x18(%rbp),%rdx
  mov    D26(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L131
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <remove_dir_entries>
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  js     L78
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <rmdir@plt>
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  jns    L3
  jmp    L80
L131:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <unlink@plt>
  mov    %eax,-0x44(%rbp)
  cmpl   $0x0,-0x44(%rbp)
  js     L19
  jmp    L3
L78:
  nop
  jmp    L80
L19:
  nop
L80:
  mov    -0x38(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x30(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    -0x44(%rbp),%eax
L143:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L65
  call   <__stack_chk_fail@plt>
L65:
  leave
  ret
```

assistant: ```c
int remove_dir_entries(const char *__restrict path) {
  struct dirent entry, *result;
  char *buffer;
  DIR *dir;
  size_t len;
  int err;
  dir = opendir(path);
  if (!dir)
    return -errno;
  len = strlen(path);
  buffer = malloc(len + 1 + sizeof(entry.d_name));
  if (!buffer) {
    closedir(dir);
    return -ENOMEM;
  }
  buffer = strcpy(buffer, path);
  if (buffer[len] != '/')
    buffer = strcat(buffer, "/");
  while (1) {
    err = readdir_r(dir, &entry, &result);
    if (err || !result)
      break;
    buffer = strcpy(buffer + len + 1, entry.d_name);
    if (entry.d_type == DT_DIR) {
      err = remove_dir_entries(buffer);
      if (err < 0)
        break;
      err = rmdir(buffer);
      if (err < 0)
        break;
    } else {
      err = unlink(buffer);
      if (err < 0)
        break;
    }
  }
  free(buffer);
  closedir(dir);
  return err;
}
```