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

@determ_.l = external hidden global i64, align 8
@determ_.d1 = external hidden global double, align 8
@determ_.d2 = external hidden global double, align 8
@determ_.d3 = external hidden global double, align 8
@determ_.icnt = external hidden global i64, align 8

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

; Function Attrs: nounwind uwtable
define dso_local double @determ_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca double, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %8 = load ptr, ptr %6, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = shl i64 %10, 1
  %12 = sub nsw i64 %11, 2
  %13 = getelementptr inbounds double, ptr %8, i64 %12
  %14 = load double, ptr %13, align 8, !tbaa !11
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = load double, ptr %15, align 8, !tbaa !11
  %17 = fsub double %14, %16
  store double %17, ptr @determ_.d2, align 8, !tbaa !11
  %18 = load double, ptr @determ_.d2, align 8, !tbaa !11
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load i64, ptr %20, align 8, !tbaa !9
  %22 = shl i64 %21, 1
  %23 = sub nsw i64 %22, 4
  %24 = getelementptr inbounds double, ptr %19, i64 %23
  %25 = load double, ptr %24, align 8, !tbaa !11
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load double, ptr %26, align 8, !tbaa !11
  %28 = fsub double %25, %27
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = shl i64 %31, 1
  %33 = sub nsw i64 %32, 1
  %34 = getelementptr inbounds double, ptr %29, i64 %33
  %35 = load double, ptr %34, align 8, !tbaa !11
  %36 = fneg double %35
  %37 = call double @llvm.fmuladd.f64(double %18, double %28, double %36)
  store double %37, ptr @determ_.d1, align 8, !tbaa !11
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = icmp eq i64 %39, 2
  br i1 %40, label %41, label %43

41:                                               ; preds = %3
  %42 = load double, ptr @determ_.d1, align 8, !tbaa !11
  store double %42, ptr %4, align 8
  br label %83

43:                                               ; preds = %3
  store i64 2, ptr @determ_.icnt, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %78, %43
  %45 = load i64, ptr @determ_.icnt, align 8, !tbaa !9
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = icmp slt i64 %45, %47
  br i1 %48, label %49, label %81

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = load i64, ptr @determ_.icnt, align 8, !tbaa !9
  %53 = sub nsw i64 %51, %52
  %54 = add nsw i64 %53, 1
  store i64 %54, ptr @determ_.l, align 8, !tbaa !9
  %55 = load double, ptr @determ_.d2, align 8, !tbaa !11
  store double %55, ptr @determ_.d3, align 8, !tbaa !11
  %56 = load double, ptr @determ_.d1, align 8, !tbaa !11
  store double %56, ptr @determ_.d2, align 8, !tbaa !11
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load i64, ptr @determ_.l, align 8, !tbaa !9
  %59 = sub nsw i64 %58, 1
  %60 = shl i64 %59, 1
  %61 = sub nsw i64 %60, 2
  %62 = getelementptr inbounds double, ptr %57, i64 %61
  %63 = load double, ptr %62, align 8, !tbaa !11
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = fsub double %63, %65
  %67 = load double, ptr @determ_.d2, align 8, !tbaa !11
  %68 = load double, ptr @determ_.d3, align 8, !tbaa !11
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load i64, ptr @determ_.l, align 8, !tbaa !9
  %71 = shl i64 %70, 1
  %72 = sub nsw i64 %71, 1
  %73 = getelementptr inbounds double, ptr %69, i64 %72
  %74 = load double, ptr %73, align 8, !tbaa !11
  %75 = fmul double %68, %74
  %76 = fneg double %75
  %77 = call double @llvm.fmuladd.f64(double %66, double %67, double %76)
  store double %77, ptr @determ_.d1, align 8, !tbaa !11
  br label %78

78:                                               ; preds = %49
  %79 = load i64, ptr @determ_.icnt, align 8, !tbaa !9
  %80 = add nsw i64 %79, 1
  store i64 %80, ptr @determ_.icnt, align 8, !tbaa !9
  br label %44, !llvm.loop !13

81:                                               ; preds = %44
  %82 = load double, ptr @determ_.d1, align 8, !tbaa !11
  store double %82, ptr %4, align 8
  br label %83

83:                                               ; preds = %81, %41
  %84 = load double, ptr %4, align 8
  ret double %84
}

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

@determ_.l = external hidden local_unnamed_addr global i64, align 8
@determ_.d1 = external hidden local_unnamed_addr global double, align 8
@determ_.d2 = external hidden local_unnamed_addr global double, align 8
@determ_.d3 = external hidden local_unnamed_addr global double, align 8
@determ_.icnt = external hidden local_unnamed_addr global i64, align 8

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

; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: read, inaccessiblemem: none) uwtable
define dso_local double @determ_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %.idx = shl i64 %4, 4
  %5 = getelementptr i8, ptr %1, i64 %.idx
  %6 = getelementptr i8, ptr %5, i64 -16
  %7 = load double, ptr %6, align 8, !tbaa !9
  %8 = load double, ptr %2, align 8, !tbaa !9
  %9 = fsub double %7, %8
  store double %9, ptr @determ_.d2, align 8, !tbaa !9
  %10 = getelementptr i8, ptr %5, i64 -32
  %11 = load double, ptr %10, align 8, !tbaa !9
  %12 = load double, ptr %2, align 8, !tbaa !9
  %13 = fsub double %11, %12
  %14 = getelementptr i8, ptr %5, i64 -8
  %15 = load double, ptr %14, align 8, !tbaa !9
  %16 = fneg double %15
  %17 = tail call double @llvm.fmuladd.f64(double %9, double %13, double %16)
  store double %17, ptr @determ_.d1, align 8, !tbaa !9
  %18 = icmp eq i64 %4, 2
  br i1 %18, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %3
  %invariant.gep = getelementptr i8, ptr %1, i64 -16
  %invariant.gep20 = getelementptr i8, ptr %1, i64 -8
  store i64 2, ptr @determ_.icnt, align 8, !tbaa !5
  %19 = load i64, ptr %0, align 8, !tbaa !5
  %20 = icmp sgt i64 %19, 2
  br i1 %20, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %21 = phi double [ %32, %.lr.ph ], [ %17, %.preheader ]
  %22 = phi double [ %21, %.lr.ph ], [ %9, %.preheader ]
  %23 = phi i64 [ %34, %.lr.ph ], [ %19, %.preheader ]
  %storemerge22 = phi i64 [ %33, %.lr.ph ], [ 2, %.preheader ]
  %24 = sub nsw i64 %23, %storemerge22
  %25 = add nsw i64 %24, 1
  store i64 %25, ptr @determ_.l, align 8, !tbaa !5
  store double %22, ptr @determ_.d3, align 8, !tbaa !9
  store double %21, ptr @determ_.d2, align 8, !tbaa !9
  %.idx17 = shl i64 %24, 4
  %gep = getelementptr i8, ptr %invariant.gep, i64 %.idx17
  %26 = load double, ptr %gep, align 8, !tbaa !9
  %27 = load double, ptr %2, align 8, !tbaa !9
  %28 = fsub double %26, %27
  %.idx18 = shl i64 %25, 4
  %gep21 = getelementptr i8, ptr %invariant.gep20, i64 %.idx18
  %29 = load double, ptr %gep21, align 8, !tbaa !9
  %30 = fneg double %22
  %31 = fmul double %29, %30
  %32 = tail call double @llvm.fmuladd.f64(double %28, double %21, double %31)
  store double %32, ptr @determ_.d1, align 8, !tbaa !9
  %33 = add nuw nsw i64 %storemerge22, 1
  store i64 %33, ptr @determ_.icnt, align 8, !tbaa !5
  %34 = load i64, ptr %0, align 8, !tbaa !5
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %.preheader, %3
  %.0 = phi double [ %17, %3 ], [ %17, %.preheader ], [ %32, %.lr.ph ]
  ret double %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree norecurse nosync nounwind memory(write, argmem: read, inaccessiblemem: none) 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 = !{!"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,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass