ylfeng/ReF-Decompile-dataset huggingface dataset:
user: 请从给定的汇编指令推导出C源代码:

```asm
<fil_stresccpy>:
  endbr64
  test   %rdx,%rdx
  jne    L36
L37:
  movb   $0x0,(%rdi)
  ret
L15:
  test   %rdx,%rdx
  je     L37
  movzbl (%rsi),%eax
  test   %al,%al
  je     L37
  add    $0x1,%rsi
  add    $0x1,%rdi
  mov    %al,-0x1(%rdi)
  sub    $0x1,%rdx
  je     L37
L36:
  cmpb   $0x5c,(%rsi)
  jne    L15
  add    $0x1,%rsi
  sub    $0x1,%rdx
  jmp    L15
```

assistant: ```c
void fil_stresccpy(char *dest, const char *src, size_t len) {
  while (len > 0) {
    if (*src == '\\') {
      src++;
      len--;
    }
    if (!(len > 0) || *src == 0)
      break;
    len--;
    *dest++ = *src++;
  }
  *dest = 0;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<fil_stresccpy>:
  endbr64
  test   %rdx,%rdx
  jne    L60
  jmp    L48
  nopl   0x0(%rax,%rax,1)
L42:
  test   %al,%al
  je     L48
L51:
  add    $0x1,%rdi
  add    $0x1,%rsi
  mov    %al,-0x1(%rdi)
  sub    $0x1,%rdx
  je     L48
L60:
  movzbl (%rsi),%eax
  cmp    $0x5c,%al
  jne    L42
  lea    0x1(%rsi),%rcx
  sub    $0x1,%rdx
  je     L48
  movzbl 0x1(%rsi),%eax
  mov    %rcx,%rsi
  test   %al,%al
  jne    L51
L48:
  movb   $0x0,(%rdi)
  ret
```

assistant: ```c
void fil_stresccpy(char *dest, const char *src, size_t len) {
  while (len > 0) {
    if (*src == '\\') {
      src++;
      len--;
    }
    if (!(len > 0) || *src == 0)
      break;
    len--;
    *dest++ = *src++;
  }
  *dest = 0;
}
```
user: What is the c source code of the assembly code below:

```asm
<fil_stresccpy>:
  endbr64
  test   %rdx,%rdx
  jne    L26
  jmp    L35
  nopl   0x0(%rax,%rax,1)
L33:
  test   %al,%al
  je     L35
L54:
  add    $0x1,%rdi
  add    $0x1,%rsi
  mov    %al,-0x1(%rdi)
  sub    $0x1,%rdx
  je     L35
L26:
  movzbl (%rsi),%eax
  cmp    $0x5c,%al
  jne    L33
  lea    0x1(%rsi),%rcx
  sub    $0x1,%rdx
  je     L35
  movzbl 0x1(%rsi),%eax
  mov    %rcx,%rsi
  test   %al,%al
  jne    L54
L35:
  movb   $0x0,(%rdi)
  ret
```

assistant: ```c
void fil_stresccpy(char *dest, const char *src, size_t len) {
  while (len > 0) {
    if (*src == '\\') {
      src++;
      len--;
    }
    if (!(len > 0) || *src == 0)
      break;
    len--;
    *dest++ = *src++;
  }
  *dest = 0;
}
```
user: What is the c source code of the assembly code below?

```asm
<send_n_bytes>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0x30(%rbp)
  je     L86
  cmpq   $0x0,-0x38(%rbp)
  jne    L45
L86:
  mov    $0xffffffff,%eax
  jmp    L42
L45:
  movq   $0x0,-0x18(%rbp)
  mov    -0x30(%rbp),%rax
  mov    %rax,-0x10(%rbp)
  jmp    L3
L95:
  mov    -0x30(%rbp),%rax
  sub    -0x10(%rbp),%rax
  mov    %rax,%rdx
  mov    -0x38(%rbp),%rax
  lea    (%rdx,%rax,1),%rsi
  lea    -0x18(%rbp),%rcx
  mov    -0x10(%rbp),%rdx
  mov    -0x24(%rbp),%eax
  mov    %eax,%edi
  call   <transmit@plt>
  test   %rax,%rax
  je     L47
  mov    $0xffffffff,%eax
  jmp    L42
L47:
  mov    -0x18(%rbp),%rax
  test   %rax,%rax
  je     L56
  mov    -0x18(%rbp),%rax
  sub    %rax,-0x10(%rbp)
L3:
  cmpq   $0x0,-0x10(%rbp)
  jne    L95
  jmp    L41
L56:
  nop
L41:
  mov    -0x30(%rbp),%rax
  mov    %eax,%edx
  mov    -0x10(%rbp),%rax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
L42:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L94
  call   <__stack_chk_fail@plt>
L94:
  leave
  ret
```

assistant: ```c
int send_n_bytes(int fd, size_t n, char *buf) {
  if (!n || !buf)
    return -1;
  size_t tx = 0;
  size_t to_send = n;
  while (to_send > 0) {
    if (transmit(fd, buf + (n - to_send), to_send, &tx) != 0) {
      return -1;
    } else if (tx == 0) {
      break;
    } else {
      to_send -= tx;
    }
  };
  return n - to_send;
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<send_n_bytes>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L51
  mov    %edi,%r13d
  mov    %rsi,%rbp
  mov    %rdx,%r12
  test   %rdx,%rdx
  je     L51
  movq   $0x0,(%rsp)
  mov    %rsi,%rbx
  mov    %rsp,%r14
L43:
  mov    %rbp,%rsi
  sub    %rbx,%rsi
  add    %r12,%rsi
  mov    %r14,%rcx
  mov    %rbx,%rdx
  mov    %r13d,%edi
  call   <transmit@plt>
  test   %rax,%rax
  jne    L13
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L45
  sub    %rax,%rbx
  jne    L43
L45:
  mov    %ebp,%eax
  sub    %ebx,%eax
L18:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L77
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L51:
  mov    $0xffffffff,%eax
  jmp    L18
L13:
  mov    $0xffffffff,%eax
  jmp    L18
L77:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int send_n_bytes(int fd, size_t n, char *buf) {
  if (!n || !buf)
    return -1;
  size_t tx = 0;
  size_t to_send = n;
  while (to_send > 0) {
    if (transmit(fd, buf + (n - to_send), to_send, &tx) != 0) {
      return -1;
    } else if (tx == 0) {
      break;
    } else {
      to_send -= tx;
    }
  };
  return n - to_send;
}
```
user: 下面的汇编指令对应的C源代码是什么：

```asm
<send_n_bytes>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L42
  mov    %rdx,%r12
  test   %rdx,%rdx
  je     L42
  mov    %edi,%r13d
  mov    %rsi,%rbp
  mov    %rsi,%rbx
  mov    %rsp,%r14
  movq   $0x0,(%rsp)
  nopl   0x0(%rax)
L40:
  mov    %rbp,%rsi
  mov    %r14,%rcx
  mov    %rbx,%rdx
  mov    %r13d,%edi
  sub    %rbx,%rsi
  add    %r12,%rsi
  call   <transmit@plt>
  test   %rax,%rax
  jne    L42
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L12
  sub    %rax,%rbx
  jne    L40
  xor    %ebx,%ebx
L12:
  mov    %ebp,%eax
  sub    %ebx,%eax
L8:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L27
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L42:
  mov    $0xffffffff,%eax
  jmp    L8
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int send_n_bytes(int fd, size_t n, char *buf) {
  if (!n || !buf)
    return -1;
  size_t tx = 0;
  size_t to_send = n;
  while (to_send > 0) {
    if (transmit(fd, buf + (n - to_send), to_send, &tx) != 0) {
      return -1;
    } else if (tx == 0) {
      break;
    } else {
      to_send -= tx;
    }
  };
  return n - to_send;
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<send_n_bytes>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x10,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  test   %rsi,%rsi
  je     L48
  mov    %rdx,%r12
  test   %rdx,%rdx
  je     L48
  mov    %edi,%r13d
  mov    %rsi,%rbp
  mov    %rsi,%rbx
  mov    %rsp,%r14
  movq   $0x0,(%rsp)
  nopl   0x0(%rax)
L66:
  mov    %rbp,%rsi
  mov    %r14,%rcx
  mov    %rbx,%rdx
  mov    %r13d,%edi
  sub    %rbx,%rsi
  add    %r12,%rsi
  call   <transmit@plt>
  test   %rax,%rax
  jne    L48
  mov    (%rsp),%rax
  test   %rax,%rax
  je     L50
  sub    %rax,%rbx
  jne    L66
  xor    %ebx,%ebx
L50:
  mov    %ebp,%eax
  sub    %ebx,%eax
L58:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L47
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   (%rax)
L48:
  mov    $0xffffffff,%eax
  jmp    L58
L47:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int send_n_bytes(int fd, size_t n, char *buf) {
  if (!n || !buf)
    return -1;
  size_t tx = 0;
  size_t to_send = n;
  while (to_send > 0) {
    if (transmit(fd, buf + (n - to_send), to_send, &tx) != 0) {
      return -1;
    } else if (tx == 0) {
      break;
    } else {
      to_send -= tx;
    }
  };
  return n - to_send;
}
```
user: Demonstrate the C code that generates the assembly output below:

```asm
<termop_vt52>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x10,%rsp
  mov    %rdi,-0x8(%rbp)
  sub    $0x8,%rsp
  lea    D26(%rip),%rax
  push   %rax
  lea    D27(%rip),%r9
  mov    $0xd8,%r8d
  lea    D28(%rip),%rax
  mov    %rax,%rcx
  mov    $0xffffffff,%edx
  mov    $0x4,%esi
  mov    $0x6,%edi
  mov    $0x0,%eax
  call   <tnc_log_log@plt>
  add    $0x10,%rsp
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <ansiseq_dump@plt>
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D26
type_guessed: string
name: unpack_data
arguments: data_tag: D27
type_guessed: string
name: unpack_data
arguments: data_tag: D28
type_guessed: string

tool: D26: unhandled

tool: D27: termop_vt52

tool: D28: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c

assistant: ```c
void termop_vt52(struct ansiseq *s) {
  tnc_log_log(6, 4, -1, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c", 216, __func__, "unhandled");
  ansiseq_dump(s);
}
```
user: What is the c source code of the assembly code below?

```asm
<termop_vt52>:
  endbr64
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x8,%rsp
  lea    D2(%rip),%rax
  push   %rax
  lea    D0(%rip),%r9
  mov    $0xd8,%r8d
  lea    D6(%rip),%rcx
  mov    $0xffffffff,%edx
  mov    $0x4,%esi
  mov    $0x6,%edi
  mov    $0x0,%eax
  call   <tnc_log_log@plt>
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <ansiseq_dump@plt>
  add    $0x10,%rsp
  pop    %rbx
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D2
data_type: string
name: disassemble_data
arguments: data_label: D0
data_type: string
name: disassemble_data
arguments: data_label: D6
data_type: string

tool: D2: unhandled

tool: D0: termop_vt52

tool: D6: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c

assistant: ```c
void termop_vt52(struct ansiseq *s) {
  tnc_log_log(6, 4, -1, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c", 216, __func__, "unhandled");
  ansiseq_dump(s);
}
```
user: 请将以下的汇编代码转换成C语言代码:

```asm
<termop_vt52>:
  endbr64
  push   %rbp
  mov    $0xffffffff,%edx
  mov    %rdi,%rbp
  lea    D10(%rip),%rax
  mov    $0x6,%edi
  lea    D19(%rip),%r9
  mov    $0xd8,%r8d
  mov    $0x4,%esi
  lea    D21(%rip),%rcx
  sub    $0x8,%rsp
  push   %rax
  xor    %eax,%eax
  call   <tnc_log_log@plt>
  pop    %rax
  mov    %rbp,%rdi
  pop    %rdx
  xor    %eax,%eax
  pop    %rbp
  jmp    1060 <ansiseq_dump@plt>
```

tool_calls: name: disassemble_data
arguments: label: D10
type: string
name: disassemble_data
arguments: label: D19
type: string
name: disassemble_data
arguments: label: D21
type: string

tool: D10: unhandled

tool: D19: termop_vt52

tool: D21: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c

assistant: ```c
void termop_vt52(struct ansiseq *s) {
  tnc_log_log(6, 4, -1, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c", 216, __func__, "unhandled");
  ansiseq_dump(s);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<termop_vt52>:
  endbr64
  push   %rbp
  mov    $0xffffffff,%edx
  mov    %rdi,%rbp
  lea    D21(%rip),%rax
  mov    $0x6,%edi
  lea    D7(%rip),%r9
  mov    $0xd8,%r8d
  mov    $0x4,%esi
  lea    D28(%rip),%rcx
  sub    $0x8,%rsp
  push   %rax
  xor    %eax,%eax
  call   <tnc_log_log@plt>
  pop    %rax
  mov    %rbp,%rdi
  pop    %rdx
  xor    %eax,%eax
  pop    %rbp
  jmp    1060 <ansiseq_dump@plt>
```

tool_calls: name: retrieve_data
arguments: label: D21
type_infered: string
name: retrieve_data
arguments: label: D7
type_infered: string
name: retrieve_data
arguments: label: D28
type_infered: string

tool: D21: unhandled

tool: D7: termop_vt52

tool: D28: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c

assistant: ```c
void termop_vt52(struct ansiseq *s) {
  tnc_log_log(6, 4, -1, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/fstd/telnetcat/refs/heads/devel/src/vt100.c", 216, __func__, "unhandled");
  ansiseq_dump(s);
}
```
user: What would the C source look like for the assembly code provided here?

```asm
<wipe_directory>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <opendir@plt>
  mov    %rax,-0x20(%rbp)
  cmpq   $0x0,-0x20(%rbp)
  jne    L62
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D10(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L39
L53:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    D48(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L62
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rax
  lea    D12(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L23
  jmp    L62
L23:
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rbx
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <dirfd@plt>
  mov    $0x0,%edx
  mov    %rbx,%rsi
  mov    %eax,%edi
  call   <unlinkat@plt>
  test   %rax,%rax
  je     L62
  mov    -0x18(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D47(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L62:
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <readdir@plt>
  mov    %rax,-0x18(%rbp)
  cmpq   $0x0,-0x18(%rbp)
  jne    L53
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <closedir@plt>
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <rmdir@plt>
  test   %rax,%rax
  je     L39
  mov    -0x28(%rbp),%rax
  mov    %rax,%rsi
  lea    D11(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
L39:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: label: D10
type_infered: string
name: extract_symbolic_data
arguments: label: D48
type_infered: string
name: extract_symbolic_data
arguments: label: D12
type_infered: string
name: extract_symbolic_data
arguments: label: D47
type_infered: string
name: extract_symbolic_data
arguments: label: D11
type_infered: string

tool: D10: opendir(%s): %m


tool: D48: .

tool: D12: ..

tool: D47: unable to unlink %s/%s: %m


tool: D11: unable to unlink %s: %m


assistant: ```c
void wipe_directory(char *path) {
  DIR *d = opendir(path);
  if (d == NULL) {
    printf("opendir(%s): %m\n", path);
    return;
  }
  struct dirent *dent;
  while ((dent = readdir(d)) != NULL) {
    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
      continue;
    if (unlinkat(dirfd(d), dent->d_name, 0))
      printf("unable to unlink %s/%s: %m\n", path, dent->d_name);
  }
  closedir(d);
  if (rmdir(path))
    printf("unable to unlink %s: %m\n", path);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<wipe_directory>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  call   <opendir@plt>
  mov    %rax,%rbp
  lea    D28(%rip),%r12
  lea    D25(%rip),%r14
  test   %rax,%rax
  je     L32
L51:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L16
  mov    %r12,%rsi
  mov    (%rbx),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L51
  mov    %r14,%rsi
  mov    (%rbx),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L51
  mov    (%rbx),%r15
  mov    %rbp,%rdi
  call   <dirfd@plt>
  mov    %eax,%edi
  mov    $0x0,%edx
  mov    %r15,%rsi
  call   <unlinkat@plt>
  test   %rax,%rax
  je     L51
  mov    (%rbx),%rdx
  mov    %r13,%rsi
  lea    D27(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L51
L32:
  mov    %r13,%rsi
  lea    D43(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L45
L16:
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    %r13,%rdi
  call   <rmdir@plt>
  test   %rax,%rax
  jne    L69
L45:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L69:
  mov    %r13,%rsi
  lea    D33(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  jmp    L45
```

tool_calls: name: read_data
arguments: label: D28
type_guessed: string
name: read_data
arguments: label: D25
type_guessed: string
name: read_data
arguments: label: D27
type_guessed: string
name: read_data
arguments: label: D43
type_guessed: string
name: read_data
arguments: label: D33
type_guessed: string

tool: D28: .

tool: D25: ..

tool: D27: unable to unlink %s/%s: %m


tool: D43: opendir(%s): %m


tool: D33: unable to unlink %s: %m


assistant: ```c
void wipe_directory(char *path) {
  DIR *d = opendir(path);
  if (d == NULL) {
    printf("opendir(%s): %m\n", path);
    return;
  }
  struct dirent *dent;
  while ((dent = readdir(d)) != NULL) {
    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
      continue;
    if (unlinkat(dirfd(d), dent->d_name, 0))
      printf("unable to unlink %s/%s: %m\n", path, dent->d_name);
  }
  closedir(d);
  if (rmdir(path))
    printf("unable to unlink %s: %m\n", path);
}
```
user: Please show me the C implementation that matches the assembly code listed below:

```asm
<wipe_directory>:
  endbr64
  push   %r15
  push   %r14
  lea    D23(%rip),%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    D21(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <opendir@plt>
  mov    %r13,%rsi
  lea    D41(%rip),%rdi
  mov    %rax,%rbp
  test   %rax,%rax
  je     L49
  xchg   %ax,%ax
L66:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L58
L23:
  mov    (%rbx),%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L66
  mov    (%rbx),%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L66
  mov    (%rbx),%r15
  mov    %rbp,%rdi
  call   <dirfd@plt>
  xor    %edx,%edx
  mov    %eax,%edi
  mov    %r15,%rsi
  call   <unlinkat@plt>
  test   %rax,%rax
  je     L66
  mov    (%rbx),%rdx
  mov    %r13,%rsi
  lea    D44(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L23
L58:
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    %r13,%rdi
  call   <rmdir@plt>
  test   %rax,%rax
  jne    L24
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L24:
  mov    %r13,%rsi
  lea    D0(%rip),%rdi
L49:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10f0 <printf@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D23
type_guessed: string
name: parse_data
arguments: data_tag: D21
type_guessed: string
name: parse_data
arguments: data_tag: D41
type_guessed: string
name: parse_data
arguments: data_tag: D44
type_guessed: string
name: parse_data
arguments: data_tag: D0
type_guessed: string

tool: D23: ..

tool: D21: .

tool: D41: opendir(%s): %m


tool: D44: unable to unlink %s/%s: %m


tool: D0: unable to unlink %s: %m


assistant: ```c
void wipe_directory(char *path) {
  DIR *d = opendir(path);
  if (d == NULL) {
    printf("opendir(%s): %m\n", path);
    return;
  }
  struct dirent *dent;
  while ((dent = readdir(d)) != NULL) {
    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
      continue;
    if (unlinkat(dirfd(d), dent->d_name, 0))
      printf("unable to unlink %s/%s: %m\n", path, dent->d_name);
  }
  closedir(d);
  if (rmdir(path))
    printf("unable to unlink %s: %m\n", path);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<wipe_directory>:
  endbr64
  push   %r15
  push   %r14
  lea    D48(%rip),%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  lea    D16(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <opendir@plt>
  mov    %r13,%rsi
  lea    D24(%rip),%rdi
  mov    %rax,%rbp
  test   %rax,%rax
  je     L19
  xchg   %ax,%ax
L9:
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  je     L60
L67:
  mov    (%rbx),%rdi
  mov    %r12,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L9
  mov    (%rbx),%rdi
  mov    %r14,%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L9
  mov    (%rbx),%r15
  mov    %rbp,%rdi
  call   <dirfd@plt>
  xor    %edx,%edx
  mov    %eax,%edi
  mov    %r15,%rsi
  call   <unlinkat@plt>
  test   %rax,%rax
  je     L9
  mov    (%rbx),%rdx
  mov    %r13,%rsi
  lea    D0(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %rbp,%rdi
  call   <readdir@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L67
L60:
  mov    %rbp,%rdi
  call   <closedir@plt>
  mov    %r13,%rdi
  call   <rmdir@plt>
  test   %rax,%rax
  jne    L5
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L5:
  mov    %r13,%rsi
  lea    D46(%rip),%rdi
L19:
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10f0 <printf@plt>
```

tool_calls: name: disassemble_data
arguments: label: D48
data_type: string
name: disassemble_data
arguments: label: D16
data_type: string
name: disassemble_data
arguments: label: D24
data_type: string
name: disassemble_data
arguments: label: D0
data_type: string
name: disassemble_data
arguments: label: D46
data_type: string

tool: D48: ..

tool: D16: .

tool: D24: opendir(%s): %m


tool: D0: unable to unlink %s/%s: %m


tool: D46: unable to unlink %s: %m


assistant: ```c
void wipe_directory(char *path) {
  DIR *d = opendir(path);
  if (d == NULL) {
    printf("opendir(%s): %m\n", path);
    return;
  }
  struct dirent *dent;
  while ((dent = readdir(d)) != NULL) {
    if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0)
      continue;
    if (unlinkat(dirfd(d), dent->d_name, 0))
      printf("unable to unlink %s/%s: %m\n", path, dent->d_name);
  }
  closedir(d);
  if (rmdir(path))
    printf("unable to unlink %s: %m\n", path);
}
```