void remez(double h[], int numtaps, int numband, double bands[], double des[],
           double weight[], int type) {
  double *Grid, *W, *D, *E;
  int i, iter, gridsize, r, *Ext;
  double *taps, c;
  double *x, *y, *ad;
  int symmetry;
  if (type == 1)
    symmetry = 1;
  else
    symmetry = 0;
  r = numtaps / 2;
  if ((numtaps % 2) && (symmetry == 1))
    r++;
  gridsize = 0;
  for (i = 0; i < numband; i++) {
    gridsize += (int)(2 * r * 16 * (bands[2 * i + 1] - bands[2 * i]) + .5);
  }
  if (symmetry == 0) {
    gridsize--;
  }
  Grid = (double *)malloc(gridsize * sizeof(double));
  D = (double *)malloc(gridsize * sizeof(double));
  W = (double *)malloc(gridsize * sizeof(double));
  E = (double *)malloc(gridsize * sizeof(double));
  Ext = (int *)malloc((r + 1) * sizeof(int));
  taps = (double *)malloc((r + 1) * sizeof(double));
  x = (double *)malloc((r + 1) * sizeof(double));
  y = (double *)malloc((r + 1) * sizeof(double));
  ad = (double *)malloc((r + 1) * sizeof(double));
  CreateDenseGrid(r, numtaps, numband, bands, des, weight, &gridsize, Grid, D,
                  W, symmetry);
  InitialGuess(r, Ext, gridsize);
  if (type == 2) {
    for (i = 0; i < gridsize; i++) {
      if (D[i] > 0.0001)
        W[i] = W[i] / Grid[i];
    }
  }
  if (symmetry == 1) {
    if (numtaps % 2 == 0) {
      for (i = 0; i < gridsize; i++) {
        c = cos(3.1415926535897932 * Grid[i]);
        D[i] /= c;
        W[i] *= c;
      }
    }
  } else {
    if (numtaps % 2) {
      for (i = 0; i < gridsize; i++) {
        c = sin(6.2831853071795865 * Grid[i]);
        D[i] /= c;
        W[i] *= c;
      }
    } else {
      for (i = 0; i < gridsize; i++) {
        c = sin(3.1415926535897932 * Grid[i]);
        D[i] /= c;
        W[i] *= c;
      }
    }
  }
  for (iter = 0; iter < 100; iter++) {
    CalcParms(r, Ext, Grid, D, W, ad, x, y);
    CalcError(r, ad, x, y, gridsize, Grid, D, W, E);
    Search(r, Ext, gridsize, E);
    if (isDone(r, Ext, E))
      break;
  }
  if (iter == 100) {
    printf("Reached maximum iteration count.\nResults may be bad.\n");
  }
  CalcParms(r, Ext, Grid, D, W, ad, x, y);
  for (i = 0; i <= numtaps / 2; i++) {
    if (symmetry == 1) {
      if (numtaps % 2)
        c = 1;
      else
        c = cos(3.1415926535897932 * (double)i / numtaps);
    } else {
      if (numtaps % 2)
        c = sin(6.2831853071795865 * (double)i / numtaps);
      else
        c = sin(3.1415926535897932 * (double)i / numtaps);
    }
    taps[i] = ComputeA((double)i / numtaps, r, ad, x, y) * c;
  }
  FreqSample(numtaps, taps, h, symmetry);
  free(Grid);
  free(W);
  free(D);
  free(E);
  free(Ext);
  free(x);
  free(y);
  free(ad);
}


x86 assembly (clang, -O0):
<remez>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xc0,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x18(%rbp)
mov    %esi,-0x1c(%rbp)
mov    %edx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
cmpl   $0x1,0x10(%rbp)
jne    1210 <remez+0x40>
movl   $0x1,-0x9c(%rbp)
jmp    121a <remez+0x4a>
movl   $0x0,-0x9c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x68(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1252 <remez+0x82>
cmpl   $0x1,-0x9c(%rbp)
jne    1252 <remez+0x82>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    12c8 <remez+0xf8>
mov    -0x68(%rbp),%eax
shl    $0x1,%eax
shl    $0x4,%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd74(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    -0x64(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1260 <remez+0x90>
cmpl   $0x0,-0x9c(%rbp)
jne    12de <remez+0x10e>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
movslq -0x64(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x64(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x64(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x64(%rbp),%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x2,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x90(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x3,%rdi
call   10b0 <malloc@plt>
mov    %rax,-0x98(%rbp)
mov    -0x68(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
mov    -0x40(%rbp),%rbx
mov    -0x50(%rbp),%r11
mov    -0x48(%rbp),%r10
mov    -0x9c(%rbp),%eax
lea    -0x64(%rbp),%r14
mov    %r14,(%rsp)
mov    %rbx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %eax,0x20(%rsp)
mov    $0x0,%al
call   1040 <CreateDenseGrid@plt>
mov    -0x68(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    -0x64(%rbp),%edx
mov    $0x0,%al
call   1070 <InitialGuess@plt>
cmpl   $0x2,0x10(%rbp)
jne    146e <remez+0x29e>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1469 <remez+0x299>
mov    -0x50(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xbf3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1456 <remez+0x286>
mov    -0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    145b <remez+0x28b>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1404 <remez+0x234>
jmp    146e <remez+0x29e>
cmpl   $0x1,-0x9c(%rbp)
jne    150b <remez+0x33b>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1506 <remez+0x336>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1501 <remez+0x331>
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xb4e(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   10c0 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
mov    -0x50(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1496 <remez+0x2c6>
jmp    1506 <remez+0x336>
jmp    1612 <remez+0x442>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1596 <remez+0x3c6>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1591 <remez+0x3c1>
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xac6(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
mov    -0x50(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1526 <remez+0x356>
jmp    160d <remez+0x43d>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    1608 <remez+0x438>
mov    -0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  0xa47(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x80(%rbp)
movsd  -0x80(%rbp),%xmm1
mov    -0x50(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    159d <remez+0x3cd>
jmp    160d <remez+0x43d>
jmp    1612 <remez+0x442>
movl   $0x0,-0x60(%rbp)
cmpl   $0x64,-0x60(%rbp)
jge    16e4 <remez+0x514>
mov    -0x68(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x98(%rbp),%r9
mov    -0x88(%rbp),%r10
mov    -0x90(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1090 <CalcParms@plt>
mov    -0x68(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x90(%rbp),%rcx
mov    -0x64(%rbp),%r8d
mov    -0x40(%rbp),%r9
mov    -0x50(%rbp),%r11
mov    -0x48(%rbp),%r10
mov    -0x58(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1050 <CalcError@plt>
mov    -0x68(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    -0x64(%rbp),%edx
mov    -0x58(%rbp),%rcx
mov    $0x0,%al
call   10f0 <Search@plt>
mov    -0x68(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    $0x0,%al
call   10d0 <isDone@plt>
cmp    $0x0,%eax
je     16d1 <remez+0x501>
jmp    16e4 <remez+0x514>
jmp    16d6 <remez+0x506>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1619 <remez+0x449>
cmpl   $0x64,-0x60(%rbp)
jne    16fc <remez+0x52c>
lea    0x933(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x68(%rbp),%edi
mov    -0x70(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x48(%rbp),%r8
mov    -0x98(%rbp),%r9
mov    -0x88(%rbp),%r10
mov    -0x90(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1090 <CalcParms@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0xa0(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
cmp    %ecx,%eax
jg     1872 <remez+0x6a2>
cmpl   $0x1,-0x9c(%rbp)
jne    17bb <remez+0x5eb>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1792 <remez+0x5c2>
movsd  0x888(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    17b6 <remez+0x5e6>
cvtsi2sdl -0x5c(%rbp),%xmm1
movsd  0x861(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   10c0 <cos@plt>
movsd  %xmm0,-0x80(%rbp)
jmp    1821 <remez+0x651>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     17f8 <remez+0x628>
cvtsi2sdl -0x5c(%rbp),%xmm1
movsd  0x82c(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x80(%rbp)
jmp    181c <remez+0x64c>
cvtsi2sdl -0x5c(%rbp),%xmm1
movsd  0x7fb(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1080 <sin@plt>
movsd  %xmm0,-0x80(%rbp)
jmp    1821 <remez+0x651>
cvtsi2sdl -0x5c(%rbp),%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x68(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x90(%rbp),%rcx
mov    $0x1,%al
call   10e0 <ComputeA@plt>
cvtsi2sd %eax,%xmm0
mulsd  -0x80(%rbp),%xmm0
mov    -0x78(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    173b <remez+0x56b>
mov    -0x1c(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x9c(%rbp),%ecx
mov    $0x0,%al
call   10a0 <FreqSample@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
add    $0xc0,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<remez>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,0x18(%rsp)
mov    %rcx,%r14
mov    %rdi,0x78(%rsp)
xor    %ebp,%ebp
cmpl   $0x1,0xc0(%rsp)
01
sete   %al
mov    %esi,%ecx
shr    $0x1f,%ecx
add    %esi,%ecx
mov    %ecx,%edi
sar    %edi
and    $0xfffffffe,%ecx
mov    %esi,0x8(%rsp)
sub    %ecx,%esi
mov    %esi,0xc(%rsp)
setne  %cl
and    %al,%cl
movzbl %cl,%r13d
mov    %rdi,0x48(%rsp)
add    %edi,%r13d
movl   $0x0,0x4(%rsp)
test   %edx,%edx
jle    1250 <remez+0x80>
mov    %r13d,%ecx
shl    $0x5,%ecx
cvtsi2sd %ecx,%xmm8
mov    %edx,%ecx
cmp    $0x4,%edx
jae    1257 <remez+0x87>
xor    %ebx,%ebx
xor    %esi,%esi
jmp    130e <remez+0x13e>
xor    %esi,%esi
jmp    1356 <remez+0x186>
mov    %ecx,%ebx
and    $0xfffffffc,%ebx
movapd %xmm8,%xmm10
unpcklpd %xmm8,%xmm10
mov    %rcx,%rsi
shl    $0x4,%rsi
and    $0xffffffffffffffc0,%rsi
pxor   %xmm2,%xmm2
xor    %edi,%edi
movapd 0xd80(%rip),%xmm9
pxor   %xmm3,%xmm3
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd (%r14,%rdi,1),%xmm5
movupd 0x10(%r14,%rdi,1),%xmm6
movupd 0x20(%r14,%rdi,1),%xmm7
movupd 0x30(%r14,%rdi,1),%xmm0
movapd %xmm5,%xmm4
unpcklpd %xmm6,%xmm4
movapd %xmm7,%xmm1
unpcklpd %xmm0,%xmm1
unpckhpd %xmm6,%xmm5
subpd  %xmm4,%xmm5
unpckhpd %xmm0,%xmm7
subpd  %xmm1,%xmm7
mulpd  %xmm10,%xmm5
addpd  %xmm9,%xmm5
mulpd  %xmm10,%xmm7
addpd  %xmm9,%xmm7
cvttpd2dq %xmm5,%xmm0
cvttpd2dq %xmm7,%xmm1
paddd  %xmm0,%xmm2
paddd  %xmm1,%xmm3
add    $0x40,%rdi
cmp    %rdi,%rsi
jne    1290 <remez+0xc0>
paddd  %xmm2,%xmm3
pshufd $0x55,%xmm3,%xmm0
paddd  %xmm3,%xmm0
movd   %xmm0,%esi
cmp    %rcx,%rbx
je     1352 <remez+0x182>
sub    %rbx,%rcx
shl    $0x4,%rbx
add    %r14,%rbx
add    $0x8,%rbx
movsd  0xcec(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  (%rbx),%xmm0
subsd  -0x8(%rbx),%xmm0
mulsd  %xmm8,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
add    %edi,%esi
add    $0x10,%rbx
add    $0xffffffffffffffff,%rcx
jne    1330 <remez+0x160>
mov    %esi,0x4(%rsp)
mov    %al,%bpl
cmpl   $0x1,0xc0(%rsp)
01
mov    %rbp,0x58(%rsp)
mov    %edx,0x50(%rsp)
je     1373 <remez+0x1a3>
add    $0xffffffff,%esi
mov    %esi,0x4(%rsp)
movslq %esi,%rbx
shl    $0x3,%rbx
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,0x70(%rsp)
movslq %r13d,%rbx
lea    0x4(,%rbx,4),%rdi
call   10b0 <malloc@plt>
mov    %rax,0x28(%rsp)
lea    0x8(,%rbx,8),%rbx
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,0x60(%rsp)
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,0x68(%rsp)
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %rbx,%rdi
call   10b0 <malloc@plt>
mov    %rax,0x38(%rsp)
sub    $0x8,%rsp
lea    0xc(%rsp),%r10
mov    %r13d,%edi
mov    0x10(%rsp),%esi
mov    0x58(%rsp),%edx
mov    %r14,%rcx
mov    %rbp,%rbx
mov    0x20(%rsp),%r8
mov    0x28(%rsp),%r9
xor    %eax,%eax
push   0x60(%rsp)
push   %r15
push   %r12
push   %rbp
push   %r10
call   1050 <CreateDenseGrid@plt>
add    $0x30,%rsp
mov    0x4(%rsp),%edx
mov    %r13d,%edi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   1070 <InitialGuess@plt>
cmpl   $0x2,0xc0(%rsp)
02
jne    1489 <remez+0x2b9>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    1489 <remez+0x2b9>
cmp    $0x1,%eax
jne    1818 <remez+0x648>
xor    %ecx,%ecx
test   $0x1,%al
je     1489 <remez+0x2b9>
movsd  (%r12,%rcx,8),%xmm0
ucomisd 0xba3(%rip),%xmm0
jbe    1489 <remez+0x2b9>
movsd  (%r15,%rcx,8),%xmm0
divsd  0x0(%rbp,%rcx,8),%xmm0
movsd  %xmm0,(%r15,%rcx,8)
cmpl   $0x1,0xc0(%rsp)
01
jne    14f2 <remez+0x322>
cmpl   $0x0,0xc(%rsp)
jne    159d <remez+0x3cd>
cmpl   $0x0,0x4(%rsp)
jle    159d <remez+0x3cd>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rbx,8),%xmm0
mulsd  0xb62(%rip),%xmm0
call   10c0 <cos@plt>
movsd  (%r12,%rbx,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rbx,8)
mulsd  (%r15,%rbx,8),%xmm0
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     14b0 <remez+0x2e0>
jmp    159d <remez+0x3cd>
mov    0x4(%rsp),%eax
cmpl   $0x0,0xc(%rsp)
je     154f <remez+0x37f>
test   %eax,%eax
jle    159d <remez+0x3cd>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rbx,8),%xmm0
mulsd  0xb0a(%rip),%xmm0
call   1080 <sin@plt>
movsd  (%r12,%rbx,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rbx,8)
mulsd  (%r15,%rbx,8),%xmm0
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1510 <remez+0x340>
jmp    159d <remez+0x3cd>
test   %eax,%eax
jle    159d <remez+0x3cd>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%rbp,%rbx,8),%xmm0
mulsd  0xab2(%rip),%xmm0
call   1080 <sin@plt>
movsd  (%r12,%rbx,8),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rbx,8)
mulsd  (%r15,%rbx,8),%xmm0
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     1560 <remez+0x390>
mov    %r15,0x18(%rsp)
mov    %r12,0x20(%rsp)
mov    $0x64,%ebx
mov    %rbp,0x80(%rsp)
mov    0x38(%rsp),%r12
mov    0x40(%rsp),%r15
xchg   %ax,%ax
mov    %r13d,%edi
mov    0x28(%rsp),%rsi
mov    %rbp,%rdx
mov    0x20(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    %r12,%r9
xor    %eax,%eax
push   %r15
mov    0x70(%rsp),%r14
push   %r14
call   1090 <CalcParms@plt>
add    $0x10,%rsp
mov    0x4(%rsp),%r8d
sub    $0x8,%rsp
mov    %r13d,%edi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbp,%r9
xor    %eax,%eax
mov    0x78(%rsp),%r14
push   %r14
push   0x28(%rsp)
push   0x38(%rsp)
call   1060 <CalcError@plt>
add    $0x20,%rsp
mov    0x4(%rsp),%edx
mov    %r13d,%edi
mov    0x28(%rsp),%rbp
mov    %rbp,%rsi
mov    %r14,%rcx
xor    %eax,%eax
call   10f0 <Search@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    0x80(%rsp),%rbp
xor    %eax,%eax
call   10d0 <isDone@plt>
test   %eax,%eax
jne    1668 <remez+0x498>
add    $0xffffffff,%ebx
jne    15c0 <remez+0x3f0>
lea    0x9d5(%rip),%rdi
call   1040 <puts@plt>
mov    %r13d,%edi
mov    0x28(%rsp),%rsi
mov    %rbp,%rdx
mov    0x20(%rsp),%r12
mov    %r12,%rcx
mov    0x18(%rsp),%r15
mov    %r15,%r8
mov    0x38(%rsp),%r9
xor    %eax,%eax
push   0x40(%rsp)
mov    0x70(%rsp),%r14
push   %r14
call   1090 <CalcParms@plt>
add    $0x10,%rsp
cmpl   $0xffffffff,0x8(%rsp)
jge    1719 <remez+0x549>
mov    0x8(%rsp),%edi
mov    0x60(%rsp),%rsi
mov    0x78(%rsp),%rdx
mov    0x58(%rsp),%rcx
xor    %eax,%eax
call   10a0 <FreqSample@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cvtsi2sdl 0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    0x48(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x48(%rsp)
xor    %ebx,%ebx
jmp    179e <remez+0x5ce>
mulsd  0x8e2(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1080 <sin@plt>
movsd  0x30(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,0x50(%rsp)
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
mov    %r13d,%edi
mov    0x38(%rsp),%rsi
mov    %r14,%rdx
mov    0x40(%rsp),%rcx
mov    $0x1,%al
call   10e0 <ComputeA@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x50(%rsp),%xmm0
mov    0x60(%rsp),%rax
movsd  %xmm0,(%rax,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,0x48(%rsp)
je     16a5 <remez+0x4d5>
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
cmpl   $0x1,0xc0(%rsp)
01
jne    17f0 <remez+0x620>
movsd  0x879(%rip),%xmm0
cmpl   $0x0,0xc(%rsp)
movsd  0x10(%rsp),%xmm1
jne    1753 <remez+0x583>
movapd %xmm2,%xmm0
mulsd  0x850(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm2,0x30(%rsp)
call   10c0 <cos@plt>
jmp    1747 <remez+0x577>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpl   $0x0,0xc(%rsp)
movsd  0x10(%rsp),%xmm1
movsd  %xmm2,0x30(%rsp)
movapd %xmm2,%xmm0
je     1736 <remez+0x566>
mulsd  0x815(%rip),%xmm0
jmp    173e <remez+0x56e>
mov    %eax,%edx
and    $0xfffffffe,%edx
xor    %ecx,%ecx
movsd  0x7f1(%rip),%xmm0
jmp    183d <remez+0x66d>
nopl   0x0(%rax)
add    $0x2,%rcx
cmp    %rcx,%rdx
je     1463 <remez+0x293>
movsd  (%r12,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    185b <remez+0x68b>
movsd  (%r15,%rcx,8),%xmm1
divsd  0x0(%rbp,%rcx,8),%xmm1
movsd  %xmm1,(%r15,%rcx,8)
movsd  0x8(%r12,%rcx,8),%xmm1
ucomisd %xmm0,%xmm1
jbe    1830 <remez+0x660>
movsd  0x8(%r15,%rcx,8),%xmm1
divsd  0x8(%rbp,%rcx,8),%xmm1
movsd  %xmm1,0x8(%r15,%rcx,8)
jmp    1830 <remez+0x660>

LLVM IR (-O0):
@.str = [54 x i8] c"Reached maximum iteration count.\0AResults may be bad.\0A\00"
define void @remez(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, i32 %6) {
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32*
%24 = alloca double*
%25 = alloca double
%26 = alloca double*
%27 = alloca double*
%28 = alloca double*
%29 = alloca i32
store double* %0, double** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
store i32 %6, i32* %14
%30 = load i32, i32* %14
%31 = icmp eq i32 %30, 1
br i1 %31, label %32, label %33
32: ; preds = %7
store i32 1, i32* %29
br label %34
33: ; preds = %7
store i32 0, i32* %29
br label %34
34: ; preds = %33, %32
%35 = load i32, i32* %9
%36 = sdiv i32 %35, 2
store i32 %36, i32* %22
%37 = load i32, i32* %9
%38 = srem i32 %37, 2
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %34
%41 = load i32, i32* %29
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i32, i32* %22
%45 = add nsw i32 %44, 1
store i32 %45, i32* %22
br label %46
46: ; preds = %43, %40, %34
store i32 0, i32* %21
store i32 0, i32* %19
br label %47
47: ; preds = %74, %46
%48 = load i32, i32* %19
%49 = load i32, i32* %10
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %77
51: ; preds = %47
%52 = load i32, i32* %22
%53 = mul nsw i32 2, %52
%54 = mul nsw i32 %53, 16
%55 = sitofp i32 %54 to double
%56 = load double*, double** %11
%57 = load i32, i32* %19
%58 = mul nsw i32 2, %57
%59 = add nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %56, i64 %60
%62 = load double, double* %61
%63 = load double*, double** %11
%64 = load i32, i32* %19
%65 = mul nsw i32 2, %64
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %63, i64 %66
%68 = load double, double* %67
%69 = fsub double %62, %68
%70 = call double @llvm.fmuladd.f64(double %55, double %69, double 5.000000e-01)
%71 = fptosi double %70 to i32
%72 = load i32, i32* %21
%73 = add nsw i32 %72, %71
store i32 %73, i32* %21
br label %74
74: ; preds = %51
%75 = load i32, i32* %19
%76 = add nsw i32 %75, 1
store i32 %76, i32* %19
br label %47
77: ; preds = %47
%78 = load i32, i32* %29
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %77
%81 = load i32, i32* %21
%82 = add nsw i32 %81, -1
store i32 %82, i32* %21
br label %83
83: ; preds = %80, %77
%84 = load i32, i32* %21
%85 = sext i32 %84 to i64
%86 = mul i64 %85, 8
%87 = call i8* @malloc(i64 %86)
%88 = bitcast i8* %87 to double*
store double* %88, double** %15
%89 = load i32, i32* %21
%90 = sext i32 %89 to i64
%91 = mul i64 %90, 8
%92 = call i8* @malloc(i64 %91)
%93 = bitcast i8* %92 to double*
store double* %93, double** %17
%94 = load i32, i32* %21
%95 = sext i32 %94 to i64
%96 = mul i64 %95, 8
%97 = call i8* @malloc(i64 %96)
%98 = bitcast i8* %97 to double*
store double* %98, double** %16
%99 = load i32, i32* %21
%100 = sext i32 %99 to i64
%101 = mul i64 %100, 8
%102 = call i8* @malloc(i64 %101)
%103 = bitcast i8* %102 to double*
store double* %103, double** %18
%104 = load i32, i32* %22
%105 = add nsw i32 %104, 1
%106 = sext i32 %105 to i64
%107 = mul i64 %106, 4
%108 = call i8* @malloc(i64 %107)
%109 = bitcast i8* %108 to i32*
store i32* %109, i32** %23
%110 = load i32, i32* %22
%111 = add nsw i32 %110, 1
%112 = sext i32 %111 to i64
%113 = mul i64 %112, 8
%114 = call i8* @malloc(i64 %113)
%115 = bitcast i8* %114 to double*
store double* %115, double** %24
%116 = load i32, i32* %22
%117 = add nsw i32 %116, 1
%118 = sext i32 %117 to i64
%119 = mul i64 %118, 8
%120 = call i8* @malloc(i64 %119)
%121 = bitcast i8* %120 to double*
store double* %121, double** %26
%122 = load i32, i32* %22
%123 = add nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = mul i64 %124, 8
%126 = call i8* @malloc(i64 %125)
%127 = bitcast i8* %126 to double*
store double* %127, double** %27
%128 = load i32, i32* %22
%129 = add nsw i32 %128, 1
%130 = sext i32 %129 to i64
%131 = mul i64 %130, 8
%132 = call i8* @malloc(i64 %131)
%133 = bitcast i8* %132 to double*
store double* %133, double** %28
%134 = load i32, i32* %22
%135 = load i32, i32* %9
%136 = load i32, i32* %10
%137 = load double*, double** %11
%138 = load double*, double** %12
%139 = load double*, double** %13
%140 = load double*, double** %15
%141 = load double*, double** %17
%142 = load double*, double** %16
%143 = load i32, i32* %29
%144 = call i32 (i32, i32, i32, double*, double*, double*, i32*, double*, double*, double*, i32, ...) bitcast (i32 (...)* @CreateDenseGrid to i32 (i32, i32, i32, double*, double*, double*, i32*, double*, double*, double*, i32, ...)*)(i32 %134, i32 %135, i32 %136, double* %137, double* %138, double* %139, i32* %21, double* %140, double* %141, double* %142, i32 %143)
%145 = load i32, i32* %22
%146 = load i32*, i32** %23
%147 = load i32, i32* %21
%148 = call i32 (i32, i32*, i32, ...) bitcast (i32 (...)* @InitialGuess to i32 (i32, i32*, i32, ...)*)(i32 %145, i32* %146, i32 %147)
%149 = load i32, i32* %14
%150 = icmp eq i32 %149, 2
br i1 %150, label %151, label %184
151: ; preds = %83
store i32 0, i32* %19
br label %152
152: ; preds = %180, %151
%153 = load i32, i32* %19
%154 = load i32, i32* %21
%155 = icmp slt i32 %153, %154
br i1 %155, label %156, label %183
156: ; preds = %152
%157 = load double*, double** %17
%158 = load i32, i32* %19
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds double, double* %157, i64 %159
%161 = load double, double* %160
%162 = fcmp ogt double %161, 1.000000e-04
br i1 %162, label %163, label %179
163: ; preds = %156
%164 = load double*, double** %16
%165 = load i32, i32* %19
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds double, double* %164, i64 %166
%168 = load double, double* %167
%169 = load double*, double** %15
%170 = load i32, i32* %19
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds double, double* %169, i64 %171
%173 = load double, double* %172
%174 = fdiv double %168, %173
%175 = load double*, double** %16
%176 = load i32, i32* %19
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds double, double* %175, i64 %177
store double %174, double* %178
br label %179
179: ; preds = %163, %156
br label %180
180: ; preds = %179
%181 = load i32, i32* %19
%182 = add nsw i32 %181, 1
store i32 %182, i32* %19
br label %152
183: ; preds = %152
br label %184
184: ; preds = %183, %83
%185 = load i32, i32* %29
%186 = icmp eq i32 %185, 1
br i1 %186, label %187, label %223
187: ; preds = %184
%188 = load i32, i32* %9
%189 = srem i32 %188, 2
%190 = icmp eq i32 %189, 0
br i1 %190, label %191, label %222
191: ; preds = %187
store i32 0, i32* %19
br label %192
192: ; preds = %218, %191
%193 = load i32, i32* %19
%194 = load i32, i32* %21
%195 = icmp slt i32 %193, %194
br i1 %195, label %196, label %221
196: ; preds = %192
%197 = load double*, double** %15
%198 = load i32, i32* %19
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %197, i64 %199
%201 = load double, double* %200
%202 = fmul double 0x400921FB54442D18, %201
%203 = call double @cos(double %202)
store double %203, double* %25
%204 = load double, double* %25
%205 = load double*, double** %17
%206 = load i32, i32* %19
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds double, double* %205, i64 %207
%209 = load double, double* %208
%210 = fdiv double %209, %204
store double %210, double* %208
%211 = load double, double* %25
%212 = load double*, double** %16
%213 = load i32, i32* %19
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %212, i64 %214
%216 = load double, double* %215
%217 = fmul double %216, %211
store double %217, double* %215
br label %218
218: ; preds = %196
%219 = load i32, i32* %19
%220 = add nsw i32 %219, 1
store i32 %220, i32* %19
br label %192
221: ; preds = %192
br label %222
222: ; preds = %221, %187
br label %290
223: ; preds = %184
%224 = load i32, i32* %9
%225 = srem i32 %224, 2
%226 = icmp ne i32 %225, 0
br i1 %226, label %227, label %258
227: ; preds = %223
store i32 0, i32* %19
br label %228
228: ; preds = %254, %227
%229 = load i32, i32* %19
%230 = load i32, i32* %21
%231 = icmp slt i32 %229, %230
br i1 %231, label %232, label %257
232: ; preds = %228
%233 = load double*, double** %15
%234 = load i32, i32* %19
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %233, i64 %235
%237 = load double, double* %236
%238 = fmul double 0x401921FB54442D18, %237
%239 = call double @sin(double %238)
store double %239, double* %25
%240 = load double, double* %25
%241 = load double*, double** %17
%242 = load i32, i32* %19
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %241, i64 %243
%245 = load double, double* %244
%246 = fdiv double %245, %240
store double %246, double* %244
%247 = load double, double* %25
%248 = load double*, double** %16
%249 = load i32, i32* %19
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds double, double* %248, i64 %250
%252 = load double, double* %251
%253 = fmul double %252, %247
store double %253, double* %251
br label %254
254: ; preds = %232
%255 = load i32, i32* %19
%256 = add nsw i32 %255, 1
store i32 %256, i32* %19
br label %228
257: ; preds = %228
br label %289
258: ; preds = %223
store i32 0, i32* %19
br label %259
259: ; preds = %285, %258
%260 = load i32, i32* %19
%261 = load i32, i32* %21
%262 = icmp slt i32 %260, %261
br i1 %262, label %263, label %288
263: ; preds = %259
%264 = load double*, double** %15
%265 = load i32, i32* %19
%266 = sext i32 %265 to i64
%267 = getelementptr inbounds double, double* %264, i64 %266
%268 = load double, double* %267
%269 = fmul double 0x400921FB54442D18, %268
%270 = call double @sin(double %269)
store double %270, double* %25
%271 = load double, double* %25
%272 = load double*, double** %17
%273 = load i32, i32* %19
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds double, double* %272, i64 %274
%276 = load double, double* %275
%277 = fdiv double %276, %271
store double %277, double* %275
%278 = load double, double* %25
%279 = load double*, double** %16
%280 = load i32, i32* %19
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds double, double* %279, i64 %281
%283 = load double, double* %282
%284 = fmul double %283, %278
store double %284, double* %282
br label %285
285: ; preds = %263
%286 = load i32, i32* %19
%287 = add nsw i32 %286, 1
store i32 %287, i32* %19
br label %259
288: ; preds = %259
br label %289
289: ; preds = %288, %257
br label %290
290: ; preds = %289, %222
store i32 0, i32* %20
br label %291
291: ; preds = %326, %290
%292 = load i32, i32* %20
%293 = icmp slt i32 %292, 100
br i1 %293, label %294, label %329
294: ; preds = %291
%295 = load i32, i32* %22
%296 = load i32*, i32** %23
%297 = load double*, double** %15
%298 = load double*, double** %17
%299 = load double*, double** %16
%300 = load double*, double** %28
%301 = load double*, double** %26
%302 = load double*, double** %27
%303 = call i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...) bitcast (i32 (...)* @CalcParms to i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...)*)(i32 %295, i32* %296, double* %297, double* %298, double* %299, double* %300, double* %301, double* %302)
%304 = load i32, i32* %22
%305 = load double*, double** %28
%306 = load double*, double** %26
%307 = load double*, double** %27
%308 = load i32, i32* %21
%309 = load double*, double** %15
%310 = load double*, double** %17
%311 = load double*, double** %16
%312 = load double*, double** %18
%313 = call i32 (i32, double*, double*, double*, i32, double*, double*, double*, double*, ...) bitcast (i32 (...)* @CalcError to i32 (i32, double*, double*, double*, i32, double*, double*, double*, double*, ...)*)(i32 %304, double* %305, double* %306, double* %307, i32 %308, double* %309, double* %310, double* %311, double* %312)
%314 = load i32, i32* %22
%315 = load i32*, i32** %23
%316 = load i32, i32* %21
%317 = load double*, double** %18
%318 = call i32 (i32, i32*, i32, double*, ...) bitcast (i32 (...)* @Search to i32 (i32, i32*, i32, double*, ...)*)(i32 %314, i32* %315, i32 %316, double* %317)
%319 = load i32, i32* %22
%320 = load i32*, i32** %23
%321 = load double*, double** %18
%322 = call i32 (i32, i32*, double*, ...) bitcast (i32 (...)* @isDone to i32 (i32, i32*, double*, ...)*)(i32 %319, i32* %320, double* %321)
%323 = icmp ne i32 %322, 0
br i1 %323, label %324, label %325
324: ; preds = %294
br label %329
325: ; preds = %294
br label %326
326: ; preds = %325
%327 = load i32, i32* %20
%328 = add nsw i32 %327, 1
store i32 %328, i32* %20
br label %291
329: ; preds = %324, %291
%330 = load i32, i32* %20
%331 = icmp eq i32 %330, 100
br i1 %331, label %332, label %334
332: ; preds = %329
%333 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %334
334: ; preds = %332, %329
%335 = load i32, i32* %22
%336 = load i32*, i32** %23
%337 = load double*, double** %15
%338 = load double*, double** %17
%339 = load double*, double** %16
%340 = load double*, double** %28
%341 = load double*, double** %26
%342 = load double*, double** %27
%343 = call i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...) bitcast (i32 (...)* @CalcParms to i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...)*)(i32 %335, i32* %336, double* %337, double* %338, double* %339, double* %340, double* %341, double* %342)
store i32 0, i32* %19
br label %344
344: ; preds = %405, %334
%345 = load i32, i32* %19
%346 = load i32, i32* %9
%347 = sdiv i32 %346, 2
%348 = icmp sle i32 %345, %347
br i1 %348, label %349, label %408
349: ; preds = %344
%350 = load i32, i32* %29
%351 = icmp eq i32 %350, 1
br i1 %351, label %352, label %366
352: ; preds = %349
%353 = load i32, i32* %9
%354 = srem i32 %353, 2
%355 = icmp ne i32 %354, 0
br i1 %355, label %356, label %357
356: ; preds = %352
store double 1.000000e+00, double* %25
br label %365
357: ; preds = %352
%358 = load i32, i32* %19
%359 = sitofp i32 %358 to double
%360 = fmul double 0x400921FB54442D18, %359
%361 = load i32, i32* %9
%362 = sitofp i32 %361 to double
%363 = fdiv double %360, %362
%364 = call double @cos(double %363)
store double %364, double* %25
br label %365
365: ; preds = %357, %356
br label %387
366: ; preds = %349
%367 = load i32, i32* %9
%368 = srem i32 %367, 2
%369 = icmp ne i32 %368, 0
br i1 %369, label %370, label %378
370: ; preds = %366
%371 = load i32, i32* %19
%372 = sitofp i32 %371 to double
%373 = fmul double 0x401921FB54442D18, %372
%374 = load i32, i32* %9
%375 = sitofp i32 %374 to double
%376 = fdiv double %373, %375
%377 = call double @sin(double %376)
store double %377, double* %25
br label %386
378: ; preds = %366
%379 = load i32, i32* %19
%380 = sitofp i32 %379 to double
%381 = fmul double 0x400921FB54442D18, %380
%382 = load i32, i32* %9
%383 = sitofp i32 %382 to double
%384 = fdiv double %381, %383
%385 = call double @sin(double %384)
store double %385, double* %25
br label %386
386: ; preds = %378, %370
br label %387
387: ; preds = %386, %365
%388 = load i32, i32* %19
%389 = sitofp i32 %388 to double
%390 = load i32, i32* %9
%391 = sitofp i32 %390 to double
%392 = fdiv double %389, %391
%393 = load i32, i32* %22
%394 = load double*, double** %28
%395 = load double*, double** %26
%396 = load double*, double** %27
%397 = call i32 (double, i32, double*, double*, double*, ...) bitcast (i32 (...)* @ComputeA to i32 (double, i32, double*, double*, double*, ...)*)(double %392, i32 %393, double* %394, double* %395, double* %396)
%398 = sitofp i32 %397 to double
%399 = load double, double* %25
%400 = fmul double %398, %399
%401 = load double*, double** %24
%402 = load i32, i32* %19
%403 = sext i32 %402 to i64
%404 = getelementptr inbounds double, double* %401, i64 %403
store double %400, double* %404
br label %405
405: ; preds = %387
%406 = load i32, i32* %19
%407 = add nsw i32 %406, 1
store i32 %407, i32* %19
br label %344
408: ; preds = %344
%409 = load i32, i32* %9
%410 = load double*, double** %24
%411 = load double*, double** %8
%412 = load i32, i32* %29
%413 = call i32 (i32, double*, double*, i32, ...) bitcast (i32 (...)* @FreqSample to i32 (i32, double*, double*, i32, ...)*)(i32 %409, double* %410, double* %411, i32 %412)
%414 = load double*, double** %15
%415 = bitcast double* %414 to i8*
%416 = load double*, double** %16
%417 = bitcast double* %416 to i8*
%418 = load double*, double** %17
%419 = bitcast double* %418 to i8*
%420 = load double*, double** %18
%421 = bitcast double* %420 to i8*
%422 = load i32*, i32** %23
%423 = bitcast i32* %422 to i8*
%424 = load double*, double** %26
%425 = bitcast double* %424 to i8*
%426 = load double*, double** %27
%427 = bitcast double* %426 to i8*
%428 = load double*, double** %28
%429 = bitcast double* %428 to i8*
ret void
}

LLVM IR (-O2):
@str = [53 x i8] c"Reached maximum iteration count.\0AResults may be bad.\00"
define void @remez(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, i32 %6) {
%8 = alloca i32
%9 = bitcast i32* %8 to i8*
%10 = icmp eq i32 %6, 1
%11 = zext i1 %10 to i32
%12 = sdiv i32 %1, 2
%13 = srem i32 %1, 2
%14 = icmp ne i32 %13, 0
%15 = and i1 %14, %10
%16 = zext i1 %15 to i32
%17 = add nsw i32 %12, %16
store i32 0, i32* %8
%18 = icmp sgt i32 %2, 0
br i1 %18, label %19, label %84
19: ; preds = %7
%20 = shl nsw i32 %17, 5
%21 = sitofp i32 %20 to double
%22 = zext i32 %2 to i64
%23 = icmp ult i32 %2, 4
br i1 %23, label %64, label %24
24: ; preds = %19
%25 = and i64 %22, 4294967292
%26 = insertelement <2 x double> poison, double %21, i64 0
%27 = shufflevector <2 x double> %26, <2 x double> poison, <2 x i32> zeroinitializer
%28 = insertelement <2 x double> poison, double %21, i64 0
%29 = shufflevector <2 x double> %28, <2 x double> poison, <2 x i32> zeroinitializer
%30 = getelementptr inbounds double, double* %3, i64 -1
%31 = getelementptr inbounds double, double* %3, i64 -1
br label %32
32: ; preds = %32, %24
%33 = phi i64 [ 0, %24 ], [ %58, %32 ]
%34 = phi <2 x i32> [ zeroinitializer, %24 ], [ %56, %32 ]
%35 = phi <2 x i32> [ zeroinitializer, %24 ], [ %57, %32 ]
%36 = shl nuw nsw i64 %33, 1
%37 = shl i64 %33, 1
%38 = or i64 %36, 1
%39 = or i64 %37, 5
%40 = getelementptr inbounds double, double* %30, i64 %38
%41 = bitcast double* %40 to <4 x double>*
%42 = getelementptr inbounds double, double* %31, i64 %39
%43 = bitcast double* %42 to <4 x double>*
%44 = load <4 x double>, <4 x double>* %41
%45 = load <4 x double>, <4 x double>* %43
%46 = shufflevector <4 x double> %44, <4 x double> poison, <2 x i32> <i32 0, i32 2>
%47 = shufflevector <4 x double> %45, <4 x double> poison, <2 x i32> <i32 0, i32 2>
%48 = shufflevector <4 x double> %44, <4 x double> poison, <2 x i32> <i32 1, i32 3>
%49 = shufflevector <4 x double> %45, <4 x double> poison, <2 x i32> <i32 1, i32 3>
%50 = fsub <2 x double> %48, %46
%51 = fsub <2 x double> %49, %47
%52 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %27, <2 x double> %50, <2 x double> <double 5.000000e-01, double 5.000000e-01>)
%53 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %29, <2 x double> %51, <2 x double> <double 5.000000e-01, double 5.000000e-01>)
%54 = fptosi <2 x double> %52 to <2 x i32>
%55 = fptosi <2 x double> %53 to <2 x i32>
%56 = add <2 x i32> %34, %54
%57 = add <2 x i32> %35, %55
%58 = add nuw i64 %33, 4
%59 = icmp eq i64 %58, %25
br i1 %59, label %60, label %32
60: ; preds = %32
%61 = add <2 x i32> %57, %56
%62 = call i32 @llvm.vector.reduce.add.v2i32(<2 x i32> %61)
%63 = icmp eq i64 %25, %22
br i1 %63, label %82, label %64
64: ; preds = %19, %60
%65 = phi i64 [ 0, %19 ], [ %25, %60 ]
%66 = phi i32 [ 0, %19 ], [ %62, %60 ]
br label %67
67: ; preds = %64, %67
%68 = phi i64 [ %80, %67 ], [ %65, %64 ]
%69 = phi i32 [ %79, %67 ], [ %66, %64 ]
%70 = shl nuw nsw i64 %68, 1
%71 = or i64 %70, 1
%72 = getelementptr inbounds double, double* %3, i64 %71
%73 = load double, double* %72
%74 = getelementptr inbounds double, double* %3, i64 %70
%75 = load double, double* %74
%76 = fsub double %73, %75
%77 = tail call double @llvm.fmuladd.f64(double %21, double %76, double 5.000000e-01)
%78 = fptosi double %77 to i32
%79 = add nsw i32 %69, %78
%80 = add nuw nsw i64 %68, 1
%81 = icmp eq i64 %80, %22
br i1 %81, label %82, label %67
82: ; preds = %67, %60
%83 = phi i32 [ %62, %60 ], [ %79, %67 ]
store i32 %83, i32* %8
br label %84
84: ; preds = %82, %7
%85 = phi i32 [ %83, %82 ], [ 0, %7 ]
br i1 %10, label %88, label %86
86: ; preds = %84
%87 = add nsw i32 %85, -1
store i32 %87, i32* %8
br label %88
88: ; preds = %86, %84
%89 = phi i32 [ %87, %86 ], [ %85, %84 ]
%90 = sext i32 %89 to i64
%91 = shl nsw i64 %90, 3
%92 = tail call i8* @malloc(i64 %91)
%93 = bitcast i8* %92 to double*
%94 = tail call i8* @malloc(i64 %91)
%95 = bitcast i8* %94 to double*
%96 = tail call i8* @malloc(i64 %91)
%97 = bitcast i8* %96 to double*
%98 = tail call i8* @malloc(i64 %91)
%99 = bitcast i8* %98 to double*
%100 = add nsw i32 %17, 1
%101 = sext i32 %100 to i64
%102 = shl nsw i64 %101, 2
%103 = tail call i8* @malloc(i64 %102)
%104 = bitcast i8* %103 to i32*
%105 = shl nsw i64 %101, 3
%106 = tail call i8* @malloc(i64 %105)
%107 = bitcast i8* %106 to double*
%108 = tail call i8* @malloc(i64 %105)
%109 = bitcast i8* %108 to double*
%110 = tail call i8* @malloc(i64 %105)
%111 = bitcast i8* %110 to double*
%112 = tail call i8* @malloc(i64 %105)
%113 = bitcast i8* %112 to double*
%114 = call i32 (i32, i32, i32, double*, double*, double*, i32*, double*, double*, double*, i32, ...) bitcast (i32 (...)* @CreateDenseGrid to i32 (i32, i32, i32, double*, double*, double*, i32*, double*, double*, double*, i32, ...)*)(i32 %17, i32 %1, i32 %2, double* %3, double* %4, double* %5, i32* %8, double* %93, double* %95, double* %97, i32 %11)
%115 = load i32, i32* %8
%116 = call i32 (i32, i32*, i32, ...) bitcast (i32 (...)* @InitialGuess to i32 (i32, i32*, i32, ...)*)(i32 %17, i32* %104, i32 %115)
%117 = icmp eq i32 %6, 2
br i1 %117, label %118, label %167
118: ; preds = %88
%119 = load i32, i32* %8
%120 = icmp sgt i32 %119, 0
br i1 %120, label %121, label %167
121: ; preds = %118
%122 = zext i32 %119 to i64
%123 = and i64 %122, 1
%124 = icmp eq i32 %119, 1
br i1 %124, label %154, label %125
125: ; preds = %121
%126 = and i64 %122, 4294967294
br label %127
127: ; preds = %150, %125
%128 = phi i64 [ 0, %125 ], [ %151, %150 ]
%129 = phi i64 [ 0, %125 ], [ %152, %150 ]
%130 = getelementptr inbounds double, double* %95, i64 %128
%131 = load double, double* %130
%132 = fcmp ogt double %131, 1.000000e-04
br i1 %132, label %133, label %139
133: ; preds = %127
%134 = getelementptr inbounds double, double* %97, i64 %128
%135 = load double, double* %134
%136 = getelementptr inbounds double, double* %93, i64 %128
%137 = load double, double* %136
%138 = fdiv double %135, %137
store double %138, double* %134
br label %139
139: ; preds = %127, %133
%140 = or i64 %128, 1
%141 = getelementptr inbounds double, double* %95, i64 %140
%142 = load double, double* %141
%143 = fcmp ogt double %142, 1.000000e-04
br i1 %143, label %144, label %150
144: ; preds = %139
%145 = getelementptr inbounds double, double* %97, i64 %140
%146 = load double, double* %145
%147 = getelementptr inbounds double, double* %93, i64 %140
%148 = load double, double* %147
%149 = fdiv double %146, %148
store double %149, double* %145
br label %150
150: ; preds = %144, %139
%151 = add nuw nsw i64 %128, 2
%152 = add i64 %129, 2
%153 = icmp eq i64 %152, %126
br i1 %153, label %154, label %127
154: ; preds = %150, %121
%155 = phi i64 [ 0, %121 ], [ %151, %150 ]
%156 = icmp eq i64 %123, 0
br i1 %156, label %167, label %157
157: ; preds = %154
%158 = getelementptr inbounds double, double* %95, i64 %155
%159 = load double, double* %158
%160 = fcmp ogt double %159, 1.000000e-04
br i1 %160, label %161, label %167
161: ; preds = %157
%162 = getelementptr inbounds double, double* %97, i64 %155
%163 = load double, double* %162
%164 = getelementptr inbounds double, double* %93, i64 %155
%165 = load double, double* %164
%166 = fdiv double %163, %165
store double %166, double* %162
br label %167
167: ; preds = %154, %161, %157, %118, %88
br i1 %10, label %168, label %189
168: ; preds = %167
%169 = icmp eq i32 %13, 0
%170 = load i32, i32* %8
%171 = icmp sgt i32 %170, 0
%172 = select i1 %169, i1 %171, i1 false
br i1 %172, label %173, label %226
173: ; preds = %168, %173
%174 = phi i64 [ %185, %173 ], [ 0, %168 ]
%175 = getelementptr inbounds double, double* %93, i64 %174
%176 = load double, double* %175
%177 = fmul double %176, 0x400921FB54442D18
%178 = call double @cos(double %177)
%179 = getelementptr inbounds double, double* %95, i64 %174
%180 = load double, double* %179
%181 = fdiv double %180, %178
store double %181, double* %179
%182 = getelementptr inbounds double, double* %97, i64 %174
%183 = load double, double* %182
%184 = fmul double %178, %183
store double %184, double* %182
%185 = add nuw nsw i64 %174, 1
%186 = load i32, i32* %8
%187 = sext i32 %186 to i64
%188 = icmp slt i64 %185, %187
br i1 %188, label %173, label %226
189: ; preds = %167
%190 = load i32, i32* %8
%191 = icmp sgt i32 %190, 0
br i1 %14, label %193, label %192
192: ; preds = %189
br i1 %191, label %210, label %226
193: ; preds = %189
br i1 %191, label %194, label %226
194: ; preds = %193, %194
%195 = phi i64 [ %206, %194 ], [ 0, %193 ]
%196 = getelementptr inbounds double, double* %93, i64 %195
%197 = load double, double* %196
%198 = fmul double %197, 0x401921FB54442D18
%199 = call double @sin(double %198)
%200 = getelementptr inbounds double, double* %95, i64 %195
%201 = load double, double* %200
%202 = fdiv double %201, %199
store double %202, double* %200
%203 = getelementptr inbounds double, double* %97, i64 %195
%204 = load double, double* %203
%205 = fmul double %199, %204
store double %205, double* %203
%206 = add nuw nsw i64 %195, 1
%207 = load i32, i32* %8
%208 = sext i32 %207 to i64
%209 = icmp slt i64 %206, %208
br i1 %209, label %194, label %226
210: ; preds = %192, %210
%211 = phi i64 [ %222, %210 ], [ 0, %192 ]
%212 = getelementptr inbounds double, double* %93, i64 %211
%213 = load double, double* %212
%214 = fmul double %213, 0x400921FB54442D18
%215 = call double @sin(double %214)
%216 = getelementptr inbounds double, double* %95, i64 %211
%217 = load double, double* %216
%218 = fdiv double %217, %215
store double %218, double* %216
%219 = getelementptr inbounds double, double* %97, i64 %211
%220 = load double, double* %219
%221 = fmul double %215, %220
store double %221, double* %219
%222 = add nuw nsw i64 %211, 1
%223 = load i32, i32* %8
%224 = sext i32 %223 to i64
%225 = icmp slt i64 %222, %224
br i1 %225, label %210, label %226
226: ; preds = %210, %194, %173, %192, %193, %168
br label %227
227: ; preds = %226, %236
%228 = phi i32 [ %237, %236 ], [ 0, %226 ]
%229 = call i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...) bitcast (i32 (...)* @CalcParms to i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...)*)(i32 %17, i32* %104, double* %93, double* %95, double* %97, double* %113, double* %109, double* %111)
%230 = load i32, i32* %8
%231 = call i32 (i32, double*, double*, double*, i32, double*, double*, double*, double*, ...) bitcast (i32 (...)* @CalcError to i32 (i32, double*, double*, double*, i32, double*, double*, double*, double*, ...)*)(i32 %17, double* %113, double* %109, double* %111, i32 %230, double* %93, double* %95, double* %97, double* %99)
%232 = load i32, i32* %8
%233 = call i32 (i32, i32*, i32, double*, ...) bitcast (i32 (...)* @Search to i32 (i32, i32*, i32, double*, ...)*)(i32 %17, i32* %104, i32 %232, double* %99)
%234 = call i32 (i32, i32*, double*, ...) bitcast (i32 (...)* @isDone to i32 (i32, i32*, double*, ...)*)(i32 %17, i32* %104, double* %99)
%235 = icmp eq i32 %234, 0
br i1 %235, label %236, label %241
236: ; preds = %227
%237 = add nuw nsw i32 %228, 1
%238 = icmp eq i32 %237, 100
br i1 %238, label %239, label %227
239: ; preds = %236
%240 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
br label %241
241: ; preds = %227, %239
%242 = call i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...) bitcast (i32 (...)* @CalcParms to i32 (i32, i32*, double*, double*, double*, double*, double*, double*, ...)*)(i32 %17, i32* %104, double* %93, double* %95, double* %97, double* %113, double* %109, double* %111)
%243 = icmp slt i32 %1, -1
br i1 %243, label %275, label %244
244: ; preds = %241
%245 = sitofp i32 %1 to double
%246 = add nsw i32 %12, 1
%247 = zext i32 %246 to i64
br label %248
248: ; preds = %244, %266
%249 = phi i64 [ 0, %244 ], [ %273, %266 ]
%250 = trunc i64 %249 to i32
%251 = sitofp i32 %250 to double
br i1 %10, label %252, label %257
252: ; preds = %248
br i1 %14, label %266, label %253
253: ; preds = %252
%254 = fmul double %251, 0x400921FB54442D18
%255 = fdiv double %254, %245
%256 = call double @cos(double %255)
br label %266
257: ; preds = %248
br i1 %14, label %258, label %262
258: ; preds = %257
%259 = fmul double %251, 0x401921FB54442D18
%260 = fdiv double %259, %245
%261 = call double @sin(double %260)
br label %266
262: ; preds = %257
%263 = fmul double %251, 0x400921FB54442D18
%264 = fdiv double %263, %245
%265 = call double @sin(double %264)
br label %266
266: ; preds = %252, %258, %262, %253
%267 = phi double [ %261, %258 ], [ %265, %262 ], [ %256, %253 ], [ 1.000000e+00, %252 ]
%268 = fdiv double %251, %245
%269 = call i32 (double, i32, double*, double*, double*, ...) bitcast (i32 (...)* @ComputeA to i32 (double, i32, double*, double*, double*, ...)*)(double %268, i32 %17, double* %113, double* %109, double* %111)
%270 = sitofp i32 %269 to double
%271 = fmul double %267, %270
%272 = getelementptr inbounds double, double* %107, i64 %249
store double %271, double* %272
%273 = add nuw nsw i64 %249, 1
%274 = icmp eq i64 %273, %247
br i1 %274, label %275, label %248
275: ; preds = %266, %241
%276 = call i32 (i32, double*, double*, i32, ...) bitcast (i32 (...)* @FreqSample to i32 (i32, double*, double*, i32, ...)*)(i32 %1, double* %107, double* %0, i32 %11)
ret void
}