; LLVM IR from jrouwe/JoltPhysics :: Jolt/Physics/Body/Body.ll (ZN3JPH4Body20ApplyBuoyancyImpulseENS_4Vec3ES1_fffS1_S1_f)

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

; 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: mustprogress uwtable
declare dso_local void @_ZNK3JPH4Body18GetSubmergedVolumeENS_4Vec3ES1_RfS2_RS1_(ptr noundef nonnull align 16 dereferenceable(122), double, double, double, double, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 16 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH4Body20ApplyBuoyancyImpulseEffNS_4Vec3EfffS1_S1_f(ptr noundef nonnull align 16 dereferenceable(122), float noundef, float noundef, double, double, float noundef, float noundef, float noundef, ptr noundef byval(%"class.JPH::Vec3") align 16, ptr noundef byval(%"class.JPH::Vec3") align 16, float noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH4Body20ApplyBuoyancyImpulseENS_4Vec3ES1_fffS1_S1_f(ptr noundef nonnull align 16 dereferenceable(122) %0, double %1, double %2, double %3, double %4, float noundef %5, float noundef %6, float noundef %7, ptr noundef byval(%"class.JPH::Vec3") align 16 %8, ptr noundef byval(%"class.JPH::Vec3") align 16 %9, float noundef %10) #2 align 2 {
  %12 = alloca %"class.JPH::Vec3", align 16
  %13 = alloca %"class.JPH::Vec3", align 16
  %14 = alloca ptr, align 8
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca float, align 4
  %21 = alloca %"class.JPH::Vec3", align 16
  %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 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 0
  store double %1, ptr %27, align 16
  %28 = getelementptr inbounds { double, double }, ptr %12, i32 0, i32 1
  store double %2, ptr %28, align 8
  %29 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 0
  store double %3, ptr %29, align 16
  %30 = getelementptr inbounds { double, double }, ptr %13, i32 0, i32 1
  store double %4, ptr %30, align 8
  store ptr %0, ptr %14, align 8, !tbaa !5
  store float %5, ptr %15, align 4, !tbaa !9
  store float %6, ptr %16, align 4, !tbaa !9
  store float %7, ptr %17, align 4, !tbaa !9
  store float %10, ptr %18, align 4, !tbaa !9
  %31 = load ptr, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %21) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %22, ptr align 16 %12, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %23, ptr align 16 %13, i64 16, i1 false), !tbaa.struct !11
  %32 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 0
  %33 = load double, ptr %32, align 16
  %34 = getelementptr inbounds { double, double }, ptr %22, i32 0, i32 1
  %35 = load double, ptr %34, align 8
  %36 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 0
  %37 = load double, ptr %36, align 16
  %38 = getelementptr inbounds { double, double }, ptr %23, i32 0, i32 1
  %39 = load double, ptr %38, align 8
  call void @_ZNK3JPH4Body18GetSubmergedVolumeENS_4Vec3ES1_RfS2_RS1_(ptr noundef nonnull align 16 dereferenceable(122) %31, double %33, double %35, double %37, double %39, ptr noundef nonnull align 4 dereferenceable(4) %19, ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 16 dereferenceable(16) %21)
  %40 = load float, ptr %19, align 4, !tbaa !9
  %41 = load float, ptr %20, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %24, ptr align 16 %21, i64 16, i1 false), !tbaa.struct !11
  %42 = load float, ptr %15, align 4, !tbaa !9
  %43 = load float, ptr %16, align 4, !tbaa !9
  %44 = load float, ptr %17, align 4, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %25, ptr align 16 %8, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %26, ptr align 16 %9, i64 16, i1 false), !tbaa.struct !11
  %45 = load float, ptr %18, align 4, !tbaa !9
  %46 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 0
  %47 = load double, ptr %46, align 16
  %48 = getelementptr inbounds { double, double }, ptr %24, i32 0, i32 1
  %49 = load double, ptr %48, align 8
  %50 = call noundef zeroext i1 @_ZN3JPH4Body20ApplyBuoyancyImpulseEffNS_4Vec3EfffS1_S1_f(ptr noundef nonnull align 16 dereferenceable(122) %31, float noundef %40, float noundef %41, double %47, double %49, float noundef %42, float noundef %43, float noundef %44, ptr noundef byval(%"class.JPH::Vec3") align 16 %25, ptr noundef byval(%"class.JPH::Vec3") align 16 %26, float noundef %45)
  call void @llvm.lifetime.end.p0(i64 16, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  ret i1 %50
}

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 = { 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
declare dso_local void @_ZNK3JPH4Body18GetSubmergedVolumeENS_4Vec3ES1_RfS2_RS1_(ptr noundef nonnull align 16 dereferenceable(122), double, double, double, double, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH4Body20ApplyBuoyancyImpulseEffNS_4Vec3EfffS1_S1_f(ptr noundef nonnull align 16 dereferenceable(122), float noundef, float noundef, double, double, float noundef, float noundef, float noundef, ptr noundef byval(%"class.JPH::Vec3") align 16, ptr noundef byval(%"class.JPH::Vec3") align 16, float noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3JPH4Body20ApplyBuoyancyImpulseENS_4Vec3ES1_fffS1_S1_f(ptr noundef nonnull align 16 dereferenceable(122) %0, double %1, double %2, double %3, double %4, float noundef %5, float noundef %6, float noundef %7, ptr nocapture noundef readonly byval(%"class.JPH::Vec3") align 16 %8, ptr nocapture noundef readonly byval(%"class.JPH::Vec3") align 16 %9, float noundef %10) local_unnamed_addr #1 align 2 {
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca %"class.JPH::Vec3", align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #2
  call void @_ZNK3JPH4Body18GetSubmergedVolumeENS_4Vec3ES1_RfS2_RS1_(ptr noundef nonnull align 16 dereferenceable(122) %0, double %1, double %2, double %3, double %4, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 16 dereferenceable(16) %14)
  %15 = load float, ptr %12, align 4, !tbaa !5
  %16 = load float, ptr %13, align 4, !tbaa !5
  %.sroa.0.0.copyload = load double, ptr %14, align 16
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %14, i64 8
  %.sroa.2.0.copyload = load double, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !9
  %17 = call noundef zeroext i1 @_ZN3JPH4Body20ApplyBuoyancyImpulseEffNS_4Vec3EfffS1_S1_f(ptr noundef nonnull align 16 dereferenceable(122) %0, float noundef %15, float noundef %16, double %.sroa.0.0.copyload, double %.sroa.2.0.copyload, float noundef %5, float noundef %6, float noundef %7, ptr noundef nonnull byval(%"class.JPH::Vec3") align 16 %8, ptr noundef nonnull byval(%"class.JPH::Vec3") align 16 %9, float noundef %10)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #2
  ret i1 %17
}

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


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