user: Translate the below assembly code into C programming language:

```asm
<printmat2>:
  endbr64
  push   %r15
  mov    %edi,%edx
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,0x20(%rsp)
  movslq %edi,%rdi
  test   %edi,%edi
  lea    0xf(%rdi),%eax
  mov    %rdi,%rcx
  mov    %rsi,0x48(%rsp)
  cmovns %edi,%eax
  sar    $0x1f,%ecx
  mov    %rdi,0x40(%rsp)
  sar    $0x4,%eax
  mov    %eax,0x38(%rsp)
  mov    %ecx,%eax
  mov    %edx,%ecx
  shr    $0x1c,%eax
  add    %eax,%edx
  and    $0xf,%edx
  sub    %eax,%edx
  mov    %edx,0x3c(%rsp)
  cmp    $0xf,%ecx
  jle    L46
  lea    0x80(%rsi),%rax
  xor    %ebx,%ebx
  movq   $0x0,0x8(%rsp)
  lea    D0(%rip),%r14
  mov    %rax,0x10(%rsp)
  lea    0x0(,%rdi,8),%rax
  lea    D10(%rip),%rbp
  mov    %rax,0x30(%rsp)
  lea    D36(%rip),%rax
  mov    %rax,0x28(%rsp)
L75:
  lea    D50(%rip),%rdi
  xor    %eax,%eax
  lea    0x10(%rbx),%r13d
  call   <printf@plt>
  nopl   (%rax)
L91:
  mov    %ebx,%esi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x1,%ebx
  call   <printf@plt>
  cmp    %r13d,%ebx
  jne    L91
  mov    $0xa,%edi
  xor    %r12d,%r12d
  call   <putchar@plt>
  mov    %r13d,0x24(%rsp)
  mov    0x10(%rsp),%rbx
  mov    %r14,0x18(%rsp)
  mov    0x28(%rsp),%r15
  mov    0x30(%rsp),%r14
  nopw   0x0(%rax,%rax,1)
L14:
  mov    %r12d,%esi
  mov    %r15,%rdi
  lea    -0x80(%rbx),%r13
  xor    %eax,%eax
  call   <printf@plt>
  nopl   0x0(%rax)
L22:
  movsd  0x0(%r13),%xmm0
  mov    %rbp,%rdi
  mov    $0x1,%eax
  add    $0x8,%r13
  call   <printf@plt>
  cmp    %rbx,%r13
  jne    L22
  mov    $0xa,%edi
  add    $0x1,%r12d
  lea    0x0(%r13,%r14,1),%rbx
  call   <putchar@plt>
  cmp    %r12d,0x20(%rsp)
  jne    L14
  mov    $0xa,%edi
  mov    0x18(%rsp),%r14
  mov    0x24(%rsp),%r13d
  call   <putchar@plt>
  addq   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%rax
  subq   $0xffffffffffffff80,0x10(%rsp)
  cmp    %eax,0x38(%rsp)
  jle    L46
  mov    %r13d,%ebx
  jmp    L75
L46:
  mov    0x3c(%rsp),%edx
  test   %edx,%edx
  jg     L11
L39:
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  lea    D50(%rip),%rdi
  xor    %eax,%eax
  lea    D0(%rip),%r14
  call   <printf@plt>
  mov    0x38(%rsp),%ebx
  mov    0x20(%rsp),%r12d
  shl    $0x4,%ebx
  mov    %ebx,%ebp
L90:
  mov    %ebp,%esi
  mov    %r14,%rdi
  xor    %eax,%eax
  add    $0x1,%ebp
  call   <printf@plt>
  cmp    %r12d,%ebp
  jne    L90
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  jle    L39
  mov    0x3c(%rsp),%r13d
  movslq %ebx,%rbx
  mov    0x48(%rsp),%rcx
  xor    %r12d,%r12d
  mov    0x40(%rsp),%r15
  lea    D10(%rip),%rbp
  lea    -0x1(%r13),%eax
  neg    %r13
  shl    $0x3,%r15
  add    %rbx,%rax
  shl    $0x3,%r13
  lea    0x8(%rcx,%rax,8),%rbx
  lea    D36(%rip),%rax
  mov    %rax,0x28(%rsp)
L54:
  mov    0x28(%rsp),%rdi
  mov    %r12d,%esi
  xor    %eax,%eax
  lea    0x0(%r13,%rbx,1),%r14
  call   <printf@plt>
  nopl   0x0(%rax)
L74:
  movsd  (%r14),%xmm0
  mov    %rbp,%rdi
  mov    $0x1,%eax
  add    $0x8,%r14
  call   <printf@plt>
  cmp    %rbx,%r14
  jne    L74
  mov    $0xa,%edi
  add    $0x1,%r12d
  add    %r15,%rbx
  call   <putchar@plt>
  cmp    %r12d,0x20(%rsp)
  jne    L54
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: parse_data
arguments: data_tag: D0
type_guessed: string
name: parse_data
arguments: data_tag: D10
type_guessed: string
name: parse_data
arguments: data_tag: D36
type_guessed: string
name: parse_data
arguments: data_tag: D50
type_guessed: string

tool: D0: %10d

tool: D10: %+10.2e

tool: D36:  %3d

tool: D50:     

assistant: ```c
void printmat2(const int dim, double mat[][dim]) {
  const int ncols = 16;
  int i, j, k;
  int nblocks, nlast;
  nblocks = dim / ncols;
  nlast = dim % ncols;
  for (i = 0; i < nblocks; ++i) {
    printf("    ");
    for (k = 0; k < ncols; ++k)
      printf("%10d", k + i * ncols);
    printf("\n");
    for (j = 0; j < dim; ++j) {
      printf(" %3d", j);
      for (k = 0; k < ncols; ++k)
        printf("%+10.2e", mat[j][k + i * ncols]);
      printf("\n");
    }
    printf("\n");
  }
  if (nlast > 0) {
    printf("    ");
    for (k = 0; k < nlast; ++k)
      printf("%10d", k + nblocks * ncols);
    printf("\n");
    for (j = 0; j < dim; ++j) {
      printf(" %3d", j);
      for (k = 0; k < nlast; ++k)
        printf("%+10.2e", mat[j][k + nblocks * ncols]);
      printf("\n");
    }
  }
  return;
}
```