user: 请从给定的汇编指令推导出C源代码:

```asm
<run_sex>:
  endbr64
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  push   %rbx
  sub    $0x150,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x148(%rsp)
  xor    %eax,%eax
  lea    0x40(%rsp),%rbp
  call   <write_sex_cfg@plt>
  mov    %r12,%rdx
  lea    D34(%rip),%rsi
  mov    %rbp,%rdi
  call   <sprintf@plt>
  mov    %rbp,%rdi
  call   <system@plt>
  lea    0x30(%rsp),%rcx
  lea    0x28(%rsp),%rdx
  lea    0x20(%rsp),%rsi
  lea    0x1c(%rsp),%rdi
  lea    0x38(%rsp),%r8
  call   <get_result@plt>
  movslq 0x1c(%rsp),%rbx
  pxor   %xmm1,%xmm1
  movsd  D32(%rip),%xmm4
  movq   D59(%rip),%xmm5
  mov    %rbx,%rbp
  nopl   0x0(%rax,%rax,1)
L62:
  test   %ebp,%ebp
  jle    L168
  mov    0x30(%rsp),%rdx
  mov    0x38(%rsp),%rcx
  xor    %eax,%eax
  movapd %xmm1,%xmm6
  movapd %xmm1,%xmm3
  nopl   0x0(%rax)
L125:
  movsd  (%rdx,%rax,8),%xmm0
  comisd %xmm1,%xmm0
  jbe    L129
  addsd  (%rcx,%rax,8),%xmm3
  addsd  %xmm4,%xmm6
L129:
  add    $0x1,%rax
  cmp    %rbx,%rax
  jne    L125
  divsd  %xmm6,%xmm3
  xor    %eax,%eax
  movapd %xmm1,%xmm0
  nop
L34:
  movsd  (%rdx,%rax,8),%xmm2
  comisd %xmm1,%xmm2
  jbe    L32
  movapd %xmm3,%xmm2
  subsd  (%rcx,%rax,8),%xmm2
  mulsd  %xmm2,%xmm2
  addsd  %xmm2,%xmm0
L32:
  add    $0x1,%rax
  cmp    %rbx,%rax
  jne    L34
  subsd  %xmm4,%xmm6
  divsd  %xmm6,%xmm0
  ucomisd %xmm0,%xmm1
  ja     L13
L55:
  sqrtsd %xmm0,%xmm0
  test   %ebp,%ebp
  jle    L138
L68:
  mov    0x38(%rsp),%rsi
  mov    0x30(%rsp),%rdx
  xor    %eax,%eax
  xor    %ecx,%ecx
  nopl   0x0(%rax)
L123:
  movsd  (%rdx,%rax,8),%xmm2
  comisd %xmm1,%xmm2
  jbe    L84
  movapd %xmm0,%xmm2
  movapd %xmm3,%xmm6
  subsd  (%rsi,%rax,8),%xmm6
  addsd  %xmm0,%xmm2
  comisd %xmm2,%xmm6
  ja     L104
  xorpd  %xmm5,%xmm2
  comisd %xmm6,%xmm2
  jbe    L84
L104:
  movq   $0x0,(%rdx,%rax,8)
  add    $0x1,%ecx
L84:
  add    $0x1,%rax
  cmp    %rax,%rbx
  jne    L123
  test   %ecx,%ecx
  jne    L62
  cmp    $0xa,%ebp
  jle    L138
L89:
  mov    0x148(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L51
  add    $0x150,%rsp
  movapd %xmm3,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax,%rax,1)
L138:
  movsd  D44(%rip),%xmm3
  jmp    L89
  nopw   0x0(%rax,%rax,1)
L168:
  mov    D59(%rip),%rax
  movapd %xmm1,%xmm3
  divsd  %xmm1,%xmm3
  movq   %rax,%xmm0
  jmp    L55
L13:
  movsd  %xmm3,0x8(%rsp)
  call   <sqrt@plt>
  mov    D32(%rip),%rax
  movsd  0x8(%rsp),%xmm3
  pxor   %xmm1,%xmm1
  movq   D59(%rip),%xmm5
  movq   %rax,%xmm4
  jmp    L68
L51:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: tag: D34
type_guessed: string
name: extract_symbolic_data
arguments: tag: D32
type_guessed: f64
name: extract_symbolic_data
arguments: tag: D59
type_guessed: byte[8]
name: extract_symbolic_data
arguments: tag: D44
type_guessed: byte[8]

tool: D34: sex -c _sex.cfg %s

tool: D32: 1

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

tool: {"D44": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

assistant: ```c
double run_sex(char *fitsfile) {
  char command[256];
  int N, j, x;
  double *xx, *yy, *F, *Q;
  double S, NN, E, tt;
  write_sex_cfg();
  sprintf(command, "sex -c _sex.cfg %s", fitsfile);
  system(command);
  get_result(&N, &xx, &yy, &F, &Q);
  do {
    S = 0;
    NN = 0;
    for (x = 0; x < N; x++)
      if (F[x] > 0) {
        S += Q[x];
        NN++;
      }
    S /= NN;
    E = 0;
    for (x = 0; x < N; x++)
      if (F[x] > 0) {
        tt = S - Q[x];
        E += tt * tt;
      }
    E = sqrt(E / (NN - 1));
    j = 0;
    for (x = 0; x < N; x++) {
      tt = S - Q[x];
      if (F[x] > 0)
        if ((tt > 2 * E) || (tt < -2 * E)) {
          F[x] = 0;
          j++;
        }
    }
  } while (j);
  if (N > 10)
    return S;
  else
    return -1.0;
}
```