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

@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

declare i32 @xerbla_(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z18get_compact_vectorIdEPT_S1_ii(ptr noundef, i32 noundef, i32 noundef) #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local i32 @dger_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7, ptr noundef %8) #3 {
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca double, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  store ptr %0, ptr %11, align 8, !tbaa !5
  store ptr %1, ptr %12, align 8, !tbaa !5
  store ptr %2, ptr %13, align 8, !tbaa !5
  store ptr %3, ptr %14, align 8, !tbaa !5
  store ptr %4, ptr %15, align 8, !tbaa !5
  store ptr %5, ptr %16, align 8, !tbaa !5
  store ptr %6, ptr %17, align 8, !tbaa !5
  store ptr %7, ptr %18, align 8, !tbaa !5
  store ptr %8, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %29 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %29, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %30 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %30, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %31 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %31, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #5
  %32 = load ptr, ptr %13, align 8, !tbaa !5
  %33 = load double, ptr %32, align 8, !tbaa !9
  store double %33, ptr %23, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !11
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = load i32, ptr %34, align 4, !tbaa !11
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %9
  store i32 1, ptr %24, align 4, !tbaa !11
  br label %65

38:                                               ; preds = %9
  %39 = load ptr, ptr %12, align 8, !tbaa !5
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = icmp slt i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  store i32 2, ptr %24, align 4, !tbaa !11
  br label %64

43:                                               ; preds = %38
  %44 = load ptr, ptr %15, align 8, !tbaa !5
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %43
  store i32 5, ptr %24, align 4, !tbaa !11
  br label %63

48:                                               ; preds = %43
  %49 = load ptr, ptr %17, align 8, !tbaa !5
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %48
  store i32 7, ptr %24, align 4, !tbaa !11
  br label %62

53:                                               ; preds = %48
  %54 = load ptr, ptr %19, align 8, !tbaa !5
  %55 = load i32, ptr %54, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 1, ptr %25, align 4, !tbaa !11
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %25, ptr noundef nonnull align 4 dereferenceable(4) %56)
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %59 = icmp slt i32 %55, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br i1 %59, label %60, label %61

60:                                               ; preds = %53
  store i32 9, ptr %24, align 4, !tbaa !11
  br label %61

61:                                               ; preds = %60, %53
  br label %62

62:                                               ; preds = %61, %52
  br label %63

63:                                               ; preds = %62, %47
  br label %64

64:                                               ; preds = %63, %42
  br label %65

65:                                               ; preds = %64, %37
  %66 = load i32, ptr %24, align 4, !tbaa !11
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %65
  %69 = call i32 @xerbla_(ptr noundef @.str.12, ptr noundef %24, i32 noundef 6)
  store i32 %69, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %115

70:                                               ; preds = %65
  %71 = load double, ptr %23, align 8, !tbaa !9
  %72 = fcmp oeq double %71, 0.000000e+00
  br i1 %72, label %73, label %74

73:                                               ; preds = %70
  store i32 1, ptr %10, align 4
  store i32 1, ptr %26, align 4
  br label %115

74:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  %75 = load ptr, ptr %20, align 8, !tbaa !5
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = load i32, ptr %76, align 4, !tbaa !11
  %78 = load ptr, ptr %15, align 8, !tbaa !5
  %79 = load i32, ptr %78, align 4, !tbaa !11
  %80 = call noundef ptr @_Z18get_compact_vectorIdEPT_S1_ii(ptr noundef %75, i32 noundef %77, i32 noundef %79)
  store ptr %80, ptr %27, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  %81 = load ptr, ptr %21, align 8, !tbaa !5
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load i32, ptr %82, align 4, !tbaa !11
  %84 = load ptr, ptr %17, align 8, !tbaa !5
  %85 = load i32, ptr %84, align 4, !tbaa !11
  %86 = call noundef ptr @_Z18get_compact_vectorIdEPT_S1_ii(ptr noundef %81, i32 noundef %83, i32 noundef %85)
  store ptr %86, ptr %28, align 8, !tbaa !5
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = load i32, ptr %87, align 4, !tbaa !11
  %89 = load ptr, ptr %12, align 8, !tbaa !5
  %90 = load i32, ptr %89, align 4, !tbaa !11
  %91 = load ptr, ptr %22, align 8, !tbaa !5
  %92 = load ptr, ptr %19, align 8, !tbaa !5
  %93 = load i32, ptr %92, align 4, !tbaa !11
  %94 = load ptr, ptr %27, align 8, !tbaa !5
  %95 = load ptr, ptr %28, align 8, !tbaa !5
  %96 = load double, ptr %23, align 8, !tbaa !9
  call void @_ZN5Eigen8internal20general_rank1_updateIdiLi0ELb0ELb0EE3runEiiPdiPKdS5_d(i32 noundef %88, i32 noundef %90, ptr noundef %91, i32 noundef %93, ptr noundef %94, ptr noundef %95, double noundef %96)
  %97 = load ptr, ptr %27, align 8, !tbaa !5
  %98 = load ptr, ptr %20, align 8, !tbaa !5
  %99 = icmp ne ptr %97, %98
  br i1 %99, label %100, label %105

100:                                              ; preds = %74
  %101 = load ptr, ptr %27, align 8, !tbaa !5
  %102 = icmp eq ptr %101, null
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  call void @_ZdaPv(ptr noundef %101) #6
  br label %104

104:                                              ; preds = %103, %100
  br label %105

105:                                              ; preds = %104, %74
  %106 = load ptr, ptr %28, align 8, !tbaa !5
  %107 = load ptr, ptr %21, align 8, !tbaa !5
  %108 = icmp ne ptr %106, %107
  br i1 %108, label %109, label %114

109:                                              ; preds = %105
  %110 = load ptr, ptr %28, align 8, !tbaa !5
  %111 = icmp eq ptr %110, null
  br i1 %111, label %113, label %112

112:                                              ; preds = %109
  call void @_ZdaPv(ptr noundef %110) #6
  br label %113

113:                                              ; preds = %112, %109
  br label %114

114:                                              ; preds = %113, %105
  store i32 1, ptr %10, align 4
  store i32 1, ptr %26, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  br label %115

115:                                              ; preds = %114, %73, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  %116 = load i32, ptr %10, align 4
  ret i32 %116
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen8internal20general_rank1_updateIdiLi0ELb0ELb0EE3runEiiPdiPKdS5_d(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, double noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 #2 = { "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 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 #4 = { nobuiltin nounwind "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 #5 = { nounwind }
attributes #6 = { builtin 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"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"

@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

declare i32 @xerbla_(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z18get_compact_vectorIdEPT_S1_ii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local i32 @dger_(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr noundef %3, ptr nocapture noundef readonly %4, ptr noundef %5, ptr nocapture noundef readonly %6, ptr noundef %7, ptr nocapture noundef readonly %8) local_unnamed_addr #3 {
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = load double, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %13 = load i32, ptr %0, align 4, !tbaa !9
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %15, label %16

15:                                               ; preds = %9
  store i32 1, ptr %10, align 4, !tbaa !9
  br label %.thread

16:                                               ; preds = %9
  %17 = load i32, ptr %1, align 4, !tbaa !9
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  store i32 2, ptr %10, align 4, !tbaa !9
  br label %.thread

20:                                               ; preds = %16
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %20
  store i32 5, ptr %10, align 4, !tbaa !9
  br label %.thread

24:                                               ; preds = %20
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  store i32 7, ptr %10, align 4, !tbaa !9
  br label %.thread

28:                                               ; preds = %24
  %29 = load i32, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  store i32 1, ptr %11, align 4, !tbaa !9
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %0)
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = icmp slt i32 %29, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  br i1 %32, label %33, label %35

33:                                               ; preds = %28
  store i32 9, ptr %10, align 4, !tbaa !9
  br label %.thread

.thread:                                          ; preds = %15, %23, %33, %27, %19
  %34 = call i32 @xerbla_(ptr noundef nonnull @.str.12, ptr noundef nonnull %10, i32 noundef 6)
  br label %52

35:                                               ; preds = %28
  %36 = fcmp oeq double %12, 0.000000e+00
  br i1 %36, label %52, label %37

37:                                               ; preds = %35
  %38 = load i32, ptr %0, align 4, !tbaa !9
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = call noundef ptr @_Z18get_compact_vectorIdEPT_S1_ii(ptr noundef %3, i32 noundef %38, i32 noundef %39)
  %41 = load i32, ptr %1, align 4, !tbaa !9
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = call noundef ptr @_Z18get_compact_vectorIdEPT_S1_ii(ptr noundef %5, i32 noundef %41, i32 noundef %42)
  %44 = load i32, ptr %0, align 4, !tbaa !9
  %45 = load i32, ptr %1, align 4, !tbaa !9
  %46 = load i32, ptr %8, align 4, !tbaa !9
  call void @_ZN5Eigen8internal20general_rank1_updateIdiLi0ELb0ELb0EE3runEiiPdiPKdS5_d(i32 noundef %44, i32 noundef %45, ptr noundef %7, i32 noundef %46, ptr noundef %40, ptr noundef %43, double noundef %12)
  %.not33 = icmp eq ptr %40, %3
  %47 = icmp eq ptr %40, null
  %or.cond = or i1 %.not33, %47
  br i1 %or.cond, label %49, label %48

48:                                               ; preds = %37
  call void @_ZdaPv(ptr noundef nonnull %40) #6
  br label %49

49:                                               ; preds = %48, %37
  %.not34 = icmp eq ptr %43, %5
  %50 = icmp eq ptr %43, null
  %or.cond35 = or i1 %.not34, %50
  br i1 %or.cond35, label %52, label %51

51:                                               ; preds = %49
  call void @_ZdaPv(ptr noundef nonnull %43) #6
  br label %52

52:                                               ; preds = %49, %51, %35, %.thread
  %.0 = phi i32 [ %34, %.thread ], [ 1, %35 ], [ 1, %51 ], [ 1, %49 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  ret i32 %.0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Eigen8internal20general_rank1_updateIdiLi0ELb0ELb0EE3runEiiPdiPKdS5_d(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #3 align 2

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


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass