; LLVM IR from jrouwe/JoltPhysics :: Jolt/AABBTree (AABBTreeBuilder)

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

%"struct.JPH::AssertLastParam" = type { i8 }
%"class.JPH::AABBTreeBuilder::Node" = type { %"class.JPH::AABox", i32, i32, [2 x i32] }
%"class.JPH::AABox" = type { %"class.JPH::Vec3", %"class.JPH::Vec3" }
%"class.JPH::Vec3" = type { %union.anon }
%union.anon = type { <4 x float> }

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH15AABBTreeBuilder4Node11HasChildrenEv(ptr noundef nonnull align 16 dereferenceable(48)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH15AABBTreeBuilder4Node12GetNChildrenERKNS_5ArrayIS1_NS_12STLAllocatorIS1_EEEEjRNS2_IPKS1_NS3_IS9_EEEE(ptr noundef nonnull align 16 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #3 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.JPH::AssertLastParam", align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8
  br label %19

19:                                               ; preds = %4
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = call noundef zeroext i1 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  br i1 %21, label %25, label %22

22:                                               ; preds = %19
  %23 = call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 78)
  br i1 %23, label %24, label %25

24:                                               ; preds = %22
  call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #4, !srcloc !11
  br label %25

25:                                               ; preds = %24, %22, %19
  br label %26

26:                                               ; preds = %25
  %27 = call noundef zeroext i1 @_ZNK3JPH15AABBTreeBuilder4Node11HasChildrenEv(ptr noundef nonnull align 16 dereferenceable(48) %18)
  br i1 %27, label %29, label %28

28:                                               ; preds = %26
  br label %97

29:                                               ; preds = %26
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %18, i32 0, i32 3
  %33 = getelementptr inbounds [2 x i32], ptr %32, i64 0, i64 0
  %34 = load i32, ptr %33, align 8, !tbaa !9
  %35 = zext i32 %34 to i64
  %36 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %35)
  store ptr %36, ptr %10, align 8, !tbaa !5
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 8 dereferenceable(8) %10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %18, i32 0, i32 3
  %40 = getelementptr inbounds [2 x i32], ptr %39, i64 0, i64 1
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %38, i64 noundef %42)
  store ptr %43, ptr %11, align 8, !tbaa !5
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(8) %11)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i64 0, ptr %12, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  store i8 1, ptr %13, align 1, !tbaa !14
  br label %44

44:                                               ; preds = %93, %29
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = call noundef i64 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %45)
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = zext i32 %47 to i64
  %49 = icmp ult i64 %46, %48
  br i1 %49, label %50, label %94

50:                                               ; preds = %44
  %51 = load i64, ptr %12, align 8, !tbaa !12
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = call noundef i64 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %52)
  %54 = icmp uge i64 %51, %53
  br i1 %54, label %55, label %60

55:                                               ; preds = %50
  %56 = load i8, ptr %13, align 1, !tbaa !14, !range !16, !noundef !17
  %57 = trunc i8 %56 to i1
  br i1 %57, label %58, label %59

58:                                               ; preds = %55
  store i32 1, ptr %14, align 4
  br label %95

59:                                               ; preds = %55
  store i64 0, ptr %12, align 8, !tbaa !12
  store i8 1, ptr %13, align 1, !tbaa !14
  br label %60

60:                                               ; preds = %59, %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load i64, ptr %12, align 8, !tbaa !12
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %61, i64 noundef %62)
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  store ptr %64, ptr %15, align 8, !tbaa !5
  %65 = load ptr, ptr %15, align 8, !tbaa !5
  %66 = call noundef zeroext i1 @_ZNK3JPH15AABBTreeBuilder4Node11HasChildrenEv(ptr noundef nonnull align 16 dereferenceable(48) %65)
  br i1 %66, label %67, label %90

67:                                               ; preds = %60
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = call noundef ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %69)
  %71 = load i64, ptr %12, align 8, !tbaa !12
  %72 = getelementptr inbounds ptr, ptr %70, i64 %71
  %73 = call noundef ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5eraseEPKS4_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef %72)
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = load ptr, ptr %15, align 8, !tbaa !5
  %77 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %76, i32 0, i32 3
  %78 = getelementptr inbounds [2 x i32], ptr %77, i64 0, i64 0
  %79 = load i32, ptr %78, align 8, !tbaa !9
  %80 = zext i32 %79 to i64
  %81 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %75, i64 noundef %80)
  store ptr %81, ptr %16, align 8, !tbaa !5
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %74, ptr noundef nonnull align 8 dereferenceable(8) %16)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = load ptr, ptr %15, align 8, !tbaa !5
  %85 = getelementptr inbounds %"class.JPH::AABBTreeBuilder::Node", ptr %84, i32 0, i32 3
  %86 = getelementptr inbounds [2 x i32], ptr %85, i64 0, i64 1
  %87 = load i32, ptr %86, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %83, i64 noundef %88)
  store ptr %89, ptr %17, align 8, !tbaa !5
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 8 dereferenceable(8) %17)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  store i8 0, ptr %13, align 1, !tbaa !14
  br label %93

90:                                               ; preds = %60
  %91 = load i64, ptr %12, align 8, !tbaa !12
  %92 = add i64 %91, 1
  store i64 %92, ptr %12, align 8, !tbaa !12
  br label %93

93:                                               ; preds = %90, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %44, !llvm.loop !18

94:                                               ; preds = %44
  store i32 0, ptr %14, align 4
  br label %95

95:                                               ; preds = %94, %58
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %96 = load i32, ptr %14, align 4
  switch i32 %96, label %98 [
    i32 0, label %97
    i32 1, label %97
  ]

97:                                               ; preds = %95, %95, %28
  ret void

98:                                               ; preds = %95
  unreachable
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) #2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{i64 2156962849}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"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"

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH15AABBTreeBuilder4Node11HasChildrenEv(ptr noundef nonnull align 16 dereferenceable(48)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3JPH15AABBTreeBuilder4Node12GetNChildrenERKNS_5ArrayIS1_NS_12STLAllocatorIS1_EEEEjRNS2_IPKS1_NS3_IS9_EEEE(ptr noundef nonnull align 16 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %2, ptr noundef nonnull align 8 dereferenceable(24) %3) local_unnamed_addr #3 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = tail call noundef zeroext i1 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  br i1 %9, label %13, label %10

10:                                               ; preds = %4
  %11 = tail call noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 78)
  br i1 %11, label %12, label %13

12:                                               ; preds = %10
  tail call void asm sideeffect "int $$0x3", "~{dirflag},~{fpsr},~{flags}"() #4, !srcloc !5
  br label %13

13:                                               ; preds = %4, %10, %12
  %14 = tail call noundef zeroext i1 @_ZNK3JPH15AABBTreeBuilder4Node11HasChildrenEv(ptr noundef nonnull align 16 dereferenceable(48) %0)
  br i1 %14, label %15, label %.loopexit

15:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  %17 = load i32, ptr %16, align 8, !tbaa !6
  %18 = zext i32 %17 to i64
  %19 = tail call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %18)
  store ptr %19, ptr %5, align 8, !tbaa !10
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %20 = getelementptr inbounds i8, ptr %0, i64 44
  %21 = load i32, ptr %20, align 4, !tbaa !6
  %22 = zext i32 %21 to i64
  %23 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %22)
  store ptr %23, ptr %6, align 8, !tbaa !10
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  %24 = call noundef i64 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %25 = zext i32 %2 to i64
  %26 = icmp ult i64 %24, %25
  br i1 %26, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %15, %46
  %.027 = phi i64 [ %.2, %46 ], [ 0, %15 ]
  %.02326 = phi i1 [ %.225, %46 ], [ true, %15 ]
  %27 = call noundef i64 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %.not = icmp uge i64 %.027, %27
  %brmerge.not = select i1 %.not, i1 %.02326, i1 false
  %.023.mux = select i1 %.not, i1 true, i1 %.02326
  %.0.mux = select i1 %.not, i64 0, i64 %.027
  br i1 %brmerge.not, label %.loopexit, label %28

28:                                               ; preds = %.lr.ph
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %.0.mux)
  %30 = load ptr, ptr %29, align 8, !tbaa !10
  %31 = call noundef zeroext i1 @_ZNK3JPH15AABBTreeBuilder4Node11HasChildrenEv(ptr noundef nonnull align 16 dereferenceable(48) %30)
  br i1 %31, label %32, label %44

32:                                               ; preds = %28
  %33 = call noundef ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %34 = getelementptr inbounds ptr, ptr %33, i64 %.0.mux
  %35 = call noundef ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5eraseEPKS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef %34)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %36 = getelementptr inbounds i8, ptr %30, i64 40
  %37 = load i32, ptr %36, align 8, !tbaa !6
  %38 = zext i32 %37 to i64
  %39 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %38)
  store ptr %39, ptr %7, align 8, !tbaa !10
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %40 = getelementptr inbounds i8, ptr %30, i64 44
  %41 = load i32, ptr %40, align 4, !tbaa !6
  %42 = zext i32 %41 to i64
  %43 = call noundef nonnull align 16 dereferenceable(48) ptr @_ZNK3JPH5ArrayINS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS2_EEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %42)
  store ptr %43, ptr %8, align 8, !tbaa !10
  call void @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE9push_backEOS4_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %46

44:                                               ; preds = %28
  %45 = add nuw i64 %.0.mux, 1
  br label %46

46:                                               ; preds = %44, %32
  %.225 = phi i1 [ false, %32 ], [ %.023.mux, %44 ]
  %.2 = phi i64 [ %.0.mux, %32 ], [ %45, %44 ]
  %47 = call noundef i64 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %48 = icmp ult i64 %47, %25
  br i1 %48, label %.lr.ph, label %.loopexit, !llvm.loop !12

.loopexit:                                        ; preds = %46, %.lr.ph, %15, %13
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3JPH23AssertFailedParamHelperEPKcS1_jNS_15AssertLastParamE(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3JPH5ArrayIPKNS_15AABBTreeBuilder4NodeENS_12STLAllocatorIS4_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #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 = !{i64 2156962849}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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