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

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

@_ZTIN10SimTKIpopt11MatrixSpaceE = external constant ptr
@_ZTIN10SimTKIpopt19CompoundMatrixSpaceE = external dso_local constant { ptr, ptr, ptr }, align 8

; 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_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

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

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

; 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 uwtable
declare dso_local void @_ZN10SimTKIpopt13TripletHelper10FillRowColEiRKNS_6MatrixEPiS4_ii(i32 noundef, ptr noundef nonnull align 8 dereferenceable(69), ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt13TripletHelper11FillRowCol_EiRKNS_14CompoundMatrixEiiPiS4_(i32 noundef %0, ptr noundef nonnull align 8 dereferenceable(129) %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #2 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca %"class.SimTKIpopt::SmartPtr.5", align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %"class.SimTKIpopt::SmartPtr.6", align 8
  %24 = alloca i32, align 4
  store i32 %0, ptr %7, align 4, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %25 = load ptr, ptr %8, align 8, !tbaa !9
  call void @_ZNK10SimTKIpopt6Matrix10OwnerSpaceEv(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8 %15, ptr noundef nonnull align 8 dereferenceable(69) %25)
  %26 = invoke noundef ptr @_ZN10SimTKIpopt9GetRawPtrIKNS_11MatrixSpaceEEEPT_RKNS_8SmartPtrIS3_EE(ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %27 unwind label %31

27:                                               ; preds = %6
  %28 = icmp eq ptr %26, null
  br i1 %28, label %35, label %29

29:                                               ; preds = %27
  %30 = call ptr @__dynamic_cast(ptr %26, ptr @_ZTIN10SimTKIpopt11MatrixSpaceE, ptr @_ZTIN10SimTKIpopt19CompoundMatrixSpaceE, i64 0) #6
  br label %36

31:                                               ; preds = %6
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %16, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %17, align 4
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %112

35:                                               ; preds = %27
  br label %36

36:                                               ; preds = %35, %29
  %37 = phi ptr [ %30, %29 ], [ null, %35 ]
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  store ptr %37, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %38 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %38, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %108, %36
  %40 = load i32, ptr %19, align 4, !tbaa !5
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129) %41)
  %43 = icmp slt i32 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  store i32 2, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %111

45:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %46 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %46, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %98, %45
  %48 = load i32, ptr %22, align 4, !tbaa !5
  %49 = load ptr, ptr %8, align 8, !tbaa !9
  %50 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %49)
  %51 = icmp slt i32 %48, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %47
  store i32 5, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  br label %102

53:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %54 = load ptr, ptr %8, align 8, !tbaa !9
  %55 = load i32, ptr %19, align 4, !tbaa !5
  %56 = load i32, ptr %22, align 4, !tbaa !5
  call void @_ZNK10SimTKIpopt14CompoundMatrix7GetCompEii(ptr dead_on_unwind writable sret(%"class.SimTKIpopt::SmartPtr.6") align 8 %23, ptr noundef nonnull align 8 dereferenceable(129) %54, i32 noundef %55, i32 noundef %56)
  %57 = invoke noundef zeroext i1 @_ZN10SimTKIpopt7IsValidIKNS_6MatrixEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %58 unwind label %83

58:                                               ; preds = %53
  br i1 %57, label %59, label %91

59:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  %60 = invoke noundef nonnull align 8 dereferenceable(69) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6MatrixEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %61 unwind label %87

61:                                               ; preds = %59
  %62 = invoke noundef i32 @_ZN10SimTKIpopt13TripletHelper16GetNumberEntriesERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(69) %60)
          to label %63 unwind label %87

63:                                               ; preds = %61
  store i32 %62, ptr %24, align 4, !tbaa !5
  %64 = load i32, ptr %24, align 4, !tbaa !5
  %65 = load i32, ptr %13, align 4, !tbaa !5
  %66 = add nsw i32 %65, %64
  store i32 %66, ptr %13, align 4, !tbaa !5
  %67 = load i32, ptr %24, align 4, !tbaa !5
  %68 = invoke noundef nonnull align 8 dereferenceable(69) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6MatrixEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23)
          to label %69 unwind label %87

69:                                               ; preds = %63
  %70 = load ptr, ptr %11, align 8, !tbaa !9
  %71 = load ptr, ptr %12, align 8, !tbaa !9
  %72 = load i32, ptr %18, align 4, !tbaa !5
  %73 = load i32, ptr %21, align 4, !tbaa !5
  invoke void @_ZN10SimTKIpopt13TripletHelper10FillRowColEiRKNS_6MatrixEPiS4_ii(i32 noundef %67, ptr noundef nonnull align 8 dereferenceable(69) %68, ptr noundef %70, ptr noundef %71, i32 noundef %72, i32 noundef %73)
          to label %74 unwind label %87

74:                                               ; preds = %69
  %75 = load i32, ptr %24, align 4, !tbaa !5
  %76 = load ptr, ptr %11, align 8, !tbaa !9
  %77 = sext i32 %75 to i64
  %78 = getelementptr inbounds i32, ptr %76, i64 %77
  store ptr %78, ptr %11, align 8, !tbaa !9
  %79 = load i32, ptr %24, align 4, !tbaa !5
  %80 = load ptr, ptr %12, align 8, !tbaa !9
  %81 = sext i32 %79 to i64
  %82 = getelementptr inbounds i32, ptr %80, i64 %81
  store ptr %82, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %91

83:                                               ; preds = %91, %53
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %16, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %17, align 4
  br label %101

87:                                               ; preds = %69, %63, %61, %59
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %16, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %101

91:                                               ; preds = %74, %58
  %92 = load ptr, ptr %14, align 8, !tbaa !9
  %93 = load i32, ptr %22, align 4, !tbaa !5
  %94 = invoke noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockColsEi(ptr noundef nonnull align 8 dereferenceable(129) %92, i32 noundef %93)
          to label %95 unwind label %83

95:                                               ; preds = %91
  %96 = load i32, ptr %21, align 4, !tbaa !5
  %97 = add nsw i32 %96, %94
  store i32 %97, ptr %21, align 4, !tbaa !5
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  br label %98

98:                                               ; preds = %95
  %99 = load i32, ptr %22, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %22, align 4, !tbaa !5
  br label %47, !llvm.loop !11

101:                                              ; preds = %87, %83
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %112

102:                                              ; preds = %52
  %103 = load ptr, ptr %14, align 8, !tbaa !9
  %104 = load i32, ptr %19, align 4, !tbaa !5
  %105 = call noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockRowsEi(ptr noundef nonnull align 8 dereferenceable(129) %103, i32 noundef %104)
  %106 = load i32, ptr %18, align 4, !tbaa !5
  %107 = add nsw i32 %106, %105
  store i32 %107, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %108

108:                                              ; preds = %102
  %109 = load i32, ptr %19, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %19, align 4, !tbaa !5
  br label %39, !llvm.loop !13

111:                                              ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  ret void

112:                                              ; preds = %101, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %113

113:                                              ; preds = %112
  %114 = load ptr, ptr %16, align 8
  %115 = load i32, ptr %17, align 4
  %116 = insertvalue { ptr, i32 } poison, ptr %114, 0
  %117 = insertvalue { ptr, i32 } %116, i32 %115, 1
  resume { ptr, i32 } %117
}

; 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129)) #4 align 2

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

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

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

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

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

declare noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockColsEi(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef) #5

declare noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockRowsEi(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind willreturn memory(read) }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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

@_ZTIN10SimTKIpopt11MatrixSpaceE = external constant ptr
@_ZTIN10SimTKIpopt19CompoundMatrixSpaceE = external dso_local constant { ptr, ptr, ptr }, align 8

; 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_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN10SimTKIpopt13TripletHelper16GetNumberEntriesERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(69)) 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: mustprogress nounwind uwtable
declare dso_local void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10SimTKIpopt13TripletHelper10FillRowColEiRKNS_6MatrixEPiS4_ii(i32 noundef, ptr noundef nonnull align 8 dereferenceable(69), ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SimTKIpopt13TripletHelper11FillRowCol_EiRKNS_14CompoundMatrixEiiPiS4_(i32 noundef %0, ptr noundef nonnull align 8 dereferenceable(129) %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %7 = alloca %"class.SimTKIpopt::SmartPtr.5", align 8
  %8 = alloca %"class.SimTKIpopt::SmartPtr.6", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  call void @_ZNK10SimTKIpopt6Matrix10OwnerSpaceEv(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.5") align 8 %7, ptr noundef nonnull align 8 dereferenceable(69) %1)
  %9 = call noundef ptr @_ZN10SimTKIpopt9GetRawPtrIKNS_11MatrixSpaceEEEPT_RKNS_8SmartPtrIS3_EE(ptr noundef nonnull align 8 dereferenceable(8) %7)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %13, label %11

11:                                               ; preds = %6
  %12 = call ptr @__dynamic_cast(ptr nonnull %9, ptr nonnull @_ZTIN10SimTKIpopt11MatrixSpaceE, ptr nonnull @_ZTIN10SimTKIpopt19CompoundMatrixSpaceE, i64 0) #6
  br label %13

13:                                               ; preds = %6, %11
  %14 = phi ptr [ %12, %11 ], [ null, %6 ]
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %15 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129) %1)
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.preheader, label %._crit_edge62

.preheader:                                       ; preds = %13, %._crit_edge
  %.061 = phi ptr [ %.1.lcssa, %._crit_edge ], [ %4, %13 ]
  %.03260 = phi i32 [ %21, %._crit_edge ], [ 0, %13 ]
  %.03359 = phi i32 [ %20, %._crit_edge ], [ %2, %13 ]
  %.03658 = phi ptr [ %.137.lcssa, %._crit_edge ], [ %5, %13 ]
  %17 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %1)
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge62:                                    ; preds = %._crit_edge, %13
  ret void

._crit_edge:                                      ; preds = %41, %.preheader
  %.137.lcssa = phi ptr [ %.03658, %.preheader ], [ %.238, %41 ]
  %.1.lcssa = phi ptr [ %.061, %.preheader ], [ %.2, %41 ]
  %19 = call noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockRowsEi(ptr noundef nonnull align 8 dereferenceable(129) %14, i32 noundef %.03260)
  %20 = add nsw i32 %19, %.03359
  %21 = add nuw nsw i32 %.03260, 1
  %22 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_RowsEv(ptr noundef nonnull align 8 dereferenceable(129) %1)
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %.preheader, label %._crit_edge62, !llvm.loop !5

.lr.ph:                                           ; preds = %.preheader, %41
  %.154 = phi ptr [ %.2, %41 ], [ %.061, %.preheader ]
  %.03053 = phi i32 [ %43, %41 ], [ 0, %.preheader ]
  %.03152 = phi i32 [ %42, %41 ], [ %3, %.preheader ]
  %.13751 = phi ptr [ %.238, %41 ], [ %.03658, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @_ZNK10SimTKIpopt14CompoundMatrix7GetCompEii(ptr dead_on_unwind nonnull writable sret(%"class.SimTKIpopt::SmartPtr.6") align 8 %8, ptr noundef nonnull align 8 dereferenceable(129) %1, i32 noundef %.03260, i32 noundef %.03053)
  %24 = invoke noundef zeroext i1 @_ZN10SimTKIpopt7IsValidIKNS_6MatrixEEEbRKNS_8SmartPtrIT_EE(ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %25 unwind label %35

25:                                               ; preds = %.lr.ph
  br i1 %24, label %26, label %39

26:                                               ; preds = %25
  %27 = call noundef nonnull align 8 dereferenceable(69) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6MatrixEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  %28 = invoke noundef i32 @_ZN10SimTKIpopt13TripletHelper16GetNumberEntriesERKNS_6MatrixE(ptr noundef nonnull align 8 dereferenceable(69) %27)
          to label %29 unwind label %37

29:                                               ; preds = %26
  %30 = call noundef nonnull align 8 dereferenceable(69) ptr @_ZNK10SimTKIpopt8SmartPtrIKNS_6MatrixEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8)
  invoke void @_ZN10SimTKIpopt13TripletHelper10FillRowColEiRKNS_6MatrixEPiS4_ii(i32 noundef %28, ptr noundef nonnull align 8 dereferenceable(69) %30, ptr noundef %.154, ptr noundef %.13751, i32 noundef %.03359, i32 noundef %.03152)
          to label %31 unwind label %37

31:                                               ; preds = %29
  %32 = sext i32 %28 to i64
  %33 = getelementptr inbounds i32, ptr %.154, i64 %32
  %34 = getelementptr inbounds i32, ptr %.13751, i64 %32
  br label %39

35:                                               ; preds = %39, %.lr.ph
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %46

37:                                               ; preds = %29, %26
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %46

39:                                               ; preds = %31, %25
  %.238 = phi ptr [ %34, %31 ], [ %.13751, %25 ]
  %.2 = phi ptr [ %33, %31 ], [ %.154, %25 ]
  %40 = invoke noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockColsEi(ptr noundef nonnull align 8 dereferenceable(129) %14, i32 noundef %.03053)
          to label %41 unwind label %35

41:                                               ; preds = %39
  %42 = add nsw i32 %40, %.03152
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  %43 = add nuw nsw i32 %.03053, 1
  %44 = call noundef i32 @_ZNK10SimTKIpopt14CompoundMatrix11NComps_ColsEv(ptr noundef nonnull align 8 dereferenceable(129) %1)
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !7

46:                                               ; preds = %37, %35
  %.pn = phi { ptr, i32 } [ %36, %35 ], [ %38, %37 ]
  call void @_ZN10SimTKIpopt8SmartPtrIKNS_6MatrixEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  resume { ptr, i32 } %.pn
}

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

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

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

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

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

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

declare noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockColsEi(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef) local_unnamed_addr #5

declare noundef i32 @_ZNK10SimTKIpopt19CompoundMatrixSpace12GetBlockRowsEi(ptr noundef nonnull align 8 dereferenceable(129), i32 noundef) local_unnamed_addr #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 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass