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

```asm
<normalize>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %edi,0x1c(%rsp)
  test   %edi,%edi
  jle    L4
  mov    %rdx,%r14
  mov    %rcx,%r15
  mov    %r8,%r13
  mov    %r9,%r12
  mov    %rdx,%rbx
  mov    $0x0,%ebp
  jmp    L66
L111:
  add    $0x1,%ebp
L66:
  mov    %rbx,0x8(%rsp)
  movsd  (%rbx),%xmm0
  call   <isnan@plt>
  add    $0x8,%rbx
  test   %rax,%rax
  jne    L111
  mov    0x8(%rsp),%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,0x0(%r13)
  lea    0x1(%rbp),%eax
  mov    0x1c(%rsp),%esi
  cmp    %eax,%esi
  jle    L45
  cltq
  lea    (%r14,%rax,8),%rbx
  lea    -0x2(%rsi),%eax
  sub    %ebp,%eax
  movslq %ebp,%rbp
  add    %rbp,%rax
  lea    0x10(%r14,%rax,8),%rax
  mov    %rax,(%rsp)
  mov    %rbx,%rbp
  movl   $0x1,0x10(%rsp)
  jmp    L5
L114:
  add    $0x8,%rbp
  cmp    (%rsp),%rbp
  je     L59
L5:
  movsd  0x0(%rbp),%xmm0
  call   <isnan@plt>
  test   %rax,%rax
  jne    L114
  movsd  0x0(%r13),%xmm0
  addsd  0x0(%rbp),%xmm0
  movsd  %xmm0,0x0(%r13)
  addl   $0x1,0x10(%rsp)
  jmp    L114
L115:
  add    $0x8,%rbx
  cmp    (%rsp),%rbx
  je     L64
L69:
  movsd  (%rbx),%xmm0
  call   <isnan@plt>
  test   %rax,%rax
  jne    L115
  movsd  (%rbx),%xmm0
  subsd  0x0(%r13),%xmm0
  mulsd  %xmm0,%xmm0
  addsd  (%r12),%xmm0
  movsd  %xmm0,(%r12)
  jmp    L115
L68:
  call   <sqrt@plt>
  jmp    L77
L59:
  pxor   %xmm2,%xmm2
  cvtsi2sdl 0x10(%rsp),%xmm2
  movsd  %xmm2,0x10(%rsp)
  movsd  0x0(%r13),%xmm1
  divsd  %xmm2,%xmm1
  movsd  %xmm1,0x0(%r13)
  mov    0x8(%rsp),%rax
  movsd  (%rax),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  %xmm0,%xmm0
  movsd  %xmm0,(%r12)
  jmp    L69
L45:
  mov    0x8(%rsp),%rax
  movsd  (%rax),%xmm1
  subsd  %xmm0,%xmm1
  mulsd  %xmm1,%xmm1
  movsd  %xmm1,(%r12)
  movsd  D2(%rip),%xmm4
  movsd  %xmm4,0x10(%rsp)
L64:
  movsd  (%r12),%xmm0
  divsd  0x10(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L68
  sqrtsd %xmm0,%xmm0
L77:
  movsd  %xmm0,(%r12)
  mov    0x1c(%rsp),%edx
  mov    $0x0,%eax
L120:
  movsd  (%r14,%rax,8),%xmm0
  subsd  0x0(%r13),%xmm0
  divsd  (%r12),%xmm0
  movsd  %xmm0,(%r14,%rax,8)
  movsd  (%r15,%rax,8),%xmm0
  divsd  (%r12),%xmm0
  movsd  %xmm0,(%r15,%rax,8)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L120
L4:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D2
type_guessed: byte[8]

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

assistant: ```c
void normalize(int size, double *t, double *mag, double *sig, double *ave, double *stddev) {
  int i, i1, n;
  if (size > 0) {
    i = 0;
    while (isnan(mag[i]))
      i++;
    *ave = mag[i];
    n = 1;
    i1 = i;
    for (i = i + 1; i < size; i++)
      if (!isnan(mag[i])) {
        *ave += mag[i];
        n++;
      }
    *ave /= (double)n;
    *stddev = ((mag[i1] - *ave) * (mag[i1] - *ave));
    for (i = i1 + 1; i < size; i++)
      if (!isnan(mag[i]))
        *stddev += ((mag[i] - *ave) * (mag[i] - *ave));
    *stddev = sqrt((*stddev) / (double)n);
    for (i = 0; i < size; i++) {
      mag[i] = (mag[i] - *ave) / (*stddev);
      sig[i] = sig[i] / (*stddev);
    }
  }
}
```