; LLVM IR from atlantis13579/Riemann :: Src/Collision (GeometryQuery)

; 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.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl" }
%"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Riemann::AABBTreeBuildData" = type <{ i32, i32, ptr, ptr, ptr, ptr, i8, [7 x i8] }>
%"class.Riemann::GeometryQuery" = type { %"class.std::vector", ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Riemann::Geometry *, std::allocator<Riemann::Geometry *>>::_Vector_impl" }
%"struct.std::_Vector_base<Riemann::Geometry *, std::allocator<Riemann::Geometry *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Riemann::Geometry *, std::allocator<Riemann::Geometry *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Riemann::Geometry *, std::allocator<Riemann::Geometry *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: nounwind
declare void @_ZN7Riemann8AABBTreeD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann13GeometryQuery19BuildStaticGeometryERKSt6vectorIPNS_8GeometryESaIS3_EEi(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2) #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::vector.5", align 8
  %10 = alloca i64, align 8
  %11 = alloca %"struct.Riemann::AABBTreeBuildData", align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  %12 = load ptr, ptr %4, align 8
  %13 = getelementptr inbounds %"class.Riemann::GeometryQuery", ptr %12, i32 0, i32 1
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %23

16:                                               ; preds = %3
  %17 = getelementptr inbounds %"class.Riemann::GeometryQuery", ptr %12, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = icmp eq ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @_ZN7Riemann8AABBTreeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %18) #8
  call void @_ZdlPvm(ptr noundef %18, i64 noundef 24) #9
  br label %21

21:                                               ; preds = %20, %16
  %22 = getelementptr inbounds %"class.Riemann::GeometryQuery", ptr %12, i32 0, i32 1
  store ptr null, ptr %22, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %21, %3
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %24) #8
  %26 = icmp ugt i64 %25, 0
  br i1 %26, label %27, label %89

27:                                               ; preds = %23
  %28 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #10
  invoke void @_ZN7Riemann8AABBTreeC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %28)
          to label %29 unwind label %40

29:                                               ; preds = %27
  %30 = getelementptr inbounds %"class.Riemann::GeometryQuery", ptr %12, i32 0, i32 1
  store ptr %28, ptr %30, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %9) #8
  call void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %31) #8
  invoke void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %32)
          to label %33 unwind label %44

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 0, ptr %10, align 8, !tbaa !17
  br label %34

34:                                               ; preds = %59, %33
  %35 = load i64, ptr %10, align 8, !tbaa !17
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #8
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %48, label %39

39:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %66

40:                                               ; preds = %27
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %7, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %28, i64 noundef 24) #9
  br label %90

44:                                               ; preds = %66, %29
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %7, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %8, align 4
  br label %88

48:                                               ; preds = %34
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load i64, ptr %10, align 8, !tbaa !17
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %50) #8
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = invoke noundef nonnull align 4 dereferenceable(24) ptr @_ZNK7Riemann8Geometry28GetBoundingVolume_WorldSpaceEv(ptr noundef nonnull align 8 dereferenceable(204) %52)
          to label %54 unwind label %62

54:                                               ; preds = %48
  %55 = load i64, ptr %10, align 8, !tbaa !17
  %56 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %55) #8
  %57 = invoke noundef nonnull align 4 dereferenceable(24) ptr @_ZN5Maths6TAABB3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %56, ptr noundef nonnull align 4 dereferenceable(24) %53)
          to label %58 unwind label %62

58:                                               ; preds = %54
  br label %59

59:                                               ; preds = %58
  %60 = load i64, ptr %10, align 8, !tbaa !17
  %61 = add i64 %60, 1
  store i64 %61, ptr %10, align 8, !tbaa !17
  br label %34, !llvm.loop !19

62:                                               ; preds = %54, %48
  %63 = landingpad { ptr, i32 }
          cleanup
  %64 = extractvalue { ptr, i32 } %63, 0
  store ptr %64, ptr %7, align 8
  %65 = extractvalue { ptr, i32 } %63, 1
  store i32 %65, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %88

66:                                               ; preds = %39
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.Riemann::GeometryQuery", ptr %12, i32 0, i32 0
  %69 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIPN7Riemann8GeometryESaIS2_EEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(24) %67)
          to label %70 unwind label %44

70:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 48, ptr %11) #8
  %71 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef 0) #8
  %72 = call noundef i64 @_ZNKSt6vectorIN5Maths6TAABB3IfEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  %73 = trunc i64 %72 to i32
  %74 = load i32, ptr %6, align 4, !tbaa !9
  invoke void @_ZN7Riemann17AABBTreeBuildDataC2EPKN5Maths6TAABB3IfEEii(ptr noundef nonnull align 8 dereferenceable(41) %11, ptr noundef %71, i32 noundef %73, i32 noundef %74)
          to label %75 unwind label %79

75:                                               ; preds = %70
  %76 = getelementptr inbounds %"class.Riemann::GeometryQuery", ptr %12, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !11
  invoke void @_ZN7Riemann8AABBTree11StaticBuildERNS_17AABBTreeBuildDataE(ptr noundef nonnull align 8 dereferenceable(24) %77, ptr noundef nonnull align 8 dereferenceable(41) %11)
          to label %78 unwind label %83

78:                                               ; preds = %75
  call void @_ZN7Riemann17AABBTreeBuildDataD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %11) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #8
  call void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #8
  br label %89

79:                                               ; preds = %70
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %7, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %8, align 4
  br label %87

83:                                               ; preds = %75
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %7, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %8, align 4
  call void @_ZN7Riemann17AABBTreeBuildDataD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %11) #8
  br label %87

87:                                               ; preds = %83, %79
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #8
  br label %88

88:                                               ; preds = %87, %62, %44
  call void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %9) #8
  br label %90

89:                                               ; preds = %78, %23
  ret void

90:                                               ; preds = %88, %40
  %91 = load ptr, ptr %7, align 8
  %92 = load i32, ptr %8, align 4
  %93 = insertvalue { ptr, i32 } poison, ptr %91, 0
  %94 = insertvalue { ptr, i32 } %93, i32 %92, 1
  resume { ptr, i32 } %94
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #5

declare void @_ZN7Riemann8AABBTreeC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZNK7Riemann8Geometry28GetBoundingVolume_WorldSpaceEv(ptr noundef nonnull align 8 dereferenceable(204)) #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: mustprogress nounwind 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)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN5Maths6TAABB3IfEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann17AABBTreeBuildDataC2EPKN5Maths6TAABB3IfEEii(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

declare void @_ZN7Riemann8AABBTree11StaticBuildERNS_17AABBTreeBuildDataE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(41)) #6

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

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

attributes #0 = { nounwind "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 = { nobuiltin nounwind "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nobuiltin allocsize(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 = { "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 = { 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 #8 = { nounwind }
attributes #9 = { builtin nounwind }
attributes #10 = { builtin allocsize(0) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"_ZTSN7Riemann13GeometryQueryE", !13, i64 0, !6, i64 24, !6, i64 32}
!13 = !{!"_ZTSSt6vectorIPN7Riemann8GeometryESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPN7Riemann8GeometryESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN7Riemann8GeometryESaIS2_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN7Riemann8GeometryESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!18, !18, i64 0}
!18 = !{!"long", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; 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.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl" }
%"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl" = type { %"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Maths::TAABB3<float>, std::allocator<Maths::TAABB3<float>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.Riemann::AABBTreeBuildData" = type <{ i32, i32, ptr, ptr, ptr, ptr, i8, [7 x i8] }>

; Function Attrs: nounwind
declare void @_ZN7Riemann8AABBTreeD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann13GeometryQuery19BuildStaticGeometryERKSt6vectorIPNS_8GeometryESaIS3_EEi(ptr noundef nonnull align 8 dereferenceable(40) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.std::vector.5", align 8
  %5 = alloca %"struct.Riemann::AABBTreeBuildData", align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %9, label %8

8:                                                ; preds = %3
  tail call void @_ZN7Riemann8AABBTreeD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #8
  tail call void @_ZdlPvm(ptr noundef nonnull %7, i64 noundef 24) #9
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %8, %3
  %10 = tail call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %.not16 = icmp eq i64 %10, 0
  br i1 %.not16, label %38, label %11

11:                                               ; preds = %9
  %12 = tail call noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #10
  invoke void @_ZN7Riemann8AABBTreeC1Ev(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %13 unwind label %17

13:                                               ; preds = %11
  store ptr %12, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #8
  call void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  %14 = call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  invoke void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %14)
          to label %.preheader unwind label %19

.preheader:                                       ; preds = %13
  %15 = call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %.not20 = icmp eq i64 %15, 0
  br i1 %.not20, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %16 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIPN7Riemann8GeometryESaIS2_EEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %29 unwind label %19

17:                                               ; preds = %11
  %18 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %12, i64 noundef 24) #9
  br label %39

19:                                               ; preds = %._crit_edge, %13
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %37

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.019 = phi i64 [ %26, %.lr.ph ], [ 0, %.preheader ]
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %.019) #8
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNK7Riemann8Geometry28GetBoundingVolume_WorldSpaceEv(ptr noundef nonnull align 8 dereferenceable(204) %22)
  %24 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %.019) #8
  %25 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZN5Maths6TAABB3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(24) %24, ptr noundef nonnull align 4 dereferenceable(24) %23)
  %26 = add nuw i64 %.019, 1
  %27 = call noundef i64 @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %28 = icmp ult i64 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !15

29:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #8
  %30 = call noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef 0) #8
  %31 = call noundef i64 @_ZNKSt6vectorIN5Maths6TAABB3IfEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  %32 = trunc i64 %31 to i32
  call void @_ZN7Riemann17AABBTreeBuildDataC2EPKN5Maths6TAABB3IfEEii(ptr noundef nonnull align 8 dereferenceable(41) %5, ptr noundef nonnull %30, i32 noundef %32, i32 noundef %2)
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN7Riemann8AABBTree11StaticBuildERNS_17AABBTreeBuildDataE(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 8 dereferenceable(41) %5)
          to label %34 unwind label %35

34:                                               ; preds = %29
  call void @_ZN7Riemann17AABBTreeBuildDataD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #8
  call void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  br label %38

35:                                               ; preds = %29
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7Riemann17AABBTreeBuildDataD2Ev(ptr noundef nonnull align 8 dereferenceable(41) %5) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #8
  br label %37

37:                                               ; preds = %35, %19
  %.pn = phi { ptr, i32 } [ %36, %35 ], [ %20, %19 ]
  call void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #8
  br label %39

38:                                               ; preds = %34, %9
  ret void

39:                                               ; preds = %37, %17
  %.pn.pn = phi { ptr, i32 } [ %.pn, %37 ], [ %18, %17 ]
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #5

declare void @_ZN7Riemann8AABBTreeC1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt6vectorIPN7Riemann8GeometryESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZNK7Riemann8Geometry28GetBoundingVolume_WorldSpaceEv(ptr noundef nonnull align 8 dereferenceable(204)) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(24) ptr @_ZNSt6vectorIN5Maths6TAABB3IfEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind 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 #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIN5Maths6TAABB3IfEESaIS2_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann17AABBTreeBuildDataC2EPKN5Maths6TAABB3IfEEii(ptr noundef nonnull align 8 dereferenceable(41), ptr noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

declare void @_ZN7Riemann8AABBTree11StaticBuildERNS_17AABBTreeBuildDataE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(41)) local_unnamed_addr #6

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

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

attributes #0 = { nounwind "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 = { nobuiltin nounwind "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nobuiltin allocsize(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 = { "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 = { 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 #8 = { nounwind }
attributes #9 = { builtin nounwind }
attributes #10 = { builtin allocsize(0) }

!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, !11, i64 24}
!6 = !{!"_ZTSN7Riemann13GeometryQueryE", !7, i64 0, !11, i64 24, !11, i64 32}
!7 = !{!"_ZTSSt6vectorIPN7Riemann8GeometryESaIS2_EE", !8, i64 0}
!8 = !{!"_ZTSSt12_Vector_baseIPN7Riemann8GeometryESaIS2_EE", !9, i64 0}
!9 = !{!"_ZTSNSt12_Vector_baseIPN7Riemann8GeometryESaIS2_EE12_Vector_implE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIPN7Riemann8GeometryESaIS2_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !12, i64 0}
!12 = !{!"omnipotent char", !13, i64 0}
!13 = !{!"Simple C++ TBAA"}
!14 = !{!11, !11, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass