user: Demonstrate the C code that generates the assembly output below:

```asm
<write_imatrix2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %rdx,%r14
  mov    %ecx,0x10(%rsp)
  mov    %r8d,%r15d
  mov    %r9d,0x14(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0xc8(%rsp)
  xor    %edx,%edx
  lea    0x20(%rsp),%rbx
  mov    %rdi,%rcx
  mov    %esi,%edx
  lea    D18(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    D58(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L79
L81:
  mov    0x120(%rsp),%eax
  cmp    %eax,0x118(%rsp)
  jg     L67
  movslq 0x118(%rsp),%r13
  shl    $0x2,%r13
  movslq 0x14(%rsp),%rax
  shl    $0x3,%rax
  mov    %rax,0x18(%rsp)
  jmp    L110
L79:
  mov    %rbx,%rdx
  lea    0x70(%rsp),%rbx
  lea    D45(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  lea    D22(%rip),%rsi
  mov    $0x328,%edi
  call   <errhandler@plt>
  jmp    L81
L99:
  mov    (%r14,%rbx,8),%rax
  mov    (%rax,%rbp,1),%rax
  mov    (%rax,%r13,1),%edx
  lea    D29(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x1,%rbx
  cmp    %ebx,%r15d
  jge    L99
L48:
  mov    %r12,%rsi
  mov    $0xa,%edi
  call   <fputc@plt>
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  add    $0x8,%rbp
  cmp    %eax,0x110(%rsp)
  jl     L37
L94:
  mov    0x10(%rsp),%eax
  movslq %eax,%rbx
  cmp    %r15d,%eax
  jle    L99
  jmp    L48
L37:
  mov    %r12,%rcx
  mov    $0x3c,%edx
  mov    $0x1,%esi
  lea    D0(%rip),%rdi
  call   <fwrite@plt>
  addl   $0x1,0x118(%rsp)
  add    $0x4,%r13
  mov    0x118(%rsp),%eax
  cmp    %eax,0x120(%rsp)
  jl     L67
L110:
  mov    0x18(%rsp),%rbp
  mov    0x14(%rsp),%eax
  mov    %eax,0xc(%rsp)
  cmp    0x110(%rsp),%eax
  jle    L94
  jmp    L37
L67:
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L90
L86:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L100
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L90:
  lea    0x20(%rsp),%rdx
  lea    0x70(%rsp),%rbx
  lea    D4(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  lea    D22(%rip),%rsi
  mov    $0x33b,%edi
  call   <errhandler@plt>
  jmp    L86
L100:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D18
type: string
name: read_data
arguments: data_label: D58
type: string
name: read_data
arguments: data_label: D45
type: string
name: read_data
arguments: data_label: D22
type: string
name: read_data
arguments: data_label: D29
type: string
name: read_data
arguments: data_label: D0
type: string
name: read_data
arguments: data_label: D4
type: string

tool: D18: /media/norbert/940CB6150CB5F27A/Documents/simulation/debug/d%i_%s

tool: D58: w

tool: D45: Outputfile %s cannot be created

tool: D22: /scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProject/helper.c

tool: D29: %d 

tool: D0: -----------------------------------------------------------


tool: D4: Outputfile %s cannot be closed

assistant: ```c
void write_imatrix2(const char *szDebug, int timeStepNumber, int ***m, int nrl, int nrh, int ncl, int nch, int nll, int nlh) {
  int i, j, k;
  FILE *fh = 0;
  char szFileName[80];
  sprintf(szFileName, "/media/norbert/940CB6150CB5F27A/Documents/simulation/debug/d%i_%s", timeStepNumber, szDebug);
  fh = fopen(szFileName, "w");
  if (fh == NULL) {
    char szBuff[80];
    sprintf(szBuff, "Outputfile %s cannot be created", szFileName);
    errhandler(808, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProject/helper.c", szBuff);
  }
  for (k = nll; k <= nlh; k++) {
    for (j = ncl; j <= nch; j++) {
      for (i = nrl; i <= nrh; i++) {
        fprintf(fh, "%d ", m[i][j][k]);
      }
      fprintf(fh, "\n");
    }
    fprintf(fh, "-----------------------------------------------------------\n");
  }
  if (fclose(fh)) {
    char szBuff[80];
    sprintf(szBuff, "Outputfile %s cannot be closed", szFileName);
    errhandler(827, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProject/helper.c", szBuff);
  };
}
```