; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Collision/Shape (Shape)

; 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::TransformedShape" = type { %"class.JPH::Vec3", %"class.JPH::Quat", %"class.JPH::RefConst", %"class.JPH::Float3", %"class.JPH::BodyID", %"class.JPH::SubShapeIDCreator" }
%"class.JPH::Vec3" = type { %union.anon.2 }
%union.anon.2 = type { <4 x float> }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.3 }
%union.anon.3 = type { <4 x float> }
%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Float3" = type { float, float, float }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::SubShapeIDCreator" = type { %"class.JPH::SubShapeID", i32 }
%"class.JPH::SubShapeID" = type { i32 }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; 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: mustprogress uwtable
define dso_local void @_ZNK3JPH5Shape27GetSubShapeTransformedShapeERKNS_10SubShapeIDENS_4Vec3ENS_4QuatES4_RS1_(ptr dead_on_unwind noalias writable sret(%"class.JPH::TransformedShape") align 16 %0, ptr noundef nonnull align 8 dereferenceable(26) %1, ptr noundef nonnull align 4 dereferenceable(4) %2, double %3, double %4, double %5, double %6, double %7, double %8, ptr noundef nonnull align 4 dereferenceable(4) %9) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %11 = alloca ptr, align 8
  %12 = alloca %"class.JPH::Vec3", align 16
  %13 = alloca %"class.JPH::Quat", align 16
  %14 = alloca %"class.JPH::Vec3", align 16
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %"class.JPH::SubShapeID", align 4
  %19 = alloca i1, align 1
  %20 = alloca %"class.JPH::Vec3", align 16
  %21 = alloca %"class.JPH::Quat", align 16
  %22 = alloca %"class.JPH::BodyID", align 4
  %23 = alloca %"class.JPH::SubShapeIDCreator", align 4
  %24 = alloca %"class.JPH::Vec3", align 16
  %25 = alloca ptr, align 8
  %26 = alloca i32, align 4
  store ptr %0, ptr %11, align 8
  %27 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
  store double %3, ptr %27, align 16
  %28 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
  store double %4, ptr %28, align 8
  %29 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  store double %5, ptr %29, align 16
  %30 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  store double %6, ptr %30, align 8
  %31 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 0
  store double %7, ptr %31, align 16
  %32 = getelementptr inbounds { double, double }, ptr %14, i32 0, i32 1
  store double %8, ptr %32, align 8
  store ptr %1, ptr %15, align 8, !tbaa !5
  store ptr %2, ptr %16, align 8, !tbaa !5
  store ptr %9, ptr %17, align 8, !tbaa !5
  %33 = load ptr, ptr %15, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  call void @llvm.memset.p0.i64(ptr align 4 %18, i8 0, i64 4, i1 false)
  call void @_ZN3JPH10SubShapeIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %18) #7
  %34 = load ptr, ptr %17, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %18, i64 4, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  store i1 false, ptr %19, align 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %20, ptr align 16 %12, i64 16, i1 false), !tbaa.struct !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %21, ptr align 16 %13, i64 16, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #7
  call void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %22)
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  call void @llvm.memset.p0.i64(ptr align 4 %23, i8 0, i64 8, i1 false)
  call void @_ZN3JPH17SubShapeIDCreatorC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %23) #7
  %35 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 0
  %36 = load double, ptr %35, align 16
  %37 = getelementptr inbounds { double, double }, ptr %20, i32 0, i32 1
  %38 = load double, ptr %37, align 8
  %39 = getelementptr inbounds { double, double }, ptr %21, i32 0, i32 0
  %40 = load double, ptr %39, align 16
  %41 = getelementptr inbounds { double, double }, ptr %21, i32 0, i32 1
  %42 = load double, ptr %41, align 8
  call void @_ZN3JPH16TransformedShapeC2ENS_4Vec3ENS_4QuatEPKNS_5ShapeERKNS_6BodyIDERKNS_17SubShapeIDCreatorE(ptr noundef nonnull align 16 dereferenceable(64) %0, double %36, double %38, double %40, double %42, ptr noundef %33, ptr noundef nonnull align 4 dereferenceable(4) %22, ptr noundef nonnull align 4 dereferenceable(8) %23)
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %14, i64 16, i1 false), !tbaa.struct !12
  %43 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %44 = load double, ptr %43, align 16
  %45 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %46 = load double, ptr %45, align 8
  invoke void @_ZN3JPH16TransformedShape13SetShapeScaleENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %0, double %44, double %46)
          to label %47 unwind label %49

47:                                               ; preds = %10
  store i1 true, ptr %19, align 1
  %48 = load i1, ptr %19, align 1
  br i1 %48, label %54, label %53

49:                                               ; preds = %10
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %25, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %26, align 4
  call void @_ZN3JPH16TransformedShapeD2Ev(ptr noundef nonnull align 16 dereferenceable(64) %0) #7
  br label %55

53:                                               ; preds = %47
  call void @_ZN3JPH16TransformedShapeD2Ev(ptr noundef nonnull align 16 dereferenceable(64) %0) #7
  br label %54

54:                                               ; preds = %53, %47
  ret void

55:                                               ; preds = %49
  %56 = load ptr, ptr %25, align 8
  %57 = load i32, ptr %26, align 4
  %58 = insertvalue { ptr, i32 } poison, ptr %56, 0
  %59 = insertvalue { ptr, i32 } %58, i32 %57, 1
  resume { ptr, i32 } %59
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH10SubShapeIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH17SubShapeIDCreatorC2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH16TransformedShapeC2ENS_4Vec3ENS_4QuatEPKNS_5ShapeERKNS_6BodyIDERKNS_17SubShapeIDCreatorE(ptr noundef nonnull align 16 dereferenceable(64), double, double, double, double, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH16TransformedShape13SetShapeScaleENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64), double, double) #6 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TransformedShapeD2Ev(ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #5 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #7 = { 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 = !{i64 0, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{i64 0, i64 16, !13}
!13 = !{!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::TransformedShape" = type { %"class.JPH::Vec3", %"class.JPH::Quat", %"class.JPH::RefConst", %"class.JPH::Float3", %"class.JPH::BodyID", %"class.JPH::SubShapeIDCreator" }
%"class.JPH::Vec3" = type { %union.anon.2 }
%union.anon.2 = type { <4 x float> }
%"class.JPH::Quat" = type { %"class.JPH::Vec4" }
%"class.JPH::Vec4" = type { %union.anon.3 }
%union.anon.3 = type { <4 x float> }
%"class.JPH::RefConst" = type { ptr }
%"class.JPH::Float3" = type { float, float, float }
%"class.JPH::BodyID" = type { i32 }
%"class.JPH::SubShapeIDCreator" = type { %"class.JPH::SubShapeID", i32 }
%"class.JPH::SubShapeID" = type { i32 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare i32 @__gxx_personality_v0(...)

; 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 @_ZNK3JPH5Shape27GetSubShapeTransformedShapeERKNS_10SubShapeIDENS_4Vec3ENS_4QuatES4_RS1_(ptr dead_on_unwind noalias writable sret(%"class.JPH::TransformedShape") align 16 %0, ptr noundef nonnull align 8 dereferenceable(26) %1, ptr nocapture noundef nonnull readnone align 4 dereferenceable(4) %2, double %3, double %4, double %5, double %6, double %7, double %8, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %9) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %11 = alloca %"class.JPH::SubShapeID", align 4
  %12 = alloca %"class.JPH::BodyID", align 4
  %13 = alloca %"class.JPH::SubShapeIDCreator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  store i32 0, ptr %11, align 4
  call void @_ZN3JPH10SubShapeIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %11) #5
  %14 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %14, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #5
  call void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %12)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #5
  store i64 0, ptr %13, align 8
  call void @_ZN3JPH17SubShapeIDCreatorC2Ev(ptr noundef nonnull align 4 dereferenceable(8) %13) #5
  call void @_ZN3JPH16TransformedShapeC2ENS_4Vec3ENS_4QuatEPKNS_5ShapeERKNS_6BodyIDERKNS_17SubShapeIDCreatorE(ptr noundef nonnull align 16 dereferenceable(64) %0, double %3, double %4, double %5, double %6, ptr noundef nonnull %1, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(8) %13)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  invoke void @_ZN3JPH16TransformedShape13SetShapeScaleENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64) %0, double %7, double %8)
          to label %17 unwind label %15

15:                                               ; preds = %10
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3JPH16TransformedShapeD2Ev(ptr noundef nonnull align 16 dereferenceable(64) %0) #5
  resume { ptr, i32 } %16

17:                                               ; preds = %10
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH10SubShapeIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH6BodyIDC2Ev(ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH17SubShapeIDCreatorC2Ev(ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3JPH16TransformedShapeC2ENS_4Vec3ENS_4QuatEPKNS_5ShapeERKNS_6BodyIDERKNS_17SubShapeIDCreatorE(ptr noundef nonnull align 16 dereferenceable(64), double, double, double, double, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3JPH16TransformedShape13SetShapeScaleENS_4Vec3E(ptr noundef nonnull align 16 dereferenceable(64), double, double) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3JPH16TransformedShapeD2Ev(ptr noundef nonnull align 16 dereferenceable(64)) unnamed_addr #3 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 = { 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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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