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

```asm
<dfct>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rcx,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x58,%rsp
  mov    (%rcx),%eax
  mov    %edi,0x20(%rsp)
  mov    %eax,0x24(%rsp)
  shl    $0x3,%eax
  mov    %r8,0x28(%rsp)
  cmp    %edi,%eax
  jl     L149
L174:
  mov    0x4(%r13),%r14d
  mov    0x20(%rsp),%esi
  lea    (%r14,%r14,1),%eax
  mov    %esi,%edi
  sar    %edi
  cmp    %esi,%eax
  jl     L50
L87:
  movslq 0x20(%rsp),%r8
  movsd  (%r12),%xmm1
  movslq %edi,%rax
  movsd  (%r12,%rax,8),%xmm0
  lea    0x0(,%rax,8),%rdx
  mov    %r8,%rsi
  shl    $0x3,%r8
  movapd %xmm1,%xmm2
  lea    (%r12,%r8,1),%rcx
  movsd  (%rcx),%xmm3
  mov    %rcx,0x48(%rsp)
  addsd  %xmm3,%xmm2
  subsd  %xmm3,%xmm1
  movsd  %xmm1,(%r12)
  movapd %xmm2,%xmm1
  subsd  %xmm0,%xmm1
  addsd  %xmm2,%xmm0
  movsd  %xmm1,(%rbx)
  movsd  %xmm0,(%rbx,%rax,8)
  cmp    $0x2,%esi
  jle    L94
  mov    %esi,%ebp
  sar    $0x2,%ebp
  cmp    $0x7,%esi
  jle    L134
  mov    %r8,%rsi
  lea    -0x8(,%rax,8),%rcx
  movslq %ebp,%r15
  sub    %rdx,%rsi
  mov    $0x1,%edx
  add    %r12,%rsi
  nopl   0x0(%rax)
L49:
  movsd  (%r12,%rdx,8),%xmm2
  movsd  (%rsi,%rcx,1),%xmm5
  movsd  (%r12,%rcx,1),%xmm1
  movsd  (%rsi,%rdx,8),%xmm4
  movapd %xmm2,%xmm0
  subsd  %xmm5,%xmm2
  addsd  %xmm5,%xmm0
  movapd %xmm1,%xmm3
  subsd  %xmm4,%xmm1
  addsd  %xmm4,%xmm3
  movsd  %xmm2,(%r12,%rdx,8)
  movsd  %xmm1,(%r12,%rcx,1)
  movapd %xmm0,%xmm1
  subsd  %xmm3,%xmm1
  addsd  %xmm3,%xmm0
  movsd  %xmm1,(%rbx,%rdx,8)
  add    $0x1,%rdx
  movsd  %xmm0,(%rbx,%rcx,1)
  sub    $0x8,%rcx
  cmp    %rdx,%r15
  jne    L49
L128:
  mov    0x20(%rsp),%ecx
  lea    (%r12,%r15,8),%rdx
  mov    0x28(%rsp),%rax
  mov    %r12,%rsi
  movsd  (%rdx),%xmm0
  mov    %r8,0x18(%rsp)
  sub    %ebp,%ecx
  mov    %edi,0x10(%rsp)
  movslq %ecx,%rcx
  lea    (%r12,%rcx,8),%rcx
  addsd  (%rcx),%xmm0
  movsd  %xmm0,(%rbx,%r15,8)
  movsd  (%rdx),%xmm0
  subsd  (%rcx),%xmm0
  movsd  %xmm0,(%rdx)
  movslq 0x24(%rsp),%rdx
  lea    (%rax,%rdx,8),%rax
  mov    %r14d,%edx
  mov    %rax,%rcx
  mov    %rax,0x8(%rsp)
  call   <dctsub@plt>
  mov    0x18(%rsp),%r8
  mov    0x10(%rsp),%edi
  lea    -0x8(%r12,%r8,1),%r10
  lea    -0x2(%rdi),%r9d
  cmp    $0x4,%edi
  jg     L79
  je     L121
  movsd  (%r12),%xmm0
  subsd  0x8(%r12),%xmm0
  movsd  %xmm0,(%r10)
  movsd  0x8(%r12),%xmm0
  addsd  (%r12),%xmm0
  movsd  %xmm0,0x8(%r12)
  cmp    $0x1,%r9d
  jle    L88
L125:
  lea    0x1(%r9,%r9,1),%ecx
  movslq %r9d,%rdx
  movslq %ecx,%rcx
  lea    (%r12,%rcx,8),%rcx
  cs nopw 0x0(%rax,%rax,1)
L30:
  movsd  (%r12,%rdx,8),%xmm0
  addsd  0x8(%r12,%rdx,8),%xmm0
  sub    $0x20,%rcx
  movsd  %xmm0,0x20(%rcx)
  movsd  (%r12,%rdx,8),%xmm0
  subsd  0x8(%r12,%rdx,8),%xmm0
  sub    $0x2,%rdx
  movsd  %xmm0,0x10(%rcx)
  cmp    $0x1,%edx
  jg     L30
L88:
  lea    0x8(%rbx),%rax
  mov    $0x2,%r9d
  mov    %rax,0x18(%rsp)
  lea    0x8(%r13),%rax
  mov    %rax,0x40(%rsp)
  mov    $0x10,%eax
  cmp    $0x1,%ebp
  jle    L47
  mov    %r14d,0x10(%rsp)
  mov    %r12,%r14
  mov    %r9d,%r12d
  nopw   0x0(%rax,%rax,1)
L85:
  mov    0x10(%rsp),%edx
  mov    0x8(%rsp),%rcx
  mov    %rbx,%rsi
  mov    %ebp,%edi
  movslq %r12d,%r13
  call   <dctsub@plt>
  mov    0x20(%rsp),%edx
  lea    (%r14,%r13,8),%r10
  sub    %r12d,%edx
  movslq %edx,%rdx
  lea    (%r14,%rdx,8),%r11
  cmp    $0x4,%ebp
  jg     L56
  je     L14
  movsd  (%rbx),%xmm0
  subsd  0x8(%rbx),%xmm0
  movsd  %xmm0,(%r11)
  movsd  (%rbx),%xmm0
  addsd  0x8(%rbx),%xmm0
  movsd  %xmm0,(%r10)
  cmp    $0x3,%ebp
  jne    L194
L75:
  lea    0x0(,%r12,4),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rdi
  sub    %r13,%rdx
  shl    $0x4,%r13
  lea    (%r14,%rdx,8),%rcx
  mov    $0x2,%edx
  nopl   0x0(%rax,%rax,1)
L62:
  movsd  (%rbx,%rdx,8),%xmm0
  subsd  0x8(%rbx,%rdx,8),%xmm0
  movsd  %xmm0,(%rcx)
  movsd  (%rbx,%rdx,8),%xmm0
  addsd  0x8(%rbx,%rdx,8),%xmm0
  add    $0x2,%rdx
  movsd  %xmm0,(%rcx,%r13,1)
  add    %rdi,%rcx
  cmp    %edx,%ebp
  jg     L62
L194:
  mov    %ebp,%r10d
  mov    0x18(%rsp),%rax
  lea    0x0(%rbp,%rbp,1),%edx
  add    %r12d,%r12d
  sar    %r10d
  movslq %edx,%rdx
  lea    0x0(,%r15,8),%rdi
  lea    -0x1(%r10),%r8d
  lea    (%rbx,%rdx,8),%rcx
  add    %r15,%r8
  lea    (%rbx,%rdi,1),%rdx
  neg    %rdi
  lea    (%rax,%r8,8),%r8
  cs nopw 0x0(%rax,%rax,1)
L24:
  movsd  (%rcx),%xmm0
  subsd  (%rdx),%xmm0
  add    $0x8,%rdx
  sub    $0x8,%rcx
  movsd  %xmm0,-0x8(%rdx,%rdi,1)
  movsd  0x8(%rcx),%xmm0
  addsd  -0x8(%rdx),%xmm0
  movsd  %xmm0,0x8(%rcx,%rdi,1)
  cmp    %rdx,%r8
  jne    L24
  add    %r10d,%ebp
  movslq %r10d,%r15
  movslq %ebp,%rbp
  movsd  (%rbx,%rbp,8),%xmm0
  movsd  %xmm0,(%rbx,%r15,8)
  cmp    $0x1,%r10d
  je     L32
  mov    %r10d,%ebp
  jmp    L85
  nopl   0x0(%rax)
L94:
  movsd  (%r12),%xmm0
  movsd  %xmm0,0x8(%r12)
  movsd  (%rbx),%xmm0
  movsd  %xmm0,0x10(%r12)
  movsd  0x8(%rbx),%xmm0
L112:
  movsd  %xmm0,(%r12)
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L56:
  mov    0x28(%rsp),%r8
  mov    0x24(%rsp),%ecx
  mov    %rbx,%rsi
  mov    %ebp,%edi
  mov    0x40(%rsp),%rdx
  mov    %r10,0x38(%rsp)
  mov    %r11,0x30(%rsp)
  call   <cftfsub@plt>
  mov    0x8(%rsp),%rcx
  mov    0x10(%rsp),%edx
  mov    %ebp,%edi
  mov    %rbx,%rsi
  call   <rftfsub@plt>
  mov    0x30(%rsp),%r11
  mov    0x38(%rsp),%r10
L242:
  movsd  (%rbx),%xmm0
  subsd  0x8(%rbx),%xmm0
  movsd  %xmm0,(%r11)
  movsd  0x8(%rbx),%xmm0
  addsd  (%rbx),%xmm0
  movsd  %xmm0,(%r10)
  jmp    L75
L14:
  mov    0x28(%rsp),%r8
  mov    0x24(%rsp),%ecx
  mov    %rbx,%rsi
  mov    $0x4,%edi
  mov    0x40(%rsp),%rdx
  mov    %r10,0x38(%rsp)
  mov    %r11,0x30(%rsp)
  call   <cftfsub@plt>
  mov    0x30(%rsp),%r11
  mov    0x38(%rsp),%r10
  jmp    L242
  nopl   0x0(%rax)
L32:
  movslq %r12d,%rax
  mov    %r14,%r12
  shl    $0x3,%rax
L47:
  movsd  (%rbx),%xmm0
  movsd  %xmm0,(%r12,%rax,1)
  movsd  0x10(%rbx),%xmm0
  subsd  0x8(%rbx),%xmm0
  mov    0x48(%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  0x10(%rbx),%xmm0
  addsd  0x8(%rbx),%xmm0
  jmp    L112
L50:
  mov    0x28(%rsp),%rsi
  movslq 0x24(%rsp),%rax
  mov    %edi,0x8(%rsp)
  lea    (%rsi,%rax,8),%rdx
  mov    %r13,%rsi
  call   <makect@plt>
  mov    0x8(%rsp),%edi
  mov    %edi,%r14d
  jmp    L87
L149:
  mov    %edi,%eax
  mov    %r8,%rdx
  mov    %rcx,%rsi
  sar    $0x3,%eax
  mov    %eax,%edi
  mov    %eax,0x24(%rsp)
  call   <makewt@plt>
  jmp    L174
L134:
  movslq %ebp,%r15
  jmp    L128
L79:
  mov    0x28(%rsp),%r8
  mov    0x24(%rsp),%ecx
  lea    0x8(%r13),%rdx
  mov    %r12,%rsi
  mov    %r9d,0x30(%rsp)
  mov    %r10,0x18(%rsp)
  mov    %edi,0x10(%rsp)
  call   <cftfsub@plt>
  mov    0x8(%rsp),%rcx
  mov    %r14d,%edx
  mov    %r12,%rsi
  mov    0x10(%rsp),%edi
  call   <rftfsub@plt>
  mov    0x18(%rsp),%r10
  mov    0x30(%rsp),%r9d
L107:
  movsd  (%r12),%xmm0
  subsd  0x8(%r12),%xmm0
  movsd  %xmm0,(%r10)
  movsd  0x8(%r12),%xmm0
  addsd  (%r12),%xmm0
  movsd  %xmm0,0x8(%r12)
  jmp    L125
L121:
  mov    0x28(%rsp),%r8
  mov    0x24(%rsp),%ecx
  lea    0x8(%r13),%rdx
  mov    %r12,%rsi
  mov    $0x4,%edi
  mov    %r9d,0x18(%rsp)
  mov    %r10,0x10(%rsp)
  call   <cftfsub@plt>
  mov    0x10(%rsp),%r10
  mov    0x18(%rsp),%r9d
  jmp    L107
```

assistant: ```c
void dfct(int n, double *a, double *t, int *ip, double *w) {
  void makewt(int nw, int *ip, double *w);
  void makect(int nc, int *ip, double *c);
  void cftfsub(int n, double *a, int *ip, int nw, double *w);
  void rftfsub(int n, double *a, int nc, double *c);
  void dctsub(int n, double *a, int nc, double *c);
  int j, k, l, m, mh, nw, nc;
  double xr, xi, yr, yi;
  nw = ip[0];
  if (n > (nw << 3)) {
    nw = n >> 3;
    makewt(nw, ip, w);
  }
  nc = ip[1];
  if (n > (nc << 1)) {
    nc = n >> 1;
    makect(nc, ip, w + nw);
  }
  m = n >> 1;
  yi = a[m];
  xi = a[0] + a[n];
  a[0] -= a[n];
  t[0] = xi - yi;
  t[m] = xi + yi;
  if (n > 2) {
    mh = m >> 1;
    for (j = 1; j < mh; j++) {
      k = m - j;
      xr = a[j] - a[n - j];
      xi = a[j] + a[n - j];
      yr = a[k] - a[n - k];
      yi = a[k] + a[n - k];
      a[j] = xr;
      a[k] = yr;
      t[j] = xi - yi;
      t[k] = xi + yi;
    }
    t[mh] = a[mh] + a[n - mh];
    a[mh] -= a[n - mh];
    dctsub(m, a, nc, w + nw);
    if (m > 4) {
      cftfsub(m, a, ip + 2, nw, w);
      rftfsub(m, a, nc, w + nw);
    } else if (m == 4) {
      cftfsub(m, a, ip + 2, nw, w);
    }
    a[n - 1] = a[0] - a[1];
    a[1] = a[0] + a[1];
    for (j = m - 2; j >= 2; j -= 2) {
      a[2 * j + 1] = a[j] + a[j + 1];
      a[2 * j - 1] = a[j] - a[j + 1];
    }
    l = 2;
    m = mh;
    while (m >= 2) {
      dctsub(m, t, nc, w + nw);
      if (m > 4) {
        cftfsub(m, t, ip + 2, nw, w);
        rftfsub(m, t, nc, w + nw);
      } else if (m == 4) {
        cftfsub(m, t, ip + 2, nw, w);
      }
      a[n - l] = t[0] - t[1];
      a[l] = t[0] + t[1];
      k = 0;
      for (j = 2; j < m; j += 2) {
        k += l << 2;
        a[k - l] = t[j] - t[j + 1];
        a[k + l] = t[j] + t[j + 1];
      }
      l <<= 1;
      mh = m >> 1;
      for (j = 0; j < mh; j++) {
        k = m - j;
        t[j] = t[m + k] - t[m + j];
        t[k] = t[m + k] + t[m + j];
      }
      t[mh] = t[m + mh];
      m = mh;
    }
    a[l] = t[0];
    a[n] = t[2] - t[1];
    a[0] = t[2] + t[1];
  } else {
    a[1] = a[0];
    a[2] = t[0];
    a[0] = t[1];
  }
}
```