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

; 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.25" = type { ptr }
%"class.SimTKIpopt::SmartPtr.26" = type { ptr }
%"class.SimTKIpopt::SmartPtr.24" = type { ptr }
%"class.SimTKIpopt::SmartPtr.96" = type { ptr }
%"class.SimTKIpopt::RestoIpoptNLP" = type { %"class.SimTKIpopt::IpoptNLP", %"class.SimTKIpopt::SmartPtr.17", %"class.SimTKIpopt::SmartPtr.18", %"class.SimTKIpopt::SmartPtr.19", %"class.SimTKIpopt::SmartPtr.20", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.20", %"class.SimTKIpopt::SmartPtr.21", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.21", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr", %"class.SimTKIpopt::SmartPtr.5", %"class.SimTKIpopt::SmartPtr.21", %"class.SimTKIpopt::SmartPtr.21", %"class.SimTKIpopt::SmartPtr.22", %"class.SimTKIpopt::SmartPtr.23", %"class.SimTKIpopt::SmartPtr.24", %"class.SimTKIpopt::SmartPtr.25", %"class.SimTKIpopt::SmartPtr.24", %"class.SimTKIpopt::SmartPtr.25", %"class.SimTKIpopt::SmartPtr.26", %"class.SimTKIpopt::SmartPtr.25", %"class.SimTKIpopt::SmartPtr.26", double, double, double, %"class.SimTKIpopt::SmartPtr.27", %"class.SimTKIpopt::SmartPtr.28", %"class.SimTKIpopt::SmartPtr.27", i8, i32, i8, i32, i32, i32, i32, i32, i32, i32 }
%"class.SimTKIpopt::IpoptNLP" = type { %"class.SimTKIpopt::ReferencedObject.base", %"class.SimTKIpopt::SmartPtr.16" }
%"class.SimTKIpopt::ReferencedObject.base" = type <{ ptr, i32 }>
%"class.SimTKIpopt::SmartPtr.16" = type { ptr }
%"class.SimTKIpopt::SmartPtr.17" = type { ptr }
%"class.SimTKIpopt::SmartPtr.18" = type { ptr }
%"class.SimTKIpopt::SmartPtr.19" = type { ptr }
%"class.SimTKIpopt::SmartPtr.20" = type { ptr }
%"class.SimTKIpopt::SmartPtr" = type { ptr }
%"class.SimTKIpopt::SmartPtr.5" = type { ptr }
%"class.SimTKIpopt::SmartPtr.21" = type { ptr }
%"class.SimTKIpopt::SmartPtr.22" = type { ptr }
%"class.SimTKIpopt::SmartPtr.23" = type { ptr }
%"class.SimTKIpopt::SmartPtr.28" = type { ptr }
%"class.SimTKIpopt::SmartPtr.27" = type { ptr }

@_ZTIN10SimTKIpopt6VectorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14CompoundVectorE = external constant ptr
@_ZTIN10SimTKIpopt6MatrixE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14IdentityMatrixE = 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: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

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

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

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

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

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

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

declare noundef ptr @_ZNK10SimTKIpopt19CompoundMatrixSpace21MakeNewCompoundMatrixEv(ptr noundef nonnull align 8 dereferenceable(129)) #4

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

declare void @_ZN10SimTKIpopt14CompoundMatrix7SetCompEiiRKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(69)) #4

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt13RestoIpoptNLP5jac_cERKNS_6VectorE(ptr dead_on_unwind noalias writable sret(%"class.SimTKIpopt::SmartPtr.26") align 8 %0, ptr noundef nonnull align 8 dereferenceable(312) %1, ptr noundef nonnull align 8 dereferenceable(205) %2) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.SimTKIpopt::SmartPtr.25", align 8
  %9 = alloca %"class.SimTKIpopt::SmartPtr.26", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"class.SimTKIpopt::SmartPtr.24", align 8
  %13 = alloca %"class.SimTKIpopt::SmartPtr.96", align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %20, label %18

18:                                               ; preds = %3
  %19 = call ptr @__dynamic_cast(ptr %16, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #5
  br label %21

20:                                               ; preds = %3
  br label %21

21:                                               ; preds = %20, %18
  %22 = phi ptr [ %19, %18 ], [ null, %20 ]
  store ptr %22, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZNK10SimTKIpopt14CompoundVector7GetCompEi(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.25") align 8 %8, ptr noundef nonnull align 8 dereferenceable(265) %23, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %24 = getelementptr inbounds %"class.SimTKIpopt::RestoIpoptNLP", ptr %15, i32 0, i32 1
  %25 = invoke noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_8IpoptNLPEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
          to label %26 unwind label %52

26:                                               ; preds = %21
  %27 = invoke noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %28 unwind label %52

28:                                               ; preds = %26
  %29 = load ptr, ptr %25, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 8
  %31 = load ptr, ptr %30, align 8
  invoke void %31(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.26") align 8 %9, ptr noundef nonnull align 8 dereferenceable(24) %25, ptr noundef nonnull align 8 dereferenceable(205) %27)
          to label %32 unwind label %52

32:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %33 = getelementptr inbounds %"class.SimTKIpopt::RestoIpoptNLP", ptr %15, i32 0, i32 15
  %34 = invoke noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_19CompoundMatrixSpaceEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %33)
          to label %35 unwind label %56

35:                                               ; preds = %32
  %36 = invoke noundef ptr @_ZNK10SimTKIpopt19CompoundMatrixSpace21MakeNewCompoundMatrixEv(ptr noundef nonnull align 8 dereferenceable(129) %34)
          to label %37 unwind label %56

37:                                               ; preds = %35
  invoke void @_ZN10SimTKIpopt8SmartPtrINS_14CompoundMatrixEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef %36)
          to label %38 unwind label %56

38:                                               ; preds = %37
  %39 = invoke noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_14CompoundMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %40 unwind label %60

40:                                               ; preds = %38
  %41 = invoke noundef nonnull align 8 dereferenceable(69) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6MatrixEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %42 unwind label %60

42:                                               ; preds = %40
  invoke void @_ZN10SimTKIpopt14CompoundMatrix7SetCompEiiRKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(129) %39, i32 noundef 0, i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(69) %41)
          to label %43 unwind label %60

43:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %44 = invoke noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_14CompoundMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %45 unwind label %64

45:                                               ; preds = %43
  invoke void @_ZN10SimTKIpopt14CompoundMatrix15GetCompNonConstEii(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.96") align 8 %13, ptr noundef nonnull align 8 dereferenceable(129) %44, i32 noundef 0, i32 noundef 2)
          to label %46 unwind label %64

46:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %47 = invoke noundef ptr @_ZN10SimTKIpopt9GetRawPtrINS_6MatrixEEEPT_RKNS_8SmartPtrIS2_EE(ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %48 unwind label %68

48:                                               ; preds = %46
  %49 = icmp eq ptr %47, null
  br i1 %49, label %72, label %50

50:                                               ; preds = %48
  %51 = call ptr @__dynamic_cast(ptr %47, ptr @_ZTIN10SimTKIpopt6MatrixE, ptr @_ZTIN10SimTKIpopt14IdentityMatrixE, i64 0) #5
  br label %73

52:                                               ; preds = %28, %26, %21
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %10, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %11, align 4
  br label %83

56:                                               ; preds = %37, %35, %32
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %10, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %11, align 4
  br label %82

60:                                               ; preds = %42, %40, %38
  %61 = landingpad { ptr, i32 }
          cleanup
  %62 = extractvalue { ptr, i32 } %61, 0
  store ptr %62, ptr %10, align 8
  %63 = extractvalue { ptr, i32 } %61, 1
  store i32 %63, ptr %11, align 4
  br label %81

64:                                               ; preds = %45, %43
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %10, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %11, align 4
  br label %80

68:                                               ; preds = %78, %76, %73, %46
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %10, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @_ZN10SimTKIpopt8SmartPtrINS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  br label %80

72:                                               ; preds = %48
  br label %73

73:                                               ; preds = %72, %50
  %74 = phi ptr [ %51, %50 ], [ null, %72 ]
  store ptr %74, ptr %14, align 8, !tbaa !5
  %75 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN10SimTKIpopt14IdentityMatrix9SetFactorEd(ptr noundef nonnull align 8 dereferenceable(88) %75, double noundef -1.000000e+00)
          to label %76 unwind label %68

76:                                               ; preds = %73
  %77 = invoke noundef ptr @_ZN10SimTKIpopt9GetRawPtrINS_14CompoundMatrixEEEPT_RKNS_8SmartPtrIS2_EE(ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %78 unwind label %68

78:                                               ; preds = %76
  invoke void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %77)
          to label %79 unwind label %68

79:                                               ; preds = %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @_ZN10SimTKIpopt8SmartPtrINS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @_ZN10SimTKIpopt8SmartPtrINS_14CompoundMatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void

80:                                               ; preds = %68, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %81

81:                                               ; preds = %80, %60
  call void @_ZN10SimTKIpopt8SmartPtrINS_14CompoundMatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %12) #5
  br label %82

82:                                               ; preds = %81, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  br label %83

83:                                               ; preds = %82, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr %10, align 8
  %86 = load i32, ptr %11, align 4
  %87 = insertvalue { ptr, i32 } poison, ptr %85, 0
  %88 = insertvalue { ptr, i32 } %87, i32 %86, 1
  resume { ptr, i32 } %88
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt14IdentityMatrix9SetFactorEd(ptr noundef nonnull align 8 dereferenceable(88), double noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrINS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #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 = { nounwind willreturn memory(read) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}


; 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.25" = type { ptr }
%"class.SimTKIpopt::SmartPtr.26" = type { ptr }
%"class.SimTKIpopt::SmartPtr.24" = type { ptr }
%"class.SimTKIpopt::SmartPtr.96" = type { ptr }

@_ZTIN10SimTKIpopt6VectorE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14CompoundVectorE = external constant ptr
@_ZTIN10SimTKIpopt6MatrixE = external dso_local constant { ptr, ptr, ptr }, align 8
@_ZTIN10SimTKIpopt14IdentityMatrixE = 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: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

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

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

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

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

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

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

declare noundef ptr @_ZNK10SimTKIpopt19CompoundMatrixSpace21MakeNewCompoundMatrixEv(ptr noundef nonnull align 8 dereferenceable(129)) local_unnamed_addr #4

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

declare void @_ZN10SimTKIpopt14CompoundMatrix7SetCompEiiRKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(69)) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt13RestoIpoptNLP5jac_cERKNS_6VectorE(ptr dead_on_unwind noalias writable sret(%"class.SimTKIpopt::SmartPtr.26") align 8 %0, ptr noundef nonnull align 8 dereferenceable(312) %1, ptr noundef nonnull align 8 dereferenceable(205) %2) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.SimTKIpopt::SmartPtr.25", align 8
  %5 = alloca %"class.SimTKIpopt::SmartPtr.26", align 8
  %6 = alloca %"class.SimTKIpopt::SmartPtr.24", align 8
  %7 = alloca %"class.SimTKIpopt::SmartPtr.96", align 8
  %8 = tail call ptr @__dynamic_cast(ptr nonnull %2, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt14CompoundVectorE, i64 0) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @_ZNK10SimTKIpopt14CompoundVector7GetCompEi(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.25") align 8 %4, ptr noundef nonnull align 8 dereferenceable(265) %8, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %9 = getelementptr inbounds i8, ptr %1, i64 24
  %10 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_8IpoptNLPEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %11 = call noundef nonnull align 8 dereferenceable(205) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6VectorEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4)
  %12 = load ptr, ptr %10, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 64
  %14 = load ptr, ptr %13, align 8
  invoke void %14(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.26") align 8 %5, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(205) %11)
          to label %15 unwind label %29

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %16 = getelementptr inbounds i8, ptr %1, i64 136
  %17 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_19CompoundMatrixSpaceEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %16)
  %18 = invoke noundef ptr @_ZNK10SimTKIpopt19CompoundMatrixSpace21MakeNewCompoundMatrixEv(ptr noundef nonnull align 8 dereferenceable(129) %17)
          to label %19 unwind label %31

19:                                               ; preds = %15
  call void @_ZN10SimTKIpopt8SmartPtrINS_14CompoundMatrixEEC2EPS1_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef %18)
  %20 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_14CompoundMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  %21 = call noundef nonnull align 8 dereferenceable(69) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6MatrixEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  invoke void @_ZN10SimTKIpopt14CompoundMatrix7SetCompEiiRKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(129) %20, i32 noundef 0, i32 noundef 0, ptr noundef nonnull align 8 dereferenceable(69) %21)
          to label %22 unwind label %33

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %23 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_14CompoundMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6)
  invoke void @_ZN10SimTKIpopt14CompoundMatrix15GetCompNonConstEii(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.96") align 8 %7, ptr noundef nonnull align 8 dereferenceable(129) %23, i32 noundef 0, i32 noundef 2)
          to label %24 unwind label %35

24:                                               ; preds = %22
  %25 = call noundef ptr @_ZN10SimTKIpopt9GetRawPtrINS_6MatrixEEEPT_RKNS_8SmartPtrIS2_EE(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %26 = icmp ne ptr %25, null
  call void @llvm.assume(i1 %26)
  %27 = call ptr @__dynamic_cast(ptr nonnull %25, ptr nonnull @_ZTIN10SimTKIpopt6MatrixE, ptr nonnull @_ZTIN10SimTKIpopt14IdentityMatrixE, i64 0) #6
  call void @_ZN10SimTKIpopt14IdentityMatrix9SetFactorEd(ptr noundef nonnull align 8 dereferenceable(88) %27, double noundef -1.000000e+00)
  %28 = call noundef ptr @_ZN10SimTKIpopt9GetRawPtrINS_14CompoundMatrixEEEPT_RKNS_8SmartPtrIS2_EE(ptr noundef nonnull align 8 dereferenceable(8) %6)
  invoke void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEEC2EPS2_(ptr noundef nonnull align 8 dereferenceable(8) %0, ptr noundef %28)
          to label %39 unwind label %37

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

31:                                               ; preds = %15
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %42

33:                                               ; preds = %19
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %41

35:                                               ; preds = %22
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %40

37:                                               ; preds = %24
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10SimTKIpopt8SmartPtrINS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  br label %40

39:                                               ; preds = %24
  call void @_ZN10SimTKIpopt8SmartPtrINS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @_ZN10SimTKIpopt8SmartPtrINS_14CompoundMatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  ret void

40:                                               ; preds = %37, %35
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %36, %35 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %41

41:                                               ; preds = %40, %33
  %.pn.pn = phi { ptr, i32 } [ %.pn, %40 ], [ %34, %33 ]
  call void @_ZN10SimTKIpopt8SmartPtrINS_14CompoundMatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  br label %42

42:                                               ; preds = %41, %31
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %41 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  br label %43

43:                                               ; preds = %42, %29
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %42 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6VectorEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  resume { ptr, i32 } %.pn.pn.pn.pn
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt14IdentityMatrix9SetFactorEd(ptr noundef nonnull align 8 dereferenceable(88), double noundef) local_unnamed_addr #1 align 2

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(read) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass