user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<spline_construct>:
  endbr64
  push   %r15
  lea    -0x1(%rcx),%r9d
  mov    %rsi,%r15
  push   %r14
  push   %r13
  push   %r12
  lea    0x0(,%r9,8),%r12d
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %r12d,%edi
  mov    %ecx,0x8(%rsp)
  mov    %r9d,0xc(%rsp)
  mov    %rdx,0x10(%rsp)
  call   <malloc@plt>
  movslq 0x8(%rsp),%rbx
  mov    %rax,%r13
  lea    0x0(,%rbx,8),%ebp
  mov    %ebp,%edi
  call   <malloc@plt>
  mov    %r12d,%edi
  mov    %rax,%r14
  call   <malloc@plt>
  mov    %ebp,%edi
  mov    %rax,%r12
  call   <malloc@plt>
  mov    0x18(%rsp),%r8
  mov    0xc(%rsp),%r9d
  movsd  D3(%rip),%xmm3
  mov    0x8(%rsp),%ecx
  mov    %rax,%rbp
  movsd  0x8(%r8),%xmm0
  subsd  (%r8),%xmm0
  cmp    $0x1,%r9d
  mov    0x10(%rsp),%rsi
  addsd  %xmm0,%xmm0
  movsd  %xmm0,(%r14)
  movsd  0x8(%r8),%xmm0
  subsd  (%r8),%xmm0
  movsd  %xmm0,(%r12)
  movsd  0x8(%r15),%xmm0
  subsd  (%r15),%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,(%rax)
  jle    L49
  lea    -0x3(%rcx),%edi
  mov    %r8,%rdx
  mov    $0x1,%eax
  add    $0x2,%rdi
  cs nopw 0x0(%rax,%rax,1)
L39:
  movsd  0x8(%rdx),%xmm0
  subsd  (%rdx),%xmm0
  add    $0x8,%rdx
  movsd  %xmm0,-0x8(%r13,%rax,8)
  movsd  (%rdx),%xmm2
  movsd  0x8(%rdx),%xmm1
  movapd %xmm2,%xmm0
  subsd  %xmm2,%xmm1
  subsd  -0x8(%rdx),%xmm0
  addsd  %xmm1,%xmm1
  addsd  %xmm0,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,(%r14,%rax,8)
  movsd  0x8(%rdx),%xmm0
  subsd  (%rdx),%xmm0
  movsd  %xmm0,(%r12,%rax,8)
  movsd  0x8(%r15,%rax,8),%xmm0
  subsd  -0x8(%r15,%rax,8),%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %rax,%rdi
  jne    L39
L49:
  shl    $0x3,%rbx
  lea    -0x2(%rcx),%edi
  lea    -0x8(%rbx),%r10
  lea    -0x10(%r8,%rbx,1),%rax
  lea    (%r8,%r10,1),%rdx
  lea    0x0(%rbp,%r10,1),%r8
  add    %rsi,%r10
  movsd  (%rdx),%xmm0
  subsd  (%rax),%xmm0
  movsd  %xmm0,-0x10(%r13,%rbx,1)
  movsd  (%rdx),%xmm0
  subsd  (%rax),%xmm0
  addsd  %xmm0,%xmm0
  movsd  %xmm0,-0x8(%r14,%rbx,1)
  movsd  -0x8(%r15,%rbx,1),%xmm0
  subsd  -0x10(%r15,%rbx,1),%xmm0
  mulsd  %xmm3,%xmm0
  movsd  %xmm0,(%r8)
  movsd  (%r12),%xmm0
  divsd  (%r14),%xmm0
  movsd  %xmm0,(%r12)
  movsd  0x0(%rbp),%xmm0
  divsd  (%r14),%xmm0
  movsd  %xmm0,0x0(%rbp)
  cmp    $0x1,%ecx
  jle    L86
  cmp    $0x1,%r9d
  jle    L62
  movsd  D26(%rip),%xmm3
  mov    $0x1,%eax
  nopl   0x0(%rax)
L109:
  movsd  -0x8(%r12,%rax,8),%xmm1
  movsd  (%r14,%rax,8),%xmm0
  movapd %xmm3,%xmm2
  lea    0x1(%rax),%edx
  mulsd  -0x8(%r13,%rax,8),%xmm1
  subsd  %xmm1,%xmm0
  divsd  %xmm0,%xmm2
  movsd  (%r12,%rax,8),%xmm0
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,(%r12,%rax,8)
  movsd  -0x8(%rbp,%rax,8),%xmm1
  mulsd  -0x8(%r13,%rax,8),%xmm1
  movsd  0x0(%rbp,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  movsd  %xmm0,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%r9d
  jg     L109
  cmp    %edx,%ecx
  jle    L36
L96:
  movslq %edx,%rax
  movsd  -0x8(%rbp,%rax,8),%xmm0
  nopw   0x0(%rax,%rax,1)
L66:
  movsd  -0x8(%r13,%rax,8),%xmm2
  movsd  -0x8(%r12,%rax,8),%xmm4
  movsd  (%r14,%rax,8),%xmm1
  mulsd  %xmm2,%xmm4
  mulsd  %xmm2,%xmm0
  subsd  %xmm4,%xmm1
  movapd %xmm3,%xmm4
  divsd  %xmm1,%xmm4
  movsd  0x0(%rbp,%rax,8),%xmm1
  subsd  %xmm0,%xmm1
  mulsd  %xmm1,%xmm4
  movsd  %xmm4,0x0(%rbp,%rax,8)
  add    $0x1,%rax
  movapd %xmm4,%xmm0
  cmp    %eax,%ecx
  jg     L66
L36:
  movsd  (%r8),%xmm0
  movsd  %xmm0,(%r10)
L92:
  movsd  -0x8(%rsi,%rbx,1),%xmm0
  movslq %edi,%rax
  nopl   0x0(%rax,%rax,1)
L108:
  movsd  (%r12,%rax,8),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  0x0(%rbp,%rax,8),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,(%rsi,%rax,8)
  sub    $0x1,%rax
  test   %eax,%eax
  jns    L108
L90:
  mov    %r13,%rdi
  call   <free@plt>
  mov    %r14,%rdi
  call   <free@plt>
  mov    %r12,%rdi
  call   <free@plt>
  add    $0x28,%rsp
  mov    %rbp,%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1060 <free@plt>
  nopw   0x0(%rax,%rax,1)
L62:
  movsd  D26(%rip),%xmm3
  mov    $0x1,%edx
  jmp    L96
  nopw   0x0(%rax,%rax,1)
L86:
  movsd  (%r8),%xmm0
  movsd  %xmm0,(%r10)
  test   %edi,%edi
  js     L90
  jmp    L92
```

tool_calls: name: parse_data
arguments: tag: D3
type: byte[8]
name: parse_data
arguments: tag: D26
type: f64

tool: {"D3": [0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x40]}

tool: D26: 1

assistant: ```c
void spline_construct(double *x, double *y, double *d, int n) {
  int i;
  double tmp;
  double *diag_low;
  double *diag_mid;
  double *diag_up;
  double *right;
  diag_low = malloc((n - 1) * sizeof(double));
  diag_mid = malloc(n * sizeof(double));
  diag_up = malloc((n - 1) * sizeof(double));
  right = malloc(n * sizeof(double));
  diag_mid[0] = 2 * (x[1] - x[0]);
  diag_up[0] = (x[1] - x[0]);
  right[0] = 3 * (y[1] - y[0]);
  for (i = 1; i < n - 1; i++) {
    diag_low[i - 1] = (x[i] - x[i - 1]);
    diag_mid[i] = 2 * (x[i] - x[i - 1]) + 2 * (x[i + 1] - x[i]);
    diag_up[i] = (x[i + 1] - x[i]);
    right[i] = 3 * (y[i + 1] - y[i - 1]);
  }
  diag_low[n - 2] = (x[n - 1] - x[n - 2]);
  diag_mid[n - 1] = 2 * (x[n - 1] - x[n - 2]);
  right[n - 1] = 3 * (y[n - 1] - y[n - 2]);
  diag_up[0] /= diag_mid[0];
  right[0] /= diag_mid[0];
  for (i = 1; i < n; i++) {
    tmp = 1.0 / (diag_mid[i] - diag_up[i - 1] * diag_low[i - 1]);
    if (i < n - 1)
      diag_up[i] *= tmp;
    right[i] = (right[i] - right[i - 1] * diag_low[i - 1]) * tmp;
  }
  d[n - 1] = right[n - 1];
  for (i = n - 2; i >= 0; i--) {
    d[i] = right[i] - diag_up[i] * d[i + 1];
  }
  free(diag_low);
  free(diag_mid);
  free(diag_up);
  free(right);
}
```