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

```asm
<daubechies4>:
  endbr64
  cmp    $0x3,%esi
  jg     L9
  ret
  nopw   0x0(%rax,%rax,1)
L9:
  push   %r15
  push   %r14
  push   %r13
  mov    %edx,%r13d
  push   %r12
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rdi,%rbx
  lea    0x0(,%rsi,8),%edi
  sub    $0x8,%rsp
  call   <malloc@plt>
  movslq %ebp,%r11
  mov    %ebp,%ecx
  shl    $0x3,%r11
  mov    %rax,%rdi
  sar    %ecx
  lea    -0x8(%rbx,%r11,1),%r12
  test   %r13d,%r13d
  js     L64
  lea    -0x4(%rbp),%r14d
  movslq %ecx,%r8
  mov    %rax,%rdx
  mov    %r14d,%r10d
  lea    0x0(,%r8,8),%rsi
  shr    %r10d
  lea    (%rax,%rsi,1),%r15
  lea    0x1(%r10),%r9d
  add    %r9,%r8
  lea    0x1(%r9),%rax
  mov    %r9,%r10
  shl    $0x4,%rax
  lea    (%rdi,%r8,8),%r8
  add    %rbx,%rax
  cmp    %r8,%rbx
  setae  %r8b
  cmp    %r15,%rax
  setbe  %r13b
  or     %r13d,%r8d
  lea    0x8(%rdi),%r13
  cmp    %r13,%r15
  setne  %r15b
  cmp    $0x1,%r14d
  seta   %r14b
  and    %r15d,%r14d
  test   %r14b,%r8b
  je     L134
  lea    (%rdi,%r9,8),%r8
  cmp    %r8,%rbx
  setae  %r8b
  cmp    %rax,%rdi
  setae  %al
  or     %al,%r8b
  je     L134
  mov    %r9d,%r8d
  movapd D110(%rip),%xmm5
  movapd D209(%rip),%xmm4
  lea    0x10(%rbx),%rax
  shr    %r8d
  movapd D205(%rip),%xmm3
  movapd D112(%rip),%xmm2
  sub    $0x1,%r8d
  shl    $0x5,%r8
  lea    0x30(%rbx,%r8,1),%r8
  nopl   0x0(%rax)
L139:
  movupd -0x10(%rax),%xmm0
  movupd (%rax),%xmm1
  add    $0x20,%rax
  movlpd -0x28(%rax),%xmm1
  movhpd -0x20(%rax),%xmm0
  mulpd  %xmm4,%xmm1
  mulpd  %xmm5,%xmm0
  addpd  %xmm1,%xmm0
  movupd -0x20(%rax),%xmm1
  movhpd -0x10(%rax),%xmm1
  mulpd  %xmm3,%xmm1
  addpd  %xmm1,%xmm0
  movupd -0x10(%rax),%xmm1
  movlpd -0x18(%rax),%xmm1
  mulpd  %xmm2,%xmm1
  addpd  %xmm1,%xmm0
  movups %xmm0,(%rdx)
  movupd -0x30(%rax),%xmm0
  movupd -0x20(%rax),%xmm1
  movlpd -0x28(%rax),%xmm1
  movhpd -0x20(%rax),%xmm0
  mulpd  %xmm3,%xmm1
  mulpd  %xmm2,%xmm0
  subpd  %xmm1,%xmm0
  movupd -0x20(%rax),%xmm1
  movhpd -0x10(%rax),%xmm1
  mulpd  %xmm4,%xmm1
  addpd  %xmm1,%xmm0
  movupd -0x10(%rax),%xmm1
  movlpd -0x18(%rax),%xmm1
  mulpd  %xmm5,%xmm1
  subpd  %xmm1,%xmm0
  movups %xmm0,(%rsi,%rdx,1)
  add    $0x10,%rdx
  cmp    %rax,%r8
  jne    L139
  mov    %r10d,%eax
  and    $0xfffffffe,%eax
  lea    (%rax,%rax,1),%edx
  cmp    %eax,%r10d
  je     L111
  movslq %edx,%rdx
  mov    %eax,%r14d
  add    %ecx,%eax
  movsd  D110(%rip),%xmm6
  lea    0x0(,%rdx,8),%rsi
  lea    0x8(,%rdx,8),%rdx
  movsd  D209(%rip),%xmm7
  cltq
  lea    (%rbx,%rsi,1),%r9
  lea    (%rbx,%rdx,1),%r8
  movsd  D205(%rip),%xmm8
  movsd  (%r9),%xmm1
  movsd  (%r8),%xmm0
  lea    0x10(%rbx,%rsi,1),%rsi
  lea    0x10(%rbx,%rdx,1),%rdx
  movsd  (%rdx),%xmm2
  mulsd  %xmm7,%xmm0
  mulsd  %xmm6,%xmm1
  addsd  %xmm0,%xmm1
  movsd  (%rsi),%xmm0
  mulsd  %xmm8,%xmm0
  addsd  %xmm0,%xmm1
  movsd  D112(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdi,%r14,8)
  movsd  (%r9),%xmm1
  movsd  (%r8),%xmm2
  mulsd  %xmm0,%xmm1
  mulsd  %xmm8,%xmm2
  subsd  %xmm2,%xmm1
  movsd  (%rsi),%xmm2
  mulsd  %xmm7,%xmm2
  addsd  %xmm2,%xmm1
  movsd  (%rdx),%xmm2
  mulsd  %xmm6,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdi,%rax,8)
L142:
  lea    -0x10(%rbx,%r11,1),%rax
  movsd  (%r12),%xmm2
  movslq %r10d,%rdx
  add    %ecx,%r10d
  movsd  (%rax),%xmm1
  movslq %r10d,%r10
  mulsd  %xmm7,%xmm2
  mulsd  %xmm6,%xmm1
  addsd  %xmm2,%xmm1
  movsd  (%rbx),%xmm2
  mulsd  %xmm8,%xmm2
  addsd  %xmm2,%xmm1
  movsd  0x8(%rbx),%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdi,%rdx,8)
  mulsd  (%rax),%xmm0
  mulsd  (%r12),%xmm8
  mulsd  (%rbx),%xmm7
  mulsd  0x8(%rbx),%xmm6
  subsd  %xmm8,%xmm0
  addsd  %xmm7,%xmm0
  subsd  %xmm6,%xmm0
  movsd  %xmm0,(%rdi,%r10,8)
L110:
  cmp    %r13,%rbx
  je     L19
  mov    %ebp,%edx
  mov    %rbx,%rcx
  mov    %rdi,%rax
  shr    %edx
  sub    %rdi,%rcx
  shl    $0x4,%rdx
  add    %rdi,%rdx
  nopl   (%rax)
L15:
  movupd (%rax),%xmm3
  movups %xmm3,(%rcx,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L15
  mov    %ebp,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%ebp
  je     L171
  movsd  (%rdi,%rax,8),%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
L171:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <free@plt>
L64:
  movslq %ecx,%r9
  movsd  (%r12),%xmm0
  mov    %ecx,%r11d
  movsd  D205(%rip),%xmm8
  lea    0x0(,%r9,8),%r10
  movsd  D209(%rip),%xmm7
  movsd  D110(%rip),%xmm6
  mov    %r11,%r8
  lea    -0x8(%rbx,%r10,1),%rax
  lea    (%rbx,%r10,1),%rdx
  shl    $0x4,%r8
  movsd  (%rax),%xmm1
  mulsd  %xmm7,%xmm0
  movsd  (%rdx),%xmm2
  add    %rdi,%r8
  lea    (%rbx,%r11,8),%r11
  mulsd  %xmm8,%xmm1
  addsd  %xmm0,%xmm1
  movsd  (%rbx),%xmm0
  mulsd  %xmm6,%xmm0
  addsd  %xmm0,%xmm1
  movsd  D112(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdi)
  movsd  (%rax),%xmm1
  movsd  (%r12),%xmm2
  lea    -0x1(%rcx),%r12d
  lea    0x1(%r9,%r12,1),%r9
  lea    0x10(%rdi),%rax
  mov    %r12,%rsi
  mulsd  %xmm6,%xmm2
  lea    (%rbx,%r9,8),%r9
  mulsd  %xmm0,%xmm1
  cmp    %r9,%rax
  setae  %r12b
  cmp    %r8,%rdx
  setae  %r9b
  or     %r12d,%r9d
  cmp    %r11,%rax
  setae  %r11b
  cmp    %r8,%rbx
  subsd  %xmm2,%xmm1
  movsd  (%rbx),%xmm2
  setae  %r8b
  or     %r11d,%r8d
  mulsd  %xmm7,%xmm2
  addsd  %xmm2,%xmm1
  movsd  (%rdx),%xmm2
  mulsd  %xmm8,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,0x8(%rdi)
  test   %r8b,%r9b
  je     L20
  cmp    $0x2,%ecx
  je     L20
  mov    %esi,%r9d
  movapd D110(%rip),%xmm5
  movapd D209(%rip),%xmm4
  lea    0x8(%rbx,%r10,1),%r10
  shr    %r9d
  movapd D205(%rip),%xmm3
  movapd D112(%rip),%xmm2
  xor    %r8d,%r8d
  shl    $0x4,%r9
  nopw   0x0(%rax,%rax,1)
L135:
  movupd (%rbx,%r8,1),%xmm9
  movupd (%rdx,%r8,1),%xmm1
  add    $0x20,%rax
  movupd (%rdx,%r8,1),%xmm10
  mulpd  %xmm4,%xmm1
  mulpd  %xmm3,%xmm9
  mulpd  %xmm5,%xmm10
  addpd  %xmm1,%xmm9
  movupd 0x8(%rbx,%r8,1),%xmm1
  mulpd  %xmm5,%xmm1
  addpd  %xmm1,%xmm9
  movupd (%r10,%r8,1),%xmm1
  mulpd  %xmm2,%xmm1
  addpd  %xmm1,%xmm9
  movupd (%rbx,%r8,1),%xmm1
  mulpd  %xmm2,%xmm1
  subpd  %xmm10,%xmm1
  movupd 0x8(%rbx,%r8,1),%xmm10
  mulpd  %xmm4,%xmm10
  addpd  %xmm10,%xmm1
  movupd (%r10,%r8,1),%xmm10
  add    $0x10,%r8
  mulpd  %xmm3,%xmm10
  subpd  %xmm10,%xmm1
  movapd %xmm9,%xmm10
  unpcklpd %xmm1,%xmm10
  unpckhpd %xmm1,%xmm9
  movups %xmm10,-0x20(%rax)
  movups %xmm9,-0x10(%rax)
  cmp    %r8,%r9
  jne    L135
  mov    %esi,%edx
  mov    %esi,%eax
  lea    0x8(%rdi),%r13
  or     $0x1,%edx
  and    $0xfffffffe,%eax
  add    %edx,%edx
  and    $0x1,%esi
  je     L110
  mov    %eax,%esi
  add    %ecx,%eax
  movslq %edx,%r9
  add    $0x1,%edx
  cltq
  shl    $0x3,%rsi
  movslq %edx,%rdx
  shl    $0x3,%rax
  lea    (%rbx,%rsi,1),%r8
  lea    0x8(%rbx,%rsi,1),%rsi
  lea    (%rbx,%rax,1),%rcx
  movsd  (%r8),%xmm1
  lea    0x8(%rbx,%rax,1),%rax
  movsd  (%rcx),%xmm2
  mulsd  %xmm8,%xmm1
  mulsd  %xmm7,%xmm2
  addsd  %xmm2,%xmm1
  movsd  (%rsi),%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm2,%xmm1
  movsd  (%rax),%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdi,%r9,8)
  mulsd  (%r8),%xmm0
  mulsd  (%rcx),%xmm6
  mulsd  (%rsi),%xmm7
  mulsd  (%rax),%xmm8
  subsd  %xmm6,%xmm0
  addsd  %xmm7,%xmm0
  subsd  %xmm8,%xmm0
  movsd  %xmm0,(%rdi,%rdx,8)
  jmp    L110
  nopl   (%rax)
L111:
  movsd  D110(%rip),%xmm6
  movsd  D209(%rip),%xmm7
  movsd  D205(%rip),%xmm8
  movsd  D112(%rip),%xmm0
  jmp    L142
  cs nopw 0x0(%rax,%rax,1)
L19:
  mov    %ebp,%ebp
  mov    %rdi,%rax
  sub    %rdi,%rbx
  lea    (%rdi,%rbp,8),%rdx
  nopl   0x0(%rax)
L97:
  movsd  (%rax),%xmm0
  movsd  %xmm0,(%rbx,%rax,1)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L97
  jmp    L171
  nopw   0x0(%rax,%rax,1)
L134:
  mov    %r10d,%r8d
  mov    %rbx,%rax
  movsd  D110(%rip),%xmm6
  movsd  D209(%rip),%xmm7
  movsd  D205(%rip),%xmm8
  movsd  D112(%rip),%xmm0
  lea    (%rdi,%r8,8),%r8
  nopl   0x0(%rax,%rax,1)
L115:
  movsd  (%rax),%xmm1
  movsd  0x8(%rax),%xmm2
  add    $0x10,%rax
  mulsd  %xmm7,%xmm2
  mulsd  %xmm6,%xmm1
  addsd  %xmm2,%xmm1
  movsd  (%rax),%xmm2
  mulsd  %xmm8,%xmm2
  addsd  %xmm2,%xmm1
  movsd  0x8(%rax),%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdx)
  movsd  -0x10(%rax),%xmm1
  movsd  -0x8(%rax),%xmm2
  mulsd  %xmm0,%xmm1
  mulsd  %xmm8,%xmm2
  subsd  %xmm2,%xmm1
  movsd  (%rax),%xmm2
  mulsd  %xmm7,%xmm2
  addsd  %xmm2,%xmm1
  movsd  0x8(%rax),%xmm2
  mulsd  %xmm6,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%rsi,%rdx,1)
  add    $0x8,%rdx
  cmp    %rdx,%r8
  jne    L115
  jmp    L142
L20:
  sub    $0x2,%ecx
  mov    %rbx,%rsi
  lea    0x8(%rbx,%rcx,8),%rcx
  nopl   (%rax)
L165:
  movsd  (%rsi),%xmm1
  movsd  (%rdx),%xmm2
  add    $0x8,%rsi
  add    $0x8,%rdx
  add    $0x10,%rax
  mulsd  %xmm7,%xmm2
  mulsd  %xmm8,%xmm1
  addsd  %xmm2,%xmm1
  movsd  (%rsi),%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm2,%xmm1
  movsd  (%rdx),%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm2,%xmm1
  movsd  %xmm1,-0x10(%rax)
  movsd  -0x8(%rsi),%xmm1
  movsd  -0x8(%rdx),%xmm2
  mulsd  %xmm0,%xmm1
  mulsd  %xmm6,%xmm2
  subsd  %xmm2,%xmm1
  movsd  (%rsi),%xmm2
  mulsd  %xmm7,%xmm2
  addsd  %xmm2,%xmm1
  movsd  (%rdx),%xmm2
  mulsd  %xmm8,%xmm2
  subsd  %xmm2,%xmm1
  movsd  %xmm1,-0x8(%rax)
  cmp    %rcx,%rsi
  jne    L165
  lea    0x8(%rdi),%r13
  jmp    L110
```

tool_calls: name: unpack_data
arguments: tag: D110
datatype: f64[2]
name: unpack_data
arguments: tag: D209
datatype: f64[2]
name: unpack_data
arguments: tag: D205
datatype: f64[2]
name: unpack_data
arguments: tag: D112
datatype: byte[16]

tool: {"D110": [0.4829629131445341,0.4829629131445341]}

tool: {"D209": [0.8365163037378077,0.8365163037378077]}

tool: {"D205": [0.2241438680420134,0.2241438680420134]}

tool: {"D112": [0x8f,0x06,0x93,0xc1,0x7d,0x90,0xc0,0xbf,0x8f,0x06,0x93,0xc1,0x7d,0x90,0xc0,0xbf]}

assistant: ```c
void daubechies4(double *a, const int n, const int isign) {
  const double C0 = 0.4829629131445341, C1 = 0.83651630373780772, C2 = 0.22414386804201339, C3 = -0.12940952255126034;
  int nh, i, j;
  double *dwt;
  if (n < 4)
    return;
  dwt = (double *)malloc(n * sizeof(double));
  nh = n >> 1;
  if (isign >= 0) {
    for (j = 0, i = 0; j < n - 3; j += 2) {
      dwt[i] = C0 * a[j] + C1 * a[j + 1] + C2 * a[j + 2] + C3 * a[j + 3];
      dwt[i + nh] = C3 * a[j] - C2 * a[j + 1] + C1 * a[j + 2] - C0 * a[j + 3];
      i++;
    }
    dwt[i] = C0 * a[n - 2] + C1 * a[n - 1] + C2 * a[0] + C3 * a[1];
    dwt[i + nh] = C3 * a[n - 2] - C2 * a[n - 1] + C1 * a[0] - C0 * a[1];
  } else {
    dwt[0] = C2 * a[nh - 1] + C1 * a[n - 1] + C0 * a[0] + C3 * a[nh];
    dwt[1] = C3 * a[nh - 1] - C0 * a[n - 1] + C1 * a[0] - C2 * a[nh];
    for (i = 0, j = 2; i < nh - 1; i++) {
      dwt[j++] = C2 * a[i] + C1 * a[i + nh] + C0 * a[i + 1] + C3 * a[i + nh + 1];
      dwt[j++] = C3 * a[i] - C0 * a[i + nh] + C1 * a[i + 1] - C2 * a[i + nh + 1];
    }
  }
  for (i = 0; i < n; i++)
    a[i] = dwt[i];
  free(dwt);
  return;
}
```