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

```asm
<do_ftuneven_complexinput>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x98,%rsp
  mov    %edi,0x54(%rsp)
  movsd  %xmm0,0x30(%rsp)
  movsd  %xmm1,0x70(%rsp)
  test   %r8d,%r8d
  jle    L103
  mov    %rsi,%rbp
  mov    %rdx,%r13
  mov    %rcx,%r12
  mov    %r9,0x38(%rsp)
  mov    0xd8(%rsp),%r15
  mov    0xd0(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0xe0(%rsp),%rax
  mov    %rax,0x40(%rsp)
  lea    -0x1(%r8),%eax
  lea    0x8(%r9,%rax,8),%rax
  mov    %rax,0x58(%rsp)
  lea    -0x1(%rdi),%r14d
  lea    0x8(%rsi,%r14,8),%rax
  mov    %rax,0x78(%rsp)
  jmp    L1
L101:
  cmpl   $0x0,0x54(%rsp)
  jle    L58
  movsd  0x20(%rsp),%xmm7
  movapd %xmm7,%xmm6
  addsd  %xmm7,%xmm6
  movsd  %xmm6,0x10(%rsp)
  mov    %rbp,%rbx
  pxor   %xmm3,%xmm3
  movsd  %xmm3,0x8(%rsp)
  movsd  %xmm3,(%rsp)
  lea    0x88(%rsp),%rax
  mov    %r15,0x18(%rsp)
  mov    %rbp,0x28(%rsp)
  mov    0x78(%rsp),%rbp
  mov    %rax,%r15
L108:
  lea    0x80(%rsp),%rsi
  movsd  0x10(%rsp),%xmm0
  mulsd  (%rbx),%xmm0
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  (%rsp),%xmm7
  addsd  0x80(%rsp),%xmm7
  movsd  %xmm7,(%rsp)
  movsd  0x8(%rsp),%xmm7
  addsd  0x88(%rsp),%xmm7
  movsd  %xmm7,0x8(%rsp)
  add    $0x8,%rbx
  cmp    %rbx,%rbp
  jne    L108
  mov    0x18(%rsp),%r15
  mov    0x28(%rsp),%rbp
  movsd  (%rsp),%xmm1
  movapd %xmm7,%xmm0
  call   <atan2@plt>
  mulsd  D15(%rip),%xmm0
  movsd  %xmm0,0x28(%rsp)
  mov    $0x0,%ebx
  pxor   %xmm5,%xmm5
  movsd  %xmm5,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  movsd  %xmm5,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  lea    0x88(%rsp),%rax
  mov    %r15,0x60(%rsp)
  mov    %rax,%r15
L154:
  lea    0x80(%rsp),%rsi
  movsd  0x20(%rsp),%xmm0
  mulsd  0x0(%rbp,%rbx,8),%xmm0
  subsd  0x28(%rsp),%xmm0
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  0x80(%rsp),%xmm2
  movsd  0x88(%rsp),%xmm1
  movsd  0x0(%r13,%rbx,8),%xmm0
  movsd  (%r12,%rbx,8),%xmm3
  movapd %xmm0,%xmm4
  mulsd  %xmm2,%xmm4
  movsd  0x30(%rsp),%xmm6
  movapd %xmm6,%xmm5
  mulsd  %xmm3,%xmm5
  mulsd  %xmm1,%xmm5
  subsd  %xmm5,%xmm4
  addsd  (%rsp),%xmm4
  movsd  %xmm4,(%rsp)
  mulsd  %xmm6,%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm3
  addsd  %xmm3,%xmm0
  addsd  0x8(%rsp),%xmm0
  movsd  %xmm0,0x8(%rsp)
  mulsd  %xmm2,%xmm2
  addsd  0x10(%rsp),%xmm2
  movsd  %xmm2,0x10(%rsp)
  mulsd  %xmm1,%xmm1
  addsd  0x18(%rsp),%xmm1
  movsd  %xmm1,0x18(%rsp)
  mov    %rbx,%rax
  add    $0x1,%rbx
  cmp    %r14,%rax
  jne    L154
  mov    0x60(%rsp),%r15
  comisd D47(%rip),%xmm6
  jbe    L65
L34:
  movsd  D24(%rip),%xmm0
  movsd  (%rsp),%xmm6
  divsd  %xmm0,%xmm6
  movsd  %xmm6,(%rsp)
  movsd  0x8(%rsp),%xmm4
  divsd  %xmm0,%xmm4
  movsd  %xmm4,0x8(%rsp)
L65:
  pxor   %xmm0,%xmm0
  ucomisd 0x10(%rsp),%xmm0
  ja     L215
L168:
  movsd  0x10(%rsp),%xmm0
  sqrtsd %xmm0,%xmm0
L147:
  mulsd  D24(%rip),%xmm0
  movsd  (%rsp),%xmm6
  divsd  %xmm0,%xmm6
  movsd  %xmm6,0x60(%rsp)
  pxor   %xmm2,%xmm2
  movsd  0x18(%rsp),%xmm4
  ucomisd %xmm4,%xmm2
  ja     L95
  sqrtsd %xmm4,%xmm4
  movapd %xmm4,%xmm0
L18:
  mulsd  D24(%rip),%xmm0
  movsd  0x8(%rsp),%xmm7
  divsd  %xmm0,%xmm7
  movsd  %xmm7,0x68(%rsp)
  lea    0x88(%rsp),%rdi
  lea    0x80(%rsp),%rsi
  movsd  0x20(%rsp),%xmm6
  mulsd  0x70(%rsp),%xmm6
  movsd  0x28(%rsp),%xmm0
  subsd  %xmm6,%xmm0
  call   <sincos@plt>
  movsd  0x80(%rsp),%xmm0
  movsd  0x88(%rsp),%xmm1
  movsd  0x60(%rsp),%xmm6
  movapd %xmm6,%xmm2
  mulsd  %xmm0,%xmm2
  movsd  0x68(%rsp),%xmm7
  movapd %xmm7,%xmm3
  mulsd  %xmm1,%xmm3
  subsd  %xmm3,%xmm2
  mov    0x48(%rsp),%rax
  movsd  %xmm2,(%rax)
  mulsd  %xmm7,%xmm0
  mulsd  %xmm6,%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r15)
  movsd  (%rsp),%xmm0
  mulsd  %xmm0,%xmm0
  divsd  0x10(%rsp),%xmm0
  movsd  0x8(%rsp),%xmm1
  mulsd  %xmm1,%xmm1
  divsd  0x18(%rsp),%xmm1
  addsd  %xmm1,%xmm0
  mov    0x40(%rsp),%rax
  movsd  %xmm0,(%rax)
  jmp    L94
L217:
  movsd  (%rbx),%xmm2
  movsd  %xmm2,(%rsp)
  pxor   %xmm7,%xmm7
  cvtsi2sdl 0x54(%rsp),%xmm7
  movsd  %xmm7,0x10(%rsp)
  pxor   %xmm0,%xmm0
  ucomisd %xmm7,%xmm0
  ja     L24
  sqrtsd %xmm7,%xmm7
  movapd %xmm7,%xmm1
  divsd  %xmm7,%xmm2
  movsd  %xmm2,(%rbx)
  mov    %r15,0x8(%rsp)
  movsd  (%r15),%xmm2
  movsd  %xmm2,(%rsp)
L75:
  movsd  (%rsp),%xmm0
  divsd  %xmm1,%xmm0
  mov    0x8(%rsp),%rax
  movsd  %xmm0,(%rax)
  movsd  (%rbx),%xmm1
  mulsd  %xmm1,%xmm1
  mulsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  mov    0x40(%rsp),%rax
  movsd  %xmm0,(%rax)
L94:
  addq   $0x8,0x38(%rsp)
  mov    0x38(%rsp),%rax
  add    $0x8,%r15
  addq   $0x8,0x48(%rsp)
  addq   $0x8,0x40(%rsp)
  cmp    0x58(%rsp),%rax
  je     L103
L1:
  mov    0x38(%rsp),%rax
  movsd  (%rax),%xmm3
  movsd  %xmm3,0x20(%rsp)
  pxor   %xmm6,%xmm6
  ucomisd %xmm6,%xmm3
  jp     L101
  jne    L101
  mov    0x48(%rsp),%rax
  mov    %rax,%rbx
  movq   $0x0,(%rax)
  cmpl   $0x0,0x54(%rsp)
  jle    L217
  mov    $0x0,%eax
L149:
  movsd  (%rbx),%xmm0
  addsd  0x0(%r13,%rax,8),%xmm0
  movsd  %xmm0,(%rbx)
  movsd  (%r15),%xmm0
  addsd  (%r12,%rax,8),%xmm0
  movsd  %xmm0,(%r15)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r14,%rdx
  jne    L149
  jmp    L217
L24:
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  movsd  (%rsp),%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx)
  mov    %r15,0x8(%rsp)
  movsd  (%r15),%xmm7
  movsd  %xmm7,(%rsp)
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm1
  jmp    L75
L215:
  movsd  0x10(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L147
L95:
  movsd  0x18(%rsp),%xmm0
  call   <sqrt@plt>
  jmp    L18
L58:
  movsd  0x30(%rsp),%xmm7
  comisd D47(%rip),%xmm7
  jbe    L131
  pxor   %xmm5,%xmm5
  movsd  %xmm5,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  movsd  %xmm5,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  movsd  %xmm5,0x28(%rsp)
  jmp    L34
L131:
  pxor   %xmm2,%xmm2
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm2,0x28(%rsp)
  movsd  %xmm2,0x8(%rsp)
  movsd  %xmm2,(%rsp)
  jmp    L168
L103:
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: read_data
arguments: data_label: D15
type_infered: f64
name: read_data
arguments: data_label: D47
type_infered: f64[2]
name: read_data
arguments: data_label: D24
type_infered: byte[8]

tool: D15: 0.5

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

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

assistant: ```c
void do_ftuneven_complexinput(int NJD, double *t, double *input_real, double *input_imag, 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;
  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] += input_real[ii_t];
        FT_imag[ii_ww] += input_imag[ii_t];
      }
      FT_real[ii_ww] = FT_real[ii_ww] / sqrt(NJD);
      FT_imag[ii_ww] = FT_imag[ii_ww] / sqrt(NJD);
      FT_periodogram[ii_ww] = FT_real[ii_ww] * FT_real[ii_ww] + FT_imag[ii_ww] * FT_imag[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 += input_real[ii_t] * cval - ft_sign * input_imag[ii_t] * sval;
        sumi += ft_sign * input_real[ii_t] * sval + input_imag[ii_t] * cval;
        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 = 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);
    }
  }
}
```