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
  lea    0x20(%rsp),%rbx
  mov    %rdi,%rcx
  mov    %esi,%edx
  lea    D70(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  lea    D11(%rip),%rsi
  mov    %rbx,%rdi
  call   <fopen@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L64
L12:
  mov    0x120(%rsp),%eax
  cmp    %eax,0x118(%rsp)
  jg     L109
  movslq 0x118(%rsp),%r13
  shl    $0x3,%r13
  movslq 0x14(%rsp),%rax
  shl    $0x3,%rax
  mov    %rax,0x18(%rsp)
  jmp    L88
L64:
  mov    %rbx,%rdx
  lea    0x70(%rsp),%rbx
  lea    D40(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  lea    D63(%rip),%rsi
  mov    $0x149,%edi
  call   <errhandler@plt>
  jmp    L12
L83:
  mov    (%r14,%rbx,8),%rax
  mov    (%rax,%rbp,1),%rax
  movsd  (%rax,%r13,1),%xmm0
  lea    D34(%rip),%rsi
  mov    %r12,%rdi
  mov    $0x1,%eax
  call   <fprintf@plt>
  add    $0x1,%rbx
  cmp    %ebx,%r15d
  jge    L83
L125:
  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     L15
L89:
  mov    0x10(%rsp),%eax
  movslq %eax,%rbx
  cmp    %r15d,%eax
  jle    L83
  jmp    L125
L15:
  mov    %r12,%rcx
  mov    $0x3c,%edx
  mov    $0x1,%esi
  lea    D42(%rip),%rdi
  call   <fwrite@plt>
  addl   $0x1,0x118(%rsp)
  add    $0x8,%r13
  mov    0x118(%rsp),%eax
  cmp    %eax,0x120(%rsp)
  jl     L109
L88:
  mov    0x18(%rsp),%rbp
  mov    0x14(%rsp),%eax
  mov    %eax,0xc(%rsp)
  cmp    0x110(%rsp),%eax
  jle    L89
  jmp    L15
L109:
  mov    %r12,%rdi
  call   <fclose@plt>
  test   %rax,%rax
  jne    L35
L28:
  mov    0xc8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L52
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L35:
  lea    0x20(%rsp),%rdx
  lea    0x70(%rsp),%rbx
  lea    D69(%rip),%rsi
  mov    %rbx,%rdi
  mov    $0x0,%eax
  call   <sprintf@plt>
  mov    %rbx,%rdx
  lea    D63(%rip),%rsi
  mov    $0x15c,%edi
  call   <errhandler@plt>
  jmp    L28
L52:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: label: D70
data_type: string
name: extract_symbolic_data
arguments: label: D11
data_type: string
name: extract_symbolic_data
arguments: label: D40
data_type: string
name: extract_symbolic_data
arguments: label: D63
data_type: string
name: extract_symbolic_data
arguments: label: D34
data_type: string
name: extract_symbolic_data
arguments: label: D42
data_type: string
name: extract_symbolic_data
arguments: label: D69
data_type: string

tool: D70: debug/d%i_%s

tool: D11: w

tool: D40: Outputfile %s cannot be created

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

tool: D34: %f 

tool: D42: -----------------------------------------------------------


tool: D69: 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];
  sprintf(szFileName, "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(329, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProjectBackup/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(348, "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Backup/FinalProjectBackup/helper.c", szBuff);
  };
}
```