user: 请从给定的汇编指令推导出C源代码:

```asm
<ti_qstick>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %edi,-0x44(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    -0x50(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x28(%rbp)
  mov    -0x50(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    %rax,-0x20(%rbp)
  mov    -0x60(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x58(%rbp),%rax
  movsd  (%rax),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x3c(%rbp)
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0x3c(%rbp),%xmm1
  movsd  D6(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  cmpl   $0x0,-0x3c(%rbp)
  jg     L13
  mov    $0x1,%eax
  jmp    L4
L13:
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <ti_qstick_start@plt>
  cmp    %eax,-0x44(%rbp)
  jg     L10
  mov    $0x0,%eax
  jmp    L4
L10:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movl   $0x0,-0x40(%rbp)
  jmp    L28
L23:
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  -0x30(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  addl   $0x1,-0x40(%rbp)
L28:
  mov    -0x40(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L23
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movsd  -0x30(%rbp),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  mov    -0x3c(%rbp),%eax
  mov    %eax,-0x40(%rbp)
  jmp    L30
L62:
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x40(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  -0x30(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x40(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x40(%rbp),%eax
  sub    -0x3c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x28(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  movsd  -0x30(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x38(%rbp),%rax
  lea    0x8(%rax),%rdx
  mov    %rdx,-0x38(%rbp)
  movsd  -0x30(%rbp),%xmm0
  mulsd  -0x18(%rbp),%xmm0
  movsd  %xmm0,(%rax)
  addl   $0x1,-0x40(%rbp)
L30:
  mov    -0x40(%rbp),%eax
  cmp    -0x44(%rbp),%eax
  jl     L62
  mov    -0x60(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x38(%rbp),%rax
  sub    %rdx,%rax
  sar    $0x3,%rax
  mov    %rax,%rbx
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <ti_qstick_start@plt>
  mov    %eax,%edx
  mov    -0x44(%rbp),%eax
  sub    %edx,%eax
  cltq
  cmp    %rax,%rbx
  sete   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <assert@plt>
  mov    $0x0,%eax
L4:
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D6
type: f64

tool: D6: 1

assistant: ```c
int ti_qstick(int size, double const *const *inputs, double const *options, double *const *outputs) {
  const double *open = inputs[0];
  const double *close = inputs[1];
  double *output = outputs[0];
  const int period = (int)options[0];
  const double scale = 1.0 / period;
  if (period < 1)
    return 1;
  if (size <= ti_qstick_start(options))
    return 0;
  double sum = 0;
  int i;
  for (i = 0; i < period; ++i) {
    sum += close[i] - open[i];
  }
  *output++ = sum * scale;
  for (i = period; i < size; ++i) {
    sum += close[i] - open[i];
    sum -= close[i - period] - open[i - period];
    *output++ = sum * scale;
  }
  assert(output - outputs[0] == size - ti_qstick_start(options));
  return 0;
}
```