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

```asm
<pjf_rmdir>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    0x4(%rsp),%rsi
  call   <lstat@plt>
  test   %rax,%rax
  js     L14
  mov    0x4(%rsp),%edi
  call   <S_ISDIR@plt>
  mov    %rbp,%rdi
  test   %rax,%rax
  je     L19
  call   <opendir@plt>
  lea    D0(%rip),%r14
  mov    %rax,%r13
  test   %rax,%rax
  je     L14
  nopl   0x0(%rax,%rax,1)
L101:
  mov    %r13,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L105
  mov    (%rbx),%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L101
  mov    (%rbx),%rdi
  lea    D3(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L101
  test   %r12,%r12
  je     L88
  mov    (%rbx),%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L101
L88:
  mov    %rbp,%rdi
  call   <strlen@plt>
  mov    (%rbx),%rdi
  mov    %rax,%r15
  call   <strlen@plt>
  lea    0x2(%r15,%rax,1),%rdi
  call   <pjf_malloc@plt>
  mov    %rbp,%rsi
  mov    %rax,%r15
  mov    %rax,%rdi
  call   <strcpy@plt>
  lea    D26(%rip),%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  mov    (%rbx),%rsi
  mov    %r15,%rdi
  call   <strcat@plt>
  mov    %r15,%rdi
  mov    %r12,%rsi
  call   <pjf_rmdir>
  mov    %r15,%rdi
  mov    %eax,%ebx
  call   <free@plt>
  test   %ebx,%ebx
  jne    L101
  nop
L14:
  xor    %eax,%eax
L103:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L61
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L19:
  call   <unlink@plt>
  test   %rax,%rax
  sete   %al
  movzbl %al,%eax
  jmp    L103
  nopl   0x0(%rax,%rax,1)
L105:
  mov    %r13,%rdi
  call   <closedir@plt>
  mov    %rbp,%rdi
  call   <rmdir@plt>
  test   %r12,%r12
  mov    %rax,%r8
  sete   %al
  test   %r8,%r8
  setne  %dl
  and    %edx,%eax
  xor    $0x1,%eax
  movzbl %al,%eax
  jmp    L103
L61:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D0
data_type: string
name: retrieve_data
arguments: label: D3
data_type: string
name: retrieve_data
arguments: label: D26
data_type: string

tool: D0: .

tool: D3: ..

tool: D26: /

assistant: ```c
int pjf_rmdir(const char *path, const char *skip) {
  struct stat statbuf;
  struct dirent *dirp;
  DIR *subd;
  char *newpath;
  int upret;
  if (lstat(path, &statbuf) < 0)
    return 0;
  if (S_ISDIR(statbuf.st_mode)) {
    subd = opendir(path);
    if (!subd)
      return 0;
    while ((dirp = readdir(subd))) {
      if ((strcmp((dirp->d_name), (".")) == 0))
        continue;
      if ((strcmp((dirp->d_name), ("..")) == 0))
        continue;
      if (skip && (strcmp((dirp->d_name), (skip)) == 0))
        continue;
      newpath = pjf_malloc(strlen(path) + strlen(dirp->d_name) + 2);
      strcpy(newpath, path);
      strcat(newpath, "/");
      strcat(newpath, dirp->d_name);
      upret = pjf_rmdir(newpath, skip);
      free(newpath);
      if (!upret)
        return 0;
    }
    closedir(subd);
    if (rmdir(path) != 0 && !skip)
      return 0;
  } else {
    if (unlink(path) != 0)
      return 0;
  }
  return 1;
}
```