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

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

@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE = external hidden unnamed_addr constant [52 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(20) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.Riemann::StaticStack", align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.Riemann::StaticStack", align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %14, i8 0, i64 20, i1 false)
  call void @llvm.lifetime.start.p0(i64 132, ptr %5) #6
  call void @_ZN7Riemann11StaticStackIjLi32EEC2Ev(ptr noundef nonnull align 4 dereferenceable(132) %5)
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %5, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 132, ptr %7) #6
  call void @_ZN7Riemann11StaticStackIjLi32EEC2Ev(ptr noundef nonnull align 4 dereferenceable(132) %7)
  %15 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %7, i32 noundef %15)
  br label %16

16:                                               ; preds = %96, %2
  %17 = call noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE5emptyEv(ptr noundef nonnull align 4 dereferenceable(132) %5)
  %18 = xor i1 %17, true
  br i1 %18, label %19, label %97

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %20 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %13, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = call noundef i32 @_ZN7Riemann11StaticStackIjLi32EE3popEv(ptr noundef nonnull align 4 dereferenceable(132) %5)
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds %"struct.Riemann::CacheFriendlyAABBTree", ptr %21, i64 %23
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = call noundef i32 @_ZN7Riemann11StaticStackIjLi32EE3popEv(ptr noundef nonnull align 4 dereferenceable(132) %7)
  store i32 %25, ptr %6, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %91, %19
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %96

29:                                               ; preds = %26
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %30, i32 0, i32 3
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %31, align 4, !tbaa !13
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = call noundef zeroext i1 @_ZNK7Riemann21CacheFriendlyAABBTree6IsLeafEv(ptr noundef nonnull align 4 dereferenceable(28) %34)
  br i1 %35, label %36, label %62

36:                                               ; preds = %29
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %37, i32 0, i32 4
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %38, align 4, !tbaa !15
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %41, i32 0, i32 2
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = call noundef i32 @_ZNK7Riemann21CacheFriendlyAABBTree16GetNumGeometriesEv(ptr noundef nonnull align 4 dereferenceable(28) %43)
  store i32 %44, ptr %9, align 4, !tbaa !9
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %42, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %47, i32 0, i32 2
  store i32 %46, ptr %48, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %49, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %51 = call noundef i32 @_ZNK7Riemann11StaticStackIjLi32EE5depthEv(ptr noundef nonnull align 4 dereferenceable(132) %5)
  store i32 %51, ptr %10, align 4, !tbaa !9
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %50, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %54, i32 0, i32 0
  store i32 %53, ptr %55, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %56, i32 0, i32 1
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %57, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %"struct.Riemann::TreeStatistics", ptr %60, i32 0, i32 1
  store i32 %59, ptr %61, align 4, !tbaa !18
  br label %96

62:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %13, i32 0, i32 2
  %65 = load ptr, ptr %64, align 8, !tbaa !11
  %66 = call noundef ptr @_ZN7Riemann21CacheFriendlyAABBTree11GetLeftNodeEPS0_(ptr noundef nonnull align 4 dereferenceable(28) %63, ptr noundef %65)
  store ptr %66, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %13, i32 0, i32 2
  %69 = load ptr, ptr %68, align 8, !tbaa !11
  %70 = call noundef ptr @_ZN7Riemann21CacheFriendlyAABBTree12GetRightNodeEPS0_(ptr noundef nonnull align 4 dereferenceable(28) %67, ptr noundef %69)
  store ptr %70, ptr %12, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %95

73:                                               ; preds = %62
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %95

76:                                               ; preds = %73
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %77, ptr %8, align 8, !tbaa !5
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %"class.Riemann::AABBTree", ptr %13, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !11
  %81 = ptrtoint ptr %78 to i64
  %82 = ptrtoint ptr %80 to i64
  %83 = sub i64 %81, %82
  %84 = sdiv exact i64 %83, 28
  %85 = trunc i64 %84 to i32
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %5, i32 noundef %85)
  %86 = call noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE4fullEv(ptr noundef nonnull align 4 dereferenceable(132) %5)
  %87 = xor i1 %86, true
  br i1 %87, label %88, label %89

88:                                               ; preds = %76
  br label %91

89:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 93, ptr noundef @__PRETTY_FUNCTION__._ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE) #7
  unreachable

90:                                               ; No predecessors!
  br label %91

91:                                               ; preds = %90, %88
  %92 = load i32, ptr %6, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %6, align 4, !tbaa !9
  %94 = load i32, ptr %6, align 4, !tbaa !9
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %7, i32 noundef %94)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %26

95:                                               ; preds = %73, %62
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 100, ptr noundef @__PRETTY_FUNCTION__._ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE) #7
  unreachable

96:                                               ; preds = %36, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %16, !llvm.loop !19

97:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 132, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 132, ptr %5) #6
  ret void
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132), i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE5emptyEv(ptr noundef nonnull align 4 dereferenceable(132)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7Riemann11StaticStackIjLi32EE3popEv(ptr noundef nonnull align 4 dereferenceable(132)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7Riemann21CacheFriendlyAABBTree6IsLeafEv(ptr noundef nonnull align 4 dereferenceable(28)) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann21CacheFriendlyAABBTree16GetNumGeometriesEv(ptr noundef nonnull align 4 dereferenceable(28)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann11StaticStackIjLi32EE5depthEv(ptr noundef nonnull align 4 dereferenceable(132)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Riemann21CacheFriendlyAABBTree11GetLeftNodeEPS0_(ptr noundef nonnull align 4 dereferenceable(28), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN7Riemann21CacheFriendlyAABBTree12GetRightNodeEPS0_(ptr noundef nonnull align 4 dereferenceable(28), ptr noundef) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE4fullEv(ptr noundef nonnull align 4 dereferenceable(132)) #4 align 2

attributes #0 = { noreturn 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #7 = { noreturn 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTSN7Riemann8AABBTreeE", !6, i64 0, !10, i64 8, !6, i64 16}
!13 = !{!14, !10, i64 12}
!14 = !{!"_ZTSN7Riemann14TreeStatisticsE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!15 = !{!14, !10, i64 16}
!16 = !{!14, !10, i64 8}
!17 = !{!14, !10, i64 0}
!18 = !{!14, !10, i64 4}
!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.Riemann::StaticStack" = type { i32, [32 x i32] }
%"struct.Riemann::CacheFriendlyAABBTree" = type { %"class.Maths::TAABB3", i32 }
%"class.Maths::TAABB3" = type { %"class.Maths::TVector3", %"class.Maths::TVector3" }
%"class.Maths::TVector3" = type { float, float, float }

@.str.1 = external hidden unnamed_addr constant [82 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE = external hidden unnamed_addr constant [52 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(20) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.Riemann::StaticStack", align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.Riemann::StaticStack", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %1, i8 0, i64 20, i1 false)
  call void @llvm.lifetime.start.p0(i64 132, ptr nonnull %3) #5
  call void @_ZN7Riemann11StaticStackIjLi32EEC2Ev(ptr noundef nonnull align 4 dereferenceable(132) %3)
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %3, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 132, ptr nonnull %5) #5
  call void @_ZN7Riemann11StaticStackIjLi32EEC2Ev(ptr noundef nonnull align 4 dereferenceable(132) %5)
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %5, i32 noundef 1)
  %8 = call noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE5emptyEv(ptr noundef nonnull align 4 dereferenceable(132) %3)
  br i1 %8, label %._crit_edge, label %.lr.ph27

.lr.ph27:                                         ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = getelementptr inbounds i8, ptr %1, i64 12
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  br label %14

14:                                               ; preds = %.lr.ph27, %.loopexit
  %15 = load ptr, ptr %9, align 8, !tbaa !9
  %16 = call noundef i32 @_ZN7Riemann11StaticStackIjLi32EE3popEv(ptr noundef nonnull align 4 dereferenceable(132) %3)
  %17 = call noundef i32 @_ZN7Riemann11StaticStackIjLi32EE3popEv(ptr noundef nonnull align 4 dereferenceable(132) %5)
  store i32 %17, ptr %4, align 4, !tbaa !5
  %.not25 = icmp eq ptr %15, null
  br i1 %.not25, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %14
  %18 = zext i32 %16 to i64
  %19 = getelementptr inbounds %"struct.Riemann::CacheFriendlyAABBTree", ptr %15, i64 %18
  %20 = load i32, ptr %10, align 4, !tbaa !12
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %10, align 4, !tbaa !12
  %22 = call noundef zeroext i1 @_ZNK7Riemann21CacheFriendlyAABBTree6IsLeafEv(ptr noundef nonnull align 4 dereferenceable(28) %19)
  br i1 %22, label %.lr.ph._crit_edge, label %.lr.ph35

.lr.ph._crit_edge:                                ; preds = %.lr.ph, %.lr.ph.preheader
  %.026.lcssa = phi ptr [ %19, %.lr.ph.preheader ], [ %34, %.lr.ph ]
  %23 = load i32, ptr %11, align 4, !tbaa !14
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %11, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %25 = call noundef i32 @_ZNK7Riemann21CacheFriendlyAABBTree16GetNumGeometriesEv(ptr noundef nonnull align 4 dereferenceable(28) %.026.lcssa)
  store i32 %25, ptr %6, align 4, !tbaa !5
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %27 = load i32, ptr %26, align 4, !tbaa !5
  store i32 %27, ptr %12, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %28 = call noundef i32 @_ZNK7Riemann11StaticStackIjLi32EE5depthEv(ptr noundef nonnull align 4 dereferenceable(132) %3)
  store i32 %28, ptr %7, align 4, !tbaa !5
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %30 = load i32, ptr %29, align 4, !tbaa !5
  store i32 %30, ptr %1, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  %31 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %32 = load i32, ptr %31, align 4, !tbaa !5
  store i32 %32, ptr %13, align 4, !tbaa !17
  br label %.loopexit

.lr.ph35:                                         ; preds = %.lr.ph.preheader, %.lr.ph
  %.02634 = phi ptr [ %34, %.lr.ph ], [ %19, %.lr.ph.preheader ]
  %33 = load ptr, ptr %9, align 8, !tbaa !9
  %34 = call noundef ptr @_ZN7Riemann21CacheFriendlyAABBTree11GetLeftNodeEPS0_(ptr noundef nonnull align 4 dereferenceable(28) %.02634, ptr noundef %33)
  %35 = load ptr, ptr %9, align 8, !tbaa !9
  %36 = call noundef ptr @_ZN7Riemann21CacheFriendlyAABBTree12GetRightNodeEPS0_(ptr noundef nonnull align 4 dereferenceable(28) %.02634, ptr noundef %35)
  %37 = icmp ne ptr %34, null
  %38 = icmp ne ptr %36, null
  %or.cond = and i1 %37, %38
  br i1 %or.cond, label %39, label %53

39:                                               ; preds = %.lr.ph35
  %40 = load ptr, ptr %9, align 8, !tbaa !9
  %41 = ptrtoint ptr %36 to i64
  %42 = ptrtoint ptr %40 to i64
  %43 = sub i64 %41, %42
  %44 = sdiv exact i64 %43, 28
  %45 = trunc i64 %44 to i32
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %3, i32 noundef %45)
  %46 = call noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE4fullEv(ptr noundef nonnull align 4 dereferenceable(132) %3)
  br i1 %46, label %47, label %.lr.ph

47:                                               ; preds = %39
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 93, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE) #6
  unreachable

.lr.ph:                                           ; preds = %39
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %4, align 4, !tbaa !5
  call void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132) %5, i32 noundef %49)
  %50 = load i32, ptr %10, align 4, !tbaa !12
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %10, align 4, !tbaa !12
  %52 = call noundef zeroext i1 @_ZNK7Riemann21CacheFriendlyAABBTree6IsLeafEv(ptr noundef nonnull align 4 dereferenceable(28) %34)
  br i1 %52, label %.lr.ph._crit_edge, label %.lr.ph35

53:                                               ; preds = %.lr.ph35
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 100, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN7Riemann8AABBTree9StatisticERNS_14TreeStatisticsE) #6
  unreachable

.loopexit:                                        ; preds = %14, %.lr.ph._crit_edge
  %54 = call noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE5emptyEv(ptr noundef nonnull align 4 dereferenceable(132) %3)
  br i1 %54, label %._crit_edge, label %14, !llvm.loop !18

._crit_edge:                                      ; preds = %.loopexit, %2
  call void @llvm.lifetime.end.p0(i64 132, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 132, ptr nonnull %3) #5
  ret void
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Riemann11StaticStackIjLi32EE4pushEj(ptr noundef nonnull align 4 dereferenceable(132), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE5emptyEv(ptr noundef nonnull align 4 dereferenceable(132)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN7Riemann11StaticStackIjLi32EE3popEv(ptr noundef nonnull align 4 dereferenceable(132)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7Riemann21CacheFriendlyAABBTree6IsLeafEv(ptr noundef nonnull align 4 dereferenceable(28)) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann21CacheFriendlyAABBTree16GetNumGeometriesEv(ptr noundef nonnull align 4 dereferenceable(28)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7Riemann11StaticStackIjLi32EE5depthEv(ptr noundef nonnull align 4 dereferenceable(132)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7Riemann11StaticStackIjLi32EE4fullEv(ptr noundef nonnull align 4 dereferenceable(132)) local_unnamed_addr #1 align 2

attributes #0 = { noreturn 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 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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"}
!9 = !{!10, !11, i64 16}
!10 = !{!"_ZTSN7Riemann8AABBTreeE", !11, i64 0, !6, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!13, !6, i64 12}
!13 = !{!"_ZTSN7Riemann14TreeStatisticsE", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!14 = !{!13, !6, i64 16}
!15 = !{!13, !6, i64 8}
!16 = !{!13, !6, i64 0}
!17 = !{!13, !6, i64 4}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass