user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<getlsampthresh_func>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x8,%rsp
  movapd %xmm0,%xmm3
  mov    %edi,%ebp
  mov    %rsi,%r12
  mov    %rcx,%rdi
  movapd %xmm1,%xmm0
  movq   %xmm4,%r14
  movq   %xmm5,%r15
  test   %ebp,%ebp
  jle    L73
  mov    %rdx,%rsi
  mov    %ebp,%ecx
  mov    $0x0,%eax
  mov    $0x0,%ebx
  pxor   %xmm4,%xmm4
  jmp    L42
L28:
  add    $0x1,%rax
  cmp    %rax,%rcx
  je     L124
L42:
  movapd %xmm3,%xmm2
  mulsd  (%r8,%rax,8),%xmm2
  addsd  (%rsi,%rax,8),%xmm2
  movsd  %xmm2,(%r9,%rax,8)
  ucomisd %xmm2,%xmm2
  jp     L28
  movsd  (%rdi,%rax,8),%xmm2
  ucomisd %xmm2,%xmm2
  jp     L28
  comisd %xmm4,%xmm2
  seta   %dl
  movzbl %dl,%edx
  add    %edx,%ebx
  jmp    L28
L73:
  mov    $0x0,%ebx
L124:
  cmpl   $0x0,0x70(%rsp)
  je     L87
  mov    %ebp,%edx
  mov    %r9,%rsi
  mov    %r12,%rdi
  call   <ls_oneperiod@plt>
  movq   %xmm0,%r13
  movslq %ebp,%rbp
  movsd  -0x8(%r12,%rbp,8),%xmm1
  subsd  (%r12),%xmm1
  addsd  %xmm1,%xmm1
  movq   %r14,%xmm7
  divsd  %xmm7,%xmm1
  movq   %xmm1,%rbx
  movapd %xmm1,%xmm0
  call   <log10@plt>
  movq   %r13,%xmm1
  xorpd  D27(%rip),%xmm1
  movapd %xmm1,%xmm0
  mulsd  D24(%rip),%xmm0
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  addsd  %xmm2,%xmm0
  comisd D29(%rip),%xmm0
  ja     L82
L99:
  movq   %r15,%xmm6
  subsd  %xmm6,%xmm0
  add    $0x8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L87:
  mov    %ebp,%ecx
  mov    %rdi,%rdx
  mov    %r9,%rsi
  mov    %r12,%rdi
  call   <gls_oneperiod@plt>
  movq   %xmm0,%r13
  movslq %ebp,%rbp
  movsd  -0x8(%r12,%rbp,8),%xmm0
  subsd  (%r12),%xmm0
  addsd  %xmm0,%xmm0
  movq   %r14,%xmm7
  divsd  %xmm7,%xmm0
  movq   %xmm0,%rbp
  call   <log10@plt>
  mov    %eax,%r12d
  movq   %r13,%xmm6
  ucomisd D46(%rip),%xmm6
  jp     L58
  pxor   %xmm0,%xmm0
  je     L99
L58:
  lea    -0x3(%rbx),%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  mov    $0x3,%r14d
  sub    %ebx,%r14d
  movsd  D122(%rip),%xmm1
  movapd %xmm1,%xmm3
  movq   %r13,%xmm7
  subsd  %xmm7,%xmm3
  movq   %r13,%xmm0
  divsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  D107(%rip),%xmm0
  addsd  %xmm0,%xmm0
  divsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  movq   %xmm0,%rbx
  call   <log10@plt>
  imul   %r14d,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mulsd  D107(%rip),%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %r12d,%xmm1
  addsd  %xmm1,%xmm0
  comisd D29(%rip),%xmm0
  jbe    L99
  pxor   %xmm1,%xmm1
  cvtsi2sd %r14d,%xmm1
  mulsd  D107(%rip),%xmm1
  movq   %rbx,%xmm0
  call   <pow@plt>
  movapd %xmm0,%xmm1
  movsd  D122(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movq   %rbp,%xmm1
  call   <pow@plt>
  movapd %xmm0,%xmm1
  movsd  D122(%rip),%xmm0
  subsd  %xmm1,%xmm0
  call   <log10@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  jmp    L99
L82:
  movapd %xmm1,%xmm0
  call   <exp@plt>
  movapd %xmm0,%xmm1
  movsd  D122(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movq   %rbx,%xmm1
  call   <pow@plt>
  movapd %xmm0,%xmm1
  movsd  D122(%rip),%xmm0
  subsd  %xmm1,%xmm0
  call   <log10@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  jmp    L99
```

tool_calls: name: parse_data
arguments: data_label: D27
type: f32[4]
name: parse_data
arguments: data_label: D24
type: f64
name: parse_data
arguments: data_label: D29
type: f32[4]
name: parse_data
arguments: data_label: D46
type: f32[2]
name: parse_data
arguments: data_label: D122
type: f64
name: parse_data
arguments: data_label: D107
type: f32[2]

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

tool: D24: 0.434294482

tool: {"D29": [0.0,-2.0,0.0,1.875]}

tool: {"D46": [0.0,0.0]}

tool: D122: 1

tool: {"D107": [0.0,1.75]}

assistant: ```c
double getlsampthresh_func(double amp_scale, int N, double *t, double *mag_orig, double *sig, double *mag_signal, double *mag_tmp, double period, int Nsubharm, int Nharm, double *subharmA, double *subharmB, double *harmA, double *harmB, double fundA, double fundB, double minPer, double thresh, int use_orig_ls) {
  int i, ngood = 0;
  double val, T, effm, expy, outprob, zval;
  for (i = 0; i < N; i++) {
    mag_tmp[i] = mag_orig[i] + amp_scale * mag_signal[i];
    if (!isnan(mag_tmp[i]) && !isnan(sig[i]) && sig[i] > 0)
      ngood++;
  }
  if (use_orig_ls) {
    val = ls_oneperiod(t, mag_tmp, N, period);
  } else {
    val = gls_oneperiod(t, mag_tmp, sig, N, period);
  }
  T = t[N - 1] - t[0];
  effm = log10(2.0 * T / minPer);
  if (use_orig_ls) {
    expy = -val * 0.434294482;
    outprob = effm + expy;
    if (outprob > -2.0) {
      expy = exp(-val);
      outprob = 1.0 - pow(1.0 - expy, 2.0 * T / minPer);
      outprob = log10(outprob);
    }
  } else {
    if (val == 0.)
      outprob = 0.0;
    else {
      zval = (ngood - 3) * (val / (1.0 - val)) / 2.0;
      expy = -(ngood - 3) * log10((1.0 + (2.0 * zval) / (ngood - 3))) / 2.0;
      outprob = effm + expy;
      if (outprob > -2.0) {
        expy = pow(((1.0 + (2.0 * zval) / (ngood - 3))), (-(ngood - 3) / 2.0));
        outprob = 1.0 - pow(1.0 - expy, 2.0 * T / minPer);
        outprob = log10(outprob);
      }
    }
  }
  return (outprob - thresh);
}
```