; LLVM IR from yangfengzzz/Arche-webgpu :: vox.geometry (implicit_surface_set2)

; 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.vox::Point" = type { double, double }
%class.anon = type { i8 }
%"class.std::initializer_list" = type { ptr, i64 }
%"struct.vox::NearestNeighborQueryResult2" = type { ptr, double }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.__gnu_cxx::__normal_iterator.19" = type { ptr }
%"class.vox::ImplicitSurfaceSet2" = type <{ %"class.vox::ImplicitSurface2.base", [7 x i8], %"class.std::vector", %"class.std::vector", %"class.vox::Bvh2", i8, [7 x i8] }>
%"class.vox::ImplicitSurface2.base" = type { %"class.vox::Surface2.base" }
%"class.vox::Surface2.base" = type <{ ptr, %"class.vox::Transform2", i8 }>
%"class.vox::Transform2" = type { %"struct.vox::Vector", double, double, double }
%"struct.vox::Vector" = type { double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::shared_ptr<vox::ImplicitSurface2>, std::allocator<std::shared_ptr<vox::ImplicitSurface2>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::shared_ptr<vox::ImplicitSurface2>, std::allocator<std::shared_ptr<vox::ImplicitSurface2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::shared_ptr<vox::ImplicitSurface2>, std::allocator<std::shared_ptr<vox::ImplicitSurface2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::shared_ptr<vox::ImplicitSurface2>, std::allocator<std::shared_ptr<vox::ImplicitSurface2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.vox::Bvh2" = type { %"class.vox::IntersectionQueryEngine2", %"class.vox::NearestNeighborQueryEngine2", %"struct.vox::BoundingBox", %"class.std::vector", %"class.std::vector.0", %"class.std::vector.5" }
%"class.vox::IntersectionQueryEngine2" = type { ptr }
%"class.vox::NearestNeighborQueryEngine2" = type { ptr }
%"struct.vox::BoundingBox" = type { %"struct.vox::Point", %"struct.vox::Point" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<vox::BoundingBox<double, 2>, std::allocator<vox::BoundingBox<double, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::BoundingBox<double, 2>, std::allocator<vox::BoundingBox<double, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::BoundingBox<double, 2>, std::allocator<vox::BoundingBox<double, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::BoundingBox<double, 2>, std::allocator<vox::BoundingBox<double, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node, std::allocator<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node>>::_Vector_impl" }
%"struct.std::_Vector_base<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node, std::allocator<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node>>::_Vector_impl" = type { %"struct.std::_Vector_base<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node, std::allocator<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node, std::allocator<vox::Bvh2<std::shared_ptr<vox::ImplicitSurface2>>::Node>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3vox19ImplicitSurfaceSet28buildBvhEv(ptr noundef nonnull align 8 dereferenceable(232)) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox19ImplicitSurfaceSet217closestPointLocalERKNS_5PointIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"struct.vox::Point") align 8 %0, ptr noundef nonnull align 8 dereferenceable(232) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.anon, align 1
  %8 = alloca %"class.std::initializer_list", align 8
  %9 = alloca [2 x double], align 8
  %10 = alloca %"struct.vox::NearestNeighborQueryResult2", align 8
  %11 = alloca %"class.std::function", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.vox::Point", align 8
  %15 = alloca double, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %19 = alloca ptr, align 8
  %20 = alloca %"struct.vox::Point", align 8
  %21 = alloca double, align 8
  %22 = alloca %"struct.vox::Point", align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8
  call void @_ZNK3vox19ImplicitSurfaceSet28buildBvhEv(ptr noundef nonnull align 8 dereferenceable(232) %23)
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #6
  store double 0x7FEFFFFFFFFFFFFF, ptr %9, align 8, !tbaa !9
  %24 = getelementptr inbounds double, ptr %9, i64 1
  store double 0x7FEFFFFFFFFFFFFF, ptr %24, align 8, !tbaa !9
  %25 = getelementptr inbounds %"class.std::initializer_list", ptr %8, i32 0, i32 0
  store ptr %9, ptr %25, align 8, !tbaa !11
  %26 = getelementptr inbounds %"class.std::initializer_list", ptr %8, i32 0, i32 1
  store i64 2, ptr %26, align 8, !tbaa !14
  call void @_ZN3vox5PointIdLm2EEC2IdEERKSt16initializer_listIT_E(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %27 = getelementptr inbounds %"class.vox::ImplicitSurfaceSet2", ptr %23, i32 0, i32 4
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #6
  call void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_5PointIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet217closestPointLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %11, ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  %29 = invoke { ptr, double } @_ZNK3vox4Bvh2ISt10shared_ptrINS_16ImplicitSurface2EEE7nearestERKNS_5PointIdLm2EEERKSt8functionIFdRKS3_S8_EE(ptr noundef nonnull align 8 dereferenceable(120) %27, ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(32) %11)
          to label %30 unwind label %44

30:                                               ; preds = %3
  %31 = getelementptr inbounds { ptr, double }, ptr %10, i32 0, i32 0
  %32 = extractvalue { ptr, double } %29, 0
  store ptr %32, ptr %31, align 8
  %33 = getelementptr inbounds { ptr, double }, ptr %10, i32 0, i32 1
  %34 = extractvalue { ptr, double } %29, 1
  store double %34, ptr %33, align 8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  %35 = getelementptr inbounds %"struct.vox::NearestNeighborQueryResult2", ptr %10, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %48

38:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #6
  %39 = getelementptr inbounds %"struct.vox::NearestNeighborQueryResult2", ptr %10, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !15
  %41 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %40) #6
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::Point") align 8 %14, ptr noundef nonnull align 8 dereferenceable(49) %41, ptr noundef nonnull align 8 dereferenceable(16) %42)
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox5PointIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %14)
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #6
  br label %48

44:                                               ; preds = %3
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %12, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %13, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  br label %81

48:                                               ; preds = %38, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %49 = getelementptr inbounds %"struct.vox::NearestNeighborQueryResult2", ptr %10, i32 0, i32 1
  %50 = load double, ptr %49, align 8, !tbaa !17
  store double %50, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %51 = getelementptr inbounds %"class.vox::ImplicitSurfaceSet2", ptr %23, i32 0, i32 3
  store ptr %51, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %52 = load ptr, ptr %16, align 8, !tbaa !5
  %53 = call ptr @_ZNKSt6vectorISt10shared_ptrIN3vox16ImplicitSurface2EESaIS3_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %52) #6
  %54 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.19", ptr %17, i32 0, i32 0
  store ptr %53, ptr %54, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %55 = load ptr, ptr %16, align 8, !tbaa !5
  %56 = call ptr @_ZNKSt6vectorISt10shared_ptrIN3vox16ImplicitSurface2EESaIS3_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %55) #6
  %57 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.19", ptr %18, i32 0, i32 0
  store ptr %56, ptr %57, align 8
  br label %58

58:                                               ; preds = %78, %48
  %59 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(8) %18) #6
  br i1 %59, label %61, label %60

60:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %80

61:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %62 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  store ptr %62, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #6
  %63 = load ptr, ptr %19, align 8, !tbaa !5
  %64 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %63) #6
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::Point") align 8 %20, ptr noundef nonnull align 8 dereferenceable(49) %64, ptr noundef nonnull align 8 dereferenceable(16) %65)
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = call noundef double @_ZNK3vox5PointIdLm2EE10distanceToERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %66)
  store double %67, ptr %21, align 8, !tbaa !9
  %68 = load double, ptr %21, align 8, !tbaa !9
  %69 = load double, ptr %15, align 8, !tbaa !9
  %70 = fcmp olt double %68, %69
  br i1 %70, label %71, label %77

71:                                               ; preds = %61
  %72 = load double, ptr %21, align 8, !tbaa !9
  store double %72, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %22) #6
  %73 = load ptr, ptr %19, align 8, !tbaa !5
  %74 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %73) #6
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::Point") align 8 %22, ptr noundef nonnull align 8 dereferenceable(49) %74, ptr noundef nonnull align 8 dereferenceable(16) %75)
  %76 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox5PointIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %22)
  call void @llvm.lifetime.end.p0(i64 16, ptr %22) #6
  br label %77

77:                                               ; preds = %71, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %78

78:                                               ; preds = %77
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  br label %58

80:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  ret void

81:                                               ; preds = %44
  %82 = load ptr, ptr %12, align 8
  %83 = load i32, ptr %13, align 4
  %84 = insertvalue { ptr, i32 } poison, ptr %82, 0
  %85 = insertvalue { ptr, i32 } %84, i32 %83, 1
  resume { ptr, i32 } %85
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox5PointIdLm2EEC2IdEERKSt16initializer_listIT_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, double } @_ZNK3vox4Bvh2ISt10shared_ptrINS_16ImplicitSurface2EEE7nearestERKNS_5PointIdLm2EEERKSt8functionIFdRKS3_S8_EE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_5PointIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet217closestPointLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

declare void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::Point") align 8, ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 8 dereferenceable(16)) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK3vox5PointIdLm2EE10distanceToERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 #5 = { "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 }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt16initializer_listIdE", !6, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTSN3vox27NearestNeighborQueryResult2ISt10shared_ptrINS_16ImplicitSurface2EEEE", !6, i64 0, !10, i64 8}
!17 = !{!16, !10, i64 8}


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

%"struct.vox::Point" = type { double, double }
%class.anon = type { i8 }
%"class.std::initializer_list" = type { ptr, i64 }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%"class.__gnu_cxx::__normal_iterator.19" = type { ptr }

; 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3vox19ImplicitSurfaceSet28buildBvhEv(ptr noundef nonnull align 8 dereferenceable(232)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox19ImplicitSurfaceSet217closestPointLocalERKNS_5PointIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"struct.vox::Point") align 8 %0, ptr noundef nonnull align 8 dereferenceable(232) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.anon, align 1
  %5 = alloca %"class.std::initializer_list", align 8
  %6 = alloca [2 x double], align 16
  %7 = alloca %"class.std::function", align 8
  %8 = alloca %"struct.vox::Point", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %11 = alloca %"struct.vox::Point", align 8
  %12 = alloca %"struct.vox::Point", align 8
  tail call void @_ZNK3vox19ImplicitSurfaceSet28buildBvhEv(ptr noundef nonnull align 8 dereferenceable(232) %1)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  store <2 x double> <double 0x7FEFFFFFFFFFFFFF, double 0x7FEFFFFFFFFFFFFF>, ptr %6, align 16, !tbaa !5
  store ptr %6, ptr %5, align 8, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %5, i64 8
  store i64 2, ptr %13, align 8, !tbaa !13
  call void @_ZN3vox5PointIdLm2EEC2IdEERKSt16initializer_listIT_E(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  %14 = getelementptr inbounds i8, ptr %1, i64 104
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #6
  call void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_5PointIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet217closestPointLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  %15 = invoke { ptr, double } @_ZNK3vox4Bvh2ISt10shared_ptrINS_16ImplicitSurface2EEE7nearestERKNS_5PointIdLm2EEERKSt8functionIFdRKS3_S8_EE(ptr noundef nonnull align 8 dereferenceable(120) %14, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(32) %7)
          to label %16 unwind label %22

16:                                               ; preds = %3
  %17 = extractvalue { ptr, double } %15, 0
  %18 = extractvalue { ptr, double } %15, 1
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %24, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #6
  %20 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %17) #6
  call void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"struct.vox::Point") align 8 %8, ptr noundef nonnull align 8 dereferenceable(49) %20, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox5PointIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #6
  br label %24

22:                                               ; preds = %3
  %23 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  resume { ptr, i32 } %23

24:                                               ; preds = %19, %16
  %25 = getelementptr inbounds i8, ptr %1, i64 80
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %26 = call ptr @_ZNKSt6vectorISt10shared_ptrIN3vox16ImplicitSurface2EESaIS3_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #6
  store ptr %26, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %27 = call ptr @_ZNKSt6vectorISt10shared_ptrIN3vox16ImplicitSurface2EESaIS3_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %25) #6
  store ptr %27, ptr %10, align 8
  %28 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %36, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  ret void

.lr.ph:                                           ; preds = %24, %36
  %.017 = phi double [ %.1, %36 ], [ %18, %24 ]
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #6
  %30 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %29) #6
  call void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"struct.vox::Point") align 8 %11, ptr noundef nonnull align 8 dereferenceable(49) %30, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %31 = call noundef double @_ZNK3vox5PointIdLm2EE10distanceToERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %32 = fcmp olt double %31, %.017
  br i1 %32, label %33, label %36

33:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %12) #6
  %34 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %29) #6
  call void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"struct.vox::Point") align 8 %12, ptr noundef nonnull align 8 dereferenceable(49) %34, ptr noundef nonnull align 8 dereferenceable(16) %2)
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox5PointIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %12)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %12) #6
  br label %36

36:                                               ; preds = %33, %.lr.ph
  %.1 = phi double [ %31, %33 ], [ %.017, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #6
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %38 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br i1 %38, label %.lr.ph, label %._crit_edge
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3vox5PointIdLm2EEC2IdEERKSt16initializer_listIT_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { ptr, double } @_ZNK3vox4Bvh2ISt10shared_ptrINS_16ImplicitSurface2EEE7nearestERKNS_5PointIdLm2EEERKSt8functionIFdRKS3_S8_EE(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_5PointIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet217closestPointLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

declare void @_ZNK3vox8Surface212closestPointERKNS_5PointIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::Point") align 8, ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #5

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK3vox5PointIdLm2EE10distanceToERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 #5 = { "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 }

!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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSSt16initializer_listIdE", !11, i64 0, !12, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !12, i64 8}


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