user: Translate the below assembly code into C programming language:

```asm
<write_data>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,%ebp
  mov    %edx,0x1c(%rsp)
  mov    %ecx,%r13d
  mov    %r8,0x20(%rsp)
  mov    %r9,0x28(%rsp)
  lea    D37(%rip),%rsi
  call   <fopen@plt>
  test   %rax,%rax
  je     L15
  mov    %rax,%rbx
  mov    %ebp,%edx
  lea    D72(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x1c(%rsp),%r14d
  mov    %r14d,%edx
  lea    D76(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %r13d,%edx
  lea    D59(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    0x70(%rsp),%edx
  lea    D70(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  test   %r14d,%r14d
  jle    L26
  movslq %ebp,%rbp
  lea    0x0(,%rbp,4),%rax
  mov    %rax,0x8(%rsp)
  movq   $0x0,0x10(%rsp)
  movl   $0x0,0x18(%rsp)
  lea    D54(%rip),%r12
  jmp    L120
L15:
  lea    D87(%rip),%rdi
  call   <printf@plt>
  jmp    L93
L100:
  mov    (%r15),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %ebp,%eax
  add    $0x1,%ebp
  add    0x8(%rsp),%r15
  cmp    %eax,%r14d
  jne    L100
L136:
  mov    0x18(%rsp),%edx
  lea    D8(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  cmpl   $0x0,0x70(%rsp)
  jle    L63
  mov    0x10(%rsp),%r15
  add    0x78(%rsp),%r15
  mov    $0x0,%ebp
  mov    0x70(%rsp),%r14d
L24:
  mov    (%r15),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %ebp,%eax
  add    $0x1,%ebp
  add    0x8(%rsp),%r15
  cmp    %ebp,%r14d
  jne    L24
  mov    %eax,%r14d
  mov    %rbx,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    0x10(%rsp),%r15
  add    0x80(%rsp),%r15
  mov    $0x0,%ebp
L45:
  mov    (%r15),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %ebp,%eax
  add    $0x1,%ebp
  add    0x8(%rsp),%r15
  cmp    %eax,%r14d
  jne    L45
L108:
  addl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%eax
  addq   $0x4,0x10(%rsp)
  cmp    %eax,0x1c(%rsp)
  je     L26
L120:
  mov    0x18(%rsp),%r14d
  mov    %r14d,%edx
  lea    D18(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %r14d,%edx
  lea    D93(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  test   %r13d,%r13d
  jle    L79
  mov    0x20(%rsp),%r15
  add    0x10(%rsp),%r15
  mov    $0x0,%ebp
L81:
  mov    (%r15),%edx
  mov    %r12,%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    %ebp,%r14d
  add    $0x1,%ebp
  add    0x8(%rsp),%r15
  cmp    %ebp,%r13d
  jne    L81
  mov    %rbx,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  mov    0x28(%rsp),%r15
  add    0x10(%rsp),%r15
  mov    $0x0,%ebp
  jmp    L100
L26:
  mov    %rbx,%rdi
  call   <fclose@plt>
L93:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L63:
  mov    %rbx,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  jmp    L108
L79:
  mov    %rbx,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  jmp    L136
```

tool_calls: name: read_data
arguments: label: D37
data_type: string
name: read_data
arguments: label: D72
data_type: string
name: read_data
arguments: label: D76
data_type: string
name: read_data
arguments: label: D59
data_type: string
name: read_data
arguments: label: D70
data_type: string
name: read_data
arguments: label: D54
data_type: string
name: read_data
arguments: label: D87
data_type: string
name: read_data
arguments: label: D8
data_type: string
name: read_data
arguments: label: D18
data_type: string
name: read_data
arguments: label: D93
data_type: string

tool: D37: w+

tool: D72: Total AVI Frames: %d


tool: D76: Frames Processed: %d


tool: D59: endoPoints: %d


tool: D70: epiPoints: %d

tool: D54: %d	

tool: D87: The file was not opened for writing


tool: D8: 
--epi--


tool: D18: 
---Frame %d---

tool: D93: 
--endo--


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);
}
```