; LLVM IR from stillwater-sc/universal :: applications/accuracy/roots/rpoly_ak1.ll (Z8Quad_ak1dddPdS_S_S_)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind
declare double @sqrt(double noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z8Quad_ak1dddPdS_S_S_(double noundef %0, double noundef %1, double noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #2 {
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  store double %0, ptr %8, align 8, !tbaa !5
  store double %1, ptr %9, align 8, !tbaa !5
  store double %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !9
  store ptr %5, ptr %13, align 8, !tbaa !9
  store ptr %6, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %19 = load ptr, ptr %14, align 8, !tbaa !9
  store double 0.000000e+00, ptr %19, align 8, !tbaa !5
  %20 = load ptr, ptr %13, align 8, !tbaa !9
  store double 0.000000e+00, ptr %20, align 8, !tbaa !5
  %21 = load ptr, ptr %12, align 8, !tbaa !9
  store double 0.000000e+00, ptr %21, align 8, !tbaa !5
  %22 = load ptr, ptr %11, align 8, !tbaa !9
  store double 0.000000e+00, ptr %22, align 8, !tbaa !5
  %23 = load double, ptr %8, align 8, !tbaa !5
  %24 = fcmp oeq double %23, 0.000000e+00
  br i1 %24, label %25, label %39

25:                                               ; preds = %7
  %26 = load double, ptr %9, align 8, !tbaa !5
  %27 = fcmp une double %26, 0.000000e+00
  br i1 %27, label %28, label %33

28:                                               ; preds = %25
  %29 = load double, ptr %10, align 8, !tbaa !5
  %30 = load double, ptr %9, align 8, !tbaa !5
  %31 = fdiv double %29, %30
  %32 = fneg double %31
  br label %36

33:                                               ; preds = %25
  %34 = load ptr, ptr %11, align 8, !tbaa !9
  %35 = load double, ptr %34, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %33, %28
  %37 = phi double [ %32, %28 ], [ %35, %33 ]
  %38 = load ptr, ptr %11, align 8, !tbaa !9
  store double %37, ptr %38, align 8, !tbaa !5
  store i32 1, ptr %18, align 4
  br label %149

39:                                               ; preds = %7
  %40 = load double, ptr %10, align 8, !tbaa !5
  %41 = fcmp oeq double %40, 0.000000e+00
  br i1 %41, label %42, label %48

42:                                               ; preds = %39
  %43 = load double, ptr %9, align 8, !tbaa !5
  %44 = load double, ptr %8, align 8, !tbaa !5
  %45 = fdiv double %43, %44
  %46 = fneg double %45
  %47 = load ptr, ptr %13, align 8, !tbaa !9
  store double %46, ptr %47, align 8, !tbaa !5
  store i32 1, ptr %18, align 4
  br label %149

48:                                               ; preds = %39
  %49 = load double, ptr %9, align 8, !tbaa !5
  %50 = fdiv double %49, 2.000000e+00
  store double %50, ptr %15, align 8, !tbaa !5
  %51 = load double, ptr %15, align 8, !tbaa !5
  %52 = call double @llvm.fabs.f64(double %51)
  %53 = load double, ptr %10, align 8, !tbaa !5
  %54 = call double @llvm.fabs.f64(double %53)
  %55 = fcmp olt double %52, %54
  br i1 %55, label %56, label %81

56:                                               ; preds = %48
  %57 = load double, ptr %10, align 8, !tbaa !5
  %58 = fcmp oge double %57, 0.000000e+00
  br i1 %58, label %59, label %61

59:                                               ; preds = %56
  %60 = load double, ptr %8, align 8, !tbaa !5
  br label %64

61:                                               ; preds = %56
  %62 = load double, ptr %8, align 8, !tbaa !5
  %63 = fneg double %62
  br label %64

64:                                               ; preds = %61, %59
  %65 = phi double [ %60, %59 ], [ %63, %61 ]
  store double %65, ptr %17, align 8, !tbaa !5
  %66 = load double, ptr %17, align 8, !tbaa !5
  %67 = fneg double %66
  %68 = load double, ptr %15, align 8, !tbaa !5
  %69 = load double, ptr %15, align 8, !tbaa !5
  %70 = load double, ptr %10, align 8, !tbaa !5
  %71 = call double @llvm.fabs.f64(double %70)
  %72 = fdiv double %69, %71
  %73 = call double @llvm.fmuladd.f64(double %68, double %72, double %67)
  store double %73, ptr %17, align 8, !tbaa !5
  %74 = load double, ptr %17, align 8, !tbaa !5
  %75 = call double @llvm.fabs.f64(double %74)
  %76 = call double @sqrt(double noundef %75) #4
  %77 = load double, ptr %10, align 8, !tbaa !5
  %78 = call double @llvm.fabs.f64(double %77)
  %79 = call double @sqrt(double noundef %78) #4
  %80 = fmul double %76, %79
  store double %80, ptr %16, align 8, !tbaa !5
  br label %96

81:                                               ; preds = %48
  %82 = load double, ptr %8, align 8, !tbaa !5
  %83 = load double, ptr %15, align 8, !tbaa !5
  %84 = fdiv double %82, %83
  %85 = load double, ptr %10, align 8, !tbaa !5
  %86 = load double, ptr %15, align 8, !tbaa !5
  %87 = fdiv double %85, %86
  %88 = fneg double %84
  %89 = call double @llvm.fmuladd.f64(double %88, double %87, double 1.000000e+00)
  store double %89, ptr %17, align 8, !tbaa !5
  %90 = load double, ptr %17, align 8, !tbaa !5
  %91 = call double @llvm.fabs.f64(double %90)
  %92 = call double @sqrt(double noundef %91) #4
  %93 = load double, ptr %15, align 8, !tbaa !5
  %94 = call double @llvm.fabs.f64(double %93)
  %95 = fmul double %92, %94
  store double %95, ptr %16, align 8, !tbaa !5
  br label %96

96:                                               ; preds = %81, %64
  %97 = load double, ptr %17, align 8, !tbaa !5
  %98 = fcmp oge double %97, 0.000000e+00
  br i1 %98, label %99, label %132

99:                                               ; preds = %96
  %100 = load double, ptr %15, align 8, !tbaa !5
  %101 = fcmp oge double %100, 0.000000e+00
  br i1 %101, label %102, label %105

102:                                              ; preds = %99
  %103 = load double, ptr %16, align 8, !tbaa !5
  %104 = fneg double %103
  br label %107

105:                                              ; preds = %99
  %106 = load double, ptr %16, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %105, %102
  %108 = phi double [ %104, %102 ], [ %106, %105 ]
  store double %108, ptr %16, align 8, !tbaa !5
  %109 = load double, ptr %15, align 8, !tbaa !5
  %110 = fneg double %109
  %111 = load double, ptr %16, align 8, !tbaa !5
  %112 = fadd double %110, %111
  %113 = load double, ptr %8, align 8, !tbaa !5
  %114 = fdiv double %112, %113
  %115 = load ptr, ptr %13, align 8, !tbaa !9
  store double %114, ptr %115, align 8, !tbaa !5
  %116 = load ptr, ptr %13, align 8, !tbaa !9
  %117 = load double, ptr %116, align 8, !tbaa !5
  %118 = fcmp une double %117, 0.000000e+00
  br i1 %118, label %119, label %126

119:                                              ; preds = %107
  %120 = load double, ptr %10, align 8, !tbaa !5
  %121 = load ptr, ptr %13, align 8, !tbaa !9
  %122 = load double, ptr %121, align 8, !tbaa !5
  %123 = fdiv double %120, %122
  %124 = load double, ptr %8, align 8, !tbaa !5
  %125 = fdiv double %123, %124
  br label %129

126:                                              ; preds = %107
  %127 = load ptr, ptr %11, align 8, !tbaa !9
  %128 = load double, ptr %127, align 8, !tbaa !5
  br label %129

129:                                              ; preds = %126, %119
  %130 = phi double [ %125, %119 ], [ %128, %126 ]
  %131 = load ptr, ptr %11, align 8, !tbaa !9
  store double %130, ptr %131, align 8, !tbaa !5
  br label %148

132:                                              ; preds = %96
  %133 = load double, ptr %15, align 8, !tbaa !5
  %134 = load double, ptr %8, align 8, !tbaa !5
  %135 = fdiv double %133, %134
  %136 = fneg double %135
  %137 = load ptr, ptr %11, align 8, !tbaa !9
  store double %136, ptr %137, align 8, !tbaa !5
  %138 = load ptr, ptr %13, align 8, !tbaa !9
  store double %136, ptr %138, align 8, !tbaa !5
  %139 = load double, ptr %16, align 8, !tbaa !5
  %140 = load double, ptr %8, align 8, !tbaa !5
  %141 = fdiv double %139, %140
  %142 = call double @llvm.fabs.f64(double %141)
  %143 = load ptr, ptr %12, align 8, !tbaa !9
  store double %142, ptr %143, align 8, !tbaa !5
  %144 = load ptr, ptr %12, align 8, !tbaa !9
  %145 = load double, ptr %144, align 8, !tbaa !5
  %146 = fneg double %145
  %147 = load ptr, ptr %14, align 8, !tbaa !9
  store double %146, ptr %147, align 8, !tbaa !5
  br label %148

148:                                              ; preds = %132, %129
  store i32 1, ptr %18, align 4
  br label %149

149:                                              ; preds = %148, %42, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_Z8Quad_ak1dddPdS_S_S_(double noundef %0, double noundef %1, double noundef %2, ptr nocapture noundef %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #0 {
  store double 0.000000e+00, ptr %6, align 8, !tbaa !5
  store double 0.000000e+00, ptr %5, align 8, !tbaa !5
  store double 0.000000e+00, ptr %4, align 8, !tbaa !5
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  %8 = fcmp oeq double %0, 0.000000e+00
  br i1 %8, label %9, label %14

9:                                                ; preds = %7
  %10 = fcmp une double %1, 0.000000e+00
  %11 = fneg double %2
  %12 = fdiv double %11, %1
  %13 = select i1 %10, double %12, double 0.000000e+00
  store double %13, ptr %3, align 8, !tbaa !5
  br label %59

14:                                               ; preds = %7
  %15 = fcmp oeq double %2, 0.000000e+00
  br i1 %15, label %16, label %19

16:                                               ; preds = %14
  %17 = fneg double %1
  %18 = fdiv double %17, %0
  store double %18, ptr %5, align 8, !tbaa !5
  br label %59

19:                                               ; preds = %14
  %20 = fmul double %1, 5.000000e-01
  %21 = tail call double @llvm.fabs.f64(double %20)
  %22 = tail call double @llvm.fabs.f64(double %2)
  %23 = fcmp olt double %21, %22
  %.neg = fneg double %0
  br i1 %23, label %24, label %31

24:                                               ; preds = %19
  %25 = fcmp oge double %2, 0.000000e+00
  %26 = select i1 %25, double %.neg, double %0
  %27 = fdiv double %20, %22
  %28 = tail call double @llvm.fmuladd.f64(double %20, double %27, double %26)
  %29 = tail call double @llvm.fabs.f64(double %28)
  %sqrt62 = tail call double @llvm.sqrt.f64(double %29)
  %sqrt = tail call double @llvm.sqrt.f64(double %22)
  %30 = fmul double %sqrt, %sqrt62
  br label %37

31:                                               ; preds = %19
  %32 = fdiv double %2, %20
  %33 = fdiv double %.neg, %20
  %34 = tail call double @llvm.fmuladd.f64(double %33, double %32, double 1.000000e+00)
  %35 = tail call double @llvm.fabs.f64(double %34)
  %sqrt63 = tail call double @llvm.sqrt.f64(double %35)
  %36 = fmul double %21, %sqrt63
  br label %37

37:                                               ; preds = %31, %24
  %.055 = phi double [ %30, %24 ], [ %36, %31 ]
  %.0 = phi double [ %28, %24 ], [ %34, %31 ]
  %38 = fcmp ult double %.0, 0.000000e+00
  br i1 %38, label %53, label %39

39:                                               ; preds = %37
  %40 = fcmp oge double %20, 0.000000e+00
  %41 = fneg double %.055
  %42 = select i1 %40, double %41, double %.055
  %43 = fsub double %42, %20
  %44 = fdiv double %43, %0
  store double %44, ptr %5, align 8, !tbaa !5
  %45 = fcmp une double %44, 0.000000e+00
  br i1 %45, label %46, label %49

46:                                               ; preds = %39
  %47 = fdiv double %2, %44
  %48 = fdiv double %47, %0
  br label %51

49:                                               ; preds = %39
  %50 = load double, ptr %3, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %49, %46
  %52 = phi double [ %48, %46 ], [ %50, %49 ]
  store double %52, ptr %3, align 8, !tbaa !5
  br label %59

53:                                               ; preds = %37
  %54 = fneg double %20
  %55 = fdiv double %54, %0
  store double %55, ptr %3, align 8, !tbaa !5
  store double %55, ptr %5, align 8, !tbaa !5
  %56 = fdiv double %.055, %0
  %57 = tail call double @llvm.fabs.f64(double %56)
  store double %57, ptr %4, align 8, !tbaa !5
  %58 = fneg double %57
  store double %58, ptr %6, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %51, %53, %16, %9
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #2

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass