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

; 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__3 = 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 [50 x i8], align 1
@c__1 = external hidden global i64, align 8
@c__2 = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @d9lgic_(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 double, 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 double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = 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) #5
  store double 0.000000e+00, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %17 = call double @d1mach_(ptr noundef @c__3)
  %18 = fmul double 5.000000e-01, %17
  store double %18, ptr %7, align 8, !tbaa !9
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load double, ptr %19, align 8, !tbaa !9
  %21 = fadd double %20, 1.000000e+00
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fsub double %21, %23
  store double %24, ptr %16, align 8, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = fsub double %26, 1.000000e+00
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = fsub double %27, %29
  store double %30, ptr %15, align 8, !tbaa !9
  store double 0.000000e+00, ptr %11, align 8, !tbaa !9
  store double 1.000000e+00, ptr %10, align 8, !tbaa !9
  %31 = load double, ptr %10, align 8, !tbaa !9
  store double %31, ptr %12, align 8, !tbaa !9
  store i64 1, ptr %9, align 8, !tbaa !11
  br label %32

32:                                               ; preds = %79, %3
  %33 = load i64, ptr %9, align 8, !tbaa !11
  %34 = icmp sle i64 %33, 300
  br i1 %34, label %35, label %82

35:                                               ; preds = %32
  %36 = load i64, ptr %9, align 8, !tbaa !11
  %37 = sitofp i64 %36 to double
  store double %37, ptr %14, align 8, !tbaa !9
  %38 = load double, ptr %14, align 8, !tbaa !9
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = load double, ptr %14, align 8, !tbaa !9
  %42 = fsub double %40, %41
  %43 = fmul double %38, %42
  %44 = load double, ptr %11, align 8, !tbaa !9
  %45 = fadd double %44, 1.000000e+00
  %46 = fmul double %43, %45
  store double %46, ptr %13, align 8, !tbaa !9
  %47 = load double, ptr %13, align 8, !tbaa !9
  %48 = fneg double %47
  %49 = load double, ptr %15, align 8, !tbaa !9
  %50 = load double, ptr %14, align 8, !tbaa !9
  %51 = call double @llvm.fmuladd.f64(double %50, double 2.000000e+00, double %49)
  %52 = load double, ptr %16, align 8, !tbaa !9
  %53 = load double, ptr %14, align 8, !tbaa !9
  %54 = call double @llvm.fmuladd.f64(double %53, double 2.000000e+00, double %52)
  %55 = load double, ptr %13, align 8, !tbaa !9
  %56 = call double @llvm.fmuladd.f64(double %51, double %54, double %55)
  %57 = fdiv double %48, %56
  store double %57, ptr %11, align 8, !tbaa !9
  %58 = load double, ptr %11, align 8, !tbaa !9
  %59 = load double, ptr %10, align 8, !tbaa !9
  %60 = fmul double %58, %59
  store double %60, ptr %10, align 8, !tbaa !9
  %61 = load double, ptr %10, align 8, !tbaa !9
  %62 = load double, ptr %12, align 8, !tbaa !9
  %63 = fadd double %62, %61
  store double %63, ptr %12, align 8, !tbaa !9
  %64 = load double, ptr %10, align 8, !tbaa !9
  %65 = fcmp oge double %64, 0.000000e+00
  br i1 %65, label %66, label %68

66:                                               ; preds = %35
  %67 = load double, ptr %10, align 8, !tbaa !9
  br label %71

68:                                               ; preds = %35
  %69 = load double, ptr %10, align 8, !tbaa !9
  %70 = fneg double %69
  br label %71

71:                                               ; preds = %68, %66
  %72 = phi double [ %67, %66 ], [ %70, %68 ]
  %73 = load double, ptr %7, align 8, !tbaa !9
  %74 = load double, ptr %12, align 8, !tbaa !9
  %75 = fmul double %73, %74
  %76 = fcmp olt double %72, %75
  br i1 %76, label %77, label %78

77:                                               ; preds = %71
  br label %84

78:                                               ; preds = %71
  br label %79

79:                                               ; preds = %78
  %80 = load i64, ptr %9, align 8, !tbaa !11
  %81 = add nsw i64 %80, 1
  store i64 %81, ptr %9, align 8, !tbaa !11
  br label %32, !llvm.loop !13

82:                                               ; preds = %32
  %83 = call i32 @xermsg_(ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, ptr noundef @c__1, ptr noundef @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 49)
  br label %84

84:                                               ; preds = %82, %77
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = load double, ptr %85, align 8, !tbaa !9
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load double, ptr %87, align 8, !tbaa !9
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load double, ptr %89, align 8, !tbaa !9
  %91 = fneg double %90
  %92 = call double @llvm.fmuladd.f64(double %86, double %88, double %91)
  %93 = load double, ptr %12, align 8, !tbaa !9
  %94 = load double, ptr %16, align 8, !tbaa !9
  %95 = fdiv double %93, %94
  %96 = call double @log(double noundef %95) #5
  %97 = fadd double %92, %96
  store double %97, ptr %8, align 8, !tbaa !9
  %98 = load double, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret double %98
}

; 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

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

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

; Function Attrs: nounwind
declare double @log(double noundef) #4

; 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 "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 #5 = { 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__3 = 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 [50 x i8], align 1
@c__1 = external hidden global i64, align 8
@c__2 = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @d9lgic_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = tail call double @d1mach_(ptr noundef nonnull @c__3) #4
  %5 = fmul double %4, 5.000000e-01
  %6 = load double, ptr %1, align 8, !tbaa !5
  %7 = fadd double %6, 1.000000e+00
  %8 = load double, ptr %0, align 8, !tbaa !5
  %9 = fsub double %7, %8
  %10 = fadd double %6, -1.000000e+00
  %11 = fsub double %10, %8
  br label %14

12:                                               ; preds = %14
  %13 = add nuw nsw i64 %.039, 1
  %exitcond.not = icmp eq i64 %13, 301
  br i1 %exitcond.not, label %32, label %14, !llvm.loop !9

14:                                               ; preds = %3, %12
  %.039 = phi i64 [ 1, %3 ], [ %13, %12 ]
  %.03238 = phi double [ 1.000000e+00, %3 ], [ %25, %12 ]
  %.03337 = phi double [ 0.000000e+00, %3 ], [ %24, %12 ]
  %.03436 = phi double [ 1.000000e+00, %3 ], [ %26, %12 ]
  %15 = uitofp nneg i64 %.039 to double
  %16 = fsub double %8, %15
  %17 = fmul double %16, %15
  %18 = fadd double %.03337, 1.000000e+00
  %19 = fmul double %18, %17
  %20 = fneg double %19
  %21 = tail call double @llvm.fmuladd.f64(double %15, double 2.000000e+00, double %11)
  %22 = tail call double @llvm.fmuladd.f64(double %15, double 2.000000e+00, double %9)
  %23 = tail call double @llvm.fmuladd.f64(double %21, double %22, double %19)
  %24 = fdiv double %20, %23
  %25 = fmul double %.03238, %24
  %26 = fadd double %.03436, %25
  %27 = fcmp oge double %25, 0.000000e+00
  %28 = fneg double %25
  %29 = select i1 %27, double %25, double %28
  %30 = fmul double %5, %26
  %31 = fcmp olt double %29, %30
  br i1 %31, label %.loopexit, label %12

32:                                               ; preds = %12
  %33 = tail call i32 @xermsg_(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, ptr noundef nonnull @c__1, ptr noundef nonnull @c__2, i64 noundef 6, i64 noundef 6, i64 noundef 49) #4
  %.pre = load double, ptr %0, align 8, !tbaa !5
  %.pre41 = load double, ptr %1, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %14, %32
  %34 = phi double [ %.pre41, %32 ], [ %6, %14 ]
  %35 = phi double [ %.pre, %32 ], [ %8, %14 ]
  %36 = load double, ptr %2, align 8, !tbaa !5
  %37 = fneg double %34
  %38 = tail call double @llvm.fmuladd.f64(double %35, double %36, double %37)
  %39 = fdiv double %26, %9
  %40 = tail call double @log(double noundef %39) #4
  %41 = fadd double %38, %40
  ret double %41
}

declare double @d1mach_(ptr 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

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 nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #3

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 = { mustprogress nofree nounwind willreturn memory(write) "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 #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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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