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

```asm
<optimize_px>:
  endbr64
  push   %rbp
  movslq %edi,%r11
  mov    %esi,%eax
  movapd %xmm0,%xmm12
  mov    %rsp,%rbp
  push   %r15
  lea    0x0(,%r11,8),%r15
  push   %r14
  mov    %r8,%r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbx
  sub    $0x98,%rsp
  mov    0x10(%rbp),%rdx
  mov    0x18(%rbp),%rsi
  mov    %edi,-0x44(%rbp)
  mov    %rcx,-0x90(%rbp)
  movsd  0x8(%rdx),%xmm5
  movsd  (%rdx),%xmm7
  mov    %r11,%rdx
  mov    %rsi,-0x70(%rbp)
  imul   %r11,%rdx
  mov    %r9,-0x60(%rbp)
  mov    %rsp,%rsi
  mov    %fs:0x28,%rcx
  mov    %rcx,-0x38(%rbp)
  xor    %ecx,%ecx
  lea    0xf(,%rdx,8),%rcx
  movsd  %xmm5,-0x78(%rbp)
  mov    %rcx,%rdx
  and    $0xfffffffffffff000,%rcx
  sub    %rcx,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L247
L286:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L286
L247:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L159
L6:
  lea    0xf(%r15),%rcx
  mov    %rsp,%rsi
  mov    %rsp,%r12
  mov    %rcx,%rdx
  and    $0xfffffffffffff000,%rcx
  sub    %rcx,%rsi
  and    $0xfffffffffffffff0,%rdx
  cmp    %rsi,%rsp
  je     L10
L180:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rsi,%rsp
  jne    L180
L10:
  and    $0xfff,%edx
  sub    %rdx,%rsp
  test   %rdx,%rdx
  jne    L16
L307:
  pxor   %xmm9,%xmm9
  movapd %xmm1,%xmm5
  mov    -0x44(%rbp),%edx
  mov    %r15,%r9
  cvtsi2sd %eax,%xmm9
  mov    %rsp,%rbx
  shr    $0x3,%r9
  xor    %r10d,%r10d
  movsd  D56(%rip),%xmm0
  movsd  D59(%rip),%xmm13
  divsd  %xmm9,%xmm0
  divsd  %xmm9,%xmm5
  subsd  %xmm0,%xmm13
  movsd  D59(%rip),%xmm0
  addsd  %xmm5,%xmm0
  movsd  %xmm5,-0x50(%rbp)
  divsd  %xmm0,%xmm13
  movsd  %xmm13,-0x58(%rbp)
  test   %edx,%edx
  jle    L121
L56:
  mov    %r10d,%edx
  movslq %r10d,%rcx
L211:
  movslq %edx,%rax
  add    $0x1,%edx
  imul   %r9,%rax
  add    %rcx,%rax
  movq   $0x0,(%r12,%rax,8)
  cmp    %edx,-0x44(%rbp)
  jg     L211
  lea    0x1(%r10),%ecx
  cmp    %ecx,-0x44(%rbp)
  je     L272
  mov    %ecx,%r10d
  jmp    L56
L159:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L6
L121:
  movsd  -0x78(%rbp),%xmm0
  mov    %r11,-0xa0(%rbp)
  mov    %r9,-0x90(%rbp)
  divsd  %xmm7,%xmm0
  movsd  %xmm7,-0x80(%rbp)
  movsd  %xmm12,-0x98(%rbp)
  movsd  %xmm9,-0x88(%rbp)
  call   <log@plt>
  mov    %eax,%edx
  cltq
  imul   $0x51eb851f,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x24,%rax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <exp@plt>
  xor    %r8d,%r8d
  mov    %r12,%rax
  pxor   %xmm8,%xmm8
  movapd %xmm0,%xmm14
  pxor   %xmm0,%xmm0
  movsd  -0x88(%rbp),%xmm9
  movsd  D59(%rip),%xmm13
  cvtsi2sdl -0x44(%rbp),%xmm0
  mov    -0x90(%rbp),%r9
  movsd  -0x80(%rbp),%xmm7
  mov    %r8d,%r12d
  mov    -0xa0(%rbp),%r11
  mov    %r14,%r8
  movapd %xmm8,%xmm10
  mov    %r13,%r14
  movsd  -0x98(%rbp),%xmm12
  add    $0x1,%r9
  mov    %rax,%r13
  movsd  %xmm12,-0x90(%rbp)
  addsd  %xmm0,%xmm0
  divsd  %xmm9,%xmm0
  subsd  %xmm0,%xmm13
  movsd  %xmm13,-0x88(%rbp)
L257:
  movsd  -0x88(%rbp),%xmm12
  mov    $0x33,%r10d
  movsd  -0x90(%rbp),%xmm13
  nopw   0x0(%rax,%rax,1)
L215:
  mov    -0x44(%rbp),%eax
  test   %eax,%eax
  jle    L71
  mov    -0x60(%rbp),%rax
  movapd %xmm7,%xmm11
  movapd %xmm7,%xmm15
  xor    %esi,%esi
  addsd  %xmm7,%xmm15
  mov    %r13,%rcx
  movapd %xmm12,%xmm5
  subsd  (%rax),%xmm11
  movapd %xmm8,%xmm0
  movapd %xmm8,%xmm4
  movapd %xmm8,%xmm6
  mulsd  %xmm9,%xmm11
  nopl   0x0(%rax)
L258:
  movsd  (%r8,%rsi,8),%xmm3
  movapd %xmm15,%xmm1
  movslq %esi,%rax
  mov    %esi,%r12d
  imul   %r9,%rax
  addsd  %xmm11,%xmm3
  divsd  %xmm3,%xmm1
  addsd  %xmm1,%xmm5
  movsd  (%r14,%rsi,8),%xmm1
  movapd %xmm1,%xmm2
  divsd  %xmm3,%xmm2
  mulsd  %xmm2,%xmm1
  movsd  %xmm2,(%rbx,%rsi,8)
  addsd  %xmm1,%xmm6
  divsd  %xmm3,%xmm1
  addsd  %xmm1,%xmm4
  movsd  0x0(%r13,%rax,8),%xmm1
  mulsd  %xmm2,%xmm1
  mulsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm0
  test   %rsi,%rsi
  je     L278
  addsd  %xmm2,%xmm2
  lea    -0x1(%rsi),%edx
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L87:
  movsd  (%rcx,%rax,8),%xmm1
  mov    %rax,%rdi
  mulsd  %xmm2,%xmm1
  mulsd  (%rbx,%rax,8),%xmm1
  add    $0x1,%rax
  addsd  %xmm1,%xmm0
  cmp    %rdi,%rdx
  jne    L87
L198:
  add    $0x1,%rsi
  add    %r15,%rcx
  cmp    %rsi,%r11
  jne    L258
  movapd %xmm13,%xmm1
  subsd  %xmm6,%xmm1
L43:
  movapd %xmm9,%xmm2
  mulsd  %xmm4,%xmm2
  divsd  %xmm0,%xmm4
  movapd %xmm13,%xmm0
  mulsd  %xmm7,%xmm2
  subsd  %xmm2,%xmm1
  mulsd  -0x50(%rbp),%xmm4
  addsd  D59(%rip),%xmm4
  mulsd  %xmm4,%xmm1
  mulsd  -0x58(%rbp),%xmm1
  divsd  %xmm5,%xmm1
  subsd  %xmm1,%xmm0
  comisd %xmm10,%xmm0
  jbe    L281
  comisd %xmm8,%xmm5
  jbe    L281
  mov    -0x70(%rbp),%rax
  movapd %xmm0,%xmm10
  movsd  %xmm7,-0x68(%rbp)
  movsd  %xmm5,(%rax)
L281:
  mulsd  %xmm14,%xmm7
  sub    $0x1,%r10d
  jne    L215
  movsd  -0x68(%rbp),%xmm5
  movsd  %xmm7,-0xb8(%rbp)
  mov    %r8,-0xb0(%rbp)
  movapd %xmm5,%xmm7
  mov    %r11,-0xa8(%rbp)
  subsd  D21(%rip),%xmm7
  comisd -0x80(%rbp),%xmm7
  mov    %r9,-0xa0(%rbp)
  movsd  %xmm9,-0xc0(%rbp)
  jbe    L25
  movapd %xmm5,%xmm7
  movsd  D21(%rip),%xmm0
  movsd  -0x78(%rbp),%xmm6
  divsd  %xmm14,%xmm7
  addsd  %xmm5,%xmm0
  comisd %xmm0,%xmm6
  movsd  %xmm7,-0x80(%rbp)
  jbe    L25
  mulsd  %xmm5,%xmm14
  add    $0x1,%r12d
  movsd  %xmm10,-0x98(%rbp)
  movapd %xmm14,%xmm0
  movsd  %xmm14,-0x78(%rbp)
  divsd  %xmm7,%xmm0
  call   <log@plt>
  mov    %eax,%edx
  cltq
  imul   $0x51eb851f,%rax,%rax
  sar    $0x1f,%edx
  sar    $0x24,%rax
  sub    %edx,%eax
  mov    %eax,%edi
  call   <exp@plt>
  cmp    $0x2,%r12d
  movsd  -0x98(%rbp),%xmm10
  mov    -0xa0(%rbp),%r9
  mov    -0xa8(%rbp),%r11
  mov    -0xb0(%rbp),%r8
  movapd %xmm0,%xmm14
  pxor   %xmm8,%xmm8
  movsd  -0xb8(%rbp),%xmm7
  movsd  -0xc0(%rbp),%xmm9
  jle    L257
L25:
  mov    -0x60(%rbp),%rax
  movsd  -0x68(%rbp),%xmm7
  movsd  %xmm7,(%rax)
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L140
  lea    -0x28(%rbp),%rsp
  movapd %xmm10,%xmm0
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   0x0(%rax)
L278:
  xor    %r12d,%r12d
  jmp    L198
L71:
  movapd %xmm13,%xmm1
  movapd %xmm12,%xmm5
  movapd %xmm8,%xmm0
  movapd %xmm8,%xmm4
  jmp    L43
L272:
  movslq -0x44(%rbp),%rax
  movl   $0x0,-0x80(%rbp)
  movl   $0x0,-0x88(%rbp)
  mov    %eax,%edx
  mov    %rax,-0xa0(%rbp)
  sar    %edx
  mov    %edx,-0x98(%rbp)
L126:
  mov    -0x88(%rbp),%eax
  pxor   %xmm1,%xmm1
  xor    %r8d,%r8d
  cltd
  idivl  -0x98(%rbp)
  movslq -0x80(%rbp),%rax
  cvtsi2sd %edx,%xmm1
  addsd  D59(%rip),%xmm1
  mov    -0x90(%rbp),%rdx
  lea    (%rdx,%rax,8),%rdi
  mulsd  %xmm1,%xmm1
  mulsd  %xmm1,%xmm1
L273:
  movslq %r8d,%rsi
  cmp    %r8d,%ecx
  jle    L61
  mov    -0x80(%rbp),%eax
  mov    -0x90(%rbp),%rdx
  add    %r8d,%eax
  cltq
  movsd  (%rdx,%rax,8),%xmm2
  mov    %r8,%rdx
  movapd %xmm2,%xmm0
  jmp    L132
  nopl   0x0(%rax,%rax,1)
L176:
  movsd  (%rdi,%rdx,8),%xmm0
L132:
  mulsd  %xmm2,%xmm0
  movslq %edx,%rax
  add    $0x1,%rdx
  imul   %r9,%rax
  add    %rsi,%rax
  divsd  %xmm1,%xmm0
  addsd  (%r12,%rax,8),%xmm0
  movsd  %xmm0,(%r12,%rax,8)
  cmp    %edx,%ecx
  jg     L176
L61:
  add    $0x1,%r8
  cmp    %r8,-0xa0(%rbp)
  jne    L273
  mov    -0x88(%rbp),%edx
  mov    -0x44(%rbp),%edi
  add    %edi,-0x80(%rbp)
  lea    0x1(%rdx),%eax
  cmp    %r10d,%edx
  je     L121
  mov    %eax,-0x88(%rbp)
  jmp    L126
L16:
  orq    $0x0,-0x8(%rsp,%rdx,1)
  jmp    L307
L140:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: label: D56
type_guessed: f64
name: unpack_data
arguments: label: D59
type_guessed: f64
name: unpack_data
arguments: label: D21
type_guessed: byte[8]

tool: D56: 3

tool: D59: 1

tool: {"D21": [0xf1,0x68,0xe3,0x88,0xb5,0xf8,0xe4,0x3e]}

assistant: ```c
double optimize_px(int n, int numt, double p[], double hat_hat[], double eigs[], double *lambda0, double *lambda0_range, double chi0, double tc, double *Trace) {
  int i, j, k, niter = 50;
  double px, lambda, dlambda, lambda_best, eigs1, px_max = 0., start = lambda0_range[0], stop = lambda0_range[1];
  double m[n][n], s1, s2, s3, sum, v[n], tcn = tc / numt, Tr, Tr0 = (1 - 3. / numt) / (1. + tcn);
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++)
      m[j][i] = 0.;
  }
  for (k = 0; k < n; k++) {
    s1 = 1. + (k % (n / 2));
    s1 *= s1;
    s1 *= s1;
    for (i = 0; i < n; i++) {
      for (j = i; j < n; j++)
        m[j][i] += hat_hat[i + k * n] * hat_hat[j + k * n] / s1;
    }
  }
  lambda = start;
  dlambda = exp(log(stop / start) / niter);
  for (k = 0; k < 3; k++) {
    for (j = 0; j <= niter; j++) {
      Tr = 1 - 2. * n / numt;
      px = chi0;
      s1 = 0;
      s2 = 0, s3 = 0;
      for (i = 0; i < n; i++) {
        eigs1 = eigs[i] + numt * (lambda - (*lambda0));
        Tr += 2. * lambda / eigs1;
        s1 += p[i] * (v[i] = p[i] / eigs1);
        s2 += p[i] * v[i] / eigs1;
        s3 += v[i] * m[i][i] * v[i];
        for (k = 0; k < i; k++)
          s3 += 2. * v[i] * m[i][k] * v[k];
      }
      px = chi0 - (chi0 - s1 - s2 * numt * lambda) * (1. + tcn * (s2 / s3)) * Tr0 / Tr;
      if (px > px_max && Tr > 0) {
        px_max = px;
        lambda_best = lambda;
        *Trace = Tr;
      }
      lambda *= dlambda;
    }
    if (lambda_best - 1.e-5 > start)
      start = lambda_best / dlambda;
    else
      break;
    if (lambda_best + 1.e-5 < stop)
      stop = lambda_best * dlambda;
    else
      break;
    dlambda = exp(log(stop / start) / niter);
  }
  *lambda0 = lambda_best;
  return px_max;
}
```