; LLVM IR from Derek-TH-Wang/quadruped_ctrl :: src/MPC_Ctrl/SparseCMPC.ll (ZN10SparseCMPC23addQuadraticControlCostEv)

; 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"

%struct.SparseTriple = type { double, i32, i32 }
%class.SparseCMPC = type <{ %"class.Eigen::Matrix", [8 x i8], %"class.Eigen::Matrix.3", double, double, double, double, %"class.Eigen::Matrix.13", %"class.Eigen::Matrix.13", %"class.Eigen::Matrix.13", %"class.Eigen::Matrix.13", %"class.Eigen::Matrix.23", %"class.Eigen::Matrix.3", %"class.Eigen::Matrix.3", %"class.Eigen::Matrix.3", %"class.std::vector", %"class.std::vector.33", %"class.std::vector.38", %"class.std::vector.43", %"class.std::vector.49", %"class.std::vector.54", %"class.std::vector.60", %"class.std::vector.60", %"class.std::vector.65", %"class.std::vector.65", %"class.std::vector.38", %"class.std::vector.38", %"class.std::vector.38", %"class.Eigen::Matrix.70", i32, i32, i32, [12 x i8] }>
%"class.Eigen::Matrix" = type { %"class.Eigen::PlainObjectBase" }
%"class.Eigen::PlainObjectBase" = type { %"class.Eigen::DenseStorage" }
%"class.Eigen::DenseStorage" = type { %"struct.Eigen::internal::plain_array" }
%"struct.Eigen::internal::plain_array" = type { [9 x double] }
%"class.Eigen::Matrix.13" = type { %"class.Eigen::PlainObjectBase.14" }
%"class.Eigen::PlainObjectBase.14" = type { %"class.Eigen::DenseStorage.21" }
%"class.Eigen::DenseStorage.21" = type { %"struct.Eigen::internal::plain_array.22" }
%"struct.Eigen::internal::plain_array.22" = type { [3 x double] }
%"class.Eigen::Matrix.23" = type { %"class.Eigen::PlainObjectBase.24" }
%"class.Eigen::PlainObjectBase.24" = type { %"class.Eigen::DenseStorage.31" }
%"class.Eigen::DenseStorage.31" = type { %"struct.Eigen::internal::plain_array.32" }
%"struct.Eigen::internal::plain_array.32" = type { [4 x double] }
%"class.Eigen::Matrix.3" = type { %"class.Eigen::PlainObjectBase.4" }
%"class.Eigen::PlainObjectBase.4" = type { %"class.Eigen::DenseStorage.11" }
%"class.Eigen::DenseStorage.11" = type { %"struct.Eigen::internal::plain_array.12" }
%"struct.Eigen::internal::plain_array.12" = type { [12 x double] }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<ContactState, std::allocator<ContactState>>::_Vector_impl" }
%"struct.std::_Vector_base<ContactState, std::allocator<ContactState>>::_Vector_impl" = type { %"struct.std::_Vector_base<ContactState, std::allocator<ContactState>>::_Vector_impl_data" }
%"struct.std::_Vector_base<ContactState, std::allocator<ContactState>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.33" = type { %"struct.std::_Vector_base.34" }
%"struct.std::_Vector_base.34" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 12, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 1>>>::_Vector_impl" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 12, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 1>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 12, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 1>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 12, 1>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 1>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.43" = type { %"struct.std::_Vector_base.44" }
%"struct.std::_Vector_base.44" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 12, 12>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 12>>>::_Vector_impl" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 12, 12>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 12>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 12, 12>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 12>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 12, 12>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 12>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.49" = type { %"struct.std::_Vector_base.50" }
%"struct.std::_Vector_base.50" = type { %"struct.std::_Vector_base<BblockID, std::allocator<BblockID>>::_Vector_impl" }
%"struct.std::_Vector_base<BblockID, std::allocator<BblockID>>::_Vector_impl" = type { %"struct.std::_Vector_base<BblockID, std::allocator<BblockID>>::_Vector_impl_data" }
%"struct.std::_Vector_base<BblockID, std::allocator<BblockID>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.54" = type { %"struct.std::_Vector_base.55" }
%"struct.std::_Vector_base.55" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 12, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 12, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 12, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 12, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 12, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.60" = type { %"struct.std::_Vector_base.61" }
%"struct.std::_Vector_base.61" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.65" = type { %"struct.std::_Vector_base.66" }
%"struct.std::_Vector_base.66" = type { %"struct.std::_Vector_base<SparseTriple<double>, std::allocator<SparseTriple<double>>>::_Vector_impl" }
%"struct.std::_Vector_base<SparseTriple<double>, std::allocator<SparseTriple<double>>>::_Vector_impl" = type { %"struct.std::_Vector_base<SparseTriple<double>, std::allocator<SparseTriple<double>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SparseTriple<double>, std::allocator<SparseTriple<double>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.38" = type { %"struct.std::_Vector_base.39" }
%"struct.std::_Vector_base.39" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Eigen::Matrix.70" = type { %"class.Eigen::PlainObjectBase.71" }
%"class.Eigen::PlainObjectBase.71" = type { %"class.Eigen::DenseStorage.78" }
%"class.Eigen::DenseStorage.78" = type { ptr, i64 }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SparseCMPC23addQuadraticControlCostEv(ptr noundef nonnull align 16 dereferenceable(964) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %struct.SparseTriple, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %39, %1
  %10 = load i32, ptr %3, align 4, !tbaa !9
  %11 = getelementptr inbounds %class.SparseCMPC, ptr %8, i32 0, i32 30
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %13 = icmp ult i32 %10, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %9
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %42

15:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %16 = load i32, ptr %3, align 4, !tbaa !9
  %17 = call noundef i32 @_ZN10SparseCMPC15getControlIndexEj(ptr noundef nonnull align 16 dereferenceable(964) %8, i32 noundef %16)
  store i32 %17, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %18

18:                                               ; preds = %35, %15
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = icmp ult i32 %19, 3
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %38

22:                                               ; preds = %18
  %23 = getelementptr inbounds %class.SparseCMPC, ptr %8, i32 0, i32 24
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %24 = getelementptr inbounds %struct.SparseTriple, ptr %7, i32 0, i32 0
  %25 = getelementptr inbounds %class.SparseCMPC, ptr %8, i32 0, i32 6
  %26 = load double, ptr %25, align 8, !tbaa !66
  store double %26, ptr %24, align 8, !tbaa !67
  %27 = getelementptr inbounds %struct.SparseTriple, ptr %7, i32 0, i32 1
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = add i32 %28, %29
  store i32 %30, ptr %27, align 8, !tbaa !69
  %31 = getelementptr inbounds %struct.SparseTriple, ptr %7, i32 0, i32 2
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = add i32 %32, %33
  store i32 %34, ptr %31, align 4, !tbaa !70
  call void @_ZNSt6vectorI12SparseTripleIdESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %23, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  br label %35

35:                                               ; preds = %22
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = add i32 %36, 1
  store i32 %37, ptr %6, align 4, !tbaa !9
  br label %18, !llvm.loop !71

38:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %39

39:                                               ; preds = %38
  %40 = load i32, ptr %3, align 4, !tbaa !9
  %41 = add i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !9
  br label %9, !llvm.loop !73

42:                                               ; preds = %14
  ret void
}

; 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 i32 @_ZN10SparseCMPC15getControlIndexEj(ptr noundef nonnull align 16 dereferenceable(964), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI12SparseTripleIdESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 956}
!12 = !{!"_ZTS10SparseCMPC", !13, i64 0, !17, i64 80, !21, i64 176, !21, i64 184, !21, i64 192, !21, i64 200, !22, i64 208, !22, i64 232, !22, i64 256, !22, i64 280, !26, i64 304, !17, i64 336, !17, i64 432, !17, i64 528, !30, i64 624, !34, i64 648, !38, i64 672, !42, i64 696, !46, i64 720, !50, i64 744, !54, i64 768, !54, i64 792, !58, i64 816, !58, i64 840, !38, i64 864, !38, i64 888, !38, i64 912, !62, i64 936, !10, i64 952, !10, i64 956, !10, i64 960}
!13 = !{!"_ZTSN5Eigen6MatrixIdLi3ELi3ELi0ELi3ELi3EEE", !14, i64 0}
!14 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi3ELi3ELi0ELi3ELi3EEEEE", !15, i64 0}
!15 = !{!"_ZTSN5Eigen12DenseStorageIdLi9ELi3ELi3ELi0EEE", !16, i64 0}
!16 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi9ELi0ELi0EEE", !7, i64 0}
!17 = !{!"_ZTSN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEE", !18, i64 0}
!18 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi12ELi1ELi0ELi12ELi1EEEEE", !19, i64 0}
!19 = !{!"_ZTSN5Eigen12DenseStorageIdLi12ELi12ELi1ELi0EEE", !20, i64 0}
!20 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi12ELi0ELi16EEE", !7, i64 0}
!21 = !{!"double", !7, i64 0}
!22 = !{!"_ZTSN5Eigen6MatrixIdLi3ELi1ELi0ELi3ELi1EEE", !23, i64 0}
!23 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi3ELi1ELi0ELi3ELi1EEEEE", !24, i64 0}
!24 = !{!"_ZTSN5Eigen12DenseStorageIdLi3ELi3ELi1ELi0EEE", !25, i64 0}
!25 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi3ELi0ELi0EEE", !7, i64 0}
!26 = !{!"_ZTSN5Eigen6MatrixIdLi4ELi1ELi0ELi4ELi1EEE", !27, i64 0}
!27 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi4ELi1ELi0ELi4ELi1EEEEE", !28, i64 0}
!28 = !{!"_ZTSN5Eigen12DenseStorageIdLi4ELi4ELi1ELi0EEE", !29, i64 0}
!29 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi4ELi0ELi16EEE", !7, i64 0}
!30 = !{!"_ZTSSt6vectorI12ContactStateSaIS0_EE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseI12ContactStateSaIS0_EE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseI12ContactStateSaIS0_EE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseI12ContactStateSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = !{!"_ZTSSt6vectorIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE", !35, i64 0}
!35 = !{!"_ZTSSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE12_Vector_implE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!38 = !{!"_ZTSSt6vectorIdSaIdEE", !39, i64 0}
!39 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !40, i64 0}
!40 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !41, i64 0}
!41 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!42 = !{!"_ZTSSt6vectorIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE", !43, i64 0}
!43 = !{!"_ZTSSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE", !44, i64 0}
!44 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE12_Vector_implE", !45, i64 0}
!45 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!46 = !{!"_ZTSSt6vectorI8BblockIDSaIS0_EE", !47, i64 0}
!47 = !{!"_ZTSSt12_Vector_baseI8BblockIDSaIS0_EE", !48, i64 0}
!48 = !{!"_ZTSNSt12_Vector_baseI8BblockIDSaIS0_EE12_Vector_implE", !49, i64 0}
!49 = !{!"_ZTSNSt12_Vector_baseI8BblockIDSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!50 = !{!"_ZTSSt6vectorIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE", !51, i64 0}
!51 = !{!"_ZTSSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE", !52, i64 0}
!52 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE12_Vector_implE", !53, i64 0}
!53 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!54 = !{!"_ZTSSt6vectorIjSaIjEE", !55, i64 0}
!55 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !56, i64 0}
!56 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !57, i64 0}
!57 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!58 = !{!"_ZTSSt6vectorI12SparseTripleIdESaIS1_EE", !59, i64 0}
!59 = !{!"_ZTSSt12_Vector_baseI12SparseTripleIdESaIS1_EE", !60, i64 0}
!60 = !{!"_ZTSNSt12_Vector_baseI12SparseTripleIdESaIS1_EE12_Vector_implE", !61, i64 0}
!61 = !{!"_ZTSNSt12_Vector_baseI12SparseTripleIdESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!62 = !{!"_ZTSN5Eigen6MatrixIfLin1ELi1ELi0ELin1ELi1EEE", !63, i64 0}
!63 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIfLin1ELi1ELi0ELin1ELi1EEEEE", !64, i64 0}
!64 = !{!"_ZTSN5Eigen12DenseStorageIfLin1ELin1ELi1ELi0EEE", !6, i64 0, !65, i64 8}
!65 = !{!"long", !7, i64 0}
!66 = !{!12, !21, i64 200}
!67 = !{!68, !21, i64 0}
!68 = !{!"_ZTS12SparseTripleIdE", !21, i64 0, !10, i64 8, !10, i64 12}
!69 = !{!68, !10, i64 8}
!70 = !{!68, !10, i64 12}
!71 = distinct !{!71, !72}
!72 = !{!"llvm.loop.mustprogress"}
!73 = distinct !{!73, !72}


; 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"

%struct.SparseTriple = type { double, i32, i32 }

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10SparseCMPC23addQuadraticControlCostEv(ptr noundef nonnull align 16 dereferenceable(964) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %struct.SparseTriple, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 956
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 840
  %6 = getelementptr inbounds i8, ptr %0, i64 200
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = getelementptr inbounds i8, ptr %2, i64 12
  br label %9

._crit_edge:                                      ; preds = %9, %1
  ret void

9:                                                ; preds = %.lr.ph, %9
  %.0911 = phi i32 [ 0, %.lr.ph ], [ %16, %9 ]
  %10 = call noundef i32 @_ZN10SparseCMPC15getControlIndexEj(ptr noundef nonnull align 16 dereferenceable(964) %0, i32 noundef %.0911)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %11 = load double, ptr %6, align 8, !tbaa !64
  store double %11, ptr %2, align 8, !tbaa !65
  store i32 %10, ptr %7, align 8, !tbaa !67
  store i32 %10, ptr %8, align 4, !tbaa !68
  call void @_ZNSt6vectorI12SparseTripleIdESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %12 = load double, ptr %6, align 8, !tbaa !64
  store double %12, ptr %2, align 8, !tbaa !65
  %13 = add i32 %10, 1
  store i32 %13, ptr %7, align 8, !tbaa !67
  store i32 %13, ptr %8, align 4, !tbaa !68
  call void @_ZNSt6vectorI12SparseTripleIdESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %14 = load double, ptr %6, align 8, !tbaa !64
  store double %14, ptr %2, align 8, !tbaa !65
  %15 = add i32 %10, 2
  store i32 %15, ptr %7, align 8, !tbaa !67
  store i32 %15, ptr %8, align 4, !tbaa !68
  call void @_ZNSt6vectorI12SparseTripleIdESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  %16 = add nuw i32 %.0911, 1
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp ult i32 %16, %17
  br i1 %18, label %9, label %._crit_edge, !llvm.loop !69
}

; 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 noundef i32 @_ZN10SparseCMPC15getControlIndexEj(ptr noundef nonnull align 16 dereferenceable(964), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorI12SparseTripleIdESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #3 = { 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, !63, i64 956}
!6 = !{!"_ZTS10SparseCMPC", !7, i64 0, !13, i64 80, !17, i64 176, !17, i64 184, !17, i64 192, !17, i64 200, !18, i64 208, !18, i64 232, !18, i64 256, !18, i64 280, !22, i64 304, !13, i64 336, !13, i64 432, !13, i64 528, !26, i64 624, !31, i64 648, !35, i64 672, !39, i64 696, !43, i64 720, !47, i64 744, !51, i64 768, !51, i64 792, !55, i64 816, !55, i64 840, !35, i64 864, !35, i64 888, !35, i64 912, !59, i64 936, !63, i64 952, !63, i64 956, !63, i64 960}
!7 = !{!"_ZTSN5Eigen6MatrixIdLi3ELi3ELi0ELi3ELi3EEE", !8, i64 0}
!8 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi3ELi3ELi0ELi3ELi3EEEEE", !9, i64 0}
!9 = !{!"_ZTSN5Eigen12DenseStorageIdLi9ELi3ELi3ELi0EEE", !10, i64 0}
!10 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi9ELi0ELi0EEE", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTSN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEE", !14, i64 0}
!14 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi12ELi1ELi0ELi12ELi1EEEEE", !15, i64 0}
!15 = !{!"_ZTSN5Eigen12DenseStorageIdLi12ELi12ELi1ELi0EEE", !16, i64 0}
!16 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi12ELi0ELi16EEE", !11, i64 0}
!17 = !{!"double", !11, i64 0}
!18 = !{!"_ZTSN5Eigen6MatrixIdLi3ELi1ELi0ELi3ELi1EEE", !19, i64 0}
!19 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi3ELi1ELi0ELi3ELi1EEEEE", !20, i64 0}
!20 = !{!"_ZTSN5Eigen12DenseStorageIdLi3ELi3ELi1ELi0EEE", !21, i64 0}
!21 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi3ELi0ELi0EEE", !11, i64 0}
!22 = !{!"_ZTSN5Eigen6MatrixIdLi4ELi1ELi0ELi4ELi1EEE", !23, i64 0}
!23 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIdLi4ELi1ELi0ELi4ELi1EEEEE", !24, i64 0}
!24 = !{!"_ZTSN5Eigen12DenseStorageIdLi4ELi4ELi1ELi0EEE", !25, i64 0}
!25 = !{!"_ZTSN5Eigen8internal11plain_arrayIdLi4ELi0ELi16EEE", !11, i64 0}
!26 = !{!"_ZTSSt6vectorI12ContactStateSaIS0_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseI12ContactStateSaIS0_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseI12ContactStateSaIS0_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseI12ContactStateSaIS0_EE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!30 = !{!"any pointer", !11, i64 0}
!31 = !{!"_ZTSSt6vectorIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE", !32, i64 0}
!32 = !{!"_ZTSSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE12_Vector_implE", !34, i64 0}
!34 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi1ELi0ELi12ELi1EEENS0_17aligned_allocatorIS2_EEE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!35 = !{!"_ZTSSt6vectorIdSaIdEE", !36, i64 0}
!36 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!39 = !{!"_ZTSSt6vectorIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE", !40, i64 0}
!40 = !{!"_ZTSSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE", !41, i64 0}
!41 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE12_Vector_implE", !42, i64 0}
!42 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi12ELi0ELi12ELi12EEENS0_17aligned_allocatorIS2_EEE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!43 = !{!"_ZTSSt6vectorI8BblockIDSaIS0_EE", !44, i64 0}
!44 = !{!"_ZTSSt12_Vector_baseI8BblockIDSaIS0_EE", !45, i64 0}
!45 = !{!"_ZTSNSt12_Vector_baseI8BblockIDSaIS0_EE12_Vector_implE", !46, i64 0}
!46 = !{!"_ZTSNSt12_Vector_baseI8BblockIDSaIS0_EE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!47 = !{!"_ZTSSt6vectorIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE", !48, i64 0}
!48 = !{!"_ZTSSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE", !49, i64 0}
!49 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE12_Vector_implE", !50, i64 0}
!50 = !{!"_ZTSNSt12_Vector_baseIN5Eigen6MatrixIdLi12ELi3ELi0ELi12ELi3EEENS0_17aligned_allocatorIS2_EEE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!51 = !{!"_ZTSSt6vectorIjSaIjEE", !52, i64 0}
!52 = !{!"_ZTSSt12_Vector_baseIjSaIjEE", !53, i64 0}
!53 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE12_Vector_implE", !54, i64 0}
!54 = !{!"_ZTSNSt12_Vector_baseIjSaIjEE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!55 = !{!"_ZTSSt6vectorI12SparseTripleIdESaIS1_EE", !56, i64 0}
!56 = !{!"_ZTSSt12_Vector_baseI12SparseTripleIdESaIS1_EE", !57, i64 0}
!57 = !{!"_ZTSNSt12_Vector_baseI12SparseTripleIdESaIS1_EE12_Vector_implE", !58, i64 0}
!58 = !{!"_ZTSNSt12_Vector_baseI12SparseTripleIdESaIS1_EE17_Vector_impl_dataE", !30, i64 0, !30, i64 8, !30, i64 16}
!59 = !{!"_ZTSN5Eigen6MatrixIfLin1ELi1ELi0ELin1ELi1EEE", !60, i64 0}
!60 = !{!"_ZTSN5Eigen15PlainObjectBaseINS_6MatrixIfLin1ELi1ELi0ELin1ELi1EEEEE", !61, i64 0}
!61 = !{!"_ZTSN5Eigen12DenseStorageIfLin1ELin1ELi1ELi0EEE", !30, i64 0, !62, i64 8}
!62 = !{!"long", !11, i64 0}
!63 = !{!"int", !11, i64 0}
!64 = !{!6, !17, i64 200}
!65 = !{!66, !17, i64 0}
!66 = !{!"_ZTS12SparseTripleIdE", !17, i64 0, !63, i64 8, !63, i64 12}
!67 = !{!66, !63, i64 8}
!68 = !{!66, !63, i64 12}
!69 = distinct !{!69, !70}
!70 = !{!"llvm.loop.mustprogress"}


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