; LLVM IR from o0o0o0o0o0o0o/image-processing-from-scratch :: ImageMatting/Eigen/lapack (complex_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.2 = external hidden unnamed_addr constant [7 x i8], align 1

; 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)) #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @zgetrf_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %20 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %20, align 4, !tbaa !9
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  %22 = load i32, ptr %21, align 4, !tbaa !9
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %6
  %25 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 -1, ptr %25, align 4, !tbaa !9
  br label %43

26:                                               ; preds = %6
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %32

30:                                               ; preds = %26
  %31 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 -2, ptr %31, align 4, !tbaa !9
  br label %42

32:                                               ; preds = %26
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = load i32, ptr %33, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1, ptr %14, align 4, !tbaa !9
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = icmp slt i32 %34, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br i1 %38, label %39, label %41

39:                                               ; preds = %32
  %40 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 -4, ptr %40, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %39, %32
  br label %42

42:                                               ; preds = %41, %30
  br label %43

43:                                               ; preds = %42, %24
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %52

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = sub nsw i32 0, %49
  store i32 %50, ptr %15, align 4, !tbaa !9
  %51 = call i32 @xerbla_(ptr noundef @.str.2, ptr noundef %15, i32 noundef 6)
  store i32 %51, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %102

52:                                               ; preds = %43
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %60, label %56

56:                                               ; preds = %52
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %56, %52
  store i32 0, ptr %7, align 4
  br label %102

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %62, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = load i32, ptr %63, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = load ptr, ptr %16, align 8, !tbaa !5
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = call noundef i64 @_ZN5Eigen8internal15partial_lu_implISt7complexIdELi0EiE10blocked_luEllPS3_lPiRil(i64 noundef %65, i64 noundef %68, ptr noundef %69, i64 noundef %72, ptr noundef %73, ptr noundef nonnull align 4 dereferenceable(4) %17, i64 noundef 256)
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %91, %61
  %77 = load i32, ptr %19, align 4, !tbaa !9
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %78, ptr noundef nonnull align 4 dereferenceable(4) %79)
  %81 = load i32, ptr %80, align 4, !tbaa !9
  %82 = icmp slt i32 %77, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %94

84:                                               ; preds = %76
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = load i32, ptr %19, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds i32, ptr %85, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %88, align 4, !tbaa !9
  br label %91

91:                                               ; preds = %84
  %92 = load i32, ptr %19, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %19, align 4, !tbaa !9
  br label %76, !llvm.loop !11

94:                                               ; preds = %83
  %95 = load i32, ptr %18, align 4, !tbaa !9
  %96 = icmp sge i32 %95, 0
  br i1 %96, label %97, label %101

97:                                               ; preds = %94
  %98 = load i32, ptr %18, align 4, !tbaa !9
  %99 = add nsw i32 %98, 1
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 %99, ptr %100, align 4, !tbaa !9
  br label %101

101:                                              ; preds = %97, %94
  store i32 0, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %102

102:                                              ; preds = %101, %60, %47
  %103 = load i32, ptr %7, align 4
  ret i32 %103
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN5Eigen8internal15partial_lu_implISt7complexIdELi0EiE10blocked_luEllPS3_lPiRil(i64 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), i64 noundef) #3 align 2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.2 = external hidden unnamed_addr constant [7 x i8], align 1

; 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 #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @zgetrf_(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, ptr noundef %4, ptr nocapture noundef %5) local_unnamed_addr #3 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %5, align 4, !tbaa !5
  %10 = load i32, ptr %0, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 0
  br i1 %11, label %.thread.sink.split, label %12

12:                                               ; preds = %6
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %.thread.sink.split, label %15

15:                                               ; preds = %12
  %16 = load i32, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  store i32 1, ptr %7, align 4, !tbaa !5
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %0)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp slt i32 %16, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  br i1 %19, label %.thread.sink.split, label %20

20:                                               ; preds = %15
  %.pr = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %.pr, 0
  br i1 %.not, label %24, label %.thread

.thread.sink.split:                               ; preds = %15, %12, %6
  %.sink = phi i32 [ -1, %6 ], [ -2, %12 ], [ -4, %15 ]
  store i32 %.sink, ptr %5, align 4, !tbaa !5
  br label %.thread

.thread:                                          ; preds = %.thread.sink.split, %20
  %21 = phi i32 [ %.pr, %20 ], [ %.sink, %.thread.sink.split ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #4
  %22 = sub nsw i32 0, %21
  store i32 %22, ptr %8, align 4, !tbaa !5
  %23 = call i32 @xerbla_(ptr noundef nonnull @.str.2, ptr noundef nonnull %8, i32 noundef 6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #4
  br label %51

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

27:                                               ; preds = %24
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %51, label %30

30:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #4
  %31 = sext i32 %25 to i64
  %32 = sext i32 %28 to i64
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = call noundef i64 @_ZN5Eigen8internal15partial_lu_implISt7complexIdELi0EiE10blocked_luEllPS3_lPiRil(i64 noundef %31, i64 noundef %32, ptr noundef %2, i64 noundef %34, ptr noundef %4, ptr noundef nonnull align 4 dereferenceable(4) %9, i64 noundef 256)
  %36 = trunc i64 %35 to i32
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %30
  %40 = icmp sgt i32 %36, -1
  br i1 %40, label %48, label %50

.lr.ph:                                           ; preds = %30, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %30 ]
  %41 = getelementptr inbounds i32, ptr %4, i64 %indvars.iv
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next, %46
  br i1 %47, label %.lr.ph, label %._crit_edge, !llvm.loop !9

48:                                               ; preds = %._crit_edge
  %49 = add nuw nsw i32 %36, 1
  store i32 %49, ptr %5, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %48, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #4
  br label %51

51:                                               ; preds = %24, %27, %50, %.thread
  %.027 = phi i32 [ %23, %.thread ], [ 0, %50 ], [ 0, %27 ], [ 0, %24 ]
  ret i32 %.027
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN5Eigen8internal15partial_lu_implISt7complexIdELi0EiE10blocked_luEllPS3_lPiRil(i64 noundef, i64 noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), i64 noundef) local_unnamed_addr #3 align 2

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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