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

```asm
<ti_volatility>:
  endbr64
  push   %r15
  mov    $0x1,%eax
  push   %r14
  mov    %rdx,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  cvttsd2si (%rdx),%ebx
  test   %ebx,%ebx
  jle    L62
  mov    %edi,%r13d
  mov    %rdx,%rdi
  mov    %rcx,0x8(%rsp)
  mov    (%rsi),%rbp
  mov    (%rcx),%r15
  call   <ti_volatility_start@plt>
  mov    %eax,%r8d
  xor    %eax,%eax
  cmp    %r13d,%r8d
  jge    L62
  pxor   %xmm3,%xmm3
  lea    -0x1(%rbx),%ecx
  mov    0x8(%rsp),%rdx
  mov    %rbp,%rax
  movsd  D0(%rip),%xmm2
  lea    0x8(%rbp,%rcx,8),%rcx
  movapd %xmm3,%xmm5
  movapd %xmm3,%xmm4
  xchg   %ax,%ax
L39:
  movsd  0x8(%rax),%xmm0
  divsd  (%rax),%xmm0
  subsd  %xmm2,%xmm0
  add    $0x8,%rax
  addsd  %xmm0,%xmm4
  mulsd  %xmm0,%xmm0
  addsd  %xmm0,%xmm5
  cmp    %rax,%rcx
  jne    L39
  pxor   %xmm0,%xmm0
  movapd %xmm2,%xmm6
  cvtsi2sd %ebx,%xmm0
  divsd  %xmm0,%xmm6
  movapd %xmm6,%xmm1
  movapd %xmm6,%xmm0
  mulsd  %xmm4,%xmm1
  mulsd  %xmm5,%xmm0
  mulsd  %xmm1,%xmm1
  subsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm3
  ja     L49
  sqrtsd %xmm0,%xmm0
L10:
  movsd  D7(%rip),%xmm7
  lea    0x1(%rbx),%eax
  lea    0x8(%r15),%rcx
  mulsd  %xmm7,%xmm0
  movsd  %xmm0,(%r15)
  cmp    %eax,%r13d
  jle    L84
  lea    -0x2(%r13),%esi
  sub    %ebx,%esi
  movslq %ebx,%rbx
  lea    0x0(%rbp,%rbx,8),%r12
  lea    0x10(,%rsi,8),%rax
  mov    $0x8,%ebx
  nopl   0x0(%rax)
L18:
  movsd  (%r12,%rbx,1),%xmm1
  divsd  -0x8(%r12,%rbx,1),%xmm1
  movapd %xmm1,%xmm0
  movsd  0x0(%rbp,%rbx,1),%xmm1
  subsd  %xmm2,%xmm0
  divsd  -0x8(%rbp,%rbx,1),%xmm1
  subsd  %xmm2,%xmm1
  addsd  %xmm0,%xmm4
  mulsd  %xmm0,%xmm0
  subsd  %xmm1,%xmm4
  mulsd  %xmm1,%xmm1
  addsd  %xmm0,%xmm5
  movapd %xmm6,%xmm0
  subsd  %xmm1,%xmm5
  movapd %xmm6,%xmm1
  mulsd  %xmm4,%xmm1
  mulsd  %xmm5,%xmm0
  mulsd  %xmm1,%xmm1
  subsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm3
  ja     L76
  sqrtsd %xmm0,%xmm0
L82:
  mulsd  %xmm7,%xmm0
  movsd  %xmm0,(%r15,%rbx,1)
  add    $0x8,%rbx
  cmp    %rbx,%rax
  jne    L18
  lea    0x8(%rcx,%rsi,8),%rcx
L84:
  sub    (%rdx),%rcx
  mov    %r14,%rdi
  sar    $0x3,%rcx
  mov    %rcx,%rbx
  call   <ti_volatility_start@plt>
  xor    %edi,%edi
  sub    %eax,%r13d
  movslq %r13d,%r13
  cmp    %rbx,%r13
  sete   %dil
  call   <assert@plt>
  xor    %eax,%eax
L62:
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L76:
  mov    %rdx,0x38(%rsp)
  mov    %rsi,0x30(%rsp)
  mov    %rax,0x28(%rsp)
  mov    %rcx,0x8(%rsp)
  movsd  %xmm5,0x20(%rsp)
  movsd  %xmm4,0x18(%rsp)
  movsd  %xmm6,0x10(%rsp)
  call   <sqrt@plt>
  mov    D7(%rip),%rax
  mov    0x38(%rsp),%rdx
  pxor   %xmm3,%xmm3
  mov    0x30(%rsp),%rsi
  movsd  0x20(%rsp),%xmm5
  movq   %rax,%xmm7
  movsd  0x18(%rsp),%xmm4
  movsd  0x10(%rsp),%xmm6
  mov    D0(%rip),%rax
  mov    0x8(%rsp),%rcx
  movq   %rax,%xmm2
  mov    0x28(%rsp),%rax
  jmp    L82
L49:
  mov    %rdx,0x20(%rsp)
  movsd  %xmm5,0x18(%rsp)
  movsd  %xmm4,0x10(%rsp)
  movsd  %xmm6,0x8(%rsp)
  call   <sqrt@plt>
  mov    D0(%rip),%rax
  mov    0x20(%rsp),%rdx
  pxor   %xmm3,%xmm3
  movsd  0x18(%rsp),%xmm5
  movsd  0x10(%rsp),%xmm4
  movsd  0x8(%rsp),%xmm6
  movq   %rax,%xmm2
  jmp    L10
```

tool_calls: name: retrieve_data
arguments: data_tag: D0
data_type: f64
name: retrieve_data
arguments: data_tag: D7
data_type: byte[8]

tool: D0: 1

tool: {"D7": [0x5f,0x75,0xbc,0x7e,0xbf,0xbf,0x2f,0x40]}

assistant: ```c
int ti_volatility(int size, double const *const *inputs, double const *options, double *const *outputs) {
  const double *input = inputs[0];
  double *output = outputs[0];
  const int period = (int)options[0];
  const double scale = 1.0 / period;
  const double annual = sqrt(252);
  if (period < 1)
    return 1;
  if (size <= ti_volatility_start(options))
    return 0;
  double sum = 0;
  double sum2 = 0;
  int i;
  for (i = 1; i <= period; ++i) {
    const double c = (input[i] / input[i - 1] - 1.0);
    sum += c;
    sum2 += c * c;
  }
  *output++ = sqrt(sum2 * scale - (sum * scale) * (sum * scale)) * annual;
  for (i = period + 1; i < size; ++i) {
    const double c = (input[i] / input[i - 1] - 1.0);
    sum += c;
    sum2 += c * c;
    const double cp = (input[i - period] / input[i - period - 1] - 1.0);
    sum -= cp;
    sum2 -= cp * cp;
    *output++ = sqrt(sum2 * scale - (sum * scale) * (sum * scale)) * annual;
  }
  assert(output - outputs[0] == size - ti_volatility_start(options));
  return 0;
}
```