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

```asm
<ti_linregintercept>:
  endbr64
  push   %r15
  mov    $0x1,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  cvttsd2si (%rdx),%r15d
  test   %r15d,%r15d
  jle    L59
  mov    %edi,%r12d
  xor    %eax,%eax
  mov    %rdx,%rdi
  mov    (%rsi),%rbx
  mov    (%rcx),%rbp
  mov    %rdx,%r13
  mov    %rcx,%r14
  call   <ti_linregintercept_start@plt>
  mov    %eax,%r8d
  xor    %eax,%eax
  cmp    %r12d,%r8d
  jge    L59
  movsd  D4(%rip),%xmm8
  pxor   %xmm5,%xmm5
  mov    %r15d,%esi
  cvtsi2sd %r15d,%xmm5
  movapd %xmm8,%xmm6
  divsd  %xmm5,%xmm6
  sub    $0x1,%esi
  je     L55
  pxor   %xmm1,%xmm1
  lea    -0x2(%r15),%ecx
  mov    $0x1,%eax
  movapd %xmm1,%xmm2
  movapd %xmm1,%xmm7
  movapd %xmm1,%xmm4
  add    $0x2,%rcx
L0:
  mov    %eax,%edx
  pxor   %xmm3,%xmm3
  pxor   %xmm0,%xmm0
  imul   %eax,%edx
  cvtsi2sd %eax,%xmm0
  cvtsi2sd %edx,%xmm3
  addsd  %xmm0,%xmm4
  addsd  %xmm3,%xmm7
  movsd  -0x8(%rbx,%rax,8),%xmm3
  add    $0x1,%rax
  mulsd  %xmm3,%xmm0
  addsd  %xmm3,%xmm2
  addsd  %xmm0,%xmm1
  cmp    %rax,%rcx
  jne    L0
L50:
  mov    %r15d,%eax
  pxor   %xmm0,%xmm0
  addsd  %xmm5,%xmm4
  imul   %r15d,%eax
  movapd %xmm4,%xmm3
  cvtsi2sd %eax,%xmm0
  mulsd  %xmm4,%xmm3
  addsd  %xmm7,%xmm0
  movapd %xmm8,%xmm7
  mulsd  %xmm5,%xmm0
  subsd  %xmm3,%xmm0
  divsd  %xmm0,%xmm7
  cmp    %esi,%r12d
  jle    L28
  mov    %r12d,%ecx
  xor    %eax,%eax
  sub    %r15d,%ecx
  movslq %r15d,%r15
  lea    0x1(%rcx),%rsi
  lea    (%rbx,%r15,8),%rdi
  nopl   0x0(%rax)
L54:
  movsd  -0x8(%rdi,%rax,8),%xmm0
  movapd %xmm5,%xmm3
  movapd %xmm4,%xmm8
  mov    %rax,%rdx
  mulsd  %xmm0,%xmm3
  addsd  %xmm2,%xmm0
  movapd %xmm4,%xmm2
  mulsd  %xmm0,%xmm2
  addsd  %xmm1,%xmm3
  movapd %xmm5,%xmm1
  mulsd  %xmm3,%xmm1
  subsd  %xmm0,%xmm3
  subsd  %xmm2,%xmm1
  movapd %xmm0,%xmm2
  mulsd  %xmm7,%xmm1
  mulsd  %xmm1,%xmm8
  subsd  %xmm8,%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm1,%xmm2
  movapd %xmm3,%xmm1
  movsd  %xmm2,0x0(%rbp,%rax,8)
  subsd  (%rbx,%rax,8),%xmm0
  add    $0x1,%rax
  movapd %xmm0,%xmm2
  cmp    %rdx,%rcx
  jne    L54
  lea    0x0(%rbp,%rsi,8),%rbp
L28:
  mov    %r13,%rdi
  xor    %eax,%eax
  sub    (%r14),%rbp
  call   <ti_linregintercept_start@plt>
  sar    $0x3,%rbp
  xor    %edi,%edi
  sub    %eax,%r12d
  movslq %r12d,%r12
  cmp    %rbp,%r12
  sete   %dil
  xor    %eax,%eax
  call   <assert@plt>
  xor    %eax,%eax
L59:
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L55:
  pxor   %xmm1,%xmm1
  movapd %xmm1,%xmm2
  movapd %xmm1,%xmm7
  movapd %xmm1,%xmm4
  jmp    L50
```

tool_calls: name: parse_data
arguments: data_label: D4
type: f64

tool: D4: 1

assistant: ```c
int ti_linregintercept(int size, double const *const *inputs, double const *options, double *const *outputs) {
  const double *input = inputs[0];
  const int period = (int)options[0];
  double *output = outputs[0];
  if (period < 1)
    return 1;
  if (size <= ti_linregintercept_start(options))
    return 0;
  do {
    double x = 0;
    double x2 = 0;
    double y = 0;
    double xy = 0;
    const double p = (1.0 / (period));
    int i;
    for (i = 0; i < (period)-1; ++i) {
      x += i + 1;
      x2 += (i + 1) * (i + 1);
      xy += (input)[i] * (i + 1);
      y += (input)[i];
    }
    x += (period);
    x2 += (period) * (period);
    const double bd = 1.0 / ((period)*x2 - x * x);
    for (i = (period)-1; i < (size); ++i) {
      xy += (input)[i] * (period);
      y += (input)[i];
      const double b = ((period)*xy - x * y) * bd;
      do {
        const double a = (y - b * x) * p;
        *output++ = (a + b * ((1)));
      } while (0);
      xy -= y;
      y -= (input)[i - (period) + 1];
    }
  } while (0);
  assert(output - outputs[0] == size - ti_linregintercept_start(options));
  return 0;
}
```