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

; 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::ContactConstraintManager::WorldContactPoint" = type { %"class.JPH::AxisConstraintPart", %"class.JPH::AxisConstraintPart", %"class.JPH::AxisConstraintPart", ptr }
%"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 }
%"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: mustprogress uwtable
define dso_local void @_ZN3JPH24ContactConstraintManager17WorldContactPoint43CalculateNonPenetrationConstraintPropertiesERKNS_4BodyEffS4_ffNS_4Vec3ES5_S5_(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef nonnull align 16 dereferenceable(122) %1, float noundef %2, float noundef %3, ptr noundef nonnull align 16 dereferenceable(122) %4, float noundef %5, float noundef %6, double %7, double %8, double %9, double %10, ptr noundef byval(%"class.JPH::Vec3") align 16 %11) #1 align 2 {
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca ptr, align 8
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca %"class.JPH::Vec3", align 16
  %23 = alloca %"class.JPH::Vec3", align 16
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca %"class.JPH::Vec3", align 16
  %26 = alloca %"class.JPH::Vec3", align 16
  %27 = alloca %"class.JPH::Vec3", align 16
  %28 = alloca %"class.JPH::Vec3", align 16
  %29 = alloca %"class.JPH::Vec3", align 16
  %30 = alloca %"class.JPH::Vec3", align 16
  %31 = alloca %"class.JPH::Vec3", align 16
  %32 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  store double %7, ptr %32, align 16
  %33 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  store double %8, ptr %33, align 8
  %34 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  store double %9, ptr %34, align 16
  %35 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  store double %10, ptr %35, align 8
  store ptr %0, ptr %15, align 8, !tbaa !5
  store ptr %1, ptr %16, align 8, !tbaa !5
  store float %2, ptr %17, align 4, !tbaa !9
  store float %3, ptr %18, align 4, !tbaa !9
  store ptr %4, ptr %19, align 8, !tbaa !5
  store float %5, ptr %20, align 4, !tbaa !9
  store float %6, ptr %21, align 4, !tbaa !9
  %36 = load ptr, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #6
  %37 = call noundef float @_ZN3JPH8literalsli2_rEe(x86_fp80 noundef 0xK3FFE8000000000000000)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %14, i64 16, i1 false), !tbaa.struct !11
  %38 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %39 = load double, ptr %38, align 16
  %40 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %41 = load double, ptr %40, align 8
  %42 = call { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16) %13, double %39, double %41)
  %43 = getelementptr inbounds %"class.JPH::Vec3", ptr %23, i32 0, i32 0
  %44 = getelementptr inbounds %union.anon, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds { double, double }, ptr %44, i32 0, i32 0
  %46 = extractvalue { double, double } %42, 0
  store double %46, ptr %45, align 16
  %47 = getelementptr inbounds { double, double }, ptr %44, i32 0, i32 1
  %48 = extractvalue { double, double } %42, 1
  store double %48, ptr %47, align 8
  %49 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 0
  %50 = load double, ptr %49, align 16
  %51 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 1
  %52 = load double, ptr %51, align 8
  %53 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %37, double %50, double %52)
  %54 = getelementptr inbounds %"class.JPH::Vec3", ptr %22, i32 0, i32 0
  %55 = getelementptr inbounds %union.anon, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds { double, double }, ptr %55, i32 0, i32 0
  %57 = extractvalue { double, double } %53, 0
  store double %57, ptr %56, align 16
  %58 = getelementptr inbounds { double, double }, ptr %55, i32 0, i32 1
  %59 = extractvalue { double, double } %53, 1
  store double %59, ptr %58, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #6
  %60 = load ptr, ptr %16, align 8, !tbaa !5
  %61 = call { double, double } @_ZNK3JPH4Body23GetCenterOfMassPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %60)
  %62 = getelementptr inbounds %"class.JPH::Vec3", ptr %26, i32 0, i32 0
  %63 = getelementptr inbounds %union.anon, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds { double, double }, ptr %63, i32 0, i32 0
  %65 = extractvalue { double, double } %61, 0
  store double %65, ptr %64, align 16
  %66 = getelementptr inbounds { double, double }, ptr %63, i32 0, i32 1
  %67 = extractvalue { double, double } %61, 1
  store double %67, ptr %66, align 8
  %68 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 0
  %69 = load double, ptr %68, align 16
  %70 = getelementptr inbounds { double, double }, ptr %26, i32 0, i32 1
  %71 = load double, ptr %70, align 8
  %72 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %22, double %69, double %71)
  %73 = getelementptr inbounds %"class.JPH::Vec3", ptr %25, i32 0, i32 0
  %74 = getelementptr inbounds %union.anon, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds { double, double }, ptr %74, i32 0, i32 0
  %76 = extractvalue { double, double } %72, 0
  store double %76, ptr %75, align 16
  %77 = getelementptr inbounds { double, double }, ptr %74, i32 0, i32 1
  %78 = extractvalue { double, double } %72, 1
  store double %78, ptr %77, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #6
  %79 = load ptr, ptr %19, align 8, !tbaa !5
  %80 = call { double, double } @_ZNK3JPH4Body23GetCenterOfMassPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %79)
  %81 = getelementptr inbounds %"class.JPH::Vec3", ptr %28, i32 0, i32 0
  %82 = getelementptr inbounds %union.anon, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds { double, double }, ptr %82, i32 0, i32 0
  %84 = extractvalue { double, double } %80, 0
  store double %84, ptr %83, align 16
  %85 = getelementptr inbounds { double, double }, ptr %82, i32 0, i32 1
  %86 = extractvalue { double, double } %80, 1
  store double %86, ptr %85, align 8
  %87 = getelementptr inbounds { double, double }, ptr %28, i32 0, i32 0
  %88 = load double, ptr %87, align 16
  %89 = getelementptr inbounds { double, double }, ptr %28, i32 0, i32 1
  %90 = load double, ptr %89, align 8
  %91 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %22, double %88, double %90)
  %92 = getelementptr inbounds %"class.JPH::Vec3", ptr %27, i32 0, i32 0
  %93 = getelementptr inbounds %union.anon, ptr %92, i32 0, i32 0
  %94 = getelementptr inbounds { double, double }, ptr %93, i32 0, i32 0
  %95 = extractvalue { double, double } %91, 0
  store double %95, ptr %94, align 16
  %96 = getelementptr inbounds { double, double }, ptr %93, i32 0, i32 1
  %97 = extractvalue { double, double } %91, 1
  store double %97, ptr %96, align 8
  %98 = getelementptr inbounds %"class.JPH::ContactConstraintManager::WorldContactPoint", ptr %36, i32 0, i32 0
  %99 = load ptr, ptr %16, align 8, !tbaa !5
  %100 = load float, ptr %17, align 4, !tbaa !9
  %101 = load float, ptr %18, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %29, ptr align 16 %25, i64 16, i1 false), !tbaa.struct !11
  %102 = load ptr, ptr %19, align 8, !tbaa !5
  %103 = load float, ptr %20, align 4, !tbaa !9
  %104 = load float, ptr %21, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %30, ptr align 16 %27, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %31, ptr align 16 %11, i64 16, i1 false), !tbaa.struct !11
  %105 = getelementptr inbounds { double, double }, ptr %29, i32 0, i32 0
  %106 = load double, ptr %105, align 16
  %107 = getelementptr inbounds { double, double }, ptr %29, i32 0, i32 1
  %108 = load double, ptr %107, align 8
  %109 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 0
  %110 = load double, ptr %109, align 16
  %111 = getelementptr inbounds { double, double }, ptr %30, i32 0, i32 1
  %112 = load double, ptr %111, align 8
  call void @_ZN3JPH18AxisConstraintPart45CalculateConstraintPropertiesWithMassOverrideERKNS_4BodyEffNS_4Vec3ES3_ffS4_S4_f(ptr noundef nonnull align 4 dereferenceable(64) %98, ptr noundef nonnull align 16 dereferenceable(122) %99, float noundef %100, float noundef %101, double %106, double %108, ptr noundef nonnull align 16 dereferenceable(122) %102, float noundef %103, float noundef %104, double %110, double %112, ptr noundef byval(%"class.JPH::Vec3") align 16 %31, float noundef 0.000000e+00)
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #6
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef, double, double) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH8literalsli2_rEe(x86_fp80 noundef) #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 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 uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH18AxisConstraintPart45CalculateConstraintPropertiesWithMassOverrideERKNS_4BodyEffNS_4Vec3ES3_ffS4_S4_f(ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 16 dereferenceable(122), float noundef, float noundef, double, double, ptr noundef nonnull align 16 dereferenceable(122), float noundef, float noundef, double, double, ptr noundef byval(%"class.JPH::Vec3") align 16, float noundef) #5 align 2

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 = { 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 #3 = { 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 = { 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 #6 = { 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 = !{!"float", !7, i64 0}
!11 = !{i64 0, i64 16, !12}
!12 = !{!7, !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: 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 @_ZN3JPH24ContactConstraintManager17WorldContactPoint43CalculateNonPenetrationConstraintPropertiesERKNS_4BodyEffS4_ffNS_4Vec3ES5_S5_(ptr noundef nonnull align 8 dereferenceable(200) %0, ptr noundef nonnull align 16 dereferenceable(122) %1, float noundef %2, float noundef %3, ptr noundef nonnull align 16 dereferenceable(122) %4, float noundef %5, float noundef %6, double %7, double %8, double %9, double %10, ptr nocapture noundef readonly byval(%"class.JPH::Vec3") align 16 %11) local_unnamed_addr #1 align 2 {
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  store double %7, ptr %13, align 16
  %15 = getelementptr inbounds i8, ptr %13, i64 8
  store double %8, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #5
  %16 = tail call noundef float @_ZN3JPH8literalsli2_rEe(x86_fp80 noundef 0xK3FFE8000000000000000)
  %17 = call { double, double } @_ZNK3JPH4Vec3plES0_(ptr noundef nonnull align 16 dereferenceable(16) %13, double %9, double %10)
  %18 = extractvalue { double, double } %17, 0
  %19 = extractvalue { double, double } %17, 1
  %20 = call { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef %16, double %18, double %19)
  %21 = extractvalue { double, double } %20, 0
  store double %21, ptr %14, align 16
  %22 = getelementptr inbounds i8, ptr %14, i64 8
  %23 = extractvalue { double, double } %20, 1
  store double %23, ptr %22, align 8
  %24 = call { double, double } @_ZNK3JPH4Body23GetCenterOfMassPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %1)
  %25 = extractvalue { double, double } %24, 0
  %26 = extractvalue { double, double } %24, 1
  %27 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %14, double %25, double %26)
  %28 = extractvalue { double, double } %27, 0
  %29 = extractvalue { double, double } %27, 1
  %30 = call { double, double } @_ZNK3JPH4Body23GetCenterOfMassPositionEv(ptr noundef nonnull align 16 dereferenceable(122) %4)
  %31 = extractvalue { double, double } %30, 0
  %32 = extractvalue { double, double } %30, 1
  %33 = call { double, double } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16) %14, double %31, double %32)
  %34 = extractvalue { double, double } %33, 0
  %35 = extractvalue { double, double } %33, 1
  call void @_ZN3JPH18AxisConstraintPart45CalculateConstraintPropertiesWithMassOverrideERKNS_4BodyEffNS_4Vec3ES3_ffS4_S4_f(ptr noundef nonnull align 4 dereferenceable(64) %0, ptr noundef nonnull align 16 dereferenceable(122) %1, float noundef %2, float noundef %3, double %28, double %29, ptr noundef nonnull align 16 dereferenceable(122) %4, float noundef %5, float noundef %6, double %34, double %35, ptr noundef nonnull byval(%"class.JPH::Vec3") align 16 %11, float noundef 0.000000e+00)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #5
  ret void
}

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZN3JPHmlEfNS_4Vec3E(float noundef, double, double) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef float @_ZN3JPH8literalsli2_rEe(x86_fp80 noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { double, double } @_ZNK3JPH4Vec3plES0_(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 } @_ZNK3JPH4Vec3miES0_(ptr noundef nonnull align 16 dereferenceable(16), double, double) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH18AxisConstraintPart45CalculateConstraintPropertiesWithMassOverrideERKNS_4BodyEffNS_4Vec3ES3_ffS4_S4_f(ptr noundef nonnull align 4 dereferenceable(64), ptr noundef nonnull align 16 dereferenceable(122), float noundef, float noundef, double, double, ptr noundef nonnull align 16 dereferenceable(122), float noundef, float noundef, double, double, ptr noundef byval(%"class.JPH::Vec3") align 16, float noundef) local_unnamed_addr #4 align 2

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 = { 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 #3 = { 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 = { 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)"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass