user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<write_data>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %edx,-0x20(%rbp)
  mov    %ecx,-0x24(%rbp)
  mov    %r8,-0x30(%rbp)
  mov    %r9,-0x38(%rbp)
  mov    -0x18(%rbp),%rax
  lea    D4(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x8(%rbp)
  cmpq   $0x0,-0x8(%rbp)
  jne    L57
  lea    D86(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  jmp    L96
L57:
  mov    -0x1c(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D2(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x20(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D19(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x24(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D46(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0x8(%rbp),%rax
  mov    0x10(%rbp),%edx
  lea    D70(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movl   $0x0,-0xc(%rbp)
  jmp    L95
L11:
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D89(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D124(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movl   $0x0,-0x10(%rbp)
  jmp    L91
L36:
  mov    -0x10(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    D58(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addl   $0x1,-0x10(%rbp)
L91:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L36
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  movl   $0x0,-0x10(%rbp)
  jmp    L33
L71:
  mov    -0x10(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    D58(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addl   $0x1,-0x10(%rbp)
L33:
  mov    -0x10(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L71
  mov    -0xc(%rbp),%edx
  mov    -0x8(%rbp),%rax
  lea    D118(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  movl   $0x0,-0x10(%rbp)
  jmp    L21
L85:
  mov    -0x10(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    0x18(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    D58(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addl   $0x1,-0x10(%rbp)
L21:
  mov    -0x10(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L85
  mov    -0x8(%rbp),%rax
  mov    %rax,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  movl   $0x0,-0x10(%rbp)
  jmp    L98
L73:
  mov    -0x10(%rbp),%eax
  imul   -0x1c(%rbp),%eax
  mov    %eax,%edx
  mov    -0xc(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x8(%rbp),%rax
  lea    D58(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  addl   $0x1,-0x10(%rbp)
L98:
  mov    -0x10(%rbp),%eax
  cmp    0x10(%rbp),%eax
  jl     L73
  addl   $0x1,-0xc(%rbp)
L95:
  mov    -0xc(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L11
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
L96:
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: data_label: D4
type_infered: string
name: retrieve_data
arguments: data_label: D86
type_infered: string
name: retrieve_data
arguments: data_label: D2
type_infered: string
name: retrieve_data
arguments: data_label: D19
type_infered: string
name: retrieve_data
arguments: data_label: D46
type_infered: string
name: retrieve_data
arguments: data_label: D70
type_infered: string
name: retrieve_data
arguments: data_label: D89
type_infered: string
name: retrieve_data
arguments: data_label: D124
type_infered: string
name: retrieve_data
arguments: data_label: D58
type_infered: string
name: retrieve_data
arguments: data_label: D118
type_infered: string

tool: D4: w+

tool: D86: The file was not opened for writing


tool: D2: Total AVI Frames: %d


tool: D19: Frames Processed: %d


tool: D46: endoPoints: %d


tool: D70: epiPoints: %d

tool: D89: 
---Frame %d---

tool: D124: 
--endo--


tool: D58: %d	

tool: D118: 
--epi--


assistant: ```c
void write_data(char *filename, int frameNo, int frames_processed, int endoPoints, int *input_a, int *input_b, int epiPoints, int *input_2a, int *input_2b) {
  FILE *fid;
  int i, j;
  char c;
  fid = fopen(filename, "w+");
  if (fid == NULL) {
    printf("The file was not opened for writing\n");
    return;
  }
  fprintf(fid, "Total AVI Frames: %d\n", frameNo);
  fprintf(fid, "Frames Processed: %d\n", frames_processed);
  fprintf(fid, "endoPoints: %d\n", endoPoints);
  fprintf(fid, "epiPoints: %d", epiPoints);
  for (j = 0; j < frames_processed; j++) {
    fprintf(fid, "\n---Frame %d---", j);
    fprintf(fid, "\n--endo--\n", j);
    for (i = 0; i < endoPoints; i++) {
      fprintf(fid, "%d\t", input_a[j + i * frameNo]);
    }
    fprintf(fid, "\n");
    for (i = 0; i < endoPoints; i++) {
      fprintf(fid, "%d\t", input_b[j + i * frameNo]);
    }
    fprintf(fid, "\n--epi--\n", j);
    for (i = 0; i < epiPoints; i++) {
      fprintf(fid, "%d\t", input_2a[j + i * frameNo]);
    }
    fprintf(fid, "\n");
    for (i = 0; i < epiPoints; i++) {
      fprintf(fid, "%d\t", input_2b[j + i * frameNo]);
    }
  }
  fclose(fid);
}
```