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

```asm
<do_ftuneven>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %edi,0x5c(%rsp)
  mov    %rsi,%r14
  mov    %rdx,%r15
  movsd  %xmm0,0x60(%rsp)
  movsd  %xmm1,0x88(%rsp)
  test   %edi,%edi
  jle    L15
  mov    %rdx,%rax
  lea    -0x1(%rdi),%edx
  lea    0x8(%r15,%rdx,8),%rdx
  pxor   %xmm0,%xmm0
L30:
  addsd  (%rax),%xmm0
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L30
L53:
  mov    0x5c(%rsp),%edx
  pxor   %xmm5,%xmm5
  cvtsi2sd %edx,%xmm5
  movsd  %xmm5,0x80(%rsp)
  divsd  %xmm5,%xmm0
  movsd  %xmm0,0x28(%rsp)
  test   %ecx,%ecx
  jle    L186
  mov    %r8,%r13
  mov    %r9,0x40(%rsp)
  mov    0xf0(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0xf8(%rsp),%rax
  mov    %rax,0x50(%rsp)
  lea    -0x1(%rcx),%eax
  lea    0x8(%r8,%rax,8),%rax
  mov    %rax,0x68(%rsp)
  lea    -0x1(%rdx),%ebp
  lea    0x0(,%rbp,8),%rax
  lea    0x8(%r14,%rax,1),%rcx
  mov    %rcx,0x98(%rsp)
  lea    0x8(%r15,%rax,1),%rax
  mov    %rax,0x90(%rsp)
  mov    %rbp,%r12
  jmp    L104
L15:
  pxor   %xmm0,%xmm0
  jmp    L53
L234:
  cmpl   $0x0,0x5c(%rsp)
  jle    L23
  movsd  0x30(%rsp),%xmm7
  movapd %xmm7,%xmm5
  addsd  %xmm7,%xmm5
  movsd  %xmm5,0x18(%rsp)
  mov    %r14,%rbx
  pxor   %xmm7,%xmm7
  movsd  %xmm7,0x10(%rsp)
  movsd  %xmm7,0x8(%rsp)
  lea    0xa8(%rsp),%rbp
  mov    %r12,0x20(%rsp)
  mov    0x98(%rsp),%r12
L107:
  lea    0xa0(%rsp),%rsi
  movsd  0x18(%rsp),%xmm0
  mulsd  (%rbx),%xmm0
  mov    %rbp,%rdi
  call   <sincos@plt>
  movsd  0x8(%rsp),%xmm4
  addsd  0xa0(%rsp),%xmm4
  movsd  %xmm4,0x8(%rsp)
  movsd  0x10(%rsp),%xmm5
  addsd  0xa8(%rsp),%xmm5
  movsd  %xmm5,0x10(%rsp)
  add    $0x8,%rbx
  cmp    %r12,%rbx
  jne    L107
  mov    0x20(%rsp),%r12
  movapd %xmm4,%xmm1
  movapd %xmm5,%xmm0
  call   <atan2@plt>
  mulsd  D18(%rip),%xmm0
  movsd  %xmm0,0x38(%rsp)
  mov    $0x0,%ebx
  pxor   %xmm5,%xmm5
  movsd  %xmm5,0x20(%rsp)
  movsd  %xmm5,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  movsd  %xmm5,0x8(%rsp)
  lea    0xa8(%rsp),%rbp
L174:
  lea    0xa0(%rsp),%rsi
  movsd  0x30(%rsp),%xmm0
  mulsd  (%r14,%rbx,8),%xmm0
  subsd  0x38(%rsp),%xmm0
  mov    %rbp,%rdi
  call   <sincos@plt>
  movsd  0xa0(%rsp),%xmm2
  movsd  0xa8(%rsp),%xmm1
  movsd  (%r15,%rbx,8),%xmm0
  subsd  0x28(%rsp),%xmm0
  movapd %xmm0,%xmm3
  mulsd  %xmm2,%xmm3
  addsd  0x8(%rsp),%xmm3
  movsd  %xmm3,0x8(%rsp)
  mulsd  %xmm1,%xmm0
  addsd  0x10(%rsp),%xmm0
  movsd  %xmm0,0x10(%rsp)
  mulsd  %xmm2,%xmm2
  addsd  0x18(%rsp),%xmm2
  movsd  %xmm2,0x18(%rsp)
  mulsd  %xmm1,%xmm1
  addsd  0x20(%rsp),%xmm1
  movsd  %xmm1,0x20(%rsp)
  mov    %rbx,%rax
  add    $0x1,%rbx
  cmp    %r12,%rax
  jne    L174
  movsd  0x60(%rsp),%xmm4
  comisd D8(%rip),%xmm4
  jbe    L138
L89:
  movsd  D25(%rip),%xmm0
  movsd  0x8(%rsp),%xmm6
  divsd  %xmm0,%xmm6
  movsd  %xmm6,0x8(%rsp)
  movsd  0x10(%rsp),%xmm7
  divsd  %xmm0,%xmm7
  movsd  %xmm7,0x10(%rsp)
L138:
  pxor   %xmm0,%xmm0
  ucomisd 0x18(%rsp),%xmm0
  ja     L77
L201:
  movsd  0x18(%rsp),%xmm0
  sqrtsd %xmm0,%xmm0
L112:
  mulsd  D25(%rip),%xmm0
  movsd  0x8(%rsp),%xmm5
  divsd  %xmm0,%xmm5
  movsd  %xmm5,0x70(%rsp)
  movsd  0x60(%rsp),%xmm4
  mulsd  0x10(%rsp),%xmm4
  movq   %xmm4,%rbx
  pxor   %xmm5,%xmm5
  movsd  0x20(%rsp),%xmm6
  ucomisd %xmm6,%xmm5
  ja     L81
  sqrtsd %xmm6,%xmm6
  movapd %xmm6,%xmm0
L86:
  mulsd  D25(%rip),%xmm0
  movq   %rbx,%xmm4
  divsd  %xmm0,%xmm4
  movsd  %xmm4,0x78(%rsp)
  lea    0xa8(%rsp),%rdi
  lea    0xa0(%rsp),%rsi
  movsd  0x30(%rsp),%xmm1
  mulsd  0x88(%rsp),%xmm1
  movsd  0x38(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  call   <sincos@plt>
  movsd  0xa0(%rsp),%xmm0
  movsd  0xa8(%rsp),%xmm1
  movsd  0x70(%rsp),%xmm6
  movapd %xmm6,%xmm2
  mulsd  %xmm0,%xmm2
  movsd  0x78(%rsp),%xmm4
  movapd %xmm4,%xmm3
  mulsd  %xmm1,%xmm3
  subsd  %xmm3,%xmm2
  mov    0x40(%rsp),%rax
  movsd  %xmm2,(%rax)
  mulsd  %xmm4,%xmm0
  mulsd  %xmm6,%xmm1
  addsd  %xmm1,%xmm0
  mov    0x48(%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  0x8(%rsp),%xmm0
  mulsd  %xmm0,%xmm0
  divsd  0x18(%rsp),%xmm0
  movsd  0x10(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  divsd  0x20(%rsp),%xmm1
  addsd  %xmm1,%xmm0
  mov    0x50(%rsp),%rax
  movsd  %xmm0,(%rax)
  jmp    L147
L71:
  mov    (%rbx),%rbp
  pxor   %xmm0,%xmm0
  movsd  0x80(%rsp),%xmm4
  ucomisd %xmm4,%xmm0
  ja     L222
  sqrtsd %xmm4,%xmm4
  movapd %xmm4,%xmm0
L235:
  movq   %rbp,%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx)
  mov    0x48(%rsp),%rax
  movq   $0x0,(%rax)
  movsd  (%rbx),%xmm0
  mulsd  %xmm0,%xmm0
  mov    0x50(%rsp),%rax
  movsd  %xmm0,(%rax)
L147:
  add    $0x8,%r13
  addq   $0x8,0x40(%rsp)
  addq   $0x8,0x48(%rsp)
  addq   $0x8,0x50(%rsp)
  cmp    0x68(%rsp),%r13
  je     L186
L104:
  movsd  0x0(%r13),%xmm7
  movsd  %xmm7,0x30(%rsp)
  pxor   %xmm4,%xmm4
  ucomisd %xmm4,%xmm7
  jp     L234
  jne    L234
  mov    0x40(%rsp),%rax
  mov    %rax,%rbx
  movq   $0x0,(%rax)
  cmpl   $0x0,0x5c(%rsp)
  jle    L71
  mov    %r15,%rax
  mov    0x90(%rsp),%rdx
L60:
  movsd  (%rax),%xmm0
  subsd  0x28(%rsp),%xmm0
  addsd  (%rbx),%xmm0
  movsd  %xmm0,(%rbx)
  add    $0x8,%rax
  cmp    %rdx,%rax
  jne    L60
  jmp    L71
L222:
  movsd  0x80(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L235
L77:
  movsd  0x18(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L112
L81:
  movsd  0x20(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L86
L23:
  movsd  0x60(%rsp),%xmm6
  comisd D8(%rip),%xmm6
  jbe    L153
  pxor   %xmm4,%xmm4
  movsd  %xmm4,0x20(%rsp)
  movsd  %xmm4,0x18(%rsp)
  movsd  %xmm4,0x10(%rsp)
  movsd  %xmm4,0x8(%rsp)
  movsd  %xmm4,0x38(%rsp)
  jmp    L89
L153:
  pxor   %xmm6,%xmm6
  movsd  %xmm6,0x20(%rsp)
  movsd  %xmm6,0x18(%rsp)
  movsd  %xmm6,0x38(%rsp)
  movsd  %xmm6,0x10(%rsp)
  movsd  %xmm6,0x8(%rsp)
  jmp    L201
L186:
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: label: D18
datatype: f64
name: disassemble_data
arguments: label: D8
datatype: f64[2]
name: disassemble_data
arguments: label: D25
datatype: byte[8]

tool: D18: 0.5

tool: {"D8": [0.0,1.4142135623730951]}

tool: {"D25": [0xcd,0x3b,0x7f,0x66,0x9e,0xa0,0xf6,0x3f]}

assistant: ```c
void do_ftuneven(int NJD, double *t, double *mag, double ft_sign, double tt_zero, int Nfreq, double *freqvals, double *FT_real, double *FT_imag, double *FT_periodogram) {
  int ii_ww, ii_t;
  double magmean;
  double wrun, csum, ssum, wtau, sumr, sumi, scos2, ssin2, cval, sval;
  double ft_real, ft_imag, phi_this;
  magmean = 0.0;
  for (ii_t = 0; ii_t < NJD; ii_t++) {
    magmean += mag[ii_t];
  }
  magmean = magmean / (double)NJD;
  for (ii_ww = 0; ii_ww < Nfreq; ii_ww++) {
    wrun = freqvals[ii_ww];
    if (wrun == 0.0) {
      FT_real[ii_ww] = 0.0;
      for (ii_t = 0; ii_t < NJD; ii_t++) {
        FT_real[ii_ww] += (mag[ii_t] - magmean);
      }
      FT_real[ii_ww] = FT_real[ii_ww] / sqrt(NJD);
      FT_imag[ii_ww] = 0.0;
      FT_periodogram[ii_ww] = FT_real[ii_ww] * FT_real[ii_ww];
    } else {
      csum = 0.0;
      ssum = 0.0;
      for (ii_t = 0; ii_t < NJD; ii_t++) {
        csum += cos(2.0 * wrun * t[ii_t]);
        ssum += sin(2.0 * wrun * t[ii_t]);
      }
      wtau = 0.5 * atan2(ssum, csum);
      sumr = 0.0;
      sumi = 0.0;
      scos2 = 0.0;
      ssin2 = 0.0;
      for (ii_t = 0; ii_t < NJD; ii_t++) {
        cval = cos(wrun * t[ii_t] - wtau);
        sval = sin(wrun * t[ii_t] - wtau);
        sumr += (mag[ii_t] - magmean) * cval;
        sumi += (mag[ii_t] - magmean) * sval;
        scos2 += cval * cval;
        ssin2 += sval * sval;
      }
      if (ft_sign > 0) {
        sumr = sumr / sqrt(2.0);
        sumi = sumi / sqrt(2.0);
      }
      ft_real = sumr / (sqrt(2.0) * sqrt(scos2));
      ft_imag = ft_sign * sumi / (sqrt(2.0) * sqrt(ssin2));
      phi_this = wtau - wrun * tt_zero;
      FT_real[ii_ww] = ft_real * cos(phi_this) - ft_imag * sin(phi_this);
      FT_imag[ii_ww] = ft_imag * cos(phi_this) + ft_real * sin(phi_this);
      FT_periodogram[ii_ww] = (sumr * sumr / scos2) + (sumi * sumi / ssin2);
    }
  }
}
```