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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter14update_local_xERKNS_6VectorE(ptr noundef nonnull align 8 dereferenceable(400), ptr noundef nonnull align 8 dereferenceable(205)) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter6Eval_cERKNS_6VectorERS1_(ptr noundef nonnull align 8 dereferenceable(400) %0, ptr noundef nonnull align 8 dereferenceable(205) %1, ptr noundef nonnull align 8 dereferenceable(205) %2) unnamed_addr #4 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  store i8 0, ptr %8, align 1, !tbaa !9
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = call noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter14update_local_xERKNS_6VectorE(ptr noundef nonnull align 8 dereferenceable(400) %16, ptr noundef nonnull align 8 dereferenceable(205) %17)
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  store i8 1, ptr %8, align 1, !tbaa !9
  br label %20

20:                                               ; preds = %19, %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %25, label %23

23:                                               ; preds = %20
  %24 = call ptr @__dynamic_cast(ptr %21, ptr @_ZTIN10SimTKIpopt6VectorE, ptr @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #5
  br label %26

25:                                               ; preds = %20
  br label %26

26:                                               ; preds = %25, %23
  %27 = phi ptr [ %24, %23 ], [ null, %25 ]
  store ptr %27, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = call noundef ptr @_ZN10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %28)
  store ptr %29, ptr %10, align 8, !tbaa !5
  %30 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %31 = trunc i8 %30 to i1
  %32 = call noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter15internal_eval_gEb(ptr noundef nonnull align 8 dereferenceable(400) %16, i1 noundef zeroext %31)
  br i1 %32, label %33, label %118

33:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %34 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 53
  %35 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %34)
  %36 = call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %35)
  store ptr %36, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %37 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 53
  %38 = call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %37)
  %39 = call noundef i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69) %38)
  store i32 %39, ptr %12, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !13
  br label %40

40:                                               ; preds = %72, %33
  %41 = load i32, ptr %13, align 4, !tbaa !13
  %42 = load i32, ptr %12, align 4, !tbaa !13
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %75

45:                                               ; preds = %40
  %46 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 38
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = load i32, ptr %13, align 4, !tbaa !13
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !13
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds double, ptr %47, i64 %53
  %55 = load double, ptr %54, align 8, !tbaa !31
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = load i32, ptr %13, align 4, !tbaa !13
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds double, ptr %56, i64 %58
  store double %55, ptr %59, align 8, !tbaa !31
  %60 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 40
  %61 = load ptr, ptr %60, align 8, !tbaa !32
  %62 = load i32, ptr %13, align 4, !tbaa !13
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds double, ptr %61, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !31
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = load i32, ptr %13, align 4, !tbaa !13
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds double, ptr %66, i64 %68
  %70 = load double, ptr %69, align 8, !tbaa !31
  %71 = fsub double %70, %65
  store double %71, ptr %69, align 8, !tbaa !31
  br label %72

72:                                               ; preds = %45
  %73 = load i32, ptr %13, align 4, !tbaa !13
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %13, align 4, !tbaa !13
  br label %40, !llvm.loop !33

75:                                               ; preds = %44
  %76 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 5
  %77 = load i32, ptr %76, align 8, !tbaa !35
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %117

79:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !13
  br label %80

80:                                               ; preds = %113, %79
  %81 = load i32, ptr %14, align 4, !tbaa !13
  %82 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 20
  %83 = load i32, ptr %82, align 8, !tbaa !36
  %84 = icmp slt i32 %81, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %116

86:                                               ; preds = %80
  %87 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 36
  %88 = load ptr, ptr %87, align 8, !tbaa !37
  %89 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 58
  %90 = load ptr, ptr %89, align 8, !tbaa !38
  %91 = load i32, ptr %14, align 4, !tbaa !13
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr %90, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !13
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds double, ptr %88, i64 %95
  %97 = load double, ptr %96, align 8, !tbaa !31
  %98 = getelementptr inbounds %"class.SimTKIpopt::TNLPAdapter", ptr %16, i32 0, i32 40
  %99 = load ptr, ptr %98, align 8, !tbaa !32
  %100 = load i32, ptr %12, align 4, !tbaa !13
  %101 = load i32, ptr %14, align 4, !tbaa !13
  %102 = add nsw i32 %100, %101
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds double, ptr %99, i64 %103
  %105 = load double, ptr %104, align 8, !tbaa !31
  %106 = fsub double %97, %105
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i32, ptr %12, align 4, !tbaa !13
  %109 = load i32, ptr %14, align 4, !tbaa !13
  %110 = add nsw i32 %108, %109
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds double, ptr %107, i64 %111
  store double %106, ptr %112, align 8, !tbaa !31
  br label %113

113:                                              ; preds = %86
  %114 = load i32, ptr %14, align 4, !tbaa !13
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %14, align 4, !tbaa !13
  br label %80, !llvm.loop !39

116:                                              ; preds = %85
  br label %117

117:                                              ; preds = %116, %75
  store i1 true, ptr %4, align 1
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %119

118:                                              ; preds = %26
  store i1 false, ptr %4, align 1
  store i32 1, ptr %15, align 4
  br label %119

119:                                              ; preds = %118, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  %120 = load i1, ptr %4, align 1
  ret i1 %120
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter15internal_eval_gEb(ptr noundef nonnull align 8 dereferenceable(400), i1 noundef zeroext) #4 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 = { 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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 248}
!16 = !{!"_ZTSN10SimTKIpopt11TNLPAdapterE", !17, i64 0, !19, i64 16, !20, i64 24, !21, i64 32, !21, i64 40, !22, i64 48, !23, i64 52, !21, i64 56, !21, i64 64, !10, i64 72, !10, i64 73, !24, i64 76, !14, i64 80, !14, i64 84, !14, i64 88, !14, i64 92, !14, i64 96, !14, i64 100, !14, i64 104, !14, i64 108, !14, i64 112, !25, i64 116, !26, i64 120, !26, i64 128, !26, i64 136, !26, i64 144, !27, i64 152, !26, i64 160, !27, i64 168, !26, i64 176, !27, i64 184, !26, i64 192, !27, i64 200, !27, i64 208, !27, i64 216, !28, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !14, i64 272, !14, i64 276, !14, i64 280, !14, i64 284, !14, i64 288, !29, i64 296, !30, i64 304, !29, i64 312, !30, i64 320, !29, i64 328, !30, i64 336, !30, i64 344, !29, i64 352, !30, i64 360, !29, i64 368, !6, i64 376, !6, i64 384, !6, i64 392}
!17 = !{!"_ZTSN10SimTKIpopt3NLPE", !18, i64 0}
!18 = !{!"_ZTSN10SimTKIpopt16ReferencedObjectE", !14, i64 8}
!19 = !{!"_ZTSN10SimTKIpopt8SmartPtrINS_4TNLPEEE", !6, i64 0}
!20 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_10JournalistEEE", !6, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = !{!"_ZTSN10SimTKIpopt11TNLPAdapter26FixedVariableTreatmentEnumE", !7, i64 0}
!23 = !{!"_ZTSN10SimTKIpopt11TNLPAdapter18DerivativeTestEnumE", !7, i64 0}
!24 = !{!"_ZTSN10SimTKIpopt24HessianApproximationTypeE", !7, i64 0}
!25 = !{!"_ZTSN10SimTKIpopt4TNLP14IndexStyleEnumE", !7, i64 0}
!26 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11VectorSpaceEEE", !6, i64 0}
!27 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEEE", !6, i64 0}
!28 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_14SymMatrixSpaceEEE", !6, i64 0}
!29 = !{!"_ZTSN10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEE", !6, i64 0}
!30 = !{!"_ZTSN10SimTKIpopt8SmartPtrINS_20ExpansionMatrixSpaceEEE", !6, i64 0}
!31 = !{!21, !21, i64 0}
!32 = !{!16, !6, i64 264}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!16, !22, i64 48}
!36 = !{!16, !14, i64 112}
!37 = !{!16, !6, i64 232}
!38 = !{!16, !6, i64 392}
!39 = distinct !{!39, !34}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter14update_local_xERKNS_6VectorE(ptr noundef nonnull align 8 dereferenceable(400), ptr noundef nonnull align 8 dereferenceable(205)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter6Eval_cERKNS_6VectorERS1_(ptr noundef nonnull align 8 dereferenceable(400) %0, ptr noundef nonnull align 8 dereferenceable(205) %1, ptr noundef nonnull align 8 dereferenceable(205) %2) unnamed_addr #3 align 2 {
  %4 = tail call noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter14update_local_xERKNS_6VectorE(ptr noundef nonnull align 8 dereferenceable(400) %0, ptr noundef nonnull align 8 dereferenceable(205) %1)
  %5 = tail call ptr @__dynamic_cast(ptr nonnull %2, ptr nonnull @_ZTIN10SimTKIpopt6VectorE, ptr nonnull @_ZTIN10SimTKIpopt11DenseVectorE, i64 0) #4
  %6 = tail call noundef ptr @_ZN10SimTKIpopt11DenseVector6ValuesEv(ptr noundef nonnull align 8 dereferenceable(240) %5)
  %7 = tail call noundef zeroext i1 @_ZN10SimTKIpopt11TNLPAdapter15internal_eval_gEb(ptr noundef nonnull align 8 dereferenceable(400) %0, i1 noundef zeroext %4)
  br i1 %7, label %8, label %.loopexit

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 352
  %10 = tail call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %11 = tail call noundef ptr @_ZNK10SimTKIpopt15ExpansionMatrix18ExpandedPosIndicesEv(ptr noundef nonnull align 8 dereferenceable(80) %10)
  %12 = tail call noundef ptr @_ZNK10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %9)
  %13 = tail call noundef i32 @_ZNK10SimTKIpopt6Matrix5NColsEv(ptr noundef nonnull align 8 dereferenceable(69) %12)
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %8
  %15 = getelementptr inbounds i8, ptr %0, i64 248
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 264
  %18 = load ptr, ptr %17, align 8, !tbaa !26
  %wide.trip.count = zext nneg i32 %13 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %19 = icmp eq i32 %13, 1
  br i1 %19, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %43

._crit_edge.loopexit.unr-lcssa:                   ; preds = %43, %.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next.1, %43 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %._crit_edge.loopexit.unr-lcssa
  %20 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv.unr
  %21 = load i32, ptr %20, align 4, !tbaa !27
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds double, ptr %16, i64 %22
  %24 = load double, ptr %23, align 8, !tbaa !28
  %25 = getelementptr inbounds double, ptr %6, i64 %indvars.iv.unr
  store double %24, ptr %25, align 8, !tbaa !28
  %26 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.unr
  %27 = load double, ptr %26, align 8, !tbaa !28
  %28 = fsub double %24, %27
  store double %28, ptr %25, align 8, !tbaa !28
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %8
  %29 = getelementptr inbounds i8, ptr %0, i64 48
  %30 = load i32, ptr %29, align 8, !tbaa !29
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %._crit_edge
  %32 = getelementptr inbounds i8, ptr %0, i64 112
  %33 = load i32, ptr %32, align 8, !tbaa !30
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph29, label %.loopexit

.lr.ph29:                                         ; preds = %.preheader
  %35 = getelementptr inbounds i8, ptr %0, i64 232
  %36 = load ptr, ptr %35, align 8, !tbaa !31
  %37 = getelementptr inbounds i8, ptr %0, i64 392
  %38 = load ptr, ptr %37, align 8, !tbaa !32
  %39 = getelementptr inbounds i8, ptr %0, i64 264
  %40 = load ptr, ptr %39, align 8, !tbaa !26
  %41 = sext i32 %13 to i64
  %wide.trip.count34 = zext nneg i32 %33 to i64
  %xtraiter37 = and i64 %wide.trip.count34, 1
  %42 = icmp eq i32 %33, 1
  br i1 %42, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph29.new

.lr.ph29.new:                                     ; preds = %.lr.ph29
  %unroll_iter39 = and i64 %wide.trip.count34, 2147483646
  br label %62

43:                                               ; preds = %43, %.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.new ], [ %indvars.iv.next.1, %43 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %43 ]
  %44 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv
  %45 = load i32, ptr %44, align 4, !tbaa !27
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds double, ptr %16, i64 %46
  %48 = load double, ptr %47, align 8, !tbaa !28
  %49 = getelementptr inbounds double, ptr %6, i64 %indvars.iv
  store double %48, ptr %49, align 8, !tbaa !28
  %50 = getelementptr inbounds double, ptr %18, i64 %indvars.iv
  %51 = load double, ptr %50, align 8, !tbaa !28
  %52 = fsub double %48, %51
  store double %52, ptr %49, align 8, !tbaa !28
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %53 = getelementptr inbounds i32, ptr %11, i64 %indvars.iv.next
  %54 = load i32, ptr %53, align 4, !tbaa !27
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds double, ptr %16, i64 %55
  %57 = load double, ptr %56, align 8, !tbaa !28
  %58 = getelementptr inbounds double, ptr %6, i64 %indvars.iv.next
  store double %57, ptr %58, align 8, !tbaa !28
  %59 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.next
  %60 = load double, ptr %59, align 8, !tbaa !28
  %61 = fsub double %57, %60
  store double %61, ptr %58, align 8, !tbaa !28
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %43, !llvm.loop !33

62:                                               ; preds = %62, %.lr.ph29.new
  %indvars.iv31 = phi i64 [ 0, %.lr.ph29.new ], [ %indvars.iv.next32.1, %62 ]
  %niter40 = phi i64 [ 0, %.lr.ph29.new ], [ %niter40.next.1, %62 ]
  %63 = getelementptr inbounds i32, ptr %38, i64 %indvars.iv31
  %64 = load i32, ptr %63, align 4, !tbaa !27
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds double, ptr %36, i64 %65
  %67 = load double, ptr %66, align 8, !tbaa !28
  %68 = add nsw i64 %indvars.iv31, %41
  %69 = getelementptr inbounds double, ptr %40, i64 %68
  %70 = load double, ptr %69, align 8, !tbaa !28
  %71 = fsub double %67, %70
  %72 = getelementptr inbounds double, ptr %6, i64 %68
  store double %71, ptr %72, align 8, !tbaa !28
  %indvars.iv.next32 = or disjoint i64 %indvars.iv31, 1
  %73 = getelementptr inbounds i32, ptr %38, i64 %indvars.iv.next32
  %74 = load i32, ptr %73, align 4, !tbaa !27
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds double, ptr %36, i64 %75
  %77 = load double, ptr %76, align 8, !tbaa !28
  %78 = add nsw i64 %indvars.iv.next32, %41
  %79 = getelementptr inbounds double, ptr %40, i64 %78
  %80 = load double, ptr %79, align 8, !tbaa !28
  %81 = fsub double %77, %80
  %82 = getelementptr inbounds double, ptr %6, i64 %78
  store double %81, ptr %82, align 8, !tbaa !28
  %indvars.iv.next32.1 = add nuw nsw i64 %indvars.iv31, 2
  %niter40.next.1 = add i64 %niter40, 2
  %niter40.ncmp.1 = icmp eq i64 %niter40.next.1, %unroll_iter39
  br i1 %niter40.ncmp.1, label %.loopexit.loopexit.unr-lcssa, label %62, !llvm.loop !35

.loopexit.loopexit.unr-lcssa:                     ; preds = %62, %.lr.ph29
  %indvars.iv31.unr = phi i64 [ 0, %.lr.ph29 ], [ %indvars.iv.next32.1, %62 ]
  %lcmp.mod38.not = icmp eq i64 %xtraiter37, 0
  br i1 %lcmp.mod38.not, label %.loopexit, label %.loopexit.loopexit.epilog-lcssa

.loopexit.loopexit.epilog-lcssa:                  ; preds = %.loopexit.loopexit.unr-lcssa
  %83 = getelementptr inbounds i32, ptr %38, i64 %indvars.iv31.unr
  %84 = load i32, ptr %83, align 4, !tbaa !27
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds double, ptr %36, i64 %85
  %87 = load double, ptr %86, align 8, !tbaa !28
  %88 = add nsw i64 %indvars.iv31.unr, %41
  %89 = getelementptr inbounds double, ptr %40, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !28
  %91 = fsub double %87, %90
  %92 = getelementptr inbounds double, ptr %6, i64 %88
  store double %91, ptr %92, align 8, !tbaa !28
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit.epilog-lcssa, %.loopexit.loopexit.unr-lcssa, %.preheader, %3, %._crit_edge
  ret i1 %7
}

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(read) }
attributes #2 = { 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 #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 = { 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, !13, i64 248}
!6 = !{!"_ZTSN10SimTKIpopt11TNLPAdapterE", !7, i64 0, !12, i64 16, !14, i64 24, !15, i64 32, !15, i64 40, !16, i64 48, !17, i64 52, !15, i64 56, !15, i64 64, !18, i64 72, !18, i64 73, !19, i64 76, !9, i64 80, !9, i64 84, !9, i64 88, !9, i64 92, !9, i64 96, !9, i64 100, !9, i64 104, !9, i64 108, !9, i64 112, !20, i64 116, !21, i64 120, !21, i64 128, !21, i64 136, !21, i64 144, !22, i64 152, !21, i64 160, !22, i64 168, !21, i64 176, !22, i64 184, !21, i64 192, !22, i64 200, !22, i64 208, !22, i64 216, !23, i64 224, !13, i64 232, !13, i64 240, !13, i64 248, !13, i64 256, !13, i64 264, !9, i64 272, !9, i64 276, !9, i64 280, !9, i64 284, !9, i64 288, !24, i64 296, !25, i64 304, !24, i64 312, !25, i64 320, !24, i64 328, !25, i64 336, !25, i64 344, !24, i64 352, !25, i64 360, !24, i64 368, !13, i64 376, !13, i64 384, !13, i64 392}
!7 = !{!"_ZTSN10SimTKIpopt3NLPE", !8, i64 0}
!8 = !{!"_ZTSN10SimTKIpopt16ReferencedObjectE", !9, i64 8}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"_ZTSN10SimTKIpopt8SmartPtrINS_4TNLPEEE", !13, i64 0}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_10JournalistEEE", !13, i64 0}
!15 = !{!"double", !10, i64 0}
!16 = !{!"_ZTSN10SimTKIpopt11TNLPAdapter26FixedVariableTreatmentEnumE", !10, i64 0}
!17 = !{!"_ZTSN10SimTKIpopt11TNLPAdapter18DerivativeTestEnumE", !10, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{!"_ZTSN10SimTKIpopt24HessianApproximationTypeE", !10, i64 0}
!20 = !{!"_ZTSN10SimTKIpopt4TNLP14IndexStyleEnumE", !10, i64 0}
!21 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11VectorSpaceEEE", !13, i64 0}
!22 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_11MatrixSpaceEEE", !13, i64 0}
!23 = !{!"_ZTSN10SimTKIpopt8SmartPtrIKNS_14SymMatrixSpaceEEE", !13, i64 0}
!24 = !{!"_ZTSN10SimTKIpopt8SmartPtrINS_15ExpansionMatrixEEE", !13, i64 0}
!25 = !{!"_ZTSN10SimTKIpopt8SmartPtrINS_20ExpansionMatrixSpaceEEE", !13, i64 0}
!26 = !{!6, !13, i64 264}
!27 = !{!9, !9, i64 0}
!28 = !{!15, !15, i64 0}
!29 = !{!6, !16, i64 48}
!30 = !{!6, !9, i64 112}
!31 = !{!6, !13, i64 232}
!32 = !{!6, !13, i64 392}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}


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