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

```asm
<dt>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  mov    -0x40(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  cmp    %eax,%edx
  cmovge %edx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x24(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L111
L106:
  movl   $0x0,-0x28(%rbp)
  jmp    L85
L38:
  mov    -0x28(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L85:
  mov    -0x28(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L38
  mov    -0x8(%rbp),%rdi
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rdx
  mov    -0x3c(%rbp),%esi
  mov    -0x20(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <dt_row@plt>
  movl   $0x0,-0x28(%rbp)
  jmp    L95
L89:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x2c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x28(%rbp)
L95:
  mov    -0x28(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L89
  addl   $0x1,-0x2c(%rbp)
L111:
  mov    -0x2c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L106
  movl   $0x0,-0x28(%rbp)
  jmp    L29
L20:
  movl   $0x0,-0x2c(%rbp)
  jmp    L109
L50:
  mov    -0x28(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,%edx
  mov    -0x2c(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rax,%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L109:
  mov    -0x2c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L50
  mov    -0x8(%rbp),%rdi
  mov    -0x10(%rbp),%rcx
  mov    -0x18(%rbp),%rdx
  mov    -0x40(%rbp),%esi
  mov    -0x20(%rbp),%rax
  mov    %rdi,%r8
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <dt_row@plt>
  movl   $0x0,-0x2c(%rbp)
  jmp    L30
L68:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rax,%rdx
  mov    -0x28(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x2c(%rbp),%eax
  add    %ecx,%eax
  cltq
  lea    0x0(,%rax,8),%rcx
  mov    -0x38(%rbp),%rax
  add    %rcx,%rax
  movsd  (%rdx),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x2c(%rbp)
L30:
  mov    -0x2c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L68
  addl   $0x1,-0x28(%rbp)
L29:
  mov    -0x28(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L20
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x10(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  nop
  leave
  ret
```

assistant: ```c
void dt(double *m, int rows, int cols) {
  const int n = ((rows) > (cols) ? (rows) : (cols));
  double *f = (double *)malloc(sizeof(f[0]) * n);
  double *d = (double *)malloc(sizeof(d[0]) * n);
  double *z = (double *)malloc(sizeof(z[0]) * (n + 1));
  int *v = (int *)malloc(sizeof(v[0]) * n);
  int x, y;
  for (x = 0; x < cols; ++x) {
    for (y = 0; y < rows; ++y) {
      f[y] = m[y * cols + x];
    }
    dt_row(f, rows, d, z, v);
    for (y = 0; y < rows; ++y) {
      m[y * cols + x] = d[y];
    }
  }
  for (y = 0; y < rows; ++y) {
    for (x = 0; x < cols; ++x) {
      f[x] = m[y * cols + x];
    }
    dt_row(f, cols, d, z, v);
    for (x = 0; x < cols; ++x) {
      m[y * cols + x] = d[x];
    }
  }
  free(f);
  free(d);
  free(z);
  free(v);
}
```