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

```asm
<mvnrand>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %ecx,-0x5c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0x5c(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x30(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L27:
  cmp    %rdx,%rsp
  je     L57
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L27
L57:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L4
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L4:
  mov    %rsp,%rax
  add    $0x7,%rax
  shr    $0x3,%rax
  shl    $0x3,%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x5c(%rbp),%edx
  mov    -0x5c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <new_matrix2@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x5c(%rbp),%ecx
  mov    -0x58(%rbp),%rdx
  mov    -0x20(%rbp),%rsi
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <eigen_symm@plt>
  movl   $0x0,-0x34(%rbp)
  jmp    L52
L7:
  mov    -0x28(%rbp),%rax
  mov    -0x34(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,8),%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    -0x28(%rbp),%rdx
  mov    -0x34(%rbp),%ecx
  movslq %ecx,%rcx
  mov    %rax,(%rdx,%rcx,8)
  addl   $0x1,-0x34(%rbp)
L52:
  mov    -0x34(%rbp),%eax
  cmp    -0x5c(%rbp),%eax
  jl     L7
  mov    -0x5c(%rbp),%edi
  mov    -0x20(%rbp),%rcx
  mov    -0x28(%rbp),%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x48(%rbp),%rax
  mov    %edi,%r8d
  mov    %rax,%rdi
  call   <mvnrand_pcs@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free_matrix2@plt>
  mov    %rbx,%rsp
  nop
  mov    -0x18(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void mvnrand(double *x, double *mu, double **S, int d) {
  double z[d], **V = new_matrix2(d, d);
  eigen_symm(z, V, S, d);
  int i;
  for (i = 0; i < d; i++)
    z[i] = sqrt(z[i]);
  mvnrand_pcs(x, mu, z, V, d);
  free_matrix2(V);
}
```
user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<mvnrand>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,%rbx
  mov    %ecx,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %ecx,%rax
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L15:
  cmp    %rdx,%rsp
  je     L77
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L15
L77:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L34
  orq    $0x0,-0x8(%rsp,%rax,1)
L34:
  mov    %rsp,%r15
  mov    %r14d,%esi
  mov    %r14d,%edi
  call   <new_matrix2@plt>
  mov    %rax,-0x58(%rbp)
  mov    %r14d,%ecx
  mov    %rbx,%rdx
  mov    %rax,%rsi
  mov    %r15,%rdi
  call   <eigen_symm@plt>
  test   %r14d,%r14d
  jle    L69
  mov    %r15,%rbx
  mov    %r14d,%eax
  lea    (%r15,%rax,8),%r13
L12:
  mov    %rbx,%r12
  movsd  (%rbx),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L71
  sqrtsd %xmm0,%xmm0
L50:
  movsd  %xmm0,(%r12)
  add    $0x8,%rbx
  cmp    %r13,%rbx
  jne    L12
L69:
  mov    %r14d,%r8d
  mov    -0x58(%rbp),%rbx
  mov    %rbx,%rcx
  mov    %r15,%rdx
  mov    -0x50(%rbp),%rsi
  mov    -0x48(%rbp),%rdi
  call   <mvnrand_pcs@plt>
  mov    %rbx,%rdi
  call   <free_matrix2@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L19
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L71:
  call   <sqrt@plt>
  jmp    L50
L19:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void mvnrand(double *x, double *mu, double **S, int d) {
  double z[d], **V = new_matrix2(d, d);
  eigen_symm(z, V, S, d);
  int i;
  for (i = 0; i < d; i++)
    z[i] = sqrt(z[i]);
  mvnrand_pcs(x, mu, z, V, d);
  free_matrix2(V);
}
```
user: Translate the below assembly code into C programming language:

```asm
<mvnrand>:
  endbr64
  push   %rbp
  mov    %ecx,%r8d
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  mov    %rdx,%r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %ecx,%rax
  mov    %rsp,%rcx
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L88
L80:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L80
L88:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L83
L37:
  mov    %r8d,%esi
  mov    %r8d,%edi
  mov    %r8d,-0x48(%rbp)
  mov    %rsp,%r15
  call   <new_matrix2@plt>
  mov    -0x48(%rbp),%r8d
  mov    %r12,%rdx
  mov    %r15,%rdi
  mov    %rax,%rsi
  mov    %rax,-0x48(%rbp)
  mov    %r8d,%ecx
  mov    %r8d,-0x4c(%rbp)
  call   <eigen_symm@plt>
  mov    -0x4c(%rbp),%r8d
  mov    -0x48(%rbp),%r9
  test   %r8d,%r8d
  jle    L49
  mov    %r8d,%eax
  mov    %r15,%rbx
  pxor   %xmm1,%xmm1
  lea    (%r15,%rax,8),%r12
  nopl   0x0(%rax)
L34:
  movsd  (%rbx),%xmm0
  ucomisd %xmm0,%xmm1
  ja     L35
  sqrtsd %xmm0,%xmm0
L16:
  movsd  %xmm0,(%rbx)
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L34
L49:
  mov    %r13,%rdi
  mov    %r9,%rcx
  mov    %r15,%rdx
  mov    %r14,%rsi
  mov    %r9,-0x48(%rbp)
  call   <mvnrand_pcs@plt>
  mov    -0x48(%rbp),%rdi
  call   <free_matrix2@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L75
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nop
L83:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L37
L35:
  mov    %r8d,-0x4c(%rbp)
  mov    %r9,-0x48(%rbp)
  call   <sqrt@plt>
  mov    -0x4c(%rbp),%r8d
  mov    -0x48(%rbp),%r9
  pxor   %xmm1,%xmm1
  jmp    L16
L75:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void mvnrand(double *x, double *mu, double **S, int d) {
  double z[d], **V = new_matrix2(d, d);
  eigen_symm(z, V, S, d);
  int i;
  for (i = 0; i < d; i++)
    z[i] = sqrt(z[i]);
  mvnrand_pcs(x, mu, z, V, d);
  free_matrix2(V);
}
```
user: 这段汇编代码用C语言表示是什么样的？

```asm
<mvnrand>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  mov    %rsi,%r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %ecx,%r13d
  push   %r12
  mov    %rdx,%r12
  push   %rbx
  sub    $0x28,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %ecx,%rax
  mov    %rsp,%rcx
  lea    0xf(,%rax,8),%rax
  mov    %rax,%rdx
  and    $0xfffffffffffff000,%rax
  sub    %rax,%rcx
  and    $0xfffffffffffffff0,%rdx
  cmp    %rcx,%rsp
  je     L43
L89:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rcx,%rsp
  jne    L89
L43:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L18
L97:
  mov    %rsp,%r9
  mov    %r13d,%esi
  mov    %r13d,%edi
  mov    %r9,-0x48(%rbp)
  call   <new_matrix2@plt>
  mov    -0x48(%rbp),%rdi
  mov    %r13d,%ecx
  mov    %r12,%rdx
  mov    %rax,%rsi
  mov    %rax,-0x50(%rbp)
  call   <eigen_symm@plt>
  test   %r13d,%r13d
  mov    -0x48(%rbp),%r9
  mov    -0x50(%rbp),%r10
  jle    L17
  mov    %r13d,%eax
  mov    %r9,%rbx
  pxor   %xmm1,%xmm1
  lea    (%r9,%rax,8),%r12
  nopl   (%rax)
L25:
  movsd  (%rbx),%xmm0
  ucomisd %xmm0,%xmm1
  ja     L36
  sqrtsd %xmm0,%xmm0
  add    $0x8,%rbx
  movsd  %xmm0,-0x8(%rbx)
  cmp    %r12,%rbx
  jne    L25
L17:
  mov    %r14,%rdi
  mov    %r13d,%r8d
  mov    %r10,%rcx
  mov    %r9,%rdx
  mov    %r15,%rsi
  mov    %r10,-0x48(%rbp)
  call   <mvnrand_pcs@plt>
  mov    -0x48(%rbp),%rdi
  call   <free_matrix2@plt>
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L27
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax,%rax,1)
L18:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L97
L36:
  mov    %r9,-0x50(%rbp)
  add    $0x8,%rbx
  mov    %r10,-0x48(%rbp)
  call   <sqrt@plt>
  mov    -0x48(%rbp),%r10
  mov    -0x50(%rbp),%r9
  pxor   %xmm1,%xmm1
  movsd  %xmm0,-0x8(%rbx)
  cmp    %rbx,%r12
  jne    L25
  jmp    L17
L27:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void mvnrand(double *x, double *mu, double **S, int d) {
  double z[d], **V = new_matrix2(d, d);
  eigen_symm(z, V, S, d);
  int i;
  for (i = 0; i < d; i++)
    z[i] = sqrt(z[i]);
  mvnrand_pcs(x, mu, z, V, d);
  free_matrix2(V);
}
```
user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<viderDossierInventaireSauvegarde>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %rdi,%rbp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbx
  mov    %rdi,%rdx
  lea    D49(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <remove@plt>
  mov    %rbp,%rdx
  lea    D58(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <remove@plt>
  mov    %rbp,%rdx
  lea    D61(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <remove@plt>
  mov    %rbp,%rdx
  lea    D17(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <remove@plt>
  mov    %rbp,%rdx
  lea    D44(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <remove@plt>
  mov    %rbp,%rdx
  lea    D26(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <remove@plt>
  mov    %rbp,%rdx
  lea    D15(%rip),%rsi
  mov    %rbx,%rdi
  call   <sprintf@plt>
  mov    %rbx,%rdi
  call   <rmdir@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L7
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  ret
L7:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D49
type: string
name: disassemble_data
arguments: tag: D58
type: string
name: disassemble_data
arguments: tag: D61
type: string
name: disassemble_data
arguments: tag: D17
type: string
name: disassemble_data
arguments: tag: D44
type: string
name: disassemble_data
arguments: tag: D26
type: string
name: disassemble_data
arguments: tag: D15
type: string

tool: D49: Sauvegarde/%s/Inventaire/tek.txt

tool: D58: Sauvegarde/%s/Inventaire/armure.txt

tool: D61: Sauvegarde/%s/Inventaire/arme.txt

tool: D17: Sauvegarde/%s/Inventaire/tresor.txt

tool: D44: Sauvegarde/%s/Inventaire/potion.txt

tool: D26: Sauvegarde/%s/Inventaire/cle.txt

tool: D15: Sauvegarde/%s/Inventaire

assistant: ```c
void viderDossierInventaireSauvegarde(const char *nomPartie) {
  char chemin[200];
  sprintf(chemin, "Sauvegarde/%s/Inventaire/tek.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/armure.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/arme.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/tresor.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/potion.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/cle.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire", nomPartie);
  rmdir(chemin);
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<viderDossierInventaireSauvegarde>:
  endbr64
  push   %r12
  mov    %rdi,%rdx
  mov    %rdi,%r12
  lea    D55(%rip),%rsi
  push   %rbp
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D41(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D43(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D25(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D32(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %rbp,%rdi
  mov    %r12,%rdx
  lea    D24(%rip),%rsi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <rmdir@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L4
  add    $0xd8,%rsp
  pop    %rbp
  pop    %r12
  ret
L4:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D55
type_infered: string
name: unpack_data
arguments: tag: D34
type_infered: string
name: unpack_data
arguments: tag: D41
type_infered: string
name: unpack_data
arguments: tag: D43
type_infered: string
name: unpack_data
arguments: tag: D25
type_infered: string
name: unpack_data
arguments: tag: D32
type_infered: string
name: unpack_data
arguments: tag: D24
type_infered: string

tool: D55: Sauvegarde/%s/Inventaire/tek.txt

tool: D34: Sauvegarde/%s/Inventaire/armure.txt

tool: D41: Sauvegarde/%s/Inventaire/arme.txt

tool: D43: Sauvegarde/%s/Inventaire/tresor.txt

tool: D25: Sauvegarde/%s/Inventaire/potion.txt

tool: D32: Sauvegarde/%s/Inventaire/cle.txt

tool: D24: Sauvegarde/%s/Inventaire

assistant: ```c
void viderDossierInventaireSauvegarde(const char *nomPartie) {
  char chemin[200];
  sprintf(chemin, "Sauvegarde/%s/Inventaire/tek.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/armure.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/arme.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/tresor.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/potion.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/cle.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire", nomPartie);
  rmdir(chemin);
}
```
user: What is the c source code of the assembly code below:

```asm
<viderDossierInventaireSauvegarde>:
  endbr64
  push   %r12
  mov    %rdi,%rdx
  mov    %rdi,%r12
  lea    D0(%rip),%rsi
  push   %rbp
  sub    $0xd8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    %rsp,%rbp
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D16(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D19(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D54(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D12(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %r12,%rdx
  lea    D15(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <remove@plt>
  mov    %rbp,%rdi
  mov    %r12,%rdx
  lea    D6(%rip),%rsi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <rmdir@plt>
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L2
  add    $0xd8,%rsp
  pop    %rbp
  pop    %r12
  ret
L2:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D0
type_guessed: string
name: retrieve_data
arguments: tag: D16
type_guessed: string
name: retrieve_data
arguments: tag: D19
type_guessed: string
name: retrieve_data
arguments: tag: D54
type_guessed: string
name: retrieve_data
arguments: tag: D12
type_guessed: string
name: retrieve_data
arguments: tag: D15
type_guessed: string
name: retrieve_data
arguments: tag: D6
type_guessed: string

tool: D0: Sauvegarde/%s/Inventaire/tek.txt

tool: D16: Sauvegarde/%s/Inventaire/armure.txt

tool: D19: Sauvegarde/%s/Inventaire/arme.txt

tool: D54: Sauvegarde/%s/Inventaire/tresor.txt

tool: D12: Sauvegarde/%s/Inventaire/potion.txt

tool: D15: Sauvegarde/%s/Inventaire/cle.txt

tool: D6: Sauvegarde/%s/Inventaire

assistant: ```c
void viderDossierInventaireSauvegarde(const char *nomPartie) {
  char chemin[200];
  sprintf(chemin, "Sauvegarde/%s/Inventaire/tek.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/armure.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/arme.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/tresor.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/potion.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire/cle.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Inventaire", nomPartie);
  rmdir(chemin);
}
```
user: 请将以下的汇编代码转换成C语言代码：

```asm
<tbz_compute_stream_crc32>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x28(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %rdx,-0x38(%rbp)
  movq   $0x1000,-0x18(%rbp)
  mov    -0x18(%rbp),%rax
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  cmpq   $0x0,-0x10(%rbp)
  jne    L40
  mov    D29(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <strerror@plt>
  mov    -0x38(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    $0x1,%eax
  jmp    L54
L40:
  mov    D10(%rip),%rax
  mov    (%rax),%rax
  mov    $0x0,%edx
  mov    %rax,%rsi
  mov    $0x0,%edi
  call   <crc32_z@plt>
  mov    %rax,-0x20(%rbp)
L28:
  mov    -0x28(%rbp),%rcx
  mov    -0x18(%rbp),%rdx
  mov    -0x10(%rbp),%rax
  mov    $0x1,%esi
  mov    %rax,%rdi
  call   <fread@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  je     L2
  mov    -0x8(%rbp),%rdx
  mov    -0x10(%rbp),%rcx
  mov    -0x20(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <crc32_z@plt>
  mov    %rax,-0x20(%rbp)
L2:
  mov    -0x8(%rbp),%rax
  cmp    -0x18(%rbp),%rax
  jae    L28
  mov    -0x28(%rbp),%rax
  mov    %rax,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  je     L10
  mov    D29(%rip),%rax
  mov    (%rax),%eax
  mov    %eax,%edi
  call   <strerror@plt>
  mov    -0x38(%rbp),%rdx
  mov    %rax,(%rdx)
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L54
L10:
  nop
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x30(%rbp),%rax
  mov    -0x20(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    $0x0,%eax
L54:
  leave
  ret
```

assistant: ```c
int tbz_compute_stream_crc32(FILE *input_f, uint32_t *returned_crc, char **error) {
  size_t chunk_size = 1 << 12;
  uint8_t *buffer;
  uint32_t crc;
  buffer = (uint8_t *)malloc(chunk_size * sizeof(uint8_t));
  if (buffer == NULL) {
    *error = strerror(errno);
    return 1;
  }
  crc = crc32_z(0, Z_NULL, 0);
  while (1) {
    size_t bytes_read = fread(buffer, 1, chunk_size, input_f);
    if (bytes_read > 0) {
      crc = crc32_z(crc, buffer, bytes_read);
    }
    if (bytes_read < chunk_size) {
      if (ferror(input_f)) {
        *error = strerror(errno);
        free(buffer);
        return 1;
      } else {
        break;
      }
    }
  }
  free(buffer);
  *returned_crc = crc;
  return 0;
}
```
user: Converte this assembly snippet into its equivalent C code:

```asm
<tbz_compute_stream_crc32>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  mov    %rdi,%r13
  mov    %rsi,%r15
  mov    %rdx,%r14
  mov    $0x4000,%edi
  call   <malloc@plt>
  test   %rax,%rax
  je     L66
  mov    %rax,%r12
  mov    $0x0,%edx
  mov    D15(%rip),%rax
  mov    (%rax),%rsi
  mov    $0x0,%edi
  call   <crc32_z@plt>
  mov    %rax,%rbp
  jmp    L19
L66:
  mov    D23(%rip),%rax
  mov    (%rax),%edi
  call   <strerror@plt>
  mov    %rax,(%r14)
  mov    $0x1,%eax
  jmp    L12
L8:
  mov    %rax,%rdx
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <crc32_z@plt>
  mov    %rax,%rbp
  cmp    $0xfff,%rbx
  jbe    L5
L19:
  mov    %r13,%rcx
  mov    $0x1000,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fread@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L8
L5:
  mov    %r13,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L2
  mov    %r12,%rdi
  call   <free@plt>
  mov    %rbp,(%r15)
  mov    $0x0,%eax
L12:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L2:
  mov    D23(%rip),%rax
  mov    (%rax),%edi
  call   <strerror@plt>
  mov    %rax,(%r14)
  mov    %r12,%rdi
  call   <free@plt>
  mov    $0x1,%eax
  jmp    L12
```

assistant: ```c
int tbz_compute_stream_crc32(FILE *input_f, uint32_t *returned_crc, char **error) {
  size_t chunk_size = 1 << 12;
  uint8_t *buffer;
  uint32_t crc;
  buffer = (uint8_t *)malloc(chunk_size * sizeof(uint8_t));
  if (buffer == NULL) {
    *error = strerror(errno);
    return 1;
  }
  crc = crc32_z(0, Z_NULL, 0);
  while (1) {
    size_t bytes_read = fread(buffer, 1, chunk_size, input_f);
    if (bytes_read > 0) {
      crc = crc32_z(crc, buffer, bytes_read);
    }
    if (bytes_read < chunk_size) {
      if (ferror(input_f)) {
        *error = strerror(errno);
        free(buffer);
        return 1;
      } else {
        break;
      }
    }
  }
  free(buffer);
  *returned_crc = crc;
  return 0;
}
```
user: 下面的汇编指令对应的C源代码是什么:

```asm
<tbz_compute_stream_crc32>:
  endbr64
  push   %r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %rdi,%r12
  mov    $0x4000,%edi
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  call   <malloc@plt>
  test   %rax,%rax
  je     L37
  mov    %rax,%rbp
  mov    D22(%rip),%rax
  xor    %edx,%edx
  xor    %edi,%edi
  mov    (%rax),%rsi
  call   <crc32_z@plt>
  mov    %rax,%r15
  nopw   0x0(%rax,%rax,1)
L15:
  mov    %r12,%rcx
  mov    $0x1000,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fread@plt>
  mov    %rax,%rbx
  test   %rax,%rax
  jne    L47
L20:
  mov    %r12,%rdi
  call   <ferror@plt>
  test   %rax,%rax
  jne    L11
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r15,(%r14)
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L47:
  mov    %r15,%rdi
  mov    %rax,%rdx
  mov    %rbp,%rsi
  call   <crc32_z@plt>
  mov    %rax,%r15
  cmp    $0xfff,%rbx
  ja     L15
  jmp    L20
  nopl   0x0(%rax)
L11:
  mov    D24(%rip),%rax
  mov    (%rax),%edi
  call   <strerror@plt>
  mov    %rbp,%rdi
  mov    %rax,0x0(%r13)
  call   <free@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  xchg   %ax,%ax
L37:
  mov    D24(%rip),%rax
  mov    (%rax),%edi
  call   <strerror@plt>
  mov    %rax,0x0(%r13)
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int tbz_compute_stream_crc32(FILE *input_f, uint32_t *returned_crc, char **error) {
  size_t chunk_size = 1 << 12;
  uint8_t *buffer;
  uint32_t crc;
  buffer = (uint8_t *)malloc(chunk_size * sizeof(uint8_t));
  if (buffer == NULL) {
    *error = strerror(errno);
    return 1;
  }
  crc = crc32_z(0, Z_NULL, 0);
  while (1) {
    size_t bytes_read = fread(buffer, 1, chunk_size, input_f);
    if (bytes_read > 0) {
      crc = crc32_z(crc, buffer, bytes_read);
    }
    if (bytes_read < chunk_size) {
      if (ferror(input_f)) {
        *error = strerror(errno);
        free(buffer);
        return 1;
      } else {
        break;
      }
    }
  }
  free(buffer);
  *returned_crc = crc;
  return 0;
}
```