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

; 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::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::Vec3" = type { %union.anon }
%union.anon = type { <4 x 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: 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH24SwingTwistConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(272)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16SixDOFConstraint14ResetWarmStartEv(ptr noundef nonnull align 16 dereferenceable(1856) %0) unnamed_addr #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %16 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %15, i32 0, i32 28
  store ptr %16, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds [3 x %"class.JPH::AxisConstraintPart"], ptr %17, i64 0, i64 0
  store ptr %18, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds [3 x %"class.JPH::AxisConstraintPart"], ptr %19, i64 0, i64 0
  %21 = getelementptr inbounds %"class.JPH::AxisConstraintPart", ptr %20, i64 3
  store ptr %21, ptr %5, align 8, !tbaa !5
  br label %22

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

26:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %33

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %28, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %29)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %30

30:                                               ; preds = %27
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.JPH::AxisConstraintPart", ptr %31, i32 1
  store ptr %32, ptr %4, align 8, !tbaa !5
  br label %22

33:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %34 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %15, i32 0, i32 29
  store ptr %34, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds [3 x %"class.JPH::AngleConstraintPart"], ptr %35, i64 0, i64 0
  store ptr %36, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds [3 x %"class.JPH::AngleConstraintPart"], ptr %37, i64 0, i64 0
  %39 = getelementptr inbounds %"class.JPH::AngleConstraintPart", ptr %38, i64 3
  store ptr %39, ptr %9, align 8, !tbaa !5
  br label %40

40:                                               ; preds = %48, %33
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = icmp ne ptr %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %51

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %46, ptr %10, align 8, !tbaa !5
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3JPH19AngleConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(48) %47)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %48

48:                                               ; preds = %45
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.JPH::AngleConstraintPart", ptr %49, i32 1
  store ptr %50, ptr %8, align 8, !tbaa !5
  br label %40

51:                                               ; preds = %44
  %52 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %15, i32 0, i32 27
  call void @_ZN3JPH27RotationEulerConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(208) %52)
  %53 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %15, i32 0, i32 26
  call void @_ZN3JPH24SwingTwistConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(272) %53)
  %54 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %15, i32 0, i32 25
  call void @_ZN3JPH19PointConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(240) %54)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %55 = getelementptr inbounds %"class.JPH::SixDOFConstraint", ptr %15, i32 0, i32 24
  store ptr %55, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = getelementptr inbounds [3 x %"class.JPH::AxisConstraintPart"], ptr %56, i64 0, i64 0
  store ptr %57, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = getelementptr inbounds [3 x %"class.JPH::AxisConstraintPart"], ptr %58, i64 0, i64 0
  %60 = getelementptr inbounds %"class.JPH::AxisConstraintPart", ptr %59, i64 3
  store ptr %60, ptr %13, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %69, %51
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = icmp ne ptr %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %72

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %67, ptr %14, align 8, !tbaa !5
  %68 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %68)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %69

69:                                               ; preds = %66
  %70 = load ptr, ptr %12, align 8, !tbaa !5
  %71 = getelementptr inbounds %"class.JPH::AxisConstraintPart", ptr %70, i32 1
  store ptr %71, ptr %12, align 8, !tbaa !5
  br label %61

72:                                               ; preds = %65
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH27RotationEulerConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(208)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH19PointConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(240)) #4 align 2

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


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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH24SwingTwistConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(272)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3JPH16SixDOFConstraint14ResetWarmStartEv(ptr noundef nonnull align 16 dereferenceable(1856) %0) unnamed_addr #2 align 2 {
.preheader.preheader:
  %.0.ptr = getelementptr inbounds i8, ptr %0, i64 1520
  tail call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %.0.ptr)
  %.0.ptr.1 = getelementptr inbounds i8, ptr %0, i64 1584
  tail call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %.0.ptr.1)
  %.0.ptr.2 = getelementptr inbounds i8, ptr %0, i64 1648
  tail call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %.0.ptr.2)
  %.022.ptr = getelementptr inbounds i8, ptr %0, i64 1712
  tail call void @_ZN3JPH19AngleConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(48) %.022.ptr)
  %.022.ptr.1 = getelementptr inbounds i8, ptr %0, i64 1760
  tail call void @_ZN3JPH19AngleConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(48) %.022.ptr.1)
  %.022.ptr.2 = getelementptr inbounds i8, ptr %0, i64 1808
  tail call void @_ZN3JPH19AngleConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(48) %.022.ptr.2)
  %1 = getelementptr inbounds i8, ptr %0, i64 1312
  tail call void @_ZN3JPH27RotationEulerConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(208) %1)
  %2 = getelementptr inbounds i8, ptr %0, i64 1040
  tail call void @_ZN3JPH24SwingTwistConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(272) %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 800
  tail call void @_ZN3JPH19PointConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(240) %3)
  %.023.ptr = getelementptr inbounds i8, ptr %0, i64 604
  tail call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %.023.ptr)
  %.023.ptr.1 = getelementptr inbounds i8, ptr %0, i64 668
  tail call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %.023.ptr.1)
  %.023.ptr.2 = getelementptr inbounds i8, ptr %0, i64 732
  tail call void @_ZN3JPH18AxisConstraintPart10DeactivateEv(ptr noundef nonnull align 4 dereferenceable(64) %.023.ptr.2)
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH27RotationEulerConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(208)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH19PointConstraintPart10DeactivateEv(ptr noundef nonnull align 16 dereferenceable(240)) local_unnamed_addr #3 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 = { 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 = { 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 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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass