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

```asm
<testFreq2>:
  endbr64
  push   %r13
  pxor   %xmm4,%xmm4
  push   %r12
  mov    %edx,%r12d
  push   %rbp
  mov    %rsi,%rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x28,%rsp
  comisd %xmm4,%xmm0
  jbe    L198
  pxor   %xmm2,%xmm2
  movapd %xmm0,%xmm6
  mov    %edx,%edi
  mov    $0x1,%esi
  cvtsi2sd %ecx,%xmm2
  movsd  D36(%rip),%xmm3
  movsd  D19(%rip),%xmm1
  movsd  %xmm0,0x8(%rsp)
  addsd  %xmm3,%xmm6
  mulsd  %xmm3,%xmm2
  movsd  %xmm6,0x10(%rsp)
  divsd  %xmm2,%xmm1
  movapd %xmm3,%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,(%rsp)
  movsd  %xmm1,0x18(%rsp)
  call   <calloc@plt>
  movsd  0x8(%rsp),%xmm0
  xor    %edi,%edi
  mov    %rax,%r13
  mov    D36(%rip),%rax
  movq   %rax,%xmm3
  comisd %xmm0,%xmm3
  setae  %dil
  call   <assert@plt>
  movsd  (%rsp),%xmm2
  movsd  0x10(%rsp),%xmm6
  comisd %xmm2,%xmm6
  movsd  %xmm2,0x8(%rsp)
  movsd  %xmm6,(%rsp)
  seta   %dil
  movzbl %dil,%edi
  call   <assert@plt>
  pxor   %xmm4,%xmm4
  xor    %edi,%edi
  movsd  (%rsp),%xmm6
  movsd  0x8(%rsp),%xmm2
  movsd  0x18(%rsp),%xmm1
  comisd %xmm4,%xmm2
  jb     L85
  movsd  D19(%rip),%xmm7
  xor    %edi,%edi
  comisd %xmm6,%xmm7
  setae  %dil
L85:
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm6,0x8(%rsp)
  movsd  %xmm1,(%rsp)
  call   <assert@plt>
  test   %r12d,%r12d
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm6
  movsd  0x10(%rsp),%xmm2
  pxor   %xmm4,%xmm4
  jle    L338
  lea    0xf(%rbx),%rax
  sub    %rbp,%rax
  cmp    $0x1e,%rax
  jbe    L258
  cmp    $0x1,%r12d
  je     L258
  mov    %r12d,%edx
  movapd %xmm1,%xmm3
  xor    %eax,%eax
  shr    %edx
  unpcklpd %xmm3,%xmm3
  shl    $0x4,%rdx
  nopl   0x0(%rax)
L364:
  movupd (%rbx,%rax,1),%xmm0
  mulpd  %xmm3,%xmm0
  movups %xmm0,(%rbx,%rax,1)
  movupd 0x0(%rbp,%rax,1),%xmm0
  mulpd  %xmm3,%xmm0
  movups %xmm0,0x0(%rbp,%rax,1)
  add    $0x10,%rax
  cmp    %rdx,%rax
  jne    L364
  mov    %r12d,%eax
  movslq %r12d,%rcx
  and    $0xfffffffe,%eax
  and    $0x1,%r12d
  je     L103
  shl    $0x3,%rax
  lea    (%rbx,%rax,1),%rdx
  add    %rbp,%rax
  movsd  (%rdx),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rdx)
  mulsd  (%rax),%xmm1
  movsd  %xmm1,(%rax)
L103:
  mov    %r13,%rsi
  mov    %r13,%rdx
  add    %r13,%rcx
  mov    %r13,%rax
  neg    %rsi
  movapd %xmm4,%xmm3
  movapd %xmm4,%xmm5
  shl    $0x3,%rsi
  add    %rsi,%rbx
  add    %rbp,%rsi
  xor    %ebp,%ebp
  jmp    L226
L335:
  comisd %xmm0,%xmm6
  jb     L316
L37:
  addsd  %xmm0,%xmm5
  addsd  %xmm1,%xmm3
  movb   $0x1,(%rax)
  add    $0x1,%ebp
L265:
  add    $0x1,%rax
  cmp    %rcx,%rax
  je     L384
L226:
  movsd  (%rbx,%rax,8),%xmm0
  movsd  (%rsi,%rax,8),%xmm1
  comisd %xmm2,%xmm0
  jae    L335
L316:
  comisd %xmm2,%xmm1
  jb     L265
  comisd %xmm1,%xmm6
  jae    L37
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L226
  nopw   0x0(%rax,%rax,1)
L384:
  test   %ebp,%ebp
  je     L338
  pxor   %xmm0,%xmm0
  xor    %r12d,%r12d
  movapd %xmm4,%xmm7
  cvtsi2sd %ebp,%xmm0
  divsd  %xmm0,%xmm5
  divsd  %xmm0,%xmm3
  movapd %xmm4,%xmm0
  movapd %xmm5,%xmm6
  movapd %xmm4,%xmm5
  nopl   0x0(%rax,%rax,1)
L239:
  cmpb   $0x0,(%rdx)
  je     L140
  movsd  (%rbx,%rdx,8),%xmm2
  movsd  (%rsi,%rdx,8),%xmm1
  add    $0x1,%r12d
  subsd  %xmm6,%xmm2
  subsd  %xmm3,%xmm1
  movapd %xmm2,%xmm8
  mulsd  %xmm1,%xmm8
  mulsd  %xmm2,%xmm2
  mulsd  %xmm1,%xmm1
  addsd  %xmm8,%xmm5
  addsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm7
L140:
  add    $0x1,%rdx
  cmp    %rdx,%rcx
  jne    L239
  mov    %r13,%rdi
  movsd  %xmm7,0x10(%rsp)
  movsd  %xmm0,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  call   <free@plt>
  xor    %edi,%edi
  cmp    %r12d,%ebp
  sete   %dil
  call   <assert@plt>
  movsd  0x8(%rsp),%xmm0
  pxor   %xmm4,%xmm4
  movsd  (%rsp),%xmm5
  movsd  0x10(%rsp),%xmm7
  ucomisd %xmm0,%xmm4
  ja     L21
  movapd %xmm0,%xmm1
  sqrtsd %xmm1,%xmm1
L62:
  ucomisd %xmm7,%xmm4
  ja     L187
  sqrtsd %xmm7,%xmm7
L137:
  mulsd  %xmm7,%xmm1
  divsd  %xmm1,%xmm5
L111:
  movapd %xmm5,%xmm0
  movsd  %xmm5,(%rsp)
  call   <isnan@plt>
  movsd  (%rsp),%xmm5
  test   %rax,%rax
  jne    L107
  add    $0x28,%rsp
  movapd %xmm5,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopw   0x0(%rax,%rax,1)
L198:
  movapd %xmm4,%xmm6
  movapd %xmm4,%xmm7
  movapd %xmm4,%xmm5
  test   %edx,%edx
  jle    L248
  cmp    $0x1,%edx
  je     L8
  shr    %edx
  movapd %xmm4,%xmm0
  movapd %xmm4,%xmm1
  xor    %eax,%eax
  shl    $0x4,%rdx
  nopl   (%rax)
L329:
  movsd  (%rbx,%rax,1),%xmm2
  addsd  %xmm2,%xmm1
  movsd  0x8(%rbx,%rax,1),%xmm2
  addsd  %xmm2,%xmm1
  movsd  0x0(%rbp,%rax,1),%xmm2
  addsd  %xmm2,%xmm0
  movsd  0x8(%rbp,%rax,1),%xmm2
  add    $0x10,%rax
  addsd  %xmm2,%xmm0
  cmp    %rdx,%rax
  jne    L329
  mov    %r12d,%eax
  and    $0xfffffffe,%eax
  cmp    %eax,%r12d
  je     L195
L252:
  pxor   %xmm2,%xmm2
  cltq
  cvtsi2sd %r12d,%xmm2
  addsd  (%rbx,%rax,8),%xmm1
  addsd  0x0(%rbp,%rax,8),%xmm0
  divsd  %xmm2,%xmm1
  movapd %xmm0,%xmm3
  divsd  %xmm2,%xmm3
  movapd %xmm1,%xmm8
  cmp    $0x1,%r12d
  je     L194
L321:
  mov    %r12d,%edx
  movapd %xmm8,%xmm10
  movapd %xmm3,%xmm9
  xor    %eax,%eax
  unpcklpd %xmm10,%xmm10
  shr    %edx
  unpcklpd %xmm9,%xmm9
  movapd %xmm4,%xmm6
  shl    $0x4,%rdx
  movapd %xmm4,%xmm7
  movapd %xmm4,%xmm5
  nopl   0x0(%rax,%rax,1)
L120:
  movupd (%rbx,%rax,1),%xmm2
  movupd 0x0(%rbp,%rax,1),%xmm1
  add    $0x10,%rax
  subpd  %xmm10,%xmm2
  subpd  %xmm9,%xmm1
  movapd %xmm2,%xmm0
  mulpd  %xmm1,%xmm0
  mulpd  %xmm2,%xmm2
  mulpd  %xmm1,%xmm1
  addsd  %xmm0,%xmm5
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm5
  movapd %xmm2,%xmm0
  unpckhpd %xmm2,%xmm2
  addsd  %xmm7,%xmm0
  movapd %xmm2,%xmm7
  addsd  %xmm0,%xmm7
  movapd %xmm1,%xmm0
  unpckhpd %xmm1,%xmm1
  addsd  %xmm6,%xmm0
  movapd %xmm1,%xmm6
  addsd  %xmm0,%xmm6
  cmp    %rax,%rdx
  jne    L120
  mov    %r12d,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%r12d
  je     L29
L121:
  cltq
  movsd  0x0(%rbp,%rax,8),%xmm0
  movsd  (%rbx,%rax,8),%xmm2
  subsd  %xmm3,%xmm0
  subsd  %xmm8,%xmm2
  movapd %xmm0,%xmm1
  mulsd  %xmm2,%xmm1
  mulsd  %xmm0,%xmm0
  mulsd  %xmm2,%xmm2
  addsd  %xmm1,%xmm5
  addsd  %xmm0,%xmm6
  addsd  %xmm2,%xmm7
L29:
  ucomisd %xmm7,%xmm4
  ja     L339
L248:
  sqrtsd %xmm7,%xmm7
L35:
  ucomisd %xmm6,%xmm4
  ja     L108
  sqrtsd %xmm6,%xmm6
L18:
  mulsd  %xmm6,%xmm7
  divsd  %xmm7,%xmm5
  jmp    L111
  nopl   0x0(%rax)
L194:
  movapd %xmm4,%xmm6
  movapd %xmm4,%xmm7
  movapd %xmm4,%xmm5
  xor    %eax,%eax
  jmp    L121
L338:
  add    $0x28,%rsp
  movapd %xmm4,%xmm5
  pop    %rbx
  movapd %xmm5,%xmm0
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax,%rax,1)
L107:
  lea    D8(%rip),%rdi
  call   <printf@plt>
  xor    %edi,%edi
  call   <assert@plt>
  movsd  (%rsp),%xmm5
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  movapd %xmm5,%xmm0
  pop    %r12
  pop    %r13
  ret
  nop
L258:
  movslq %r12d,%rcx
  xor    %eax,%eax
  nopl   (%rax)
L153:
  movsd  (%rbx,%rax,8),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx,%rax,8)
  movsd  0x0(%rbp,%rax,8),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L153
  jmp    L103
  nopl   0x0(%rax)
L195:
  pxor   %xmm2,%xmm2
  movapd %xmm0,%xmm3
  cvtsi2sd %r12d,%xmm2
  divsd  %xmm2,%xmm1
  divsd  %xmm2,%xmm3
  movapd %xmm1,%xmm8
  jmp    L321
L8:
  movapd %xmm4,%xmm0
  movapd %xmm4,%xmm1
  xor    %eax,%eax
  jmp    L252
L21:
  movsd  %xmm7,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm7
  movsd  (%rsp),%xmm5
  pxor   %xmm4,%xmm4
  movapd %xmm0,%xmm1
  jmp    L62
L187:
  movapd %xmm7,%xmm0
  movsd  %xmm5,0x8(%rsp)
  movsd  %xmm1,(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm5
  movsd  (%rsp),%xmm1
  movapd %xmm0,%xmm7
  jmp    L137
L339:
  movapd %xmm7,%xmm0
  movsd  %xmm6,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm6
  movsd  (%rsp),%xmm5
  pxor   %xmm4,%xmm4
  movapd %xmm0,%xmm7
  jmp    L35
L108:
  movapd %xmm6,%xmm0
  movsd  %xmm7,0x8(%rsp)
  movsd  %xmm5,(%rsp)
  call   <sqrt@plt>
  movsd  0x8(%rsp),%xmm7
  movsd  (%rsp),%xmm5
  movapd %xmm0,%xmm6
  jmp    L18
```

tool_calls: name: read_data
arguments: label: D36
data_type: f64
name: read_data
arguments: label: D19
data_type: f64
name: read_data
arguments: label: D8
data_type: string

tool: D36: 0.5

tool: D19: 1

tool: D8: Numerical Error pearson correlation is not a number


assistant: ```c
double testFreq2(double *vect1, double *vect2, int n, int reps, double bootstopCutoff) {
  int i;
  double sum_xy = 0.0, sum_x = 0.0, sum_y = 0.0, corr = 0.0;
  double av1 = 0.0, av2 = 0.0;
  if (bootstopCutoff > 0.0) {
    const double scale = 1.0 / ((double)reps * 0.5);
    const double upper_bound = 0.5 + bootstopCutoff;
    const double lower_bound = 0.5 - bootstopCutoff;
    int count = 0, verify = 0;
    char *isSet = (char *)calloc(n, sizeof(char));
    assert(bootstopCutoff > 0.0 && bootstopCutoff <= 0.5);
    assert(lower_bound < upper_bound);
    assert(lower_bound >= 0.0 && upper_bound <= 1.0);
    for (i = 0; i < n; i++) {
      vect1[i] *= scale;
      vect2[i] *= scale;
    }
    for (i = 0; i < n; i++) {
      if ((vect1[i] >= lower_bound && vect1[i] <= upper_bound) || (vect2[i] >= lower_bound && vect2[i] <= upper_bound)) {
        av1 += vect1[i];
        av2 += vect2[i];
        isSet[i] = 1;
        count++;
      }
    }
    if (count == 0) {
      return 0.0;
    }
    av1 /= ((double)count);
    av2 /= ((double)count);
    for (i = 0; i < n; i++) {
      if (isSet[i]) {
        sum_xy += ((vect1[i] - av1) * (vect2[i] - av2));
        sum_x += ((vect1[i] - av1) * (vect1[i] - av1));
        sum_y += ((vect2[i] - av2) * (vect2[i] - av2));
        verify++;
      }
    }
    free(isSet);
    assert(verify == count);
    corr = sum_xy / (sqrt(sum_x) * sqrt(sum_y));
    if (isnan(corr)) {
      printf("Numerical Error pearson correlation is not a number\n");
      assert(0);
    }
    return corr;
  } else {
    for (i = 0; i < n; i++) {
      av1 += vect1[i];
      av2 += vect2[i];
    }
    av1 /= ((double)n);
    av2 /= ((double)n);
    for (i = 0; i < n; i++) {
      sum_xy += ((vect1[i] - av1) * (vect2[i] - av2));
      sum_x += ((vect1[i] - av1) * (vect1[i] - av1));
      sum_y += ((vect2[i] - av2) * (vect2[i] - av2));
    }
    corr = sum_xy / (sqrt(sum_x) * sqrt(sum_y));
    if (isnan(corr)) {
      printf("Numerical Error pearson correlation is not a number\n");
      assert(0);
    }
    return corr;
  }
}
```