#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 */
typedef int /*<<< orphan*/ ROOT;

/* Variables and functions */
int /*<<< orphan*/ allroots(int, double *, int, double *);
scalar_t__ calloc(int, int);
double d_abs(double);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ newton(int, double *, double, double);
int /*<<< orphan*/ printf(char *, ...);
double sqrt(double);
void deflat(int No, double Po[], int N, double Pn[], double ROOT) {
  double *TP;
  int I, J;
  if (N != No) {
    printf("----> Refine Root on the Orginal Polynomial (non-deflated)\n");
    newton(No, Po, ROOT - .5, ROOT + .5);
  }
  TP = (double *)calloc(N, sizeof(ROOT));
  TP[N - 1] = Pn[N];
  for (I = N - 2; I >= 0; I--)
    TP[I] = TP[I + 1] * ROOT + Pn[I + 1];
  for (J = N; J > 0; J--) {
    printf("%g", d_abs(Pn[J]));
    if (Pn[J - 1] < 0)
      printf("x**%d - ", J);
    else
      printf("x**%d + ", J);
  }
  printf("%g\n", d_abs(Pn[0]));
  printf("     DEFLATED to\n(x - %g)*(", ROOT);
  for (J = N - 1; J > 0; J--) {
    printf("%g", d_abs(TP[J]));
    if (TP[J - 1] < 0)
      printf("x**%d - ", J);
    else
      printf("x**%d + ", J);
  }
  printf("%g)\n", d_abs(TP[0]));
  if (N == 3) {
    ROOT = (-TP[1] + sqrt(TP[1] * TP[1] - 4 * TP[2] * TP[0])) / (2 * TP[2]);
    printf("\n  ROOT = %g (from quadratic formula)\n", ROOT);
    printf("----> Refine Root on the Orginal Polynomial (non-deflated)\n");
    newton(No, Po, ROOT - .5, ROOT + .5);
    ROOT = (-TP[1] - sqrt(TP[1] * TP[1] - 4 * TP[2] * TP[0])) / (2 * TP[2]);
    printf("  ROOT = %g (from quadratic formula)\n", ROOT);
    printf("----> Refine Root on the Orginal Polynomial (non-deflated)\n");
    newton(No, Po, ROOT - .5, ROOT + .5);
  } else {
    allroots(No, Po, N - 1, TP);
  }
  free(TP);
}


x86 assembly (clang, -O0):
<deflat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     11cf <deflat+0x5f>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
movsd  0xe47(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe3b(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
call   1060 <newton@plt>
mov    -0x14(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     125e <deflat+0xee>
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x28(%rbp),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    1208 <deflat+0x98>
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jle    12e3 <deflat+0x173>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <d_abs@plt>
lea    0xdcd(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    12bf <deflat+0x14f>
mov    -0x38(%rbp),%esi
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12d0 <deflat+0x160>
mov    -0x38(%rbp),%esi
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12d5 <deflat+0x165>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    1264 <deflat+0xf4>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <d_abs@plt>
lea    0xd72(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xd63(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jle    1399 <deflat+0x229>
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <d_abs@plt>
lea    0xd17(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
ucomisd (%rax,%rcx,8),%xmm0
jbe    1375 <deflat+0x205>
mov    -0x38(%rbp),%esi
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1386 <deflat+0x216>
mov    -0x38(%rbp),%esi
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    138b <deflat+0x21b>
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
jmp    131a <deflat+0x1aa>
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <d_abs@plt>
lea    0xcdc(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
cmpl   $0x3,-0x14(%rbp)
jne    158d <deflat+0x41d>
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x30(%rbp),%rax
movsd  0xc0f(%rip),%xmm1
mulsd  0x10(%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  0xbbe(%rip),%xmm1
mulsd  0x10(%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xc2a(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xba6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
movsd  0xb73(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xb67(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
call   1060 <newton@plt>
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x30(%rbp),%rax
movsd  0xb2a(%rip),%xmm1
mulsd  0x10(%rax),%xmm1
mov    -0x30(%rbp),%rax
mulsd  (%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1090 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  0xad9(%rip),%xmm1
mulsd  0x10(%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xb46(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xac1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
movsd  0xa8e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xa82(%rip),%xmm1
addsd  -0x28(%rbp),%xmm1
call   1060 <newton@plt>
jmp    15a3 <deflat+0x433>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
mov    -0x30(%rbp),%rcx
call   1080 <allroots@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deflat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm0,0x18(%rsp)
mov    %rcx,%rbp
mov    %edx,%ebx
mov    %rsi,%r15
mov    %edi,%r12d
cmp    %edi,%edx
je     11d8 <deflat+0x58>
lea    0xee7(%rip),%rdi
call   1050 <puts@plt>
movsd  0xe49(%rip),%xmm0
movsd  0x18(%rsp),%xmm2
addsd  %xmm2,%xmm0
movsd  0xe3f(%rip),%xmm1
addsd  %xmm2,%xmm1
mov    %r12d,%edi
mov    %r15,%rsi
call   1070 <newton@plt>
mov    %ebx,%edi
mov    $0x8,%esi
call   1080 <calloc@plt>
mov    %rax,%r14
movslq %ebx,%rax
movsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x8(%r14,%rax,8)
cmp    $0x2,%ebx
movsd  0x18(%rsp),%xmm1
jl     126e <deflat+0xee>
lea    -0x2(%rbx),%ecx
mov    %rcx,%rax
test   $0x1,%cl
jne    1228 <deflat+0xa8>
movsd  0x8(%r14,%rcx,8),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x8(%rbp,%rcx,8),%xmm0
movsd  %xmm0,(%r14,%rcx,8)
lea    -0x1(%rcx),%rax
test   %rcx,%rcx
je     126e <deflat+0xee>
add    $0x1,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rax,8),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x0(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x8(%r14,%rax,8)
mulsd  %xmm1,%xmm0
addsd  -0x8(%rbp,%rax,8),%xmm0
movsd  %xmm0,-0x10(%r14,%rax,8)
add    $0xfffffffffffffffe,%rax
jne    1240 <deflat+0xc0>
mov    %r12d,0x14(%rsp)
mov    %r15,0x20(%rsp)
mov    %rbx,(%rsp)
test   %ebx,%ebx
jle    12e3 <deflat+0x163>
mov    (%rsp),%ebx
lea    0xda9(%rip),%r15
lea    0xdab(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  0x0(%rbp,%rbx,8),%xmm0
call   1040 <d_abs@plt>
lea    0xd7e(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    -0x1(%rbx),%r13
mov    %r13d,%eax
xorpd  %xmm0,%xmm0
ucomisd 0x0(%rbp,%rax,8),%xmm0
mov    %r12,%rdi
cmova  %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x1,%rbx
mov    %r13,%rbx
ja     12a0 <deflat+0x120>
mov    (%rsp),%rbx
lea    -0x1(%rbx),%eax
mov    %eax,0x10(%rsp)
movsd  0x0(%rbp),%xmm0
call   1040 <d_abs@plt>
lea    0xd46(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xd3c(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
cmp    $0x2,%ebx
jl     137f <deflat+0x1ff>
mov    0x10(%rsp),%ebx
lea    0xd06(%rip),%r15
lea    0xd02(%rip),%r12
lea    0xd04(%rip),%rbp
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rbx,8),%xmm0
call   1040 <d_abs@plt>
mov    %r15,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    -0x1(%rbx),%r13
mov    %r13d,%eax
xorpd  %xmm0,%xmm0
ucomisd (%r14,%rax,8),%xmm0
mov    %rbp,%rdi
cmova  %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    $0x1,%rbx
mov    %r13,%rbx
ja     1340 <deflat+0x1c0>
movsd  (%r14),%xmm0
call   1040 <d_abs@plt>
lea    0xcd5(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
cmpl   $0x3,(%rsp)
jne    13db <deflat+0x25b>
movsd  0x10(%r14),%xmm1
mulsd  0xc65(%rip),%xmm1
movsd  0x8(%r14),%xmm2
mulsd  (%r14),%xmm1
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    0x20(%rsp),%rbx
mov    0x14(%rsp),%ebp
jb     13f5 <deflat+0x275>
sqrtsd %xmm0,%xmm0
jmp    1404 <deflat+0x284>
mov    0x14(%rsp),%edi
mov    0x20(%rsp),%rsi
mov    0x10(%rsp),%edx
mov    %r14,%rcx
call   1090 <allroots@plt>
jmp    14fc <deflat+0x37c>
movsd  %xmm2,(%rsp)
call   10a0 <sqrt@plt>
movsd  (%rsp),%xmm2
subsd  %xmm2,%xmm0
movsd  0x10(%r14),%xmm1
addsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
lea    0xc48(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xc61(%rip),%rdi
call   1050 <puts@plt>
movsd  0xbc3(%rip),%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm0
addsd  0xbba(%rip),%xmm1
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <newton@plt>
movsd  0x8(%r14),%xmm0
movsd  0x10(%r14),%xmm1
movapd 0xbb4(%rip),%xmm2
xorpd  %xmm0,%xmm2
movapd %xmm2,(%rsp)
mulsd  0xb93(%rip),%xmm1
mulsd  (%r14),%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ucomisd 0xb86(%rip),%xmm0
jb     149a <deflat+0x31a>
sqrtsd %xmm0,%xmm0
jmp    149f <deflat+0x31f>
call   10a0 <sqrt@plt>
movapd (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x10(%r14),%xmm0
addsd  %xmm0,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
lea    0xba9(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1060 <printf@plt>
lea    0xbbd(%rip),%rdi
call   1050 <puts@plt>
movsd  0xb1f(%rip),%xmm0
movapd (%rsp),%xmm1
addsd  %xmm1,%xmm0
addsd  0xb16(%rip),%xmm1
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <newton@plt>
mov    %r14,%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"----> Refine Root on the Orginal Polynomial (non-deflated)\0A\00"
@.str.1 = [3 x i8] c"%g\00"
@.str.2 = [9 x i8] c"x**%d - \00"
@.str.3 = [9 x i8] c"x**%d + \00"
@.str.4 = [4 x i8] c"%g\0A\00"
@.str.5 = [28 x i8] c" DEFLATED to\0A(x - %g)*(\00"
@.str.6 = [5 x i8] c"%g)\0A\00"
@.str.7 = [39 x i8] c"\0A ROOT = %g (from quadratic formula)\0A\00"
@.str.8 = [38 x i8] c" ROOT = %g (from quadratic formula)\0A\00"
define void @deflat(i32 %0, double* %1, i32 %2, double* %3, double %4) {
%6 = alloca i32
%7 = alloca double*
%8 = alloca i32
%9 = alloca double*
%10 = alloca double
%11 = alloca double*
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store double* %1, double** %7
store i32 %2, i32* %8
store double* %3, double** %9
store double %4, double* %10
%14 = load i32, i32* %8
%15 = load i32, i32* %6
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %6
%20 = load double*, double** %7
%21 = load double, double* %10
%22 = fsub double %21, 5.000000e-01
%23 = load double, double* %10
%24 = fadd double %23, 5.000000e-01
%25 = call i32 @newton(i32 %19, double* %20, double %22, double %24)
br label %26
26: ; preds = %17, %5
%27 = load i32, i32* %8
%28 = call i64 @calloc(i32 %27, i32 8)
%29 = inttoptr i64 %28 to double*
store double* %29, double** %11
%30 = load double*, double** %9
%31 = load i32, i32* %8
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %30, i64 %32
%34 = load double, double* %33
%35 = load double*, double** %11
%36 = load i32, i32* %8
%37 = sub nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %35, i64 %38
store double %34, double* %39
%40 = load i32, i32* %8
%41 = sub nsw i32 %40, 2
store i32 %41, i32* %12
br label %42
42: ; preds = %64, %26
%43 = load i32, i32* %12
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %67
45: ; preds = %42
%46 = load double*, double** %11
%47 = load i32, i32* %12
%48 = add nsw i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %46, i64 %49
%51 = load double, double* %50
%52 = load double, double* %10
%53 = load double*, double** %9
%54 = load i32, i32* %12
%55 = add nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %53, i64 %56
%58 = load double, double* %57
%59 = call double @llvm.fmuladd.f64(double %51, double %52, double %58)
%60 = load double*, double** %11
%61 = load i32, i32* %12
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double %59, double* %63
br label %64
64: ; preds = %45
%65 = load i32, i32* %12
%66 = add nsw i32 %65, -1
store i32 %66, i32* %12
br label %42
67: ; preds = %42
%68 = load i32, i32* %8
store i32 %68, i32* %13
br label %69
69: ; preds = %94, %67
%70 = load i32, i32* %13
%71 = icmp sgt i32 %70, 0
br i1 %71, label %72, label %97
72: ; preds = %69
%73 = load double*, double** %9
%74 = load i32, i32* %13
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %73, i64 %75
%77 = load double, double* %76
%78 = call double @d_abs(double %77)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %78)
%80 = load double*, double** %9
%81 = load i32, i32* %13
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %80, i64 %83
%85 = load double, double* %84
%86 = fcmp olt double %85, 0.000000e+00
br i1 %86, label %87, label %90
87: ; preds = %72
%88 = load i32, i32* %13
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %88)
br label %93
90: ; preds = %72
%91 = load i32, i32* %13
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %91)
br label %93
93: ; preds = %90, %87
br label %94
94: ; preds = %93
%95 = load i32, i32* %13
%96 = add nsw i32 %95, -1
store i32 %96, i32* %13
br label %69
97: ; preds = %69
%98 = load double*, double** %9
%99 = getelementptr inbounds double, double* %98, i64 0
%100 = load double, double* %99
%101 = call double @d_abs(double %100)
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %101)
%103 = load double, double* %10
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), double %103)
%105 = load i32, i32* %8
%106 = sub nsw i32 %105, 1
store i32 %106, i32* %13
br label %107
107: ; preds = %132, %97
%108 = load i32, i32* %13
%109 = icmp sgt i32 %108, 0
br i1 %109, label %110, label %135
110: ; preds = %107
%111 = load double*, double** %11
%112 = load i32, i32* %13
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
%116 = call double @d_abs(double %115)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %116)
%118 = load double*, double** %11
%119 = load i32, i32* %13
%120 = sub nsw i32 %119, 1
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %118, i64 %121
%123 = load double, double* %122
%124 = fcmp olt double %123, 0.000000e+00
br i1 %124, label %125, label %128
125: ; preds = %110
%126 = load i32, i32* %13
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %126)
br label %131
128: ; preds = %110
%129 = load i32, i32* %13
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %129)
br label %131
131: ; preds = %128, %125
br label %132
132: ; preds = %131
%133 = load i32, i32* %13
%134 = add nsw i32 %133, -1
store i32 %134, i32* %13
br label %107
135: ; preds = %107
%136 = load double*, double** %11
%137 = getelementptr inbounds double, double* %136, i64 0
%138 = load double, double* %137
%139 = call double @d_abs(double %138)
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %139)
%141 = load i32, i32* %8
%142 = icmp eq i32 %141, 3
br i1 %142, label %143, label %218
143: ; preds = %135
%144 = load double*, double** %11
%145 = getelementptr inbounds double, double* %144, i64 1
%146 = load double, double* %145
%147 = fneg double %146
%148 = load double*, double** %11
%149 = getelementptr inbounds double, double* %148, i64 1
%150 = load double, double* %149
%151 = load double*, double** %11
%152 = getelementptr inbounds double, double* %151, i64 1
%153 = load double, double* %152
%154 = load double*, double** %11
%155 = getelementptr inbounds double, double* %154, i64 2
%156 = load double, double* %155
%157 = fmul double 4.000000e+00, %156
%158 = load double*, double** %11
%159 = getelementptr inbounds double, double* %158, i64 0
%160 = load double, double* %159
%161 = fmul double %157, %160
%162 = fneg double %161
%163 = call double @llvm.fmuladd.f64(double %150, double %153, double %162)
%164 = call double @sqrt(double %163)
%165 = fadd double %147, %164
%166 = load double*, double** %11
%167 = getelementptr inbounds double, double* %166, i64 2
%168 = load double, double* %167
%169 = fmul double 2.000000e+00, %168
%170 = fdiv double %165, %169
store double %170, double* %10
%171 = load double, double* %10
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), double %171)
%173 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%174 = load i32, i32* %6
%175 = load double*, double** %7
%176 = load double, double* %10
%177 = fsub double %176, 5.000000e-01
%178 = load double, double* %10
%179 = fadd double %178, 5.000000e-01
%180 = call i32 @newton(i32 %174, double* %175, double %177, double %179)
%181 = load double*, double** %11
%182 = getelementptr inbounds double, double* %181, i64 1
%183 = load double, double* %182
%184 = fneg double %183
%185 = load double*, double** %11
%186 = getelementptr inbounds double, double* %185, i64 1
%187 = load double, double* %186
%188 = load double*, double** %11
%189 = getelementptr inbounds double, double* %188, i64 1
%190 = load double, double* %189
%191 = load double*, double** %11
%192 = getelementptr inbounds double, double* %191, i64 2
%193 = load double, double* %192
%194 = fmul double 4.000000e+00, %193
%195 = load double*, double** %11
%196 = getelementptr inbounds double, double* %195, i64 0
%197 = load double, double* %196
%198 = fmul double %194, %197
%199 = fneg double %198
%200 = call double @llvm.fmuladd.f64(double %187, double %190, double %199)
%201 = call double @sqrt(double %200)
%202 = fsub double %184, %201
%203 = load double*, double** %11
%204 = getelementptr inbounds double, double* %203, i64 2
%205 = load double, double* %204
%206 = fmul double 2.000000e+00, %205
%207 = fdiv double %202, %206
store double %207, double* %10
%208 = load double, double* %10
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), double %208)
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%211 = load i32, i32* %6
%212 = load double*, double** %7
%213 = load double, double* %10
%214 = fsub double %213, 5.000000e-01
%215 = load double, double* %10
%216 = fadd double %215, 5.000000e-01
%217 = call i32 @newton(i32 %211, double* %212, double %214, double %216)
br label %225
218: ; preds = %135
%219 = load i32, i32* %6
%220 = load double*, double** %7
%221 = load i32, i32* %8
%222 = sub nsw i32 %221, 1
%223 = load double*, double** %11
%224 = call i32 @allroots(i32 %219, double* %220, i32 %222, double* %223)
br label %225
225: ; preds = %218, %143
%226 = load double*, double** %11
%227 = call i32 @free(double* %226)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%g\00"
@.str.2 = [9 x i8] c"x**%d - \00"
@.str.3 = [9 x i8] c"x**%d + \00"
@.str.4 = [4 x i8] c"%g\0A\00"
@.str.5 = [28 x i8] c" DEFLATED to\0A(x - %g)*(\00"
@.str.6 = [5 x i8] c"%g)\0A\00"
@.str.7 = [39 x i8] c"\0A ROOT = %g (from quadratic formula)\0A\00"
@.str.8 = [38 x i8] c" ROOT = %g (from quadratic formula)\0A\00"
@str.10 = [59 x i8] c"----> Refine Root on the Orginal Polynomial (non-deflated)\00"
define void @deflat(i32 %0, double* %1, i32 %2, double* nocapture %3, double %4) {
%6 = icmp eq i32 %2, %0
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.10, i64 0, i64 0))
%9 = fadd double %4, -5.000000e-01
%10 = fadd double %4, 5.000000e-01
%11 = tail call i32 @newton(i32 %0, double* %1, double %9, double %10)
br label %12
12: ; preds = %7, %5
%13 = tail call i64 @calloc(i32 %2, i32 8)
%14 = inttoptr i64 %13 to double*
%15 = sext i32 %2 to i64
%16 = getelementptr inbounds double, double* %3, i64 %15
%17 = load double, double* %16
%18 = add nsw i32 %2, -1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %14, i64 %19
store double %17, double* %20
%21 = icmp sgt i32 %2, 1
br i1 %21, label %22, label %39
22: ; preds = %12
%23 = add nsw i32 %2, -2
%24 = zext i32 %23 to i64
%25 = and i64 %24, 1
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %36
27: ; preds = %22
%28 = add nuw nsw i64 %24, 1
%29 = getelementptr inbounds double, double* %14, i64 %28
%30 = load double, double* %29
%31 = getelementptr inbounds double, double* %3, i64 %28
%32 = load double, double* %31
%33 = tail call double @llvm.fmuladd.f64(double %30, double %4, double %32)
%34 = getelementptr inbounds double, double* %14, i64 %24
store double %33, double* %34
%35 = add nsw i64 %24, -1
br label %36
36: ; preds = %27, %22
%37 = phi i64 [ %24, %22 ], [ %35, %27 ]
%38 = icmp eq i32 %23, 0
br i1 %38, label %39, label %43
39: ; preds = %36, %43, %12
%40 = icmp sgt i32 %2, 0
br i1 %40, label %41, label %74
41: ; preds = %39
%42 = zext i32 %2 to i64
br label %59
43: ; preds = %36, %43
%44 = phi i64 [ %57, %43 ], [ %37, %36 ]
%45 = add nuw nsw i64 %44, 1
%46 = getelementptr inbounds double, double* %14, i64 %45
%47 = load double, double* %46
%48 = getelementptr inbounds double, double* %3, i64 %45
%49 = load double, double* %48
%50 = tail call double @llvm.fmuladd.f64(double %47, double %4, double %49)
%51 = getelementptr inbounds double, double* %14, i64 %44
store double %50, double* %51
%52 = add nsw i64 %44, -1
%53 = getelementptr inbounds double, double* %3, i64 %44
%54 = load double, double* %53
%55 = tail call double @llvm.fmuladd.f64(double %50, double %4, double %54)
%56 = getelementptr inbounds double, double* %14, i64 %52
store double %55, double* %56
%57 = add nsw i64 %44, -2
%58 = icmp eq i64 %52, 0
br i1 %58, label %39, label %43
59: ; preds = %41, %59
%60 = phi i64 [ %42, %41 ], [ %65, %59 ]
%61 = getelementptr inbounds double, double* %3, i64 %60
%62 = load double, double* %61
%63 = tail call double @d_abs(double %62)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %63)
%65 = add nsw i64 %60, -1
%66 = and i64 %65, 4294967295
%67 = getelementptr inbounds double, double* %3, i64 %66
%68 = load double, double* %67
%69 = fcmp olt double %68, 0.000000e+00
%70 = trunc i64 %60 to i32
%71 = select i1 %69, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %71, i32 %70)
%73 = icmp ugt i64 %60, 1
br i1 %73, label %59, label %74
74: ; preds = %59, %39
%75 = load double, double* %3
%76 = tail call double @d_abs(double %75)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double %76)
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), double %4)
br i1 %21, label %79, label %96
79: ; preds = %74
%80 = zext i32 %18 to i64
br label %81
81: ; preds = %79, %81
%82 = phi i64 [ %80, %79 ], [ %87, %81 ]
%83 = getelementptr inbounds double, double* %14, i64 %82
%84 = load double, double* %83
%85 = tail call double @d_abs(double %84)
%86 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), double %85)
%87 = add nsw i64 %82, -1
%88 = and i64 %87, 4294967295
%89 = getelementptr inbounds double, double* %14, i64 %88
%90 = load double, double* %89
%91 = fcmp olt double %90, 0.000000e+00
%92 = trunc i64 %82 to i32
%93 = select i1 %91, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%94 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %93, i32 %92)
%95 = icmp ugt i64 %82, 1
br i1 %95, label %81, label %96
96: ; preds = %81, %74
%97 = load double, double* %14
%98 = tail call double @d_abs(double %97)
%99 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %98)
%100 = icmp eq i32 %2, 3
br i1 %100, label %101, label %137
101: ; preds = %96
%102 = getelementptr inbounds double, double* %14, i64 1
%103 = load double, double* %102
%104 = getelementptr inbounds double, double* %14, i64 2
%105 = load double, double* %104
%106 = load double, double* %14
%107 = fmul double %105, -4.000000e+00
%108 = fmul double %107, %106
%109 = tail call double @llvm.fmuladd.f64(double %103, double %103, double %108)
%110 = tail call double @sqrt(double %109)
%111 = fsub double %110, %103
%112 = load double, double* %104
%113 = fmul double %112, 2.000000e+00
%114 = fdiv double %111, %113
%115 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0), double %114)
%116 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.10, i64 0, i64 0))
%117 = fadd double %114, -5.000000e-01
%118 = fadd double %114, 5.000000e-01
%119 = tail call i32 @newton(i32 %0, double* %1, double %117, double %118)
%120 = load double, double* %102
%121 = fneg double %120
%122 = load double, double* %104
%123 = load double, double* %14
%124 = fmul double %122, -4.000000e+00
%125 = fmul double %124, %123
%126 = tail call double @llvm.fmuladd.f64(double %120, double %120, double %125)
%127 = tail call double @sqrt(double %126)
%128 = fsub double %121, %127
%129 = load double, double* %104
%130 = fmul double %129, 2.000000e+00
%131 = fdiv double %128, %130
%132 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), double %131)
%133 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.10, i64 0, i64 0))
%134 = fadd double %131, -5.000000e-01
%135 = fadd double %131, 5.000000e-01
%136 = tail call i32 @newton(i32 %0, double* %1, double %134, double %135)
br label %139
137: ; preds = %96
%138 = tail call i32 @allroots(i32 %0, double* %1, i32 %18, double* %14)
br label %139
139: ; preds = %137, %101
%140 = tail call i32 @free(double* %14)
ret void
}