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

@wevmw_.i = external hidden global i64, align 8
@wevmw_.m = external hidden global i64, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @wevmw_(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 %105

12:                                               ; preds = %3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load i64, ptr %13, align 8, !tbaa !9
  %15 = srem i64 %14, 4
  store i64 %15, ptr @wevmw_.m, align 8, !tbaa !9
  store i64 0, ptr @wevmw_.i, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %33, %12
  %17 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %18 = load i64, ptr @wevmw_.m, align 8, !tbaa !9
  %19 = icmp slt i64 %17, %18
  br i1 %19, label %20, label %36

20:                                               ; preds = %16
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %23 = getelementptr inbounds double, ptr %21, i64 %22
  %24 = load double, ptr %23, align 8, !tbaa !11
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %27 = getelementptr inbounds double, ptr %25, i64 %26
  %28 = load double, ptr %27, align 8, !tbaa !11
  %29 = fsub double %24, %28
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %32 = getelementptr inbounds double, ptr %30, i64 %31
  store double %29, ptr %32, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %20
  %34 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr @wevmw_.i, align 8, !tbaa !9
  br label %16, !llvm.loop !13

36:                                               ; preds = %16
  %37 = load i64, ptr @wevmw_.m, align 8, !tbaa !9
  store i64 %37, ptr @wevmw_.i, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %101, %36
  %39 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load i64, ptr %40, align 8, !tbaa !9
  %42 = icmp slt i64 %39, %41
  br i1 %42, label %43, label %104

43:                                               ; preds = %38
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %46 = getelementptr inbounds double, ptr %44, i64 %45
  %47 = load double, ptr %46, align 8, !tbaa !11
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %50 = getelementptr inbounds double, ptr %48, i64 %49
  %51 = load double, ptr %50, align 8, !tbaa !11
  %52 = fsub double %47, %51
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %55 = getelementptr inbounds double, ptr %53, i64 %54
  store double %52, ptr %55, align 8, !tbaa !11
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %58 = add nsw i64 %57, 1
  %59 = getelementptr inbounds double, ptr %56, i64 %58
  %60 = load double, ptr %59, align 8, !tbaa !11
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %63 = add nsw i64 %62, 1
  %64 = getelementptr inbounds double, ptr %61, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !11
  %66 = fsub double %60, %65
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %69 = add nsw i64 %68, 1
  %70 = getelementptr inbounds double, ptr %67, i64 %69
  store double %66, ptr %70, align 8, !tbaa !11
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %73 = add nsw i64 %72, 2
  %74 = getelementptr inbounds double, ptr %71, i64 %73
  %75 = load double, ptr %74, align 8, !tbaa !11
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %78 = add nsw i64 %77, 2
  %79 = getelementptr inbounds double, ptr %76, i64 %78
  %80 = load double, ptr %79, align 8, !tbaa !11
  %81 = fsub double %75, %80
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %84 = add nsw i64 %83, 2
  %85 = getelementptr inbounds double, ptr %82, i64 %84
  store double %81, ptr %85, align 8, !tbaa !11
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %88 = add nsw i64 %87, 3
  %89 = getelementptr inbounds double, ptr %86, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !11
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %93 = add nsw i64 %92, 3
  %94 = getelementptr inbounds double, ptr %91, i64 %93
  %95 = load double, ptr %94, align 8, !tbaa !11
  %96 = fsub double %90, %95
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %99 = add nsw i64 %98, 3
  %100 = getelementptr inbounds double, ptr %97, i64 %99
  store double %96, ptr %100, align 8, !tbaa !11
  br label %101

101:                                              ; preds = %43
  %102 = load i64, ptr @wevmw_.i, align 8, !tbaa !9
  %103 = add nsw i64 %102, 4
  store i64 %103, ptr @wevmw_.i, align 8, !tbaa !9
  br label %38, !llvm.loop !15

104:                                              ; preds = %38
  store i32 0, ptr %4, align 4
  br label %105

105:                                              ; preds = %104, %11
  %106 = load i32, ptr %4, align 4
  ret i32 %106
}

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}


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

@wevmw_.i = external hidden local_unnamed_addr global i64, align 8
@wevmw_.m = external hidden local_unnamed_addr global i64, align 8

; Function Attrs: nofree norecurse nosync nounwind memory(write, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local noundef i32 @wevmw_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %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 %6

6:                                                ; preds = %3
  %7 = and i64 %4, 3
  store i64 %7, ptr @wevmw_.m, align 8, !tbaa !5
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %.lr.ph.1, %.lr.ph.2, %6
  store i64 %7, ptr @wevmw_.i, align 8, !tbaa !5
  %8 = load i64, ptr %0, align 8, !tbaa !5
  %9 = icmp slt i64 %7, %8
  br i1 %9, label %.lr.ph24, label %.loopexit

.lr.ph:                                           ; preds = %6
  %10 = load double, ptr %1, align 8, !tbaa !9
  %11 = load double, ptr %2, align 8, !tbaa !9
  %12 = fsub double %10, %11
  store double %12, ptr %2, align 8, !tbaa !9
  %exitcond.not = icmp eq i64 %7, 1
  br i1 %exitcond.not, label %.preheader, label %.lr.ph.1, !llvm.loop !11

.lr.ph.1:                                         ; preds = %.lr.ph
  %13 = getelementptr inbounds i8, ptr %1, i64 8
  %14 = load double, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %2, i64 8
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = fsub double %14, %16
  store double %17, ptr %15, align 8, !tbaa !9
  %exitcond.not.1 = icmp eq i64 %7, 2
  br i1 %exitcond.not.1, label %.preheader, label %.lr.ph.2, !llvm.loop !11

.lr.ph.2:                                         ; preds = %.lr.ph.1
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load double, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds i8, ptr %2, i64 16
  %21 = load double, ptr %20, align 8, !tbaa !9
  %22 = fsub double %19, %21
  store double %22, ptr %20, align 8, !tbaa !9
  br label %.preheader

.lr.ph24:                                         ; preds = %.preheader, %.lr.ph24
  %storemerge2123 = phi i64 [ %46, %.lr.ph24 ], [ %7, %.preheader ]
  %23 = getelementptr inbounds double, ptr %1, i64 %storemerge2123
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds double, ptr %2, i64 %storemerge2123
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = fsub double %24, %26
  store double %27, ptr %25, align 8, !tbaa !9
  %28 = add nuw nsw i64 %storemerge2123, 1
  %29 = getelementptr inbounds double, ptr %1, i64 %28
  %30 = load double, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds double, ptr %2, i64 %28
  %32 = load double, ptr %31, align 8, !tbaa !9
  %33 = fsub double %30, %32
  store double %33, ptr %31, align 8, !tbaa !9
  %34 = add nuw nsw i64 %storemerge2123, 2
  %35 = getelementptr inbounds double, ptr %1, i64 %34
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds double, ptr %2, i64 %34
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = fsub double %36, %38
  store double %39, ptr %37, align 8, !tbaa !9
  %40 = add nuw nsw i64 %storemerge2123, 3
  %41 = getelementptr inbounds double, ptr %1, i64 %40
  %42 = load double, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds double, ptr %2, i64 %40
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = fsub double %42, %44
  store double %45, ptr %43, align 8, !tbaa !9
  %46 = add nuw nsw i64 %storemerge2123, 4
  store i64 %46, ptr @wevmw_.i, align 8, !tbaa !5
  %47 = load i64, ptr %0, align 8, !tbaa !5
  %48 = icmp slt i64 %46, %47
  br i1 %48, label %.lr.ph24, label %.loopexit, !llvm.loop !13

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

attributes #0 = { nofree norecurse nosync nounwind memory(write, argmem: 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}


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