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

```asm
<dct>:
  endbr64
  push   %r15
  mov    $0x1,%eax
  mov    %rsi,%r15
  mov    %rcx,%rsi
  push   %r14
  mov    %edx,%r9d
  push   %r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rcx,0x10(%rsp)
  mov    %edx,%ecx
  shl    %cl,%eax
  mov    %edx,0x28(%rsp)
  mov    %eax,%ebp
  movslq %eax,%rdx
  lea    0x0(,%rdx,8),%rcx
  sar    %ebp
  movslq %ebp,%rdx
  mov    %rcx,0x18(%rsp)
  sub    $0x8,%rcx
  lea    0x0(,%rdx,8),%rdi
  mov    %rdx,0x38(%rsp)
  lea    (%r12,%rcx,1),%rdx
  mov    %rdx,0x20(%rsp)
  cvttsd2si (%rsi),%edx
  lea    (%r15,%rdi,1),%rbx
  mov    %rcx,0x40(%rsp)
  mov    %rdi,0x30(%rsp)
  cmp    %eax,%edx
  je     L10
  mov    $0x2,%eax
  mov    %r9d,%ecx
  pxor   %xmm0,%xmm0
  add    %rdi,%rsi
  shl    %cl,%eax
  movsd  D27(%rip),%xmm1
  lea    (%rsi,%rdi,1),%rdx
  cvtsi2sd %eax,%xmm0
  divsd  %xmm0,%xmm1
  movsd  %xmm1,0x8(%rsp)
  test   %ebp,%ebp
  jle    L35
  mov    D24(%rip),%rcx
  movapd %xmm1,%xmm2
  lea    0x8(%rdx),%r13
  lea    0x8(%rsi),%r14
  lea    0x68(%rsp),%rax
  addsd  D47(%rip),%xmm2
  mov    %rcx,(%rsi)
  mov    %rcx,(%rdx)
  mov    %rax,%rcx
  add    0x30(%rsp),%rdx
  lea    0x60(%rsp),%rax
  cmp    $0x1,%ebp
  je     L89
  mov    %ebp,0x48(%rsp)
  mov    %rdx,%rbp
  mov    %rbx,0x50(%rsp)
  mov    %r14,%rbx
  mov    %rcx,%r14
  mov    %r12,0x58(%rsp)
  mov    %r13,%r12
  mov    %rax,%r13
  nopw   0x0(%rax,%rax,1)
L74:
  movapd %xmm2,%xmm0
  mov    %r13,%rsi
  mov    %r14,%rdi
  movsd  %xmm2,(%rsp)
  call   <sincos@plt>
  movsd  0x60(%rsp),%xmm0
  movsd  0x68(%rsp),%xmm3
  add    $0x8,%rbx
  add    $0x8,%r12
  movsd  (%rsp),%xmm2
  addsd  0x8(%rsp),%xmm2
  movapd %xmm0,%xmm1
  addsd  %xmm3,%xmm0
  subsd  %xmm3,%xmm1
  mulsd  D24(%rip),%xmm0
  mulsd  D24(%rip),%xmm1
  movsd  %xmm1,-0x8(%rbx)
  movsd  %xmm0,-0x8(%r12)
  cmp    %r12,%rbp
  jne    L74
  mov    0x48(%rsp),%ebp
  mov    0x50(%rsp),%rbx
  mov    0x58(%rsp),%r12
L89:
  mov    0x20(%rsp),%rcx
  mov    %r12,%rdx
  xor    %eax,%eax
  nopl   0x0(%rax,%rax,1)
L28:
  movsd  (%rdx),%xmm0
  sub    $0x10,%rcx
  add    $0x10,%rdx
  movsd  %xmm0,(%r15,%rax,8)
  movsd  0x10(%rcx),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%ebp
  jg     L28
  mov    0x10(%rsp),%r14
  mov    0x28(%rsp),%esi
  mov    %r15,%rdi
  xor    %eax,%eax
  mov    %r14,%rdx
  call   <hartley@plt>
  movsd  (%r15),%xmm0
  mov    0x38(%rsp),%rax
  lea    0x8(%r15),%rdi
  mov    0x30(%rsp),%rcx
  mov    0x40(%rsp),%rdx
  mov    %rdi,0x28(%rsp)
  movsd  %xmm0,(%r12)
  movsd  (%rbx),%xmm0
  add    %r15,%rdx
  movsd  %xmm0,(%r12,%rax,8)
  add    $0x1,%rax
  mov    %rax,0x50(%rsp)
  lea    0x8(%r14,%rcx,1),%rax
  lea    0x8(%r12),%r14
  add    %rax,%rcx
  cmp    $0x1,%ebp
  jle    L93
  mov    0x38(%rsp),%rdi
  lea    -0x1(%rbp),%r13d
  lea    0x18(%r12),%r11
  mov    %r13,%rsi
  mov    %r13,0x40(%rsp)
  mov    %r13,%r9
  lea    0x1(%rdi,%rdi,1),%rbx
  mov    0x18(%rsp),%rdi
  neg    %rsi
  lea    0x0(,%rbx,8),%r10
  mov    %rbx,0x48(%rsp)
  mov    %ebp,%ebx
  lea    (%rdi,%rsi,8),%r13
  mov    0x10(%rsp),%rsi
  mov    %r10,0x38(%rsp)
  lea    (%r12,%r13,1),%r8
  add    %r10,%rsi
  lea    -0x10(%rdi),%r10
  mov    %r8,0x8(%rsp)
  lea    (%r12,%rdi,1),%r8
  mov    %r10,0x58(%rsp)
  lea    (%r15,%r10,1),%rdi
  lea    0x0(,%rbx,8),%r10
  lea    0x18(%r15),%rbx
  mov    %r10,(%rsp)
  cmp    %rbx,%r14
  setae  %r10b
  cmp    0x28(%rsp),%r11
  setbe  %bl
  or     %r10d,%ebx
  cmp    $0x2,%ebp
  mov    0x10(%rsp),%rbp
  setne  %r10b
  and    %r10d,%ebx
  cmp    0x20(%rsp),%rdi
  setne  %r10b
  and    %r10d,%ebx
  mov    0x30(%rsp),%r10
  lea    0x18(%rbp,%r10,1),%r10
  cmp    %r10,%r14
  setae  %r10b
  cmp    %rax,%r11
  setbe  %bpl
  or     %ebp,%r10d
  mov    0x10(%rsp),%rbp
  and    %ebx,%r10d
  mov    0x38(%rsp),%rbx
  lea    0x10(%rbp,%rbx,1),%rbx
  cmp    %rbx,%r14
  setae  %bl
  cmp    %rsi,%r11
  setbe  %r11b
  or     %r11d,%ebx
  and    %r10d,%ebx
  cmp    %r13,(%rsp)
  setle  %r11b
  cmp    %r8,%r14
  setae  %r10b
  or     %r11d,%r10d
  mov    (%rsp),%r11
  and    %ebx,%r10d
  add    %r15,%r11
  cmp    %r11,0x8(%rsp)
  setae  %r11b
  cmp    %r8,0x28(%rsp)
  setae  %bl
  or     %ebx,%r11d
  lea    (%r15,%r13,1),%rbx
  mov    0x40(%rsp),%r13
  and    %r10d,%r11d
  mov    (%rsp),%r10
  add    %r12,%r10
  cmp    %rbx,%r10
  mov    0x18(%rsp),%rbx
  setbe  %r10b
  add    %r15,%rbx
  cmp    %rbx,%r14
  setae  %bl
  or     %ebx,%r10d
  and    %r11d,%r10d
  mov    0x48(%rsp),%r11
  add    %r13,%r11
  lea    0x0(%rbp,%r11,8),%r11
  cmp    %r11,0x8(%rsp)
  setae  %r11b
  cmp    %r8,%rsi
  setae  %bl
  or     %ebx,%r11d
  test   %r11b,%r10b
  je     L95
  mov    0x50(%rsp),%r11
  add    %r13,%r11
  lea    0x0(%rbp,%r11,8),%r10
  cmp    %r10,0x8(%rsp)
  setae  %r10b
  cmp    %r8,%rax
  setae  %r11b
  or     %r11b,%r10b
  je     L95
  mov    0x58(%rsp),%rbp
  mov    %r9d,%ebx
  xor    %r11d,%r11d
  xor    %r10d,%r10d
  shr    %ebx
  add    %r12,%rbp
  shl    $0x4,%rbx
  nopl   0x0(%rax)
L1:
  movupd 0x8(%r15,%r10,1),%xmm5
  movupd (%rsi,%r10,1),%xmm7
  movupd (%rax,%r10,1),%xmm0
  movupd (%rdi,%r11,1),%xmm1
  mulpd  %xmm5,%xmm0
  shufpd $0x1,%xmm1,%xmm1
  mulpd  %xmm7,%xmm1
  addpd  %xmm1,%xmm0
  movups %xmm0,0x8(%r12,%r10,1)
  movupd (%rsi,%r10,1),%xmm0
  movupd 0x8(%r15,%r10,1),%xmm5
  movupd (%rdi,%r11,1),%xmm1
  movupd (%rax,%r10,1),%xmm7
  add    $0x10,%r10
  mulpd  %xmm5,%xmm0
  shufpd $0x1,%xmm1,%xmm1
  mulpd  %xmm7,%xmm1
  subpd  %xmm1,%xmm0
  shufpd $0x1,%xmm0,%xmm0
  movups %xmm0,0x0(%rbp,%r11,1)
  sub    $0x10,%r11
  cmp    %r10,%rbx
  jne    L1
  mov    %r9d,%r10d
  mov    0x20(%rsp),%r8
  mov    0x28(%rsp),%rsi
  and    $0xfffffffe,%r10d
  mov    %r10d,%edi
  shl    $0x3,%rdi
  add    %rdi,%rax
  add    %rdi,%rcx
  add    %rdi,%r14
  sub    %rdi,%r8
  add    %rdi,%rsi
  sub    %rdi,%rdx
  cmp    %r10d,%r9d
  je     L93
  movsd  (%rax),%xmm0
  movsd  (%rcx),%xmm1
  mulsd  (%rsi),%xmm0
  mulsd  (%rdx),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r14)
  movsd  (%rcx),%xmm0
  movsd  (%rax),%xmm1
  mulsd  (%rsi),%xmm0
  mulsd  (%rdx),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%r8)
L93:
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L10:
  test   %ebp,%ebp
  jg     L89
L35:
  mov    0x10(%rsp),%rdx
  mov    %r15,%rdi
  mov    %r9d,%esi
  xor    %eax,%eax
  call   <hartley@plt>
  movsd  (%r15),%xmm0
  mov    0x38(%rsp),%rax
  movsd  %xmm0,(%r12)
  movsd  (%rbx),%xmm0
  movsd  %xmm0,(%r12,%rax,8)
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L95:
  mov    0x20(%rsp),%r8
  mov    %r9d,%edi
  xor    %esi,%esi
  nopw   0x0(%rax,%rax,1)
L11:
  movsd  (%rax,%rsi,8),%xmm0
  movsd  (%rcx,%rsi,8),%xmm1
  sub    $0x8,%rdx
  sub    $0x8,%r8
  mulsd  0x8(%rdx),%xmm1
  mulsd  0x8(%r15,%rsi,8),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%r12,%rsi,8)
  movsd  (%rcx,%rsi,8),%xmm0
  movsd  (%rax,%rsi,8),%xmm1
  mulsd  0x8(%r15,%rsi,8),%xmm0
  add    $0x1,%rsi
  mulsd  0x8(%rdx),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,0x8(%r8)
  cmp    %rdi,%rsi
  jne    L11
  add    $0x78,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D27
data_type: f64
name: extract_symbolic_data
arguments: data_label: D24
data_type: f64
name: extract_symbolic_data
arguments: data_label: D47
data_type: byte[8]

tool: D27: 3.141592652598793

tool: D24: 0.707106781186547

tool: {"D47": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

assistant: ```c
void dct(x, y, m, tab) double *x, *y, *tab;
int m;
{
  int n, n2, i;
  double *cp1, *cp2, *xp1, *xp2, *yp1, *yp2;
  double arg, delta_w;
  n = 1 << m;
  n2 = n >> 1;
  if ((int)(*tab) != n) {
    delta_w = 3.141592652598793 / (2 * n);
    cp1 = tab + n2;
    cp2 = cp1 + n2;
    arg = 0;
    for (i = 0; i < n2; i++) {
      *(cp1++) = (double)(cos(arg) - sin(arg)) * 0.707106781186547;
      *(cp2++) = (double)(cos(arg) + sin(arg)) * 0.707106781186547;
      arg += delta_w;
    }
  }
  xp1 = x;
  xp2 = x + (n - 1);
  yp1 = y;
  yp2 = y + n2;
  for (i = 0; i < n2; i++) {
    *(yp1++) = *xp1;
    *(yp2++) = *xp2;
    xp1 += 2;
    xp2 -= 2;
  }
  hartley(y, m, tab);
  *x = *y;
  *(x + n2) = *(y + n2);
  cp1 = tab + n2 + 1;
  cp2 = cp1 + n2;
  xp1 = x + 1;
  xp2 = x + (n - 1);
  yp1 = y + 1;
  yp2 = y + (n - 1);
  for (i = 1; i < n2; i++) {
    *(xp1++) = (*cp1) * (*yp1) + (*cp2) * (*yp2);
    *(xp2--) = (*cp2++) * (*yp1++) - (*cp1++) * (*yp2--);
  }
}
```