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

@_ZTIN10SimTKIpopt6VectorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14CompoundVectorE = external constant 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129)) #1 align 2

; Function Attrs: nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrINS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10SimTKIpopt14CompoundMatrix13AddMSinvZImplEdRKNS_6VectorES3_RS1_(ptr noundef nonnull align 8 dereferenceable(129) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(205) %2, ptr noundef nonnull align 8 dereferenceable(205) %3, ptr noundef nonnull align 8 dereferenceable(205) %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %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 %"class.SimTKIpopt::SmartPtr.43", align 8
  %17 = alloca %"class.SimTKIpopt::SmartPtr.43", align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %22 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %23 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %24 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %30, label %28

28:                                               ; preds = %5
  %29 = call ptr @__dynamic_cast(ptr %26, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  br label %31

30:                                               ; preds = %5
  br label %31

31:                                               ; preds = %30, %28
  %32 = phi ptr [ %29, %28 ], [ null, %30 ]
  store ptr %32, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br i1 %34, label %37, label %35

35:                                               ; preds = %31
  %36 = call ptr @__dynamic_cast(ptr %33, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  br label %38

37:                                               ; preds = %31
  br label %38

38:                                               ; preds = %37, %35
  %39 = phi ptr [ %36, %35 ], [ null, %37 ]
  store ptr %39, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %44, label %42

42:                                               ; preds = %38
  %43 = call ptr @__dynamic_cast(ptr %40, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  br label %45

44:                                               ; preds = %38
  br label %45

45:                                               ; preds = %44, %42
  %46 = phi ptr [ %43, %42 ], [ null, %44 ]
  store ptr %46, ptr %13, align 8, !tbaa !5
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %50

49:                                               ; preds = %45
  br label %51

50:                                               ; preds = %45
  br label %51

51:                                               ; preds = %50, %49
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %51
  br label %56

55:                                               ; preds = %51
  br label %56

56:                                               ; preds = %55, %54
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %56
  br label %61

60:                                               ; preds = %56
  br label %61

61:                                               ; preds = %60, %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %62

62:                                               ; preds = %209, %61
  %63 = load i32, ptr %14, align 4, !tbaa !11
  %64 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %25)
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 2, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %213

67:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16)
  %68 = load ptr, ptr %13, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %85

70:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %71 = load ptr, ptr %13, align 8, !tbaa !5
  %72 = load i32, ptr %14, align 4, !tbaa !11
  invoke void @_ZN10SimTKIpopt14CompoundVector15GetCompNonConstEi(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.43") align 8 %17, ptr noundef nonnull align 8 dereferenceable(265) %71, i32 noundef %72)
          to label %73 unwind label %76

73:                                               ; preds = %70
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17)
          to label %75 unwind label %80

75:                                               ; preds = %73
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %93

76:                                               ; preds = %70
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %18, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %19, align 4
  br label %84

80:                                               ; preds = %73
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %18, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %19, align 4
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br label %84

84:                                               ; preds = %80, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %212

85:                                               ; preds = %67
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef %86)
          to label %88 unwind label %89

88:                                               ; preds = %85
  br label %93

89:                                               ; preds = %85
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %18, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %19, align 4
  br label %212

93:                                               ; preds = %88, %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %94

94:                                               ; preds = %204, %93
  %95 = load i32, ptr %20, align 4, !tbaa !11
  %96 = invoke noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %25)
          to label %97 unwind label %100

97:                                               ; preds = %94
  %98 = icmp slt i32 %95, %96
  br i1 %98, label %104, label %99

99:                                               ; preds = %97
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %208

100:                                              ; preds = %118, %113, %104, %94
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %18, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %19, align 4
  br label %207

104:                                              ; preds = %97
  %105 = getelementptr inbounds %"class.SimTKIpopt::CompoundMatrix", ptr %25, i32 0, i32 4
  %106 = load ptr, ptr %105, align 8, !tbaa !13
  %107 = invoke noundef zeroext i1 @_ZNK10SimTKIpopt19CompoundMatrixSpace8DiagonalEv(ptr noundef nonnull align 8 dereferenceable(129) %106)
          to label %108 unwind label %100

108:                                              ; preds = %104
  br i1 %107, label %109, label %113

109:                                              ; preds = %108
  %110 = load i32, ptr %14, align 4, !tbaa !11
  %111 = load i32, ptr %20, align 4, !tbaa !11
  %112 = icmp eq i32 %110, %111
  br i1 %112, label %124, label %113

113:                                              ; preds = %109, %108
  %114 = getelementptr inbounds %"class.SimTKIpopt::CompoundMatrix", ptr %25, i32 0, i32 4
  %115 = load ptr, ptr %114, align 8, !tbaa !13
  %116 = invoke noundef zeroext i1 @_ZNK10SimTKIpopt19CompoundMatrixSpace8DiagonalEv(ptr noundef nonnull align 8 dereferenceable(129) %115)
          to label %117 unwind label %100

117:                                              ; preds = %113
  br i1 %116, label %203, label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %20, align 4, !tbaa !11
  %120 = load i32, ptr %14, align 4, !tbaa !11
  %121 = invoke noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %25, i32 noundef %119, i32 noundef %120)
          to label %122 unwind label %100

122:                                              ; preds = %118
  %123 = icmp ne ptr %121, null
  br i1 %123, label %124, label %203

124:                                              ; preds = %122, %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  invoke void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %21)
          to label %125 unwind label %134

125:                                              ; preds = %124
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  %127 = icmp ne ptr %126, null
  br i1 %127, label %128, label %147

128:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %129 = load ptr, ptr %11, align 8, !tbaa !5
  %130 = load i32, ptr %20, align 4, !tbaa !11
  invoke void @_ZNK10SimTKIpopt14CompoundVector7GetCompEi(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.54") align 8 %22, ptr noundef nonnull align 8 dereferenceable(265) %129, i32 noundef %130)
          to label %131 unwind label %138

131:                                              ; preds = %128
  %132 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22)
          to label %133 unwind label %142

133:                                              ; preds = %131
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %155

134:                                              ; preds = %124
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %18, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %19, align 4
  br label %202

138:                                              ; preds = %128
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %18, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %19, align 4
  br label %146

142:                                              ; preds = %131
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %18, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %19, align 4
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %22) #6
  br label %146

146:                                              ; preds = %142, %138
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  br label %201

147:                                              ; preds = %125
  %148 = load ptr, ptr %8, align 8, !tbaa !5
  %149 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef %148)
          to label %150 unwind label %151

150:                                              ; preds = %147
  br label %155

151:                                              ; preds = %147
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %18, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %19, align 4
  br label %201

155:                                              ; preds = %150, %133
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  invoke void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %156 unwind label %165

156:                                              ; preds = %155
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = icmp ne ptr %157, null
  br i1 %158, label %159, label %178

159:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  %160 = load ptr, ptr %12, align 8, !tbaa !5
  %161 = load i32, ptr %20, align 4, !tbaa !11
  invoke void @_ZNK10SimTKIpopt14CompoundVector7GetCompEi(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.54") align 8 %24, ptr noundef nonnull align 8 dereferenceable(265) %160, i32 noundef %161)
          to label %162 unwind label %169

162:                                              ; preds = %159
  %163 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %164 unwind label %173

164:                                              ; preds = %162
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %186

165:                                              ; preds = %155
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %18, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %19, align 4
  br label %200

169:                                              ; preds = %159
  %170 = landingpad { ptr, i32 }
          cleanup
  %171 = extractvalue { ptr, i32 } %170, 0
  store ptr %171, ptr %18, align 8
  %172 = extractvalue { ptr, i32 } %170, 1
  store i32 %172, ptr %19, align 4
  br label %177

173:                                              ; preds = %162
  %174 = landingpad { ptr, i32 }
          cleanup
  %175 = extractvalue { ptr, i32 } %174, 0
  store ptr %175, ptr %18, align 8
  %176 = extractvalue { ptr, i32 } %174, 1
  store i32 %176, ptr %19, align 4
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %24) #6
  br label %177

177:                                              ; preds = %173, %169
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %199

178:                                              ; preds = %156
  %179 = load ptr, ptr %9, align 8, !tbaa !5
  %180 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef %179)
          to label %181 unwind label %182

181:                                              ; preds = %178
  br label %186

182:                                              ; preds = %197, %195, %193, %190, %186, %178
  %183 = landingpad { ptr, i32 }
          cleanup
  %184 = extractvalue { ptr, i32 } %183, 0
  store ptr %184, ptr %18, align 8
  %185 = extractvalue { ptr, i32 } %183, 1
  store i32 %185, ptr %19, align 4
  br label %199

186:                                              ; preds = %181, %164
  %187 = load i32, ptr %20, align 4, !tbaa !11
  %188 = load i32, ptr %14, align 4, !tbaa !11
  %189 = invoke noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %25, i32 noundef %187, i32 noundef %188)
          to label %190 unwind label %182

190:                                              ; preds = %186
  %191 = load double, ptr %7, align 8, !tbaa !9
  %192 = invoke noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21)
          to label %193 unwind label %182

193:                                              ; preds = %190
  %194 = invoke noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %195 unwind label %182

195:                                              ; preds = %193
  %196 = invoke noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrINS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %197 unwind label %182

197:                                              ; preds = %195
  invoke void @_ZNK10SimTKIpopt6Matrix9AddMSinvZEdRKNS_6VectorES3_RS1_(ptr noundef nonnull align 8 dereferenceable(69) %189, double noundef %191, ptr noundef nonnull align 8 dereferenceable(205) %192, ptr noundef nonnull align 8 dereferenceable(205) %194, ptr noundef nonnull align 8 dereferenceable(205) %196)
          to label %198 unwind label %182

198:                                              ; preds = %197
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %203

199:                                              ; preds = %182, %177
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  br label %200

200:                                              ; preds = %199, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %201

201:                                              ; preds = %200, %151, %146
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  br label %202

202:                                              ; preds = %201, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %207

203:                                              ; preds = %198, %122, %117
  br label %204

204:                                              ; preds = %203
  %205 = load i32, ptr %20, align 4, !tbaa !11
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %20, align 4, !tbaa !11
  br label %94, !llvm.loop !33

207:                                              ; preds = %202, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  br label %212

208:                                              ; preds = %99
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %14, align 4, !tbaa !11
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %14, align 4, !tbaa !11
  br label %62, !llvm.loop !35

212:                                              ; preds = %207, %89, %84
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %214

213:                                              ; preds = %66
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  ret void

214:                                              ; preds = %212
  %215 = load ptr, ptr %18, align 8
  %216 = load i32, ptr %19, align 4
  %217 = insertvalue { ptr, i32 } poison, ptr %215, 0
  %218 = insertvalue { ptr, i32 } %217, i32 %216, 1
  resume { ptr, i32 } %218
}

declare void @_ZNK10SimTKIpopt6Matrix9AddMSinvZEdRKNS_6VectorES3_RS1_(ptr noundef nonnull align 8 dereferenceable(69), double noundef, ptr noundef nonnull align 8 dereferenceable(205), ptr noundef nonnull align 8 dereferenceable(205), ptr noundef nonnull align 8 dereferenceable(205)) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nounwind willreturn memory(read) }
attributes #3 = { 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 #4 = { 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 #5 = { "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 #6 = { 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}
!13 = !{!14, !6, i64 120}
!14 = !{!"_ZTSN10SimTKIpopt14CompoundMatrixE", !15, i64 0, !25, i64 72, !29, i64 96, !6, i64 120, !24, i64 128}
!15 = !{!"_ZTSN10SimTKIpopt6MatrixE", !16, i64 0, !23, i64 56, !12, i64 64, !24, 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 = !{!"bool", !7, i64 0}
!25 = !{!"_ZTSSt6vectorIS_IN10SimTKIpopt8SmartPtrINS0_6MatrixEEESaIS3_EESaIS5_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrINS1_6MatrixEEESaIS4_EESaIS6_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"_ZTSSt6vectorIS_IN10SimTKIpopt8SmartPtrIKNS0_6MatrixEEESaIS4_EESaIS6_EE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseISt6vectorIN10SimTKIpopt8SmartPtrIKNS1_6MatrixEEESaIS5_EESaIS7_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}


; 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.43" = type { ptr }
%"class.SimTKIpopt::SmartPtr.54" = type { ptr }

@_ZTIN10SimTKIpopt6VectorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14CompoundVectorE = external constant 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nofree nounwind willreturn memory(read)
declare ptr @__dynamic_cast(ptr, ptr, ptr, i64) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

; 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 #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrINS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10SimTKIpopt14CompoundMatrix13AddMSinvZImplEdRKNS_6VectorES3_RS1_(ptr noundef nonnull align 8 dereferenceable(129) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(205) %2, ptr noundef nonnull align 8 dereferenceable(205) %3, ptr noundef nonnull align 8 dereferenceable(205) %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.SimTKIpopt::SmartPtr.43", align 8
  %7 = alloca %"class.SimTKIpopt::SmartPtr.43", align 8
  %8 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %9 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %10 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %11 = alloca %"class.SimTKIpopt::SmartPtr.54", align 8
  %12 = tail call ptr @__dynamic_cast(ptr nonnull %2, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  %13 = tail call ptr @__dynamic_cast(ptr nonnull %3, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  %14 = tail call ptr @__dynamic_cast(ptr nonnull %4, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  %15 = tail call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %5
  %.not = icmp eq ptr %14, null
  %17 = getelementptr inbounds i8, ptr %0, i64 120
  %.not44 = icmp eq ptr %12, null
  %.not47 = icmp eq ptr %13, null
  br label %18

._crit_edge:                                      ; preds = %36, %5
  ret void

18:                                               ; preds = %.lr.ph, %36
  %.03855 = phi i32 [ 0, %.lr.ph ], [ %37, %36 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br i1 %.not, label %28, label %19

19:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  invoke void @_ZN10SimTKIpopt14CompoundVector15GetCompNonConstEi(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.43") align 8 %7, ptr noundef nonnull align 8 dereferenceable(265) %14, i32 noundef %.03855)
          to label %20 unwind label %23

20:                                               ; preds = %19
  %21 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %22 unwind label %25

22:                                               ; preds = %20
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %.preheader

.preheader:                                       ; preds = %28, %22
  br label %32

23:                                               ; preds = %19
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %27

25:                                               ; preds = %20
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br label %27

27:                                               ; preds = %25, %23
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %91

28:                                               ; preds = %18
  %29 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrINS_6VectorEEaSEPS1_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull %4)
          to label %.preheader unwind label %30

30:                                               ; preds = %28
  %31 = landingpad { ptr, i32 }
          cleanup
  br label %91

32:                                               ; preds = %.preheader, %89
  %.0 = phi i32 [ %90, %89 ], [ 0, %.preheader ]
  %33 = invoke noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
          to label %34 unwind label %40

34:                                               ; preds = %32
  %35 = icmp slt i32 %.0, %33
  br i1 %35, label %42, label %36

36:                                               ; preds = %34
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %37 = add nuw nsw i32 %.03855, 1
  %38 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %0)
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %18, label %._crit_edge, !llvm.loop !5

40:                                               ; preds = %49, %32
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %91

42:                                               ; preds = %34
  %43 = load ptr, ptr %17, align 8, !tbaa !7
  %44 = call noundef zeroext i1 @_ZNK10SimTKIpopt19CompoundMatrixSpace8DiagonalEv(ptr noundef nonnull align 8 dereferenceable(129) %43)
  %45 = icmp eq i32 %.03855, %.0
  %or.cond = select i1 %44, i1 %45, i1 false
  br i1 %or.cond, label %52, label %46

46:                                               ; preds = %42
  %47 = load ptr, ptr %17, align 8, !tbaa !7
  %48 = call noundef zeroext i1 @_ZNK10SimTKIpopt19CompoundMatrixSpace8DiagonalEv(ptr noundef nonnull align 8 dereferenceable(129) %47)
  br i1 %48, label %89, label %49

49:                                               ; preds = %46
  %50 = invoke noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %0, i32 noundef %.0, i32 noundef %.03855)
          to label %51 unwind label %40

51:                                               ; preds = %49
  %.not43 = icmp eq ptr %50, null
  br i1 %.not43, label %89, label %52

52:                                               ; preds = %42, %51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8)
  br i1 %.not44, label %62, label %53

53:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  invoke void @_ZNK10SimTKIpopt14CompoundVector7GetCompEi(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.54") align 8 %9, ptr noundef nonnull align 8 dereferenceable(265) %12, i32 noundef %.0)
          to label %54 unwind label %57

54:                                               ; preds = %53
  %55 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %56 unwind label %59

56:                                               ; preds = %54
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %66

57:                                               ; preds = %53
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %61

59:                                               ; preds = %54
  %60 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  br label %61

61:                                               ; preds = %59, %57
  %.pn45 = phi { ptr, i32 } [ %60, %59 ], [ %58, %57 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %88

62:                                               ; preds = %52
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull %2)
          to label %66 unwind label %64

64:                                               ; preds = %62
  %65 = landingpad { ptr, i32 }
          cleanup
  br label %88

66:                                               ; preds = %62, %56
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10)
  br i1 %.not47, label %76, label %67

67:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #6
  invoke void @_ZNK10SimTKIpopt14CompoundVector7GetCompEi(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.54") align 8 %11, ptr noundef nonnull align 8 dereferenceable(265) %13, i32 noundef %.0)
          to label %68 unwind label %71

68:                                               ; preds = %67
  %69 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSERKS3_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %70 unwind label %73

70:                                               ; preds = %68
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  br label %80

71:                                               ; preds = %67
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %75

73:                                               ; preds = %68
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  br label %75

75:                                               ; preds = %73, %71
  %.pn48 = phi { ptr, i32 } [ %74, %73 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #6
  br label %87

76:                                               ; preds = %66
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEEaSEPS2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull %3)
          to label %80 unwind label %78

78:                                               ; preds = %82, %80, %76
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %87

80:                                               ; preds = %76, %70
  %81 = invoke noundef ptr @_ZNK10SimTKIpopt14CompoundMatrix9ConstCompEii(ptr noundef nonnull align 8 dereferenceable(129) %0, i32 noundef %.0, i32 noundef %.03855)
          to label %82 unwind label %78

82:                                               ; preds = %80
  %83 = call noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %84 = call noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10)
  %85 = call noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrINS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  invoke void @_ZNK10SimTKIpopt6Matrix9AddMSinvZEdRKNS_6VectorES3_RS1_(ptr noundef nonnull align 8 dereferenceable(69) %81, double noundef %1, ptr noundef nonnull align 8 dereferenceable(205) %83, ptr noundef nonnull align 8 dereferenceable(205) %84, ptr noundef nonnull align 8 dereferenceable(205) %85)
          to label %86 unwind label %78

86:                                               ; preds = %82
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br label %89

87:                                               ; preds = %78, %75
  %.pn50 = phi { ptr, i32 } [ %79, %78 ], [ %.pn48, %75 ]
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br label %88

88:                                               ; preds = %87, %64, %61
  %.pn50.pn = phi { ptr, i32 } [ %.pn50, %87 ], [ %.pn45, %61 ], [ %65, %64 ]
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  br label %91

89:                                               ; preds = %46, %51, %86
  %90 = add nuw nsw i32 %.0, 1
  br label %32, !llvm.loop !31

91:                                               ; preds = %40, %88, %30, %27
  %.pn50.pn.pn.pn = phi { ptr, i32 } [ %.pn, %27 ], [ %31, %30 ], [ %.pn50.pn, %88 ], [ %41, %40 ]
  call void @_ZN10SimTKIpopt8SmartPtrINS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  resume { ptr, i32 } %.pn50.pn.pn.pn
}

declare void @_ZNK10SimTKIpopt6Matrix9AddMSinvZEdRKNS_6VectorES3_RS1_(ptr noundef nonnull align 8 dereferenceable(69), double noundef, ptr noundef nonnull align 8 dereferenceable(205), ptr noundef nonnull align 8 dereferenceable(205), ptr noundef nonnull align 8 dereferenceable(205)) local_unnamed_addr #5

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


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