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

```asm
<unroll_dot_product>:
  endbr64
  mov    %rdi,%rcx
  mov    %edx,%r8d
  movapd %xmm0,%xmm2
  cmp    $0x3,%edx
  jle    L89
  lea    -0x4(%rdx),%edx
  mov    %edx,%eax
  shr    $0x2,%eax
  lea    0x1(%rax),%edi
  cmp    $0x3,%edx
  jbe    L65
  mov    %edi,%r9d
  movapd %xmm0,%xmm6
  mov    %rcx,%rax
  mov    %rsi,%rdx
  shr    %r9d
  unpcklpd %xmm6,%xmm6
  pxor   %xmm3,%xmm3
  sub    $0x1,%r9d
  shl    $0x6,%r9
  lea    0x40(%rcx,%r9,1),%r9
L12:
  movupd (%rax),%xmm5
  movupd (%rdx),%xmm9
  add    $0x40,%rax
  add    $0x40,%rdx
  movupd -0x20(%rax),%xmm12
  movupd -0x20(%rdx),%xmm11
  movhpd -0x30(%rax),%xmm5
  movhpd -0x30(%rdx),%xmm9
  movupd -0x30(%rax),%xmm1
  movupd -0x30(%rdx),%xmm4
  movlpd -0x38(%rax),%xmm1
  movhpd -0x10(%rax),%xmm12
  movlpd -0x38(%rdx),%xmm4
  movhpd -0x10(%rdx),%xmm11
  movapd %xmm5,%xmm0
  movapd %xmm9,%xmm10
  movupd -0x10(%rax),%xmm8
  movupd -0x10(%rdx),%xmm7
  movlpd -0x18(%rax),%xmm8
  movlpd -0x18(%rdx),%xmm7
  unpcklpd %xmm11,%xmm10
  unpcklpd %xmm12,%xmm0
  mulpd  %xmm10,%xmm0
  movapd %xmm4,%xmm13
  movapd %xmm1,%xmm10
  unpcklpd %xmm8,%xmm10
  unpcklpd %xmm7,%xmm13
  unpckhpd %xmm12,%xmm5
  mulpd  %xmm13,%xmm10
  unpckhpd %xmm11,%xmm9
  unpckhpd %xmm8,%xmm1
  mulpd  %xmm9,%xmm5
  unpckhpd %xmm7,%xmm4
  mulpd  %xmm4,%xmm1
  addpd  %xmm10,%xmm0
  addpd  %xmm5,%xmm0
  addpd  %xmm1,%xmm0
  mulpd  %xmm6,%xmm0
  movapd %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm3,%xmm1
  movapd %xmm0,%xmm3
  addsd  %xmm1,%xmm3
  cmp    %r9,%rax
  jne    L12
  mov    %edi,%eax
  and    $0xfffffffe,%eax
  lea    0x0(,%rax,4),%edx
  cmp    %edi,%eax
  je     L63
L85:
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rax
  movsd  (%rsi,%rdx,8),%xmm1
  mulsd  (%rcx,%rdx,8),%xmm1
  movsd  0x8(%rsi,%rax,1),%xmm0
  mulsd  0x8(%rcx,%rax,1),%xmm0
  addsd  %xmm1,%xmm0
  movsd  0x10(%rsi,%rax,1),%xmm1
  mulsd  0x10(%rcx,%rax,1),%xmm1
  addsd  %xmm1,%xmm0
  movsd  0x18(%rsi,%rax,1),%xmm1
  mulsd  0x18(%rcx,%rax,1),%xmm1
  addsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm3
L63:
  lea    0x0(,%rdi,4),%eax
L62:
  cmp    %eax,%r8d
  jle    L16
  sub    %eax,%r8d
  cmp    $0x1,%r8d
  je     L1
  movslq %eax,%rdx
  movapd %xmm2,%xmm4
  mov    %r8d,%r9d
  shl    $0x3,%rdx
  unpcklpd %xmm4,%xmm4
  shr    %r9d
  lea    (%rcx,%rdx,1),%rdi
  add    %rsi,%rdx
  movupd (%rdi),%xmm0
  movupd (%rdx),%xmm6
  mulpd  %xmm6,%xmm0
  mulpd  %xmm4,%xmm0
  movapd %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm3,%xmm1
  movapd %xmm0,%xmm3
  addsd  %xmm1,%xmm3
  cmp    $0x1,%r9d
  je     L26
  movupd 0x10(%rdi),%xmm1
  movupd 0x10(%rdx),%xmm0
  mulpd  %xmm1,%xmm0
  mulpd  %xmm4,%xmm0
  movapd %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm3,%xmm1
  movapd %xmm0,%xmm3
  addsd  %xmm1,%xmm3
L26:
  mov    %r8d,%edx
  and    $0xfffffffe,%edx
  add    %edx,%eax
  cmp    %r8d,%edx
  je     L16
L1:
  cltq
  movsd  (%rsi,%rax,8),%xmm0
  mulsd  (%rcx,%rax,8),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm3
L16:
  movapd %xmm3,%xmm0
  ret
  nopl   0x0(%rax)
L89:
  xor    %eax,%eax
  pxor   %xmm3,%xmm3
  jmp    L62
L65:
  xor    %edx,%edx
  pxor   %xmm3,%xmm3
  jmp    L85
```

assistant: ```c
double unroll_dot_product(const double *x, const double *y, int n, double weight) {
  double res = 0.0;
  int i = 0;
  for (; i <= n - 4; i += 4)
    res += (x[i] * y[i] + x[i + 1] * y[i + 1] + x[i + 2] * y[i + 2] + x[i + 3] * y[i + 3]) * weight;
  for (; i < n; i++)
    res += (x[i] * y[i]) * weight;
  return res;
}
```