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

; 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::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.4 }
%union.anon.4 = type { <4 x float> }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }
%"class.JPH::HingeConstraint" = type { %"class.JPH::TwoBodyConstraint", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Quat", i8, float, float, %"class.JPH::SpringSettings", float, %"class.JPH::MotorSettings", i32, float, float, float, %"class.JPH::Vec3", %"class.JPH::PointConstraintPart", %"class.JPH::HingeRotationConstraintPart", %"class.JPH::AngleConstraintPart", %"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::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::HingeRotationConstraintPart" = type <{ %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Mat44", %"class.JPH::Mat44", %"class.JPH::Vec3", %"class.JPH::Vec3", %"class.JPH::Matrix", %"class.JPH::Vector", [8 x i8] }>
%"class.JPH::Matrix" = type { [2 x %"class.JPH::Vector"] }
%"class.JPH::Vector" = type { [2 x float] }
%"class.JPH::AngleConstraintPart" = type { %"class.JPH::Vec3", %"class.JPH::Vec3", float, %"class.JPH::SpringPart", float }
%"class.JPH::SpringPart" = type { float, float }

; 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: 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) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122)) #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Quat10ConjugatedEv(ptr noundef nonnull align 16 dereferenceable(16)) #3 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4QuatmlES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #3 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4QuatmlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(16), double, double) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH15HingeConstraint19CalculateA1AndThetaEv(ptr noundef nonnull align 16 dereferenceable(832) %0) #4 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.JPH::Quat", align 16
  %4 = alloca %"class.JPH::Quat", align 16
  %5 = alloca %"class.JPH::Quat", align 16
  %6 = alloca %"class.JPH::Quat", align 16
  %7 = alloca %"class.JPH::Quat", align 16
  %8 = alloca %"class.JPH::Quat", align 16
  %9 = alloca %"class.JPH::Vec3", align 16
  %10 = alloca %"class.JPH::Vec3", align 16
  %11 = alloca %"class.JPH::Vec3", align 16
  store ptr %0, ptr %2, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8
  %13 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 8
  %14 = load i8, ptr %13, align 16, !tbaa !9, !range !34, !noundef !35
  %15 = trunc i8 %14 to i1
  br i1 %15, label %24, label %16

16:                                               ; preds = %1
  %17 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 14
  %18 = load i32, ptr %17, align 8, !tbaa !36
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %24, label %20

20:                                               ; preds = %16
  %21 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 12
  %22 = load float, ptr %21, align 8, !tbaa !37
  %23 = fcmp ogt float %22, 0.000000e+00
  br i1 %23, label %24, label %98

24:                                               ; preds = %20, %16, %1
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #5
  %25 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %12, i32 0, i32 1
  %26 = load ptr, ptr %25, align 16, !tbaa !38
  %27 = call { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122) %26)
  %28 = getelementptr inbounds %"class.JPH::Quat", ptr %3, i32 0, i32 0
  %29 = getelementptr inbounds %"class.JPH::Vec4", ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %union.anon.4, ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 0
  %32 = extractvalue { double, double } %27, 0
  store double %32, ptr %31, align 16
  %33 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 1
  %34 = extractvalue { double, double } %27, 1
  store double %34, ptr %33, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  %35 = getelementptr inbounds %"class.JPH::TwoBodyConstraint", ptr %12, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !39
  %37 = call { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122) %36)
  %38 = getelementptr inbounds %"class.JPH::Quat", ptr %6, i32 0, i32 0
  %39 = getelementptr inbounds %"class.JPH::Vec4", ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %union.anon.4, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds { double, double }, ptr %40, i32 0, i32 0
  %42 = extractvalue { double, double } %37, 0
  store double %42, ptr %41, align 16
  %43 = getelementptr inbounds { double, double }, ptr %40, i32 0, i32 1
  %44 = extractvalue { double, double } %37, 1
  store double %44, ptr %43, align 8
  %45 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 %45, i64 16, i1 false), !tbaa.struct !40
  %46 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 0
  %47 = load double, ptr %46, align 16
  %48 = getelementptr inbounds { double, double }, ptr %7, i32 0, i32 1
  %49 = load double, ptr %48, align 8
  %50 = call { double, double } @_ZNK3JPH4QuatmlES0_(ptr noundef nonnull align 16 dereferenceable(16) %6, double %47, double %49)
  %51 = getelementptr inbounds %"class.JPH::Quat", ptr %5, i32 0, i32 0
  %52 = getelementptr inbounds %"class.JPH::Vec4", ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %union.anon.4, ptr %52, i32 0, i32 0
  %54 = getelementptr inbounds { double, double }, ptr %53, i32 0, i32 0
  %55 = extractvalue { double, double } %50, 0
  store double %55, ptr %54, align 16
  %56 = getelementptr inbounds { double, double }, ptr %53, i32 0, i32 1
  %57 = extractvalue { double, double } %50, 1
  store double %57, ptr %56, align 8
  %58 = call { double, double } @_ZNK3JPH4Quat10ConjugatedEv(ptr noundef nonnull align 16 dereferenceable(16) %3)
  %59 = getelementptr inbounds %"class.JPH::Quat", ptr %8, i32 0, i32 0
  %60 = getelementptr inbounds %"class.JPH::Vec4", ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %union.anon.4, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds { double, double }, ptr %61, i32 0, i32 0
  %63 = extractvalue { double, double } %58, 0
  store double %63, ptr %62, align 16
  %64 = getelementptr inbounds { double, double }, ptr %61, i32 0, i32 1
  %65 = extractvalue { double, double } %58, 1
  store double %65, ptr %64, align 8
  %66 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 0
  %67 = load double, ptr %66, align 16
  %68 = getelementptr inbounds { double, double }, ptr %8, i32 0, i32 1
  %69 = load double, ptr %68, align 8
  %70 = call { double, double } @_ZNK3JPH4QuatmlES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %67, double %69)
  %71 = getelementptr inbounds %"class.JPH::Quat", ptr %4, i32 0, i32 0
  %72 = getelementptr inbounds %"class.JPH::Vec4", ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds %union.anon.4, ptr %72, i32 0, i32 0
  %74 = getelementptr inbounds { double, double }, ptr %73, i32 0, i32 0
  %75 = extractvalue { double, double } %70, 0
  store double %75, ptr %74, align 16
  %76 = getelementptr inbounds { double, double }, ptr %73, i32 0, i32 1
  %77 = extractvalue { double, double } %70, 1
  store double %77, ptr %76, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %78 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %10, ptr align 16 %78, i64 16, i1 false), !tbaa.struct !40
  %79 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 0
  %80 = load double, ptr %79, align 16
  %81 = getelementptr inbounds { double, double }, ptr %10, i32 0, i32 1
  %82 = load double, ptr %81, align 8
  %83 = call { double, double } @_ZNK3JPH4QuatmlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(16) %3, double %80, double %82)
  %84 = getelementptr inbounds %"class.JPH::Vec3", ptr %9, i32 0, i32 0
  %85 = getelementptr inbounds %union.anon, ptr %84, i32 0, i32 0
  %86 = getelementptr inbounds { double, double }, ptr %85, i32 0, i32 0
  %87 = extractvalue { double, double } %83, 0
  store double %87, ptr %86, align 16
  %88 = getelementptr inbounds { double, double }, ptr %85, i32 0, i32 1
  %89 = extractvalue { double, double } %83, 1
  store double %89, ptr %88, align 8
  %90 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %90, ptr align 16 %9, i64 16, i1 false), !tbaa.struct !40
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  %91 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %11, ptr align 16 %91, i64 16, i1 false), !tbaa.struct !40
  %92 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %93 = load double, ptr %92, align 16
  %94 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %95 = load double, ptr %94, align 8
  %96 = call noundef float @_ZNK3JPH4Quat16GetRotationAngleENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(16) %4, double %93, double %95)
  %97 = getelementptr inbounds %"class.JPH::HingeConstraint", ptr %12, i32 0, i32 17
  store float %96, ptr %97, align 4, !tbaa !42
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #5
  br label %98

98:                                               ; preds = %24, %20
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !17, i64 160}
!10 = !{!"_ZTSN3JPH15HingeConstraintE", !11, i64 0, !19, i64 48, !19, i64 64, !19, i64 80, !19, i64 96, !19, i64 112, !19, i64 128, !20, i64 144, !17, i64 160, !22, i64 164, !22, i64 168, !23, i64 172, !22, i64 184, !25, i64 188, !26, i64 216, !22, i64 220, !22, i64 224, !22, i64 228, !19, i64 240, !27, i64 256, !29, i64 496, !32, i64 736, !32, i64 784}
!11 = !{!"_ZTSN3JPH17TwoBodyConstraintE", !12, i64 0, !6, i64 32, !6, i64 40}
!12 = !{!"_ZTSN3JPH10ConstraintE", !13, i64 8, !16, i64 12, !16, i64 16, !7, i64 20, !7, i64 21, !17, i64 22, !18, i64 24}
!13 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !14, i64 0}
!14 = !{!"_ZTSSt6atomicIjE", !15, i64 0}
!15 = !{!"_ZTSSt13__atomic_baseIjE", !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = !{!"_ZTSN3JPH4Vec3E", !7, i64 0}
!20 = !{!"_ZTSN3JPH4QuatE", !21, i64 0}
!21 = !{!"_ZTSN3JPH4Vec4E", !7, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = !{!"_ZTSN3JPH14SpringSettingsE", !24, i64 0, !7, i64 4, !22, i64 8}
!24 = !{!"_ZTSN3JPH11ESpringModeE", !7, i64 0}
!25 = !{!"_ZTSN3JPH13MotorSettingsE", !23, i64 0, !22, i64 12, !22, i64 16, !22, i64 20, !22, i64 24}
!26 = !{!"_ZTSN3JPH11EMotorStateE", !7, i64 0}
!27 = !{!"_ZTSN3JPH19PointConstraintPartE", !19, i64 0, !19, i64 16, !28, i64 32, !28, i64 96, !28, i64 160, !19, i64 224}
!28 = !{!"_ZTSN3JPH5Mat44E", !7, i64 0}
!29 = !{!"_ZTSN3JPH27HingeRotationConstraintPartE", !19, i64 0, !19, i64 16, !19, i64 32, !28, i64 48, !28, i64 112, !19, i64 176, !19, i64 192, !30, i64 208, !31, i64 224}
!30 = !{!"_ZTSN3JPH6MatrixILj2ELj2EEE", !7, i64 0}
!31 = !{!"_ZTSN3JPH6VectorILj2EEE", !7, i64 0}
!32 = !{!"_ZTSN3JPH19AngleConstraintPartE", !19, i64 0, !19, i64 16, !22, i64 32, !33, i64 36, !22, i64 44}
!33 = !{!"_ZTSN3JPH10SpringPartE", !22, i64 0, !22, i64 4}
!34 = !{i8 0, i8 2}
!35 = !{}
!36 = !{!10, !26, i64 216}
!37 = !{!10, !22, i64 184}
!38 = !{!11, !6, i64 32}
!39 = !{!11, !6, i64 40}
!40 = !{i64 0, i64 16, !41}
!41 = !{!7, !7, i64 0}
!42 = !{!10, !22, i64 228}


; 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::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.4 }
%union.anon.4 = 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: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Quat10ConjugatedEv(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4QuatmlES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4QuatmlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH15HingeConstraint19CalculateA1AndThetaEv(ptr nocapture noundef nonnull align 16 dereferenceable(832) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca %"class.JPH::Quat", align 16
  %3 = alloca %"class.JPH::Quat", align 16
  %4 = alloca %"class.JPH::Quat", align 16
  %5 = alloca %"class.JPH::Quat", align 16
  %6 = getelementptr inbounds i8, ptr %0, i64 160
  %7 = load i8, ptr %6, align 16, !tbaa !5, !range !33, !noundef !34
  %8 = trunc nuw i8 %7 to i1
  %9 = getelementptr inbounds i8, ptr %0, i64 216
  %10 = load i32, ptr %9, align 8
  %.not = icmp ne i32 %10, 0
  %or.cond.not13 = select i1 %8, i1 true, i1 %.not
  %11 = getelementptr inbounds i8, ptr %0, i64 184
  %12 = load float, ptr %11, align 8
  %13 = fcmp ogt float %12, 0.000000e+00
  %or.cond12 = select i1 %or.cond.not13, i1 true, i1 %13
  br i1 %or.cond12, label %14, label %46

14:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = load ptr, ptr %15, align 16, !tbaa !35
  %17 = tail call { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122) %16)
  %18 = extractvalue { double, double } %17, 0
  store double %18, ptr %2, align 16
  %19 = getelementptr inbounds i8, ptr %2, i64 8
  %20 = extractvalue { double, double } %17, 1
  store double %20, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #4
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !36
  %23 = tail call { double, double } @_ZNK3JPH4Body11GetRotationEv(ptr noundef nonnull align 16 dereferenceable(122) %22)
  %24 = extractvalue { double, double } %23, 0
  store double %24, ptr %5, align 16
  %25 = getelementptr inbounds i8, ptr %5, i64 8
  %26 = extractvalue { double, double } %23, 1
  store double %26, ptr %25, align 8
  %27 = getelementptr inbounds i8, ptr %0, i64 144
  %.sroa.06.0.copyload = load double, ptr %27, align 16
  %.sroa.27.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 152
  %.sroa.27.0.copyload = load double, ptr %.sroa.27.0..sroa_idx, align 8, !tbaa !37
  %28 = call { double, double } @_ZNK3JPH4QuatmlES0_(ptr noundef nonnull align 16 dereferenceable(16) %5, double %.sroa.06.0.copyload, double %.sroa.27.0.copyload)
  %29 = extractvalue { double, double } %28, 0
  store double %29, ptr %4, align 16
  %30 = getelementptr inbounds i8, ptr %4, i64 8
  %31 = extractvalue { double, double } %28, 1
  store double %31, ptr %30, align 8
  %32 = call { double, double } @_ZNK3JPH4Quat10ConjugatedEv(ptr noundef nonnull align 16 dereferenceable(16) %2)
  %33 = extractvalue { double, double } %32, 0
  %34 = extractvalue { double, double } %32, 1
  %35 = call { double, double } @_ZNK3JPH4QuatmlES0_(ptr noundef nonnull align 16 dereferenceable(16) %4, double %33, double %34)
  %36 = extractvalue { double, double } %35, 0
  store double %36, ptr %3, align 16
  %37 = getelementptr inbounds i8, ptr %3, i64 8
  %38 = extractvalue { double, double } %35, 1
  store double %38, ptr %37, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  %39 = getelementptr inbounds i8, ptr %0, i64 80
  %.sroa.01.0.copyload = load double, ptr %39, align 16
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 88
  %.sroa.22.0.copyload = load double, ptr %.sroa.22.0..sroa_idx, align 8, !tbaa !37
  %40 = call { double, double } @_ZNK3JPH4QuatmlENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(16) %2, double %.sroa.01.0.copyload, double %.sroa.22.0.copyload)
  %41 = extractvalue { double, double } %40, 0
  %42 = extractvalue { double, double } %40, 1
  %43 = getelementptr inbounds i8, ptr %0, i64 240
  store double %41, ptr %43, align 16
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 248
  store double %42, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !37
  %44 = call noundef float @_ZNK3JPH4Quat16GetRotationAngleENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(16) %3, double %41, double %42)
  %45 = getelementptr inbounds i8, ptr %0, i64 228
  store float %44, ptr %45, align 4, !tbaa !38
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  br label %46

46:                                               ; preds = %1, %14
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !15, i64 160}
!6 = !{!"_ZTSN3JPH15HingeConstraintE", !7, i64 0, !18, i64 48, !18, i64 64, !18, i64 80, !18, i64 96, !18, i64 112, !18, i64 128, !19, i64 144, !15, i64 160, !21, i64 164, !21, i64 168, !22, i64 172, !21, i64 184, !24, i64 188, !25, i64 216, !21, i64 220, !21, i64 224, !21, i64 228, !18, i64 240, !26, i64 256, !28, i64 496, !31, i64 736, !31, i64 784}
!7 = !{!"_ZTSN3JPH17TwoBodyConstraintE", !8, i64 0, !17, i64 32, !17, i64 40}
!8 = !{!"_ZTSN3JPH10ConstraintE", !9, i64 8, !12, i64 12, !12, i64 16, !13, i64 20, !13, i64 21, !15, i64 22, !16, i64 24}
!9 = !{!"_ZTSN3JPH9RefTargetINS_10ConstraintEEE", !10, i64 0}
!10 = !{!"_ZTSSt6atomicIjE", !11, i64 0}
!11 = !{!"_ZTSSt13__atomic_baseIjE", !12, i64 0}
!12 = !{!"int", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"bool", !13, i64 0}
!16 = !{!"long", !13, i64 0}
!17 = !{!"any pointer", !13, i64 0}
!18 = !{!"_ZTSN3JPH4Vec3E", !13, i64 0}
!19 = !{!"_ZTSN3JPH4QuatE", !20, i64 0}
!20 = !{!"_ZTSN3JPH4Vec4E", !13, i64 0}
!21 = !{!"float", !13, i64 0}
!22 = !{!"_ZTSN3JPH14SpringSettingsE", !23, i64 0, !13, i64 4, !21, i64 8}
!23 = !{!"_ZTSN3JPH11ESpringModeE", !13, i64 0}
!24 = !{!"_ZTSN3JPH13MotorSettingsE", !22, i64 0, !21, i64 12, !21, i64 16, !21, i64 20, !21, i64 24}
!25 = !{!"_ZTSN3JPH11EMotorStateE", !13, i64 0}
!26 = !{!"_ZTSN3JPH19PointConstraintPartE", !18, i64 0, !18, i64 16, !27, i64 32, !27, i64 96, !27, i64 160, !18, i64 224}
!27 = !{!"_ZTSN3JPH5Mat44E", !13, i64 0}
!28 = !{!"_ZTSN3JPH27HingeRotationConstraintPartE", !18, i64 0, !18, i64 16, !18, i64 32, !27, i64 48, !27, i64 112, !18, i64 176, !18, i64 192, !29, i64 208, !30, i64 224}
!29 = !{!"_ZTSN3JPH6MatrixILj2ELj2EEE", !13, i64 0}
!30 = !{!"_ZTSN3JPH6VectorILj2EEE", !13, i64 0}
!31 = !{!"_ZTSN3JPH19AngleConstraintPartE", !18, i64 0, !18, i64 16, !21, i64 32, !32, i64 36, !21, i64 44}
!32 = !{!"_ZTSN3JPH10SpringPartE", !21, i64 0, !21, i64 4}
!33 = !{i8 0, i8 2}
!34 = !{}
!35 = !{!7, !17, i64 32}
!36 = !{!7, !17, i64 40}
!37 = !{!13, !13, i64 0}
!38 = !{!6, !21, i64 228}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass