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

```asm
<getJstet>:
  endbr64
  push   %r15
  push   %r14
  mov    %edi,%r14d
  push   %r13
  mov    %r9,%r13
  push   %r12
  mov    %r8,%r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x68,%rsp
  mov    0xa0(%rsp),%rax
  mov    %rsi,0x40(%rsp)
  movsd  %xmm0,(%rsp)
  mov    %rax,0x8(%rsp)
  mov    0xa8(%rsp),%rax
  movsd  %xmm1,0x18(%rsp)
  mov    %rax,0x20(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  mov    %edi,%eax
  shl    $0x4,%eax
  mov    %eax,%edi
  mov    %eax,0x10(%rsp)
  call   <malloc@plt>
  mov    %rax,%r15
  test   %r14d,%r14d
  jle    L11
  cmp    $0x1,%r14d
  je     L160
  mov    %r14d,%edx
  movapd D108(%rip),%xmm0
  shr    %edx
  shl    $0x4,%rdx
  add    %rax,%rdx
  nop
L211:
  movups %xmm0,(%rax)
  add    $0x10,%rax
  cmp    %rax,%rdx
  jne    L211
  mov    %r14d,%eax
  and    $0xfffffffe,%eax
  test   $0x1,%r14b
  je     L11
L144:
  mov    D108(%rip),%rsi
  cltq
  mov    %rsi,(%r15,%rax,8)
L11:
  mov    %r12,%r8
  mov    %r15,%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r14d,%edi
  call   <w_ave@plt>
  lea    0x50(%rsp),%r8
  mov    %r13,0x28(%rsp)
  mov    %r12,%r13
  mov    %r8,%r12
  nopl   0x0(%rax)
L189:
  mov    %r12,%r8
  mov    %r15,%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r14d,%edi
  call   <w_ave@plt>
  movsd  0x50(%rsp),%xmm1
  movsd  0x0(%r13),%xmm0
  pxor   %xmm3,%xmm3
  subsd  %xmm1,%xmm0
  comisd %xmm3,%xmm0
  ja     L83
  xorpd  D99(%rip),%xmm0
L83:
  comisd D40(%rip),%xmm0
  movsd  %xmm1,0x0(%r13)
  ja     L189
  mov    %r15,%rdi
  mov    %r13,%r12
  mov    0x28(%rsp),%r13
  call   <free@plt>
  pxor   %xmm4,%xmm4
  lea    -0x1(%r14),%r10d
  pxor   %xmm1,%xmm1
  cvtsi2sd %r14d,%xmm4
  pxor   %xmm3,%xmm3
  cvtsi2sd %r10d,%xmm1
  movapd %xmm4,%xmm0
  divsd  %xmm1,%xmm0
  ucomisd %xmm0,%xmm3
  ja     L268
  sqrtsd %xmm0,%xmm0
L123:
  mov    0x10(%rsp),%r15d
  mov    %r10d,0x38(%rsp)
  movsd  %xmm4,0x30(%rsp)
  mov    %r15d,%edi
  movsd  %xmm0,0x48(%rsp)
  call   <malloc@plt>
  mov    %r15d,%edi
  mov    %rax,0x28(%rsp)
  call   <malloc@plt>
  mov    %r15d,%edi
  mov    %rax,0x10(%rsp)
  call   <malloc@plt>
  test   %r14d,%r14d
  mov    0x10(%rsp),%r8
  mov    0x28(%rsp),%r9
  movsd  0x30(%rsp),%xmm4
  mov    0x38(%rsp),%r10d
  mov    %rax,%r15
  pxor   %xmm3,%xmm3
  jle    L117
  mov    %r14d,%edx
  mov    %r9,%rsi
  mov    %rbx,%rdi
  mov    %rbp,%r11
  movsd  0x48(%rsp),%xmm0
  lea    (%r9,%rdx,8),%rcx
  mov    %r9,%rax
  mov    %r9,%rdx
  neg    %rsi
  sub    %r9,%rdi
  sub    %r9,%r11
  nopl   0x0(%rax,%rax,1)
L250:
  movsd  (%rdi,%rdx,1),%xmm1
  ucomisd %xmm1,%xmm1
  jp     L295
  movsd  (%r11,%rdx,1),%xmm2
  ucomisd %xmm2,%xmm2
  jp     L295
  subsd  (%r12),%xmm1
  mulsd  %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  %xmm1,(%rdx)
L295:
  add    $0x8,%rdx
  cmp    %rdx,%rcx
  jne    L250
  mov    0x8(%rsp),%r11
  movq   D99(%rip),%xmm5
  movapd %xmm3,%xmm2
  movapd %xmm3,%xmm0
  lea    0x0(%rbp,%rsi,1),%rdx
  movq   $0x0,(%r11)
  mov    %r11,%rsi
  cs nopw 0x0(%rax,%rax,1)
L88:
  movsd  (%rdi,%rax,1),%xmm1
  ucomisd %xmm1,%xmm1
  jp     L325
  movsd  (%rdx,%rax,1),%xmm1
  ucomisd %xmm1,%xmm1
  jp     L325
  movsd  (%rax),%xmm1
  comisd %xmm3,%xmm1
  ja     L9
  xorpd  %xmm5,%xmm1
L9:
  addsd  %xmm1,%xmm2
  movsd  %xmm2,(%rsi)
  movsd  (%rax),%xmm1
  mulsd  %xmm1,%xmm1
  addsd  %xmm1,%xmm0
L325:
  add    $0x8,%rax
  cmp    %rax,%rcx
  jne    L88
L277:
  divsd  %xmm4,%xmm0
  divsd  %xmm4,%xmm2
  ucomisd %xmm0,%xmm3
  ja     L283
  sqrtsd %xmm0,%xmm0
L307:
  mulsd  D10(%rip),%xmm0
  mov    0x8(%rsp),%rax
  divsd  %xmm0,%xmm2
  movsd  %xmm2,(%rax)
  test   %r10d,%r10d
  jle    L302
  mov    0x40(%rsp),%rsi
  lea    -0x2(%r14),%eax
  xor    %r12d,%r12d
  xor    %edx,%edx
  movsd  D108(%rip),%xmm2
  lea    0x8(%r9,%rax,8),%rcx
  sub    %r9,%rbx
  mov    %r9,%rax
  movsd  D117(%rip),%xmm5
  movq   D99(%rip),%xmm4
  sub    %r9,%rbp
  sub    %r9,%rsi
  nopl   0x0(%rax)
L237:
  movsd  (%rbx,%rax,1),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L298
  movsd  0x8(%rbx,%rax,1),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L298
  movsd  0x0(%rbp,%rax,1),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L298
  movsd  0x8(%rbp,%rax,1),%xmm0
  ucomisd %xmm0,%xmm0
  jp     L298
  movsd  0x8(%rsi,%rax,1),%xmm0
  subsd  (%rsi,%rax,1),%xmm0
  comisd %xmm3,%xmm0
  ja     L201
  xorpd  %xmm4,%xmm0
L201:
  comisd (%rsp),%xmm0
  jbe    L167
  test   %edx,%edx
  jne    L147
  movsd  (%rax),%xmm1
  movslq %r12d,%rdx
  add    $0x1,%r12d
  mulsd  %xmm1,%xmm1
  subsd  %xmm2,%xmm1
  movsd  %xmm1,(%r8,%rdx,8)
  movsd  %xmm5,(%r15,%rdx,8)
L147:
  xor    %edx,%edx
L167:
  movsd  (%rsp),%xmm7
  comisd %xmm0,%xmm7
  jb     L298
  movsd  0x8(%rax),%xmm0
  mulsd  (%rax),%xmm0
  movslq %r12d,%rdx
  add    $0x1,%r12d
  movsd  %xmm0,(%r8,%rdx,8)
  movsd  %xmm2,(%r15,%rdx,8)
  mov    $0x1,%edx
L298:
  add    $0x8,%rax
  cmp    %rax,%rcx
  jne    L237
  test   %edx,%edx
  je     L42
  movq   $0x0,0x0(%r13)
  test   %r12d,%r12d
  je     L92
L45:
  movq   D99(%rip),%xmm5
  mov    %r8,%rbx
  xor    %ebp,%ebp
  mov    %r9,%r14
  movapd %xmm3,%xmm4
  xchg   %ax,%ax
L197:
  movsd  (%rbx),%xmm1
  comisd %xmm3,%xmm1
  movapd %xmm1,%xmm2
  ja     L7
  xorpd  %xmm5,%xmm2
L7:
  divsd  %xmm2,%xmm1
  ucomisd %xmm2,%xmm3
  ja     L15
  sqrtsd %xmm2,%xmm2
L306:
  mulsd  %xmm2,%xmm1
  mov    %r15,%rax
  add    $0x1,%ebp
  sub    %r8,%rax
  add    %rbx,%rax
  add    $0x8,%rbx
  mulsd  (%rax),%xmm1
  addsd  0x0(%r13),%xmm1
  movsd  %xmm1,0x0(%r13)
  addsd  (%rax),%xmm4
  cmp    %r12d,%ebp
  jl     L197
  mov    %r14,%r9
  movapd %xmm1,%xmm0
L372:
  mov    0x8(%rsp),%rax
  movsd  0x18(%rsp),%xmm5
  mov    %r9,%rdi
  mov    %r8,(%rsp)
  divsd  %xmm4,%xmm0
  movsd  %xmm0,0x0(%r13)
  mulsd  (%rax),%xmm0
  mov    0x20(%rsp),%rax
  mulsd  %xmm4,%xmm0
  divsd  %xmm5,%xmm0
  movsd  %xmm0,(%rax)
  mulsd  0x0(%r13),%xmm4
  divsd  %xmm5,%xmm4
  movsd  %xmm4,0x0(%r13)
  call   <free@plt>
  mov    (%rsp),%rdi
  call   <free@plt>
  mov    %r15,%rdi
  call   <free@plt>
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L35
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L42:
  movslq %r12d,%rax
  add    $0x1,%r12d
  shl    $0x3,%rax
  lea    (%r8,%rax,1),%rdx
  add    %r15,%rax
L223:
  movslq %r14d,%r10
  mov    D117(%rip),%rdi
  movsd  -0x8(%r9,%r10,8),%xmm0
  mulsd  %xmm0,%xmm0
  subsd  D108(%rip),%xmm0
  movsd  %xmm0,(%rdx)
  mov    %rdi,(%rax)
  movq   $0x0,0x0(%r13)
  jmp    L45
  nopl   0x0(%rax,%rax,1)
L92:
  movapd %xmm3,%xmm0
  movapd %xmm3,%xmm4
  jmp    L372
  nopl   (%rax)
L117:
  movapd %xmm3,%xmm2
  movapd %xmm3,%xmm0
  jmp    L277
  nopl   (%rax)
L302:
  mov    %r15,%rax
  mov    %r8,%rdx
  mov    $0x1,%r12d
  jmp    L223
L160:
  xor    %eax,%eax
  jmp    L144
L15:
  movapd %xmm2,%xmm0
  mov    %r8,0x28(%rsp)
  movsd  %xmm4,0x10(%rsp)
  movsd  %xmm1,(%rsp)
  call   <sqrt@plt>
  mov    0x28(%rsp),%r8
  movsd  0x10(%rsp),%xmm4
  pxor   %xmm3,%xmm3
  movq   D99(%rip),%xmm5
  movsd  (%rsp),%xmm1
  movapd %xmm0,%xmm2
  jmp    L306
L283:
  mov    %r8,0x30(%rsp)
  mov    %r9,0x28(%rsp)
  mov    %r10d,0x10(%rsp)
  movsd  %xmm2,0x38(%rsp)
  call   <sqrt@plt>
  movsd  0x38(%rsp),%xmm2
  mov    0x30(%rsp),%r8
  pxor   %xmm3,%xmm3
  mov    0x28(%rsp),%r9
  mov    0x10(%rsp),%r10d
  jmp    L307
L268:
  mov    %r10d,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  call   <sqrt@plt>
  mov    0x30(%rsp),%r10d
  movsd  0x28(%rsp),%xmm4
  jmp    L123
L35:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D108
data_type: f64[2]
name: retrieve_data
arguments: tag: D99
data_type: f32[4]
name: retrieve_data
arguments: tag: D40
data_type: f64[2]
name: retrieve_data
arguments: tag: D10
data_type: f64
name: retrieve_data
arguments: tag: D117
data_type: f64

tool: {"D108": [1.0,1.0]}

tool: {"D99": [0.0,-0.0,0.0,0.0]}

tool: {"D40": [0.00001,0.798]}

tool: D10: 0.798

tool: D117: 0.1

assistant: ```c
void getJstet(int ngood, double tmin, double wkmax, double *time, double *mag, double *sig, double *wtave, double *jst, double *kur, double *lst) {
  int i, j, flag = 0, npair = 0;
  double dt, wave = 0.0, sigma = 0.0, *ws, wtave1, delta, *delt, *pk, *wk, dumval, s = 0.0, weight;
  for (i = 0; i < ngood; i++) {
    if (!isnan(mag[i]) && !isnan(sig[i])) {
      sigma += 1.0 / (sig[i] * sig[i]);
      wave += mag[i] / (sig[i] * sig[i]);
    }
  }
  wave /= sigma;
  ws = (double *)malloc(2 * ngood * sizeof(double));
  for (i = 0; i < ngood; i++)
    ws[i] = 1.0;
  w_ave(ngood, mag, sig, ws, wtave);
  do {
    w_ave(ngood, mag, sig, ws, &wtave1);
    delta = ((*wtave - wtave1) > 0 ? (*wtave - wtave1) : -(*wtave - wtave1));
    *wtave = wtave1;
  } while (delta > 0.00001);
  free(ws);
  dumval = sqrt((double)ngood / (double)(ngood - 1));
  delt = (double *)malloc(2 * ngood * sizeof(double));
  pk = (double *)malloc(2 * ngood * sizeof(double));
  wk = (double *)malloc(2 * ngood * sizeof(double));
  for (j = 0; j < ngood; j++)
    if (!isnan(mag[j]) && !isnan(sig[j]))
      delt[j] = dumval * (mag[j] - *wtave) / sig[j];
  *kur = 0.0;
  for (j = 0; j < ngood; j++) {
    if (!isnan(mag[j]) && !isnan(sig[j])) {
      *kur += ((delt[j]) > 0 ? (delt[j]) : -(delt[j]));
      s += (delt[j] * delt[j]);
    }
  }
  *kur /= (double)ngood;
  s = 0.798 * sqrt(s / (double)ngood);
  *kur /= s;
  flag = 0;
  for (j = 0; j < ngood - 1; j++) {
    if (!isnan(mag[j]) && !isnan(mag[j + 1]) && !isnan(sig[j]) && !isnan(sig[j + 1])) {
      dt = ((time[j + 1] - time[j]) > 0 ? (time[j + 1] - time[j]) : -(time[j + 1] - time[j]));
      if (dt > tmin && !flag) {
        pk[npair] = (delt[j] * delt[j]) - 1.0;
        wk[npair] = 0.1;
        npair++;
        flag = 0;
      }
      if (dt > tmin && flag)
        flag = 0;
      if (dt <= tmin) {
        pk[npair] = delt[j + 1] * delt[j];
        wk[npair] = 1.0;
        npair++;
        flag = 1;
      }
    }
  }
  if (!flag) {
    pk[npair] = (delt[ngood - 1] * delt[ngood - 1]) - 1.0;
    wk[npair] = 0.1;
    npair++;
  }
  weight = 0.0;
  *jst = 0.0;
  for (j = 0; j < npair; j++) {
    s = pk[j] / ((pk[j]) > 0 ? (pk[j]) : -(pk[j])) * sqrt(((pk[j]) > 0 ? (pk[j]) : -(pk[j])));
    *jst += wk[j] * s;
    weight += wk[j];
  }
  *jst /= weight;
  *lst = (*jst) * (*kur) * weight / wkmax;
  *jst = (*jst) * weight / wkmax;
  free(delt);
  free(pk);
  free(wk);
}
```