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

; 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
@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 [28 x i8], align 1
@c__2 = external hidden global i64, align 8
@.str.3 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1
@c__1 = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @d9lgit_(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 i64, align 8
  %9 = alloca double, 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
  %17 = alloca double, align 8
  %18 = 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
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %19 = call double @d1mach_(ptr noundef @c__3)
  %20 = fmul double %19, 5.000000e-01
  store double %20, ptr %16, align 8, !tbaa !9
  %21 = call double @d1mach_(ptr noundef @c__4)
  %22 = call double @sqrt(double noundef %21) #5
  store double %22, ptr %18, align 8, !tbaa !9
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = fcmp ole double %24, 0.000000e+00
  br i1 %25, label %32, label %26

26:                                               ; preds = %3
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load double, ptr %29, align 8, !tbaa !9
  %31 = fcmp olt double %28, %30
  br i1 %31, label %32, label %34

32:                                               ; preds = %26, %3
  %33 = 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 27)
  br label %34

34:                                               ; preds = %32, %26
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = fadd double %36, %38
  store double %39, ptr %14, align 8, !tbaa !9
  %40 = load double, ptr %14, align 8, !tbaa !9
  %41 = fadd double %40, 1.000000e+00
  store double %41, ptr %15, align 8, !tbaa !9
  store double 0.000000e+00, ptr %10, align 8, !tbaa !9
  store double 1.000000e+00, ptr %9, align 8, !tbaa !9
  %42 = load double, ptr %9, align 8, !tbaa !9
  store double %42, ptr %11, align 8, !tbaa !9
  store i64 1, ptr %8, align 8, !tbaa !11
  br label %43

43:                                               ; preds = %91, %34
  %44 = load i64, ptr %8, align 8, !tbaa !11
  %45 = icmp sle i64 %44, 200
  br i1 %45, label %46, label %94

46:                                               ; preds = %43
  %47 = load i64, ptr %8, align 8, !tbaa !11
  %48 = sitofp i64 %47 to double
  store double %48, ptr %13, align 8, !tbaa !9
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load double, ptr %49, align 8, !tbaa !9
  %51 = load double, ptr %13, align 8, !tbaa !9
  %52 = fadd double %50, %51
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load double, ptr %53, align 8, !tbaa !9
  %55 = fmul double %52, %54
  %56 = load double, ptr %10, align 8, !tbaa !9
  %57 = fadd double %56, 1.000000e+00
  %58 = fmul double %55, %57
  store double %58, ptr %12, align 8, !tbaa !9
  %59 = load double, ptr %12, align 8, !tbaa !9
  %60 = load double, ptr %14, align 8, !tbaa !9
  %61 = load double, ptr %13, align 8, !tbaa !9
  %62 = fadd double %60, %61
  %63 = load double, ptr %15, align 8, !tbaa !9
  %64 = load double, ptr %13, align 8, !tbaa !9
  %65 = fadd double %63, %64
  %66 = load double, ptr %12, align 8, !tbaa !9
  %67 = fneg double %66
  %68 = call double @llvm.fmuladd.f64(double %62, double %65, double %67)
  %69 = fdiv double %59, %68
  store double %69, ptr %10, align 8, !tbaa !9
  %70 = load double, ptr %10, align 8, !tbaa !9
  %71 = load double, ptr %9, align 8, !tbaa !9
  %72 = fmul double %70, %71
  store double %72, ptr %9, align 8, !tbaa !9
  %73 = load double, ptr %9, align 8, !tbaa !9
  %74 = load double, ptr %11, align 8, !tbaa !9
  %75 = fadd double %74, %73
  store double %75, ptr %11, align 8, !tbaa !9
  %76 = load double, ptr %9, align 8, !tbaa !9
  %77 = fcmp oge double %76, 0.000000e+00
  br i1 %77, label %78, label %80

78:                                               ; preds = %46
  %79 = load double, ptr %9, align 8, !tbaa !9
  br label %83

80:                                               ; preds = %46
  %81 = load double, ptr %9, align 8, !tbaa !9
  %82 = fneg double %81
  br label %83

83:                                               ; preds = %80, %78
  %84 = phi double [ %79, %78 ], [ %82, %80 ]
  %85 = load double, ptr %16, align 8, !tbaa !9
  %86 = load double, ptr %11, align 8, !tbaa !9
  %87 = fmul double %85, %86
  %88 = fcmp olt double %84, %87
  br i1 %88, label %89, label %90

89:                                               ; preds = %83
  br label %96

90:                                               ; preds = %83
  br label %91

91:                                               ; preds = %90
  %92 = load i64, ptr %8, align 8, !tbaa !11
  %93 = add nsw i64 %92, 1
  store i64 %93, ptr %8, align 8, !tbaa !11
  br label %43, !llvm.loop !13

94:                                               ; preds = %43
  %95 = 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 49)
  br label %96

96:                                               ; preds = %94, %89
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = load double, ptr %97, align 8, !tbaa !9
  %99 = load double, ptr %11, align 8, !tbaa !9
  %100 = fmul double %98, %99
  %101 = load double, ptr %15, align 8, !tbaa !9
  %102 = fdiv double %100, %101
  %103 = fsub double 1.000000e+00, %102
  store double %103, ptr %17, align 8, !tbaa !9
  %104 = load double, ptr %17, align 8, !tbaa !9
  %105 = load double, ptr %18, align 8, !tbaa !9
  %106 = fcmp olt double %104, %105
  br i1 %106, label %107, label %109

107:                                              ; preds = %96
  %108 = 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 31)
  br label %109

109:                                              ; preds = %107, %96
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = load double, ptr %110, align 8, !tbaa !9
  %112 = fneg double %111
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = load double, ptr %113, align 8, !tbaa !9
  %115 = fsub double %112, %114
  %116 = load double, ptr %17, align 8, !tbaa !9
  %117 = call double @log(double noundef %116) #5
  %118 = fsub double %115, %117
  store double %118, ptr %7, align 8, !tbaa !9
  %119 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  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 %119
}

; 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: nounwind
declare double @sqrt(double noundef) #3

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) #4

; Function Attrs: nounwind
declare double @log(double noundef) #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 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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
@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 [28 x i8], align 1
@c__2 = external hidden global i64, align 8
@.str.3 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1
@c__1 = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local double @d9lgit_(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 = tail call double @d1mach_(ptr noundef nonnull @c__4) #4
  %7 = tail call double @sqrt(double noundef %6) #4
  %8 = load double, ptr %1, align 8, !tbaa !5
  %9 = fcmp ugt double %8, 0.000000e+00
  br i1 %9, label %10, label %13

10:                                               ; preds = %3
  %11 = load double, ptr %0, align 8, !tbaa !5
  %12 = fcmp olt double %11, %8
  br i1 %12, label %13, label %15

13:                                               ; preds = %10, %3
  %14 = 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 27) #4
  %.pre = load double, ptr %0, align 8, !tbaa !5
  %.pre47 = load double, ptr %1, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %13, %10
  %16 = phi double [ %.pre47, %13 ], [ %8, %10 ]
  %17 = phi double [ %.pre, %13 ], [ %11, %10 ]
  %18 = fadd double %17, %16
  %19 = fadd double %18, 1.000000e+00
  br label %22

20:                                               ; preds = %22
  %21 = add nuw nsw i64 %.045, 1
  %exitcond.not = icmp eq i64 %21, 201
  br i1 %exitcond.not, label %40, label %22, !llvm.loop !9

22:                                               ; preds = %15, %20
  %.045 = phi i64 [ 1, %15 ], [ %21, %20 ]
  %.03744 = phi double [ 1.000000e+00, %15 ], [ %33, %20 ]
  %.03843 = phi double [ 0.000000e+00, %15 ], [ %32, %20 ]
  %.03942 = phi double [ 1.000000e+00, %15 ], [ %34, %20 ]
  %23 = uitofp nneg i64 %.045 to double
  %24 = fadd double %17, %23
  %25 = fmul double %16, %24
  %26 = fadd double %.03843, 1.000000e+00
  %27 = fmul double %26, %25
  %28 = fadd double %18, %23
  %29 = fadd double %19, %23
  %30 = fneg double %27
  %31 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %30)
  %32 = fdiv double %27, %31
  %33 = fmul double %.03744, %32
  %34 = fadd double %.03942, %33
  %35 = fcmp oge double %33, 0.000000e+00
  %36 = fneg double %33
  %37 = select i1 %35, double %33, double %36
  %38 = fmul double %5, %34
  %39 = fcmp olt double %37, %38
  br i1 %39, label %.loopexit, label %20

40:                                               ; preds = %20
  %41 = 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 49) #4
  %.pre48 = load double, ptr %1, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %22, %40
  %42 = phi double [ %.pre48, %40 ], [ %16, %22 ]
  %43 = fmul double %34, %42
  %44 = fdiv double %43, %19
  %45 = fsub double 1.000000e+00, %44
  %46 = fcmp olt double %45, %7
  br i1 %46, label %47, label %49

47:                                               ; preds = %.loopexit
  %48 = 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 31) #4
  %.pre49 = load double, ptr %1, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %47, %.loopexit
  %50 = phi double [ %.pre49, %47 ], [ %42, %.loopexit ]
  %51 = fneg double %50
  %52 = load double, ptr %2, align 8, !tbaa !5
  %53 = fsub double %51, %52
  %54 = tail call double @log(double noundef %45) #4
  %55 = fsub double %53, %54
  ret double %55
}

declare double @d1mach_(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #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 nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #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 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 #3 = { mustprogress 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/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