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

```asm
<GCI_Phasor>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  movss  %xmm0,0x18(%rsp)
  mov    %esi,%eax
  mov    %esi,0x20(%rsp)
  mov    %edx,0x24(%rsp)
  mov    %r8,0x28(%rsp)
  mov    %r9,0x30(%rsp)
  mov    0xa0(%rsp),%r14
  movslq %esi,%rbp
  lea    0x0(,%rbp,4),%rsi
  mov    %rsi,0x38(%rsp)
  sub    %eax,%edx
  movss  (%rcx),%xmm2
  movss  %xmm2,0x4(%rsp)
  add    %rdi,%rsi
  je     L111
  movaps %xmm0,%xmm7
  mov    %rdi,%r15
  mov    %edx,%r12d
  mov    %rsi,%r13
  test   %edx,%edx
  js     L235
  pxor   %xmm0,%xmm0
  cvtsi2ss %edx,%xmm0
  movss  D23(%rip),%xmm1
  divss  %xmm0,%xmm1
  movss  %xmm1,0x8(%rsp)
  mulss  %xmm7,%xmm0
  call   <setPhasorPeriod@plt>
  test   %r12d,%r12d
  jle    L9
  mov    %r13,%rax
  lea    -0x1(%r12),%edx
  lea    0x4(%r13,%rdx,4),%rdx
  pxor   %xmm2,%xmm2
  movss  %xmm2,0x10(%rsp)
L126:
  movss  (%rax),%xmm0
  subss  0x4(%rsp),%xmm0
  addss  0x10(%rsp),%xmm0
  movss  %xmm0,0x10(%rsp)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L126
  mov    %r12d,%r12d
  mov    $0x0,%ebx
  pxor   %xmm7,%xmm7
  movss  %xmm7,0x14(%rsp)
L125:
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  addss  D2(%rip),%xmm0
  mulss  0x8(%rsp),%xmm0
  call   <cosf@plt>
  movaps %xmm0,%xmm1
  movss  0x0(%r13,%rbx,4),%xmm0
  subss  0x4(%rsp),%xmm0
  mulss  %xmm1,%xmm0
  addss  0x14(%rsp),%xmm0
  movss  %xmm0,0x14(%rsp)
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L125
  movss  0x14(%rsp),%xmm7
  divss  0x10(%rsp),%xmm7
  movss  %xmm7,0x1c(%rsp)
  mov    $0x0,%ebx
  pxor   %xmm5,%xmm5
  movss  %xmm5,0x14(%rsp)
L120:
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  addss  D2(%rip),%xmm0
  mulss  0x8(%rsp),%xmm0
  call   <sinf@plt>
  movaps %xmm0,%xmm1
  movss  0x0(%r13,%rbx,4),%xmm0
  subss  0x4(%rsp),%xmm0
  mulss  %xmm1,%xmm0
  addss  0x14(%rsp),%xmm0
  movss  %xmm0,0x14(%rsp)
  add    $0x1,%rbx
  cmp    %r12,%rbx
  jne    L120
L136:
  movss  0x14(%rsp),%xmm2
  divss  0x10(%rsp),%xmm2
  movd   %xmm2,%ebx
  movss  0x18(%rsp),%xmm6
  divss  0x8(%rsp),%xmm6
  movss  %xmm6,0x8(%rsp)
  movaps %xmm2,%xmm0
  movss  0x1c(%rsp),%xmm4
  divss  %xmm4,%xmm0
  mulss  %xmm6,%xmm0
  mov    0x80(%rsp),%rax
  movss  %xmm0,(%rax)
  movaps %xmm2,%xmm0
  mulss  %xmm2,%xmm0
  movaps %xmm4,%xmm1
  mulss  %xmm4,%xmm1
  addss  %xmm0,%xmm1
  movss  D33(%rip),%xmm2
  movaps %xmm2,%xmm0
  divss  %xmm1,%xmm0
  subss  %xmm2,%xmm0
  pxor   %xmm1,%xmm1
  ucomiss %xmm0,%xmm1
  ja     L116
  sqrtss %xmm0,%xmm0
L85:
  mulss  0x8(%rsp),%xmm0
  mov    0x88(%rsp),%rax
  movss  %xmm0,(%rax)
  mov    0x80(%rsp),%rax
  addss  (%rax),%xmm0
  mulss  D2(%rip),%xmm0
  mov    0x90(%rsp),%rax
  movss  %xmm0,(%rax)
  mov    0x28(%rsp),%rax
  movss  0x1c(%rsp),%xmm3
  movss  %xmm3,(%rax)
  mov    0x30(%rsp),%rax
  mov    %ebx,(%rax)
  mov    $0x0,%eax
  cmpq   $0x0,0x98(%rsp)
  je     L19
  mov    0x24(%rsp),%r13d
  movslq %r13d,%rbx
  shl    $0x2,%rbx
  mov    %rbx,%rdx
  mov    $0x0,%esi
  mov    0x98(%rsp),%rdi
  call   <memset@plt>
  mov    %rbx,%rdx
  mov    $0x0,%esi
  mov    %r14,%rdi
  call   <memset@plt>
  mov    0x20(%rsp),%eax
  cmp    %r13d,%eax
  jge    L56
  sub    %r13d,%eax
  mov    %eax,%r13d
  mov    $0x0,%ebx
  pxor   %xmm3,%xmm3
  movss  %xmm3,0x8(%rsp)
  mov    0x90(%rsp),%r12
L134:
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  mulss  0x18(%rsp),%xmm0
  divss  (%r12),%xmm0
  call   <expf@plt>
  addss  0x8(%rsp),%xmm0
  movss  %xmm0,0x8(%rsp)
  sub    $0x1,%ebx
  cmp    %ebx,%r13d
  jne    L134
  movss  0x10(%rsp),%xmm4
  divss  0x8(%rsp),%xmm4
  movss  %xmm4,0x10(%rsp)
  mov    0x38(%rsp),%r12
  add    0x98(%rsp),%r12
  mov    $0x0,%ebx
  mov    %rbp,0x8(%rsp)
  mov    0x90(%rsp),%rbp
L5:
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  mulss  0x18(%rsp),%xmm0
  divss  0x0(%rbp),%xmm0
  call   <expf@plt>
  mulss  0x10(%rsp),%xmm0
  addss  0x4(%rsp),%xmm0
  movss  %xmm0,(%r12)
  sub    $0x1,%ebx
  add    $0x4,%r12
  cmp    %r13d,%ebx
  jne    L5
  mov    0x8(%rsp),%rbp
L56:
  mov    $0x0,%eax
  mov    %r14,%rdi
  or     0xa8(%rsp),%rdi
  je     L19
  mov    0x20(%rsp),%eax
  test   %eax,%eax
  jle    L217
  mov    %eax,%edx
  mov    $0x0,%eax
  mov    0x98(%rsp),%rcx
  jmp    L157
L116:
  call   <sqrtf@plt>
  jmp    L85
L82:
  add    $0x1,%rax
  cmp    %rax,%rdx
  je     L217
L157:
  test   %r14,%r14
  je     L82
  movss  (%r15,%rax,4),%xmm0
  subss  (%rcx,%rax,4),%xmm0
  movss  %xmm0,(%r14,%rax,4)
  jmp    L82
L217:
  mov    0x24(%rsp),%edx
  cmp    %edx,0x20(%rsp)
  jge    L226
  pxor   %xmm2,%xmm2
  movss  D33(%rip),%xmm4
  movaps %xmm4,%xmm5
  mov    0x98(%rsp),%rax
  jmp    L107
L173:
  mulss  %xmm0,%xmm0
  mulss  %xmm3,%xmm0
  addss  %xmm0,%xmm2
  add    $0x1,%rbp
  cmp    %ebp,%edx
  jle    L101
L107:
  movss  (%r15,%rbp,4),%xmm0
  subss  (%rax,%rbp,4),%xmm0
  test   %r14,%r14
  je     L78
  movss  %xmm0,(%r14,%rbp,4)
L78:
  movss  (%rax,%rbp,4),%xmm1
  movss  D33(%rip),%xmm3
  comiss %xmm4,%xmm1
  jbe    L173
  movaps %xmm5,%xmm3
  divss  %xmm1,%xmm3
  jmp    L173
L226:
  pxor   %xmm2,%xmm2
L101:
  mov    $0x0,%eax
  cmpq   $0x0,0xa8(%rsp)
  je     L19
  mov    0xa8(%rsp),%rax
  movss  %xmm2,(%rax)
  mov    $0x0,%eax
L19:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L111:
  mov    $0xffffffff,%eax
  jmp    L19
L235:
  mov    $0xfffffffe,%eax
  jmp    L19
L9:
  pxor   %xmm0,%xmm0
  movaps %xmm0,%xmm4
  divss  %xmm0,%xmm4
  movss  %xmm4,0x1c(%rsp)
  movss  %xmm0,0x10(%rsp)
  movss  %xmm0,0x14(%rsp)
  jmp    L136
```

tool_calls: name: unpack_data
arguments: tag: D23
datatype: byte[4]
name: unpack_data
arguments: tag: D2
datatype: byte[4]
name: unpack_data
arguments: tag: D33
datatype: byte[4]

tool: {"D23": [0xdb,0x0f,0xc9,0x40]}

tool: {"D2": [0x00,0x00,0x00,0x3f]}

tool: {"D33": [0x00,0x00,0x80,0x3f]}

assistant: ```c
int GCI_Phasor(float xincr, float y[], int fit_start, int fit_end, float *Z, float *U, float *V, float *taup, float *taum, float *tau, float *fitted, float *residuals, float *chisq) {
  int i, ret = 0, nBins;
  float *data, u, v, A, w, I, Ifit, bg, chisq_local, res, sigma2;
  data = &(y[fit_start]);
  nBins = (fit_end - fit_start);
  bg = *Z;
  if (!data)
    return (-1);
  if (nBins < 0)
    return (-2);
  w = 2.0f * 3.1415926535897932384626433832795028841971f / (float)nBins;
  setPhasorPeriod((float)nBins * xincr);
  for (i = 0, I = 0.0f; i < nBins; i++)
    I += (data[i] - bg);
  for (i = 0, u = 0.0f; i < nBins; i++)
    u += (data[i] - bg) * cosf(w * ((float)i + 0.5f));
  u /= I;
  for (i = 0, v = 0.0f; i < nBins; i++)
    v += (data[i] - bg) * sinf(w * ((float)i + 0.5f));
  v /= I;
  *taup = (xincr / w) * (v / u);
  *taum = (xincr / w) * sqrtf(1.0f / (u * u + v * v) - 1.0f);
  *tau = ((*taup) + (*taum)) / 2.0f;
  *U = u;
  *V = v;
  if (fitted == 0)
    return 0;
  memset(fitted, 0, (size_t)fit_end * sizeof(float));
  memset(residuals, 0, (size_t)fit_end * sizeof(float));
  for (Ifit = 0.0f, i = fit_start; i < fit_end; i++)
    Ifit += expf((float)(-(i - fit_start)) * xincr / (*tau));
  A = I / Ifit;
  for (i = fit_start; i < fit_end; i++) {
    fitted[i] = bg + A * expf((float)(-(i - fit_start)) * xincr / (*tau));
  }
  if (residuals == 0 && chisq == 0)
    return 0;
  chisq_local = 0.0f;
  for (i = 0; i < fit_start; i++) {
    res = y[i] - fitted[i];
    if (residuals != 0)
      residuals[i] = res;
  }
  for (i = fit_start; i < fit_end; i++) {
    res = y[i] - fitted[i];
    if (residuals != 0)
      residuals[i] = res;
    sigma2 = (fitted[i] > 1 ? 1.0f / fitted[i] : 1.0f);
    chisq_local += res * res * sigma2;
  }
  if (chisq != 0)
    *chisq = chisq_local;
  return (ret);
}
```