; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/SoftBody (SoftBodyMotionProperties)

; 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.JPH::MassProperties" = type { float, %"class.JPH::Mat44" }
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::Vec4" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::Vec3" = type { %union.anon.0 }
%union.anon.0 = type { <4 x float> }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::SoftBodyMotionProperties" = type <{ %"class.JPH::MotionProperties.base", [2 x i8], %"class.JPH::RefConst", %"class.JPH::Array", %"class.JPH::Array.1", %"class.JPH::Array.4", %"class.JPH::Array.7", %"class.JPH::AABox", %"class.JPH::AABox", i32, i32, float, float, i8, %"struct.std::atomic", i8, i8, [12 x i8] }>
%"class.JPH::MotionProperties.base" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", %"class.JPH::Float3", %"class.JPH::Float3", float, float, float, float, float, float, i32, i32, i8, i8, i8, i8, i8, [3 x i8], [3 x %"class.JPH::Sphere"], float, i8, i8 }>
%"class.JPH::Float3" = type { float, float, float }
%"class.JPH::Sphere" = type { %"class.JPH::Float3", float }
%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Array" = type { i64, i64, ptr }
%"class.JPH::Array.1" = type { i64, i64, ptr }
%"class.JPH::Array.4" = type { i64, i64, ptr }
%"class.JPH::Array.7" = type { i64, i64, ptr }
%"class.JPH::AABox" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"class.JPH::SoftBodyVertex" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Plane", i32, i8, float, float }
%"class.JPH::Plane" = type { %"class.JPH::Vec4" }

; 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 uwtable
define dso_local void @_ZN3JPH24SoftBodyMotionProperties23CalculateMassAndInertiaEv(ptr noundef nonnull align 16 dereferenceable(372) %0) #1 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.JPH::MassProperties", align 16
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca float, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca %"class.JPH::Quat", align 16
  store ptr %0, ptr %2, align 8, !tbaa !5
  %16 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #11
  call void @_ZN3JPH14MassPropertiesC2Ev(ptr noundef nonnull align 16 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #11
  %17 = getelementptr inbounds %"class.JPH::SoftBodyMotionProperties", ptr %16, i32 0, i32 3
  store ptr %17, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #11
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call noundef ptr @_ZN3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %18)
  store ptr %19, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #11
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = call noundef ptr @_ZN3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  store ptr %21, ptr %6, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %135, %1
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = icmp ne ptr %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 2, ptr %7, align 4
  br label %138

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #11
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %28, ptr %8, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %29, i32 0, i32 7
  %31 = load float, ptr %30, align 4, !tbaa !9
  %32 = fcmp ogt float %31, 0.000000e+00
  br i1 %32, label %33, label %107

33:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #11
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %34, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %9, ptr align 16 %35, i64 16, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #11
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %36, i32 0, i32 7
  %38 = load float, ptr %37, align 4, !tbaa !9
  %39 = fdiv float 1.000000e+00, %38
  store float %39, ptr %10, align 4, !tbaa !19
  %40 = load float, ptr %10, align 4, !tbaa !19
  %41 = getelementptr inbounds %"class.JPH::MassProperties", ptr %3, i32 0, i32 0
  %42 = load float, ptr %41, align 16, !tbaa !20
  %43 = fadd float %42, %40
  store float %43, ptr %41, align 16, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #11
  store i32 0, ptr %11, align 4, !tbaa !23
  br label %44

44:                                               ; preds = %67, %33
  %45 = load i32, ptr %11, align 4, !tbaa !23
  %46 = icmp slt i32 %45, 3
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i32 4, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #11
  br label %70

48:                                               ; preds = %44
  %49 = load float, ptr %10, align 4, !tbaa !19
  %50 = load i32, ptr %11, align 4, !tbaa !23
  %51 = add nsw i32 %50, 1
  %52 = srem i32 %51, 3
  %53 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %9, i32 noundef %52)
  %54 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %53)
  %55 = load i32, ptr %11, align 4, !tbaa !23
  %56 = add nsw i32 %55, 2
  %57 = srem i32 %56, 3
  %58 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %9, i32 noundef %57)
  %59 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %58)
  %60 = fadd float %54, %59
  %61 = getelementptr inbounds %"class.JPH::MassProperties", ptr %3, i32 0, i32 1
  %62 = load i32, ptr %11, align 4, !tbaa !23
  %63 = load i32, ptr %11, align 4, !tbaa !23
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %61, i32 noundef %62, i32 noundef %63)
  %65 = load float, ptr %64, align 4, !tbaa !19
  %66 = call float @llvm.fmuladd.f32(float %49, float %60, float %65)
  store float %66, ptr %64, align 4, !tbaa !19
  br label %67

67:                                               ; preds = %48
  %68 = load i32, ptr %11, align 4, !tbaa !23
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %11, align 4, !tbaa !23
  br label %44, !llvm.loop !24

70:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #11
  store i32 0, ptr %12, align 4, !tbaa !23
  br label %71

71:                                               ; preds = %103, %70
  %72 = load i32, ptr %12, align 4, !tbaa !23
  %73 = icmp slt i32 %72, 3
  br i1 %73, label %75, label %74

74:                                               ; preds = %71
  store i32 7, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #11
  br label %106

75:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #11
  store i32 0, ptr %13, align 4, !tbaa !23
  br label %76

76:                                               ; preds = %99, %75
  %77 = load i32, ptr %13, align 4, !tbaa !23
  %78 = icmp slt i32 %77, 3
  br i1 %78, label %80, label %79

79:                                               ; preds = %76
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #11
  br label %102

80:                                               ; preds = %76
  %81 = load i32, ptr %12, align 4, !tbaa !23
  %82 = load i32, ptr %13, align 4, !tbaa !23
  %83 = icmp ne i32 %81, %82
  br i1 %83, label %84, label %98

84:                                               ; preds = %80
  %85 = load float, ptr %10, align 4, !tbaa !19
  %86 = load i32, ptr %12, align 4, !tbaa !23
  %87 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %9, i32 noundef %86)
  %88 = fmul float %85, %87
  %89 = load i32, ptr %13, align 4, !tbaa !23
  %90 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %9, i32 noundef %89)
  %91 = getelementptr inbounds %"class.JPH::MassProperties", ptr %3, i32 0, i32 1
  %92 = load i32, ptr %12, align 4, !tbaa !23
  %93 = load i32, ptr %13, align 4, !tbaa !23
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %91, i32 noundef %92, i32 noundef %93)
  %95 = load float, ptr %94, align 4, !tbaa !19
  %96 = fneg float %88
  %97 = call float @llvm.fmuladd.f32(float %96, float %90, float %95)
  store float %97, ptr %94, align 4, !tbaa !19
  br label %98

98:                                               ; preds = %84, %80
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %13, align 4, !tbaa !23
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %13, align 4, !tbaa !23
  br label %76, !llvm.loop !26

102:                                              ; preds = %79
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %12, align 4, !tbaa !23
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %12, align 4, !tbaa !23
  br label %71, !llvm.loop !27

106:                                              ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #11
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #11
  br label %131

107:                                              ; preds = %27
  call void @_ZN3JPH16MotionProperties14SetInverseMassEf(ptr noundef nonnull align 16 dereferenceable(182) %16, float noundef 0.000000e+00)
  %108 = call { double, double } @_ZN3JPH4Vec35sZeroEv()
  %109 = getelementptr inbounds %"class.JPH::Vec3", ptr %14, i32 0, i32 0
  %110 = getelementptr inbounds %union.anon.0, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds { double, double }, ptr %110, i32 0, i32 0
  %112 = extractvalue { double, double } %108, 0
  store double %112, ptr %111, align 16
  %113 = getelementptr inbounds { double, double }, ptr %110, i32 0, i32 1
  %114 = extractvalue { double, double } %108, 1
  store double %114, ptr %113, align 8
  %115 = call { double, double } @_ZN3JPH4Quat9sIdentityEv()
  %116 = getelementptr inbounds %"class.JPH::Quat", ptr %15, i32 0, i32 0
  %117 = getelementptr inbounds %"class.JPH::Vec4", ptr %116, i32 0, i32 0
  %118 = getelementptr inbounds %union.anon, ptr %117, i32 0, i32 0
  %119 = getelementptr inbounds { double, double }, ptr %118, i32 0, i32 0
  %120 = extractvalue { double, double } %115, 0
  store double %120, ptr %119, align 16
  %121 = getelementptr inbounds { double, double }, ptr %118, i32 0, i32 1
  %122 = extractvalue { double, double } %115, 1
  store double %122, ptr %121, align 8
  %123 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  %124 = load double, ptr %123, align 16
  %125 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  %126 = load double, ptr %125, align 8
  %127 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 0
  %128 = load double, ptr %127, align 16
  %129 = getelementptr inbounds { double, double }, ptr %15, i32 0, i32 1
  %130 = load double, ptr %129, align 8
  call void @_ZN3JPH16MotionProperties17SetInverseInertiaENS_4Vec3ENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(182) %16, double %124, double %126, double %128, double %130)
  store i32 1, ptr %7, align 4
  br label %132

131:                                              ; preds = %106
  store i32 0, ptr %7, align 4
  br label %132

132:                                              ; preds = %131, %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #11
  %133 = load i32, ptr %7, align 4
  switch i32 %133, label %138 [
    i32 0, label %134
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %"class.JPH::SoftBodyVertex", ptr %136, i32 1
  store ptr %137, ptr %5, align 8, !tbaa !5
  br label %22

138:                                              ; preds = %132, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #11
  %139 = load i32, ptr %7, align 4
  switch i32 %139, label %141 [
    i32 2, label %140
  ]

140:                                              ; preds = %138
  call void @_ZN3JPH16MotionProperties17SetMassPropertiesENS_12EAllowedDOFsERKNS_14MassPropertiesE(ptr noundef nonnull align 16 dereferenceable(182) %16, i8 noundef zeroext 63, ptr noundef nonnull align 16 dereferenceable(80) %3)
  store i32 0, ptr %7, align 4
  br label %141

141:                                              ; preds = %140, %138
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #11
  %142 = load i32, ptr %7, align 4
  switch i32 %142, label %144 [
    i32 0, label %143
    i32 1, label %143
  ]

143:                                              ; preds = %141, %141
  ret void

144:                                              ; preds = %141
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH14MassPropertiesC2Ev(ptr noundef nonnull align 16 dereferenceable(80)) unnamed_addr #2 align 2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef) #5

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16), i32 noundef) #6 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64), i32 noundef, i32 noundef) #6 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16MotionProperties14SetInverseMassEf(ptr noundef nonnull align 16 dereferenceable(182), float noundef) #8 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16MotionProperties17SetInverseInertiaENS_4Vec3ENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(182), double, double, double, double) #8 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec35sZeroEv() #9 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Quat9sIdentityEv() #6 align 2

declare void @_ZN3JPH16MotionProperties17SetMassPropertiesENS_12EAllowedDOFsERKNS_14MassPropertiesE(ptr noundef nonnull align 16 dereferenceable(182), i8 noundef zeroext, ptr noundef nonnull align 16 dereferenceable(80)) #10

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 = { 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 = { inlinehint 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { alwaysinline 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 #6 = { alwaysinline 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 #9 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 #10 = { "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 #11 = { 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, !16, i64 76}
!10 = !{!"_ZTSN3JPH14SoftBodyVertexE", !11, i64 0, !11, i64 16, !11, i64 32, !12, i64 48, !14, i64 64, !15, i64 68, !16, i64 72, !16, i64 76}
!11 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!12 = !{!"_ZTSN3JPH5PlaneE", !13, i64 0}
!13 = !{!"_ZTSN3JPH4Vec4E", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{i64 0, i64 16, !18}
!18 = !{!7, !7, i64 0}
!19 = !{!16, !16, i64 0}
!20 = !{!21, !16, i64 0}
!21 = !{!"_ZTSN3JPH14MassPropertiesE", !16, i64 0, !22, i64 16}
!22 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!23 = !{!14, !14, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}


; 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.JPH::MassProperties" = type { float, %"class.JPH::Mat44" }
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::Vec4" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::Vec3" = type { %union.anon.0 }
%union.anon.0 = type { <4 x float> }

; 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 uwtable
define dso_local void @_ZN3JPH24SoftBodyMotionProperties23CalculateMassAndInertiaEv(ptr noundef nonnull align 16 dereferenceable(372) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"class.JPH::MassProperties", align 16
  %3 = alloca %"class.JPH::Vec3", align 16
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #11
  call void @_ZN3JPH14MassPropertiesC2Ev(ptr noundef nonnull align 16 dereferenceable(80) %2)
  %4 = getelementptr inbounds i8, ptr %0, i64 192
  %5 = call noundef ptr @_ZN3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %6 = call noundef ptr @_ZN3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %.not42 = icmp eq ptr %5, %6
  br i1 %.not42, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %7 = getelementptr inbounds i8, ptr %2, i64 16
  br label %75

8:                                                ; preds = %75
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #11
  %9 = getelementptr inbounds i8, ptr %.043, i64 16
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %3, ptr noundef nonnull align 16 dereferenceable(16) %9, i64 16, i1 false), !tbaa.struct !5
  %10 = fdiv float 1.000000e+00, %77
  %11 = load float, ptr %2, align 16, !tbaa !9
  %12 = fadd float %10, %11
  store float %12, ptr %2, align 16, !tbaa !9
  %13 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 1)
  %14 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %13)
  %15 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 2)
  %16 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %15)
  %17 = fadd float %14, %16
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 0, i32 noundef 0)
  %19 = load float, ptr %18, align 4, !tbaa !13
  %20 = call float @llvm.fmuladd.f32(float %10, float %17, float %19)
  store float %20, ptr %18, align 4, !tbaa !13
  %21 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 2)
  %22 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %21)
  %23 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 0)
  %24 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %23)
  %25 = fadd float %22, %24
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 1, i32 noundef 1)
  %27 = load float, ptr %26, align 4, !tbaa !13
  %28 = call float @llvm.fmuladd.f32(float %10, float %25, float %27)
  store float %28, ptr %26, align 4, !tbaa !13
  %29 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 0)
  %30 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %29)
  %31 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 1)
  %32 = call noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef %31)
  %33 = fadd float %30, %32
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 2, i32 noundef 2)
  %35 = load float, ptr %34, align 4, !tbaa !13
  %36 = call float @llvm.fmuladd.f32(float %10, float %33, float %35)
  store float %36, ptr %34, align 4, !tbaa !13
  %37 = fneg float %10
  %38 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 0)
  %39 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 1)
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 0, i32 noundef 1)
  %41 = load float, ptr %40, align 4, !tbaa !13
  %42 = fmul float %38, %37
  %43 = call float @llvm.fmuladd.f32(float %42, float %39, float %41)
  store float %43, ptr %40, align 4, !tbaa !13
  %44 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 0)
  %45 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 2)
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 0, i32 noundef 2)
  %47 = load float, ptr %46, align 4, !tbaa !13
  %48 = fmul float %44, %37
  %49 = call float @llvm.fmuladd.f32(float %48, float %45, float %47)
  store float %49, ptr %46, align 4, !tbaa !13
  %50 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 1)
  %51 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 0)
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 1, i32 noundef 0)
  %53 = load float, ptr %52, align 4, !tbaa !13
  %54 = fmul float %50, %37
  %55 = call float @llvm.fmuladd.f32(float %54, float %51, float %53)
  store float %55, ptr %52, align 4, !tbaa !13
  %56 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 1)
  %57 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 2)
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 1, i32 noundef 2)
  %59 = load float, ptr %58, align 4, !tbaa !13
  %60 = fmul float %56, %37
  %61 = call float @llvm.fmuladd.f32(float %60, float %57, float %59)
  store float %61, ptr %58, align 4, !tbaa !13
  %62 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 2)
  %63 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 0)
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 2, i32 noundef 0)
  %65 = load float, ptr %64, align 4, !tbaa !13
  %66 = fmul float %62, %37
  %67 = call float @llvm.fmuladd.f32(float %66, float %63, float %65)
  store float %67, ptr %64, align 4, !tbaa !13
  %68 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 2)
  %69 = call noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16) %3, i32 noundef 1)
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64) %7, i32 noundef 2, i32 noundef 1)
  %71 = load float, ptr %70, align 4, !tbaa !13
  %72 = fmul float %68, %37
  %73 = call float @llvm.fmuladd.f32(float %72, float %69, float %71)
  store float %73, ptr %70, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #11
  %74 = getelementptr inbounds i8, ptr %.043, i64 80
  %.not = icmp eq ptr %74, %6
  br i1 %.not, label %.critedge, label %75

75:                                               ; preds = %.lr.ph, %8
  %.043 = phi ptr [ %5, %.lr.ph ], [ %74, %8 ]
  %76 = getelementptr inbounds i8, ptr %.043, i64 76
  %77 = load float, ptr %76, align 4, !tbaa !14
  %78 = fcmp ogt float %77, 0.000000e+00
  br i1 %78, label %8, label %.thread

.thread:                                          ; preds = %75
  call void @_ZN3JPH16MotionProperties14SetInverseMassEf(ptr noundef nonnull align 16 dereferenceable(182) %0, float noundef 0.000000e+00)
  %79 = call { double, double } @_ZN3JPH4Vec35sZeroEv()
  %80 = extractvalue { double, double } %79, 0
  %81 = extractvalue { double, double } %79, 1
  %82 = call { double, double } @_ZN3JPH4Quat9sIdentityEv()
  %83 = extractvalue { double, double } %82, 0
  %84 = extractvalue { double, double } %82, 1
  call void @_ZN3JPH16MotionProperties17SetInverseInertiaENS_4Vec3ENS_4QuatE(ptr noundef nonnull align 16 dereferenceable(182) %0, double %80, double %81, double %83, double %84)
  br label %.loopexit

.critedge:                                        ; preds = %8, %1
  call void @_ZN3JPH16MotionProperties17SetMassPropertiesENS_12EAllowedDOFsERKNS_14MassPropertiesE(ptr noundef nonnull align 16 dereferenceable(182) %0, i8 noundef zeroext 63, ptr noundef nonnull align 16 dereferenceable(80) %2)
  br label %.loopexit

.loopexit:                                        ; preds = %.thread, %.critedge
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #11
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH14MassPropertiesC2Ev(ptr noundef nonnull align 16 dereferenceable(80)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayINS_14SoftBodyVertexENS_12STLAllocatorIS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH6SquareIfEET_S1_(float noundef) local_unnamed_addr #5

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef float @_ZNK3JPH4Vec3ixEj(ptr noundef nonnull align 16 dereferenceable(16), i32 noundef) local_unnamed_addr #6 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN3JPH5Mat44clEjj(ptr noundef nonnull align 16 dereferenceable(64), i32 noundef, i32 noundef) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16MotionProperties14SetInverseMassEf(ptr noundef nonnull align 16 dereferenceable(182), float noundef) local_unnamed_addr #8 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Vec35sZeroEv() local_unnamed_addr #9 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPH4Quat9sIdentityEv() local_unnamed_addr #6 align 2

declare void @_ZN3JPH16MotionProperties17SetMassPropertiesENS_12EAllowedDOFsERKNS_14MassPropertiesE(ptr noundef nonnull align 16 dereferenceable(182), i8 noundef zeroext, ptr noundef nonnull align 16 dereferenceable(80)) local_unnamed_addr #10

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 = { 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 = { inlinehint 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { alwaysinline 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 #6 = { alwaysinline 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 #7 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 #9 = { alwaysinline mustprogress uwtable "min-legal-vector-width"="128" "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 #10 = { "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 #11 = { 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 = !{i64 0, i64 16, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3JPH14MassPropertiesE", !11, i64 0, !12, i64 16}
!11 = !{!"float", !7, i64 0}
!12 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !11, i64 76}
!15 = !{!"_ZTSN3JPH14SoftBodyVertexE", !16, i64 0, !16, i64 16, !16, i64 32, !17, i64 48, !19, i64 64, !20, i64 68, !11, i64 72, !11, i64 76}
!16 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!17 = !{!"_ZTSN3JPH5PlaneE", !18, i64 0}
!18 = !{!"_ZTSN3JPH4Vec4E", !7, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!"bool", !7, i64 0}


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