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

; 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::TNLPAdapter" = type { %"class.SimTKIpopt::NLP.base", %"class.SimTKIpopt::SmartPtr.6", %"class.SimTKIpopt::SmartPtr.7", double, double, i32, i32, double, double, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr.8", ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, %"class.SimTKIpopt::SmartPtr.9", %"class.SimTKIpopt::SmartPtr.10", %"class.SimTKIpopt::SmartPtr.9", %"class.SimTKIpopt::SmartPtr.10", %"class.SimTKIpopt::SmartPtr.9", %"class.SimTKIpopt::SmartPtr.10", %"class.SimTKIpopt::SmartPtr.10", %"class.SimTKIpopt::SmartPtr.9", %"class.SimTKIpopt::SmartPtr.10", %"class.SimTKIpopt::SmartPtr.9", ptr, ptr, ptr }
%"class.SimTKIpopt::NLP.base" = type { %"class.SimTKIpopt::ReferencedObject.base" }
%"class.SimTKIpopt::ReferencedObject.base" = type <{ ptr, i32 }>
%"class.SimTKIpopt::SmartPtr.6" = type { ptr }
%"class.SimTKIpopt::SmartPtr.7" = type { ptr }
%"class.SimTKIpopt::SmartPtr" = type { ptr }
%"class.SimTKIpopt::SmartPtr.5" = type { ptr }
%"class.SimTKIpopt::SmartPtr.8" = type { ptr }
%"class.SimTKIpopt::SmartPtr.10" = type { ptr }
%"class.SimTKIpopt::SmartPtr.9" = type { ptr }

@_ZTIN10SimTKIpopt6VectorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt11DenseVectorE = external constant 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 ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt11TNLPAdapter10ResortBndsERKNS_6VectorEPdS3_S4_(ptr noundef nonnull align 8 dereferenceable(400) %0, ptr noundef nonnull align 8 dereferenceable(205) %1, ptr noundef %2, ptr noundef nonnull align 8 dereferenceable(205) %3, ptr noundef %4) #2 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, 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 double, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca double, align 8
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca ptr, align 8
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca double, align 8
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca ptr, align 8
  %39 = alloca i32, align 4
  %40 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  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
  %41 = load ptr, ptr %6, align 8
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %183

44:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %49, label %47

47:                                               ; preds = %44
  %48 = call ptr @__dynamic_cast(ptr %45, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #6
  br label %50

49:                                               ; preds = %44
  br label %50

50:                                               ; preds = %49, %47
  %51 = phi ptr [ %48, %47 ], [ null, %49 ]
  store ptr %51, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %52 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %41, i32 0, i32 48
  %53 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %52)
  %54 = call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %53)
  store ptr %54, ptr %12, align 8, !tbaa !5
  %55 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %41, i32 0, i32 46
  %56 = call noundef zeroext i1 @_ZN10SimTKIpopt7IsValidINS_15ExpansionMatrixEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %55)
  br i1 %56, label %57, label %126

57:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %58 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %41, i32 0, i32 46
  %59 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %58)
  %60 = call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %59)
  store ptr %60, ptr %13, align 8, !tbaa !5
  %61 = load ptr, ptr %11, align 8, !tbaa !5
  %62 = call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %61)
  br i1 %62, label %63, label %92

63:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %64)
  store double %65, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %88, %63
  %67 = load i32, ptr %15, align 4, !tbaa !11
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %68)
  %70 = icmp slt i32 %67, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %91

72:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  %73 = load ptr, ptr %12, align 8, !tbaa !5
  %74 = load i32, ptr %15, align 4, !tbaa !11
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds i32, ptr %73, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !11
  store i32 %77, ptr %16, align 4, !tbaa !11
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  %79 = load i32, ptr %16, align 4, !tbaa !11
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr %78, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !11
  store i32 %82, ptr %16, align 4, !tbaa !11
  %83 = load double, ptr %14, align 8, !tbaa !9
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = load i32, ptr %16, align 4, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds double, ptr %84, i64 %86
  store double %83, ptr %87, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %88

88:                                               ; preds = %72
  %89 = load i32, ptr %15, align 4, !tbaa !11
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %15, align 4, !tbaa !11
  br label %66, !llvm.loop !13

91:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %125

92:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %93 = load ptr, ptr %11, align 8, !tbaa !5
  %94 = call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %93)
  store ptr %94, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !11
  br label %95

95:                                               ; preds = %121, %92
  %96 = load i32, ptr %18, align 4, !tbaa !11
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %97)
  %99 = icmp slt i32 %96, %98
  br i1 %99, label %101, label %100

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

101:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load i32, ptr %18, align 4, !tbaa !11
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %102, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !11
  store i32 %106, ptr %19, align 4, !tbaa !11
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = load i32, ptr %19, align 4, !tbaa !11
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %107, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !11
  store i32 %111, ptr %19, align 4, !tbaa !11
  %112 = load ptr, ptr %17, align 8, !tbaa !5
  %113 = load i32, ptr %18, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds double, ptr %112, i64 %114
  %116 = load double, ptr %115, align 8, !tbaa !9
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = load i32, ptr %19, align 4, !tbaa !11
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds double, ptr %117, i64 %119
  store double %116, ptr %120, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %121

121:                                              ; preds = %101
  %122 = load i32, ptr %18, align 4, !tbaa !11
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %18, align 4, !tbaa !11
  br label %95, !llvm.loop !15

124:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %125

125:                                              ; preds = %124, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %182

126:                                              ; preds = %50
  %127 = load ptr, ptr %11, align 8, !tbaa !5
  %128 = call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %127)
  br i1 %128, label %129, label %153

129:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %130 = load ptr, ptr %11, align 8, !tbaa !5
  %131 = call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %130)
  store double %131, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  store i32 0, ptr %21, align 4, !tbaa !11
  br label %132

132:                                              ; preds = %149, %129
  %133 = load i32, ptr %21, align 4, !tbaa !11
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %134)
  %136 = icmp slt i32 %133, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %152

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = load i32, ptr %21, align 4, !tbaa !11
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds i32, ptr %139, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !11
  store i32 %143, ptr %22, align 4, !tbaa !11
  %144 = load double, ptr %20, align 8, !tbaa !9
  %145 = load ptr, ptr %8, align 8, !tbaa !5
  %146 = load i32, ptr %22, align 4, !tbaa !11
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds double, ptr %145, i64 %147
  store double %144, ptr %148, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %149

149:                                              ; preds = %138
  %150 = load i32, ptr %21, align 4, !tbaa !11
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %21, align 4, !tbaa !11
  br label %132, !llvm.loop !16

152:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %181

153:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %154 = load ptr, ptr %11, align 8, !tbaa !5
  %155 = call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %154)
  store ptr %155, ptr %23, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !11
  br label %156

156:                                              ; preds = %177, %153
  %157 = load i32, ptr %24, align 4, !tbaa !11
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  %159 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %158)
  %160 = icmp slt i32 %157, %159
  br i1 %160, label %162, label %161

161:                                              ; preds = %156
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %180

162:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %163 = load ptr, ptr %12, align 8, !tbaa !5
  %164 = load i32, ptr %24, align 4, !tbaa !11
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds i32, ptr %163, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !11
  store i32 %167, ptr %25, align 4, !tbaa !11
  %168 = load ptr, ptr %23, align 8, !tbaa !5
  %169 = load i32, ptr %24, align 4, !tbaa !11
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds double, ptr %168, i64 %170
  %172 = load double, ptr %171, align 8, !tbaa !9
  %173 = load ptr, ptr %8, align 8, !tbaa !5
  %174 = load i32, ptr %25, align 4, !tbaa !11
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds double, ptr %173, i64 %175
  store double %172, ptr %176, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  br label %177

177:                                              ; preds = %162
  %178 = load i32, ptr %24, align 4, !tbaa !11
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %24, align 4, !tbaa !11
  br label %156, !llvm.loop !17

180:                                              ; preds = %161
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %181

181:                                              ; preds = %180, %152
  br label %182

182:                                              ; preds = %181, %125
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %183

183:                                              ; preds = %182, %5
  %184 = load ptr, ptr %10, align 8, !tbaa !5
  %185 = icmp ne ptr %184, null
  br i1 %185, label %186, label %325

186:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %187 = load ptr, ptr %9, align 8, !tbaa !5
  %188 = icmp eq ptr %187, null
  br i1 %188, label %191, label %189

189:                                              ; preds = %186
  %190 = call ptr @__dynamic_cast(ptr %187, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #6
  br label %192

191:                                              ; preds = %186
  br label %192

192:                                              ; preds = %191, %189
  %193 = phi ptr [ %190, %189 ], [ null, %191 ]
  store ptr %193, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #6
  %194 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %41, i32 0, i32 50
  %195 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %194)
  %196 = call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %195)
  store ptr %196, ptr %27, align 8, !tbaa !5
  %197 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %41, i32 0, i32 46
  %198 = call noundef zeroext i1 @_ZN10SimTKIpopt7IsValidINS_15ExpansionMatrixEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %197)
  br i1 %198, label %199, label %268

199:                                              ; preds = %192
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  %200 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %41, i32 0, i32 46
  %201 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %200)
  %202 = call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %201)
  store ptr %202, ptr %28, align 8, !tbaa !5
  %203 = load ptr, ptr %26, align 8, !tbaa !5
  %204 = call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %203)
  br i1 %204, label %205, label %234

205:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  %206 = load ptr, ptr %26, align 8, !tbaa !5
  %207 = call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %206)
  store double %207, ptr %29, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #6
  store i32 0, ptr %30, align 4, !tbaa !11
  br label %208

208:                                              ; preds = %230, %205
  %209 = load i32, ptr %30, align 4, !tbaa !11
  %210 = load ptr, ptr %9, align 8, !tbaa !5
  %211 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %210)
  %212 = icmp slt i32 %209, %211
  br i1 %212, label %214, label %213

213:                                              ; preds = %208
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #6
  br label %233

214:                                              ; preds = %208
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #6
  %215 = load ptr, ptr %27, align 8, !tbaa !5
  %216 = load i32, ptr %30, align 4, !tbaa !11
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds i32, ptr %215, i64 %217
  %219 = load i32, ptr %218, align 4, !tbaa !11
  store i32 %219, ptr %31, align 4, !tbaa !11
  %220 = load ptr, ptr %28, align 8, !tbaa !5
  %221 = load i32, ptr %31, align 4, !tbaa !11
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds i32, ptr %220, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !11
  store i32 %224, ptr %31, align 4, !tbaa !11
  %225 = load double, ptr %29, align 8, !tbaa !9
  %226 = load ptr, ptr %10, align 8, !tbaa !5
  %227 = load i32, ptr %31, align 4, !tbaa !11
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds double, ptr %226, i64 %228
  store double %225, ptr %229, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #6
  br label %230

230:                                              ; preds = %214
  %231 = load i32, ptr %30, align 4, !tbaa !11
  %232 = add nsw i32 %231, 1
  store i32 %232, ptr %30, align 4, !tbaa !11
  br label %208, !llvm.loop !18

233:                                              ; preds = %213
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  br label %267

234:                                              ; preds = %199
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #6
  %235 = load ptr, ptr %26, align 8, !tbaa !5
  %236 = call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %235)
  store ptr %236, ptr %32, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #6
  store i32 0, ptr %33, align 4, !tbaa !11
  br label %237

237:                                              ; preds = %263, %234
  %238 = load i32, ptr %33, align 4, !tbaa !11
  %239 = load ptr, ptr %9, align 8, !tbaa !5
  %240 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %239)
  %241 = icmp slt i32 %238, %240
  br i1 %241, label %243, label %242

242:                                              ; preds = %237
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #6
  br label %266

243:                                              ; preds = %237
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #6
  %244 = load ptr, ptr %27, align 8, !tbaa !5
  %245 = load i32, ptr %33, align 4, !tbaa !11
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds i32, ptr %244, i64 %246
  %248 = load i32, ptr %247, align 4, !tbaa !11
  store i32 %248, ptr %34, align 4, !tbaa !11
  %249 = load ptr, ptr %28, align 8, !tbaa !5
  %250 = load i32, ptr %34, align 4, !tbaa !11
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds i32, ptr %249, i64 %251
  %253 = load i32, ptr %252, align 4, !tbaa !11
  store i32 %253, ptr %34, align 4, !tbaa !11
  %254 = load ptr, ptr %32, align 8, !tbaa !5
  %255 = load i32, ptr %33, align 4, !tbaa !11
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds double, ptr %254, i64 %256
  %258 = load double, ptr %257, align 8, !tbaa !9
  %259 = load ptr, ptr %10, align 8, !tbaa !5
  %260 = load i32, ptr %34, align 4, !tbaa !11
  %261 = sext i32 %260 to i64
  %262 = getelementptr inbounds double, ptr %259, i64 %261
  store double %258, ptr %262, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #6
  br label %263

263:                                              ; preds = %243
  %264 = load i32, ptr %33, align 4, !tbaa !11
  %265 = add nsw i32 %264, 1
  store i32 %265, ptr %33, align 4, !tbaa !11
  br label %237, !llvm.loop !19

266:                                              ; preds = %242
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #6
  br label %267

267:                                              ; preds = %266, %233
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  br label %324

268:                                              ; preds = %192
  %269 = load ptr, ptr %26, align 8, !tbaa !5
  %270 = call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %269)
  br i1 %270, label %271, label %295

271:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #6
  %272 = load ptr, ptr %26, align 8, !tbaa !5
  %273 = call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %272)
  store double %273, ptr %35, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #6
  store i32 0, ptr %36, align 4, !tbaa !11
  br label %274

274:                                              ; preds = %291, %271
  %275 = load i32, ptr %36, align 4, !tbaa !11
  %276 = load ptr, ptr %9, align 8, !tbaa !5
  %277 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %276)
  %278 = icmp slt i32 %275, %277
  br i1 %278, label %280, label %279

279:                                              ; preds = %274
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #6
  br label %294

280:                                              ; preds = %274
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #6
  %281 = load ptr, ptr %27, align 8, !tbaa !5
  %282 = load i32, ptr %36, align 4, !tbaa !11
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds i32, ptr %281, i64 %283
  %285 = load i32, ptr %284, align 4, !tbaa !11
  store i32 %285, ptr %37, align 4, !tbaa !11
  %286 = load double, ptr %35, align 8, !tbaa !9
  %287 = load ptr, ptr %10, align 8, !tbaa !5
  %288 = load i32, ptr %37, align 4, !tbaa !11
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds double, ptr %287, i64 %289
  store double %286, ptr %290, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #6
  br label %291

291:                                              ; preds = %280
  %292 = load i32, ptr %36, align 4, !tbaa !11
  %293 = add nsw i32 %292, 1
  store i32 %293, ptr %36, align 4, !tbaa !11
  br label %274, !llvm.loop !20

294:                                              ; preds = %279
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #6
  br label %323

295:                                              ; preds = %268
  call void @llvm.lifetime.start.p0(i64 8, ptr %38) #6
  %296 = load ptr, ptr %26, align 8, !tbaa !5
  %297 = call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %296)
  store ptr %297, ptr %38, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #6
  store i32 0, ptr %39, align 4, !tbaa !11
  br label %298

298:                                              ; preds = %319, %295
  %299 = load i32, ptr %39, align 4, !tbaa !11
  %300 = load ptr, ptr %9, align 8, !tbaa !5
  %301 = call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %300)
  %302 = icmp slt i32 %299, %301
  br i1 %302, label %304, label %303

303:                                              ; preds = %298
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #6
  br label %322

304:                                              ; preds = %298
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #6
  %305 = load ptr, ptr %27, align 8, !tbaa !5
  %306 = load i32, ptr %39, align 4, !tbaa !11
  %307 = sext i32 %306 to i64
  %308 = getelementptr inbounds i32, ptr %305, i64 %307
  %309 = load i32, ptr %308, align 4, !tbaa !11
  store i32 %309, ptr %40, align 4, !tbaa !11
  %310 = load ptr, ptr %38, align 8, !tbaa !5
  %311 = load i32, ptr %39, align 4, !tbaa !11
  %312 = sext i32 %311 to i64
  %313 = getelementptr inbounds double, ptr %310, i64 %312
  %314 = load double, ptr %313, align 8, !tbaa !9
  %315 = load ptr, ptr %10, align 8, !tbaa !5
  %316 = load i32, ptr %40, align 4, !tbaa !11
  %317 = sext i32 %316 to i64
  %318 = getelementptr inbounds double, ptr %315, i64 %317
  store double %314, ptr %318, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #6
  br label %319

319:                                              ; preds = %304
  %320 = load i32, ptr %39, align 4, !tbaa !11
  %321 = add nsw i32 %320, 1
  store i32 %321, ptr %39, align 4, !tbaa !11
  br label %298, !llvm.loop !21

322:                                              ; preds = %303
  call void @llvm.lifetime.end.p0(i64 8, ptr %38) #6
  br label %323

323:                                              ; preds = %322, %294
  br label %324

324:                                              ; preds = %323, %267
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  br label %325

325:                                              ; preds = %324, %183
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240)) #1 align 2

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 willreturn memory(read) }
attributes #4 = { 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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


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

@_ZTIN10SimTKIpopt6VectorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt11DenseVectorE = external constant ptr

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt11TNLPAdapter10ResortBndsERKNS_6VectorEPdS3_S4_(ptr noundef nonnull align 8 dereferenceable(400) %0, ptr noundef nonnull align 8 dereferenceable(205) %1, ptr noundef writeonly %2, ptr noundef nonnull align 8 dereferenceable(205) %3, ptr noundef writeonly %4) local_unnamed_addr #1 align 2 {
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %.loopexit105, label %6

6:                                                ; preds = %5
  %7 = tail call ptr @__dynamic_cast(ptr nonnull %1, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #5
  %8 = getelementptr inbounds i8, ptr %0, i64 312
  %9 = tail call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %10 = tail call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %9)
  %11 = getelementptr inbounds i8, ptr %0, i64 296
  %12 = tail call noundef zeroext i1 @_ZN10SimTKIpopt7IsValidINS_15ExpansionMatrixEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %11)
  br i1 %12, label %13, label %47

13:                                               ; preds = %6
  %14 = tail call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
  %15 = tail call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %14)
  %16 = tail call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %7)
  br i1 %16, label %17, label %31

17:                                               ; preds = %13
  %18 = tail call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %7)
  %19 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph115, label %.loopexit105

.lr.ph115:                                        ; preds = %17, %.lr.ph115
  %indvars.iv137 = phi i64 [ %indvars.iv.next138, %.lr.ph115 ], [ 0, %17 ]
  %21 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv137
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr %15, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds double, ptr %2, i64 %26
  store double %18, ptr %27, align 8, !tbaa !9
  %indvars.iv.next138 = add nuw nsw i64 %indvars.iv137, 1
  %28 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next138, %29
  br i1 %30, label %.lr.ph115, label %.loopexit105, !llvm.loop !11

31:                                               ; preds = %13
  %32 = tail call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %7)
  %33 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph113, label %.loopexit105

.lr.ph113:                                        ; preds = %31, %.lr.ph113
  %indvars.iv134 = phi i64 [ %indvars.iv.next135, %.lr.ph113 ], [ 0, %31 ]
  %35 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv134
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %15, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds double, ptr %32, i64 %indvars.iv134
  %41 = load double, ptr %40, align 8, !tbaa !9
  %42 = sext i32 %39 to i64
  %43 = getelementptr inbounds double, ptr %2, i64 %42
  store double %41, ptr %43, align 8, !tbaa !9
  %indvars.iv.next135 = add nuw nsw i64 %indvars.iv134, 1
  %44 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %45 = sext i32 %44 to i64
  %46 = icmp slt i64 %indvars.iv.next135, %45
  br i1 %46, label %.lr.ph113, label %.loopexit105, !llvm.loop !13

47:                                               ; preds = %6
  %48 = tail call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %7)
  br i1 %48, label %49, label %60

49:                                               ; preds = %47
  %50 = tail call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %7)
  %51 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.lr.ph111, label %.loopexit105

.lr.ph111:                                        ; preds = %49, %.lr.ph111
  %indvars.iv131 = phi i64 [ %indvars.iv.next132, %.lr.ph111 ], [ 0, %49 ]
  %53 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv131
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds double, ptr %2, i64 %55
  store double %50, ptr %56, align 8, !tbaa !9
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %57 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next132, %58
  br i1 %59, label %.lr.ph111, label %.loopexit105, !llvm.loop !14

60:                                               ; preds = %47
  %61 = tail call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %7)
  %62 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %.lr.ph, label %.loopexit105

.lr.ph:                                           ; preds = %60, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %60 ]
  %64 = getelementptr inbounds i32, ptr %10, i64 %indvars.iv
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = getelementptr inbounds double, ptr %61, i64 %indvars.iv
  %67 = load double, ptr %66, align 8, !tbaa !9
  %68 = sext i32 %65 to i64
  %69 = getelementptr inbounds double, ptr %2, i64 %68
  store double %67, ptr %69, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %70 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %1)
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next, %71
  br i1 %72, label %.lr.ph, label %.loopexit105, !llvm.loop !15

.loopexit105:                                     ; preds = %.lr.ph, %.lr.ph111, %.lr.ph113, %.lr.ph115, %60, %49, %31, %17, %5
  %.not101 = icmp eq ptr %4, null
  br i1 %.not101, label %.loopexit, label %73

73:                                               ; preds = %.loopexit105
  %74 = tail call ptr @__dynamic_cast(ptr nonnull %3, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #5
  %75 = getelementptr inbounds i8, ptr %0, i64 328
  %76 = tail call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %75)
  %77 = tail call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %76)
  %78 = getelementptr inbounds i8, ptr %0, i64 296
  %79 = tail call noundef zeroext i1 @_ZN10SimTKIpopt7IsValidINS_15ExpansionMatrixEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %78)
  br i1 %79, label %80, label %114

80:                                               ; preds = %73
  %81 = tail call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %78)
  %82 = tail call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %81)
  %83 = tail call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %74)
  br i1 %83, label %84, label %98

84:                                               ; preds = %80
  %85 = tail call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %74)
  %86 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %87 = icmp sgt i32 %86, 0
  br i1 %87, label %.lr.ph123, label %.loopexit

.lr.ph123:                                        ; preds = %84, %.lr.ph123
  %indvars.iv149 = phi i64 [ %indvars.iv.next150, %.lr.ph123 ], [ 0, %84 ]
  %88 = getelementptr inbounds i32, ptr %77, i64 %indvars.iv149
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds i32, ptr %82, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds double, ptr %4, i64 %93
  store double %85, ptr %94, align 8, !tbaa !9
  %indvars.iv.next150 = add nuw nsw i64 %indvars.iv149, 1
  %95 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %96 = sext i32 %95 to i64
  %97 = icmp slt i64 %indvars.iv.next150, %96
  br i1 %97, label %.lr.ph123, label %.loopexit, !llvm.loop !16

98:                                               ; preds = %80
  %99 = tail call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %74)
  %100 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %101 = icmp sgt i32 %100, 0
  br i1 %101, label %.lr.ph121, label %.loopexit

.lr.ph121:                                        ; preds = %98, %.lr.ph121
  %indvars.iv146 = phi i64 [ %indvars.iv.next147, %.lr.ph121 ], [ 0, %98 ]
  %102 = getelementptr inbounds i32, ptr %77, i64 %indvars.iv146
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i32, ptr %82, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = getelementptr inbounds double, ptr %99, i64 %indvars.iv146
  %108 = load double, ptr %107, align 8, !tbaa !9
  %109 = sext i32 %106 to i64
  %110 = getelementptr inbounds double, ptr %4, i64 %109
  store double %108, ptr %110, align 8, !tbaa !9
  %indvars.iv.next147 = add nuw nsw i64 %indvars.iv146, 1
  %111 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %112 = sext i32 %111 to i64
  %113 = icmp slt i64 %indvars.iv.next147, %112
  br i1 %113, label %.lr.ph121, label %.loopexit, !llvm.loop !17

114:                                              ; preds = %73
  %115 = tail call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %74)
  br i1 %115, label %116, label %127

116:                                              ; preds = %114
  %117 = tail call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %74)
  %118 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %119 = icmp sgt i32 %118, 0
  br i1 %119, label %.lr.ph119, label %.loopexit

.lr.ph119:                                        ; preds = %116, %.lr.ph119
  %indvars.iv143 = phi i64 [ %indvars.iv.next144, %.lr.ph119 ], [ 0, %116 ]
  %120 = getelementptr inbounds i32, ptr %77, i64 %indvars.iv143
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds double, ptr %4, i64 %122
  store double %117, ptr %123, align 8, !tbaa !9
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %124 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %125 = sext i32 %124 to i64
  %126 = icmp slt i64 %indvars.iv.next144, %125
  br i1 %126, label %.lr.ph119, label %.loopexit, !llvm.loop !18

127:                                              ; preds = %114
  %128 = tail call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %74)
  %129 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %130 = icmp sgt i32 %129, 0
  br i1 %130, label %.lr.ph117, label %.loopexit

.lr.ph117:                                        ; preds = %127, %.lr.ph117
  %indvars.iv140 = phi i64 [ %indvars.iv.next141, %.lr.ph117 ], [ 0, %127 ]
  %131 = getelementptr inbounds i32, ptr %77, i64 %indvars.iv140
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = getelementptr inbounds double, ptr %128, i64 %indvars.iv140
  %134 = load double, ptr %133, align 8, !tbaa !9
  %135 = sext i32 %132 to i64
  %136 = getelementptr inbounds double, ptr %4, i64 %135
  store double %134, ptr %136, align 8, !tbaa !9
  %indvars.iv.next141 = add nuw nsw i64 %indvars.iv140, 1
  %137 = tail call noundef i32 @_ZNK10SimTKIpopt6Vector3DimEv(ptr noundef nonnull align 8 dereferenceable(205) %3)
  %138 = sext i32 %137 to i64
  %139 = icmp slt i64 %indvars.iv.next141, %138
  br i1 %139, label %.lr.ph117, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph117, %.lr.ph119, %.lr.ph121, %.lr.ph123, %127, %116, %98, %84, %.loopexit105
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240)) local_unnamed_addr #0 align 2

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 = { 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 = { 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 #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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