; LLVM IR from atlantis13579/Riemann :: Src/Collision/AABBTree.ll (ZN7Riemann8AABBTree17InitAABBTreeBuildERNS_17AABBTreeBuildDataE)

; 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 }
%"class.Riemann::AABBTree" = type { ptr, i32, ptr }
%"struct.Riemann::AABBTreeBuildData" = type <{ i32, i32, ptr, ptr, ptr, ptr, i8, [7 x i8] }>
%"class.Maths::TAABB3" = type { %"class.Maths::TVector3", %"class.Maths::TVector3" }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann8AABBTree17InitAABBTreeBuildERNS_17AABBTreeBuildDataE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(41) %1) #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.Maths::TVector3", align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8
  %11 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  br label %119

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 4, !tbaa !12
  %19 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %10, i32 0, i32 1
  store i32 %18, ptr %19, align 8, !tbaa !15
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %20, i32 0, i32 1
  %22 = load i32, ptr %21, align 4, !tbaa !12
  %23 = sext i32 %22 to i64
  %24 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %23, i64 4)
  %25 = extractvalue { i64, i1 } %24, 1
  %26 = extractvalue { i64, i1 } %24, 0
  %27 = select i1 %25, i64 -1, i64 %26
  %28 = call noalias noundef nonnull ptr @_Znam(i64 noundef %27) #9
  %29 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %10, i32 0, i32 0
  store ptr %28, ptr %29, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #10
  store i32 0, ptr %5, align 4, !tbaa !16
  br label %30

30:                                               ; preds = %44, %15
  %31 = load i32, ptr %5, align 4, !tbaa !16
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %32, i32 0, i32 1
  %34 = load i32, ptr %33, align 4, !tbaa !12
  %35 = icmp slt i32 %31, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #10
  br label %47

37:                                               ; preds = %30
  %38 = load i32, ptr %5, align 4, !tbaa !16
  %39 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %10, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = load i32, ptr %5, align 4, !tbaa !16
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %40, i64 %42
  store i32 %38, ptr %43, align 4, !tbaa !16
  br label %44

44:                                               ; preds = %37
  %45 = load i32, ptr %5, align 4, !tbaa !16
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %5, align 4, !tbaa !16
  br label %30, !llvm.loop !17

47:                                               ; preds = %36
  %48 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 40) #9
  invoke void @_ZN7Riemann15AABBTreeOfflineC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %48)
          to label %49 unwind label %93

49:                                               ; preds = %47
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %50, i32 0, i32 5
  store ptr %48, ptr %51, align 8, !tbaa !19
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %52, i32 0, i32 5
  %54 = load ptr, ptr %53, align 8, !tbaa !19
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !12
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !20
  call void @_ZN7Riemann15AABBTreeOffline4InitEii(ptr noundef nonnull align 8 dereferenceable(40) %54, i32 noundef %57, i32 noundef %60)
  %61 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %10, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !9
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %63, i32 0, i32 4
  store ptr %62, ptr %64, align 8, !tbaa !21
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !12
  %68 = add nsw i32 %67, 1
  %69 = sext i32 %68 to i64
  %70 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %69, i64 12)
  %71 = extractvalue { i64, i1 } %70, 1
  %72 = extractvalue { i64, i1 } %70, 0
  %73 = select i1 %71, i64 -1, i64 %72
  %74 = call noalias noundef nonnull ptr @_Znam(i64 noundef %73) #9
  %75 = icmp eq i64 %69, 0
  br i1 %75, label %83, label %76

76:                                               ; preds = %49
  %77 = getelementptr inbounds %"class.Maths::TVector3", ptr %74, i64 %69
  br label %78

78:                                               ; preds = %80, %76
  %79 = phi ptr [ %74, %76 ], [ %81, %80 ]
  invoke void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %79)
          to label %80 unwind label %97

80:                                               ; preds = %78
  %81 = getelementptr inbounds %"class.Maths::TVector3", ptr %79, i64 1
  %82 = icmp eq ptr %81, %77
  br i1 %82, label %83, label %78

83:                                               ; preds = %80, %49
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %84, i32 0, i32 3
  store ptr %74, ptr %85, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  store i32 0, ptr %8, align 4, !tbaa !16
  br label %86

86:                                               ; preds = %115, %83
  %87 = load i32, ptr %8, align 4, !tbaa !16
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %88, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !12
  %91 = icmp slt i32 %87, %90
  br i1 %91, label %101, label %92

92:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %118

93:                                               ; preds = %47
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %6, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %7, align 4
  call void @_ZdlPvm(ptr noundef %48, i64 noundef 40) #11
  br label %120

97:                                               ; preds = %78
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %6, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %7, align 4
  call void @_ZdaPvm(ptr noundef %74, i64 noundef %73) #11
  br label %120

101:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 12, ptr %9) #10
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !23
  %105 = load i32, ptr %8, align 4, !tbaa !16
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds %"class.Maths::TAABB3", ptr %104, i64 %106
  call void @_ZNK5Maths6TAABB3IfE9GetCenterEv(ptr dead_on_unwind writable sret(%"class.Maths::TVector3") align 4 %9, ptr noundef nonnull align 4 dereferenceable(24) %107)
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %"struct.Riemann::AABBTreeBuildData", ptr %108, i32 0, i32 3
  %110 = load ptr, ptr %109, align 8, !tbaa !22
  %111 = load i32, ptr %8, align 4, !tbaa !16
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds %"class.Maths::TVector3", ptr %110, i64 %112
  %114 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %113, ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.lifetime.end.p0(i64 12, ptr %9) #10
  br label %115

115:                                              ; preds = %101
  %116 = load i32, ptr %8, align 4, !tbaa !16
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %8, align 4, !tbaa !16
  br label %86, !llvm.loop !24

118:                                              ; preds = %92
  br label %119

119:                                              ; preds = %118, %14
  ret void

120:                                              ; preds = %97, %93
  %121 = load ptr, ptr %6, align 8
  %122 = load i32, ptr %7, align 4
  %123 = insertvalue { ptr, i32 } poison, ptr %121, 0
  %124 = insertvalue { ptr, i32 } %123, i32 %122, 1
  resume { ptr, i32 } %124
}

; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann15AABBTreeOfflineC2Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #6 align 2

declare void @_ZN7Riemann15AABBTreeOffline4InitEii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) #7

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

; 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)) #8 align 2

attributes #0 = { 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 #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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { 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 #7 = { "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 = { 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 #9 = { builtin allocsize(0) }
attributes #10 = { nounwind }
attributes #11 = { builtin 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, !6, i64 0}
!10 = !{!"_ZTSN7Riemann8AABBTreeE", !6, i64 0, !11, i64 8, !6, i64 16}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 4}
!13 = !{!"_ZTSN7Riemann17AABBTreeBuildDataE", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40}
!14 = !{!"_ZTSN7Riemann14SplitHeuristicE", !7, i64 0}
!15 = !{!10, !11, i64 8}
!16 = !{!11, !11, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!13, !6, i64 32}
!20 = !{!13, !11, i64 0}
!21 = !{!13, !6, i64 24}
!22 = !{!13, !6, i64 16}
!23 = !{!13, !6, i64 8}
!24 = distinct !{!24, !18}


; 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 }
%"class.Maths::TAABB3" = type { %"class.Maths::TVector3", %"class.Maths::TVector3" }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann8AABBTree17InitAABBTreeBuildERNS_17AABBTreeBuildDataE(ptr nocapture noundef nonnull align 8 dereferenceable(24) %0, ptr nocapture noundef nonnull align 8 dereferenceable(41) %1) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.Maths::TVector3", align 4
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %.loopexit

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %7, ptr %8, align 8, !tbaa !14
  %9 = sext i32 %7 to i64
  %10 = icmp slt i32 %7, 0
  %11 = shl nsw i64 %9, 2
  %12 = select i1 %10, i64 -1, i64 %11
  %13 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %12) #8
  store ptr %13, ptr %0, align 8, !tbaa !5
  %14 = icmp sgt i32 %7, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %5
  %wide.trip.count = zext nneg i32 %7 to i64
  %min.iters.check = icmp ult i32 %7, 8
  br i1 %min.iters.check, label %.lr.ph.preheader33, label %vector.ph

.lr.ph.preheader33:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %15 = getelementptr inbounds i32, ptr %13, i64 %index
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> %vec.ind, ptr %15, align 4, !tbaa !15
  store <4 x i32> %step.add, ptr %16, align 4, !tbaa !15
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %17 = icmp eq i64 %index.next, %n.vec
  br i1 %17, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader33

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %5
  %18 = tail call noalias noundef nonnull dereferenceable(40) ptr @_Znwm(i64 noundef 40) #8
  tail call void @_ZN7Riemann15AABBTreeOfflineC2Ev(ptr noundef nonnull align 8 dereferenceable(40) %18)
  %19 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr %18, ptr %19, align 8, !tbaa !20
  %20 = load i32, ptr %6, align 4, !tbaa !11
  %21 = load i32, ptr %1, align 8, !tbaa !21
  tail call void @_ZN7Riemann15AABBTreeOffline4InitEii(ptr noundef nonnull align 8 dereferenceable(40) %18, i32 noundef %20, i32 noundef %21)
  %22 = load ptr, ptr %0, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %1, i64 24
  store ptr %22, ptr %23, align 8, !tbaa !22
  %24 = load i32, ptr %6, align 4, !tbaa !11
  %25 = add nsw i32 %24, 1
  %26 = sext i32 %25 to i64
  %27 = tail call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %26, i64 12)
  %28 = extractvalue { i64, i1 } %27, 1
  %29 = extractvalue { i64, i1 } %27, 0
  %30 = select i1 %28, i64 -1, i64 %29
  %31 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %30) #8
  %32 = icmp eq i32 %25, 0
  br i1 %32, label %.loopexit23.thread, label %36

.loopexit23.thread:                               ; preds = %._crit_edge
  %33 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %31, ptr %33, align 8, !tbaa !23
  br label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph.preheader33, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader33 ]
  %34 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %35, ptr %34, align 4, !tbaa !15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !24

36:                                               ; preds = %._crit_edge
  %37 = getelementptr inbounds %"class.Maths::TVector3", ptr %31, i64 %26
  br label %38

38:                                               ; preds = %38, %36
  %39 = phi ptr [ %31, %36 ], [ %40, %38 ]
  tail call void @_ZN5Maths8TVector3IfEC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %39)
  %40 = getelementptr inbounds i8, ptr %39, i64 12
  %41 = icmp eq ptr %40, %37
  br i1 %41, label %.loopexit23, label %38

.loopexit23:                                      ; preds = %38
  %.pre = load i32, ptr %6, align 4, !tbaa !11
  %42 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr %31, ptr %42, align 8, !tbaa !23
  %43 = icmp sgt i32 %.pre, 0
  br i1 %43, label %.lr.ph27, label %.loopexit

.lr.ph27:                                         ; preds = %.loopexit23
  %44 = getelementptr inbounds i8, ptr %1, i64 8
  br label %45

45:                                               ; preds = %.lr.ph27, %45
  %indvars.iv29 = phi i64 [ 0, %.lr.ph27 ], [ %indvars.iv.next30, %45 ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #9
  %46 = load ptr, ptr %44, align 8, !tbaa !25
  %47 = getelementptr inbounds %"class.Maths::TAABB3", ptr %46, i64 %indvars.iv29
  call void @_ZNK5Maths6TAABB3IfE9GetCenterEv(ptr dead_on_unwind nonnull writable sret(%"class.Maths::TVector3") align 4 %3, ptr noundef nonnull align 4 dereferenceable(24) %47)
  %48 = load ptr, ptr %42, align 8, !tbaa !23
  %49 = getelementptr inbounds %"class.Maths::TVector3", ptr %48, i64 %indvars.iv29
  %50 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZN5Maths8TVector3IfEaSERKS1_(ptr noundef nonnull align 4 dereferenceable(12) %49, ptr noundef nonnull align 4 dereferenceable(12) %3)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #9
  %indvars.iv.next30 = add nuw nsw i64 %indvars.iv29, 1
  %51 = load i32, ptr %6, align 4, !tbaa !11
  %52 = sext i32 %51 to i64
  %53 = icmp slt i64 %indvars.iv.next30, %52
  br i1 %53, label %45, label %.loopexit, !llvm.loop !26

.loopexit:                                        ; preds = %45, %.loopexit23.thread, %.loopexit23, %2
  ret void
}

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

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

; 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 #2 align 2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #3

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

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

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

declare void @_ZN7Riemann15AABBTreeOffline4InitEii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef) local_unnamed_addr #6

; 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 #7 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 = { "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 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 = { builtin allocsize(0) }
attributes #9 = { 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, !7, i64 0}
!6 = !{!"_ZTSN7Riemann8AABBTreeE", !7, i64 0, !10, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN7Riemann17AABBTreeBuildDataE", !10, i64 0, !10, i64 4, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !13, i64 40}
!13 = !{!"_ZTSN7Riemann14SplitHeuristicE", !8, i64 0}
!14 = !{!6, !10, i64 8}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !17, !18, !19}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.isvectorized", i32 1}
!19 = !{!"llvm.loop.unroll.runtime.disable"}
!20 = !{!12, !7, i64 32}
!21 = !{!12, !10, i64 0}
!22 = !{!12, !7, i64 24}
!23 = !{!12, !7, i64 16}
!24 = distinct !{!24, !17, !19, !18}
!25 = !{!12, !7, i64 8}
!26 = distinct !{!26, !17}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass