; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/Numerics/FEM/src (dsrc2c)

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

%struct.anon = type { i64, i64, i64, i64, i64, i64 }
%struct.anon.0 = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%struct.anon.1 = type { i64, i64, i64, i64, i64 }

@itcom1_ = external hidden global %struct.anon, align 8
@c__1 = external hidden global i64, align 8
@itcom3_ = external hidden global %struct.anon.0, align 8
@itcom2_ = external hidden global %struct.anon.1, align 8
@pstop_.tl = external hidden global double, align 8
@pstop_.tr = external hidden global double, align 8
@pstop_.con = external hidden global double, align 8
@pstop_.uold = external hidden global double, align 8

; Function Attrs: nounwind uwtable
declare dso_local double @itpackddot_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @pstop_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %14 = load ptr, ptr %11, align 8, !tbaa !5
  %15 = load double, ptr %14, align 8, !tbaa !9
  store double %15, ptr @pstop_.con, align 8, !tbaa !9
  store i64 0, ptr getelementptr inbounds (%struct.anon.1, ptr @itcom2_, i32 0, i32 3), align 8, !tbaa !11
  %16 = load i64, ptr @itcom1_, align 8, !tbaa !14
  %17 = icmp slt i64 %16, 1
  br i1 %17, label %18, label %25

18:                                               ; preds = %6
  %19 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 0, ptr %19, align 8, !tbaa !16
  store double 1.000000e+00, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  store double 1.000000e+03, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 17), align 8, !tbaa !19
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  %21 = load i64, ptr %20, align 8, !tbaa !16
  %22 = icmp sle i64 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %18
  store i32 0, ptr %7, align 4
  br label %112

24:                                               ; preds = %18
  br label %25

25:                                               ; preds = %24, %6
  %26 = load ptr, ptr %13, align 8, !tbaa !5
  %27 = load i64, ptr %26, align 8, !tbaa !16
  %28 = icmp ne i64 %27, 0
  br i1 %28, label %71, label %29

29:                                               ; preds = %25
  %30 = load i64, ptr @itcom1_, align 8, !tbaa !14
  %31 = icmp sle i64 %30, 5
  br i1 %31, label %36, label %32

32:                                               ; preds = %29
  %33 = load i64, ptr @itcom1_, align 8, !tbaa !14
  %34 = srem i64 %33, 5
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %36, label %71

36:                                               ; preds = %32, %29
  %37 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  store double %37, ptr @pstop_.uold, align 8, !tbaa !9
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = call double @itpackddot_(ptr noundef %38, ptr noundef %39, ptr noundef @c__1, ptr noundef %40, ptr noundef @c__1)
  store double %41, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %42 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %43 = fcmp oeq double %42, 0.000000e+00
  br i1 %43, label %44, label %45

44:                                               ; preds = %36
  store double 1.000000e+00, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  br label %45

45:                                               ; preds = %44, %36
  %46 = load i64, ptr @itcom1_, align 8, !tbaa !14
  %47 = icmp sgt i64 %46, 5
  br i1 %47, label %48, label %70

48:                                               ; preds = %45
  %49 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %50 = load double, ptr @pstop_.uold, align 8, !tbaa !9
  %51 = fsub double %49, %50
  %52 = fcmp oge double %51, 0.000000e+00
  br i1 %52, label %53, label %57

53:                                               ; preds = %48
  %54 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %55 = load double, ptr @pstop_.uold, align 8, !tbaa !9
  %56 = fsub double %54, %55
  br label %62

57:                                               ; preds = %48
  %58 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %59 = load double, ptr @pstop_.uold, align 8, !tbaa !9
  %60 = fsub double %58, %59
  %61 = fneg double %60
  br label %62

62:                                               ; preds = %57, %53
  %63 = phi double [ %56, %53 ], [ %61, %57 ]
  %64 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %65 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 19), align 8, !tbaa !20
  %66 = fmul double %64, %65
  %67 = fcmp ole double %63, %66
  br i1 %67, label %68, label %70

68:                                               ; preds = %62
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  store i64 1, ptr %69, align 8, !tbaa !16
  br label %70

70:                                               ; preds = %68, %62, %45
  br label %71

71:                                               ; preds = %70, %32, %25
  %72 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 18), align 8, !tbaa !17
  %73 = call double @sqrt(double noundef %72) #3
  store double %73, ptr @pstop_.tr, align 8, !tbaa !9
  store double 1.000000e+00, ptr @pstop_.tl, align 8, !tbaa !9
  %74 = load double, ptr @pstop_.con, align 8, !tbaa !9
  %75 = fcmp oeq double %74, 1.000000e+00
  br i1 %75, label %76, label %77

76:                                               ; preds = %71
  br label %101

77:                                               ; preds = %71
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = load i64, ptr %78, align 8, !tbaa !16
  %80 = icmp ne i64 %79, 2
  br i1 %80, label %81, label %89

81:                                               ; preds = %77
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = call double @sqrt(double noundef %83) #3
  store double %84, ptr @pstop_.tl, align 8, !tbaa !9
  %85 = load double, ptr @pstop_.con, align 8, !tbaa !9
  %86 = fsub double 1.000000e+00, %85
  %87 = load double, ptr @pstop_.tr, align 8, !tbaa !9
  %88 = fmul double %87, %86
  store double %88, ptr @pstop_.tr, align 8, !tbaa !9
  br label %100

89:                                               ; preds = %77
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = load double, ptr %90, align 8, !tbaa !9
  %92 = fmul double %91, 2.000000e+00
  %93 = call double @sqrt(double noundef %92) #3
  store double %93, ptr @pstop_.tl, align 8, !tbaa !9
  %94 = load double, ptr @pstop_.con, align 8, !tbaa !9
  %95 = load double, ptr @pstop_.con, align 8, !tbaa !9
  %96 = fneg double %94
  %97 = call double @llvm.fmuladd.f64(double %96, double %95, double 1.000000e+00)
  %98 = load double, ptr @pstop_.tr, align 8, !tbaa !9
  %99 = fmul double %98, %97
  store double %99, ptr @pstop_.tr, align 8, !tbaa !9
  br label %100

100:                                              ; preds = %89, %81
  br label %101

101:                                              ; preds = %100, %76
  %102 = load double, ptr @pstop_.tl, align 8, !tbaa !9
  %103 = load double, ptr @pstop_.tr, align 8, !tbaa !9
  %104 = fdiv double %102, %103
  store double %104, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 17), align 8, !tbaa !19
  %105 = load double, ptr @pstop_.tl, align 8, !tbaa !9
  %106 = load double, ptr @pstop_.tr, align 8, !tbaa !9
  %107 = load double, ptr getelementptr inbounds (%struct.anon.0, ptr @itcom3_, i32 0, i32 19), align 8, !tbaa !20
  %108 = fmul double %106, %107
  %109 = fcmp oge double %105, %108
  br i1 %109, label %110, label %111

110:                                              ; preds = %101
  store i32 0, ptr %7, align 4
  br label %112

111:                                              ; preds = %101
  store i64 1, ptr getelementptr inbounds (%struct.anon.1, ptr @itcom2_, i32 0, i32 3), align 8, !tbaa !11
  store i32 0, ptr %7, align 4
  br label %112

112:                                              ; preds = %111, %110, %23
  %113 = load i32, ptr %7, align 4
  ret i32 %113
}

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

; Function Attrs: 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 = { 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 = { 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 = !{!"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, !13, i64 24}
!12 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !10, i64 144}
!18 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152}
!19 = !{!18, !10, i64 136}
!20 = !{!18, !10, i64 152}


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

%struct.anon = type { i64, i64, i64, i64, i64, i64 }
%struct.anon.0 = type { double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double }
%struct.anon.1 = type { i64, i64, i64, i64, i64 }

@itcom1_ = external hidden local_unnamed_addr global %struct.anon, align 8
@c__1 = external hidden global i64, align 8
@itcom3_ = external hidden local_unnamed_addr global %struct.anon.0, align 8
@itcom2_ = external hidden local_unnamed_addr global %struct.anon.1, align 8
@pstop_.tl = external hidden local_unnamed_addr global double, align 8
@pstop_.tr = external hidden local_unnamed_addr global double, align 8
@pstop_.con = external hidden local_unnamed_addr global double, align 8
@pstop_.uold = external hidden local_unnamed_addr global double, align 8

; Function Attrs: nounwind uwtable
declare dso_local double @itpackddot_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @pstop_(ptr noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4, ptr nocapture noundef %5) local_unnamed_addr #0 {
  %7 = load double, ptr %3, align 8, !tbaa !5
  store double %7, ptr @pstop_.con, align 8, !tbaa !5
  store i64 0, ptr getelementptr inbounds (i8, ptr @itcom2_, i64 24), align 8, !tbaa !9
  %8 = load i64, ptr @itcom1_, align 8, !tbaa !12
  %9 = icmp slt i64 %8, 1
  br i1 %9, label %10, label %13

10:                                               ; preds = %6
  store i64 0, ptr %5, align 8, !tbaa !14
  store <2 x double> <double 1.000000e+03, double 1.000000e+00>, ptr getelementptr inbounds (i8, ptr @itcom3_, i64 136), align 8, !tbaa !5
  %11 = load i64, ptr %4, align 8, !tbaa !14
  %12 = icmp slt i64 %11, 1
  br i1 %12, label %60, label %..thread_crit_edge

..thread_crit_edge:                               ; preds = %10
  %.pre = load i64, ptr @itcom1_, align 8, !tbaa !12
  br label %.thread

13:                                               ; preds = %6
  %.pr = load i64, ptr %5, align 8, !tbaa !14
  %.not = icmp eq i64 %.pr, 0
  %.pre16.pre = load double, ptr getelementptr inbounds (i8, ptr @itcom3_, i64 144), align 8, !tbaa !15
  br i1 %.not, label %.thread, label %._crit_edge

.thread:                                          ; preds = %..thread_crit_edge, %13
  %.pre16 = phi double [ 1.000000e+00, %..thread_crit_edge ], [ %.pre16.pre, %13 ]
  %14 = phi i64 [ %.pre, %..thread_crit_edge ], [ %8, %13 ]
  %15 = icmp slt i64 %14, 6
  %16 = urem i64 %14, 5
  %17 = icmp eq i64 %16, 0
  %or.cond = or i1 %15, %17
  br i1 %or.cond, label %18, label %._crit_edge

18:                                               ; preds = %.thread
  store double %.pre16, ptr @pstop_.uold, align 8, !tbaa !5
  %19 = tail call double @itpackddot_(ptr noundef %0, ptr noundef %1, ptr noundef nonnull @c__1, ptr noundef %1, ptr noundef nonnull @c__1)
  %20 = fcmp oeq double %19, 0.000000e+00
  %storemerge = select i1 %20, double 1.000000e+00, double %19
  store double %storemerge, ptr getelementptr inbounds (i8, ptr @itcom3_, i64 144), align 8, !tbaa !15
  %21 = load i64, ptr @itcom1_, align 8, !tbaa !12
  %22 = icmp sgt i64 %21, 5
  br i1 %22, label %23, label %._crit_edge

23:                                               ; preds = %18
  %24 = load double, ptr @pstop_.uold, align 8, !tbaa !5
  %25 = fsub double %storemerge, %24
  %26 = fcmp ult double %25, 0.000000e+00
  %27 = fneg double %25
  %28 = select i1 %26, double %27, double %25
  %29 = load double, ptr getelementptr inbounds (i8, ptr @itcom3_, i64 152), align 8, !tbaa !17
  %30 = fmul double %storemerge, %29
  %31 = fcmp ugt double %28, %30
  br i1 %31, label %._crit_edge, label %32

32:                                               ; preds = %23
  store i64 1, ptr %5, align 8, !tbaa !14
  br label %._crit_edge

._crit_edge:                                      ; preds = %13, %.thread, %18, %23, %32
  %33 = phi double [ %.pre16, %.thread ], [ %storemerge, %18 ], [ %storemerge, %23 ], [ %storemerge, %32 ], [ %.pre16.pre, %13 ]
  %34 = tail call double @sqrt(double noundef %33) #3
  store double %34, ptr @pstop_.tr, align 8, !tbaa !5
  store double 1.000000e+00, ptr @pstop_.tl, align 8, !tbaa !5
  %35 = load double, ptr @pstop_.con, align 8, !tbaa !5
  %36 = fcmp oeq double %35, 1.000000e+00
  br i1 %36, label %52, label %37

37:                                               ; preds = %._crit_edge
  %38 = load i64, ptr %4, align 8, !tbaa !14
  %.not12 = icmp eq i64 %38, 2
  %39 = load double, ptr %2, align 8, !tbaa !5
  br i1 %.not12, label %44, label %40

40:                                               ; preds = %37
  %41 = tail call double @sqrt(double noundef %39) #3
  store double %41, ptr @pstop_.tl, align 8, !tbaa !5
  %42 = load double, ptr @pstop_.con, align 8, !tbaa !5
  %43 = fsub double 1.000000e+00, %42
  br label %.sink.split

44:                                               ; preds = %37
  %45 = fmul double %39, 2.000000e+00
  %46 = tail call double @sqrt(double noundef %45) #3
  store double %46, ptr @pstop_.tl, align 8, !tbaa !5
  %47 = load double, ptr @pstop_.con, align 8, !tbaa !5
  %48 = fneg double %47
  %49 = tail call double @llvm.fmuladd.f64(double %48, double %47, double 1.000000e+00)
  br label %.sink.split

.sink.split:                                      ; preds = %44, %40
  %.sink20 = phi double [ %43, %40 ], [ %49, %44 ]
  %.ph18 = phi double [ %41, %40 ], [ %46, %44 ]
  %50 = load double, ptr @pstop_.tr, align 8, !tbaa !5
  %51 = fmul double %50, %.sink20
  store double %51, ptr @pstop_.tr, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %.sink.split, %._crit_edge
  %53 = phi double [ %34, %._crit_edge ], [ %51, %.sink.split ]
  %54 = phi double [ 1.000000e+00, %._crit_edge ], [ %.ph18, %.sink.split ]
  %55 = fdiv double %54, %53
  store double %55, ptr getelementptr inbounds (i8, ptr @itcom3_, i64 136), align 8, !tbaa !18
  %56 = load double, ptr getelementptr inbounds (i8, ptr @itcom3_, i64 152), align 8, !tbaa !17
  %57 = fmul double %53, %56
  %58 = fcmp ult double %54, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %52
  store i64 1, ptr getelementptr inbounds (i8, ptr @itcom2_, i64 24), align 8, !tbaa !9
  br label %60

60:                                               ; preds = %52, %10, %59
  ret i32 0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double 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 = { 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 #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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 24}
!10 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !6, i64 144}
!16 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}
!17 = !{!16, !6, i64 152}
!18 = !{!16, !6, i64 136}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass