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

```asm
<amoeba>:
  endbr64
  push   %r15
  lea    0x1(%rdx),%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  mov    %edx,%esi
  push   %rbx
  mov    %r8,%rbx
  sub    $0x98,%rsp
  mov    %rdi,0x10(%rsp)
  mov    $0x1,%edi
  mov    %eax,0x50(%rsp)
  xor    %eax,%eax
  mov    %r8,0x8(%rsp)
  mov    %rcx,0x30(%rsp)
  mov    %edx,0x18(%rsp)
  movsd  %xmm0,0x38(%rsp)
  call   <vector@plt>
  mov    0x18(%rsp),%r11d
  movl   $0x0,(%rbx)
  mov    %rax,%r10
  mov    0x10(%rsp),%rax
  lea    0x10(%rax),%r8
  test   %r11d,%r11d
  jle    L235
  mov    0x10(%rsp),%rbx
  mov    0x50(%rsp),%edi
  movslq %r11d,%rax
  pxor   %xmm1,%xmm1
  mov    $0x8,%ecx
  lea    0x10(%rbx),%r8
  mov    %rdi,%r9
  shl    $0x3,%rdi
  lea    (%r8,%rax,8),%rsi
  nopl   0x0(%rax)
L1:
  lea    0x8(%rbx),%rax
  movapd %xmm1,%xmm0
  test   %r9d,%r9d
  jle    L261
  nopl   (%rax)
L188:
  mov    (%rax),%rdx
  add    $0x8,%rax
  addsd  (%rdx,%rcx,1),%xmm0
  cmp    %rax,%rsi
  jne    L188
L261:
  movsd  %xmm0,(%r10,%rcx,1)
  add    $0x8,%rcx
  cmp    %rcx,%rdi
  jne    L1
L235:
  mov    %r11d,%eax
  mov    %r10,%rdx
  shr    %eax
  sub    $0x1,%eax
  shl    $0x4,%rax
  add    $0x18,%rax
  mov    %rax,0x70(%rsp)
  mov    %r11d,%eax
  and    $0xfffffffe,%eax
  mov    %eax,0x5c(%rsp)
  mov    %r11d,%eax
  or     $0x1,%eax
  cltq
  shl    $0x3,%rax
  mov    %rax,0x80(%rsp)
  add    %r10,%rax
  mov    %rax,0x78(%rsp)
  lea    -0x1(%r11),%eax
  mov    %eax,0x58(%rsp)
  add    $0x2,%rax
  mov    %rax,0x88(%rsp)
  shl    $0x3,%rax
  mov    %rax,0x68(%rsp)
  mov    %r11d,%eax
  mov    %rax,0x48(%rsp)
  lea    (%r8,%rax,8),%rax
  mov    %rax,0x60(%rsp)
  lea    0x8(%rbp),%rax
  mov    %rax,0x40(%rsp)
  nopl   (%rax)
L169:
  movsd  0x8(%rbp),%xmm2
  comisd 0x10(%rbp),%xmm2
  mov    $0x10,%eax
  mov    $0x8,%r13d
  mov    0x40(%rsp),%rcx
  mov    $0x1,%r12d
  mov    0x50(%rsp),%r10d
  seta   %r14b
  cmovbe %rax,%r13
  mov    $0x2,%eax
  mov    %rcx,%r15
  movzbl %r14b,%r14d
  add    $0x1,%r14d
  comisd 0x10(%rbp),%xmm2
  cmovbe %eax,%r12d
  add    %rbp,%r13
  movsd  0x0(%r13),%xmm1
  test   %r10d,%r10d
  jle    L170
  mov    0x48(%rsp),%rax
  mov    $0x1,%r10d
  lea    0x2(%rax),%r8
  mov    $0x1,%eax
  jmp    L141
  cs nopw 0x0(%rax,%rax,1)
L247:
  movslq %r10d,%rbx
  movslq %r12d,%rsi
  shl    $0x3,%rbx
  comisd %xmm1,%xmm0
  lea    0x0(%rbp,%rsi,8),%rsi
  lea    0x0(%rbp,%rbx,1),%r15
  ja     L278
L70:
  movslq %r14d,%r9
  mov    %rsi,%r13
  comisd 0x0(%rbp,%r9,8),%xmm0
  jbe    L161
  cmp    %eax,%r12d
  je     L161
  mov    %edi,%r14d
L161:
  add    $0x1,%rax
  add    $0x8,%rcx
  cmp    %rax,%r8
  je     L52
L141:
  movsd  (%rcx),%xmm0
  mov    %eax,%edi
  lea    0x0(,%rax,8),%rbx
  mov    %rcx,%r13
  comisd %xmm0,%xmm2
  jbe    L247
  comisd %xmm1,%xmm0
  movslq %r12d,%rsi
  movapd %xmm0,%xmm2
  mov    %rcx,%r15
  mov    %eax,%r10d
  lea    0x0(%rbp,%rsi,8),%rsi
  jbe    L70
L278:
  add    $0x1,%rax
  mov    %r12d,%r14d
  movapd %xmm0,%xmm1
  mov    %edi,%r12d
  add    $0x8,%rcx
  cmp    %rax,%r8
  jne    L141
L52:
  movapd %xmm1,%xmm0
  andpd  D87(%rip),%xmm1
  movsd  0x38(%rsp),%xmm4
  subsd  %xmm2,%xmm0
  andpd  D87(%rip),%xmm2
  andpd  D87(%rip),%xmm0
  addsd  %xmm2,%xmm1
  addsd  %xmm0,%xmm0
  divsd  %xmm1,%xmm0
  comisd %xmm0,%xmm4
  ja     L357
  mov    0x8(%rsp),%rax
  cmpl   $0x1387,(%rax)
  jg     L98
L162:
  mov    %r10d,0x28(%rsp)
  sub    $0x8,%rsp
  mov    %r12d,%r9d
  mov    %r11d,%ecx
  push   0x10(%rsp)
  mov    D8(%rip),%rax
  mov    %rbp,%rsi
  mov    0x40(%rsp),%r8
  mov    0x20(%rsp),%rdi
  movq   %rax,%xmm0
  mov    $0x1,%eax
  mov    %r11d,0x30(%rsp)
  mov    %rdx,0x28(%rsp)
  call   <amotry@plt>
  movsd  (%r15),%xmm1
  pop    %r8
  pop    %r9
  mov    0x18(%rsp),%rdx
  comisd %xmm0,%xmm1
  mov    0x20(%rsp),%r11d
  mov    0x28(%rsp),%r10d
  jae    L156
  movslq %r14d,%r14
  comisd 0x0(%rbp,%r14,8),%xmm0
  jb     L169
  movsd  0x0(%r13),%xmm5
  sub    $0x8,%rsp
  mov    %r11d,%ecx
  mov    %r12d,%r9d
  mov    %r10d,0x5c(%rsp)
  mov    D11(%rip),%rax
  mov    %rbp,%rsi
  movsd  %xmm5,0x20(%rsp)
  push   0x10(%rsp)
  mov    0x40(%rsp),%r8
  movq   %rax,%xmm0
  mov    $0x1,%eax
  mov    0x20(%rsp),%rdi
  mov    %r11d,0x38(%rsp)
  mov    %rdx,0x30(%rsp)
  call   <amotry@plt>
  pop    %rdx
  pop    %rcx
  comisd 0x18(%rsp),%xmm0
  mov    0x20(%rsp),%rdx
  mov    0x28(%rsp),%r11d
  mov    0x54(%rsp),%r10d
  jb     L169
  mov    0x50(%rsp),%eax
  mov    $0x1,%r12d
  test   %eax,%eax
  jle    L309
  mov    %r10d,0x18(%rsp)
  mov    0x78(%rsp),%r15
  mov    %rdx,%r14
  mov    %r11d,%r13d
  mov    %rbx,0x28(%rsp)
  mov    0x80(%rsp),%rbx
  mov    %rbp,0x20(%rsp)
  mov    0x70(%rsp),%rbp
  nopl   (%rax)
L255:
  cmp    %r12d,0x18(%rsp)
  je     L325
  test   %r13d,%r13d
  jle    L57
  mov    0x10(%rsp),%rdx
  mov    0x28(%rsp),%rdi
  lea    0x18(%r14),%rsi
  lea    0x8(%r14),%r8
  mov    (%rdx,%r12,8),%rax
  mov    (%rdx,%rdi,1),%rcx
  lea    0x8(%rax),%rdi
  lea    0x10(%rcx),%r9
  cmp    %rsi,%rdi
  lea    0x18(%rax),%rsi
  setae  %r10b
  cmp    %rsi,%r8
  setae  %sil
  or     %r10b,%sil
  je     L95
  cmp    %r9,%r8
  setne  %sil
  cmpl   $0x1,0x58(%rsp)
  seta   %r8b
  and    %r8d,%esi
  cmp    %r9,%rdi
  setne  %dil
  test   %dil,%sil
  je     L95
  mov    $0x8,%esi
  nopl   0x0(%rax)
L339:
  movupd (%rcx,%rsi,1),%xmm0
  movupd (%rax,%rsi,1),%xmm3
  addpd  %xmm3,%xmm0
  mulpd  D11(%rip),%xmm0
  movups %xmm0,(%r14,%rsi,1)
  movups %xmm0,(%rax,%rsi,1)
  add    $0x10,%rsi
  cmp    %rbp,%rsi
  jne    L339
  cmp    %r13d,0x5c(%rsp)
  je     L57
  add    %rbx,%rax
  movsd  (%rcx,%rbx,1),%xmm0
  addsd  (%rax),%xmm0
  mulsd  D11(%rip),%xmm0
  movsd  %xmm0,(%r15)
  movsd  %xmm0,(%rax)
L57:
  xor    %eax,%eax
  mov    0x30(%rsp),%rdx
  mov    %r14,%rdi
  call   *%rdx
  mov    0x20(%rsp),%rax
  movsd  %xmm0,(%rax,%r12,8)
L325:
  add    $0x1,%r12
  lea    -0x1(%r12),%eax
  cmp    %eax,%r13d
  jge    L255
  mov    0x20(%rsp),%rbp
  mov    %r14,%rdx
  mov    %r13d,%r11d
L309:
  mov    0x8(%rsp),%rax
  mov    $0x8,%esi
  pxor   %xmm1,%xmm1
  add    %r11d,(%rax)
  test   %r11d,%r11d
  jle    L169
  mov    0x60(%rsp),%rdi
  mov    0x68(%rsp),%r8
  mov    0x50(%rsp),%r9d
  mov    0x10(%rsp),%r10
  cs nopw 0x0(%rax,%rax,1)
L110:
  lea    0x8(%r10),%rax
  movapd %xmm1,%xmm0
  test   %r9d,%r9d
  jle    L316
  nopl   (%rax)
L11:
  mov    (%rax),%rcx
  add    $0x8,%rax
  addsd  (%rcx,%rsi,1),%xmm0
  cmp    %rax,%rdi
  jne    L11
L316:
  movsd  %xmm0,(%rdx,%rsi,1)
  add    $0x8,%rsi
  cmp    %r8,%rsi
  jne    L110
  jmp    L169
  nopl   0x0(%rax)
L156:
  sub    $0x8,%rsp
  mov    %r11d,%ecx
  mov    %rbp,%rsi
  mov    %r12d,%r9d
  push   0x10(%rsp)
  mov    0x40(%rsp),%r8
  mov    $0x1,%eax
  mov    0x20(%rsp),%rdi
  movsd  D51(%rip),%xmm0
  mov    %r11d,0x30(%rsp)
  mov    %rdx,0x28(%rsp)
  call   <amotry@plt>
  pop    %rsi
  pop    %rdi
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%r11d
  jmp    L169
L98:
  lea    D35(%rip),%rdi
  xor    %eax,%eax
  mov    %r11d,0x28(%rsp)
  mov    %rdx,0x20(%rsp)
  mov    %r10d,0x18(%rsp)
  call   <nrerror@plt>
  mov    0x28(%rsp),%r11d
  mov    0x20(%rsp),%rdx
  mov    0x18(%rsp),%r10d
  jmp    L162
  nopl   0x0(%rax)
L357:
  add    $0x98,%rsp
  mov    %rdx,%r10
  mov    $0x1,%esi
  mov    %r11d,%edx
  pop    %rbx
  mov    %r10,%rdi
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1080 <free_vector@plt>
  xchg   %ax,%ax
L170:
  mov    $0x8,%ebx
  mov    $0x1,%r10d
  jmp    L52
L95:
  mov    0x88(%rsp),%rdx
  mov    $0x1,%esi
  nopl   (%rax)
L243:
  movsd  (%rcx,%rsi,8),%xmm0
  addsd  (%rax,%rsi,8),%xmm0
  mulsd  D11(%rip),%xmm0
  movsd  %xmm0,(%r14,%rsi,8)
  movsd  %xmm0,(%rax,%rsi,8)
  add    $0x1,%rsi
  cmp    %rsi,%rdx
  jne    L243
  jmp    L57
```

tool_calls: name: parse_data
arguments: data_label: D87
type: qword[2]
name: parse_data
arguments: data_label: D8
type: f32[2]
name: parse_data
arguments: data_label: D11
type: f64[2]
name: parse_data
arguments: data_label: D51
type: f64
name: parse_data
arguments: data_label: D35
type: string

tool: {"D87": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D8": [0.0,-1.875]}

tool: {"D11": [0.5,0.5]}

tool: D51: 2

tool: D35: Too many iterations in AMOEBA

assistant: ```c
void amoeba(p, y, ndim, ftol, funk, nfunk) double **p, y[], ftol, (*funk)();
int ndim, *nfunk;
{
  int i, j, ilo, ihi, inhi, mpts = ndim + 1;
  double ytry, ysave, sum, rtol, amotry(), *psum, *vector();
  void nrerror(), free_vector();
  psum = vector(1, ndim);
  *nfunk = 0;
  for (j = 1; j <= ndim; j++) {
    for (i = 1, sum = 0.0; i <= mpts; i++)
      sum += p[i][j];
    psum[j] = sum;
  }
  for (;;) {
    ilo = 1;
    ihi = y[1] > y[2] ? (inhi = 2, 1) : (inhi = 1, 2);
    for (i = 1; i <= mpts; i++) {
      if (y[i] < y[ilo])
        ilo = i;
      if (y[i] > y[ihi]) {
        inhi = ihi;
        ihi = i;
      } else if (y[i] > y[inhi])
        if (i != ihi)
          inhi = i;
    }
    rtol = 2.0 * fabs(y[ihi] - y[ilo]) / (fabs(y[ihi]) + fabs(y[ilo]));
    if (rtol < ftol)
      break;
    if (*nfunk >= 5000)
      nrerror("Too many iterations in AMOEBA");
    ytry = amotry(p, y, psum, ndim, funk, ihi, nfunk, -1.0);
    if (ytry <= y[ilo])
      ytry = amotry(p, y, psum, ndim, funk, ihi, nfunk, 2.0);
    else if (ytry >= y[inhi]) {
      ysave = y[ihi];
      ytry = amotry(p, y, psum, ndim, funk, ihi, nfunk, 0.5);
      if (ytry >= ysave) {
        for (i = 1; i <= mpts; i++) {
          if (i != ilo) {
            for (j = 1; j <= ndim; j++) {
              psum[j] = 0.5 * (p[i][j] + p[ilo][j]);
              p[i][j] = psum[j];
            }
            y[i] = (*funk)(psum);
          }
        }
        *nfunk += ndim;
        for (j = 1; j <= ndim; j++) {
          for (i = 1, sum = 0.0; i <= mpts; i++)
            sum += p[i][j];
          psum[j] = sum;
        }
      }
    }
  }
  free_vector(psum, 1, ndim);
}
```