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

```asm
<distance_vec>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x78,%rsp
  mov    %rdi,-0x58(%rbp)
  mov    %rsi,-0x60(%rbp)
  mov    %rdx,-0x68(%rbp)
  mov    %rcx,-0x70(%rbp)
  mov    %r8d,-0x74(%rbp)
  mov    -0x58(%rbp),%rax
  mov    %rax,-0x30(%rbp)
  mov    -0x60(%rbp),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x68(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x70(%rbp),%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x74(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  mov    %eax,-0x40(%rbp)
  movl   $0x0,-0x48(%rbp)
  jmp    L9
L20:
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x30(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x30(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <_mm_mul_pd@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x28(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <_mm_mul_pd@plt>
  mov    %eax,-0x38(%rbp)
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rcx
  mov    -0x20(%rbp),%rax
  add    %rcx,%rax
  mov    (%rax),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <_mm_mul_pd@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x38(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <_mm_add_pd@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x34(%rbp),%edx
  mov    -0x3c(%rbp),%eax
  mov    %edx,%esi
  mov    %eax,%edi
  call   <_mm_add_pd@plt>
  mov    %eax,-0x3c(%rbp)
  mov    -0x48(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edi
  call   <_mm_sqrt_pd@plt>
  mov    %eax,(%rbx)
  addl   $0x1,-0x48(%rbp)
L9:
  mov    -0x48(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L20
  mov    -0x40(%rbp),%eax
  add    %eax,%eax
  mov    %eax,-0x44(%rbp)
  jmp    L12
L7:
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm0,%xmm1
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x60(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  mov    -0x44(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x68(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  mov    -0x44(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,8),%rcx
  mov    -0x70(%rbp),%rdx
  lea    (%rcx,%rdx,1),%rbx
  movq   %rax,%xmm0
  call   <sqrtf@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  addl   $0x1,-0x44(%rbp)
L12:
  mov    -0x44(%rbp),%eax
  cmp    -0x74(%rbp),%eax
  jl     L7
  nop
  nop
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

assistant: ```c
void distance_vec(double *x, double *y, double *z, double *d, int n) {
  __m128d *xx = (__m128d *)x;
  __m128d *yy = (__m128d *)y;
  __m128d *zz = (__m128d *)z;
  __m128d *dd = (__m128d *)d;
  int k = n / 2;
  for (int i = 0; i < k; i++) {
    __m128d t1 = _mm_mul_pd(xx[i], xx[i]);
    __m128d t2 = _mm_mul_pd(yy[i], yy[i]);
    __m128d t3 = _mm_mul_pd(zz[i], zz[i]);
    t1 = _mm_add_pd(t1, t2);
    t1 = _mm_add_pd(t1, t3);
    dd[i] = _mm_sqrt_pd(t1);
  }
  for (int i = k * 2; i < n; i++) {
    d[i] = sqrtf(x[i] * x[i] + y[i] * y[i] + z[i] * z[i]);
  }
}
```