; LLVM IR from ERGO-Code/HiGHS :: src/ipm/ipx/forrest_tomlin.ll (ZN3ipx13ForrestTomlin23_NeedFreshFactorizationEv)

; 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.ipx::ForrestTomlin" = type { %"class.ipx::LuUpdate.base", ptr, i32, %"class.std::unique_ptr", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.ipx::SparseMatrix", %"class.ipx::SparseMatrix", %"class.ipx::SparseMatrix", %"class.std::vector", i32, i8, i8, double, double, %"class.std::valarray" }
%"class.ipx::LuUpdate.base" = type <{ ptr, i32 }>
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.1" }
%"struct.std::_Head_base.1" = type { ptr }
%"class.ipx::SparseMatrix" = type { i32, %"class.std::vector", %"class.std::vector", %"class.std::vector.5", %"class.std::vector", %"class.std::vector.5" }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::valarray" = type { i64, ptr }

; 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: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3ipx12SparseMatrix5beginEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3ipx13ForrestTomlin23_NeedFreshFactorizationEv(ptr noundef nonnull align 8 dereferenceable(608) %0) unnamed_addr #2 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %11 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 12
  %12 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  %13 = trunc i64 %12 to i32
  store i32 %13, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %14 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 11
  %15 = call noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128) %14)
  store i32 %15, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %16 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 9
  %17 = call noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128) %16)
  %18 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !11
  %20 = add nsw i32 %17, %19
  store i32 %20, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %21 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 10
  %22 = call noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128) %21)
  store i32 %22, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %23 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 10
  %24 = getelementptr inbounds %"class.ipx::ForrestTomlin", ptr %10, i32 0, i32 2
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = call noundef i32 @_ZNK3ipx12SparseMatrix5beginEi(ptr noundef nonnull align 8 dereferenceable(128) %23, i32 noundef %25)
  store i32 %26, ptr %8, align 4, !tbaa !9
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 5000
  br i1 %28, label %29, label %30

29:                                               ; preds = %1
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %51

30:                                               ; preds = %1
  %31 = load i32, ptr %4, align 4, !tbaa !9
  %32 = icmp slt i32 %31, 100
  br i1 %32, label %33, label %34

33:                                               ; preds = %30
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %51

34:                                               ; preds = %30
  %35 = load i32, ptr %5, align 4, !tbaa !9
  %36 = sitofp i32 %35 to double
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = sitofp i32 %37 to double
  %39 = fmul double 1.000000e+00, %38
  %40 = fcmp ogt double %36, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %34
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %51

42:                                               ; preds = %34
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sitofp i32 %43 to double
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = sitofp i32 %45 to double
  %47 = fmul double 1.700000e+00, %46
  %48 = fcmp ogt double %44, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %42
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %51

50:                                               ; preds = %42
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %51

51:                                               ; preds = %50, %49, %41, %33, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %52 = load i1, ptr %2, align 1
  ret i1 %52
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = { 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 = !{!12, !10, i64 24}
!12 = !{!"_ZTSN3ipx13ForrestTomlinE", !13, i64 0, !6, i64 16, !10, i64 24, !14, i64 32, !20, i64 40, !20, i64 64, !20, i64 88, !20, i64 112, !20, i64 136, !24, i64 160, !24, i64 288, !24, i64 416, !20, i64 544, !10, i64 568, !29, i64 572, !29, i64 573, !30, i64 576, !30, i64 584, !31, i64 592}
!13 = !{!"_ZTSN3ipx8LuUpdateE", !10, i64 8}
!14 = !{!"_ZTSSt10unique_ptrIN3ipx15LuFactorizationESt14default_deleteIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt15__uniq_ptr_dataIN3ipx15LuFactorizationESt14default_deleteIS1_ELb1ELb1EE", !16, i64 0}
!16 = !{!"_ZTSSt15__uniq_ptr_implIN3ipx15LuFactorizationESt14default_deleteIS1_EE", !17, i64 0}
!17 = !{!"_ZTSSt5tupleIJPN3ipx15LuFactorizationESt14default_deleteIS1_EEE", !18, i64 0}
!18 = !{!"_ZTSSt11_Tuple_implILm0EJPN3ipx15LuFactorizationESt14default_deleteIS1_EEE", !19, i64 0}
!19 = !{!"_ZTSSt10_Head_baseILm0EPN3ipx15LuFactorizationELb0EE", !6, i64 0}
!20 = !{!"_ZTSSt6vectorIiSaIiEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSN3ipx12SparseMatrixE", !10, i64 0, !20, i64 8, !20, i64 32, !25, i64 56, !20, i64 80, !25, i64 104}
!25 = !{!"_ZTSSt6vectorIdSaIdEE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"bool", !7, i64 0}
!30 = !{!"double", !7, i64 0}
!31 = !{!"_ZTSSt8valarrayIdE", !32, i64 0, !6, i64 8}
!32 = !{!"long", !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"

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK3ipx12SparseMatrix5beginEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3ipx13ForrestTomlin23_NeedFreshFactorizationEv(ptr noundef nonnull align 8 dereferenceable(608) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 544
  %3 = tail call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #1
  %4 = trunc i64 %3 to i32
  %5 = getelementptr inbounds i8, ptr %0, i64 416
  %6 = tail call noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128) %5)
  %7 = getelementptr inbounds i8, ptr %0, i64 160
  %8 = tail call noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128) %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = add nsw i32 %10, %8
  %12 = getelementptr inbounds i8, ptr %0, i64 288
  %13 = tail call noundef i32 @_ZNK3ipx12SparseMatrix7entriesEv(ptr noundef nonnull align 8 dereferenceable(128) %12)
  %14 = load i32, ptr %9, align 8, !tbaa !5
  %15 = tail call noundef i32 @_ZNK3ipx12SparseMatrix5beginEi(ptr noundef nonnull align 8 dereferenceable(128) %12, i32 noundef %14)
  %16 = icmp eq i32 %4, 5000
  br i1 %16, label %26, label %17

17:                                               ; preds = %1
  %18 = icmp slt i32 %4, 100
  br i1 %18, label %26, label %19

19:                                               ; preds = %17
  %20 = icmp sgt i32 %6, %11
  br i1 %20, label %26, label %21

21:                                               ; preds = %19
  %22 = sitofp i32 %13 to double
  %23 = sitofp i32 %15 to double
  %24 = fmul double %23, 1.700000e+00
  %25 = fcmp olt double %24, %22
  br label %26

26:                                               ; preds = %21, %19, %17, %1
  %.0 = phi i1 [ true, %1 ], [ false, %17 ], [ true, %19 ], [ %25, %21 ]
  ret i1 %.0
}

attributes #0 = { 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 = { 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, !8, i64 24}
!6 = !{!"_ZTSN3ipx13ForrestTomlinE", !7, i64 0, !11, i64 16, !8, i64 24, !12, i64 32, !18, i64 40, !18, i64 64, !18, i64 88, !18, i64 112, !18, i64 136, !22, i64 160, !22, i64 288, !22, i64 416, !18, i64 544, !8, i64 568, !27, i64 572, !27, i64 573, !28, i64 576, !28, i64 584, !29, i64 592}
!7 = !{!"_ZTSN3ipx8LuUpdateE", !8, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTSSt10unique_ptrIN3ipx15LuFactorizationESt14default_deleteIS1_EE", !13, i64 0}
!13 = !{!"_ZTSSt15__uniq_ptr_dataIN3ipx15LuFactorizationESt14default_deleteIS1_ELb1ELb1EE", !14, i64 0}
!14 = !{!"_ZTSSt15__uniq_ptr_implIN3ipx15LuFactorizationESt14default_deleteIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt5tupleIJPN3ipx15LuFactorizationESt14default_deleteIS1_EEE", !16, i64 0}
!16 = !{!"_ZTSSt11_Tuple_implILm0EJPN3ipx15LuFactorizationESt14default_deleteIS1_EEE", !17, i64 0}
!17 = !{!"_ZTSSt10_Head_baseILm0EPN3ipx15LuFactorizationELb0EE", !11, i64 0}
!18 = !{!"_ZTSSt6vectorIiSaIiEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!22 = !{!"_ZTSN3ipx12SparseMatrixE", !8, i64 0, !18, i64 8, !18, i64 32, !23, i64 56, !18, i64 80, !23, i64 104}
!23 = !{!"_ZTSSt6vectorIdSaIdEE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!27 = !{!"bool", !9, i64 0}
!28 = !{!"double", !9, i64 0}
!29 = !{!"_ZTSSt8valarrayIdE", !30, i64 0, !11, i64 8}
!30 = !{!"long", !9, i64 0}


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