; LLVM IR from atlantis13579/Riemann :: Src/CollisionPrimitive (HeightField3)

; 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.Maths::TVector3" = type { float, float, float }
%"struct.Riemann::MassParameters" = type { float, float, %"class.Maths::Matrix3", %"class.Maths::TVector3", %"class.Maths::TAABB3" }
%"class.Maths::Matrix3" = type { [3 x [3 x float]] }
%"class.Maths::TAABB3" = type { %"class.Maths::TVector3", %"class.Maths::TVector3" }
%"class.Riemann::HeightField3" = type { i32, i32, %"class.Maths::TAABB3", float, float, float, float, float, %"class.std::vector", ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::HeightField3::CellInfo, std::allocator<Riemann::HeightField3::CellInfo>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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 noundef zeroext i1 @_ZNK7Riemann12HeightField325CalculateVolumePropertiesEPNS_14MassParametersEf(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, float noundef %2) #1 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca float, align 4
  %7 = alloca %"class.Maths::TVector3", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store float %2, ptr %6, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %"struct.Riemann::MassParameters", ptr %9, i32 0, i32 1
  store float 0.000000e+00, ptr %10, align 4, !tbaa !11
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.Riemann::MassParameters", ptr %11, i32 0, i32 0
  store float 0.000000e+00, ptr %12, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 12, ptr %7) #4
  %13 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %8, i32 0, i32 2
  call void @_ZNK5Maths6TAABB3IfE9GetCenterEv(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %7, ptr noundef nonnull align 4 dereferenceable(24) %13)
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %"struct.Riemann::MassParameters", ptr %14, i32 0, i32 3
  %16 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %15, ptr noundef nonnull align 4 dereferenceable(12) %7)
  call void @llvm.lifetime.end.p0(i64 12, ptr %7) #4
  %17 = getelementptr inbounds %"class.Riemann::HeightField3", ptr %8, i32 0, i32 2
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %"struct.Riemann::MassParameters", ptr %18, i32 0, i32 4
  %20 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN5Maths6TAABB3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(24) %17)
  %21 = call noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix38IdentityEv()
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %"struct.Riemann::MassParameters", ptr %22, i32 0, i32 2
  %24 = call noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix3aSERKS0_(ptr noundef nonnull align 4 dereferenceable(36) %23, ptr noundef nonnull align 4 dereferenceable(36) %21)
  ret i1 true
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths6TAABB3IfE9GetCenterEv(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(24)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZN5Maths6TAABB3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix38IdentityEv() #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix3aSERKS0_(ptr noundef nonnull align 4 dereferenceable(36), ptr noundef nonnull align 4 dereferenceable(36)) #3 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 = { 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 = { 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 = { 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 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN7Riemann14MassParametersE", !10, i64 0, !10, i64 4, !13, i64 8, !14, i64 44, !15, i64 56}
!13 = !{!"_ZTSN5Maths7Matrix3E", !7, i64 0}
!14 = !{!"_ZTSN5Maths8TVector3IfEE", !10, i64 0, !10, i64 4, !10, i64 8}
!15 = !{!"_ZTSN5Maths6TAABB3IfEE", !14, i64 0, !14, i64 12}
!16 = !{!12, !10, 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.Maths::TVector3" = type { float, float, 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 noundef zeroext i1 @_ZNK7Riemann12HeightField325CalculateVolumePropertiesEPNS_14MassParametersEf(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %1, float noundef %2) local_unnamed_addr #1 align 2 {
  %4 = alloca %"class.Maths::TVector3", align 4
  store <2 x float> zeroinitializer, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  call void @_ZNK5Maths6TAABB3IfE9GetCenterEv(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %4, ptr noundef nonnull align 4 dereferenceable(24) %5)
  %6 = getelementptr inbounds i8, ptr %1, i64 44
  %7 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %4)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #4
  %8 = getelementptr inbounds i8, ptr %1, i64 56
  %9 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN5Maths6TAABB3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %8, ptr noundef nonnull align 4 dereferenceable(24) %5)
  %10 = call noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix38IdentityEv()
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = call noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix3aSERKS0_(ptr noundef nonnull align 4 dereferenceable(36) %11, ptr noundef nonnull align 4 dereferenceable(36) %10)
  ret i1 true
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK5Maths6TAABB3IfE9GetCenterEv(ptr dead_on_unwind noalias writable sret(%"class.Maths::TVector3") align 4, ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZN5Maths6TAABB3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix38IdentityEv() local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(36) ptr @_ZN5Maths7Matrix3aSERKS0_(ptr noundef nonnull align 4 dereferenceable(36), ptr noundef nonnull align 4 dereferenceable(36)) local_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 = { 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 = { 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 = { 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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass