user: 请将以下的汇编代码转换成C语言代码:

```asm
<doalarm>:
  endbr64
  test   %edi,%edi
  jle    L7
  fldz
  movsd  D3(%rip),%xmm3
  movslq %edi,%rcx
  xor    %eax,%eax
  fld    %st(0)
  pxor   %xmm2,%xmm2
  nopl   0x0(%rax)
L36:
  movsd  (%rsi,%rax,8),%xmm1
  ucomisd %xmm1,%xmm1
  jp     L57
  movsd  (%rdx,%rax,8),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L57
  comisd %xmm2,%xmm0
  jbe    L57
  fxch   %st(1)
  mulsd  %xmm0,%xmm0
  movapd %xmm3,%xmm7
  divsd  %xmm0,%xmm1
  divsd  %xmm0,%xmm7
  movsd  %xmm1,-0x10(%rsp)
  faddl  -0x10(%rsp)
  fxch   %st(1)
  movsd  %xmm7,-0x10(%rsp)
  faddl  -0x10(%rsp)
L57:
  add    $0x1,%rax
  cmp    %rax,%rcx
  jne    L36
  fdivrp %st,%st(1)
  movsd  (%rsi),%xmm0
  fstpl  -0x10(%rsp)
  movsd  -0x10(%rsp),%xmm3
  subsd  %xmm3,%xmm0
  movsd  %xmm0,(%rsi)
  movsd  (%rdx),%xmm1
  movapd %xmm0,%xmm5
  comisd %xmm2,%xmm0
  mulsd  %xmm0,%xmm5
  movapd %xmm1,%xmm4
  mulsd  %xmm1,%xmm4
  sbb    %r8d,%r8d
  or     $0x1,%r8d
  divsd  %xmm4,%xmm5
  movapd %xmm0,%xmm4
  divsd  %xmm1,%xmm4
  movsd  %xmm5,-0x10(%rsp)
  fldl   -0x10(%rsp)
  movsd  %xmm4,-0x10(%rsp)
  fldl   -0x10(%rsp)
  cmp    $0x1,%edi
  je     L87
  sub    $0x2,%edi
  movsd  %xmm2,-0x10(%rsp)
  mov    $0x1,%eax
  fldl   -0x10(%rsp)
  add    $0x2,%rdi
  jmp    L122
  nopl   (%rax)
L80:
  fstp   %st(0)
  fxch   %st(2)
  fmul   %st(0),%st
  mov    %ecx,%r8d
  faddp  %st,%st(1)
  fstpl  -0x10(%rsp)
  fldl   -0x10(%rsp)
  fxch   %st(2)
L53:
  mulsd  %xmm0,%xmm0
  mulsd  %xmm1,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rsp)
  faddl  -0x10(%rsp)
  jmp    L15
  nopl   (%rax)
L31:
  fxch   %st(2)
  nopw   0x0(%rax,%rax,1)
L15:
  add    $0x1,%rax
  cmp    %rax,%rdi
  je     L25
  fxch   %st(2)
L122:
  movsd  (%rsi,%rax,8),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L31
  subsd  %xmm3,%xmm0
  movsd  %xmm0,(%rsi,%rax,8)
  movsd  (%rdx,%rax,8),%xmm1
  movapd %xmm0,%xmm6
  comisd %xmm2,%xmm0
  divsd  %xmm1,%xmm6
  sbb    %ecx,%ecx
  or     $0x1,%ecx
  movsd  %xmm6,-0x10(%rsp)
  fldl   -0x10(%rsp)
  fld    %st(0)
  cmp    %r8d,%ecx
  jne    L80
  fstp   %st(1)
  faddp  %st,%st(2)
  fxch   %st(2)
  jmp    L53
  cs nopw 0x0(%rax,%rax,1)
L25:
  fxch   %st(1)
L6:
  fmul   %st(0),%st
  faddp  %st,%st(2)
  fxch   %st(1)
  fstpl  -0x10(%rsp)
  fldl   -0x10(%rsp)
  fdivp  %st,%st(1)
  fsubl  0xd70(%rip)        # 2008 <_fini+0xd50>
  fstpl  -0x10(%rsp)
  movsd  -0x10(%rsp),%xmm0
  ret
  nopl   0x0(%rax,%rax,1)
L7:
  pxor   %xmm0,%xmm0
  ret
L87:
  fldz
  fxch   %st(2)
  fxch   %st(1)
  jmp    L6
```

tool_calls: name: parse_data
arguments: data_label: D3
data_type: f64

tool: D3: 1

assistant: ```c
double doalarm(int N, double *resid, double *err) {
  double a, ave;
  long double sum1, sum2;
  int sign, i, n;
  sum1 = 0.;
  sum2 = 0.;
  for (i = 0; i < N; i++) {
    if (!isnan(resid[i]) && !isnan(err[i]) && err[i] > 0.) {
      sum1 += (long double)(resid[i] / (err[i] * err[i]));
      sum2 += (long double)(1. / (err[i] * err[i]));
    }
  }
  a = 0.;
  if (N > 0) {
    ave = sum1 / sum2;
    resid[0] -= ave;
    sum1 = resid[0] * resid[0] / (err[0] * err[0]);
    sum2 = resid[0] / err[0];
    n = 1;
    sign = ((resid[0]) >= 0 ? (1) : (-1));
    for (i = 1; i < N; i++) {
      if (!isnan(resid[i])) {
        resid[i] -= ave;
        if (((resid[i]) >= 0 ? (1) : (-1)) != sign) {
          a += (sum2 * sum2);
          sum2 = resid[i] / err[i];
          n = 1;
          sign = ((resid[i]) >= 0 ? (1) : (-1));
        } else {
          sum2 += resid[i] / err[i];
          n++;
        }
        sum1 += resid[i] * resid[i] / (err[i] * err[i]);
      }
    }
    a += (sum2 * sum2);
    a = (a / sum1) - 2.2732395;
  }
  return (a);
}
```