user: 请从给定的汇编指令推导出C源代码:

```asm
<write_imatrix2>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  mov    %esi,%edx
  lea    D59(%rip),%rsi
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %ecx,0x8(%rsp)
  lea    0x20(%rsp),%rbx
  mov    %rdi,%rcx
  mov    %r8d,(%rsp)
  mov    %rbx,%rdi
  mov    %r9d,0xc(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xc8(%rsp)
  xor    %eax,%eax
  mov    %rbx,0x18(%rsp)
  call   <sprintf@plt>
  lea    D15(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L70
L90:
  mov    0x120(%rsp),%eax
  cmp    %eax,0x118(%rsp)
  jg     L19
  movslq 0xc(%rsp),%rax
  movslq 0x118(%rsp),%r12
  lea    D66(%rip),%r14
  shl    $0x3,%rax
  shl    $0x2,%r12
  mov    %rax,0x10(%rsp)
  cs nopw 0x0(%rax,%rax,1)
L107:
  mov    0xc(%rsp),%eax
  mov    0x10(%rsp),%rbx
  mov    %eax,0x4(%rsp)
  cmp    0x110(%rsp),%eax
  jg     L65
  cs nopw 0x0(%rax,%rax,1)
L44:
  movslq 0x8(%rsp),%rbp
  cmp    (%rsp),%ebp
  jg     L62
  nopw   0x0(%rax,%rax,1)
L50:
  mov    0x0(%r13,%rbp,8),%rax
  mov    %r14,%rsi
  mov    %r15,%rdi
  add    $0x1,%rbp
  mov    (%rax,%rbx,1),%rax
  mov    (%rax,%r12,1),%edx
  xor    %eax,%eax
  call   <fprintf@plt>
  cmp    %ebp,(%rsp)
  jge    L50
L62:
  mov    %r15,%rsi
  mov    $0xa,%edi
  add    $0x8,%rbx
  call   <fputc@plt>
  addl   $0x1,0x4(%rsp)
  mov    0x4(%rsp),%eax
  cmp    %eax,0x110(%rsp)
  jge    L44
L65:
  mov    %r15,%rcx
  mov    $0x3c,%edx
  mov    $0x1,%esi
  add    $0x4,%r12
  lea    D60(%rip),%rdi
  call   <fwrite@plt>
  addl   $0x1,0x118(%rsp)
  mov    0x118(%rsp),%eax
  cmp    %eax,0x120(%rsp)
  jge    L107
L19:
  mov    %r15,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L2
L68:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L30
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L2:
  mov    0x18(%rsp),%rdx
  lea    0x70(%rsp),%r12
  lea    D24(%rip),%rsi
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <sprintf@plt>
  mov    %r12,%rdx
  mov    $0x33b,%edi
  lea    D78(%rip),%rsi
  call   <errhandler@plt>
  jmp    L68
L70:
  mov    0x18(%rsp),%rdx
  lea    0x70(%rsp),%r12
  lea    D5(%rip),%rsi
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <sprintf@plt>
  mov    %r12,%rdx
  mov    $0x328,%edi
  lea    D78(%rip),%rsi
  call   <errhandler@plt>
  jmp    L90
L30:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D59
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D15
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D66
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D60
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D24
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D78
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D5
type_infered: string

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

tool: D15: w

tool: D66: %d 

tool: D60: -----------------------------------------------------------


tool: D24: Outputfile %s cannot be closed

tool: D78: /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: D5: Outputfile %s cannot be created

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