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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10QuadSD_ak1iddPdS_S_S_(i32 noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z10calcSC_ak1iddPdS_S_S_S_S_S_S_S_S_ddS_(i32 noundef %0, double noundef %1, double noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8, ptr noundef %9, ptr noundef %10, ptr noundef %11, ptr noundef %12, double noundef %13, double noundef %14, ptr noundef %15) #2 {
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca double, align 8
  %32 = alloca double, align 8
  %33 = alloca ptr, align 8
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  store i32 %0, ptr %18, align 4, !tbaa !5
  store double %1, ptr %19, align 8, !tbaa !9
  store double %2, ptr %20, align 8, !tbaa !9
  store ptr %3, ptr %21, align 8, !tbaa !11
  store ptr %4, ptr %22, align 8, !tbaa !11
  store ptr %5, ptr %23, align 8, !tbaa !11
  store ptr %6, ptr %24, align 8, !tbaa !11
  store ptr %7, ptr %25, align 8, !tbaa !11
  store ptr %8, ptr %26, align 8, !tbaa !11
  store ptr %9, ptr %27, align 8, !tbaa !11
  store ptr %10, ptr %28, align 8, !tbaa !11
  store ptr %11, ptr %29, align 8, !tbaa !11
  store ptr %12, ptr %30, align 8, !tbaa !11
  store double %13, ptr %31, align 8, !tbaa !9
  store double %14, ptr %32, align 8, !tbaa !9
  store ptr %15, ptr %33, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #3
  store i32 3, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr %18, align 4, !tbaa !5
  %37 = load double, ptr %31, align 8, !tbaa !9
  %38 = load double, ptr %32, align 8, !tbaa !9
  %39 = load ptr, ptr %30, align 8, !tbaa !11
  %40 = load ptr, ptr %33, align 8, !tbaa !11
  %41 = load ptr, ptr %24, align 8, !tbaa !11
  %42 = load ptr, ptr %25, align 8, !tbaa !11
  call void @_Z10QuadSD_ak1iddPdS_S_S_(i32 noundef %36, double noundef %37, double noundef %38, ptr noundef %39, ptr noundef %40, ptr noundef %41, ptr noundef %42)
  %43 = load ptr, ptr %24, align 8, !tbaa !11
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = call double @llvm.fabs.f64(double %44)
  %46 = load ptr, ptr %30, align 8, !tbaa !11
  %47 = load i32, ptr %18, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds double, ptr %46, i64 %49
  %51 = load double, ptr %50, align 8, !tbaa !9
  %52 = call double @llvm.fabs.f64(double %51)
  %53 = fmul double 0x3D19000000000000, %52
  %54 = fcmp ole double %45, %53
  br i1 %54, label %55, label %71

55:                                               ; preds = %16
  %56 = load ptr, ptr %25, align 8, !tbaa !11
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = call double @llvm.fabs.f64(double %57)
  %59 = load ptr, ptr %30, align 8, !tbaa !11
  %60 = load i32, ptr %18, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 2
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds double, ptr %59, i64 %62
  %64 = load double, ptr %63, align 8, !tbaa !9
  %65 = call double @llvm.fabs.f64(double %64)
  %66 = fmul double 0x3D19000000000000, %65
  %67 = fcmp ole double %58, %66
  br i1 %67, label %68, label %70

68:                                               ; preds = %55
  %69 = load i32, ptr %34, align 4, !tbaa !5
  store i32 %69, ptr %17, align 4
  store i32 1, ptr %35, align 4
  br label %187

70:                                               ; preds = %55
  br label %71

71:                                               ; preds = %70, %16
  %72 = load double, ptr %32, align 8, !tbaa !9
  %73 = load double, ptr %20, align 8, !tbaa !9
  %74 = fmul double %72, %73
  %75 = load ptr, ptr %29, align 8, !tbaa !11
  store double %74, ptr %75, align 8, !tbaa !9
  %76 = load ptr, ptr %25, align 8, !tbaa !11
  %77 = load double, ptr %76, align 8, !tbaa !9
  %78 = call double @llvm.fabs.f64(double %77)
  %79 = load ptr, ptr %24, align 8, !tbaa !11
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = call double @llvm.fabs.f64(double %80)
  %82 = fcmp oge double %78, %81
  br i1 %82, label %83, label %130

83:                                               ; preds = %71
  store i32 2, ptr %34, align 4, !tbaa !5
  %84 = load double, ptr %19, align 8, !tbaa !9
  %85 = load ptr, ptr %25, align 8, !tbaa !11
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = fdiv double %84, %86
  %88 = load ptr, ptr %26, align 8, !tbaa !11
  store double %87, ptr %88, align 8, !tbaa !9
  %89 = load ptr, ptr %24, align 8, !tbaa !11
  %90 = load double, ptr %89, align 8, !tbaa !9
  %91 = load ptr, ptr %25, align 8, !tbaa !11
  %92 = load double, ptr %91, align 8, !tbaa !9
  %93 = fdiv double %90, %92
  %94 = load ptr, ptr %27, align 8, !tbaa !11
  store double %93, ptr %94, align 8, !tbaa !9
  %95 = load double, ptr %31, align 8, !tbaa !9
  %96 = load double, ptr %20, align 8, !tbaa !9
  %97 = fmul double %95, %96
  %98 = load ptr, ptr %28, align 8, !tbaa !11
  store double %97, ptr %98, align 8, !tbaa !9
  %99 = load ptr, ptr %26, align 8, !tbaa !11
  %100 = load double, ptr %99, align 8, !tbaa !9
  %101 = load ptr, ptr %28, align 8, !tbaa !11
  %102 = load double, ptr %101, align 8, !tbaa !9
  %103 = load double, ptr %19, align 8, !tbaa !9
  %104 = fadd double %102, %103
  %105 = load ptr, ptr %29, align 8, !tbaa !11
  %106 = load double, ptr %105, align 8, !tbaa !9
  %107 = load double, ptr %20, align 8, !tbaa !9
  %108 = load ptr, ptr %25, align 8, !tbaa !11
  %109 = load double, ptr %108, align 8, !tbaa !9
  %110 = fdiv double %107, %109
  %111 = fmul double %106, %110
  %112 = call double @llvm.fmuladd.f64(double %100, double %104, double %111)
  %113 = load ptr, ptr %22, align 8, !tbaa !11
  store double %112, ptr %113, align 8, !tbaa !9
  %114 = load double, ptr %19, align 8, !tbaa !9
  %115 = fneg double %114
  %116 = load ptr, ptr %27, align 8, !tbaa !11
  %117 = load double, ptr %116, align 8, !tbaa !9
  %118 = load double, ptr %20, align 8, !tbaa !9
  %119 = call double @llvm.fmuladd.f64(double %117, double %118, double %115)
  %120 = load ptr, ptr %21, align 8, !tbaa !11
  store double %119, ptr %120, align 8, !tbaa !9
  %121 = load ptr, ptr %29, align 8, !tbaa !11
  %122 = load double, ptr %121, align 8, !tbaa !9
  %123 = load ptr, ptr %27, align 8, !tbaa !11
  %124 = load double, ptr %123, align 8, !tbaa !9
  %125 = load double, ptr %31, align 8, !tbaa !9
  %126 = fadd double %124, %125
  %127 = load double, ptr %19, align 8, !tbaa !9
  %128 = call double @llvm.fmuladd.f64(double %126, double %127, double %122)
  %129 = load ptr, ptr %23, align 8, !tbaa !11
  store double %128, ptr %129, align 8, !tbaa !9
  br label %185

130:                                              ; preds = %71
  store i32 1, ptr %34, align 4, !tbaa !5
  %131 = load double, ptr %19, align 8, !tbaa !9
  %132 = load ptr, ptr %24, align 8, !tbaa !11
  %133 = load double, ptr %132, align 8, !tbaa !9
  %134 = fdiv double %131, %133
  %135 = load ptr, ptr %26, align 8, !tbaa !11
  store double %134, ptr %135, align 8, !tbaa !9
  %136 = load ptr, ptr %25, align 8, !tbaa !11
  %137 = load double, ptr %136, align 8, !tbaa !9
  %138 = load ptr, ptr %24, align 8, !tbaa !11
  %139 = load double, ptr %138, align 8, !tbaa !9
  %140 = fdiv double %137, %139
  %141 = load ptr, ptr %27, align 8, !tbaa !11
  store double %140, ptr %141, align 8, !tbaa !9
  %142 = load ptr, ptr %26, align 8, !tbaa !11
  %143 = load double, ptr %142, align 8, !tbaa !9
  %144 = load double, ptr %31, align 8, !tbaa !9
  %145 = fmul double %143, %144
  %146 = load ptr, ptr %28, align 8, !tbaa !11
  store double %145, ptr %146, align 8, !tbaa !9
  %147 = load ptr, ptr %26, align 8, !tbaa !11
  %148 = load double, ptr %147, align 8, !tbaa !9
  %149 = load double, ptr %19, align 8, !tbaa !9
  %150 = load ptr, ptr %28, align 8, !tbaa !11
  %151 = load double, ptr %150, align 8, !tbaa !9
  %152 = load ptr, ptr %29, align 8, !tbaa !11
  %153 = load double, ptr %152, align 8, !tbaa !9
  %154 = load ptr, ptr %24, align 8, !tbaa !11
  %155 = load double, ptr %154, align 8, !tbaa !9
  %156 = fdiv double %153, %155
  %157 = fadd double %151, %156
  %158 = load double, ptr %20, align 8, !tbaa !9
  %159 = fmul double %157, %158
  %160 = call double @llvm.fmuladd.f64(double %148, double %149, double %159)
  %161 = load ptr, ptr %22, align 8, !tbaa !11
  store double %160, ptr %161, align 8, !tbaa !9
  %162 = load double, ptr %19, align 8, !tbaa !9
  %163 = load ptr, ptr %25, align 8, !tbaa !11
  %164 = load double, ptr %163, align 8, !tbaa !9
  %165 = load ptr, ptr %24, align 8, !tbaa !11
  %166 = load double, ptr %165, align 8, !tbaa !9
  %167 = fdiv double %164, %166
  %168 = load double, ptr %20, align 8, !tbaa !9
  %169 = fneg double %162
  %170 = call double @llvm.fmuladd.f64(double %169, double %167, double %168)
  %171 = load ptr, ptr %21, align 8, !tbaa !11
  store double %170, ptr %171, align 8, !tbaa !9
  %172 = load ptr, ptr %28, align 8, !tbaa !11
  %173 = load double, ptr %172, align 8, !tbaa !9
  %174 = load ptr, ptr %25, align 8, !tbaa !11
  %175 = load double, ptr %174, align 8, !tbaa !9
  %176 = load ptr, ptr %29, align 8, !tbaa !11
  %177 = load double, ptr %176, align 8, !tbaa !9
  %178 = load ptr, ptr %27, align 8, !tbaa !11
  %179 = load double, ptr %178, align 8, !tbaa !9
  %180 = fmul double %177, %179
  %181 = call double @llvm.fmuladd.f64(double %173, double %175, double %180)
  %182 = load double, ptr %19, align 8, !tbaa !9
  %183 = fadd double %181, %182
  %184 = load ptr, ptr %23, align 8, !tbaa !11
  store double %183, ptr %184, align 8, !tbaa !9
  br label %185

185:                                              ; preds = %130, %83
  %186 = load i32, ptr %34, align 4, !tbaa !5
  store i32 %186, ptr %17, align 4
  store i32 1, ptr %35, align 4
  br label %187

187:                                              ; preds = %185, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #3
  %188 = load i32, ptr %17, align 4
  ret i32 %188
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z10QuadSD_ak1iddPdS_S_S_(i32 noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 1, 4) i32 @_Z10calcSC_ak1iddPdS_S_S_S_S_S_S_S_S_ddS_(i32 noundef %0, double noundef %1, double noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr noundef %6, ptr noundef %7, ptr nocapture noundef %8, ptr nocapture noundef %9, ptr nocapture noundef %10, ptr nocapture noundef %11, ptr noundef %12, double noundef %13, double noundef %14, ptr noundef %15) local_unnamed_addr #1 {
  tail call void @_Z10QuadSD_ak1iddPdS_S_S_(i32 noundef %0, double noundef %13, double noundef %14, ptr noundef %12, ptr noundef %15, ptr noundef %6, ptr noundef %7)
  %17 = load double, ptr %6, align 8, !tbaa !5
  %18 = tail call double @llvm.fabs.f64(double %17)
  %19 = sext i32 %0 to i64
  %20 = getelementptr double, ptr %12, i64 %19
  %21 = getelementptr i8, ptr %20, i64 -8
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = tail call double @llvm.fabs.f64(double %22)
  %24 = fmul double %23, 0x3D19000000000000
  %25 = fcmp ugt double %18, %24
  br i1 %25, label %34, label %26

26:                                               ; preds = %16
  %27 = load double, ptr %7, align 8, !tbaa !5
  %28 = tail call double @llvm.fabs.f64(double %27)
  %29 = getelementptr i8, ptr %20, i64 -16
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = tail call double @llvm.fabs.f64(double %30)
  %32 = fmul double %31, 0x3D19000000000000
  %33 = fcmp ugt double %28, %32
  br i1 %33, label %34, label %88

34:                                               ; preds = %26, %16
  %35 = fmul double %2, %14
  store double %35, ptr %11, align 8, !tbaa !5
  %36 = load double, ptr %7, align 8, !tbaa !5
  %37 = tail call double @llvm.fabs.f64(double %36)
  %38 = load double, ptr %6, align 8, !tbaa !5
  %39 = tail call double @llvm.fabs.f64(double %38)
  %40 = fcmp ult double %37, %39
  br i1 %40, label %61, label %41

41:                                               ; preds = %34
  %42 = fdiv double %1, %36
  store double %42, ptr %8, align 8, !tbaa !5
  %43 = load double, ptr %6, align 8, !tbaa !5
  %44 = load double, ptr %7, align 8, !tbaa !5
  %45 = fdiv double %43, %44
  store double %45, ptr %9, align 8, !tbaa !5
  %46 = fmul double %2, %13
  store double %46, ptr %10, align 8, !tbaa !5
  %47 = load double, ptr %8, align 8, !tbaa !5
  %48 = fadd double %46, %1
  %49 = load double, ptr %11, align 8, !tbaa !5
  %50 = load double, ptr %7, align 8, !tbaa !5
  %51 = fdiv double %2, %50
  %52 = fmul double %49, %51
  %53 = tail call double @llvm.fmuladd.f64(double %47, double %48, double %52)
  store double %53, ptr %4, align 8, !tbaa !5
  %54 = fneg double %1
  %55 = load double, ptr %9, align 8, !tbaa !5
  %56 = tail call double @llvm.fmuladd.f64(double %55, double %2, double %54)
  store double %56, ptr %3, align 8, !tbaa !5
  %57 = load double, ptr %11, align 8, !tbaa !5
  %58 = load double, ptr %9, align 8, !tbaa !5
  %59 = fadd double %58, %13
  %60 = tail call double @llvm.fmuladd.f64(double %59, double %1, double %57)
  br label %87

61:                                               ; preds = %34
  %62 = fdiv double %1, %38
  store double %62, ptr %8, align 8, !tbaa !5
  %63 = load double, ptr %7, align 8, !tbaa !5
  %64 = load double, ptr %6, align 8, !tbaa !5
  %65 = fdiv double %63, %64
  store double %65, ptr %9, align 8, !tbaa !5
  %66 = load double, ptr %8, align 8, !tbaa !5
  %67 = fmul double %66, %13
  store double %67, ptr %10, align 8, !tbaa !5
  %68 = load double, ptr %8, align 8, !tbaa !5
  %69 = load double, ptr %11, align 8, !tbaa !5
  %70 = load double, ptr %6, align 8, !tbaa !5
  %71 = fdiv double %69, %70
  %72 = fadd double %67, %71
  %73 = fmul double %72, %2
  %74 = tail call double @llvm.fmuladd.f64(double %68, double %1, double %73)
  store double %74, ptr %4, align 8, !tbaa !5
  %75 = load double, ptr %7, align 8, !tbaa !5
  %76 = load double, ptr %6, align 8, !tbaa !5
  %77 = fdiv double %75, %76
  %78 = fneg double %1
  %79 = tail call double @llvm.fmuladd.f64(double %78, double %77, double %2)
  store double %79, ptr %3, align 8, !tbaa !5
  %80 = load double, ptr %10, align 8, !tbaa !5
  %81 = load double, ptr %7, align 8, !tbaa !5
  %82 = load double, ptr %11, align 8, !tbaa !5
  %83 = load double, ptr %9, align 8, !tbaa !5
  %84 = fmul double %82, %83
  %85 = tail call double @llvm.fmuladd.f64(double %80, double %81, double %84)
  %86 = fadd double %85, %1
  br label %87

87:                                               ; preds = %61, %41
  %storemerge = phi double [ %86, %61 ], [ %60, %41 ]
  %.0 = phi i32 [ 1, %61 ], [ 2, %41 ]
  store double %storemerge, ptr %5, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %26, %87
  %.072 = phi i32 [ %.0, %87 ], [ 3, %26 ]
  ret i32 %.072
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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" }

!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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass