#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 exp(double);
scalar_t__ log(double);
int sympoly(int K, int BK, double *val, double *res, double *overflow) {
  int h, k;
  double mult = 1;
  BK++;
  if (BK > K)
    BK = K;
  if (BK <= 1)
    BK = 2;
  *overflow = 0;
  res[0] = 1;
  for (k = 1; k <= K; k++)
    res[k] = 0;
  if (K == 0)
    return 0;
  res[1] = val[0];
  for (k = 1; k < K; k++) {
    double vk = val[k];
    if (vk > 1) {
      double lastv = mult;
      mult /= vk;
      *overflow += log(vk);
      for (h = 1; h <= k && h < BK; h++) {
        double thisv = res[h];
        res[h] = thisv / vk + lastv;
        lastv = thisv;
      }
      res[h] = lastv;
    } else {
      double lastv = mult;
      for (h = 1; h <= k && h < BK; h++) {
        double thisv = res[h];
        res[h] += vk * lastv;
        lastv = thisv;
      }
      res[h] = vk * lastv;
    }
  }
  if (*overflow < 15) {
    double eo = exp(*overflow);
    for (h = 1; h <= BK; h++)
      res[h] *= eo;
    *overflow = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sympoly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  0xebe(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1162 <sympoly+0x42>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jg     1173 <sympoly+0x53>
movl   $0x2,-0xc(%rbp)
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xe76(%rip),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11bf <sympoly+0x9f>
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1195 <sympoly+0x75>
cmpl   $0x0,-0x8(%rbp)
jne    11d5 <sympoly+0xb5>
movl   $0x0,-0x4(%rbp)
jmp    1413 <sympoly+0x2f3>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x1,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    13a1 <sympoly+0x281>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xde8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12eb <sympoly+0x1cb>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <log@plt>
cvtsi2sd %rax,%xmm0
mov    -0x28(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x30(%rbp),%ecx
mov    %al,-0x69(%rbp)
jg     127e <sympoly+0x15e>
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
test   $0x1,%al
jne    128e <sympoly+0x16e>
jmp    12d4 <sympoly+0x1b4>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1261 <sympoly+0x141>
movsd  -0x48(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    138e <sympoly+0x26e>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x30(%rbp),%ecx
mov    %al,-0x6a(%rbp)
jg     1319 <sympoly+0x1f9>
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
setl   %al
mov    %al,-0x6a(%rbp)
mov    -0x6a(%rbp),%al
test   $0x1,%al
jne    1329 <sympoly+0x209>
jmp    1377 <sympoly+0x257>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12fc <sympoly+0x1dc>
movsd  -0x40(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1393 <sympoly+0x273>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11ed <sympoly+0xcd>
mov    -0x28(%rbp),%rax
movsd  0xc5b(%rip),%xmm0
ucomisd (%rax),%xmm0
jbe    140c <sympoly+0x2ec>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x68(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1401 <sympoly+0x2e1>
movsd  -0x68(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13d0 <sympoly+0x2b0>
mov    -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sympoly>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rcx,%rbx
mov    %rdx,%r9
lea    0x1(%rsi),%eax
cmp    %edi,%esi
cmovge %edi,%eax
cmp    $0x3,%eax
mov    $0x2,%ecx
cmovge %eax,%ecx
mov    %ecx,0x4(%rsp)
mov    %r8,0x8(%rsp)
movq   $0x0,(%r8)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rbx)
test   %edi,%edi
jle    151e <sympoly+0x3ee>
mov    %edi,%ebp
lea    0x8(%rbx),%rdi
mov    %ebp,%eax
mov    %rax,0x18(%rsp)
lea    0x0(,%rax,8),%rdx
xor    %esi,%esi
mov    %r9,0x10(%rsp)
call   1030 <memset@plt>
mov    0x10(%rsp),%r8
movsd  (%r8),%xmm0
movsd  %xmm0,0x8(%rbx)
cmp    $0x1,%ebp
je     152e <sympoly+0x3fe>
mov    0x4(%rsp),%ebp
lea    -0x2(%rbp),%r12
movsd  0xe3a(%rip),%xmm8
mov    $0x1,%r9d
xor    %r15d,%r15d
mov    $0x1,%r13d
movapd %xmm8,%xmm7
jmp    1212 <sympoly+0xe2>
nopl   0x0(%rax)
divsd  %xmm5,%xmm7
mov    0x10(%rsp),%r8
movsd  0xe0e(%rip),%xmm8
mov    $0x1,%r9d
mov    %edx,%eax
movsd  %xmm0,(%rbx,%rax,8)
add    $0x1,%r13
add    $0x1,%r15
cmp    0x18(%rsp),%r13
je     152e <sympoly+0x3fe>
cmp    %r15,%r12
mov    %r15,%rax
cmovb  %r12,%rax
add    $0x1,%rax
cmp    %r15,%r12
mov    %r15,%r14
cmovb  %r12,%r14
add    $0x1,%r14
test   %r15,%r15
cmove  %r9,%rax
cmove  %r9,%r14
movsd  (%r8,%r13,8),%xmm0
ucomisd %xmm8,%xmm0
jbe    13a0 <sympoly+0x270>
movapd %xmm7,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
call   1050 <log@plt>
movapd 0x20(%rsp),%xmm5
movapd 0x30(%rsp),%xmm7
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x8(%rsp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
mov    $0x1,%edx
movapd %xmm7,%xmm0
cmp    $0x2,%r14
jb     1360 <sympoly+0x230>
mov    %r14,%rax
and    $0xfffffffffffffffe,%rax
unpcklpd %xmm7,%xmm0
movapd %xmm5,%xmm1
unpcklpd %xmm5,%xmm1
lea    -0x2(%rax),%rcx
mov    %rcx,%rdx
shr    %rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     1500 <sympoly+0x3d0>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
movapd %xmm0,%xmm2
cs nopw 0x0(%rax,%rax,1)
movupd 0x8(%rbx,%rcx,8),%xmm3
movupd 0x18(%rbx,%rcx,8),%xmm0
shufpd $0x1,%xmm3,%xmm2
movapd %xmm3,%xmm4
divpd  %xmm1,%xmm4
addpd  %xmm2,%xmm4
movupd %xmm4,0x8(%rbx,%rcx,8)
shufpd $0x1,%xmm0,%xmm3
movapd %xmm0,%xmm2
divpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm2,0x18(%rbx,%rcx,8)
add    $0x4,%rcx
movapd %xmm0,%xmm2
add    $0xfffffffffffffffe,%rsi
jne    12d0 <sympoly+0x1a0>
test   $0x1,%dl
je     1344 <sympoly+0x214>
shl    $0x3,%rcx
or     $0x8,%rcx
movupd (%rbx,%rcx,1),%xmm2
shufpd $0x1,%xmm2,%xmm0
movapd %xmm2,%xmm3
divpd  %xmm1,%xmm3
addpd  %xmm0,%xmm3
movupd %xmm3,(%rbx,%rcx,1)
movapd %xmm2,%xmm0
mov    %r14,%rdx
or     $0x1,%rdx
unpckhpd %xmm0,%xmm0
cmp    %rax,%r14
je     11e0 <sympoly+0xb0>
nopl   0x0(%rax,%rax,1)
movapd %xmm0,%xmm1
mov    %rdx,%rax
movsd  (%rbx,%rdx,8),%xmm0
movapd %xmm0,%xmm2
divsd  %xmm5,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rbx,%rdx,8)
add    $0x1,%rdx
cmp    %r13,%rax
jae    11e0 <sympoly+0xb0>
cmp    %rbp,%rdx
jb     1360 <sympoly+0x230>
jmp    11e0 <sympoly+0xb0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%edx
movapd %xmm7,%xmm6
cmp    $0x4,%rax
jb     14d0 <sympoly+0x3a0>
mov    %rax,%rcx
and    $0xfffffffffffffffc,%rcx
unpcklpd %xmm7,%xmm6
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1510 <sympoly+0x3e0>
mov    %rsi,%rdi
movabs $0x7ffffffffffffffe,%rdx
ff ff 7f
and    %rdx,%rdi
xor    %edx,%edx
movapd %xmm6,%xmm2
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd 0x8(%rbx,%rdx,8),%xmm3
movupd 0x18(%rbx,%rdx,8),%xmm4
movupd 0x28(%rbx,%rdx,8),%xmm5
movupd 0x38(%rbx,%rdx,8),%xmm6
shufpd $0x1,%xmm3,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
shufpd $0x1,%xmm4,%xmm3
mulpd  %xmm1,%xmm3
addpd  %xmm4,%xmm3
movupd %xmm2,0x8(%rbx,%rdx,8)
movupd %xmm3,0x18(%rbx,%rdx,8)
shufpd $0x1,%xmm5,%xmm4
mulpd  %xmm1,%xmm4
addpd  %xmm5,%xmm4
shufpd $0x1,%xmm6,%xmm5
mulpd  %xmm1,%xmm5
addpd  %xmm6,%xmm5
movupd %xmm4,0x28(%rbx,%rdx,8)
movupd %xmm5,0x38(%rbx,%rdx,8)
add    $0x8,%rdx
movapd %xmm6,%xmm2
add    $0xfffffffffffffffe,%rdi
jne    1400 <sympoly+0x2d0>
test   $0x1,%sil
je     14b4 <sympoly+0x384>
shl    $0x3,%rdx
or     $0x8,%rdx
movupd (%rbx,%rdx,1),%xmm2
movupd 0x10(%rbx,%rdx,1),%xmm3
shufpd $0x1,%xmm2,%xmm6
mulpd  %xmm1,%xmm6
addpd  %xmm2,%xmm6
shufpd $0x1,%xmm3,%xmm2
mulpd  %xmm1,%xmm2
addpd  %xmm3,%xmm2
movupd %xmm6,(%rbx,%rdx,1)
movupd %xmm2,0x10(%rbx,%rdx,1)
movapd %xmm3,%xmm6
lea    0x1(%rcx),%rdx
unpckhpd %xmm6,%xmm6
cmp    %rcx,%rax
je     14f7 <sympoly+0x3c7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd %xmm6,%xmm1
mov    %rdx,%rax
movsd  (%rbx,%rdx,8),%xmm6
mulsd  %xmm0,%xmm1
addsd  %xmm6,%xmm1
movsd  %xmm1,(%rbx,%rdx,8)
add    $0x1,%rdx
cmp    %r13,%rax
jae    14f7 <sympoly+0x3c7>
cmp    %rbp,%rdx
jb     14d0 <sympoly+0x3a0>
mulsd  %xmm6,%xmm0
jmp    11f8 <sympoly+0xc8>
xor    %ecx,%ecx
test   $0x1,%dl
jne    131d <sympoly+0x1ed>
jmp    1344 <sympoly+0x214>
xor    %edx,%edx
test   $0x1,%sil
jne    1478 <sympoly+0x348>
jmp    14b4 <sympoly+0x384>
je     1643 <sympoly+0x513>
movsd  (%r9),%xmm0
movsd  %xmm0,0x8(%rbx)
mov    0x8(%rsp),%rax
movsd  (%rax),%xmm0
movsd  0xac9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1643 <sympoly+0x513>
call   1040 <exp@plt>
mov    0x4(%rsp),%edx
mov    %edx,%eax
mov    $0x1,%ecx
cmp    $0x4,%edx
jb     1615 <sympoly+0x4e5>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm0,%xmm1
unpcklpd %xmm0,%xmm1
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1654 <sympoly+0x524>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movupd (%rbx,%rdx,8),%xmm2
movupd 0x10(%rbx,%rdx,8),%xmm3
movupd 0x20(%rbx,%rdx,8),%xmm4
movupd 0x30(%rbx,%rdx,8),%xmm5
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm3,0x10(%rbx,%rdx,8)
mulpd  %xmm1,%xmm4
mulpd  %xmm1,%xmm5
movupd %xmm4,0x20(%rbx,%rdx,8)
movupd %xmm5,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    15a0 <sympoly+0x470>
test   $0x1,%sil
je     160c <sympoly+0x4dc>
movupd (%rbx,%rdx,8),%xmm2
movupd 0x10(%rbx,%rdx,8),%xmm3
mulpd  %xmm1,%xmm2
mulpd  %xmm1,%xmm3
movupd %xmm2,(%rbx,%rdx,8)
movupd %xmm3,0x10(%rbx,%rdx,8)
cmp    %rcx,%rax
je     1637 <sympoly+0x507>
or     $0x1,%rcx
add    $0x1,%rax
nopl   0x0(%rax)
movsd  (%rbx,%rcx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1620 <sympoly+0x4f0>
mov    0x8(%rsp),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edx
test   $0x1,%sil
jne    15ee <sympoly+0x4be>
jmp    160c <sympoly+0x4dc>

LLVM IR (-O0):
define i32 @sympoly(i32 %0, i32 %1, double* %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
store i32 %0, i32* %7
store i32 %1, i32* %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double 1.000000e+00, double* %14
%21 = load i32, i32* %8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %8
%23 = load i32, i32* %8
%24 = load i32, i32* %7
%25 = icmp sgt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %5
%27 = load i32, i32* %7
store i32 %27, i32* %8
br label %28
28: ; preds = %26, %5
%29 = load i32, i32* %8
%30 = icmp sle i32 %29, 1
br i1 %30, label %31, label %32
31: ; preds = %28
store i32 2, i32* %8
br label %32
32: ; preds = %31, %28
%33 = load double*, double** %11
store double 0.000000e+00, double* %33
%34 = load double*, double** %10
%35 = getelementptr inbounds double, double* %34, i64 0
store double 1.000000e+00, double* %35
store i32 1, i32* %13
br label %36
36: ; preds = %45, %32
%37 = load i32, i32* %13
%38 = load i32, i32* %7
%39 = icmp sle i32 %37, %38
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load double*, double** %10
%42 = load i32, i32* %13
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %41, i64 %43
store double 0.000000e+00, double* %44
br label %45
45: ; preds = %40
%46 = load i32, i32* %13
%47 = add nsw i32 %46, 1
store i32 %47, i32* %13
br label %36
48: ; preds = %36
%49 = load i32, i32* %7
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %48
store i32 0, i32* %6
br label %184
52: ; preds = %48
%53 = load double*, double** %9
%54 = getelementptr inbounds double, double* %53, i64 0
%55 = load double, double* %54
%56 = load double*, double** %10
%57 = getelementptr inbounds double, double* %56, i64 1
store double %55, double* %57
store i32 1, i32* %13
br label %58
58: ; preds = %155, %52
%59 = load i32, i32* %13
%60 = load i32, i32* %7
%61 = icmp slt i32 %59, %60
br i1 %61, label %62, label %158
62: ; preds = %58
%63 = load double*, double** %9
%64 = load i32, i32* %13
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
%67 = load double, double* %66
store double %67, double* %15
%68 = load double, double* %15
%69 = fcmp ogt double %68, 1.000000e+00
br i1 %69, label %70, label %116
70: ; preds = %62
%71 = load double, double* %14
store double %71, double* %16
%72 = load double, double* %15
%73 = load double, double* %14
%74 = fdiv double %73, %72
store double %74, double* %14
%75 = load double, double* %15
%76 = call i64 @log(double %75)
%77 = sitofp i64 %76 to double
%78 = load double*, double** %11
%79 = load double, double* %78
%80 = fadd double %79, %77
store double %80, double* %78
store i32 1, i32* %12
br label %81
81: ; preds = %107, %70
%82 = load i32, i32* %12
%83 = load i32, i32* %13
%84 = icmp sle i32 %82, %83
br i1 %84, label %85, label %89
85: ; preds = %81
%86 = load i32, i32* %12
%87 = load i32, i32* %8
%88 = icmp slt i32 %86, %87
br label %89
89: ; preds = %85, %81
%90 = phi i1 [ false, %81 ], [ %88, %85 ]
br i1 %90, label %91, label %110
91: ; preds = %89
%92 = load double*, double** %10
%93 = load i32, i32* %12
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double, double* %92, i64 %94
%96 = load double, double* %95
store double %96, double* %17
%97 = load double, double* %17
%98 = load double, double* %15
%99 = fdiv double %97, %98
%100 = load double, double* %16
%101 = fadd double %99, %100
%102 = load double*, double** %10
%103 = load i32, i32* %12
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %102, i64 %104
store double %101, double* %105
%106 = load double, double* %17
store double %106, double* %16
br label %107
107: ; preds = %91
%108 = load i32, i32* %12
%109 = add nsw i32 %108, 1
store i32 %109, i32* %12
br label %81
110: ; preds = %89
%111 = load double, double* %16
%112 = load double*, double** %10
%113 = load i32, i32* %12
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds double, double* %112, i64 %114
store double %111, double* %115
br label %154
116: ; preds = %62
%117 = load double, double* %14
store double %117, double* %18
store i32 1, i32* %12
br label %118
118: ; preds = %143, %116
%119 = load i32, i32* %12
%120 = load i32, i32* %13
%121 = icmp sle i32 %119, %120
br i1 %121, label %122, label %126
122: ; preds = %118
%123 = load i32, i32* %12
%124 = load i32, i32* %8
%125 = icmp slt i32 %123, %124
br label %126
126: ; preds = %122, %118
%127 = phi i1 [ false, %118 ], [ %125, %122 ]
br i1 %127, label %128, label %146
128: ; preds = %126
%129 = load double*, double** %10
%130 = load i32, i32* %12
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
%133 = load double, double* %132
store double %133, double* %19
%134 = load double, double* %15
%135 = load double, double* %18
%136 = load double*, double** %10
%137 = load i32, i32* %12
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
%140 = load double, double* %139
%141 = call double @llvm.fmuladd.f64(double %134, double %135, double %140)
store double %141, double* %139
%142 = load double, double* %19
store double %142, double* %18
br label %143
143: ; preds = %128
%144 = load i32, i32* %12
%145 = add nsw i32 %144, 1
store i32 %145, i32* %12
br label %118
146: ; preds = %126
%147 = load double, double* %15
%148 = load double, double* %18
%149 = fmul double %147, %148
%150 = load double*, double** %10
%151 = load i32, i32* %12
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %150, i64 %152
store double %149, double* %153
br label %154
154: ; preds = %146, %110
br label %155
155: ; preds = %154
%156 = load i32, i32* %13
%157 = add nsw i32 %156, 1
store i32 %157, i32* %13
br label %58
158: ; preds = %58
%159 = load double*, double** %11
%160 = load double, double* %159
%161 = fcmp olt double %160, 1.500000e+01
br i1 %161, label %162, label %183
162: ; preds = %158
%163 = load double*, double** %11
%164 = load double, double* %163
%165 = call double @exp(double %164)
store double %165, double* %20
store i32 1, i32* %12
br label %166
166: ; preds = %178, %162
%167 = load i32, i32* %12
%168 = load i32, i32* %8
%169 = icmp sle i32 %167, %168
br i1 %169, label %170, label %181
170: ; preds = %166
%171 = load double, double* %20
%172 = load double*, double** %10
%173 = load i32, i32* %12
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = fmul double %176, %171
store double %177, double* %175
br label %178
178: ; preds = %170
%179 = load i32, i32* %12
%180 = add nsw i32 %179, 1
store i32 %180, i32* %12
br label %166
181: ; preds = %166
%182 = load double*, double** %11
store double 0.000000e+00, double* %182
br label %183
183: ; preds = %181, %158
store i32 0, i32* %6
br label %184
184: ; preds = %183, %51
%185 = load i32, i32* %6
ret i32 %185
}

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