; LLVM IR from o0o0o0o0o0o0o/image-processing-from-scratch :: ImageMatting/Eigen/blas (double)

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

%"class.Eigen::Map.9" = type { %"class.Eigen::MapBase.base.19", [7 x i8] }
%"class.Eigen::MapBase.base.19" = type { %"class.Eigen::MapBase.base.18" }
%"class.Eigen::MapBase.base.18" = type <{ ptr, %"class.Eigen::internal::variable_if_dynamic", i8 }>
%"class.Eigen::internal::variable_if_dynamic" = type { i64 }
%"class.Eigen::Map.36" = type { %"class.Eigen::MapBase.base.46", %"class.Eigen::InnerStride" }
%"class.Eigen::MapBase.base.46" = type { %"class.Eigen::MapBase.base.45" }
%"class.Eigen::MapBase.base.45" = type <{ ptr, %"class.Eigen::internal::variable_if_dynamic", i8 }>
%"class.Eigen::InnerStride" = type { %"class.Eigen::Stride" }
%"class.Eigen::Stride" = type { [8 x i8], %"class.Eigen::internal::variable_if_dynamic" }
%"class.Eigen::CwiseUnaryOp" = type { %"class.Eigen::Map.9", [8 x i8] }
%"class.Eigen::CwiseUnaryOp.68" = type <{ %"class.Eigen::Map.36", [8 x i8] }>

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_6StrideILi0ELi0EEEEEPS3_i(ptr dead_on_unwind noalias writable sret(%"class.Eigen::Map.9") align 8, ptr noundef, i32 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_11InnerStrideILin1EEEEEPS3_ii(ptr dead_on_unwind noalias writable sret(%"class.Eigen::Map.36") align 8, ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEE8cwiseAbsEv(ptr dead_on_unwind noalias writable sret(%"class.Eigen::CwiseUnaryOp") align 8, ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEE8cwiseAbsEv(ptr dead_on_unwind noalias writable sret(%"class.Eigen::CwiseUnaryOp.68") align 8, ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local double @dasum_(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
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.Eigen::CwiseUnaryOp", align 8
  %11 = alloca %"class.Eigen::Map.9", align 8
  %12 = alloca %"class.Eigen::CwiseUnaryOp.68", align 8
  %13 = alloca %"class.Eigen::Map.36", 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %14, ptr %8, align 8, !tbaa !5
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = icmp sle i32 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %3
  store double 0.000000e+00, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %36

19:                                               ; preds = %3
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 1
  br i1 %22, label %23, label %28

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #4
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = load i32, ptr %25, align 4, !tbaa !9
  call void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_6StrideILi0ELi0EEEEEPS3_i(ptr dead_on_unwind writable sret(%"class.Eigen::Map.9") align 8 %11, ptr noundef %24, i32 noundef %26)
  call void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEE8cwiseAbsEv(ptr dead_on_unwind writable sret(%"class.Eigen::CwiseUnaryOp") align 8 %10, ptr noundef nonnull align 1 dereferenceable(1) %11)
  %27 = call noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1) %10)
  store double %27, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  store i32 1, ptr %9, align 4
  br label %36

28:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %13) #4
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = call i32 @llvm.abs.i32(i32 %33, i1 true)
  call void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_11InnerStrideILin1EEEEEPS3_ii(ptr dead_on_unwind writable sret(%"class.Eigen::Map.36") align 8 %13, ptr noundef %29, i32 noundef %31, i32 noundef %34)
  call void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEE8cwiseAbsEv(ptr dead_on_unwind writable sret(%"class.Eigen::CwiseUnaryOp.68") align 8 %12, ptr noundef nonnull align 1 dereferenceable(1) %13)
  %35 = call noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1) %12)
  store double %35, ptr %4, align 8
  call void @llvm.lifetime.end.p0(i64 40, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #4
  store i32 1, ptr %9, align 4
  br label %36

36:                                               ; preds = %28, %23, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %37 = load double, ptr %4, align 8
  ret double %37
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { inlinehint mustprogress 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}


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

%"class.Eigen::Map.9" = type { %"class.Eigen::MapBase.base.19", [7 x i8] }
%"class.Eigen::MapBase.base.19" = type { %"class.Eigen::MapBase.base.18" }
%"class.Eigen::MapBase.base.18" = type <{ ptr, %"class.Eigen::internal::variable_if_dynamic", i8 }>
%"class.Eigen::internal::variable_if_dynamic" = type { i64 }
%"class.Eigen::Map.36" = type { %"class.Eigen::MapBase.base.46", %"class.Eigen::InnerStride" }
%"class.Eigen::MapBase.base.46" = type { %"class.Eigen::MapBase.base.45" }
%"class.Eigen::MapBase.base.45" = type <{ ptr, %"class.Eigen::internal::variable_if_dynamic", i8 }>
%"class.Eigen::InnerStride" = type { %"class.Eigen::Stride" }
%"class.Eigen::Stride" = type { [8 x i8], %"class.Eigen::internal::variable_if_dynamic" }
%"class.Eigen::CwiseUnaryOp" = type { %"class.Eigen::Map.9", [8 x i8] }
%"class.Eigen::CwiseUnaryOp.68" = type <{ %"class.Eigen::Map.36", [8 x i8] }>

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_6StrideILi0ELi0EEEEEPS3_i(ptr dead_on_unwind noalias writable sret(%"class.Eigen::Map.9") align 8, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_11InnerStrideILin1EEEEEPS3_ii(ptr dead_on_unwind noalias writable sret(%"class.Eigen::Map.36") align 8, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEE8cwiseAbsEv(ptr dead_on_unwind noalias writable sret(%"class.Eigen::CwiseUnaryOp") align 8, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEE8cwiseAbsEv(ptr dead_on_unwind noalias writable sret(%"class.Eigen::CwiseUnaryOp.68") align 8, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @dasum_(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
  %4 = alloca %"class.Eigen::CwiseUnaryOp", align 8
  %5 = alloca %"class.Eigen::Map.9", align 8
  %6 = alloca %"class.Eigen::CwiseUnaryOp.68", align 8
  %7 = alloca %"class.Eigen::Map.36", align 8
  %8 = load i32, ptr %0, align 4, !tbaa !5
  %9 = icmp slt i32 %8, 1
  br i1 %9, label %18, label %10

10:                                               ; preds = %3
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %15

13:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #4
  call void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_6StrideILi0ELi0EEEEEPS3_i(ptr dead_on_unwind nonnull writable sret(%"class.Eigen::Map.9") align 8 %5, ptr noundef %1, i32 noundef %8)
  call void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEE8cwiseAbsEv(ptr dead_on_unwind nonnull writable sret(%"class.Eigen::CwiseUnaryOp") align 8 %4, ptr noundef nonnull align 1 dereferenceable(1) %5)
  %14 = call noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  br label %18

15:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %7) #4
  %16 = tail call i32 @llvm.abs.i32(i32 %11, i1 true)
  call void @_Z11make_vectorIdEN5Eigen3MapINS0_6MatrixIT_Lin1ELi1ELi0ELin1ELi1EEELi0ENS0_11InnerStrideILin1EEEEEPS3_ii(ptr dead_on_unwind nonnull writable sret(%"class.Eigen::Map.36") align 8 %7, ptr noundef %1, i32 noundef %8, i32 noundef %16)
  call void @_ZNK5Eigen10MatrixBaseINS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEE8cwiseAbsEv(ptr dead_on_unwind nonnull writable sret(%"class.Eigen::CwiseUnaryOp.68") align 8 %6, ptr noundef nonnull align 1 dereferenceable(1) %7)
  %17 = call noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1) %6)
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #4
  br label %18

18:                                               ; preds = %3, %15, %13
  %.0 = phi double [ %14, %13 ], [ %17, %15 ], [ 0.000000e+00, %3 ]
  ret double %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_6StrideILi0ELi0EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5Eigen9DenseBaseINS_12CwiseUnaryOpINS_8internal13scalar_abs_opIdEEKNS_3MapINS_6MatrixIdLin1ELi1ELi0ELin1ELi1EEELi0ENS_11InnerStrideILin1EEEEEEEE3sumEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 #2 = { inlinehint mustprogress 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass