#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fabs(double);
double sqrt(double);
int qreval(double *ev, double *dp, int n) {
  double cc, sc, d, x, y, h, tzr = 1.e-15;
  int j, k, m, mqr = 8 * n;
  for (j = 0, m = n - 1;; ++j) {
    while (1) {
      if (m < 1)
        return 0;
      k = m - 1;
      if (fabs(dp[k]) <= fabs(ev[m]) * tzr)
        --m;
      else {
        x = (ev[k] - ev[m]) / 2.;
        h = sqrt(x * x + dp[k] * dp[k]);
        if (m > 1 && fabs(dp[m - 2]) > fabs(ev[k]) * tzr)
          break;
        x += ev[m];
        ev[m--] = x - h;
        ev[m--] = x + h;
      }
    }
    if (j > mqr)
      return -1;
    if (x > 0.)
      d = ev[m] + x - h;
    else
      d = ev[m] + x + h;
    cc = 1.;
    y = 0.;
    ev[0] -= d;
    for (k = 0; k < m; ++k) {
      x = ev[k] * cc - y;
      y = dp[k] * cc;
      h = sqrt(x * x + dp[k] * dp[k]);
      if (k > 0)
        dp[k - 1] = sc * h;
      ev[k] = cc * h;
      cc = x / h;
      sc = dp[k] / h;
      ev[k + 1] -= d;
      y *= sc;
      ev[k] = cc * (ev[k] + y) + ev[k + 1] * sc * sc + d;
    }
    ev[k] = ev[k] * cc - y;
    dp[k - 1] = ev[k] * sc;
    ev[k] = ev[k] * cc + d;
  }
  return 0;
}


x86 assembly (clang, -O0):
<qreval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x68(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    114e <qreval+0x3e>
cmpl   $0x1,-0x64(%rbp)
jge    1164 <qreval+0x54>
movl   $0x0,-0x4(%rbp)
jmp    1586 <qreval+0x476>
mov    -0x64(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xe9f(%rip),%xmm0
pand   %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe87(%rip),%xmm2
pand   %xmm2,%xmm0
mulsd  -0x58(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     11ba <qreval+0xaa>
mov    -0x64(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x64(%rbp)
jmp    12c7 <qreval+0x1b7>
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  0xe2c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
cmpl   $0x1,-0x64(%rbp)
jle    126e <qreval+0x15e>
mov    -0x18(%rbp),%rax
mov    -0x64(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xde2(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xdca(%rip),%xmm2
pand   %xmm2,%xmm1
mulsd  -0x58(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    126e <qreval+0x15e>
jmp    12cc <qreval+0x1bc>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0x64(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x64(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
mov    %edx,-0x64(%rbp)
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    114e <qreval+0x3e>
mov    -0x5c(%rbp),%eax
cmp    -0x68(%rbp),%eax
jle    12e4 <qreval+0x1d4>
movl   $0xffffffff,-0x4(%rbp)
jmp    1586 <qreval+0x476>
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1317 <qreval+0x207>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x40(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1333 <qreval+0x223>
mov    -0x10(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x40(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xcd5(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%eax
cmp    -0x64(%rbp),%eax
jge    14e5 <qreval+0x3d5>
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
cmpl   $0x0,-0x60(%rbp)
jle    141e <qreval+0x30e>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x40(%rbp),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x38(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
addsd  -0x48(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x60(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    1364 <qreval+0x254>
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x60(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1149 <qreval+0x39>
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qreval>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%r14
xor    %esi,%esi
cmp    $0x2,%edx
jl     150b <qreval+0x3fb>
mov    %rdi,%r15
mov    %edx,%ebp
add    $0xffffffff,%ebp
lea    0x1(,%rdx,8),%r13d
xor    %ecx,%ecx
test   %r13d,%r13d
mov    $0x0,%eax
mov    %rax,0x10(%rsp)
cmovle %ecx,%r13d
movapd 0xea9(%rip),%xmm4
movsd  0xed1(%rip),%xmm5
xorpd  %xmm9,%xmm9
jmp    1198 <qreval+0x88>
cs nopw 0x0(%rax,%rax,1)
addsd  (%r15,%r12,8),%xmm3
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r15,%r12,8)
addsd  %xmm0,%xmm3
movsd  %xmm3,(%r15,%rbx,8)
mov    %eax,%ebp
test   %eax,%eax
jle    1509 <qreval+0x3f9>
lea    -0x1(%rbp),%ebx
movsd  (%r14,%rbx,8),%xmm1
movapd %xmm1,%xmm2
andpd  %xmm4,%xmm2
mov    %ebp,%r12d
movsd  (%r15,%r12,8),%xmm0
movapd %xmm0,%xmm3
andpd  %xmm4,%xmm3
mulsd  %xmm5,%xmm3
ucomisd %xmm2,%xmm3
mov    %ebx,%eax
jae    118e <qreval+0x7e>
movsd  (%r15,%rbx,8),%xmm3
subsd  %xmm0,%xmm3
mulsd  0xe60(%rip),%xmm3
mulsd  %xmm1,%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm9,%xmm0
jb     1200 <qreval+0xf0>
sqrtsd %xmm0,%xmm0
jmp    1226 <qreval+0x116>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm3,0x8(%rsp)
call   1030 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
xorpd  %xmm9,%xmm9
movsd  0xe12(%rip),%xmm5
movapd 0xdda(%rip),%xmm4
lea    -0x2(%rbp),%eax
cmp    $0x2,%ebp
jb     1170 <qreval+0x60>
mov    %eax,%ecx
movsd  (%r14,%rcx,8),%xmm1
andpd  %xmm4,%xmm1
movsd  (%r15,%rbx,8),%xmm2
andpd  %xmm4,%xmm2
mulsd  %xmm5,%xmm2
ucomisd %xmm2,%xmm1
jbe    1170 <qreval+0x60>
cmp    %r13d,0x10(%rsp)
je     151c <qreval+0x40c>
movsd  (%r15,%r12,8),%xmm1
addsd  %xmm3,%xmm1
movapd %xmm0,%xmm2
xorpd  0xd99(%rip),%xmm2
xorpd  %xmm7,%xmm7
xorpd  %xmm8,%xmm8
cmpltsd %xmm3,%xmm8
andpd  %xmm8,%xmm2
andnpd %xmm0,%xmm8
orpd   %xmm2,%xmm8
addsd  %xmm1,%xmm8
movsd  (%r15),%xmm2
subsd  %xmm8,%xmm2
movsd  %xmm2,(%r15)
xor    %esi,%esi
test   %ebp,%ebp
jle    12e1 <qreval+0x1d1>
movsd  (%r14),%xmm7
movapd %xmm7,%xmm1
mulsd  %xmm7,%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm9,%xmm0
movapd %xmm8,0x30(%rsp)
mov    %r13d,0x1c(%rsp)
jb     12f6 <qreval+0x1e6>
sqrtsd %xmm0,%xmm0
jmp    132f <qreval+0x21f>
movapd 0xd37(%rip),%xmm6
unpcklpd 0x20(%rsp),%xmm6
xor    %eax,%eax
jmp    14b2 <qreval+0x3a2>
movsd  %xmm7,0x8(%rsp)
movapd %xmm2,0x20(%rsp)
call   1030 <sqrt@plt>
movapd 0x20(%rsp),%xmm2
movsd  0x8(%rsp),%xmm7
movapd 0x30(%rsp),%xmm8
xorpd  %xmm9,%xmm9
movsd  0xd09(%rip),%xmm5
movapd 0xcd1(%rip),%xmm4
movsd  0x8(%r15),%xmm3
movsd  %xmm0,(%r15)
movhpd (%r14),%xmm2
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
divpd  %xmm1,%xmm2
subsd  %xmm8,%xmm3
movsd  %xmm3,0x8(%r15)
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
mulsd  %xmm1,%xmm7
addsd  %xmm7,%xmm0
movapd %xmm1,%xmm6
mulsd  %xmm3,%xmm6
mulsd  %xmm1,%xmm6
mulsd  %xmm2,%xmm0
addsd  %xmm6,%xmm0
addsd  %xmm8,%xmm0
movsd  %xmm0,(%r15)
mov    %r12,%rbx
add    $0xffffffffffffffff,%rbx
xor    %r13d,%r13d
movapd %xmm2,%xmm6
jmp    146c <qreval+0x35c>
nopw   0x0(%rax,%rax,1)
movsd  %xmm7,0x8(%rsp)
movapd %xmm3,0x20(%rsp)
movapd %xmm6,0x40(%rsp)
call   1030 <sqrt@plt>
movapd 0x40(%rsp),%xmm6
movapd 0x20(%rsp),%xmm3
movsd  0x8(%rsp),%xmm7
movapd 0x30(%rsp),%xmm8
xorpd  %xmm9,%xmm9
movsd  0xc53(%rip),%xmm5
movapd 0xc1b(%rip),%xmm4
mulsd  %xmm6,%xmm7
movapd %xmm6,%xmm1
movapd %xmm6,%xmm2
unpckhpd %xmm6,%xmm2
mulsd  %xmm0,%xmm2
mov    %r13d,%eax
movsd  %xmm2,(%r14,%rax,8)
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r15,%r13,8)
movhpd 0x8(%r14,%r13,8),%xmm3
unpcklpd %xmm0,%xmm0
movapd %xmm3,%xmm6
divpd  %xmm0,%xmm6
movsd  0x10(%r15,%r13,8),%xmm3
subsd  %xmm8,%xmm3
movsd  %xmm3,0x10(%r15,%r13,8)
movapd %xmm6,%xmm0
unpckhpd %xmm6,%xmm0
mulsd  %xmm0,%xmm7
addsd  %xmm7,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm6,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm8,%xmm1
movsd  %xmm1,0x8(%r15,%r13,8)
add    $0x1,%r13
cmp    %r13,%rbx
je     14a3 <qreval+0x393>
mulsd  %xmm6,%xmm3
subsd  %xmm7,%xmm3
movsd  0x8(%r14,%r13,8),%xmm7
movapd %xmm7,%xmm1
mulsd  %xmm7,%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
ucomisd %xmm9,%xmm0
jb     13a0 <qreval+0x290>
sqrtsd %xmm0,%xmm0
jmp    13e5 <qreval+0x2d5>
movsd  (%r15,%r12,8),%xmm2
mov    %ebp,%eax
mov    0x1c(%rsp),%r13d
xor    %esi,%esi
mov    %eax,%ecx
mulsd  %xmm6,%xmm2
subsd  %xmm7,%xmm2
movsd  %xmm2,(%r15,%rcx,8)
movapd %xmm6,%xmm0
unpckhpd %xmm6,%xmm0
movapd %xmm0,0x20(%rsp)
mulsd  %xmm2,%xmm0
add    $0xffffffff,%eax
movsd  %xmm0,(%r14,%rax,8)
movsd  (%r15,%rcx,8),%xmm0
mulsd  %xmm6,%xmm0
addsd  %xmm8,%xmm0
movsd  %xmm0,(%r15,%rcx,8)
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x10(%rsp)
test   %ebp,%ebp
jg     1198 <qreval+0x88>
jmp    150b <qreval+0x3fb>
xor    %esi,%esi
mov    %esi,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%esi
jmp    150b <qreval+0x3fb>

LLVM IR (-O0):
define i32 @qreval(double* %0, double* %1, i32 %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double 1.000000e-15, double* %14
%19 = load i32, i32* %7
%20 = mul nsw i32 8, %19
store i32 %20, i32* %18
store i32 0, i32* %15
%21 = load i32, i32* %7
%22 = sub nsw i32 %21, 1
store i32 %22, i32* %17
br label %23
23: ; preds = %298, %3
br label %24
24: ; preds = %23, %121
%25 = load i32, i32* %17
%26 = icmp slt i32 %25, 1
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 0, i32* %4
br label %301
28: ; preds = %24
%29 = load i32, i32* %17
%30 = sub nsw i32 %29, 1
store i32 %30, i32* %16
%31 = load double*, double** %6
%32 = load i32, i32* %16
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = call double @llvm.fabs.f64(double %35)
%37 = load double*, double** %5
%38 = load i32, i32* %17
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = call double @llvm.fabs.f64(double %41)
%43 = load double, double* %14
%44 = fmul double %42, %43
%45 = fcmp ole double %36, %44
br i1 %45, label %46, label %49
46: ; preds = %28
%47 = load i32, i32* %17
%48 = add nsw i32 %47, -1
store i32 %48, i32* %17
br label %121
49: ; preds = %28
%50 = load double*, double** %5
%51 = load i32, i32* %16
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = load double*, double** %5
%56 = load i32, i32* %17
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %55, i64 %57
%59 = load double, double* %58
%60 = fsub double %54, %59
%61 = fdiv double %60, 2.000000e+00
store double %61, double* %11
%62 = load double, double* %11
%63 = load double, double* %11
%64 = load double*, double** %6
%65 = load i32, i32* %16
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = load double*, double** %6
%70 = load i32, i32* %16
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = fmul double %68, %73
%75 = call double @llvm.fmuladd.f64(double %62, double %63, double %74)
%76 = call double @sqrt(double %75)
store double %76, double* %13
%77 = load i32, i32* %17
%78 = icmp sgt i32 %77, 1
br i1 %78, label %79, label %97
79: ; preds = %49
%80 = load double*, double** %6
%81 = load i32, i32* %17
%82 = sub nsw i32 %81, 2
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %80, i64 %83
%85 = load double, double* %84
%86 = call double @llvm.fabs.f64(double %85)
%87 = load double*, double** %5
%88 = load i32, i32* %16
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %87, i64 %89
%91 = load double, double* %90
%92 = call double @llvm.fabs.f64(double %91)
%93 = load double, double* %14
%94 = fmul double %92, %93
%95 = fcmp ogt double %86, %94
br i1 %95, label %96, label %97
96: ; preds = %79
br label %122
97: ; preds = %79, %49
%98 = load double*, double** %5
%99 = load i32, i32* %17
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = load double, double* %11
%104 = fadd double %103, %102
store double %104, double* %11
%105 = load double, double* %11
%106 = load double, double* %13
%107 = fsub double %105, %106
%108 = load double*, double** %5
%109 = load i32, i32* %17
%110 = add nsw i32 %109, -1
store i32 %110, i32* %17
%111 = sext i32 %109 to i64
%112 = getelementptr inbounds double, double* %108, i64 %111
store double %107, double* %112
%113 = load double, double* %11
%114 = load double, double* %13
%115 = fadd double %113, %114
%116 = load double*, double** %5
%117 = load i32, i32* %17
%118 = add nsw i32 %117, -1
store i32 %118, i32* %17
%119 = sext i32 %117 to i64
%120 = getelementptr inbounds double, double* %116, i64 %119
store double %115, double* %120
br label %121
121: ; preds = %97, %46
br label %24
122: ; preds = %96
%123 = load i32, i32* %15
%124 = load i32, i32* %18
%125 = icmp sgt i32 %123, %124
br i1 %125, label %126, label %127
126: ; preds = %122
store i32 -1, i32* %4
br label %301
127: ; preds = %122
%128 = load double, double* %11
%129 = fcmp ogt double %128, 0.000000e+00
br i1 %129, label %130, label %140
130: ; preds = %127
%131 = load double*, double** %5
%132 = load i32, i32* %17
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %131, i64 %133
%135 = load double, double* %134
%136 = load double, double* %11
%137 = fadd double %135, %136
%138 = load double, double* %13
%139 = fsub double %137, %138
store double %139, double* %10
br label %150
140: ; preds = %127
%141 = load double*, double** %5
%142 = load i32, i32* %17
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = load double, double* %11
%147 = fadd double %145, %146
%148 = load double, double* %13
%149 = fadd double %147, %148
store double %149, double* %10
br label %150
150: ; preds = %140, %130
store double 1.000000e+00, double* %8
store double 0.000000e+00, double* %12
%151 = load double, double* %10
%152 = load double*, double** %5
%153 = getelementptr inbounds double, double* %152, i64 0
%154 = load double, double* %153
%155 = fsub double %154, %151
store double %155, double* %153
store i32 0, i32* %16
br label %156
156: ; preds = %257, %150
%157 = load i32, i32* %16
%158 = load i32, i32* %17
%159 = icmp slt i32 %157, %158
br i1 %159, label %160, label %260
160: ; preds = %156
%161 = load double*, double** %5
%162 = load i32, i32* %16
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %161, i64 %163
%165 = load double, double* %164
%166 = load double, double* %8
%167 = load double, double* %12
%168 = fneg double %167
%169 = call double @llvm.fmuladd.f64(double %165, double %166, double %168)
store double %169, double* %11
%170 = load double*, double** %6
%171 = load i32, i32* %16
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %170, i64 %172
%174 = load double, double* %173
%175 = load double, double* %8
%176 = fmul double %174, %175
store double %176, double* %12
%177 = load double, double* %11
%178 = load double, double* %11
%179 = load double*, double** %6
%180 = load i32, i32* %16
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %179, i64 %181
%183 = load double, double* %182
%184 = load double*, double** %6
%185 = load i32, i32* %16
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %184, i64 %186
%188 = load double, double* %187
%189 = fmul double %183, %188
%190 = call double @llvm.fmuladd.f64(double %177, double %178, double %189)
%191 = call double @sqrt(double %190)
store double %191, double* %13
%192 = load i32, i32* %16
%193 = icmp sgt i32 %192, 0
br i1 %193, label %194, label %203
194: ; preds = %160
%195 = load double, double* %9
%196 = load double, double* %13
%197 = fmul double %195, %196
%198 = load double*, double** %6
%199 = load i32, i32* %16
%200 = sub nsw i32 %199, 1
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds double, double* %198, i64 %201
store double %197, double* %202
br label %203
203: ; preds = %194, %160
%204 = load double, double* %8
%205 = load double, double* %13
%206 = fmul double %204, %205
%207 = load double*, double** %5
%208 = load i32, i32* %16
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds double, double* %207, i64 %209
store double %206, double* %210
%211 = load double, double* %11
%212 = load double, double* %13
%213 = fdiv double %211, %212
store double %213, double* %8
%214 = load double*, double** %6
%215 = load i32, i32* %16
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %214, i64 %216
%218 = load double, double* %217
%219 = load double, double* %13
%220 = fdiv double %218, %219
store double %220, double* %9
%221 = load double, double* %10
%222 = load double*, double** %5
%223 = load i32, i32* %16
%224 = add nsw i32 %223, 1
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds double, double* %222, i64 %225
%227 = load double, double* %226
%228 = fsub double %227, %221
store double %228, double* %226
%229 = load double, double* %9
%230 = load double, double* %12
%231 = fmul double %230, %229
store double %231, double* %12
%232 = load double, double* %8
%233 = load double*, double** %5
%234 = load i32, i32* %16
%235 = sext i32 %234 to i64
%236 = getelementptr inbounds double, double* %233, i64 %235
%237 = load double, double* %236
%238 = load double, double* %12
%239 = fadd double %237, %238
%240 = load double*, double** %5
%241 = load i32, i32* %16
%242 = add nsw i32 %241, 1
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds double, double* %240, i64 %243
%245 = load double, double* %244
%246 = load double, double* %9
%247 = fmul double %245, %246
%248 = load double, double* %9
%249 = fmul double %247, %248
%250 = call double @llvm.fmuladd.f64(double %232, double %239, double %249)
%251 = load double, double* %10
%252 = fadd double %250, %251
%253 = load double*, double** %5
%254 = load i32, i32* %16
%255 = sext i32 %254 to i64
%256 = getelementptr inbounds double, double* %253, i64 %255
store double %252, double* %256
br label %257
257: ; preds = %203
%258 = load i32, i32* %16
%259 = add nsw i32 %258, 1
store i32 %259, i32* %16
br label %156
260: ; preds = %156
%261 = load double*, double** %5
%262 = load i32, i32* %16
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds double, double* %261, i64 %263
%265 = load double, double* %264
%266 = load double, double* %8
%267 = load double, double* %12
%268 = fneg double %267
%269 = call double @llvm.fmuladd.f64(double %265, double %266, double %268)
%270 = load double*, double** %5
%271 = load i32, i32* %16
%272 = sext i32 %271 to i64
%273 = getelementptr inbounds double, double* %270, i64 %272
store double %269, double* %273
%274 = load double*, double** %5
%275 = load i32, i32* %16
%276 = sext i32 %275 to i64
%277 = getelementptr inbounds double, double* %274, i64 %276
%278 = load double, double* %277
%279 = load double, double* %9
%280 = fmul double %278, %279
%281 = load double*, double** %6
%282 = load i32, i32* %16
%283 = sub nsw i32 %282, 1
%284 = sext i32 %283 to i64
%285 = getelementptr inbounds double, double* %281, i64 %284
store double %280, double* %285
%286 = load double*, double** %5
%287 = load i32, i32* %16
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds double, double* %286, i64 %288
%290 = load double, double* %289
%291 = load double, double* %8
%292 = load double, double* %10
%293 = call double @llvm.fmuladd.f64(double %290, double %291, double %292)
%294 = load double*, double** %5
%295 = load i32, i32* %16
%296 = sext i32 %295 to i64
%297 = getelementptr inbounds double, double* %294, i64 %296
store double %293, double* %297
br label %298
298: ; preds = %260
%299 = load i32, i32* %15
%300 = add nsw i32 %299, 1
store i32 %300, i32* %15
br label %23
301: ; preds = %126, %27
%302 = load i32, i32* %4
ret i32 %302
}

LLVM IR (-O2):
define i32 @qreval(double* nocapture %0, double* nocapture %1, i32 %2) {
%4 = icmp slt i32 %2, 2
br i1 %4, label %152, label %5
5: ; preds = %3
%6 = add nsw i32 %2, -1
%7 = shl i32 %2, 3
%8 = or i32 %7, 1
%9 = call i32 @llvm.smax.i32(i32 %8, i32 0)
%10 = getelementptr inbounds double, double* %0, i64 1
%11 = getelementptr inbounds double, double* %0, i64 1
br label %12
12: ; preds = %5, %133
%13 = phi i32 [ %17, %133 ], [ %6, %5 ]
%14 = phi i32 [ %150, %133 ], [ 0, %5 ]
%15 = phi double [ %143, %133 ], [ undef, %5 ]
br label %16
16: ; preds = %12, %53
%17 = phi i32 [ %13, %12 ], [ %54, %53 ]
%18 = add nsw i32 %17, -1
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds double, double* %1, i64 %19
%21 = load double, double* %20
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = zext i32 %17 to i64
%24 = getelementptr inbounds double, double* %0, i64 %23
%25 = load double, double* %24
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = fmul double %26, 1.000000e-15
%28 = fcmp ugt double %22, %27
br i1 %28, label %29, label %53
29: ; preds = %16
%30 = getelementptr inbounds double, double* %0, i64 %19
%31 = load double, double* %30
%32 = fsub double %31, %25
%33 = fmul double %32, 5.000000e-01
%34 = fmul double %21, %21
%35 = tail call double @llvm.fmuladd.f64(double %33, double %33, double %34)
%36 = tail call double @sqrt(double %35)
%37 = icmp ugt i32 %17, 1
%38 = add nsw i32 %17, -2
br i1 %37, label %39, label %48
39: ; preds = %29
%40 = zext i32 %38 to i64
%41 = getelementptr inbounds double, double* %1, i64 %40
%42 = load double, double* %41
%43 = tail call double @llvm.fabs.f64(double %42)
%44 = load double, double* %30
%45 = tail call double @llvm.fabs.f64(double %44)
%46 = fmul double %45, 1.000000e-15
%47 = fcmp ogt double %43, %46
br i1 %47, label %56, label %48
48: ; preds = %29, %39
%49 = load double, double* %24
%50 = fadd double %33, %49
%51 = fsub double %50, %36
store double %51, double* %24
%52 = fadd double %36, %50
store double %52, double* %30
br label %53
53: ; preds = %16, %48
%54 = phi i32 [ %38, %48 ], [ %18, %16 ]
%55 = icmp slt i32 %54, 1
br i1 %55, label %152, label %16
56: ; preds = %39
%57 = zext i32 %17 to i64
%58 = icmp eq i32 %14, %9
br i1 %58, label %152, label %59
59: ; preds = %56
%60 = fcmp ogt double %33, 0.000000e+00
%61 = load double, double* %24
%62 = fadd double %33, %61
%63 = fneg double %36
%64 = select i1 %60, double %63, double %36
%65 = fadd double %62, %64
%66 = load double, double* %0
%67 = fsub double %66, %65
store double %67, double* %0
%68 = icmp sgt i32 %17, 0
%69 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %15, i64 1
br i1 %68, label %70, label %133
70: ; preds = %59
%71 = load double, double* %1
%72 = fmul double %71, %71
%73 = tail call double @llvm.fmuladd.f64(double %67, double %67, double %72)
%74 = tail call double @sqrt(double %73)
%75 = load double, double* %10
store double %74, double* %0
%76 = load double, double* %1
%77 = insertelement <2 x double> poison, double %67, i64 0
%78 = insertelement <2 x double> %77, double %76, i64 1
%79 = insertelement <2 x double> poison, double %74, i64 0
%80 = shufflevector <2 x double> %79, <2 x double> poison, <2 x i32> zeroinitializer
%81 = fdiv <2 x double> %78, %80
%82 = fsub double %75, %65
store double %82, double* %11
%83 = extractelement <2 x double> %81, i64 1
%84 = fmul double %71, %83
%85 = fadd double %74, %84
%86 = fmul double %83, %82
%87 = fmul double %83, %86
%88 = extractelement <2 x double> %81, i64 0
%89 = tail call double @llvm.fmuladd.f64(double %88, double %85, double %87)
%90 = fadd double %65, %89
store double %90, double* %0
br label %91
91: ; preds = %70, %91
%92 = phi double [ %82, %70 ], [ %121, %91 ]
%93 = phi i64 [ 1, %70 ], [ %118, %91 ]
%94 = phi double [ %84, %70 ], [ %123, %91 ]
%95 = phi <2 x double> [ %81, %70 ], [ %117, %91 ]
%96 = getelementptr inbounds double, double* %0, i64 %93
%97 = fneg double %94
%98 = extractelement <2 x double> %95, i64 0
%99 = tail call double @llvm.fmuladd.f64(double %92, double %98, double %97)
%100 = getelementptr inbounds double, double* %1, i64 %93
%101 = load double, double* %100
%102 = fmul double %98, %101
%103 = fmul double %101, %101
%104 = tail call double @llvm.fmuladd.f64(double %99, double %99, double %103)
%105 = tail call double @sqrt(double %104)
%106 = extractelement <2 x double> %95, i64 1
%107 = fmul double %106, %105
%108 = add nuw i64 %93, 4294967295
%109 = and i64 %108, 4294967295
%110 = getelementptr inbounds double, double* %1, i64 %109
store double %107, double* %110
%111 = fmul double %98, %105
store double %111, double* %96
%112 = load double, double* %100
%113 = insertelement <2 x double> poison, double %99, i64 0
%114 = insertelement <2 x double> %113, double %112, i64 1
%115 = insertelement <2 x double> poison, double %105, i64 0
%116 = shufflevector <2 x double> %115, <2 x double> poison, <2 x i32> zeroinitializer
%117 = fdiv <2 x double> %114, %116
%118 = add nuw nsw i64 %93, 1
%119 = getelementptr inbounds double, double* %0, i64 %118
%120 = load double, double* %119
%121 = fsub double %120, %65
store double %121, double* %119
%122 = extractelement <2 x double> %117, i64 1
%123 = fmul double %102, %122
%124 = fadd double %111, %123
%125 = fmul double %122, %121
%126 = fmul double %122, %125
%127 = extractelement <2 x double> %117, i64 0
%128 = tail call double @llvm.fmuladd.f64(double %127, double %124, double %126)
%129 = fadd double %65, %128
store double %129, double* %96
%130 = icmp eq i64 %118, %57
br i1 %130, label %131, label %91
131: ; preds = %91
%132 = load double, double* %24
br label %133
133: ; preds = %59, %131
%134 = phi double [ %132, %131 ], [ %67, %59 ]
%135 = phi double [ %123, %131 ], [ 0.000000e+00, %59 ]
%136 = phi i32 [ %17, %131 ], [ 0, %59 ]
%137 = phi <2 x double> [ %117, %131 ], [ %69, %59 ]
%138 = zext i32 %136 to i64
%139 = getelementptr inbounds double, double* %0, i64 %138
%140 = fneg double %135
%141 = extractelement <2 x double> %137, i64 0
%142 = tail call double @llvm.fmuladd.f64(double %134, double %141, double %140)
store double %142, double* %139
%143 = extractelement <2 x double> %137, i64 1
%144 = fmul double %143, %142
%145 = add nsw i32 %136, -1
%146 = zext i32 %145 to i64
%147 = getelementptr inbounds double, double* %1, i64 %146
store double %144, double* %147
%148 = load double, double* %139
%149 = tail call double @llvm.fmuladd.f64(double %148, double %141, double %65)
store double %149, double* %139
%150 = add nuw nsw i32 %14, 1
%151 = icmp slt i32 %17, 1
br i1 %151, label %152, label %12
152: ; preds = %56, %133, %53, %3
%153 = phi i32 [ 0, %3 ], [ 0, %53 ], [ 0, %133 ], [ -1, %56 ]
ret i32 %153
}