user: Demonstrate the C code that generates the assembly output below:

```asm
<simplx>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xb8,%rsp
  mov    %edi,0x18(%rsp)
  mov    %rsi,0x68(%rsp)
  mov    %rdx,0x70(%rsp)
  movss  %xmm0,0x88(%rsp)
  mov    %ecx,%ebx
  mov    %r8,%r13
  mov    %r9,0x30(%rsp)
  mov    0xf0(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    0xf8(%rsp),%rax
  mov    %rax,0x58(%rsp)
  mov    0x100(%rsp),%r15
  mov    0x108(%rsp),%r12
  mov    0x118(%rsp),%rax
  mov    %rax,0x20(%rsp)
  mov    0x120(%rsp),%rax
  mov    %rax,0x28(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xa8(%rsp)
  xor    %eax,%eax
  test   %edi,%edi
  jle    L856
  mov    %edi,%edx
  mov    %rdx,%rdi
  mov    %rsi,%rcx
L118:
  movss  (%rcx,%rax,4),%xmm0
  movss  %xmm0,(%r12,%rax,4)
  add    $0x1,%rax
  cmp    %rdx,%rax
  jne    L118
  mov    $0x0,%r14d
  pxor   %xmm0,%xmm0
  cvtsi2ss %ebx,%xmm0
  pxor   %xmm6,%xmm6
  cvtss2sd %xmm0,%xmm6
  movsd  %xmm6,0x40(%rsp)
  mov    %ebp,0x48(%rsp)
  mov    %rdi,%rbp
  mov    %ebx,0x50(%rsp)
  mov    0x68(%rsp),%rbx
  mov    %r15,0x60(%rsp)
  mov    0x30(%rsp),%r15
L599:
  pxor   %xmm3,%xmm3
  cvtss2sd (%rbx,%r14,4),%xmm3
  movsd  %xmm3,0x8(%rsp)
  pxor   %xmm7,%xmm7
  movsd  0x40(%rsp),%xmm6
  ucomisd %xmm6,%xmm7
  ja     L128
  sqrtsd %xmm6,%xmm6
  movapd %xmm6,%xmm1
  mov    0x18(%rsp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  D40(%rip),%xmm0
  pxor   %xmm6,%xmm6
  cvtss2sd %xmm0,%xmm6
  movsd  %xmm6,0x10(%rsp)
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  addsd  %xmm1,%xmm0
  subsd  D63(%rip),%xmm0
  mulsd  %xmm3,%xmm0
  divsd  %xmm6,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,0x0(%r13,%r14,4)
  pxor   %xmm3,%xmm3
  cvtss2sd (%rbx,%r14,4),%xmm3
  movsd  %xmm3,0x8(%rsp)
L273:
  subsd  D63(%rip),%xmm1
  mulsd  0x8(%rsp),%xmm1
  divsd  0x10(%rsp),%xmm1
  cvtsd2ss %xmm1,%xmm1
  movss  %xmm1,(%r15,%r14,4)
  add    $0x1,%r14
  cmp    %rbp,%r14
  jne    L599
  mov    0x48(%rsp),%ebp
  mov    0x50(%rsp),%ebx
  mov    0x60(%rsp),%r15
L856:
  cmp    $0x1,%ebx
  jle    L70
  movslq 0x110(%rsp),%rax
  lea    0x4(,%rax,4),%r10
  lea    (%r12,%rax,4),%rdi
  mov    %r13,%rsi
  lea    -0x2(%rbx),%eax
  lea    0x4(%r13,%rax,4),%r9
  mov    0x110(%rsp),%r8d
  mov    0x18(%rsp),%r14d
  mov    %r14d,%ecx
  mov    0x30(%rsp),%r11
  jmp    L112
L128:
  movsd  0x40(%rsp),%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm1
  mov    0x18(%rsp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2ss %eax,%xmm0
  mulss  D40(%rip),%xmm0
  pxor   %xmm7,%xmm7
  cvtss2sd %xmm0,%xmm7
  movsd  %xmm7,0x10(%rsp)
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  addsd  %xmm1,%xmm0
  subsd  D63(%rip),%xmm0
  mulsd  0x8(%rsp),%xmm0
  divsd  %xmm7,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,0x0(%r13,%r14,4)
  pxor   %xmm7,%xmm7
  cvtss2sd (%rbx,%r14,4),%xmm7
  movsd  %xmm7,0x8(%rsp)
  movsd  0x40(%rsp),%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm1
  jmp    L273
L187:
  movslq %r8d,%rax
  lea    (%r12,%rax,4),%rdx
  mov    $0x0,%eax
L576:
  movss  (%r12,%rax,4),%xmm0
  addss  (%r11,%rax,4),%xmm0
  movss  %xmm0,(%rdx,%rax,4)
  add    $0x1,%rax
  cmp    %rcx,%rax
  jne    L576
L699:
  movss  (%rdi),%xmm0
  addss  (%rsi),%xmm0
  movss  %xmm0,(%rdi)
  add    %r10,%rdi
  add    $0x4,%rsi
  add    0x110(%rsp),%r8d
  cmp    %r9,%rsi
  je     L627
L112:
  test   %r14d,%r14d
  jg     L187
  jmp    L699
L70:
  jne    L802
L627:
  mov    $0x0,%esi
  mov    $0x0,%edi
  mov    0x18(%rsp),%eax
  mov    %eax,%r14d
  mov    %ebp,0x40(%rsp)
  mov    %r15,%rbp
  mov    %ebx,0x8(%rsp)
  mov    %edi,%ebx
  mov    %r15,0x48(%rsp)
  mov    %eax,%r15d
  mov    %r12,0x10(%rsp)
  mov    %esi,%r12d
  jmp    L767
L452:
  movslq %r12d,%rax
  mov    0x10(%rsp),%rdi
  lea    (%rdi,%rax,4),%rdx
  mov    $0x0,%eax
L569:
  movss  (%rdx,%rax,4),%xmm0
  movss  %xmm0,0x0(%r13,%rax,4)
  add    $0x1,%rax
  cmp    %r14,%rax
  jne    L569
L348:
  mov    %rbp,%rcx
  mov    %r13,%rdx
  mov    %r15d,%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  add    $0x1,%ebx
  add    $0x4,%rbp
  add    0x110(%rsp),%r12d
  cmp    %ebx,0x8(%rsp)
  jle    L21
L767:
  test   %r15d,%r15d
  jg     L452
  jmp    L348
L21:
  mov    0x40(%rsp),%ebp
  mov    0x8(%rsp),%ebx
  mov    0x48(%rsp),%r15
  mov    0x10(%rsp),%r12
L802:
  mov    0x128(%rsp),%eax
  lea    -0x1(%rax),%eax
  mov    %rax,0x80(%rsp)
  mov    0x18(%rsp),%eax
  lea    -0x1(%rax),%r14d
  lea    0x4(%r13,%r14,4),%rax
  mov    %rax,0x60(%rsp)
  movslq 0x110(%rsp),%rax
  shl    $0x2,%rax
  mov    %rax,0x98(%rsp)
  lea    -0x1(%rbx),%eax
  mov    %rax,0x78(%rsp)
  lea    0x4(%r15,%rax,4),%rax
  mov    %rax,0x48(%rsp)
  movq   $0x0,0x50(%rsp)
  pxor   %xmm6,%xmm6
  movss  %xmm6,0x40(%rsp)
  jmp    L743
L602:
  lea    0x1(%rax),%rdx
  cmp    %rax,%rcx
  je     L119
  mov    %rdx,%rax
L441:
  mov    %eax,%edx
  movss  (%r15,%rax,4),%xmm0
  comiss 0x10(%rsp),%xmm0
  jb     L204
  mov    %eax,%ebp
  movss  %xmm0,0x10(%rsp)
L204:
  movss  0x8(%rsp),%xmm5
  comiss %xmm0,%xmm5
  jb     L602
  mov    %edx,0x1c(%rsp)
  movss  %xmm0,0x8(%rsp)
  jmp    L602
L183:
  movss  0x10(%rsp),%xmm7
  movss  %xmm7,0x8(%rsp)
L119:
  cmpl   $0x0,0x18(%rsp)
  jle    L60
  mov    %r13,%rax
  mov    0x60(%rsp),%rdx
L143:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L143
  mov    %r13,%rsi
  mov    $0x0,%r8d
  mov    0x18(%rsp),%r10d
  mov    0x110(%rsp),%r9d
  jmp    L865
L821:
  movslq %ecx,%rdx
  movss  (%rsi),%xmm0
  addss  (%r12,%rdx,4),%xmm0
  movss  %xmm0,(%rsi)
L450:
  add    $0x1,%eax
  add    %r9d,%ecx
  cmp    %eax,%ebx
  je     L308
L133:
  cmp    %eax,%ebp
  jne    L821
  jmp    L450
L308:
  lea    0x1(%r8),%edi
  add    $0x4,%rsi
  cmp    %edi,%r10d
  je     L89
  mov    %edi,%r8d
L865:
  mov    %r8d,%ecx
  mov    $0x0,%eax
  test   %ebx,%ebx
  jg     L133
  jmp    L308
L89:
  mov    %r8d,%r8d
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
  cvtsi2ss %edi,%xmm1
  mov    0x30(%rsp),%rcx
L208:
  movss  0x0(%r13,%rax,4),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rcx,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r8,%rdx
  jne    L208
  mov    %ebp,%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rcx
  mov    $0x0,%eax
  mov    0x30(%rsp),%rsi
  mov    0x38(%rsp),%r9
L339:
  pxor   %xmm0,%xmm0
  cvtss2sd (%rsi,%rax,4),%xmm0
  addsd  %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd (%rcx,%rax,4),%xmm1
  subsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%r9,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r8,%rdx
  jne    L339
  lea    0xa0(%rsp),%rcx
  mov    0x38(%rsp),%rdx
  mov    %edi,%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  movss  0xa0(%rsp),%xmm1
  movss  0x8(%rsp),%xmm3
  comiss %xmm1,%xmm3
  ja     L649
L317:
  test   %ebp,%ebp
  je     L297
  test   %ebx,%ebx
  jle    L297
  mov    $0x1,%eax
L796:
  movss  -0x4(%r15,%rax,4),%xmm0
  comiss %xmm1,%xmm0
  ja     L580
  mov    %eax,%edx
  add    $0x1,%rax
  cmp    %edx,%ebx
  jle    L297
  cmp    %edx,%ebp
  jne    L796
L297:
  movss  0x10(%rsp),%xmm6
  comiss %xmm1,%xmm6
  jae    L501
L321:
  cmpl   $0x0,0x18(%rsp)
  jle    L395
  mov    %ebp,%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rcx
  mov    $0x0,%eax
  mov    0x30(%rsp),%rsi
  mov    0x58(%rsp),%rdi
L663:
  pxor   %xmm0,%xmm0
  cvtss2sd (%rcx,%rax,4),%xmm0
  mulsd  D6(%rip),%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd (%rsi,%rax,4),%xmm1
  mulsd  D6(%rip),%xmm1
  addsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rdi,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r14,%rdx
  jne    L663
L395:
  lea    0xa4(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  mov    0x18(%rsp),%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  movss  0xa0(%rsp),%xmm0
  minss  0x10(%rsp),%xmm0
  movaps %xmm0,%xmm3
  movss  0xa4(%rsp),%xmm0
  comiss %xmm3,%xmm0
  jbe    L419
  mov    %r13,%rax
  mov    0x60(%rsp),%rdx
  cmpl   $0x0,0x18(%rsp)
  jle    L499
L63:
  movl   $0x0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L63
  mov    %r12,%rdi
  mov    %r13,%rcx
  mov    $0x0,%esi
  mov    0x98(%rsp),%r8
  mov    0x18(%rsp),%r9d
  jmp    L472
L501:
  cmpl   $0x0,0x18(%rsp)
  jle    L19
  mov    %ebp,%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rcx
  mov    $0x0,%eax
  mov    0x38(%rsp),%rsi
L54:
  movss  (%rsi,%rax,4),%xmm0
  movss  %xmm0,(%rcx,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r14,%rdx
  jne    L54
L19:
  movslq %ebp,%rax
  movss  %xmm1,(%r15,%rax,4)
  movss  %xmm1,0x10(%rsp)
  jmp    L321
L131:
  mov    0x10(%rsp),%ebp
  mov    0x8c(%rsp),%ebx
  mov    0x90(%rsp),%r15
  jmp    L489
L649:
  mov    $0x0,%eax
  mov    0x18(%rsp),%edx
  mov    0x30(%rsp),%rcx
  mov    0x38(%rsp),%rsi
  mov    0x58(%rsp),%rdi
L603:
  pxor   %xmm0,%xmm0
  cvtss2sd (%rsi,%rax,4),%xmm0
  addsd  %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  cvtss2sd (%rcx,%rax,4),%xmm1
  subsd  %xmm1,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rdi,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%edx
  jg     L603
  lea    0xa4(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  mov    0x18(%rsp),%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  movss  0xa4(%rsp),%xmm0
  comiss 0x8(%rsp),%xmm0
  jae    L148
L419:
  cmpl   $0x0,0x18(%rsp)
  jle    L362
  mov    %ebp,%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rcx
  mov    $0x0,%eax
  mov    0x58(%rsp),%rsi
L371:
  movss  (%rsi,%rax,4),%xmm0
  movss  %xmm0,(%rcx,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r14,%rdx
  jne    L371
L362:
  movslq %ebp,%rax
  movss  0xa4(%rsp),%xmm0
  movss  %xmm0,(%r15,%rax,4)
L553:
  test   %ebx,%ebx
  jle    L236
L489:
  mov    $0x0,%eax
  pxor   %xmm1,%xmm1
L449:
  addss  (%r15,%rax,4),%xmm1
  add    $0x1,%rax
  cmp    %eax,%ebx
  jg     L449
  pxor   %xmm3,%xmm3
  cvtsi2ss %ebx,%xmm3
  divss  %xmm3,%xmm1
  mov    $0x0,%eax
  pxor   %xmm2,%xmm2
L839:
  movss  (%r15,%rax,4),%xmm0
  subss  %xmm1,%xmm0
  mulss  %xmm0,%xmm0
  addss  %xmm0,%xmm2
  add    $0x1,%rax
  cmp    %eax,%ebx
  jg     L839
L727:
  divss  %xmm3,%xmm2
  cmpl   $0x0,0x18(%rsp)
  jle    L655
  mov    0x1c(%rsp),%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rcx
  mov    $0x0,%eax
  mov    0x68(%rsp),%rsi
L495:
  movss  (%rcx,%rax,4),%xmm0
  movss  %xmm0,(%rsi,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r14,%rdx
  jne    L495
L655:
  mov    0x70(%rsp),%rax
  movss  0x8(%rsp),%xmm7
  movss  %xmm7,(%rax)
  movss  0x88(%rsp),%xmm7
  comiss %xmm2,%xmm7
  ja     L804
  movaps %xmm2,%xmm0
  subss  0x40(%rsp),%xmm0
  andps  D13(%rip),%xmm0
  cvtss2sd %xmm0,%xmm0
  movsd  D54(%rip),%xmm7
  comisd %xmm0,%xmm7
  ja     L804
  mov    0x50(%rsp),%rdi
  lea    0x1(%rdi),%rax
  cmp    0x80(%rsp),%rdi
  je     L804
  mov    %rax,0x50(%rsp)
  movss  %xmm2,0x40(%rsp)
L743:
  movss  (%r15),%xmm7
  movss  %xmm7,0x10(%rsp)
  test   %ebx,%ebx
  jle    L183
  movss  %xmm7,0x8(%rsp)
  mov    $0x0,%eax
  mov    0x78(%rsp),%rcx
  jmp    L441
L580:
  cmpl   $0x0,0x18(%rsp)
  jle    L237
L148:
  mov    %ebp,%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rdx
  mov    $0x0,%eax
  mov    0x18(%rsp),%ecx
  mov    0x38(%rsp),%rsi
L798:
  movss  (%rsi,%rax,4),%xmm0
  movss  %xmm0,(%rdx,%rax,4)
  add    $0x1,%rax
  cmp    %eax,%ecx
  jg     L798
L237:
  movslq %ebp,%rax
  movss  0xa0(%rsp),%xmm0
  movss  %xmm0,(%r15,%rax,4)
  jmp    L553
L425:
  add    $0x1,%esi
  add    $0x4,%rdi
  add    $0x4,%rcx
  cmp    %esi,%r9d
  je     L520
L472:
  mov    %rdi,%rdx
  mov    $0x0,%eax
  test   %ebx,%ebx
  jle    L425
L712:
  movss  (%rcx),%xmm0
  addss  (%rdx),%xmm0
  movss  %xmm0,(%rcx)
  add    $0x1,%eax
  add    %r8,%rdx
  cmp    %eax,%ebx
  jne    L712
  jmp    L425
L520:
  mov    %r13,%rax
  pxor   %xmm1,%xmm1
  cvtsi2ss %ebx,%xmm1
  mov    0x60(%rsp),%rdx
L66:
  movss  (%rax),%xmm0
  divss  %xmm1,%xmm0
  movss  %xmm0,(%rax)
  add    $0x4,%rax
  cmp    %rdx,%rax
  jne    L66
L499:
  test   %ebx,%ebx
  jle    L236
  mov    0x1c(%rsp),%eax
  imul   0x110(%rsp),%eax
  cltq
  lea    (%r12,%rax,4),%rsi
  mov    $0x0,%r8d
  mov    $0x0,%edi
  mov    0x18(%rsp),%r9d
  mov    0x110(%rsp),%r10d
  jmp    L433
L440:
  add    $0x1,%edi
  add    %r10d,%r8d
  cmp    %edi,%ebx
  je     L676
L433:
  test   %r9d,%r9d
  jle    L440
  movslq %r8d,%rax
  lea    (%r12,%rax,4),%rdx
  mov    $0x0,%eax
L115:
  movss  0x0(%r13,%rax,4),%xmm1
  addss  (%rsi,%rax,4),%xmm1
  movss  (%rdx,%rax,4),%xmm0
  subss  %xmm1,%xmm0
  movss  %xmm0,(%rdx,%rax,4)
  mov    %rax,%rcx
  add    $0x1,%rax
  cmp    %r14,%rcx
  jne    L115
  jmp    L440
L676:
  mov    $0x0,%eax
  mov    %ebp,0x10(%rsp)
  mov    %eax,%ebp
  mov    %ebx,0x8c(%rsp)
  mov    %r15,%rbx
  mov    %r15,0x90(%rsp)
  mov    0x18(%rsp),%r15d
  jmp    L623
L653:
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r15d,%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  add    $0x4,%rbx
  add    0x110(%rsp),%ebp
  cmp    0x48(%rsp),%rbx
  je     L131
L623:
  test   %r15d,%r15d
  jle    L653
  movslq %ebp,%rax
  lea    (%r12,%rax,4),%rcx
  mov    $0x0,%eax
L832:
  movss  (%rcx,%rax,4),%xmm0
  movss  %xmm0,0x0(%r13,%rax,4)
  mov    %rax,%rdx
  add    $0x1,%rax
  cmp    %r14,%rdx
  jne    L832
  jmp    L653
L236:
  pxor   %xmm3,%xmm3
  cvtsi2ss %ebx,%xmm3
  pxor   %xmm2,%xmm2
  jmp    L727
L60:
  lea    0xa0(%rsp),%rcx
  mov    0x38(%rsp),%rdx
  mov    0x18(%rsp),%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  movss  0xa0(%rsp),%xmm1
  movss  0x8(%rsp),%xmm3
  comiss %xmm1,%xmm3
  jbe    L317
  lea    0xa4(%rsp),%rcx
  mov    0x58(%rsp),%rdx
  mov    0x18(%rsp),%esi
  mov    0x28(%rsp),%rdi
  mov    0x20(%rsp),%rax
  call   *%rax
  movss  0xa4(%rsp),%xmm0
  comiss 0x8(%rsp),%xmm0
  jae    L237
  jmp    L362
L804:
  mov    0xa8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L345
  add    $0xb8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L345:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: read_data
arguments: data_label: D40
datatype: byte[4]
name: read_data
arguments: data_label: D63
datatype: f64
name: read_data
arguments: data_label: D6
datatype: f64
name: read_data
arguments: data_label: D13
datatype: dword[4]
name: read_data
arguments: data_label: D54
datatype: byte[8]

tool: {"D40": [0xf3,0x04,0xb5,0x3f]}

tool: D63: 1

tool: D6: 0.5

tool: {"D13": [0x7fffffff,0x00000000,0x00000000,0x00000000]}

tool: {"D54": [0x23,0x42,0x92,0x0c,0xa1,0x9c,0xc7,0x3b]}

assistant: ```c
void simplx(int n, float *x, float *f, float tol, int iw, float *xn, float *pdash, float *pastx, float *pdastx, float *y, float *p, int ldp, void (*funct)(void *, int, float *, float *), void *data, int maxcal) {
  float yerr, yerrold = 0.0, yh, yl, yast, ydast, fm, sqrt2;
  int iyhigh, iylow;
  int i, j, icount = 0;
  for (i = 0; i < n; i++)
    (p[(0) * ldp + (i)]) = x[i];
  sqrt2 = sqrt(2);
  for (i = 0; i < n; i++) {
    xn[i] = x[i] * (sqrt((float)iw) + n - 1) / (sqrt2 * n);
    pdash[i] = x[i] * (sqrt((float)iw) - 1.0) / (sqrt2 * n);
  }
  for (i = 1; i < iw; i++) {
    for (j = 0; j < n; j++)
      (p[(i)*ldp + (j)]) = (p[(0) * ldp + (j)]) + pdash[j];
    (p[(i)*ldp + (i - 1)]) += xn[i - 1];
  }
  for (i = 0; i < iw; i++) {
    for (j = 0; j < n; j++)
      xn[j] = (p[(i)*ldp + (j)]);
    funct(data, n, xn, &(y[i]));
  }
L110:
  yh = y[0];
  yl = y[0];
  for (i = 0; i < iw; i++) {
    if (yh <= y[i]) {
      yh = y[i];
      iyhigh = i;
    }
    if (yl >= y[i]) {
      yl = y[i];
      iylow = i;
    }
  }
  for (i = 0; i < n; i++)
    xn[i] = 0.0;
  for (i = 0; i < n; i++)
    for (j = 0; j < iw; j++)
      if (j != iyhigh)
        xn[i] += (p[(j)*ldp + (i)]);
  for (i = 0; i < n; i++)
    pdash[i] = xn[i] / (float)n;
  for (i = 0; i < n; i++)
    pastx[i] = 2.0 * pdash[i] - (p[(iyhigh)*ldp + (i)]);
  funct(data, n, pastx, &yast);
  if (yast < yl)
    goto L1000;
  for (i = 0; i < iw; i++) {
    if (i == iyhigh)
      break;
    if (yast < y[i])
      goto L2030;
  }
  goto L3000;
L2030:
  for (i = 0; i < n; i++)
    (p[(iyhigh)*ldp + (i)]) = pastx[i];
  y[iyhigh] = yast;
L2040:
  fm = 0.0;
  for (i = 0; i < iw; i++)
    fm += y[i];
  fm /= (float)iw;
  yerr = 0.0;
  for (i = 0; i < iw; i++)
    yerr += (y[i] - fm) * (y[i] - fm);
  yerr /= (float)iw;
  for (i = 0; i < n; i++)
    x[i] = (p[(iylow)*ldp + (i)]);
  *f = yl;
  if (yerr < tol)
    return;
  if (fabs(yerr - yerrold) < 1.e-20)
    return;
  yerrold = yerr;
  icount++;
  if (icount == maxcal)
    return;
  goto L110;
L1000:
  for (i = 0; i < n; i++)
    pdastx[i] = 2.0 * pastx[i] - pdash[i];
  funct(data, n, pdastx, &ydast);
  if (ydast >= yl)
    goto L2030;
L1030:
  for (i = 0; i < n; i++)
    (p[(iyhigh)*ldp + (i)]) = pdastx[i];
  y[iyhigh] = ydast;
  goto L2040;
L3000:
  if (yast <= yh) {
    for (i = 0; i < n; i++)
      (p[(iyhigh)*ldp + (i)]) = pastx[i];
    yh = yast;
    y[iyhigh] = yh;
  }
  for (i = 0; i < n; i++)
    pdastx[i] = 0.5 * (p[(iyhigh)*ldp + (i)]) + 0.5 * pdash[i];
  funct(data, n, pdastx, &ydast);
  if (ydast > ((((yast) < (yh)) ? (yast) : (yh)))) {
    for (i = 0; i < n; i++)
      xn[i] = 0.0;
    for (j = 0; j < n; j++)
      for (i = 0; i < iw; i++)
        xn[j] += (p[(i)*ldp + (j)]);
    for (i = 0; i < n; i++)
      xn[i] /= (float)iw;
    for (j = 0; j < iw; j++)
      for (i = 0; i < n; i++)
        (p[(j)*ldp + (i)]) -= xn[i] + (p[(iylow)*ldp + (i)]);
    for (j = 0; j < iw; j++) {
      for (i = 0; i < n; i++)
        xn[i] = (p[(j)*ldp + (i)]);
      funct(data, n, xn, &(y[j]));
    }
  } else
    goto L1030;
  goto L2040;
}
```