; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/Netlib/src/netlib/slatec (dcsevl)

; 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"

@c__4 = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@c__2 = external hidden global i64, align 8
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@c__3 = external hidden global i64, align 8
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1
@c__1 = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @dcsevl_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca double, align 8
  %9 = alloca i64, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i64, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds double, ptr %16, i32 -1
  store ptr %17, ptr %5, align 8, !tbaa !5
  %18 = call double @d1mach_(ptr noundef @c__4)
  %19 = fadd double 1.000000e+00, %18
  store double %19, ptr %15, align 8, !tbaa !9
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = icmp slt i64 %21, 1
  br i1 %22, label %23, label %25

23:                                               ; preds = %3
  %24 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, ptr noundef @c__2, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 22)
  br label %25

25:                                               ; preds = %23, %3
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = icmp sgt i64 %27, 1000
  br i1 %28, label %29, label %31

29:                                               ; preds = %25
  %30 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.3, ptr noundef @c__3, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 25)
  br label %31

31:                                               ; preds = %29, %25
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = fcmp oge double %33, 0.000000e+00
  br i1 %34, label %35, label %38

35:                                               ; preds = %31
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load double, ptr %36, align 8, !tbaa !9
  br label %42

38:                                               ; preds = %31
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = fneg double %40
  br label %42

42:                                               ; preds = %38, %35
  %43 = phi double [ %37, %35 ], [ %41, %38 ]
  %44 = load double, ptr %15, align 8, !tbaa !9
  %45 = fcmp ogt double %43, %44
  br i1 %45, label %46, label %48

46:                                               ; preds = %42
  %47 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.4, ptr noundef @c__1, ptr noundef @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 30)
  br label %48

48:                                               ; preds = %46, %42
  store double 0.000000e+00, ptr %12, align 8, !tbaa !9
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  store double 0.000000e+00, ptr %10, align 8, !tbaa !9
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load double, ptr %49, align 8, !tbaa !9
  %51 = fmul double %50, 2.000000e+00
  store double %51, ptr %14, align 8, !tbaa !9
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load i64, ptr %52, align 8, !tbaa !11
  store i64 %53, ptr %7, align 8, !tbaa !11
  store i64 1, ptr %9, align 8, !tbaa !11
  br label %54

54:                                               ; preds = %76, %48
  %55 = load i64, ptr %9, align 8, !tbaa !11
  %56 = load i64, ptr %7, align 8, !tbaa !11
  %57 = icmp sle i64 %55, %56
  br i1 %57, label %58, label %79

58:                                               ; preds = %54
  %59 = load double, ptr %11, align 8, !tbaa !9
  store double %59, ptr %12, align 8, !tbaa !9
  %60 = load double, ptr %10, align 8, !tbaa !9
  store double %60, ptr %11, align 8, !tbaa !9
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = add nsw i64 %62, 1
  %64 = load i64, ptr %9, align 8, !tbaa !11
  %65 = sub nsw i64 %63, %64
  store i64 %65, ptr %13, align 8, !tbaa !11
  %66 = load double, ptr %14, align 8, !tbaa !9
  %67 = load double, ptr %11, align 8, !tbaa !9
  %68 = load double, ptr %12, align 8, !tbaa !9
  %69 = fneg double %68
  %70 = call double @llvm.fmuladd.f64(double %66, double %67, double %69)
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = load i64, ptr %13, align 8, !tbaa !11
  %73 = getelementptr inbounds double, ptr %71, i64 %72
  %74 = load double, ptr %73, align 8, !tbaa !9
  %75 = fadd double %70, %74
  store double %75, ptr %10, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %58
  %77 = load i64, ptr %9, align 8, !tbaa !11
  %78 = add nsw i64 %77, 1
  store i64 %78, ptr %9, align 8, !tbaa !11
  br label %54, !llvm.loop !13

79:                                               ; preds = %54
  %80 = load double, ptr %10, align 8, !tbaa !9
  %81 = load double, ptr %12, align 8, !tbaa !9
  %82 = fsub double %80, %81
  %83 = fmul double %82, 5.000000e-01
  store double %83, ptr %8, align 8, !tbaa !9
  %84 = load double, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret double %84
}

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

declare double @d1mach_(ptr noundef) #2

declare i32 @xermsg_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef) #2

; 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) #1

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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"

@c__4 = external hidden global i64, align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@c__2 = external hidden global i64, align 8
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@c__3 = external hidden global i64, align 8
@.str.4 = external hidden unnamed_addr constant [31 x i8], align 1
@c__1 = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @dcsevl_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 -8
  %5 = tail call double @d1mach_(ptr noundef nonnull @c__4) #3
  %6 = fadd double %5, 1.000000e+00
  %7 = load i64, ptr %2, align 8, !tbaa !5
  %8 = icmp slt i64 %7, 1
  br i1 %8, label %9, label %11

9:                                                ; preds = %3
  %10 = tail call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, ptr noundef nonnull @c__2, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 22) #3
  %.pr = load i64, ptr %2, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %9, %3
  %12 = phi i64 [ %.pr, %9 ], [ %7, %3 ]
  %13 = icmp sgt i64 %12, 1000
  br i1 %13, label %14, label %16

14:                                               ; preds = %11
  %15 = tail call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.3, ptr noundef nonnull @c__3, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 25) #3
  br label %16

16:                                               ; preds = %14, %11
  %17 = load double, ptr %0, align 8, !tbaa !9
  %18 = fcmp ult double %17, 0.000000e+00
  %19 = fneg double %17
  %20 = select i1 %18, double %19, double %17
  %21 = fcmp ogt double %20, %6
  br i1 %21, label %22, label %24

22:                                               ; preds = %16
  %23 = tail call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.4, ptr noundef nonnull @c__1, ptr noundef nonnull @c__1, i64 noundef 6, i64 noundef 6, i64 noundef 30) #3
  %.pre = load double, ptr %0, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %22, %16
  %25 = phi double [ %.pre, %22 ], [ %17, %16 ]
  %26 = fmul double %25, 2.000000e+00
  %27 = load i64, ptr %2, align 8, !tbaa !5
  %.not27 = icmp slt i64 %27, 1
  br i1 %.not27, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %24
  %28 = add nuw nsw i64 %27, 1
  %xtraiter = and i64 %27, 1
  %29 = icmp eq i64 %27, 1
  br i1 %29, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %27, 9223372036854775806
  br label %30

30:                                               ; preds = %30, %.lr.ph.new
  %.030 = phi i64 [ 1, %.lr.ph.new ], [ %43, %30 ]
  %.02329 = phi double [ 0.000000e+00, %.lr.ph.new ], [ %42, %30 ]
  %.02528 = phi double [ 0.000000e+00, %.lr.ph.new ], [ %36, %30 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %30 ]
  %31 = sub nsw i64 %28, %.030
  %32 = fneg double %.02528
  %33 = tail call double @llvm.fmuladd.f64(double %26, double %.02329, double %32)
  %34 = getelementptr inbounds double, ptr %4, i64 %31
  %35 = load double, ptr %34, align 8, !tbaa !9
  %36 = fadd double %33, %35
  %37 = sub i64 %27, %.030
  %38 = fneg double %.02329
  %39 = tail call double @llvm.fmuladd.f64(double %26, double %36, double %38)
  %40 = getelementptr inbounds double, ptr %4, i64 %37
  %41 = load double, ptr %40, align 8, !tbaa !9
  %42 = fadd double %39, %41
  %43 = add nuw i64 %.030, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %30, !llvm.loop !11

._crit_edge.loopexit.unr-lcssa:                   ; preds = %30, %.lr.ph
  %.02528.lcssa.ph = phi double [ poison, %.lr.ph ], [ %.02329, %30 ]
  %.lcssa.ph = phi double [ poison, %.lr.ph ], [ %42, %30 ]
  %.030.unr = phi i64 [ 1, %.lr.ph ], [ %43, %30 ]
  %.02329.unr = phi double [ 0.000000e+00, %.lr.ph ], [ %42, %30 ]
  %.02528.unr = phi double [ 0.000000e+00, %.lr.ph ], [ %36, %30 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %44 = sub nsw i64 %28, %.030.unr
  %45 = fneg double %.02528.unr
  %46 = tail call double @llvm.fmuladd.f64(double %26, double %.02329.unr, double %45)
  %47 = getelementptr inbounds double, ptr %4, i64 %44
  %48 = load double, ptr %47, align 8, !tbaa !9
  %49 = fadd double %46, %48
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %._crit_edge.loopexit.unr-lcssa, %._crit_edge.loopexit.epilog-lcssa
  %.02528.lcssa = phi double [ %.02528.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.02528.unr, %._crit_edge.loopexit.epilog-lcssa ]
  %.lcssa = phi double [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %49, %._crit_edge.loopexit.epilog-lcssa ]
  %50 = fsub double %.lcssa, %.02528.lcssa
  %51 = fmul double %50, 5.000000e-01
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %24
  %52 = phi double [ 0.000000e+00, %24 ], [ %51, %._crit_edge.loopexit ]
  ret double %52
}

declare double @d1mach_(ptr noundef) local_unnamed_addr #1

declare i32 @xermsg_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #1

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

attributes #0 = { 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 #1 = { "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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass