user: Converte this assembly snippet into its equivalent C code:

```asm
<printmat2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %edi,-0x34(%rbp)
  mov    %rsi,-0x40(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  sub    $0x1,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x34(%rbp),%eax
  cltq
  mov    %rax,%rcx
  mov    $0x0,%ebx
  movl   $0x10,-0x24(%rbp)
  mov    -0x34(%rbp),%eax
  cltd
  idivl  -0x24(%rbp)
  mov    %eax,-0x20(%rbp)
  mov    -0x34(%rbp),%eax
  cltd
  idivl  -0x24(%rbp)
  mov    %edx,-0x1c(%rbp)
  movl   $0x0,-0x30(%rbp)
  jmp    L32
L39:
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L139
L30:
  mov    -0x30(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%esi
  lea    D44(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x28(%rbp)
L139:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L30
  mov    $0xa,%edi
  call   <putchar@plt>
  movl   $0x0,-0x2c(%rbp)
  jmp    L133
L137:
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L36
L76:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x34(%rbp),%eax
  cltq
  imul   %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x30(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%eax
  add    %ecx,%eax
  cltq
  mov    (%rdx,%rax,8),%rax
  movq   %rax,%xmm0
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  addl   $0x1,-0x28(%rbp)
L36:
  mov    -0x28(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jl     L76
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0x2c(%rbp)
L133:
  mov    -0x2c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L137
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0x30(%rbp)
L32:
  mov    -0x30(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jl     L39
  cmpl   $0x0,-0x1c(%rbp)
  jle    L117
  lea    D24(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L52
L41:
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%esi
  lea    D44(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  addl   $0x1,-0x28(%rbp)
L52:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L41
  mov    $0xa,%edi
  call   <putchar@plt>
  movl   $0x0,-0x2c(%rbp)
  jmp    L3
L37:
  mov    -0x2c(%rbp),%eax
  mov    %eax,%esi
  lea    D22(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L83
L87:
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x34(%rbp),%eax
  cltq
  imul   %rdx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x40(%rbp),%rax
  add    %rax,%rdx
  mov    -0x20(%rbp),%eax
  imul   -0x24(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x28(%rbp),%eax
  add    %ecx,%eax
  cltq
  mov    (%rdx,%rax,8),%rax
  movq   %rax,%xmm0
  lea    D21(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  addl   $0x1,-0x28(%rbp)
L83:
  mov    -0x28(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jl     L87
  mov    $0xa,%edi
  call   <putchar@plt>
  addl   $0x1,-0x2c(%rbp)
L3:
  mov    -0x2c(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jl     L37
  nop
L117:
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D24
type_infered: string
name: extract_symbolic_data
arguments: data_label: D44
type_infered: string
name: extract_symbolic_data
arguments: data_label: D22
type_infered: string
name: extract_symbolic_data
arguments: data_label: D21
type_infered: string

tool: D24:     

tool: D44: %10d

tool: D22:  %3d

tool: D21: %+10.2e

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