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

```asm
<dchisqr_sysrem>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    0x30(%rsp),%rbp
  lea    (%rdx,%rcx,1),%eax
  test   %eax,%eax
  jle    L78
  mov    %rdi,%r10
  mov    %rsi,%r11
  mov    %edx,%esi
  mov    %ecx,%ebx
  movapd %xmm0,%xmm5
  lea    0x1(%rax),%r12d
  mov    $0x1,%edx
  movq   D19(%rip),%xmm4
  movsd  D38(%rip),%xmm3
  movq   D7(%rip),%xmm7
  movapd %xmm4,%xmm2
  movapd %xmm7,%xmm6
  jmp    L169
L90:
  xorpd  %xmm6,%xmm13
  jmp    L1
L230:
  movslq %ecx,%r14
  movsd  0x8(%r10,%r14,8),%xmm13
  movapd %xmm13,%xmm14
  mulsd  (%r10,%rdx,8),%xmm14
  subsd  %xmm14,%xmm0
  mulsd  %xmm13,%xmm0
  mulsd  %xmm12,%xmm12
  divsd  %xmm12,%xmm0
  mulsd  %xmm10,%xmm0
  movsd  %xmm0,-0x8(%rsp)
  faddl  -0x8(%rsp)
L198:
  add    $0x1,%ecx
  add    $0x8,%rax
  cmp    %edi,%ecx
  je     L228
L99:
  movsd  0x0(%r13,%rax,1),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L198
  movapd %xmm0,%xmm12
  andpd  %xmm2,%xmm12
  ucomisd %xmm8,%xmm12
  ja     L198
  comisd %xmm1,%xmm0
  jbe    L198
  subsd  -0x8(%rbp,%rdx,8),%xmm0
  movapd %xmm0,%xmm13
  comisd %xmm9,%xmm0
  jbe    L90
L1:
  mov    -0x8(%r9,%rdx,8),%r14
  movsd  (%r14,%rax,1),%xmm12
  divsd  %xmm12,%xmm13
  comisd %xmm13,%xmm5
  ja     L230
  comisd %xmm5,%xmm11
  jbe    L198
  jmp    L230
L257:
  mov    %edx,%ecx
  sub    %esi,%ecx
  sub    $0x1,%ecx
  test   %esi,%esi
  jle    L17
  movslq %ecx,%rcx
  shl    $0x3,%rcx
  lea    -0x1(%rsi),%r13d
  mov    $0x0,%eax
  fldz
  pxor   %xmm9,%xmm9
  movsd  D21(%rip),%xmm10
  movapd %xmm9,%xmm11
  jmp    L233
L14:
  xorpd  %xmm7,%xmm12
  jmp    L162
L241:
  movsd  0x8(%r10,%rax,8),%xmm12
  movapd %xmm12,%xmm13
  mulsd  (%r10,%rdx,8),%xmm13
  subsd  %xmm13,%xmm0
  mulsd  %xmm12,%xmm0
  mulsd  %xmm8,%xmm8
  divsd  %xmm8,%xmm0
  mulsd  %xmm10,%xmm0
  movsd  %xmm0,-0x8(%rsp)
  faddl  -0x8(%rsp)
L32:
  lea    0x1(%rax),%rdi
  cmp    %r13,%rax
  je     L228
  mov    %rdi,%rax
L233:
  mov    (%r8,%rax,8),%rdi
  movsd  (%rdi,%rcx,1),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L32
  movapd %xmm0,%xmm8
  andpd  %xmm4,%xmm8
  ucomisd %xmm3,%xmm8
  ja     L32
  comisd %xmm1,%xmm0
  jbe    L32
  subsd  0x0(%rbp,%rax,8),%xmm0
  movapd %xmm0,%xmm12
  comisd %xmm9,%xmm0
  jbe    L14
L162:
  mov    (%r9,%rax,8),%rdi
  movsd  (%rdi,%rcx,1),%xmm8
  divsd  %xmm8,%xmm12
  comisd %xmm12,%xmm5
  ja     L241
  comisd %xmm5,%xmm11
  jbe    L32
  jmp    L241
L72:
  fldz
L228:
  pxor   %xmm0,%xmm0
  cvtsi2sd %ebx,%xmm0
  pxor   %xmm8,%xmm8
  cvtsi2sd %esi,%xmm8
  mulsd  %xmm8,%xmm0
  movsd  %xmm0,-0x8(%rsp)
  fdivl  -0x8(%rsp)
  fstpl  (%r11,%rdx,8)
  add    $0x1,%rdx
  cmp    %r12,%rdx
  je     L78
L169:
  cmp    %edx,%esi
  jl     L257
  test   %ebx,%ebx
  jle    L72
  mov    -0x8(%r8,%rdx,8),%r13
  mov    %esi,%ecx
  lea    (%rbx,%rsi,1),%edi
  mov    $0x0,%eax
  fldz
  movsd  D38(%rip),%xmm8
  pxor   %xmm9,%xmm9
  movsd  D21(%rip),%xmm10
  movapd %xmm9,%xmm11
  jmp    L99
L17:
  fldz
  jmp    L228
L78:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
```

tool_calls: name: disassemble_data
arguments: tag: D19
type: byte[8]
name: disassemble_data
arguments: tag: D38
type: byte[8]
name: disassemble_data
arguments: tag: D7
type: byte[8]
name: disassemble_data
arguments: tag: D21
type: byte[8]

tool: {"D19": [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f]}

tool: {"D38": [0xff,0xff,0xff,0xff,0xff,0xff,0xef,0x7f]}

tool: {"D7": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

tool: {"D21": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0]}

assistant: ```c
void dchisqr_sysrem(double p[], double xi[], int numlc, int numJD, double **mag, double **sig, double *mag_ave, double sigma_clip, double saturation) {
  int j, k;
  int n, num;
  long double S;
  num = 0;
  for (n = 1; n <= numlc + numJD; n++) {
    S = 0;
    if (n <= numlc) {
      j = n - 1;
      for (k = 0; k < numJD; k++) {
        if (!isnan(mag[j][k]) && !isinf(mag[j][k]) && mag[j][k] > saturation && (((mag[j][k] - mag_ave[j]) > 0 ? (mag[j][k] - mag_ave[j]) : (-(mag[j][k] - mag_ave[j]))) / sig[j][k] < sigma_clip || sigma_clip < 0))
          S += -2.0 * (p[numlc + k + 1] * (mag[j][k] - mag_ave[j] - p[n] * p[numlc + k + 1]) / (sig[j][k] * sig[j][k]));
      }
    } else {
      k = n - numlc - 1;
      for (j = 0; j < numlc; j++) {
        if (!isnan(mag[j][k]) && !isinf(mag[j][k]) && mag[j][k] > saturation && (((mag[j][k] - mag_ave[j]) > 0 ? (mag[j][k] - mag_ave[j]) : (-(mag[j][k] - mag_ave[j]))) / sig[j][k] < sigma_clip || sigma_clip < 0))
          S += -2.0 * (p[j + 1] * (mag[j][k] - mag_ave[j] - p[j + 1] * p[n]) / (sig[j][k] * sig[j][k]));
      }
    }
    xi[n] = (double)(S / ((double)numJD * numlc));
  }
}
```