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

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

@_ZTIN10SimTKIpopt6MatrixE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14DenseGenMatrixE = 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt12TaggedObject13ObjectChangedEv(ptr noundef nonnull align 8 dereferenceable(56)) #2 align 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 i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69)) #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt17MultiVectorMatrix18FillWithNewVectorsEv(ptr noundef nonnull align 8 dereferenceable(128)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt17MultiVectorMatrix18AddRightMultMatrixEdRKS0_RKNS_6MatrixEd(ptr noundef nonnull align 8 dereferenceable(128) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(128) %2, ptr noundef nonnull align 8 dereferenceable(69) %3, double noundef %4) #2 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 double, align 8
  %11 = alloca %"class.SimTKIpopt::SmartPtr.18", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.SimTKIpopt::SmartPtr.19", align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %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 ptr %3, ptr %9, align 8, !tbaa !5
  store double %4, ptr %10, align 8, !tbaa !9
  %21 = load ptr, ptr %6, align 8
  %22 = load double, ptr %10, align 8, !tbaa !9
  %23 = fcmp oeq double %22, 0.000000e+00
  br i1 %23, label %24, label %25

24:                                               ; preds = %5
  call void @_ZN10SimTKIpopt17MultiVectorMatrix18FillWithNewVectorsEv(ptr noundef nonnull align 8 dereferenceable(128) %21)
  br label %25

25:                                               ; preds = %24, %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %26 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #10
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NRowsEv(ptr noundef nonnull align 8 dereferenceable(69) %27)
          to label %29 unwind label %40

29:                                               ; preds = %25
  invoke void @_ZN10SimTKIpopt16DenseVectorSpaceC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %26, i32 noundef %28)
          to label %30 unwind label %40

30:                                               ; preds = %29
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef %26)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %31 = invoke noundef ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %32 unwind label %44

32:                                               ; preds = %30
  %33 = invoke noundef ptr @_ZNK10SimTKIpopt16DenseVectorSpace18MakeNewDenseVectorEv(ptr noundef nonnull align 8 dereferenceable(16) %31)
          to label %34 unwind label %44

34:                                               ; preds = %32
  invoke void @_ZN10SimTKIpopt8SmartPtrINS_11DenseVectorEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef %33)
          to label %35 unwind label %44

35:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #9
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %48, label %38

38:                                               ; preds = %35
  %39 = call ptr @__dynamic_cast(ptr %36, ptr @_ZTIN10SimTKIpopt6MatrixE, ptr @_ZTIN10SimTKIpopt14DenseGenMatrixE, i64 0) #9
  br label %49

40:                                               ; preds = %29, %25
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %12, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %13, align 4
  call void @_ZdlPvm(ptr noundef %26, i64 noundef 16) #11
  br label %131

44:                                               ; preds = %34, %32, %30
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %12, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %13, align 4
  br label %130

48:                                               ; preds = %35
  br label %49

49:                                               ; preds = %48, %38
  %50 = phi ptr [ %39, %38 ], [ null, %48 ]
  store ptr %50, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #9
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %51

51:                                               ; preds = %117, %49
  %52 = load i32, ptr %16, align 4, !tbaa !11
  %53 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69) %21)
          to label %54 unwind label %57

54:                                               ; preds = %51
  %55 = icmp slt i32 %52, %53
  br i1 %55, label %61, label %56

56:                                               ; preds = %54
  store i32 2, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %123

57:                                               ; preds = %51
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %12, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %13, align 4
  br label %122

61:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  %62 = load ptr, ptr %15, align 8, !tbaa !5
  %63 = invoke noundef ptr @_ZNK10SimTKIpopt14DenseGenMatrix6ValuesEv(ptr noundef nonnull align 8 dereferenceable(89) %62)
          to label %64 unwind label %76

64:                                               ; preds = %61
  store ptr %63, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  %65 = invoke noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_11DenseVectorEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %66 unwind label %80

66:                                               ; preds = %64
  %67 = invoke noundef ptr @_ZN10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %65)
          to label %68 unwind label %80

68:                                               ; preds = %66
  store ptr %67, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %69

69:                                               ; preds = %104, %68
  %70 = load i32, ptr %20, align 4, !tbaa !11
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69) %71)
          to label %73 unwind label %84

73:                                               ; preds = %69
  %74 = icmp slt i32 %70, %72
  br i1 %74, label %88, label %75

75:                                               ; preds = %73
  store i32 5, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %107

76:                                               ; preds = %61
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %12, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %13, align 4
  br label %121

80:                                               ; preds = %115, %111, %107, %66, %64
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %12, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %13, align 4
  br label %120

84:                                               ; preds = %88, %69
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %12, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  br label %120

88:                                               ; preds = %73
  %89 = load ptr, ptr %18, align 8, !tbaa !5
  %90 = load i32, ptr %16, align 4, !tbaa !11
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NRowsEv(ptr noundef nonnull align 8 dereferenceable(69) %91)
          to label %93 unwind label %84

93:                                               ; preds = %88
  %94 = mul nsw i32 %90, %92
  %95 = load i32, ptr %20, align 4, !tbaa !11
  %96 = add nsw i32 %94, %95
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds double, ptr %89, i64 %97
  %99 = load double, ptr %98, align 8, !tbaa !9
  %100 = load ptr, ptr %19, align 8, !tbaa !5
  %101 = load i32, ptr %20, align 4, !tbaa !11
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds double, ptr %100, i64 %102
  store double %99, ptr %103, align 8, !tbaa !9
  br label %104

104:                                              ; preds = %93
  %105 = load i32, ptr %20, align 4, !tbaa !11
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %20, align 4, !tbaa !11
  br label %69, !llvm.loop !13

107:                                              ; preds = %75
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = load double, ptr %7, align 8, !tbaa !9
  %110 = invoke noundef nonnull align 8 dereferenceable(240) ptr @_ZNK10SimTKIpopt8SmartPtrINS_11DenseVectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %111 unwind label %80

111:                                              ; preds = %107
  %112 = load double, ptr %10, align 8, !tbaa !9
  %113 = load i32, ptr %16, align 4, !tbaa !11
  %114 = invoke noundef ptr @_ZN10SimTKIpopt17MultiVectorMatrix3VecEi(ptr noundef nonnull align 8 dereferenceable(128) %21, i32 noundef %113)
          to label %115 unwind label %80

115:                                              ; preds = %111
  invoke void @_ZNK10SimTKIpopt6Matrix10MultVectorEdRKNS_6VectorEdRS1_(ptr noundef nonnull align 8 dereferenceable(69) %108, double noundef %109, ptr noundef nonnull align 8 dereferenceable(205) %110, double noundef %112, ptr noundef nonnull align 8 dereferenceable(205) %114)
          to label %116 unwind label %80

116:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %16, align 4, !tbaa !11
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %16, align 4, !tbaa !11
  br label %51, !llvm.loop !15

120:                                              ; preds = %84, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  br label %121

121:                                              ; preds = %120, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  br label %122

122:                                              ; preds = %121, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #9
  br label %129

123:                                              ; preds = %56
  invoke void @_ZN10SimTKIpopt12TaggedObject13ObjectChangedEv(ptr noundef nonnull align 8 dereferenceable(56) %21)
          to label %124 unwind label %125

124:                                              ; preds = %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @_ZN10SimTKIpopt8SmartPtrINS_11DenseVectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  ret void

125:                                              ; preds = %123
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %12, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %13, align 4
  br label %129

129:                                              ; preds = %125, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #9
  call void @_ZN10SimTKIpopt8SmartPtrINS_11DenseVectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %14) #9
  br label %130

130:                                              ; preds = %129, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #9
  br label %131

131:                                              ; preds = %130, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %132

132:                                              ; preds = %131
  %133 = load ptr, ptr %12, align 8
  %134 = load i32, ptr %13, align 4
  %135 = insertvalue { ptr, i32 } poison, ptr %133, 0
  %136 = insertvalue { ptr, i32 } %135, i32 %134, 1
  resume { ptr, i32 } %136
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt16DenseVectorSpaceC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZNK10SimTKIpopt16DenseVectorSpace18MakeNewDenseVectorEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

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

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

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin nounwind "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 = { nobuiltin allocsize(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 = { 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 = { "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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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}


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

@_ZTIN10SimTKIpopt6MatrixE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14DenseGenMatrixE = 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: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt12TaggedObject13ObjectChangedEv(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #2 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 i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt17MultiVectorMatrix18FillWithNewVectorsEv(ptr noundef nonnull align 8 dereferenceable(128)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt17MultiVectorMatrix18AddRightMultMatrixEdRKS0_RKNS_6MatrixEd(ptr noundef nonnull align 8 dereferenceable(128) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(128) %2, ptr noundef nonnull align 8 dereferenceable(69) %3, double noundef %4) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.SimTKIpopt::SmartPtr.18", align 8
  %7 = alloca %"class.SimTKIpopt::SmartPtr.19", align 8
  %8 = fcmp oeq double %4, 0.000000e+00
  br i1 %8, label %9, label %10

9:                                                ; preds = %5
  tail call void @_ZN10SimTKIpopt17MultiVectorMatrix18FillWithNewVectorsEv(ptr noundef nonnull align 8 dereferenceable(128) %0)
  br label %10

10:                                               ; preds = %9, %5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %11 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #10
  %12 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NRowsEv(ptr noundef nonnull align 8 dereferenceable(69) %3)
          to label %13 unwind label %20

13:                                               ; preds = %10
  invoke void @_ZN10SimTKIpopt16DenseVectorSpaceC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %11, i32 noundef %12)
          to label %14 unwind label %20

14:                                               ; preds = %13
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull %11)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %15 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %16 = invoke noundef ptr @_ZNK10SimTKIpopt16DenseVectorSpace18MakeNewDenseVectorEv(ptr noundef nonnull align 8 dereferenceable(16) %15)
          to label %17 unwind label %22

17:                                               ; preds = %14
  invoke void @_ZN10SimTKIpopt8SmartPtrINS_11DenseVectorEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef %16)
          to label %18 unwind label %22

18:                                               ; preds = %17
  %19 = call ptr @__dynamic_cast(ptr nonnull %3, ptr nonnull @_ZTIN10SimTKIpopt6MatrixE, ptr nonnull @_ZTIN10SimTKIpopt14DenseGenMatrixE, i64 0) #9
  br label %24

20:                                               ; preds = %13, %10
  %21 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %11, i64 noundef 16) #11
  br label %63

22:                                               ; preds = %17, %14
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %62

24:                                               ; preds = %56, %18
  %.027 = phi i32 [ 0, %18 ], [ %57, %56 ]
  %25 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69) %0)
          to label %26 unwind label %29

26:                                               ; preds = %24
  %27 = icmp slt i32 %.027, %25
  br i1 %27, label %31, label %28

28:                                               ; preds = %26
  invoke void @_ZN10SimTKIpopt12TaggedObject13ObjectChangedEv(ptr noundef nonnull align 8 dereferenceable(56) %0)
          to label %58 unwind label %59

29:                                               ; preds = %24
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %61

31:                                               ; preds = %26
  %32 = call noundef ptr @_ZNK10SimTKIpopt14DenseGenMatrix6ValuesEv(ptr noundef nonnull align 8 dereferenceable(89) %19)
  %33 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_11DenseVectorEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %34 = invoke noundef ptr @_ZN10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %33)
          to label %.preheader unwind label %42

.preheader:                                       ; preds = %31, %48
  %indvars.iv = phi i64 [ %indvars.iv.next, %48 ], [ 0, %31 ]
  %35 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69) %2)
          to label %36 unwind label %44

36:                                               ; preds = %.preheader
  %37 = sext i32 %35 to i64
  %38 = icmp slt i64 %indvars.iv, %37
  br i1 %38, label %46, label %39

39:                                               ; preds = %36
  %40 = call noundef nonnull align 8 dereferenceable(240) ptr @_ZNK10SimTKIpopt8SmartPtrINS_11DenseVectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %41 = call noundef ptr @_ZN10SimTKIpopt17MultiVectorMatrix3VecEi(ptr noundef nonnull align 8 dereferenceable(128) %0, i32 noundef %.027)
  invoke void @_ZNK10SimTKIpopt6Matrix10MultVectorEdRKNS_6VectorEdRS1_(ptr noundef nonnull align 8 dereferenceable(69) %2, double noundef %1, ptr noundef nonnull align 8 dereferenceable(205) %40, double noundef %4, ptr noundef nonnull align 8 dereferenceable(205) %41)
          to label %56 unwind label %42

42:                                               ; preds = %39, %31
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %61

44:                                               ; preds = %46, %.preheader
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %61

46:                                               ; preds = %36
  %47 = invoke noundef i32 @_ZNK10SimTKIpopt6Matrix5NRowsEv(ptr noundef nonnull align 8 dereferenceable(69) %3)
          to label %48 unwind label %44

48:                                               ; preds = %46
  %49 = mul nsw i32 %47, %.027
  %50 = trunc nuw nsw i64 %indvars.iv to i32
  %51 = add nsw i32 %49, %50
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds double, ptr %32, i64 %52
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds double, ptr %34, i64 %indvars.iv
  store double %54, ptr %55, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br label %.preheader, !llvm.loop !9

56:                                               ; preds = %39
  %57 = add nuw nsw i32 %.027, 1
  br label %24, !llvm.loop !11

58:                                               ; preds = %28
  call void @_ZN10SimTKIpopt8SmartPtrINS_11DenseVectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  ret void

59:                                               ; preds = %28
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %61

61:                                               ; preds = %29, %44, %42, %59
  %.pn.pn.pn = phi { ptr, i32 } [ %60, %59 ], [ %30, %29 ], [ %45, %44 ], [ %43, %42 ]
  call void @_ZN10SimTKIpopt8SmartPtrINS_11DenseVectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #9
  br label %62

62:                                               ; preds = %61, %22
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %61 ], [ %23, %22 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_16DenseVectorSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #9
  br label %63

63:                                               ; preds = %62, %20
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %62 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  resume { ptr, i32 } %.pn.pn.pn.pn.pn
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt16DenseVectorSpaceC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #2 align 2

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

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

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

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

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

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

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

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nobuiltin nounwind "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 = { mustprogress nofree 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 = { nobuiltin allocsize(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 = { 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 = { "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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass