; LLVM IR from simbody/simbody :: SimTKmath/Optimizers/src/IpOpt (IpCompoundMatrix)

; 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.SimTKIpopt::SmartPtr.5" = type { ptr }
%"class.SimTKIpopt::CompoundMatrix" = type <{ %"class.SimTKIpopt::Matrix.base", [3 x i8], %"class.std::vector.6", %"class.std::vector.11", ptr, i8, [7 x i8] }>
%"class.SimTKIpopt::Matrix.base" = type <{ %"class.SimTKIpopt::TaggedObject", %"class.SimTKIpopt::SmartPtr.5", i32, i8 }>
%"class.SimTKIpopt::TaggedObject" = type { %"class.SimTKIpopt::ReferencedObject.base", %"class.SimTKIpopt::Subject", i32, i32 }
%"class.SimTKIpopt::ReferencedObject.base" = type <{ ptr, i32 }>
%"class.SimTKIpopt::Subject" = type { ptr, %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<SimTKIpopt::Observer *, std::allocator<SimTKIpopt::Observer *>>::_Vector_impl" }
%"struct.std::_Vector_base<SimTKIpopt::Observer *, std::allocator<SimTKIpopt::Observer *>>::_Vector_impl" = type { %"struct.std::_Vector_base<SimTKIpopt::Observer *, std::allocator<SimTKIpopt::Observer *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SimTKIpopt::Observer *, std::allocator<SimTKIpopt::Observer *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.6" = type { %"struct.std::_Vector_base.7" }
%"struct.std::_Vector_base.7" = type { %"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<SimTKIpopt::Matrix>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>, std::allocator<std::vector<SimTKIpopt::SmartPtr<const SimTKIpopt::Matrix>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

declare i32 @__gxx_personality_v0(...)

; 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 void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetCompSpaceEii(ptr dead_on_unwind noalias writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8, ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK10SimTKIpopt14CompoundMatrix13MatricesValidEv(ptr noundef nonnull align 8 dereferenceable(129) %0) #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.SimTKIpopt::SmartPtr.5", align 8
  %8 = alloca i1, align 1
  %9 = alloca i1, align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.SimTKIpopt::SmartPtr.5", align 8
  %13 = alloca i1, align 1
  %14 = alloca i1, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  store i8 1, ptr %3, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !11
  br label %16

16:                                               ; preds = %102, %1
  %17 = load i32, ptr %4, align 4, !tbaa !11
  %18 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129) %15)
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %105

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %97, %21
  %23 = load i32, ptr %6, align 4, !tbaa !11
  %24 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %15)
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 5, ptr %5, align 4
  br label %100

27:                                               ; preds = %22
  %28 = load i32, ptr %4, align 4, !tbaa !11
  %29 = load i32, ptr %6, align 4, !tbaa !11
  %30 = call noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %15, i32 noundef %28, i32 noundef %29)
  %31 = icmp ne ptr %30, null
  store i1 false, ptr %8, align 1
  store i1 false, ptr %9, align 1
  store i1 false, ptr %13, align 1
  store i1 false, ptr %14, align 1
  br i1 %31, label %39, label %32

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i1 true, ptr %8, align 1
  %33 = getelementptr inbounds %"class.SimTKIpopt::CompoundMatrix", ptr %15, i32 0, i32 4
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  %35 = load i32, ptr %4, align 4, !tbaa !11
  %36 = load i32, ptr %6, align 4, !tbaa !11
  call void @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetCompSpaceEii(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8 %7, ptr noundef nonnull align 8 dereferenceable(129) %34, i32 noundef %35, i32 noundef %36)
  store i1 true, ptr %9, align 1
  %37 = invoke noundef zeroext i1 @_ZN10SimTKIpopt7IsValidIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %38 unwind label %70

38:                                               ; preds = %32
  br i1 %37, label %55, label %39

39:                                               ; preds = %38, %27
  %40 = load i32, ptr %4, align 4, !tbaa !11
  %41 = load i32, ptr %6, align 4, !tbaa !11
  %42 = invoke noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %15, i32 noundef %40, i32 noundef %41)
          to label %43 unwind label %70

43:                                               ; preds = %39
  %44 = icmp ne ptr %42, null
  br i1 %44, label %45, label %53

45:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i1 true, ptr %13, align 1
  %46 = getelementptr inbounds %"class.SimTKIpopt::CompoundMatrix", ptr %15, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !13
  %48 = load i32, ptr %4, align 4, !tbaa !11
  %49 = load i32, ptr %6, align 4, !tbaa !11
  invoke void @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetCompSpaceEii(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8 %12, ptr noundef nonnull align 8 dereferenceable(129) %47, i32 noundef %48, i32 noundef %49)
          to label %50 unwind label %74

50:                                               ; preds = %45
  store i1 true, ptr %14, align 1
  %51 = invoke noundef zeroext i1 @_ZN10SimTKIpopt6IsNullIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %52 unwind label %78

52:                                               ; preds = %50
  br label %53

53:                                               ; preds = %52, %43
  %54 = phi i1 [ false, %43 ], [ %51, %52 ]
  br label %55

55:                                               ; preds = %53, %38
  %56 = phi i1 [ true, %38 ], [ %54, %53 ]
  %57 = load i1, ptr %14, align 1
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  br label %59

59:                                               ; preds = %58, %55
  %60 = load i1, ptr %13, align 1
  br i1 %60, label %61, label %62

61:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %62

62:                                               ; preds = %61, %59
  %63 = load i1, ptr %9, align 1
  br i1 %63, label %64, label %65

64:                                               ; preds = %62
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br label %65

65:                                               ; preds = %64, %62
  %66 = load i1, ptr %8, align 1
  br i1 %66, label %67, label %68

67:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %68

68:                                               ; preds = %67, %65
  br i1 %56, label %69, label %96

69:                                               ; preds = %68
  store i8 0, ptr %3, align 1, !tbaa !9
  store i32 5, ptr %5, align 4
  br label %100

70:                                               ; preds = %39, %32
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %10, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %11, align 4
  br label %89

74:                                               ; preds = %45
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %10, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %11, align 4
  br label %85

78:                                               ; preds = %50
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %10, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %11, align 4
  %82 = load i1, ptr %14, align 1
  br i1 %82, label %83, label %84

83:                                               ; preds = %78
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  br label %84

84:                                               ; preds = %83, %78
  br label %85

85:                                               ; preds = %84, %74
  %86 = load i1, ptr %13, align 1
  br i1 %86, label %87, label %88

87:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %88

88:                                               ; preds = %87, %85
  br label %89

89:                                               ; preds = %88, %70
  %90 = load i1, ptr %9, align 1
  br i1 %90, label %91, label %92

91:                                               ; preds = %89
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br label %92

92:                                               ; preds = %91, %89
  %93 = load i1, ptr %8, align 1
  br i1 %93, label %94, label %95

94:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %95

95:                                               ; preds = %94, %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  br label %108

96:                                               ; preds = %68
  br label %97

97:                                               ; preds = %96
  %98 = load i32, ptr %6, align 4, !tbaa !11
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %6, align 4, !tbaa !11
  br label %22, !llvm.loop !32

100:                                              ; preds = %69, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %101

101:                                              ; preds = %100
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %4, align 4, !tbaa !11
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %4, align 4, !tbaa !11
  br label %16, !llvm.loop !34

105:                                              ; preds = %20
  %106 = load i8, ptr %3, align 1, !tbaa !9, !range !35, !noundef !36
  %107 = trunc i8 %106 to i1
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  ret i1 %107

108:                                              ; preds = %95
  %109 = load ptr, ptr %10, align 8
  %110 = load i32, ptr %11, align 4
  %111 = insertvalue { ptr, i32 } poison, ptr %109, 0
  %112 = insertvalue { ptr, i32 } %111, i32 %110, 1
  resume { ptr, i32 } %112
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt7IsValidIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt6IsNullIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8)) #1

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 = { 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 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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 120}
!14 = !{!"_ZTSN10SimTKIpopt14CompoundMatrixE", !15, i64 0, !24, i64 72, !28, i64 96, !6, i64 120, !10, i64 128}
!15 = !{!"_ZTSN10SimTKIpopt6MatrixE", !16, i64 0, !23, i64 56, !12, i64 64, !10, i64 68}
!16 = !{!"_ZTSN10SimTKIpopt12TaggedObjectE", !17, i64 0, !18, i64 16, !12, i64 48, !12, i64 52}
!17 = !{!"_ZTSN10SimTKIpopt16ReferencedObjectE", !12, i64 8}
!18 = !{!"_ZTSN10SimTKIpopt7SubjectE", !19, i64 8}
!19 = !{!"_ZTSSt6vectorIPN10SimTKIpopt8ObserverESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!23 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEEE", !6, i64 0}
!24 = !{!"_ZTSSt6vectorIS_IN10SimTKIpopt8SmartPtrINS0_6MatrixEEESaIS3_EESaIS5_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!28 = !{!"_ZTSSt6vectorIS_IN10SimTKIpopt8SmartPtrIKNS0_6MatrixEEESaIS4_EESaIS6_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}
!34 = distinct !{!34, !33}
!35 = !{i8 0, i8 2}
!36 = !{}


; 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.SimTKIpopt::SmartPtr.5" = type { ptr }

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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetCompSpaceEii(ptr dead_on_unwind noalias writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8, ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK10SimTKIpopt14CompoundMatrix13MatricesValidEv(ptr noundef nonnull align 8 dereferenceable(129) %0) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.SimTKIpopt::SmartPtr.5", align 8
  %3 = alloca %"class.SimTKIpopt::SmartPtr.5", align 8
  %4 = tail call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.preheader.lr.ph, label %._crit_edge

.preheader.lr.ph:                                 ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 120
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.loopexit
  %.03162 = phi i32 [ 0, %.preheader.lr.ph ], [ %30, %.loopexit ]
  %.03261 = phi i1 [ true, %.preheader.lr.ph ], [ %.133, %.loopexit ]
  %7 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.loopexit

._crit_edge:                                      ; preds = %.loopexit, %1
  %.032.lcssa = phi i1 [ true, %1 ], [ %.133, %.loopexit ]
  ret i1 %.032.lcssa

.lr.ph:                                           ; preds = %.preheader, %.critedge37.thread
  %.03057 = phi i32 [ %27, %.critedge37.thread ], [ 0, %.preheader ]
  %9 = call noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %0, i32 noundef %.03162, i32 noundef %.03057)
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %15

10:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetCompSpaceEii(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8 %2, ptr noundef nonnull align 8 dereferenceable(129) %11, i32 noundef %.03162, i32 noundef %.03057)
  %12 = invoke noundef zeroext i1 @_ZN10SimTKIpopt7IsValidIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %14 unwind label %.thread45

.thread45:                                        ; preds = %10
  %13 = landingpad { ptr, i32 }
          cleanup
  br label %26

14:                                               ; preds = %10
  br i1 %12, label %.thread49, label %15

.thread49:                                        ; preds = %14
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %.loopexit

15:                                               ; preds = %14, %.lr.ph
  %16 = invoke noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %0, i32 noundef %.03162, i32 noundef %.03057)
          to label %17 unwind label %24

17:                                               ; preds = %15
  %.not34 = icmp eq ptr %16, null
  br i1 %.not34, label %.thread, label %18

18:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetCompSpaceEii(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8 %3, ptr noundef nonnull align 8 dereferenceable(129) %19, i32 noundef %.03162, i32 noundef %.03057)
          to label %.critedge unwind label %22

.thread:                                          ; preds = %17
  br i1 %.not, label %.thread50, label %.critedge37.thread

.thread50:                                        ; preds = %.thread
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %.critedge37.thread

.critedge:                                        ; preds = %18
  %20 = call noundef zeroext i1 @_ZN10SimTKIpopt6IsNullIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br i1 %.not, label %21, label %.critedge37

21:                                               ; preds = %.critedge
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br i1 %20, label %.loopexit, label %.critedge37.thread

.critedge37:                                      ; preds = %.critedge
  br i1 %20, label %.loopexit, label %.critedge37.thread

22:                                               ; preds = %18
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  br i1 %.not, label %26, label %.critedge39

24:                                               ; preds = %15
  %25 = landingpad { ptr, i32 }
          cleanup
  br i1 %.not, label %26, label %.critedge39

26:                                               ; preds = %.thread45, %22, %24
  %.pn44 = phi { ptr, i32 } [ %23, %22 ], [ %25, %24 ], [ %13, %.thread45 ]
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %.critedge39

.critedge39:                                      ; preds = %22, %24, %26
  %.pn43 = phi { ptr, i32 } [ %23, %22 ], [ %25, %24 ], [ %.pn44, %26 ]
  resume { ptr, i32 } %.pn43

.critedge37.thread:                               ; preds = %.thread, %.thread50, %21, %.critedge37
  %27 = add nuw nsw i32 %.03057, 1
  %28 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph, label %.loopexit, !llvm.loop !29

.loopexit:                                        ; preds = %.critedge37.thread, %.critedge37, %21, %.preheader, %.thread49
  %.133 = phi i1 [ false, %.thread49 ], [ %.03261, %.preheader ], [ %.03261, %.critedge37.thread ], [ false, %.critedge37 ], [ false, %21 ]
  %30 = add nuw nsw i32 %.03162, 1
  %31 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.preheader, label %._crit_edge, !llvm.loop !31
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt7IsValidIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt6IsNullIKNS_11MatrixSpaceEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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 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, !18, i64 120}
!6 = !{!"_ZTSN10SimTKIpopt14CompoundMatrixE", !7, i64 0, !21, i64 72, !25, i64 96, !18, i64 120, !20, i64 128}
!7 = !{!"_ZTSN10SimTKIpopt6MatrixE", !8, i64 0, !19, i64 56, !10, i64 64, !20, i64 68}
!8 = !{!"_ZTSN10SimTKIpopt12TaggedObjectE", !9, i64 0, !13, i64 16, !10, i64 48, !10, i64 52}
!9 = !{!"_ZTSN10SimTKIpopt16ReferencedObjectE", !10, i64 8}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSN10SimTKIpopt7SubjectE", !14, i64 8}
!14 = !{!"_ZTSSt6vectorIPN10SimTKIpopt8ObserverESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"any pointer", !11, i64 0}
!19 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEEE", !18, i64 0}
!20 = !{!"bool", !11, i64 0}
!21 = !{!"_ZTSSt6vectorIS_IN10SimTKIpopt8SmartPtrINS0_6MatrixEEESaIS3_EESaIS5_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!25 = !{!"_ZTSSt6vectorIS_IN10SimTKIpopt8SmartPtrIKNS0_6MatrixEEESaIS4_EESaIS6_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass