; LLVM IR from gazebosim/gz-physics :: tpe/lib/src/aabb_tree/AABB.ll (ZN4aabb4Tree10removeLeafEj)

; 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.aabb::Tree" = type <{ i32, [4 x i8], %"class.std::vector.0", i32, i32, i32, i32, i8, [7 x i8], double, %"class.std::vector.5", %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::unordered_map", i8, [7 x i8] }>
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<aabb::Node, std::allocator<aabb::Node>>::_Vector_impl" }
%"struct.std::_Vector_base<aabb::Node, std::allocator<aabb::Node>>::_Vector_impl" = type { %"struct.std::_Vector_base<aabb::Node, std::allocator<aabb::Node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<aabb::Node, std::allocator<aabb::Node>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"struct.aabb::Node" = type { %"class.aabb::AABB", i32, i32, i32, i32, i32, i32 }
%"class.aabb::AABB" = type { %"class.std::vector", %"class.std::vector", %"class.std::vector", double }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4aabb4AABB5mergeERKS0_S2_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4aabb4Tree8freeNodeEj(ptr noundef nonnull align 8 dereferenceable(233), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4aabb4Tree10removeLeafEj(ptr noundef nonnull align 8 dereferenceable(233) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %11 = load ptr, ptr %3, align 8
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 0
  %14 = load i32, ptr %13, align 8, !tbaa !11
  %15 = icmp eq i32 %12, %14
  br i1 %15, label %16, label %18

16:                                               ; preds = %2
  %17 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 0
  store i32 -1, ptr %17, align 8, !tbaa !11
  br label %156

18:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %19 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = zext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %21) #4
  %23 = getelementptr inbounds %"struct.aabb::Node", ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !35
  store i32 %24, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %25 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %26 = load i32, ptr %5, align 4, !tbaa !9
  %27 = zext i32 %26 to i64
  %28 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %27) #4
  %29 = getelementptr inbounds %"struct.aabb::Node", ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 8, !tbaa !35
  store i32 %30, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %31 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %32 = load i32, ptr %5, align 4, !tbaa !9
  %33 = zext i32 %32 to i64
  %34 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %33) #4
  %35 = getelementptr inbounds %"struct.aabb::Node", ptr %34, i32 0, i32 3
  %36 = load i32, ptr %35, align 8, !tbaa !38
  %37 = load i32, ptr %4, align 4, !tbaa !9
  %38 = icmp eq i32 %36, %37
  br i1 %38, label %39, label %46

39:                                               ; preds = %18
  %40 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %42) #4
  %44 = getelementptr inbounds %"struct.aabb::Node", ptr %43, i32 0, i32 4
  %45 = load i32, ptr %44, align 4, !tbaa !39
  store i32 %45, ptr %7, align 4, !tbaa !9
  br label %53

46:                                               ; preds = %18
  %47 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = zext i32 %48 to i64
  %50 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49) #4
  %51 = getelementptr inbounds %"struct.aabb::Node", ptr %50, i32 0, i32 3
  %52 = load i32, ptr %51, align 8, !tbaa !38
  store i32 %52, ptr %7, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %46, %39
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = icmp ne i32 %54, -1
  br i1 %55, label %56, label %146

56:                                               ; preds = %53
  %57 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %58 = load i32, ptr %6, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %57, i64 noundef %59) #4
  %61 = getelementptr inbounds %"struct.aabb::Node", ptr %60, i32 0, i32 3
  %62 = load i32, ptr %61, align 8, !tbaa !38
  %63 = load i32, ptr %5, align 4, !tbaa !9
  %64 = icmp eq i32 %62, %63
  br i1 %64, label %65, label %72

65:                                               ; preds = %56
  %66 = load i32, ptr %7, align 4, !tbaa !9
  %67 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %68 = load i32, ptr %6, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %67, i64 noundef %69) #4
  %71 = getelementptr inbounds %"struct.aabb::Node", ptr %70, i32 0, i32 3
  store i32 %66, ptr %71, align 8, !tbaa !38
  br label %79

72:                                               ; preds = %56
  %73 = load i32, ptr %7, align 4, !tbaa !9
  %74 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %74, i64 noundef %76) #4
  %78 = getelementptr inbounds %"struct.aabb::Node", ptr %77, i32 0, i32 4
  store i32 %73, ptr %78, align 4, !tbaa !39
  br label %79

79:                                               ; preds = %72, %65
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %82 = load i32, ptr %7, align 4, !tbaa !9
  %83 = zext i32 %82 to i64
  %84 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %81, i64 noundef %83) #4
  %85 = getelementptr inbounds %"struct.aabb::Node", ptr %84, i32 0, i32 1
  store i32 %80, ptr %85, align 8, !tbaa !35
  %86 = load i32, ptr %5, align 4, !tbaa !9
  call void @_ZN4aabb4Tree8freeNodeEj(ptr noundef nonnull align 8 dereferenceable(233) %11, i32 noundef %86)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %87 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %87, ptr %8, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %91, %79
  %89 = load i32, ptr %8, align 4, !tbaa !9
  %90 = icmp ne i32 %89, -1
  br i1 %90, label %91, label %145

91:                                               ; preds = %88
  %92 = load i32, ptr %8, align 4, !tbaa !9
  %93 = call noundef i32 @_ZN4aabb4Tree7balanceEj(ptr noundef nonnull align 8 dereferenceable(233) %11, i32 noundef %92)
  store i32 %93, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %94 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %95 = load i32, ptr %8, align 4, !tbaa !9
  %96 = zext i32 %95 to i64
  %97 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %94, i64 noundef %96) #4
  %98 = getelementptr inbounds %"struct.aabb::Node", ptr %97, i32 0, i32 3
  %99 = load i32, ptr %98, align 8, !tbaa !38
  store i32 %99, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %100 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = zext i32 %101 to i64
  %103 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %100, i64 noundef %102) #4
  %104 = getelementptr inbounds %"struct.aabb::Node", ptr %103, i32 0, i32 4
  %105 = load i32, ptr %104, align 4, !tbaa !39
  store i32 %105, ptr %10, align 4, !tbaa !9
  %106 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %107 = load i32, ptr %8, align 4, !tbaa !9
  %108 = zext i32 %107 to i64
  %109 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %106, i64 noundef %108) #4
  %110 = getelementptr inbounds %"struct.aabb::Node", ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %112 = load i32, ptr %9, align 4, !tbaa !9
  %113 = zext i32 %112 to i64
  %114 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %111, i64 noundef %113) #4
  %115 = getelementptr inbounds %"struct.aabb::Node", ptr %114, i32 0, i32 0
  %116 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = zext i32 %117 to i64
  %119 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %116, i64 noundef %118) #4
  %120 = getelementptr inbounds %"struct.aabb::Node", ptr %119, i32 0, i32 0
  call void @_ZN4aabb4AABB5mergeERKS0_S2_(ptr noundef nonnull align 8 dereferenceable(80) %110, ptr noundef nonnull align 8 dereferenceable(80) %115, ptr noundef nonnull align 8 dereferenceable(80) %120)
  %121 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = zext i32 %122 to i64
  %124 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %121, i64 noundef %123) #4
  %125 = getelementptr inbounds %"struct.aabb::Node", ptr %124, i32 0, i32 5
  %126 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %127 = load i32, ptr %10, align 4, !tbaa !9
  %128 = zext i32 %127 to i64
  %129 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %126, i64 noundef %128) #4
  %130 = getelementptr inbounds %"struct.aabb::Node", ptr %129, i32 0, i32 5
  %131 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %125, ptr noundef nonnull align 4 dereferenceable(4) %130)
  %132 = load i32, ptr %131, align 4, !tbaa !9
  %133 = add nsw i32 1, %132
  %134 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %135 = load i32, ptr %8, align 4, !tbaa !9
  %136 = zext i32 %135 to i64
  %137 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %134, i64 noundef %136) #4
  %138 = getelementptr inbounds %"struct.aabb::Node", ptr %137, i32 0, i32 5
  store i32 %133, ptr %138, align 8, !tbaa !40
  %139 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %140 = load i32, ptr %8, align 4, !tbaa !9
  %141 = zext i32 %140 to i64
  %142 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %139, i64 noundef %141) #4
  %143 = getelementptr inbounds %"struct.aabb::Node", ptr %142, i32 0, i32 1
  %144 = load i32, ptr %143, align 8, !tbaa !35
  store i32 %144, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %88, !llvm.loop !41

145:                                              ; preds = %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %155

146:                                              ; preds = %53
  %147 = load i32, ptr %7, align 4, !tbaa !9
  %148 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 0
  store i32 %147, ptr %148, align 8, !tbaa !11
  %149 = getelementptr inbounds %"class.aabb::Tree", ptr %11, i32 0, i32 2
  %150 = load i32, ptr %7, align 4, !tbaa !9
  %151 = zext i32 %150 to i64
  %152 = call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %149, i64 noundef %151) #4
  %153 = getelementptr inbounds %"struct.aabb::Node", ptr %152, i32 0, i32 1
  store i32 -1, ptr %153, align 8, !tbaa !35
  %154 = load i32, ptr %5, align 4, !tbaa !9
  call void @_ZN4aabb4Tree8freeNodeEj(ptr noundef nonnull align 8 dereferenceable(233) %11, i32 noundef %154)
  br label %155

155:                                              ; preds = %146, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %156

156:                                              ; preds = %155, %16
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4aabb4Tree7balanceEj(ptr noundef nonnull align 8 dereferenceable(233), i32 noundef) #1 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)) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSN4aabb4TreeE", !10, i64 0, !13, i64 8, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !17, i64 48, !18, i64 56, !19, i64 64, !25, i64 104, !25, i64 128, !25, i64 152, !29, i64 176, !17, i64 232}
!13 = !{!"_ZTSSt6vectorIN4aabb4NodeESaIS1_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIN4aabb4NodeESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIN4aabb4NodeESaIS1_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN4aabb4NodeESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!"_ZTSSt6vectorIbSaIbEE", !20, i64 0}
!20 = !{!"_ZTSSt13_Bvector_baseISaIbEE", !21, i64 0}
!21 = !{!"_ZTSNSt13_Bvector_baseISaIbEE13_Bvector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt13_Bvector_baseISaIbEE18_Bvector_impl_dataE", !23, i64 0, !23, i64 16, !6, i64 32}
!23 = !{!"_ZTSSt13_Bit_iterator", !24, i64 0}
!24 = !{!"_ZTSSt18_Bit_iterator_base", !6, i64 0, !10, i64 8}
!25 = !{!"_ZTSSt6vectorIdSaIdEE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"_ZTSSt13unordered_mapIjjSt4hashIjESt8equal_toIjESaISt4pairIKjjEEE", !30, i64 0}
!30 = !{!"_ZTSSt10_HashtableIjSt4pairIKjjESaIS2_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb0ELb1EEEE", !6, i64 0, !31, i64 8, !32, i64 16, !31, i64 24, !33, i64 32, !6, i64 48}
!31 = !{!"long", !7, i64 0}
!32 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!33 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !34, i64 0, !31, i64 8}
!34 = !{!"float", !7, i64 0}
!35 = !{!36, !10, i64 80}
!36 = !{!"_ZTSN4aabb4NodeE", !37, i64 0, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100}
!37 = !{!"_ZTSN4aabb4AABBE", !25, i64 0, !25, i64 24, !25, i64 48, !18, i64 72}
!38 = !{!36, !10, i64 88}
!39 = !{!36, !10, i64 92}
!40 = !{!36, !10, i64 96}
!41 = distinct !{!41, !42}
!42 = !{!"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"

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4aabb4AABB5mergeERKS0_S2_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4aabb4Tree10removeLeafEj(ptr noundef nonnull align 8 dereferenceable(233) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = icmp eq i32 %3, %1
  br i1 %4, label %5, label %6

5:                                                ; preds = %2
  store i32 -1, ptr %0, align 8, !tbaa !5
  br label %.loopexit

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = zext i32 %1 to i64
  %9 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %8) #3
  %10 = getelementptr inbounds i8, ptr %9, i64 80
  %11 = load i32, ptr %10, align 8, !tbaa !33
  %12 = zext i32 %11 to i64
  %13 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %12) #3
  %14 = getelementptr inbounds i8, ptr %13, i64 80
  %15 = load i32, ptr %14, align 8, !tbaa !33
  %16 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %12) #3
  %17 = getelementptr inbounds i8, ptr %16, i64 88
  %18 = load i32, ptr %17, align 8, !tbaa !36
  %19 = icmp eq i32 %18, %1
  %20 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %12) #3
  %. = select i1 %19, i64 92, i64 88
  %21 = getelementptr inbounds i8, ptr %20, i64 %.
  %.0 = load i32, ptr %21, align 4, !tbaa !37
  %.not = icmp eq i32 %15, -1
  br i1 %.not, label %61, label %22

22:                                               ; preds = %6
  %23 = zext i32 %15 to i64
  %24 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %23) #3
  %25 = getelementptr inbounds i8, ptr %24, i64 88
  %26 = load i32, ptr %25, align 8, !tbaa !36
  %27 = icmp eq i32 %26, %11
  %28 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %23) #3
  br i1 %27, label %29, label %31

29:                                               ; preds = %22
  %30 = getelementptr inbounds i8, ptr %28, i64 88
  store i32 %.0, ptr %30, align 8, !tbaa !36
  br label %.lr.ph.preheader

31:                                               ; preds = %22
  %32 = getelementptr inbounds i8, ptr %28, i64 92
  store i32 %.0, ptr %32, align 4, !tbaa !38
  br label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %29, %31
  %33 = zext i32 %.0 to i64
  %34 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %33) #3
  %35 = getelementptr inbounds i8, ptr %34, i64 80
  store i32 %15, ptr %35, align 8, !tbaa !33
  tail call void @_ZN4aabb4Tree8freeNodeEj(ptr noundef nonnull align 8 dereferenceable(233) %0, i32 noundef %11)
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.03237 = phi i32 [ %60, %.lr.ph ], [ %15, %.lr.ph.preheader ]
  %36 = tail call noundef i32 @_ZN4aabb4Tree7balanceEj(ptr noundef nonnull align 8 dereferenceable(233) %0, i32 noundef %.03237)
  %37 = zext i32 %36 to i64
  %38 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %37) #3
  %39 = getelementptr inbounds i8, ptr %38, i64 88
  %40 = load i32, ptr %39, align 8, !tbaa !36
  %41 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %37) #3
  %42 = getelementptr inbounds i8, ptr %41, i64 92
  %43 = load i32, ptr %42, align 4, !tbaa !38
  %44 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %37) #3
  %45 = zext i32 %40 to i64
  %46 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %45) #3
  %47 = zext i32 %43 to i64
  %48 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %47) #3
  tail call void @_ZN4aabb4AABB5mergeERKS0_S2_(ptr noundef nonnull align 8 dereferenceable(80) %44, ptr noundef nonnull align 8 dereferenceable(80) %46, ptr noundef nonnull align 8 dereferenceable(80) %48)
  %49 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %45) #3
  %50 = getelementptr inbounds i8, ptr %49, i64 96
  %51 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %47) #3
  %52 = getelementptr inbounds i8, ptr %51, i64 96
  %53 = tail 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) %52)
  %54 = load i32, ptr %53, align 4, !tbaa !37
  %55 = add nsw i32 %54, 1
  %56 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %37) #3
  %57 = getelementptr inbounds i8, ptr %56, i64 96
  store i32 %55, ptr %57, align 8, !tbaa !39
  %58 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %37) #3
  %59 = getelementptr inbounds i8, ptr %58, i64 80
  %60 = load i32, ptr %59, align 8, !tbaa !33
  %.not35 = icmp eq i32 %60, -1
  br i1 %.not35, label %.loopexit, label %.lr.ph, !llvm.loop !40

61:                                               ; preds = %6
  store i32 %.0, ptr %0, align 8, !tbaa !5
  %62 = zext i32 %.0 to i64
  %63 = tail call noundef nonnull align 8 dereferenceable(104) ptr @_ZNSt6vectorIN4aabb4NodeESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %62) #3
  %64 = getelementptr inbounds i8, ptr %63, i64 80
  store i32 -1, ptr %64, align 8, !tbaa !33
  tail call void @_ZN4aabb4Tree8freeNodeEj(ptr noundef nonnull align 8 dereferenceable(233) %0, i32 noundef %11)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %61, %5
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN4aabb4Tree7balanceEj(ptr noundef nonnull align 8 dereferenceable(233), i32 noundef) local_unnamed_addr #0 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 #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 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 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 = { 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 = !{!"_ZTSN4aabb4TreeE", !7, i64 0, !10, i64 8, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !15, i64 48, !16, i64 56, !17, i64 64, !23, i64 104, !23, i64 128, !23, i64 152, !27, i64 176, !15, i64 232}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIN4aabb4NodeESaIS1_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseIN4aabb4NodeESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIN4aabb4NodeESaIS1_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN4aabb4NodeESaIS1_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"bool", !8, i64 0}
!16 = !{!"double", !8, i64 0}
!17 = !{!"_ZTSSt6vectorIbSaIbEE", !18, i64 0}
!18 = !{!"_ZTSSt13_Bvector_baseISaIbEE", !19, i64 0}
!19 = !{!"_ZTSNSt13_Bvector_baseISaIbEE13_Bvector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt13_Bvector_baseISaIbEE18_Bvector_impl_dataE", !21, i64 0, !21, i64 16, !14, i64 32}
!21 = !{!"_ZTSSt13_Bit_iterator", !22, i64 0}
!22 = !{!"_ZTSSt18_Bit_iterator_base", !14, i64 0, !7, i64 8}
!23 = !{!"_ZTSSt6vectorIdSaIdEE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!27 = !{!"_ZTSSt13unordered_mapIjjSt4hashIjESt8equal_toIjESaISt4pairIKjjEEE", !28, i64 0}
!28 = !{!"_ZTSSt10_HashtableIjSt4pairIKjjESaIS2_ENSt8__detail10_Select1stESt8equal_toIjESt4hashIjENS4_18_Mod_range_hashingENS4_20_Default_ranged_hashENS4_20_Prime_rehash_policyENS4_17_Hashtable_traitsILb0ELb0ELb1EEEE", !14, i64 0, !29, i64 8, !30, i64 16, !29, i64 24, !31, i64 32, !14, i64 48}
!29 = !{!"long", !8, i64 0}
!30 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !14, i64 0}
!31 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !32, i64 0, !29, i64 8}
!32 = !{!"float", !8, i64 0}
!33 = !{!34, !7, i64 80}
!34 = !{!"_ZTSN4aabb4NodeE", !35, i64 0, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100}
!35 = !{!"_ZTSN4aabb4AABBE", !23, i64 0, !23, i64 24, !23, i64 48, !16, i64 72}
!36 = !{!34, !7, i64 88}
!37 = !{!7, !7, i64 0}
!38 = !{!34, !7, i64 92}
!39 = !{!34, !7, i64 96}
!40 = distinct !{!40, !41}
!41 = !{!"llvm.loop.mustprogress"}


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