user: Converte this assembly snippet into its equivalent C code:

```asm
<math_find_minimum_brent>:
  endbr64
  push   %r15
  movapd %xmm0,%xmm6
  push   %r14
  mov    %r9,%r14
  push   %r13
  mov    %r8,%r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %ecx,%ebx
  sub    $0x68,%rsp
  test   %rdx,%rdx
  je     L241
  movsd  (%rdx),%xmm8
L305:
  subsd  %xmm6,%xmm2
  movq   D96(%rip),%xmm5
  movapd %xmm8,%xmm7
  andpd  %xmm5,%xmm2
  mulsd  %xmm3,%xmm2
  movsd  %xmm2,0x58(%rsp)
  test   %ebx,%ebx
  jle    L369
  pxor   %xmm4,%xmm4
  movapd %xmm1,%xmm9
  movapd %xmm1,%xmm3
  xor    %r15d,%r15d
  movsd  %xmm8,0x48(%rsp)
  movapd %xmm4,%xmm10
  movsd  %xmm1,0x50(%rsp)
  movsd  %xmm8,(%rsp)
  nopl   0x0(%rax)
L387:
  movapd %xmm3,%xmm0
  movapd %xmm6,%xmm13
  movapd %xmm1,%xmm12
  andpd  %xmm5,%xmm0
  addsd  %xmm1,%xmm13
  subsd  %xmm6,%xmm12
  mulsd  0x58(%rsp),%xmm0
  movapd %xmm3,%xmm2
  addsd  D71(%rip),%xmm0
  mulsd  D18(%rip),%xmm13
  mulsd  D18(%rip),%xmm12
  movapd %xmm0,%xmm11
  addsd  %xmm0,%xmm11
  subsd  %xmm13,%xmm2
  movapd %xmm11,%xmm14
  subsd  %xmm12,%xmm14
  andpd  %xmm5,%xmm2
  comisd %xmm2,%xmm14
  jae    L201
  movapd %xmm4,%xmm2
  andpd  %xmm5,%xmm2
  comisd %xmm0,%xmm2
  jbe    L248
  movapd %xmm3,%xmm8
  movapd %xmm7,%xmm15
  movapd %xmm7,%xmm12
  subsd  %xmm9,%xmm8
  subsd  (%rsp),%xmm12
  movapd %xmm3,%xmm2
  subsd  0x48(%rsp),%xmm15
  subsd  0x50(%rsp),%xmm2
  pxor   %xmm14,%xmm14
  mulsd  %xmm8,%xmm15
  mulsd  %xmm2,%xmm12
  mulsd  %xmm15,%xmm8
  mulsd  %xmm12,%xmm2
  subsd  %xmm15,%xmm12
  addsd  %xmm12,%xmm12
  subsd  %xmm8,%xmm2
  comisd %xmm14,%xmm12
  jbe    L130
  xorpd  D88(%rip),%xmm2
L130:
  movsd  D18(%rip),%xmm8
  movapd %xmm2,%xmm15
  andpd  %xmm5,%xmm15
  mulsd  %xmm12,%xmm8
  mulsd  %xmm8,%xmm4
  andpd  %xmm5,%xmm4
  comisd %xmm4,%xmm15
  jae    L299
  movapd %xmm6,%xmm4
  andpd  %xmm5,%xmm12
  subsd  %xmm3,%xmm4
  mulsd  %xmm12,%xmm4
  comisd %xmm2,%xmm4
  jae    L299
  movapd %xmm1,%xmm4
  subsd  %xmm3,%xmm4
  mulsd  %xmm12,%xmm4
  comisd %xmm4,%xmm2
  jae    L299
  divsd  %xmm12,%xmm2
  movapd %xmm2,%xmm4
  addsd  %xmm3,%xmm4
  movapd %xmm4,%xmm8
  subsd  %xmm6,%xmm8
  comisd %xmm8,%xmm11
  jbe    L119
L179:
  subsd  %xmm3,%xmm13
  pxor   %xmm4,%xmm4
  movapd %xmm0,%xmm12
  andpd  %xmm5,%xmm12
  comisd %xmm4,%xmm13
  jb     L190
  comisd %xmm0,%xmm12
  movapd %xmm10,%xmm4
  movapd %xmm12,%xmm10
  jae    L364
  nopl   0x0(%rax)
L358:
  andpd  %xmm5,%xmm0
  movapd %xmm0,%xmm2
  pxor   %xmm0,%xmm0
  comisd %xmm0,%xmm10
  jae    L38
  xorpd  D88(%rip),%xmm2
L38:
  addsd  %xmm3,%xmm2
  jmp    L71
  nopl   0x0(%rax)
L248:
  comisd %xmm13,%xmm3
  jb     L176
  movapd %xmm6,%xmm4
  subsd  %xmm3,%xmm4
L243:
  movsd  D62(%rip),%xmm10
  mulsd  %xmm4,%xmm10
  movapd %xmm10,%xmm12
  andpd  %xmm5,%xmm12
L320:
  comisd %xmm0,%xmm12
  jb     L358
L364:
  movapd %xmm10,%xmm2
  addsd  %xmm3,%xmm2
L71:
  movsd  %xmm1,0x40(%rsp)
  movapd %xmm2,%xmm0
  mov    %r13,%rsi
  mov    %r12,%rdi
  movsd  %xmm6,0x38(%rsp)
  movsd  %xmm4,0x30(%rsp)
  movsd  %xmm10,0x28(%rsp)
  movsd  %xmm9,0x20(%rsp)
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm7,0x10(%rsp)
  movsd  %xmm2,0x8(%rsp)
  call   *%rbp
  movsd  0x10(%rsp),%xmm7
  movsd  0x8(%rsp),%xmm2
  movq   D96(%rip),%xmm5
  movsd  0x18(%rsp),%xmm3
  comisd %xmm0,%xmm7
  movsd  0x20(%rsp),%xmm9
  movsd  0x28(%rsp),%xmm10
  movsd  0x30(%rsp),%xmm4
  movsd  0x38(%rsp),%xmm6
  movsd  0x40(%rsp),%xmm1
  jb     L28
  comisd %xmm3,%xmm2
  jae    L394
  movsd  (%rsp),%xmm1
  movsd  %xmm9,0x50(%rsp)
  movapd %xmm3,%xmm9
  movsd  %xmm7,(%rsp)
  movapd %xmm0,%xmm7
  movsd  %xmm1,0x48(%rsp)
  movapd %xmm3,%xmm1
  movapd %xmm2,%xmm3
L280:
  add    $0x1,%r15d
  cmp    %r15d,%ebx
  jne    L387
L201:
  test   %r14,%r14
  je     L14
  movsd  %xmm3,(%r14)
L14:
  cmpq   $0x0,0xa0(%rsp)
  je     L357
  mov    0xa0(%rsp),%rax
  movsd  %xmm7,(%rax)
L357:
  cmp    %r15d,%ebx
  jle    L121
L231:
  add    $0x68,%rsp
  mov    %r15d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L28:
  movapd %xmm2,%xmm12
  movsd  (%rsp),%xmm11
  cmpltsd %xmm3,%xmm12
  comisd %xmm0,%xmm11
  movapd %xmm12,%xmm13
  andpd  %xmm12,%xmm1
  andnpd %xmm2,%xmm13
  orpd   %xmm13,%xmm1
  movapd %xmm2,%xmm13
  andpd  %xmm12,%xmm13
  andnpd %xmm6,%xmm12
  movapd %xmm12,%xmm6
  orpd   %xmm13,%xmm6
  jae    L37
  ucomisd %xmm9,%xmm3
  jp     L72
  je     L330
L72:
  movsd  0x48(%rsp),%xmm15
  comisd %xmm0,%xmm15
  jae    L185
  movsd  0x50(%rsp),%xmm11
  mov    $0x0,%ecx
  ucomisd %xmm11,%xmm3
  setnp  %dl
  cmovne %ecx,%edx
  test   %dl,%dl
  jne    L185
  ucomisd %xmm11,%xmm9
  setnp  %cl
  cmove  %ecx,%edx
  test   %dl,%dl
  je     L280
  nopw   0x0(%rax,%rax,1)
L185:
  movsd  %xmm0,0x48(%rsp)
  movsd  %xmm2,0x50(%rsp)
  jmp    L280
  nopl   0x0(%rax)
L299:
  comisd %xmm13,%xmm3
  jb     L288
  movapd %xmm6,%xmm4
  subsd  %xmm3,%xmm4
L87:
  movsd  D62(%rip),%xmm10
  mulsd  %xmm4,%xmm10
  movapd %xmm10,%xmm12
  andpd  %xmm5,%xmm12
  jmp    L320
  nopl   0x0(%rax,%rax,1)
L394:
  movsd  (%rsp),%xmm6
  movsd  %xmm9,0x50(%rsp)
  movapd %xmm3,%xmm9
  movsd  %xmm7,(%rsp)
  movapd %xmm0,%xmm7
  movsd  %xmm6,0x48(%rsp)
  movapd %xmm3,%xmm6
  movapd %xmm2,%xmm3
  jmp    L280
  nopl   (%rax)
L37:
  movsd  %xmm9,0x50(%rsp)
  movapd %xmm2,%xmm9
  movsd  %xmm11,0x48(%rsp)
  movsd  %xmm0,(%rsp)
  jmp    L280
  nopl   (%rax)
L176:
  movapd %xmm1,%xmm4
  subsd  %xmm3,%xmm4
  jmp    L243
  nopl   (%rax)
L288:
  movapd %xmm1,%xmm4
  subsd  %xmm3,%xmm4
  jmp    L87
  nopl   (%rax)
L330:
  movsd  %xmm9,0x50(%rsp)
  movapd %xmm2,%xmm9
  movsd  %xmm11,0x48(%rsp)
  movsd  %xmm0,(%rsp)
  jmp    L280
  nopl   (%rax)
L119:
  movapd %xmm1,%xmm8
  subsd  %xmm4,%xmm8
  comisd %xmm8,%xmm11
  ja     L179
  movapd %xmm2,%xmm12
  movapd %xmm10,%xmm4
  movapd %xmm2,%xmm10
  andpd  %xmm5,%xmm12
  jmp    L320
  xchg   %ax,%ax
L241:
  movsd  %xmm3,0x18(%rsp)
  mov    %r8,%rsi
  mov    %r12,%rdi
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm0,0x8(%rsp)
  movapd %xmm1,%xmm0
  movsd  %xmm1,(%rsp)
  call   *%rbp
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm6
  movsd  0x10(%rsp),%xmm2
  movsd  0x18(%rsp),%xmm3
  movapd %xmm0,%xmm8
  jmp    L305
  nopl   0x0(%rax)
L190:
  movapd %xmm12,%xmm2
  xorpd  D88(%rip),%xmm2
  movapd %xmm10,%xmm4
  movapd %xmm2,%xmm10
  jmp    L320
L369:
  movapd %xmm1,%xmm3
  xor    %r15d,%r15d
  jmp    L201
L121:
  mov    $0xffffffff,%r15d
  jmp    L231
```

tool_calls: name: parse_data
arguments: data_label: D96
type: qword
name: parse_data
arguments: data_label: D71
type: byte[8]
name: parse_data
arguments: data_label: D18
type: f64
name: parse_data
arguments: data_label: D88
type: f32[4]
name: parse_data
arguments: data_label: D62
type: f64

tool: D96: 9223372036854775807

tool: {"D71": [0x16,0x56,0xe7,0x9e,0xaf,0x03,0xd2,0x3c]}

tool: D18: 0.5

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

tool: D62: 0.381966

assistant: ```c
int math_find_minimum_brent(double (*f)(const struct pumas_physics *physics, double x, void *params), const struct pumas_physics *physics, double xa, double xb, double xc, const double *fb_p, double tol, int max_iter, void *params, double *xopt, double *fopt) {
  double fb;
  if (fb_p == NULL)
    fb = (*f)(physics, xb, params);
  else
    fb = *fb_p;
  tol *= fabs(xc - xa);
  double x = xb, w = xb, v = xb;
  double fw = fb, fv = fb, fx = fb;
  double d = 0., e = 0.;
  int i;
  for (i = 0; i < max_iter; i++) {
    const double xm = 0.5 * (xa + xb);
    const double tol1 = tol * fabs(x) + 1E-15;
    const double tol2 = 2 * tol1;
    if (fabs(x - xm) <= (tol2 - 0.5 * (xb - xa))) {
      break;
    }
    if (fabs(e) > tol1) {
      const double r = (x - w) * (fx - fv);
      double q = (x - v) * (fx - fw);
      double p = (x - v) * q - (x - w) * r;
      q = 2. * (q - r);
      if (q > 0.)
        p = -p;
      q = fabs(q);
      const double etemp = e;
      e = d;
      if (fabs(p) >= fabs(0.5 * q * etemp) || (p <= q * (xa - x)) || (p >= q * (xb - x))) {
        e = (x >= xm) ? xa - x : xb - x;
        d = 0.3819660 * e;
      } else {
        d = p / q;
        const double u = x + d;
        if ((u - xa < tol2) || (xb - u < tol2)) {
          d = ((xm - x) >= 0.0 ? fabs(tol1) : -fabs(tol1));
        }
      }
    } else {
      e = (x >= xm) ? xa - x : xb - x;
      d = 0.3819660 * e;
    }
    const double u = (fabs(d) >= tol1) ? x + d : x + ((d) >= 0.0 ? fabs(tol1) : -fabs(tol1));
    const double fu = (*f)(physics, u, params);
    if (fu <= fx) {
      if (u >= x) {
        xa = x;
      } else {
        xb = x;
      }
      v = w, w = x, x = u;
      fv = fw, fw = fx, fx = fu;
    } else {
      if (u < x) {
        xa = u;
      } else {
        xb = u;
      }
      if ((fu <= fw) || (w == x)) {
        v = w;
        w = u;
        fv = fw;
        fw = fu;
      } else if ((fu <= fv) || (v == x) || (v == w)) {
        v = u;
        fv = fu;
      }
    }
  }
  if (xopt != NULL)
    *xopt = x;
  if (fopt != NULL)
    *fopt = fx;
  return (i < max_iter) ? i : -1;
}
```