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

```asm
<fit_cornu_half>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm6
  mov    %rdx,%r15
  push   %r14
  addsd  %xmm1,%xmm6
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x88,%rsp
  mov    %rdi,0x40(%rsp)
  mov    %rsi,0x48(%rsp)
  mov    %rcx,0x38(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x78(%rsp)
  xor    %eax,%eax
  movsd  %xmm0,0x28(%rsp)
  movapd %xmm6,%xmm0
  movsd  %xmm1,(%rsp)
  movsd  %xmm6,0x30(%rsp)
  call   <fabs@plt>
  movsd  (%rsp),%xmm1
  test   %eax,%eax
  jg     L0
  movsd  D47(%rip),%xmm0
  movsd  0x28(%rsp),%xmm6
  addsd  %xmm0,%xmm1
  addsd  %xmm0,%xmm6
  movsd  %xmm6,0x28(%rsp)
  addsd  %xmm1,%xmm6
  movsd  %xmm6,0x30(%rsp)
L0:
  subsd  0x28(%rsp),%xmm1
  pxor   %xmm0,%xmm0
  movsd  0x30(%rsp),%xmm2
  mulsd  D14(%rip),%xmm2
  ucomisd %xmm1,%xmm0
  ja     L61
  sqrtsd %xmm1,%xmm1
L22:
  divsd  %xmm1,%xmm2
  mov    $0x15,%ebx
  lea    0x60(%rsp),%r14
  movsd  D3(%rip),%xmm7
  lea    0x58(%rsp),%r13
  lea    0x70(%rsp),%r12
  lea    0x68(%rsp),%rbp
  mulsd  %xmm2,%xmm7
  movapd %xmm2,%xmm0
  addsd  %xmm2,%xmm0
  movsd  %xmm0,0x18(%rsp)
  movsd  %xmm7,0x20(%rsp)
  jmp    L10
  nopl   (%rax)
L107:
  movsd  %xmm2,0x18(%rsp)
  sub    $0x1,%ebx
  je     L28
L10:
  movsd  0x20(%rsp),%xmm2
  addsd  0x18(%rsp),%xmm2
  mov    %r14,%rsi
  mov    %r13,%rdi
  mulsd  D22(%rip),%xmm2
  movsd  D17(%rip),%xmm1
  movsd  0x30(%rsp),%xmm0
  mulsd  %xmm2,%xmm1
  movapd %xmm2,%xmm3
  movsd  %xmm2,0x10(%rsp)
  divsd  %xmm1,%xmm0
  subsd  %xmm0,%xmm3
  addsd  %xmm2,%xmm0
  movsd  %xmm0,(%rsp)
  movapd %xmm3,%xmm0
  movsd  %xmm3,0x8(%rsp)
  call   <eval_cornu@plt>
  movsd  (%rsp),%xmm0
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <eval_cornu@plt>
  movsd  0x68(%rsp),%xmm0
  movsd  0x70(%rsp),%xmm1
  subsd  0x58(%rsp),%xmm0
  subsd  0x60(%rsp),%xmm1
  call   <atan2@plt>
  movsd  0x8(%rsp),%xmm3
  movapd %xmm3,%xmm1
  mulsd  %xmm3,%xmm1
  subsd  %xmm1,%xmm0
  subsd  0x28(%rsp),%xmm0
  call   <mod_2pi@plt>
  movsd  0x8(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm2
  test   %rax,%rax
  jns    L107
  movsd  %xmm2,0x20(%rsp)
  sub    $0x1,%ebx
  jne    L10
L28:
  mov    0x40(%rsp),%rax
  movsd  (%rsp),%xmm7
  movsd  %xmm3,(%rax)
  mov    0x48(%rsp),%rax
  movsd  %xmm7,(%rax)
  mov    0x38(%rsp),%rax
  or     %r15,%rax
  jne    L81
L96:
  mov    0x78(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L52
  add    $0x88,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L81:
  movsd  0x68(%rsp),%xmm0
  movsd  0x70(%rsp),%xmm1
  movsd  %xmm3,0x8(%rsp)
  subsd  0x58(%rsp),%xmm0
  subsd  0x60(%rsp),%xmm1
  call   <hypot@plt>
  test   %r15,%r15
  movsd  0x8(%rsp),%xmm3
  je     L13
  mulsd  %xmm0,%xmm3
  cmpq   $0x0,0x38(%rsp)
  movsd  %xmm3,(%r15)
  je     L96
L13:
  mulsd  (%rsp),%xmm0
  mov    0x38(%rsp),%rax
  movsd  %xmm0,(%rax)
  jmp    L96
L61:
  movapd %xmm1,%xmm0
  movsd  %xmm2,(%rsp)
  call   <sqrt@plt>
  movsd  (%rsp),%xmm2
  movapd %xmm0,%xmm1
  jmp    L22
L52:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_label: D47
type_infered: byte[8]
name: extract_symbolic_data
arguments: data_label: D14
type_infered: f64
name: extract_symbolic_data
arguments: data_label: D3
type_infered: byte[8]
name: extract_symbolic_data
arguments: data_label: D22
type_infered: byte[8]
name: extract_symbolic_data
arguments: data_label: D17
type_infered: byte[8]

tool: {"D47": [0x8d,0xed,0xb5,0xa0,0xf7,0xc6,0xb0,0x3e]}

tool: D14: 0.29112

tool: {"D3": [0xcd,0xcc,0xcc,0xcc,0xcc,0xcc,0xec,0x3f]}

tool: {"D22": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D17": [0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x40]}

assistant: ```c
void fit_cornu_half(double th0, double th1, double *pt0, double *pt1, double *pk0, double *pk1) {
  int i;
  const int max_iter = 21;
  double t0, t1, t_m;
  double tl, tr, t_est;
  double s0, c0, s1, c1;
  if (fabs(th0 + th1) < 1e-6) {
    th0 += 1e-6;
    th1 += 1e-6;
  }
  t_est = 0.29112 * (th1 + th0) / sqrt(th1 - th0);
  tl = t_est * .9;
  tr = t_est * 2;
  for (i = 0; i < max_iter; i++) {
    double dt;
    double chord_th;
    t_m = .5 * (tl + tr);
    dt = (th0 + th1) / (4 * t_m);
    t0 = t_m - dt;
    t1 = t_m + dt;
    eval_cornu(t0, &s0, &c0);
    eval_cornu(t1, &s1, &c1);
    chord_th = atan2(s1 - s0, c1 - c0);
    if (mod_2pi(chord_th - t0 * t0 - th0) < 0)
      tl = t_m;
    else
      tr = t_m;
  }
  *pt0 = t0;
  *pt1 = t1;
  if (pk0 || pk1) {
    double chordlen = hypot(s1 - s0, c1 - c0);
    if (pk0)
      *pk0 = t0 * chordlen;
    if (pk1)
      *pk1 = t1 * chordlen;
  }
}
```