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

```asm
<finite_sum_with_derivatives>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xb8,%rsp
  mov    0x18(%rbp),%rax
  mov    %rdi,-0xd8(%rbp)
  mov    %rsi,-0xe0(%rbp)
  mov    0x38(%rbp),%r14d
  mov    %rsp,%rdi
  mov    %rax,-0x78(%rbp)
  mov    0x20(%rbp),%rax
  mov    %rdx,-0x90(%rbp)
  mov    %rcx,%rdx
  mov    0x10(%rbp),%rcx
  mov    %rax,-0xa8(%rbp)
  mov    0x28(%rbp),%rax
  mov    %r8,-0x98(%rbp)
  mov    %r9,-0xa0(%rbp)
  mov    %rax,-0xb0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  movslq %r14d,%rax
  shl    $0x3,%rax
  mov    %rax,-0x88(%rbp)
  add    $0xf,%rax
  mov    %rax,%r8
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%r8
  and    $0xfffffffffffffff0,%rsi
  sub    %r8,%rdi
  cmp    %rdi,%rsp
  je     L29
L16:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L16
L29:
  and    $0xfff,%esi
  sub    %rsi,%rsp
  test   %rsi,%rsi
  jne    L13
L142:
  mov    %rax,%r8
  mov    %rsp,%rdi
  mov    %rax,%rsi
  mov    %rsp,%r12
  and    $0xfffffffffffff000,%r8
  and    $0xfffffffffffffff0,%rsi
  sub    %r8,%rdi
  cmp    %rdi,%rsp
  je     L177
L195:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L195
L177:
  and    $0xfff,%esi
  sub    %rsi,%rsp
  test   %rsi,%rsi
  jne    L30
L169:
  mov    %rax,%rsi
  mov    %rsp,%rdi
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rbx
  sub    %rax,%rdi
  and    $0xfffffffffffffff0,%rsi
  cmp    %rdi,%rsp
  je     L68
L9:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rdi,%rsp
  jne    L9
L68:
  mov    %rsi,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L147
  orq    $0x0,-0x8(%rsp,%rax,1)
L147:
  mov    %rsp,-0xb8(%rbp)
  test   %r14d,%r14d
  jle    L73
  mov    %r14d,%r15d
  pxor   %xmm2,%xmm2
  mov    -0x88(%rbp),%r8
  mov    %r12,%rsi
  lea    (%r12,%r15,8),%rdi
  movsd  %xmm2,-0x70(%rbp)
  xchg   %ax,%ax
L28:
  xor    %eax,%eax
  movapd %xmm2,%xmm1
  cs nopw 0x0(%rax,%rax,1)
L41:
  movsd  (%rdx,%rax,8),%xmm0
  mulsd  (%rcx,%rax,8),%xmm0
  add    $0x1,%rax
  addsd  %xmm0,%xmm1
  cmp    %rax,%r15
  jne    L41
  movsd  %xmm1,(%rsi)
  add    $0x8,%rsi
  add    %r8,%rdx
  cmp    %rdi,%rsi
  jne    L28
  xor    %r13d,%r13d
  mov    %r14d,0x38(%rbp)
  mov    %r13,%r14
  mov    -0xb8(%rbp),%r13
  nopl   0x0(%rax,%rax,1)
L88:
  movsd  (%r12,%r14,8),%xmm1
  movapd %xmm1,%xmm0
  movsd  %xmm1,-0x68(%rbp)
  call   <round@plt>
  movsd  -0x68(%rbp),%xmm1
  movsd  %xmm0,(%rbx,%r14,8)
  subsd  %xmm0,%xmm1
  movsd  %xmm1,0x0(%r13,%r14,8)
  add    $0x1,%r14
  cmp    %r14,%r15
  jne    L88
  mov    0x38(%rbp),%r14d
L44:
  mov    0x40(%rbp),%ecx
  movq   $0x0,-0x48(%rbp)
  movq   $0x0,-0x40(%rbp)
  test   %ecx,%ecx
  jle    L74
  lea    -0x60(%rbp),%rax
  pxor   %xmm5,%xmm5
  mov    -0x78(%rbp),%r13
  xor    %r12d,%r12d
  mov    %rax,-0xd0(%rbp)
  lea    -0x40(%rbp),%rax
  movapd %xmm5,%xmm6
  lea    -0x58(%rbp),%r15
  mov    %rax,-0xc8(%rbp)
  lea    -0x48(%rbp),%rax
  mov    %rax,-0xc0(%rbp)
  cs nopw 0x0(%rax,%rax,1)
L168:
  mov    -0xa0(%rbp),%rdx
  mov    %r14d,%r8d
  mov    %rbx,%rcx
  mov    %r13,%rdi
  mov    -0x90(%rbp),%rsi
  movsd  %xmm5,-0x80(%rbp)
  add    $0x1,%r12d
  movsd  %xmm6,-0x78(%rbp)
  call   <exppart@plt>
  mov    -0xd0(%rbp),%rsi
  mov    %r15,%rdi
  call   <sincos@plt>
  movsd  -0x58(%rbp),%xmm7
  mov    %r14d,%ecx
  mov    %r13,%rdi
  movsd  -0x60(%rbp),%xmm2
  mov    -0xb8(%rbp),%rdx
  mov    -0x98(%rbp),%rsi
  movsd  %xmm7,-0x68(%rbp)
  movsd  %xmm2,-0x70(%rbp)
  call   <normpart@plt>
  mov    %eax,%edi
  call   <exp@plt>
  movsd  -0x70(%rbp),%xmm2
  mov    0x30(%rbp),%eax
  push   %r14
  movsd  -0x68(%rbp),%xmm3
  mov    -0xb0(%rbp),%r9
  mov    %r13,%rdx
  mov    %rbx,%rcx
  mulsd  %xmm0,%xmm2
  push   %rax
  mov    -0xa8(%rbp),%r8
  mulsd  %xmm0,%xmm3
  mov    -0xc8(%rbp),%rsi
  mov    -0xc0(%rbp),%rdi
  movsd  %xmm2,-0x70(%rbp)
  movsd  %xmm3,-0x68(%rbp)
  call   <deriv_prod@plt>
  movsd  -0x48(%rbp),%xmm0
  movsd  -0x40(%rbp),%xmm1
  movsd  -0x70(%rbp),%xmm2
  movsd  -0x68(%rbp),%xmm3
  movapd %xmm0,%xmm4
  movapd %xmm1,%xmm7
  movsd  -0x78(%rbp),%xmm6
  pop    %rax
  mulsd  %xmm2,%xmm4
  movsd  -0x80(%rbp),%xmm5
  add    -0x88(%rbp),%r13
  mulsd  %xmm3,%xmm7
  pop    %rdx
  mulsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm1
  subsd  %xmm7,%xmm4
  addsd  %xmm1,%xmm0
  addsd  %xmm4,%xmm6
  addsd  %xmm0,%xmm5
  cmp    %r12d,0x40(%rbp)
  jne    L168
L3:
  mov    -0xd8(%rbp),%rax
  movsd  %xmm6,(%rax)
  mov    -0xe0(%rbp),%rax
  movsd  %xmm5,(%rax)
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L128
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L13:
  orq    $0x0,-0x8(%rsp,%rsi,1)
  jmp    L142
L30:
  orq    $0x0,-0x8(%rsp,%rsi,1)
  jmp    L169
L74:
  pxor   %xmm5,%xmm5
  movapd %xmm5,%xmm6
  jmp    L3
L73:
  pxor   %xmm6,%xmm6
  movsd  %xmm6,-0x70(%rbp)
  jmp    L44
L128:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void finite_sum_with_derivatives(double *fsum_real, double *fsum_imag, double *X, double *Yinv, double *T, double *x, double *y, double *S, double *deriv_real, double *deriv_imag, int nderivs, int g, int N) {
  int k, j;
  double shift[g];
  double intshift[g];
  double fracshift[g];
  double sum;
  for (k = 0; k < g; k++) {
    sum = 0;
    for (j = 0; j < g; j++)
      sum += Yinv[k * g + j] * y[j];
    shift[k] = sum;
  }
  for (k = 0; k < g; k++) {
    intshift[k] = round(shift[k]);
    fracshift[k] = shift[k] - intshift[k];
  }
  double real_total = 0, imag_total = 0;
  double ept, npt, cpt, spt;
  double dpr[1];
  double dpi[1];
  double *n;
  dpr[0] = 0;
  dpi[0] = 0;
  for (k = 0; k < N; k++) {
    n = S + k * g;
    ept = exppart(n, X, x, intshift, g);
    npt = exp(normpart(n, T, fracshift, g));
    cpt = npt * cos(ept);
    spt = npt * sin(ept);
    deriv_prod(dpr, dpi, n, intshift, deriv_real, deriv_imag, nderivs, g);
    real_total += dpr[0] * cpt - dpi[0] * spt;
    imag_total += dpr[0] * spt + dpi[0] * cpt;
  }
  fsum_real[0] = real_total;
  fsum_imag[0] = imag_total;
}
```