user: Please show me the C implementation that matches the assembly code listed below:

```asm
<save_matrix>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %r9d,%r12d
  push   %rbp
  sub    %r8d,%r12d
  mov    %r9d,%ebp
  push   %rbx
  add    $0x1,%r12d
  mov    %ecx,%ebx
  sub    $0x38,%rsp
  mov    %edx,0xc(%rsp)
  mov    0x78(%rsp),%rsi
  mov    %r8d,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  mov    %ecx,%eax
  sub    %edx,%eax
  add    $0x1,%eax
  mov    %eax,0x10(%rsp)
  mov    0x70(%rsp),%eax
  test   %eax,%eax
  je     L107
  call   <fopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L36
  lea    0x24(%rsp),%rdi
  mov    %rdi,0x18(%rsp)
  call   <time@plt>
  mov    0x18(%rsp),%rdi
  call   <ctime@plt>
  mov    %r14,%rdx
  lea    D101(%rip),%rsi
  mov    %r15,%rdi
  mov    %rax,%rcx
  xor    %eax,%eax
  call   <fprintf@plt>
  lea    D9(%rip),%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    %r12d,%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D65(%rip),%rsi
  call   <fprintf@plt>
  mov    0x10(%rsp),%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D1(%rip),%rsi
  call   <fprintf@plt>
  mov    0x8(%rsp),%eax
  cmp    %eax,%ebp
  jl     L146
  movslq %eax,%r12
  shl    $0x2,%r12
  nopl   0x0(%rax,%rax,1)
L144:
  movslq 0xc(%rsp),%r14
  cmp    %r14d,%ebx
  jge    L149
  jmp    L111
  nopl   0x0(%rax)
L9:
  mov    %r15,%rdi
  lea    D114(%rip),%rsi
  add    $0x1,%r14
  cvtss2sd %xmm0,%xmm0
  mov    $0x1,%eax
  call   <fprintf@plt>
  cmp    %r14d,%ebx
  jl     L111
L149:
  mov    0x0(%r13,%r14,8),%rax
  pxor   %xmm1,%xmm1
  movss  (%rax,%r12,1),%xmm0
  ucomiss %xmm1,%xmm0
  jp     L9
  jne    L9
  mov    %r15,%rcx
  mov    $0xf,%edx
  mov    $0x1,%esi
  add    $0x1,%r14
  lea    D85(%rip),%rdi
  call   <fwrite@plt>
  cmp    %r14d,%ebx
  jge    L149
L111:
  mov    %r15,%rsi
  mov    $0xa,%edi
  add    $0x4,%r12
  call   <fputc@plt>
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  cmp    %eax,%ebp
  jge    L144
L146:
  mov    %r15,%rdi
  call   <fclose@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L196
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L107:
  call   <fopen@plt>
  mov    %rax,%r15
  test   %rax,%rax
  je     L36
  lea    0x24(%rsp),%rdi
  mov    %rdi,0x18(%rsp)
  call   <time@plt>
  mov    0x18(%rsp),%rdi
  call   <ctime@plt>
  mov    %r14,%rdx
  lea    D101(%rip),%rsi
  mov    %r15,%rdi
  mov    %rax,%rcx
  xor    %eax,%eax
  call   <fprintf@plt>
  lea    D9(%rip),%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  mov    0x10(%rsp),%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D65(%rip),%rsi
  call   <fprintf@plt>
  mov    %r12d,%edx
  mov    %r15,%rdi
  xor    %eax,%eax
  lea    D1(%rip),%rsi
  call   <fprintf@plt>
  movslq 0xc(%rsp),%rax
  cmp    %eax,%ebx
  jl     L146
  lea    0x0(%r13,%rax,8),%r12
  movslq 0x8(%rsp),%rax
  shl    $0x2,%rax
  mov    %rax,0x10(%rsp)
  nopl   0x0(%rax,%rax,1)
L119:
  mov    0x8(%rsp),%eax
  mov    0x10(%rsp),%r14
  mov    %eax,%r13d
  cmp    %eax,%ebp
  jge    L64
  jmp    L24
  nopw   0x0(%rax,%rax,1)
L96:
  mov    %r15,%rdi
  add    $0x1,%r13d
  cvtss2sd %xmm0,%xmm0
  add    $0x4,%r14
  lea    D114(%rip),%rsi
  mov    $0x1,%eax
  call   <fprintf@plt>
  cmp    %r13d,%ebp
  jl     L24
L64:
  mov    (%r12),%rax
  pxor   %xmm2,%xmm2
  movss  (%rax,%r14,1),%xmm0
  ucomiss %xmm2,%xmm0
  jp     L96
  jne    L96
  mov    %r15,%rcx
  mov    $0xf,%edx
  add    $0x1,%r13d
  add    $0x4,%r14
  mov    $0x1,%esi
  lea    D85(%rip),%rdi
  call   <fwrite@plt>
  cmp    %r13d,%ebp
  jge    L64
L24:
  mov    %r15,%rsi
  mov    $0xa,%edi
  add    $0x8,%r12
  call   <fputc@plt>
  addl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %eax,%ebx
  jge    L119
  jmp    L146
L196:
  call   <__stack_chk_fail@plt>
L36:
  lea    D60(%rip),%rdi
  mov    %r14,%rsi
  call   <printf@plt>
  mov    $0x3f5,%edi
  call   <exit@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D101
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D9
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D65
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D1
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D114
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D85
type_guessed: string
name: extract_symbolic_data
arguments: data_tag: D60
type_guessed: string

tool: D101: %% filename: %s - %s

tool: D9: %% type: matrix 


tool: D65: %% rows: %d


tool: D1: %% columns: %d


tool: D114: %15.6e

tool: D85:     0          

tool: D60:  error: cannot open file: %s 


assistant: ```c
void save_matrix(char filename[], float **A, int ml, int mh, int nl, int nh, int transpose, const char *mode) {
  FILE *fp_m;
  int i, j, rows, cols;
  void exit();
  time_t now;
  if (transpose)
    rows = nh - nl + 1;
  else
    rows = mh - ml + 1;
  if (transpose)
    cols = mh - ml + 1;
  else
    cols = nh - nl + 1;
  if ((fp_m = fopen(filename, mode)) == NULL) {
    printf(" error: cannot open file: %s \n", filename);
    exit(1013);
  }
  (void)time(&now);
  fprintf(fp_m, "%% filename: %s - %s", filename, ctime(&now));
  fprintf(fp_m, "%% type: matrix \n");
  fprintf(fp_m, "%% rows: %d\n", rows);
  fprintf(fp_m, "%% columns: %d\n", cols);
  if (transpose) {
    for (j = nl; j <= nh; j++) {
      for (i = ml; i <= mh; i++) {
        if (A[i][j] != 0)
          fprintf(fp_m, "%15.6e", A[i][j]);
        else
          fprintf(fp_m, "    0          ");
      }
      fprintf(fp_m, "\n");
    }
  } else {
    for (i = ml; i <= mh; i++) {
      for (j = nl; j <= nh; j++) {
        if (A[i][j] != 0)
          fprintf(fp_m, "%15.6e", A[i][j]);
        else
          fprintf(fp_m, "    0          ");
      }
      fprintf(fp_m, "\n");
    }
  }
  fclose(fp_m);
  return;
}
```