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

@pervec_.ii = external hidden global i64, align 8
@pervec_.now = external hidden global i64, align 8
@pervec_.save = external hidden global double, align 8
@pervec_.temp = external hidden global double, align 8
@pervec_.next = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @pervec_(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %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 %5, align 8, !tbaa !5
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = icmp sle i64 %9, 0
  br i1 %10, label %11, label %12

11:                                               ; preds = %3
  store i32 0, ptr %4, align 4
  br label %88

12:                                               ; preds = %3
  store i64 0, ptr @pervec_.ii, align 8, !tbaa !9
  br label %13

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

18:                                               ; preds = %13
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %21 = getelementptr inbounds i64, ptr %19, i64 %20
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %23 = icmp slt i64 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %18
  br label %66

25:                                               ; preds = %18
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %28 = getelementptr inbounds i64, ptr %26, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !9
  store i64 %29, ptr @pervec_.next, align 8, !tbaa !9
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %32 = getelementptr inbounds double, ptr %30, i64 %31
  %33 = load double, ptr %32, align 8, !tbaa !11
  store double %33, ptr @pervec_.save, align 8, !tbaa !11
  br label %34

34:                                               ; preds = %41, %25
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load i64, ptr @pervec_.next, align 8, !tbaa !9
  %37 = sub nsw i64 %36, 1
  %38 = getelementptr inbounds i64, ptr %35, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = icmp sge i64 %39, 0
  br i1 %40, label %41, label %65

41:                                               ; preds = %34
  %42 = load double, ptr @pervec_.save, align 8, !tbaa !11
  store double %42, ptr @pervec_.temp, align 8, !tbaa !11
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load i64, ptr @pervec_.next, align 8, !tbaa !9
  %45 = sub nsw i64 %44, 1
  %46 = getelementptr inbounds double, ptr %43, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !11
  store double %47, ptr @pervec_.save, align 8, !tbaa !11
  %48 = load double, ptr @pervec_.temp, align 8, !tbaa !11
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i64, ptr @pervec_.next, align 8, !tbaa !9
  %51 = sub nsw i64 %50, 1
  %52 = getelementptr inbounds double, ptr %49, i64 %51
  store double %48, ptr %52, align 8, !tbaa !11
  %53 = load i64, ptr @pervec_.next, align 8, !tbaa !9
  store i64 %53, ptr @pervec_.now, align 8, !tbaa !9
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load i64, ptr @pervec_.now, align 8, !tbaa !9
  %56 = sub nsw i64 %55, 1
  %57 = getelementptr inbounds i64, ptr %54, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !9
  store i64 %58, ptr @pervec_.next, align 8, !tbaa !9
  %59 = load i64, ptr @pervec_.next, align 8, !tbaa !9
  %60 = sub nsw i64 0, %59
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load i64, ptr @pervec_.now, align 8, !tbaa !9
  %63 = sub nsw i64 %62, 1
  %64 = getelementptr inbounds i64, ptr %61, i64 %63
  store i64 %60, ptr %64, align 8, !tbaa !9
  br label %34, !llvm.loop !13

65:                                               ; preds = %34
  br label %66

66:                                               ; preds = %65, %24
  %67 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr @pervec_.ii, align 8, !tbaa !9
  br label %13, !llvm.loop !15

69:                                               ; preds = %13
  store i64 0, ptr @pervec_.ii, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %84, %69
  %71 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = load i64, ptr %72, align 8, !tbaa !9
  %74 = icmp slt i64 %71, %73
  br i1 %74, label %75, label %87

75:                                               ; preds = %70
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %78 = getelementptr inbounds i64, ptr %76, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = sub nsw i64 0, %79
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %83 = getelementptr inbounds i64, ptr %81, i64 %82
  store i64 %80, ptr %83, align 8, !tbaa !9
  br label %84

84:                                               ; preds = %75
  %85 = load i64, ptr @pervec_.ii, align 8, !tbaa !9
  %86 = add nsw i64 %85, 1
  store i64 %86, ptr @pervec_.ii, align 8, !tbaa !9
  br label %70, !llvm.loop !16

87:                                               ; preds = %70
  store i32 0, ptr %4, align 4
  br label %88

88:                                               ; preds = %87, %11
  %89 = load i32, ptr %4, align 4
  ret i32 %89
}

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

!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"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@pervec_.ii = external hidden local_unnamed_addr global i64, align 8
@pervec_.now = external hidden local_unnamed_addr global i64, align 8
@pervec_.save = external hidden local_unnamed_addr global double, align 8
@pervec_.temp = external hidden local_unnamed_addr global double, align 8
@pervec_.next = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, inaccessiblemem: none) uwtable
define dso_local noundef i32 @pervec_(ptr nocapture noundef readonly %0, ptr nocapture noundef %1, ptr nocapture noundef %2) local_unnamed_addr #0 {
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %5 = icmp slt i64 %4, 1
  br i1 %5, label %.loopexit, label %.preheader17

.preheader17:                                     ; preds = %3
  store i64 0, ptr @pervec_.ii, align 8, !tbaa !5
  %6 = load i64, ptr %0, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph23, label %.preheader

.lr.ph23:                                         ; preds = %.preheader17
  %invariant.gep = getelementptr i8, ptr %2, i64 -8
  %invariant.gep18 = getelementptr i8, ptr %1, i64 -8
  br label %10

.preheader:                                       ; preds = %.loopexit16, %.preheader17
  store i64 0, ptr @pervec_.ii, align 8, !tbaa !5
  %8 = load i64, ptr %0, align 8, !tbaa !5
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph25, label %.loopexit

10:                                               ; preds = %.lr.ph23, %.loopexit16
  %storemerge22 = phi i64 [ 0, %.lr.ph23 ], [ %28, %.loopexit16 ]
  %11 = getelementptr inbounds i64, ptr %2, i64 %storemerge22
  %12 = load i64, ptr %11, align 8, !tbaa !5
  %13 = icmp slt i64 %12, 0
  br i1 %13, label %.loopexit16, label %14

14:                                               ; preds = %10
  store i64 %12, ptr @pervec_.next, align 8, !tbaa !5
  %15 = getelementptr inbounds double, ptr %1, i64 %storemerge22
  %16 = load double, ptr %15, align 8, !tbaa !9
  store double %16, ptr @pervec_.save, align 8, !tbaa !9
  %gep20 = getelementptr i64, ptr %invariant.gep, i64 %12
  %17 = load i64, ptr %gep20, align 8, !tbaa !5
  %18 = icmp sgt i64 %17, -1
  br i1 %18, label %.lr.ph, label %.loopexit16

.lr.ph:                                           ; preds = %14, %.lr.ph
  %gep21 = phi ptr [ %gep, %.lr.ph ], [ %gep20, %14 ]
  %19 = phi i64 [ %24, %.lr.ph ], [ %12, %14 ]
  %20 = load double, ptr @pervec_.save, align 8, !tbaa !9
  store double %20, ptr @pervec_.temp, align 8, !tbaa !9
  %gep19 = getelementptr double, ptr %invariant.gep18, i64 %19
  %21 = load double, ptr %gep19, align 8, !tbaa !9
  store double %21, ptr @pervec_.save, align 8, !tbaa !9
  store double %20, ptr %gep19, align 8, !tbaa !9
  store i64 %19, ptr @pervec_.now, align 8, !tbaa !5
  %22 = load i64, ptr %gep21, align 8, !tbaa !5
  store i64 %22, ptr @pervec_.next, align 8, !tbaa !5
  %23 = sub nsw i64 0, %22
  store i64 %23, ptr %gep21, align 8, !tbaa !5
  %24 = load i64, ptr @pervec_.next, align 8, !tbaa !5
  %gep = getelementptr i64, ptr %invariant.gep, i64 %24
  %25 = load i64, ptr %gep, align 8, !tbaa !5
  %26 = icmp sgt i64 %25, -1
  br i1 %26, label %.lr.ph, label %.loopexit16.loopexit, !llvm.loop !11

.loopexit16.loopexit:                             ; preds = %.lr.ph
  %.pre = load i64, ptr @pervec_.ii, align 8, !tbaa !5
  br label %.loopexit16

.loopexit16:                                      ; preds = %.loopexit16.loopexit, %14, %10
  %27 = phi i64 [ %.pre, %.loopexit16.loopexit ], [ %storemerge22, %14 ], [ %storemerge22, %10 ]
  %28 = add nsw i64 %27, 1
  store i64 %28, ptr @pervec_.ii, align 8, !tbaa !5
  %29 = load i64, ptr %0, align 8, !tbaa !5
  %30 = icmp slt i64 %28, %29
  br i1 %30, label %10, label %.preheader, !llvm.loop !13

.lr.ph25:                                         ; preds = %.preheader, %.lr.ph25
  %storemerge1524 = phi i64 [ %35, %.lr.ph25 ], [ 0, %.preheader ]
  %31 = getelementptr inbounds i64, ptr %2, i64 %storemerge1524
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = sub nsw i64 0, %32
  store i64 %33, ptr %31, align 8, !tbaa !5
  %34 = load i64, ptr @pervec_.ii, align 8, !tbaa !5
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr @pervec_.ii, align 8, !tbaa !5
  %36 = load i64, ptr %0, align 8, !tbaa !5
  %37 = icmp slt i64 %35, %36
  br i1 %37, label %.lr.ph25, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph25, %.preheader, %3
  ret i32 0
}

attributes #0 = { nofree norecurse nosync nounwind memory(readwrite, 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"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass