; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Constraints (SixDOFConstraint)

; 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::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::SixDOFConstraint" = type { %"class.JPH::TwoBodyConstraint", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", %"class.JPH::Quat", i8, i8, i8, i8, i8, i8, [6 x float], [6 x float], [3 x %"class.JPH::SpringSettings"], [6 x %"class.JPH::MotorSettings"], [6 x float], [6 x i32], %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", [3 x %"class.JPH::Vec3"], [3 x %"class.JPH::Vec3"], [3 x float], [3 x %"class.JPH::AxisConstraintPart"], %"class.JPH::PointConstraintPart", %"class.JPH::SwingTwistConstraintPart", %"class.JPH::RotationEulerConstraintPart", [3 x %"class.JPH::AxisConstraintPart"], [3 x %"class.JPH::AngleConstraintPart"] }
%"class.JPH::TwoBodyConstraint" = type { %"class.JPH::Constraint", ptr, ptr }
%"class.JPH::Constraint" = type { ptr, %"class.JPH::RefTarget.3", i32, i32, i8, i8, i8, i64 }
%"class.JPH::RefTarget.3" = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }
%"class.JPH::SpringSettings" = type { i8, %union.anon.2, float }
%union.anon.2 = type { float }
%"class.JPH::MotorSettings" = type { %"class.JPH::SpringSettings", float, float, float, float }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.4 }
%union.anon.4 = type { <4 x float> }
%"class.JPH::PointConstraintPart" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Vec3" }
%"class.JPH::Mat44" = type { [4 x %"class.JPH::Vec4"] }
%"class.JPH::SwingTwistConstraintPart" = type { i8, i8, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::AngleConstraintPart", %"class.JPH::AngleConstraintPart", %"class.JPH::AngleConstraintPart" }
%"class.JPH::AngleConstraintPart" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", float, %"class.JPH::SpringPart", float }
%"class.JPH::SpringPart" = type { float, float }
%"class.JPH::RotationEulerConstraintPart" = type { %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Vec3" }
%"class.JPH::AxisConstraintPart" = type { %"class.JPH::Float3", %"class.JPH::Float3", %"class.JPH::Float3", %"class.JPH::Float3", float, %"class.JPH::SpringPart", float }
%"class.JPH::Float3" = type { float, float, float }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16SixDOFConstraint23UpdateTranslationLimitsEv(ptr noundef nonnull align 16 dereferenceable(1856)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH16SixDOFConstraint19UpdateFixedFreeAxisEv(ptr noundef nonnull align 16 dereferenceable(1856)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16SixDOFConstraint20SetTranslationLimitsENS_4Vec3ES1_(ptr noundef nonnull align 16 dereferenceable(1856) %0, double %1, double %2, double %3, double %4) #2 align 2 {
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca %"class.JPH::Vec3", align 16
  %8 = alloca ptr, align 8
  %9 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 0
  store double %1, ptr %9, align 16
  %10 = getelementptr inbounds { double, double }, ptr %6, i32 0, i32 1
  store double %2, ptr %10, align 8
  %11 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 0
  store double %3, ptr %11, align 16
  %12 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 1
  store double %4, ptr %12, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  %13 = load ptr, ptr %8, align 8
  %14 = call noundef float @_ZNK3JPH4Vec34GetXEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  %15 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %13, i32 0, i32 11
  %16 = getelementptr inbounds [6 x float], ptr %15, i64 0, i64 0
  store float %14, ptr %16, align 8, !tbaa !9
  %17 = call noundef float @_ZNK3JPH4Vec34GetYEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  %18 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %13, i32 0, i32 11
  %19 = getelementptr inbounds [6 x float], ptr %18, i64 0, i64 1
  store float %17, ptr %19, align 4, !tbaa !9
  %20 = call noundef float @_ZNK3JPH4Vec34GetZEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  %21 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %13, i32 0, i32 11
  %22 = getelementptr inbounds [6 x float], ptr %21, i64 0, i64 2
  store float %20, ptr %22, align 8, !tbaa !9
  %23 = call noundef float @_ZNK3JPH4Vec34GetXEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  %24 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %13, i32 0, i32 12
  %25 = getelementptr inbounds [6 x float], ptr %24, i64 0, i64 0
  store float %23, ptr %25, align 16, !tbaa !9
  %26 = call noundef float @_ZNK3JPH4Vec34GetYEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  %27 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %13, i32 0, i32 12
  %28 = getelementptr inbounds [6 x float], ptr %27, i64 0, i64 1
  store float %26, ptr %28, align 4, !tbaa !9
  %29 = call noundef float @_ZNK3JPH4Vec34GetZEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  %30 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %13, i32 0, i32 12
  %31 = getelementptr inbounds [6 x float], ptr %30, i64 0, i64 2
  store float %29, ptr %31, align 8, !tbaa !9
  call void @_ZN3JPH16SixDOFConstraint23UpdateTranslationLimitsEv(ptr noundef nonnull align 16 dereferenceable(1856) %13)
  call void @_ZN3JPH16SixDOFConstraint19UpdateFixedFreeAxisEv(ptr noundef nonnull align 16 dereferenceable(1856) %13)
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec34GetXEv(ptr noundef nonnull align 16 dereferenceable(16)) #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec34GetYEv(ptr noundef nonnull align 16 dereferenceable(16)) #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec34GetZEv(ptr noundef nonnull align 16 dereferenceable(16)) #4 align 2

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { alwaysinline mustprogress nounwind 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 #4 = { 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" }

!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 = !{!"float", !7, i64 0}


; 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::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16SixDOFConstraint23UpdateTranslationLimitsEv(ptr noundef nonnull align 16 dereferenceable(1856)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH16SixDOFConstraint19UpdateFixedFreeAxisEv(ptr noundef nonnull align 16 dereferenceable(1856)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16SixDOFConstraint20SetTranslationLimitsENS_4Vec3ES1_(ptr noundef nonnull align 16 dereferenceable(1856) %0, double %1, double %2, double %3, double %4) local_unnamed_addr #2 align 2 {
  %6 = alloca %"class.JPH::Vec3", align 16
  %7 = alloca %"class.JPH::Vec3", align 16
  store double %1, ptr %6, align 16
  %8 = getelementptr inbounds i8, ptr %6, i64 8
  store double %2, ptr %8, align 8
  store double %3, ptr %7, align 16
  %9 = getelementptr inbounds i8, ptr %7, i64 8
  store double %4, ptr %9, align 8
  %10 = call noundef float @_ZNK3JPH4Vec34GetXEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  %11 = getelementptr inbounds i8, ptr %0, i64 120
  store float %10, ptr %11, align 8, !tbaa !5
  %12 = call noundef float @_ZNK3JPH4Vec34GetYEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  %13 = getelementptr inbounds i8, ptr %0, i64 124
  store float %12, ptr %13, align 4, !tbaa !5
  %14 = call noundef float @_ZNK3JPH4Vec34GetZEv(ptr noundef nonnull align 16 dereferenceable(16) %6)
  %15 = getelementptr inbounds i8, ptr %0, i64 128
  store float %14, ptr %15, align 16, !tbaa !5
  %16 = call noundef float @_ZNK3JPH4Vec34GetXEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  %17 = getelementptr inbounds i8, ptr %0, i64 144
  store float %16, ptr %17, align 16, !tbaa !5
  %18 = call noundef float @_ZNK3JPH4Vec34GetYEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  %19 = getelementptr inbounds i8, ptr %0, i64 148
  store float %18, ptr %19, align 4, !tbaa !5
  %20 = call noundef float @_ZNK3JPH4Vec34GetZEv(ptr noundef nonnull align 16 dereferenceable(16) %7)
  %21 = getelementptr inbounds i8, ptr %0, i64 152
  store float %20, ptr %21, align 8, !tbaa !5
  call void @_ZN3JPH16SixDOFConstraint23UpdateTranslationLimitsEv(ptr noundef nonnull align 16 dereferenceable(1856) %0)
  call void @_ZN3JPH16SixDOFConstraint19UpdateFixedFreeAxisEv(ptr noundef nonnull align 16 dereferenceable(1856) %0)
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec34GetXEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec34GetYEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef float @_ZNK3JPH4Vec34GetZEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { alwaysinline mustprogress nounwind 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 #4 = { 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" }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InstCombinePass,SROAPass