; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/rbdl/src (rbdl_utils)

; 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.SpatialVector_t = type { %"class.Eigen::Matrix" }
%"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 { [6 x double] }
%"class.Eigen::Product.201" = type { %"class.Eigen::CwiseBinaryOp.208", ptr }
%"class.Eigen::CwiseBinaryOp.208" = type <{ [8 x i8], %"class.Eigen::CwiseNullaryOp.214", %"class.Eigen::Transpose.219", [8 x i8] }>
%"class.Eigen::CwiseNullaryOp.214" = type { [8 x i8], %"struct.Eigen::internal::scalar_constant_op" }
%"struct.Eigen::internal::scalar_constant_op" = type { double }
%"class.Eigen::Transpose.219" = type { ptr }
%"struct.RigidBodyDynamics::Model" = type { %"class.std::vector", %"class.std::vector", %"class.std::vector.11", i32, i32, i32, i32, %class.Vector3_t, %"class.std::vector.26", %"class.std::vector.26", %"class.std::vector.32", %"class.std::vector.26", %"class.std::vector.26", %"class.std::vector.26", %"class.std::vector", %"class.std::vector.39", %"class.std::vector", %"class.std::vector.46", %"class.std::vector.46", %"class.std::vector.53", %"class.std::vector.58", %"class.std::vector", %"class.std::vector.63", %"class.std::vector.26", %"class.std::vector.68", %"class.std::vector.26", %"class.std::vector.26", %"class.Eigen::Matrix.75", %"class.Eigen::Matrix.75", %"class.std::vector.26", %"class.std::vector.84", %"class.std::vector.84", %"class.std::vector.26", %"class.std::vector.26", %"class.std::vector.39", %"class.std::vector.39", %"class.std::vector.91", i32, %"class.std::vector.98", %"class.std::map" }
%"class.std::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<std::vector<unsigned int>, std::allocator<std::vector<unsigned int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned int>, std::allocator<std::vector<unsigned int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned int>, std::allocator<std::vector<unsigned int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned int>, std::allocator<std::vector<unsigned int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Vector3_t = type { %"class.Eigen::Matrix.16" }
%"class.Eigen::Matrix.16" = type { %"class.Eigen::PlainObjectBase.17" }
%"class.Eigen::PlainObjectBase.17" = type { %"class.Eigen::DenseStorage.24" }
%"class.Eigen::DenseStorage.24" = type { %"struct.Eigen::internal::plain_array.25" }
%"struct.Eigen::internal::plain_array.25" = type { [3 x double] }
%"class.std::vector.32" = type { %"class.std::vector.33" }
%"class.std::vector.33" = type { %"struct.std::_Vector_base.34" }
%"struct.std::_Vector_base.34" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Joint, Eigen::aligned_allocator<RigidBodyDynamics::Joint>>::_Vector_impl" }
%"struct.std::_Vector_base<RigidBodyDynamics::Joint, Eigen::aligned_allocator<RigidBodyDynamics::Joint>>::_Vector_impl" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Joint, Eigen::aligned_allocator<RigidBodyDynamics::Joint>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RigidBodyDynamics::Joint, Eigen::aligned_allocator<RigidBodyDynamics::Joint>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.46" = type { %"class.std::vector.47" }
%"class.std::vector.47" = type { %"struct.std::_Vector_base.48" }
%"struct.std::_Vector_base.48" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 6, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 6, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 6, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 6, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Eigen::Matrix<double, 6, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 6, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Eigen::Matrix<double, 6, 3>, Eigen::aligned_allocator<Eigen::Matrix<double, 6, 3>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.53" = type { %"struct.std::_Vector_base.54" }
%"struct.std::_Vector_base.54" = type { %"struct.std::_Vector_base<Matrix3_t, std::allocator<Matrix3_t>>::_Vector_impl" }
%"struct.std::_Vector_base<Matrix3_t, std::allocator<Matrix3_t>>::_Vector_impl" = type { %"struct.std::_Vector_base<Matrix3_t, std::allocator<Matrix3_t>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Matrix3_t, std::allocator<Matrix3_t>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.58" = type { %"struct.std::_Vector_base.59" }
%"struct.std::_Vector_base.59" = type { %"struct.std::_Vector_base<Vector3_t, std::allocator<Vector3_t>>::_Vector_impl" }
%"struct.std::_Vector_base<Vector3_t, std::allocator<Vector3_t>>::_Vector_impl" = type { %"struct.std::_Vector_base<Vector3_t, std::allocator<Vector3_t>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Vector3_t, std::allocator<Vector3_t>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.63" = type { %"struct.std::_Vector_base.64" }
%"struct.std::_Vector_base.64" = type { %"struct.std::_Vector_base<RigidBodyDynamics::CustomJoint *, std::allocator<RigidBodyDynamics::CustomJoint *>>::_Vector_impl" }
%"struct.std::_Vector_base<RigidBodyDynamics::CustomJoint *, std::allocator<RigidBodyDynamics::CustomJoint *>>::_Vector_impl" = type { %"struct.std::_Vector_base<RigidBodyDynamics::CustomJoint *, std::allocator<RigidBodyDynamics::CustomJoint *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RigidBodyDynamics::CustomJoint *, std::allocator<RigidBodyDynamics::CustomJoint *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.68" = type { %"class.std::vector.69" }
%"class.std::vector.69" = type { %"struct.std::_Vector_base.70" }
%"struct.std::_Vector_base.70" = type { %"struct.std::_Vector_base<SpatialMatrix_t, Eigen::aligned_allocator<SpatialMatrix_t>>::_Vector_impl" }
%"struct.std::_Vector_base<SpatialMatrix_t, Eigen::aligned_allocator<SpatialMatrix_t>>::_Vector_impl" = type { %"struct.std::_Vector_base<SpatialMatrix_t, Eigen::aligned_allocator<SpatialMatrix_t>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SpatialMatrix_t, Eigen::aligned_allocator<SpatialMatrix_t>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.Eigen::Matrix.75" = type { %"class.Eigen::PlainObjectBase.76" }
%"class.Eigen::PlainObjectBase.76" = type { %"class.Eigen::DenseStorage.83" }
%"class.Eigen::DenseStorage.83" = type { ptr, i64 }
%"class.std::vector.84" = type { %"class.std::vector.85" }
%"class.std::vector.85" = type { %"struct.std::_Vector_base.86" }
%"struct.std::_Vector_base.86" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialRigidBodyInertia, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialRigidBodyInertia>>::_Vector_impl" }
%"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialRigidBodyInertia, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialRigidBodyInertia>>::_Vector_impl" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialRigidBodyInertia, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialRigidBodyInertia>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialRigidBodyInertia, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialRigidBodyInertia>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.26" = type { %"class.std::vector.27" }
%"class.std::vector.27" = type { %"struct.std::_Vector_base.28" }
%"struct.std::_Vector_base.28" = type { %"struct.std::_Vector_base<SpatialVector_t, Eigen::aligned_allocator<SpatialVector_t>>::_Vector_impl" }
%"struct.std::_Vector_base<SpatialVector_t, Eigen::aligned_allocator<SpatialVector_t>>::_Vector_impl" = type { %"struct.std::_Vector_base<SpatialVector_t, Eigen::aligned_allocator<SpatialVector_t>>::_Vector_impl_data" }
%"struct.std::_Vector_base<SpatialVector_t, Eigen::aligned_allocator<SpatialVector_t>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.39" = type { %"class.std::vector.40" }
%"class.std::vector.40" = type { %"struct.std::_Vector_base.41" }
%"struct.std::_Vector_base.41" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialTransform, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialTransform>>::_Vector_impl" }
%"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialTransform, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialTransform>>::_Vector_impl" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialTransform, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialTransform>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RigidBodyDynamics::Math::SpatialTransform, Eigen::aligned_allocator<RigidBodyDynamics::Math::SpatialTransform>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.91" = type { %"class.std::vector.92" }
%"class.std::vector.92" = type { %"struct.std::_Vector_base.93" }
%"struct.std::_Vector_base.93" = type { %"struct.std::_Vector_base<RigidBodyDynamics::FixedBody, Eigen::aligned_allocator<RigidBodyDynamics::FixedBody>>::_Vector_impl" }
%"struct.std::_Vector_base<RigidBodyDynamics::FixedBody, Eigen::aligned_allocator<RigidBodyDynamics::FixedBody>>::_Vector_impl" = type { %"struct.std::_Vector_base<RigidBodyDynamics::FixedBody, Eigen::aligned_allocator<RigidBodyDynamics::FixedBody>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RigidBodyDynamics::FixedBody, Eigen::aligned_allocator<RigidBodyDynamics::FixedBody>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.98" = type { %"class.std::vector.99" }
%"class.std::vector.99" = type { %"struct.std::_Vector_base.100" }
%"struct.std::_Vector_base.100" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Body, Eigen::aligned_allocator<RigidBodyDynamics::Body>>::_Vector_impl" }
%"struct.std::_Vector_base<RigidBodyDynamics::Body, Eigen::aligned_allocator<RigidBodyDynamics::Body>>::_Vector_impl" = type { %"struct.std::_Vector_base<RigidBodyDynamics::Body, Eigen::aligned_allocator<RigidBodyDynamics::Body>>::_Vector_impl_data" }
%"struct.std::_Vector_base<RigidBodyDynamics::Body, Eigen::aligned_allocator<RigidBodyDynamics::Body>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, unsigned int>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, unsigned int>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, 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 i64 @_ZNKSt6vectorIN17RigidBodyDynamics4BodyEN5Eigen17aligned_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

declare void @_ZN17RigidBodyDynamics22UpdateKinematicsCustomERNS_5ModelEPKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEES6_S6_(ptr noundef nonnull align 8 dereferenceable(872), ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorIN17RigidBodyDynamics4Math23SpatialRigidBodyInertiaEN5Eigen17aligned_allocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 16 dereferenceable(48) ptr @_ZNSt6vectorI15SpatialVector_tN5Eigen17aligned_allocatorIS0_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17RigidBodyDynamics4Math23SpatialRigidBodyInertiamlERK15SpatialVector_t(ptr dead_on_unwind noalias writable sret(%class.SpatialVector_t) align 16, ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 16 dereferenceable(48)) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN17RigidBodyDynamics5Utils17CalcKineticEnergyERNS_5ModelERKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEES7_b(ptr noundef nonnull align 8 dereferenceable(872) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca double, align 8
  %10 = alloca i64, align 8
  %11 = alloca %"class.Eigen::Product.201", align 8
  %12 = alloca %"class.Eigen::CwiseBinaryOp.208", align 8
  %13 = alloca double, align 8
  %14 = alloca %"class.Eigen::Transpose.219", align 8
  %15 = alloca %class.SpatialVector_t, align 16
  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 = zext i1 %3 to i8
  store i8 %16, ptr %8, align 1, !tbaa !9
  %17 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %18 = trunc i8 %17 to i1
  br i1 %18, label %19, label %23

19:                                               ; preds = %4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN17RigidBodyDynamics22UpdateKinematicsCustomERNS_5ModelEPKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEES6_S6_(ptr noundef nonnull align 8 dereferenceable(872) %20, ptr noundef %21, ptr noundef %22, ptr noundef null)
  br label %23

23:                                               ; preds = %19, %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store double 0.000000e+00, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 1, ptr %10, align 8, !tbaa !15
  br label %24

24:                                               ; preds = %49, %23
  %25 = load i64, ptr %10, align 8, !tbaa !15
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.RigidBodyDynamics::Model", ptr %26, i32 0, i32 38
  %28 = call noundef i64 @_ZNKSt6vectorIN17RigidBodyDynamics4BodyEN5Eigen17aligned_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #5
  %29 = icmp ult i64 %25, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %52

31:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 48, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  store double 5.000000e-01, ptr %13, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.RigidBodyDynamics::Model", ptr %32, i32 0, i32 8
  %34 = load i64, ptr %10, align 8, !tbaa !15
  %35 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNSt6vectorI15SpatialVector_tN5Eigen17aligned_allocatorIS0_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %34) #5
  %36 = call ptr @_ZN5Eigen9DenseBaseINS_6MatrixIdLi6ELi1ELi0ELi6ELi1EEEE9transposeEv(ptr noundef nonnull align 1 dereferenceable(1) %35)
  %37 = getelementptr inbounds %"class.Eigen::Transpose.219", ptr %14, i32 0, i32 0
  store ptr %36, ptr %37, align 8
  call void @_ZN5EigenmlIdEEKNS_13CwiseBinaryOpINS_8internal17scalar_product_opINS2_18promote_scalar_argIdT_Xsr5Eigen8internal14has_ReturnTypeINS_20ScalarBinaryOpTraitsIS5_dNS3_IS5_dEEEEEE5valueEE4typeEdEEKNS2_19plain_constant_typeINS_9TransposeINS_6MatrixIdLi6ELi1ELi0ELi6ELi1EEEEESA_E4typeEKSG_EERKS5_RKNS_10MatrixBaseISG_EE(ptr dead_on_unwind writable sret(%"class.Eigen::CwiseBinaryOp.208") align 8 %12, ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 1 dereferenceable(1) %14)
  call void @llvm.lifetime.start.p0(i64 48, ptr %15) #5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %"struct.RigidBodyDynamics::Model", ptr %38, i32 0, i32 30
  %40 = load i64, ptr %10, align 8, !tbaa !15
  %41 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorIN17RigidBodyDynamics4Math23SpatialRigidBodyInertiaEN5Eigen17aligned_allocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %39, i64 noundef %40) #5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %"struct.RigidBodyDynamics::Model", ptr %42, i32 0, i32 8
  %44 = load i64, ptr %10, align 8, !tbaa !15
  %45 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNSt6vectorI15SpatialVector_tN5Eigen17aligned_allocatorIS0_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef %44) #5
  call void @_ZN17RigidBodyDynamics4Math23SpatialRigidBodyInertiamlERK15SpatialVector_t(ptr dead_on_unwind writable sret(%class.SpatialVector_t) align 16 %15, ptr noundef nonnull align 8 dereferenceable(80) %41, ptr noundef nonnull align 16 dereferenceable(48) %45)
  call void @_ZNK5Eigen10MatrixBaseINS_13CwiseBinaryOpINS_8internal17scalar_product_opIddEEKNS_14CwiseNullaryOpINS2_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEEEmlISE_EEKNS_7ProductISH_T_Li0EEERKNS0_ISL_EE(ptr dead_on_unwind writable sret(%"class.Eigen::Product.201") align 8 %11, ptr noundef nonnull align 1 dereferenceable(1) %12, ptr noundef nonnull align 1 dereferenceable(1) %15)
  %46 = call noundef double @_ZNK5Eigen8internal18dense_product_baseINS_13CwiseBinaryOpINS0_17scalar_product_opIddEEKNS_14CwiseNullaryOpINS0_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEESE_Li0ELi6EEcvKdEv(ptr noundef nonnull align 1 dereferenceable(1) %11)
  %47 = load double, ptr %9, align 8, !tbaa !13
  %48 = fadd double %47, %46
  store double %48, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 48, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #5
  br label %49

49:                                               ; preds = %31
  %50 = load i64, ptr %10, align 8, !tbaa !15
  %51 = add i64 %50, 1
  store i64 %51, ptr %10, align 8, !tbaa !15
  br label %24, !llvm.loop !17

52:                                               ; preds = %30
  %53 = load double, ptr %9, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret double %53
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5EigenmlIdEEKNS_13CwiseBinaryOpINS_8internal17scalar_product_opINS2_18promote_scalar_argIdT_Xsr5Eigen8internal14has_ReturnTypeINS_20ScalarBinaryOpTraitsIS5_dNS3_IS5_dEEEEEE5valueEE4typeEdEEKNS2_19plain_constant_typeINS_9TransposeINS_6MatrixIdLi6ELi1ELi0ELi6ELi1EEEEESA_E4typeEKSG_EERKS5_RKNS_10MatrixBaseISG_EE(ptr dead_on_unwind noalias writable sret(%"class.Eigen::CwiseBinaryOp.208") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Eigen10MatrixBaseINS_13CwiseBinaryOpINS_8internal17scalar_product_opIddEEKNS_14CwiseNullaryOpINS2_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEEEmlISE_EEKNS_7ProductISH_T_Li0EEERKNS0_ISL_EE(ptr dead_on_unwind noalias writable sret(%"class.Eigen::Product.201") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5Eigen8internal18dense_product_baseINS_13CwiseBinaryOpINS0_17scalar_product_opIddEEKNS_14CwiseNullaryOpINS0_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEESE_Li0ELi6EEcvKdEv(ptr noundef nonnull align 1 dereferenceable(1)) #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 = { "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 = { 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 = { 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 = !{!"double", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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.SpatialVector_t = type { %"class.Eigen::Matrix" }
%"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 { [6 x double] }
%"class.Eigen::Product.201" = type { %"class.Eigen::CwiseBinaryOp.208", ptr }
%"class.Eigen::CwiseBinaryOp.208" = type <{ [8 x i8], %"class.Eigen::CwiseNullaryOp.214", %"class.Eigen::Transpose.219", [8 x i8] }>
%"class.Eigen::CwiseNullaryOp.214" = type { [8 x i8], %"struct.Eigen::internal::scalar_constant_op" }
%"struct.Eigen::internal::scalar_constant_op" = type { double }
%"class.Eigen::Transpose.219" = type { ptr }

; 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 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 i64 @_ZNKSt6vectorIN17RigidBodyDynamics4BodyEN5Eigen17aligned_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

declare void @_ZN17RigidBodyDynamics22UpdateKinematicsCustomERNS_5ModelEPKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEES6_S6_(ptr noundef nonnull align 8 dereferenceable(872), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorIN17RigidBodyDynamics4Math23SpatialRigidBodyInertiaEN5Eigen17aligned_allocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17RigidBodyDynamics4Math23SpatialRigidBodyInertiamlERK15SpatialVector_t(ptr dead_on_unwind noalias writable sret(%class.SpatialVector_t) align 16, ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 16 dereferenceable(48)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN17RigidBodyDynamics5Utils17CalcKineticEnergyERNS_5ModelERKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEES7_b(ptr noundef nonnull align 8 dereferenceable(872) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext %3) local_unnamed_addr #3 {
  %5 = alloca %"class.Eigen::Product.201", align 8
  %6 = alloca %"class.Eigen::CwiseBinaryOp.208", align 8
  %7 = alloca double, align 8
  %8 = alloca %"class.Eigen::Transpose.219", align 8
  %9 = alloca %class.SpatialVector_t, align 16
  br i1 %3, label %10, label %11

10:                                               ; preds = %4
  tail call void @_ZN17RigidBodyDynamics22UpdateKinematicsCustomERNS_5ModelEPKN5Eigen6MatrixIdLin1ELi1ELi0ELin1ELi1EEES6_S6_(ptr noundef nonnull align 8 dereferenceable(872) %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef null)
  br label %11

11:                                               ; preds = %10, %4
  %12 = getelementptr inbounds i8, ptr %0, i64 800
  %13 = tail call noundef i64 @_ZNKSt6vectorIN17RigidBodyDynamics4BodyEN5Eigen17aligned_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %14 = icmp ugt i64 %13, 1
  br i1 %14, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %11
  %15 = getelementptr inbounds i8, ptr %0, i64 112
  %16 = getelementptr inbounds i8, ptr %0, i64 624
  br label %17

._crit_edge:                                      ; preds = %17, %11
  %.014.lcssa = phi double [ 0.000000e+00, %11 ], [ %23, %17 ]
  ret double %.014.lcssa

17:                                               ; preds = %.lr.ph, %17
  %.016 = phi i64 [ 1, %.lr.ph ], [ %24, %17 ]
  %.01415 = phi double [ 0.000000e+00, %.lr.ph ], [ %23, %17 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store double 5.000000e-01, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %18 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNSt6vectorI15SpatialVector_tN5Eigen17aligned_allocatorIS0_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %.016) #5
  %19 = call ptr @_ZN5Eigen9DenseBaseINS_6MatrixIdLi6ELi1ELi0ELi6ELi1EEEE9transposeEv(ptr noundef nonnull align 1 dereferenceable(1) %18)
  store ptr %19, ptr %8, align 8
  call void @_ZN5EigenmlIdEEKNS_13CwiseBinaryOpINS_8internal17scalar_product_opINS2_18promote_scalar_argIdT_Xsr5Eigen8internal14has_ReturnTypeINS_20ScalarBinaryOpTraitsIS5_dNS3_IS5_dEEEEEE5valueEE4typeEdEEKNS2_19plain_constant_typeINS_9TransposeINS_6MatrixIdLi6ELi1ELi0ELi6ELi1EEEEESA_E4typeEKSG_EERKS5_RKNS_10MatrixBaseISG_EE(ptr dead_on_unwind nonnull writable sret(%"class.Eigen::CwiseBinaryOp.208") align 8 %6, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #5
  %20 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorIN17RigidBodyDynamics4Math23SpatialRigidBodyInertiaEN5Eigen17aligned_allocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %.016) #5
  %21 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNSt6vectorI15SpatialVector_tN5Eigen17aligned_allocatorIS0_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %15, i64 noundef %.016) #5
  call void @_ZN17RigidBodyDynamics4Math23SpatialRigidBodyInertiamlERK15SpatialVector_t(ptr dead_on_unwind nonnull writable sret(%class.SpatialVector_t) align 16 %9, ptr noundef nonnull align 8 dereferenceable(80) %20, ptr noundef nonnull align 16 dereferenceable(48) %21)
  call void @_ZNK5Eigen10MatrixBaseINS_13CwiseBinaryOpINS_8internal17scalar_product_opIddEEKNS_14CwiseNullaryOpINS2_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEEEmlISE_EEKNS_7ProductISH_T_Li0EEERKNS0_ISL_EE(ptr dead_on_unwind nonnull writable sret(%"class.Eigen::Product.201") align 8 %5, ptr noundef nonnull align 1 dereferenceable(1) %6, ptr noundef nonnull align 1 dereferenceable(1) %9)
  %22 = call noundef double @_ZNK5Eigen8internal18dense_product_baseINS_13CwiseBinaryOpINS0_17scalar_product_opIddEEKNS_14CwiseNullaryOpINS0_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEESE_Li0ELi6EEcvKdEv(ptr noundef nonnull align 1 dereferenceable(1) %5)
  %23 = fadd double %.01415, %22
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #5
  %24 = add nuw i64 %.016, 1
  %25 = call noundef i64 @_ZNKSt6vectorIN17RigidBodyDynamics4BodyEN5Eigen17aligned_allocatorIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %26 = icmp ult i64 %24, %25
  br i1 %26, label %17, label %._crit_edge, !llvm.loop !9
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5EigenmlIdEEKNS_13CwiseBinaryOpINS_8internal17scalar_product_opINS2_18promote_scalar_argIdT_Xsr5Eigen8internal14has_ReturnTypeINS_20ScalarBinaryOpTraitsIS5_dNS3_IS5_dEEEEEE5valueEE4typeEdEEKNS2_19plain_constant_typeINS_9TransposeINS_6MatrixIdLi6ELi1ELi0ELi6ELi1EEEEESA_E4typeEKSG_EERKS5_RKNS_10MatrixBaseISG_EE(ptr dead_on_unwind noalias writable sret(%"class.Eigen::CwiseBinaryOp.208") align 8, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Eigen10MatrixBaseINS_13CwiseBinaryOpINS_8internal17scalar_product_opIddEEKNS_14CwiseNullaryOpINS2_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEEEmlISE_EEKNS_7ProductISH_T_Li0EEERKNS0_ISL_EE(ptr dead_on_unwind noalias writable sret(%"class.Eigen::Product.201") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK5Eigen8internal18dense_product_baseINS_13CwiseBinaryOpINS0_17scalar_product_opIddEEKNS_14CwiseNullaryOpINS0_18scalar_constant_opIdEEKNS_6MatrixIdLi1ELi6ELi1ELi1ELi6EEEEEKNS_9TransposeINS8_IdLi6ELi1ELi0ELi6ELi1EEEEEEESE_Li0ELi6EEcvKdEv(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #4 align 2

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 = { "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 = { 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 = { nounwind }

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

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


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