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

; 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::GenTMatrix" = type <{ %"class.SimTKIpopt::Matrix.base", [3 x i8], ptr, 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 }

@_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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10SimTKIpopt10GenTMatrix14MultVectorImplEdRKNS_6VectorEdRS1_(ptr noundef nonnull align 8 dereferenceable(89) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(205) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(205) %4) unnamed_addr #2 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  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 double %3, ptr %9, align 8, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8
  %22 = load double, ptr %9, align 8, !tbaa !9
  %23 = fcmp une double %22, 0.000000e+00
  br i1 %23, label %24, label %27

24:                                               ; preds = %5
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = load double, ptr %9, align 8, !tbaa !9
  call void @_ZN10SimTKIpopt6Vector4ScalEd(ptr noundef nonnull align 8 dereferenceable(205) %25, double noundef %26)
  br label %29

27:                                               ; preds = %5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN10SimTKIpopt6Vector3SetEd(ptr noundef nonnull align 8 dereferenceable(205) %28, double noundef 0.000000e+00)
  br label %29

29:                                               ; preds = %27, %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %34, label %32

32:                                               ; preds = %29
  %33 = call ptr @__dynamic_cast(ptr %30, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #8
  br label %35

34:                                               ; preds = %29
  br label %35

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

39:                                               ; preds = %35
  %40 = call ptr @__dynamic_cast(ptr %37, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #8
  br label %42

41:                                               ; preds = %35
  br label %42

42:                                               ; preds = %41, %39
  %43 = phi ptr [ %40, %39 ], [ null, %41 ]
  store ptr %43, ptr %12, align 8, !tbaa !5
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %127

46:                                               ; preds = %42
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %127

49:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %50 = call noundef ptr @_ZNK10SimTKIpopt10GenTMatrix5IrowsEv(ptr noundef nonnull align 8 dereferenceable(89) %21)
  store ptr %50, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %51 = call noundef ptr @_ZNK10SimTKIpopt10GenTMatrix5JcolsEv(ptr noundef nonnull align 8 dereferenceable(89) %21)
  store ptr %51, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %52 = getelementptr inbounds %"class.SimTKIpopt::GenTMatrix", ptr %21, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  store ptr %53, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = call noundef ptr @_ZN10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %54)
  store ptr %55, ptr %16, align 8, !tbaa !5
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %56)
  br i1 %57, label %58, label %88

58:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %59 = load double, ptr %7, align 8, !tbaa !9
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %60)
  %62 = fmul double %59, %61
  store double %62, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !24
  br label %63

63:                                               ; preds = %84, %58
  %64 = load i32, ptr %18, align 4, !tbaa !24
  %65 = call noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89) %21)
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %63
  %69 = load double, ptr %17, align 8, !tbaa !9
  %70 = load ptr, ptr %15, align 8, !tbaa !5
  %71 = load double, ptr %70, align 8, !tbaa !9
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = load ptr, ptr %13, align 8, !tbaa !5
  %74 = load i32, ptr %73, align 4, !tbaa !24
  %75 = sub nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds double, ptr %72, i64 %76
  %78 = load double, ptr %77, align 8, !tbaa !9
  %79 = call double @llvm.fmuladd.f64(double %69, double %71, double %78)
  store double %79, ptr %77, align 8, !tbaa !9
  %80 = load ptr, ptr %15, align 8, !tbaa !5
  %81 = getelementptr inbounds double, ptr %80, i32 1
  store ptr %81, ptr %15, align 8, !tbaa !5
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = getelementptr inbounds i32, ptr %82, i32 1
  store ptr %83, ptr %13, align 8, !tbaa !5
  br label %84

84:                                               ; preds = %68
  %85 = load i32, ptr %18, align 4, !tbaa !24
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %18, align 4, !tbaa !24
  br label %63, !llvm.loop !25

87:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %126

88:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %89)
  store ptr %90, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !24
  br label %91

91:                                               ; preds = %122, %88
  %92 = load i32, ptr %20, align 4, !tbaa !24
  %93 = call noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89) %21)
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

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

96:                                               ; preds = %91
  %97 = load double, ptr %7, align 8, !tbaa !9
  %98 = load ptr, ptr %15, align 8, !tbaa !5
  %99 = load double, ptr %98, align 8, !tbaa !9
  %100 = fmul double %97, %99
  %101 = load ptr, ptr %19, align 8, !tbaa !5
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = load i32, ptr %102, align 4, !tbaa !24
  %104 = sub nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds double, ptr %101, i64 %105
  %107 = load double, ptr %106, align 8, !tbaa !9
  %108 = load ptr, ptr %16, align 8, !tbaa !5
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = load i32, ptr %109, align 4, !tbaa !24
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds double, ptr %108, i64 %112
  %114 = load double, ptr %113, align 8, !tbaa !9
  %115 = call double @llvm.fmuladd.f64(double %100, double %107, double %114)
  store double %115, ptr %113, align 8, !tbaa !9
  %116 = load ptr, ptr %15, align 8, !tbaa !5
  %117 = getelementptr inbounds double, ptr %116, i32 1
  store ptr %117, ptr %15, align 8, !tbaa !5
  %118 = load ptr, ptr %13, align 8, !tbaa !5
  %119 = getelementptr inbounds i32, ptr %118, i32 1
  store ptr %119, ptr %13, align 8, !tbaa !5
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds i32, ptr %120, i32 1
  store ptr %121, ptr %14, align 8, !tbaa !5
  br label %122

122:                                              ; preds = %96
  %123 = load i32, ptr %20, align 4, !tbaa !24
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %20, align 4, !tbaa !24
  br label %91, !llvm.loop !27

125:                                              ; preds = %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %126

126:                                              ; preds = %125, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %127

127:                                              ; preds = %126, %46, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  ret void
}

declare void @_ZN10SimTKIpopt6Vector4ScalEd(ptr noundef nonnull align 8 dereferenceable(205), double noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt6Vector3SetEd(ptr noundef nonnull align 8 dereferenceable(205), double noundef) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt10GenTMatrix5IrowsEv(ptr noundef nonnull align 8 dereferenceable(89)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt10GenTMatrix5JcolsEv(ptr noundef nonnull align 8 dereferenceable(89)) #1 align 2

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

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

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 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) }
attributes #5 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #8 = { 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, !6, i64 80}
!12 = !{!"_ZTSN10SimTKIpopt10GenTMatrixE", !13, i64 0, !6, i64 72, !6, i64 80, !23, i64 88}
!13 = !{!"_ZTSN10SimTKIpopt6MatrixE", !14, i64 0, !22, i64 56, !16, i64 64, !23, i64 68}
!14 = !{!"_ZTSN10SimTKIpopt12TaggedObjectE", !15, i64 0, !17, i64 16, !16, i64 48, !16, i64 52}
!15 = !{!"_ZTSN10SimTKIpopt16ReferencedObjectE", !16, i64 8}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSN10SimTKIpopt7SubjectE", !18, i64 8}
!18 = !{!"_ZTSSt6vectorIPN10SimTKIpopt8ObserverESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEEE", !6, i64 0}
!23 = !{!"bool", !7, i64 0}
!24 = !{!16, !16, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}


; 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK10SimTKIpopt10GenTMatrix14MultVectorImplEdRKNS_6VectorEdRS1_(ptr noundef nonnull align 8 dereferenceable(89) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(205) %2, double noundef %3, ptr noundef nonnull align 8 dereferenceable(205) %4) unnamed_addr #1 align 2 {
  %6 = fcmp une double %3, 0.000000e+00
  br i1 %6, label %7, label %8

7:                                                ; preds = %5
  tail call void @_ZN10SimTKIpopt6Vector4ScalEd(ptr noundef nonnull align 8 dereferenceable(205) %4, double noundef %3)
  br label %9

8:                                                ; preds = %5
  tail call void @_ZN10SimTKIpopt6Vector3SetEd(ptr noundef nonnull align 8 dereferenceable(205) %4, double noundef 0.000000e+00)
  br label %9

9:                                                ; preds = %7, %8
  %10 = tail call ptr @__dynamic_cast(ptr nonnull %2, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #7
  %11 = tail call ptr @__dynamic_cast(ptr nonnull %4, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #7
  %12 = icmp ne ptr %10, null
  %13 = icmp ne ptr %11, null
  %or.cond = select i1 %12, i1 %13, i1 false
  br i1 %or.cond, label %14, label %.loopexit

14:                                               ; preds = %9
  %15 = tail call noundef ptr @_ZNK10SimTKIpopt10GenTMatrix5IrowsEv(ptr noundef nonnull align 8 dereferenceable(89) %0)
  %16 = tail call noundef ptr @_ZNK10SimTKIpopt10GenTMatrix5JcolsEv(ptr noundef nonnull align 8 dereferenceable(89) %0)
  %17 = getelementptr inbounds i8, ptr %0, i64 80
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = tail call noundef ptr @_ZN10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %11)
  %20 = tail call noundef zeroext i1 @_ZNK10SimTKIpopt11DenseVector13IsHomogeneousEv(ptr noundef nonnull align 8 dereferenceable(240) %10)
  %invariant.gep48 = getelementptr i8, ptr %19, i64 -8
  br i1 %20, label %21, label %36

21:                                               ; preds = %14
  %22 = tail call noundef double @_ZNK10SimTKIpopt11DenseVector6ScalarEv(ptr noundef nonnull align 8 dereferenceable(240) %10)
  %23 = fmul double %22, %1
  %24 = tail call noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89) %0)
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph53, label %.loopexit

.lr.ph53:                                         ; preds = %21, %.lr.ph53
  %.03352 = phi ptr [ %32, %.lr.ph53 ], [ %15, %21 ]
  %.03451 = phi i32 [ %33, %.lr.ph53 ], [ 0, %21 ]
  %.03650 = phi ptr [ %31, %.lr.ph53 ], [ %18, %21 ]
  %26 = load double, ptr %.03650, align 8, !tbaa !21
  %27 = load i32, ptr %.03352, align 4, !tbaa !23
  %28 = sext i32 %27 to i64
  %gep49 = getelementptr double, ptr %invariant.gep48, i64 %28
  %29 = load double, ptr %gep49, align 8, !tbaa !21
  %30 = tail call double @llvm.fmuladd.f64(double %23, double %26, double %29)
  store double %30, ptr %gep49, align 8, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %.03650, i64 8
  %32 = getelementptr inbounds i8, ptr %.03352, i64 4
  %33 = add nuw nsw i32 %.03451, 1
  %34 = tail call noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89) %0)
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %.lr.ph53, label %.loopexit, !llvm.loop !24

36:                                               ; preds = %14
  %37 = tail call noundef ptr @_ZNK10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %10)
  %invariant.gep = getelementptr i8, ptr %37, i64 -8
  %38 = tail call noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89) %0)
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %36, %.lr.ph
  %.047 = phi i32 [ %52, %.lr.ph ], [ 0, %36 ]
  %.146 = phi ptr [ %50, %.lr.ph ], [ %15, %36 ]
  %.03545 = phi ptr [ %51, %.lr.ph ], [ %16, %36 ]
  %.13744 = phi ptr [ %49, %.lr.ph ], [ %18, %36 ]
  %40 = load double, ptr %.13744, align 8, !tbaa !21
  %41 = fmul double %40, %1
  %42 = load i32, ptr %.03545, align 4, !tbaa !23
  %43 = sext i32 %42 to i64
  %gep = getelementptr double, ptr %invariant.gep, i64 %43
  %44 = load double, ptr %gep, align 8, !tbaa !21
  %45 = load i32, ptr %.146, align 4, !tbaa !23
  %46 = sext i32 %45 to i64
  %gep43 = getelementptr double, ptr %invariant.gep48, i64 %46
  %47 = load double, ptr %gep43, align 8, !tbaa !21
  %48 = tail call double @llvm.fmuladd.f64(double %41, double %44, double %47)
  store double %48, ptr %gep43, align 8, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %.13744, i64 8
  %50 = getelementptr inbounds i8, ptr %.146, i64 4
  %51 = getelementptr inbounds i8, ptr %.03545, i64 4
  %52 = add nuw nsw i32 %.047, 1
  %53 = tail call noundef i32 @_ZNK10SimTKIpopt10GenTMatrix8NonzerosEv(ptr noundef nonnull align 8 dereferenceable(89) %0)
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %.lr.ph, label %.loopexit, !llvm.loop !26

.loopexit:                                        ; preds = %.lr.ph, %.lr.ph53, %36, %21, %9
  ret void
}

declare void @_ZN10SimTKIpopt6Vector4ScalEd(ptr noundef nonnull align 8 dereferenceable(205), double noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt6Vector3SetEd(ptr noundef nonnull align 8 dereferenceable(205), double noundef) local_unnamed_addr #0 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

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

attributes #0 = { 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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(read) }
attributes #4 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !18, i64 80}
!6 = !{!"_ZTSN10SimTKIpopt10GenTMatrixE", !7, i64 0, !18, i64 72, !18, i64 80, !20, i64 88}
!7 = !{!"_ZTSN10SimTKIpopt6MatrixE", !8, i64 0, !19, i64 56, !10, i64 64, !20, i64 68}
!8 = !{!"_ZTSN10SimTKIpopt12TaggedObjectE", !9, i64 0, !13, i64 16, !10, i64 48, !10, i64 52}
!9 = !{!"_ZTSN10SimTKIpopt16ReferencedObjectE", !10, i64 8}
!10 = !{!"int", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSN10SimTKIpopt7SubjectE", !14, i64 8}
!14 = !{!"_ZTSSt6vectorIPN10SimTKIpopt8ObserverESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN10SimTKIpopt8ObserverESaIS2_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"any pointer", !11, i64 0}
!19 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEEE", !18, i64 0}
!20 = !{!"bool", !11, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"double", !11, i64 0}
!23 = !{!10, !10, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}


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