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

@itcom1_ = external hidden global %struct.anon, align 8
@pvtbv_.ii = external hidden global i64, align 8
@pvtbv_.jj = external hidden global i64, align 8
@pvtbv_.sum = external hidden global double, align 8
@pvtbv_.jajj = external hidden global i64, align 8
@pvtbv_.ibgn = external hidden global i64, align 8
@pvtbv_.iend = external hidden global i64, align 8
@pvtbv_.sumr = external hidden global double, align 8

; Function Attrs: nounwind uwtable
define dso_local double @pvtbv_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  store double 0.000000e+00, ptr @pvtbv_.sum, align 8, !tbaa !9
  store i64 0, ptr @pvtbv_.ii, align 8, !tbaa !11
  br label %11

11:                                               ; preds = %66, %5
  %12 = load i64, ptr @pvtbv_.ii, align 8, !tbaa !11
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = load i64, ptr %13, align 8, !tbaa !11
  %15 = icmp slt i64 %12, %14
  br i1 %15, label %16, label %69

16:                                               ; preds = %11
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = load i64, ptr @pvtbv_.ii, align 8, !tbaa !11
  %19 = getelementptr inbounds i64, ptr %17, i64 %18
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = sub nsw i64 %20, 1
  store i64 %21, ptr @pvtbv_.ibgn, align 8, !tbaa !11
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = load i64, ptr @pvtbv_.ii, align 8, !tbaa !11
  %24 = add nsw i64 %23, 1
  %25 = getelementptr inbounds i64, ptr %22, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !11
  %27 = sub nsw i64 %26, 1
  store i64 %27, ptr @pvtbv_.iend, align 8, !tbaa !11
  %28 = load i64, ptr @pvtbv_.ibgn, align 8, !tbaa !11
  %29 = load i64, ptr @pvtbv_.iend, align 8, !tbaa !11
  %30 = icmp sge i64 %28, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %16
  br label %66

32:                                               ; preds = %16
  store double 0.000000e+00, ptr @pvtbv_.sumr, align 8, !tbaa !9
  %33 = load i64, ptr @pvtbv_.ibgn, align 8, !tbaa !11
  store i64 %33, ptr @pvtbv_.jj, align 8, !tbaa !11
  br label %34

34:                                               ; preds = %55, %32
  %35 = load i64, ptr @pvtbv_.jj, align 8, !tbaa !11
  %36 = load i64, ptr @pvtbv_.iend, align 8, !tbaa !11
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %38, label %58

38:                                               ; preds = %34
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = load i64, ptr @pvtbv_.jj, align 8, !tbaa !11
  %41 = getelementptr inbounds i64, ptr %39, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !11
  %43 = sub nsw i64 %42, 1
  store i64 %43, ptr @pvtbv_.jajj, align 8, !tbaa !11
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = load i64, ptr @pvtbv_.jj, align 8, !tbaa !11
  %46 = getelementptr inbounds double, ptr %44, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load i64, ptr @pvtbv_.jajj, align 8, !tbaa !11
  %50 = getelementptr inbounds double, ptr %48, i64 %49
  %51 = load double, ptr %50, align 8, !tbaa !9
  %52 = load double, ptr @pvtbv_.sumr, align 8, !tbaa !9
  %53 = fneg double %47
  %54 = call double @llvm.fmuladd.f64(double %53, double %51, double %52)
  store double %54, ptr @pvtbv_.sumr, align 8, !tbaa !9
  br label %55

55:                                               ; preds = %38
  %56 = load i64, ptr @pvtbv_.jj, align 8, !tbaa !11
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr @pvtbv_.jj, align 8, !tbaa !11
  br label %34, !llvm.loop !13

58:                                               ; preds = %34
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = load i64, ptr @pvtbv_.ii, align 8, !tbaa !11
  %61 = getelementptr inbounds double, ptr %59, i64 %60
  %62 = load double, ptr %61, align 8, !tbaa !9
  %63 = load double, ptr @pvtbv_.sumr, align 8, !tbaa !9
  %64 = load double, ptr @pvtbv_.sum, align 8, !tbaa !9
  %65 = call double @llvm.fmuladd.f64(double %62, double %63, double %64)
  store double %65, ptr @pvtbv_.sum, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %58, %31
  %67 = load i64, ptr @pvtbv_.ii, align 8, !tbaa !11
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr @pvtbv_.ii, align 8, !tbaa !11
  br label %11, !llvm.loop !15

69:                                               ; preds = %11
  %70 = load i64, ptr getelementptr inbounds (%struct.anon, ptr @itcom1_, i32 0, i32 2), align 8, !tbaa !16
  %71 = icmp eq i64 %70, 0
  br i1 %71, label %72, label %75

72:                                               ; preds = %69
  %73 = load double, ptr @pvtbv_.sum, align 8, !tbaa !9
  %74 = fmul double %73, 2.000000e+00
  store double %74, ptr @pvtbv_.sum, align 8, !tbaa !9
  br label %75

75:                                               ; preds = %72, %69
  %76 = load double, ptr @pvtbv_.sum, align 8, !tbaa !9
  ret double %76
}

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

!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"}
!15 = distinct !{!15, !14}
!16 = !{!17, !12, i64 16}
!17 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40}


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

@itcom1_ = external hidden local_unnamed_addr global %struct.anon, align 8
@pvtbv_.ii = external hidden local_unnamed_addr global i64, align 8
@pvtbv_.jj = external hidden local_unnamed_addr global i64, align 8
@pvtbv_.sum = external hidden local_unnamed_addr global double, align 8
@pvtbv_.jajj = external hidden local_unnamed_addr global i64, align 8
@pvtbv_.ibgn = external hidden local_unnamed_addr global i64, align 8
@pvtbv_.iend = external hidden local_unnamed_addr global i64, align 8
@pvtbv_.sumr = external hidden local_unnamed_addr global double, align 8

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: read, inaccessiblemem: none) uwtable
define dso_local double @pvtbv_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, ptr nocapture noundef readonly %4) local_unnamed_addr #0 {
  store double 0.000000e+00, ptr @pvtbv_.sum, align 8, !tbaa !5
  store i64 0, ptr @pvtbv_.ii, align 8, !tbaa !9
  %6 = load i64, ptr %0, align 8, !tbaa !9
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5, %51
  %storemerge11 = phi i64 [ %53, %51 ], [ 0, %5 ]
  %8 = phi double [ %52, %51 ], [ 0.000000e+00, %5 ]
  %9 = getelementptr inbounds i64, ptr %1, i64 %storemerge11
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr @pvtbv_.ibgn, align 8, !tbaa !9
  %12 = getelementptr i8, ptr %9, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !9
  %14 = add i64 %13, -1
  store i64 %14, ptr @pvtbv_.iend, align 8, !tbaa !9
  %.not = icmp slt i64 %10, %13
  br i1 %.not, label %15, label %51

15:                                               ; preds = %.lr.ph
  store double 0.000000e+00, ptr @pvtbv_.sumr, align 8, !tbaa !5
  store i64 %11, ptr @pvtbv_.jj, align 8, !tbaa !9
  %16 = sub i64 %13, %10
  %.neg = add i64 %10, 1
  %xtraiter = and i64 %16, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %15
  %17 = getelementptr inbounds i64, ptr %2, i64 %11
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = add nsw i64 %18, -1
  store i64 %19, ptr @pvtbv_.jajj, align 8, !tbaa !9
  %20 = getelementptr inbounds double, ptr %3, i64 %11
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds double, ptr %4, i64 %19
  %23 = load double, ptr %22, align 8, !tbaa !5
  %24 = fneg double %21
  %25 = tail call double @llvm.fmuladd.f64(double %24, double %23, double 0.000000e+00)
  store double %25, ptr @pvtbv_.sumr, align 8, !tbaa !5
  store i64 %10, ptr @pvtbv_.jj, align 8, !tbaa !9
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %15
  %.lcssa.unr = phi double [ poison, %15 ], [ %25, %.prol.loopexit.unr-lcssa ]
  %storemerge89.unr = phi i64 [ %11, %15 ], [ %10, %.prol.loopexit.unr-lcssa ]
  %.unr = phi double [ 0.000000e+00, %15 ], [ %25, %.prol.loopexit.unr-lcssa ]
  %26 = icmp eq i64 %13, %.neg
  br i1 %26, label %.unr-lcssa, label %.new

.new:                                             ; preds = %.prol.loopexit, %.new
  %storemerge89 = phi i64 [ %47, %.new ], [ %storemerge89.unr, %.prol.loopexit ]
  %27 = phi double [ %46, %.new ], [ %.unr, %.prol.loopexit ]
  %28 = getelementptr inbounds i64, ptr %2, i64 %storemerge89
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = add nsw i64 %29, -1
  store i64 %30, ptr @pvtbv_.jajj, align 8, !tbaa !9
  %31 = getelementptr inbounds double, ptr %3, i64 %storemerge89
  %32 = load double, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds double, ptr %4, i64 %30
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = fneg double %32
  %36 = tail call double @llvm.fmuladd.f64(double %35, double %34, double %27)
  store double %36, ptr @pvtbv_.sumr, align 8, !tbaa !5
  %37 = add nsw i64 %storemerge89, 1
  store i64 %37, ptr @pvtbv_.jj, align 8, !tbaa !9
  %38 = getelementptr inbounds i64, ptr %2, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = add nsw i64 %39, -1
  store i64 %40, ptr @pvtbv_.jajj, align 8, !tbaa !9
  %41 = getelementptr inbounds double, ptr %3, i64 %37
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = getelementptr inbounds double, ptr %4, i64 %40
  %44 = load double, ptr %43, align 8, !tbaa !5
  %45 = fneg double %42
  %46 = tail call double @llvm.fmuladd.f64(double %45, double %44, double %36)
  store double %46, ptr @pvtbv_.sumr, align 8, !tbaa !5
  %47 = add nsw i64 %storemerge89, 2
  store i64 %47, ptr @pvtbv_.jj, align 8, !tbaa !9
  %exitcond.not.1 = icmp eq i64 %47, %14
  br i1 %exitcond.not.1, label %.unr-lcssa, label %.new, !llvm.loop !11

.unr-lcssa:                                       ; preds = %.new, %.prol.loopexit
  %.lcssa = phi double [ %.lcssa.unr, %.prol.loopexit ], [ %46, %.new ]
  %48 = getelementptr inbounds double, ptr %4, i64 %storemerge11
  %49 = load double, ptr %48, align 8, !tbaa !5
  %50 = tail call double @llvm.fmuladd.f64(double %49, double %.lcssa, double %8)
  store double %50, ptr @pvtbv_.sum, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %.lr.ph, %.unr-lcssa
  %52 = phi double [ %8, %.lr.ph ], [ %50, %.unr-lcssa ]
  %53 = add nuw nsw i64 %storemerge11, 1
  store i64 %53, ptr @pvtbv_.ii, align 8, !tbaa !9
  %54 = load i64, ptr %0, align 8, !tbaa !9
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %51, %5
  %56 = phi double [ 0.000000e+00, %5 ], [ %52, %51 ]
  %57 = load i64, ptr getelementptr inbounds (i8, ptr @itcom1_, i64 16), align 8, !tbaa !14
  %58 = icmp eq i64 %57, 0
  br i1 %58, label %59, label %61

59:                                               ; preds = %._crit_edge
  %60 = fmul double %56, 2.000000e+00
  store double %60, ptr @pvtbv_.sum, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %59, %._crit_edge
  %62 = phi double [ %60, %59 ], [ %56, %._crit_edge ]
  ret double %62
}

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

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, 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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !10, i64 16}
!15 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}


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