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

```asm
<write_matrix2>:
  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
  cmp    $0x3e7,%esi
  jg     L115
  lea    0x20(%rsp),%r8
  mov    %rdi,%rcx
  mov    %esi,%edx
  lea    D5(%rip),%rsi
  mov    %r8,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
L84:
  lea    0x20(%rsp),%rdi
  lea    D3(%rip),%rsi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L85
L130:
  mov    0x120(%rsp),%eax
  cmp    %eax,0x118(%rsp)
  jg     L119
  movslq 0x118(%rsp),%r13
  shl    $0x3,%r13
  movslq 0x14(%rsp),%rax
  shl    $0x3,%rax
  mov    %rax,0x18(%rsp)
  jmp    L116
L115:
  lea    -0x3e8(%rsi),%edx
  lea    0x20(%rsp),%rax
  mov    %rdi,%rcx
  lea    D43(%rip),%rsi
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  jmp    L84
L85:
  lea    0x20(%rsp),%rdx
  lea    0x70(%rsp),%rbx
  lea    D52(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  lea    D42(%rip),%rsi
  mov    $0x1cd,%edi
  call   <errhandler@plt>
  jmp    L130
L36:
  mov    (%r14,%rbx,8),%rax
  mov    (%rax,%rbp,1),%rax
  movsd  (%rax,%r13,1),%xmm0
  lea    D36(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  add    $0x1,%rbx
  cmp    %ebx,%r15d
  jge    L36
L45:
  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     L108
L137:
  mov    0x10(%rsp),%eax
  movslq %eax,%rbx
  cmp    %r15d,%eax
  jle    L36
  jmp    L45
L108:
  mov    %r12,%rcx
  mov    $0x3c,%edx
  mov    $0x1,%esi
  lea    D45(%rip),%rdi
  call   <fwrite@plt>
  addl   $0x1,0x118(%rsp)
  add    $0x8,%r13
  mov    0x118(%rsp),%eax
  cmp    %eax,0x120(%rsp)
  jl     L119
L116:
  mov    0x18(%rsp),%rbp
  mov    0x14(%rsp),%eax
  mov    %eax,0xc(%rsp)
  cmp    0x110(%rsp),%eax
  jle    L137
  jmp    L108
L119:
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L90
L50:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L32
  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    D16(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  lea    D42(%rip),%rsi
  mov    $0x1e0,%edi
  call   <errhandler@plt>
  jmp    L50
L32:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D5
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D3
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D43
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D52
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D42
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D36
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D45
type_guessed: string
name: extract_symbolic_data
arguments: data_label: D16
type_guessed: string

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

tool: D3: w

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

tool: D52: Outputfile %s cannot be created

tool: D42: /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: D36: %f 

tool: D45: -----------------------------------------------------------


tool: D16: Outputfile %s cannot be closed

assistant: ```c
void write_matrix2(const char *szDebug, int timeStepNumber, double ***m, int nrl, int nrh, int ncl, int nch, int nll, int nlh) {
  int i, j, k;
  FILE *fh = 0;
  char szFileName[80];
  if (timeStepNumber < 1000) {
    sprintf(szFileName, "/media/norbert/940CB6150CB5F27A/Documents/simulation/debug/d%i_%s", timeStepNumber, szDebug);
  } else {
    timeStepNumber = timeStepNumber - 1000;
    sprintf(szFileName, "/media/norbert/940CB6150CB5F27A/Documents/simulation/debug/P/d%i_%s", timeStepNumber, szDebug);
  }
  fh = fopen(szFileName, "w");
  if (fh == NULL) {
    char szBuff[80];
    sprintf(szBuff, "Outputfile %s cannot be created", szFileName);
    errhandler(461, "/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, "%f ", 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(480, "/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);
  };
}
```