; 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::Vector" = type { double, double }
%"struct.vox::SurfaceRayIntersection2" = type { i8, double, %"struct.vox::Point", %"struct.vox::Vector" }
%"struct.vox::Point" = type { double, double }
%class.anon.32 = type { i8 }
%"struct.vox::ClosestIntersectionQueryResult2" = type { ptr, double }
%"class.std::function.34" = 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 }
%"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
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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox19ImplicitSurfaceSet224closestIntersectionLocalERKNS_3RayIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"struct.vox::SurfaceRayIntersection2") align 8 %0, ptr noundef nonnull align 8 dereferenceable(232) %1, ptr noundef nonnull align 8 dereferenceable(32) %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.32, align 1
  %8 = alloca %"struct.vox::ClosestIntersectionQueryResult2", align 8
  %9 = alloca %"class.std::function.34", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.vox::Point", align 8
  %13 = alloca %"struct.vox::Vector", align 8
  %14 = alloca ptr, align 8
  %15 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %17 = alloca ptr, align 8
  %18 = alloca %"struct.vox::SurfaceRayIntersection2", 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
  %19 = load ptr, ptr %5, align 8
  call void @_ZNK3vox19ImplicitSurfaceSet28buildBvhEv(ptr noundef nonnull align 8 dereferenceable(232) %19)
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %20 = getelementptr inbounds %"class.vox::ImplicitSurfaceSet2", ptr %19, i32 0, i32 4
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  call void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_3RayIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet224closestIntersectionLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  %22 = invoke { ptr, double } @_ZNK3vox4Bvh2ISt10shared_ptrINS_16ImplicitSurface2EEE19closestIntersectionERKNS_3RayIdLm2EEERKSt8functionIFdRKS3_S8_EE(ptr noundef nonnull align 8 dereferenceable(120) %20, ptr noundef nonnull align 8 dereferenceable(32) %21, ptr noundef nonnull align 8 dereferenceable(32) %9)
          to label %23 unwind label %51

23:                                               ; preds = %3
  %24 = getelementptr inbounds { ptr, double }, ptr %8, i32 0, i32 0
  %25 = extractvalue { ptr, double } %22, 0
  store ptr %25, ptr %24, align 8
  %26 = getelementptr inbounds { ptr, double }, ptr %8, i32 0, i32 1
  %27 = extractvalue { ptr, double } %22, 1
  store double %27, ptr %26, align 8
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  call void @_ZN3vox23SurfaceRayIntersection2C2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %28 = getelementptr inbounds %"struct.vox::ClosestIntersectionQueryResult2", ptr %8, i32 0, i32 1
  %29 = load double, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %0, i32 0, i32 1
  store double %29, ptr %30, align 8, !tbaa !12
  %31 = getelementptr inbounds %"struct.vox::ClosestIntersectionQueryResult2", ptr %8, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  %33 = icmp ne ptr %32, null
  %34 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %0, i32 0, i32 0
  %35 = zext i1 %33 to i8
  store i8 %35, ptr %34, align 8, !tbaa !18
  %36 = getelementptr inbounds %"struct.vox::ClosestIntersectionQueryResult2", ptr %8, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %55

39:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #6
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.vox::ClosestIntersectionQueryResult2", ptr %8, i32 0, i32 1
  %42 = load double, ptr %41, align 8, !tbaa !9
  call void @_ZNK3vox3RayIdLm2EE7pointAtEd(ptr dead_on_unwind writable sret(%"struct.vox::Point") align 8 %12, ptr noundef nonnull align 8 dereferenceable(32) %40, double noundef %42)
  %43 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %0, i32 0, i32 2
  %44 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox5PointIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(16) %12)
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #6
  %45 = getelementptr inbounds %"struct.vox::ClosestIntersectionQueryResult2", ptr %8, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !17
  %47 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %46) #6
  %48 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %0, i32 0, i32 2
  call void @_ZNK3vox8Surface213closestNormalERKNS_5PointIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::Vector") align 8 %13, ptr noundef nonnull align 8 dereferenceable(49) %47, ptr noundef nonnull align 8 dereferenceable(16) %48)
  %49 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %0, i32 0, i32 3
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #6
  br label %55

51:                                               ; preds = %3
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %10, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %11, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  br label %82

55:                                               ; preds = %39, %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %56 = getelementptr inbounds %"class.vox::ImplicitSurfaceSet2", ptr %19, i32 0, i32 3
  store ptr %56, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = call ptr @_ZNKSt6vectorISt10shared_ptrIN3vox16ImplicitSurface2EESaIS3_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %57) #6
  %59 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.19", ptr %15, i32 0, i32 0
  store ptr %58, ptr %59, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %60 = load ptr, ptr %14, align 8, !tbaa !5
  %61 = call ptr @_ZNKSt6vectorISt10shared_ptrIN3vox16ImplicitSurface2EESaIS3_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #6
  %62 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.19", ptr %16, i32 0, i32 0
  store ptr %61, ptr %62, align 8
  br label %63

63:                                               ; preds = %79, %55
  %64 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  br i1 %64, label %66, label %65

65:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %81

66:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  store ptr %67, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %18) #6
  %68 = load ptr, ptr %17, align 8, !tbaa !5
  %69 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %68) #6
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZNK3vox8Surface219closestIntersectionERKNS_3RayIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::SurfaceRayIntersection2") align 8 %18, ptr noundef nonnull align 8 dereferenceable(49) %69, ptr noundef nonnull align 8 dereferenceable(32) %70)
  %71 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %18, i32 0, i32 1
  %72 = load double, ptr %71, align 8, !tbaa !12
  %73 = getelementptr inbounds %"struct.vox::SurfaceRayIntersection2", ptr %0, i32 0, i32 1
  %74 = load double, ptr %73, align 8, !tbaa !12
  %75 = fcmp olt double %72, %74
  br i1 %75, label %76, label %78

76:                                               ; preds = %66
  %77 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN3vox23SurfaceRayIntersection2aSERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(48) %18)
  br label %78

78:                                               ; preds = %76, %66
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %79

79:                                               ; preds = %78
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %15) #6
  br label %63

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

82:                                               ; preds = %51
  %83 = load ptr, ptr %10, align 8
  %84 = load i32, ptr %11, align 4
  %85 = insertvalue { ptr, i32 } poison, ptr %83, 0
  %86 = insertvalue { ptr, i32 } %85, i32 %84, 1
  resume { ptr, i32 } %86
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_3RayIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet224closestIntersectionLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3vox23SurfaceRayIntersection2C2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3vox3RayIdLm2EE7pointAtEd(ptr dead_on_unwind noalias writable sret(%"struct.vox::Point") align 8, ptr noundef nonnull align 8 dereferenceable(32), double noundef) #2 align 2

declare void @_ZNK3vox8Surface219closestIntersectionERKNS_3RayIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::SurfaceRayIntersection2") align 8, ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 8 dereferenceable(32)) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN3vox23SurfaceRayIntersection2aSERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #5 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!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, !11, i64 8}
!10 = !{!"_ZTSN3vox31ClosestIntersectionQueryResult2ISt10shared_ptrINS_16ImplicitSurface2EEEE", !6, i64 0, !11, i64 8}
!11 = !{!"double", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"_ZTSN3vox23SurfaceRayIntersection2E", !14, i64 0, !11, i64 8, !15, i64 16, !16, i64 32}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSN3vox5PointIdLm2EEE", !11, i64 0, !11, i64 8}
!16 = !{!"_ZTSN3vox6VectorIdLm2EEE", !11, i64 0, !11, i64 8}
!17 = !{!10, !6, i64 0}
!18 = !{!13, !14, i64 0}


; 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::Vector" = type { double, double }
%"struct.vox::SurfaceRayIntersection2" = type { i8, double, %"struct.vox::Point", %"struct.vox::Vector" }
%"struct.vox::Point" = type { double, double }
%class.anon.32 = type { i8 }
%"class.std::function.34" = 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
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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3vox19ImplicitSurfaceSet224closestIntersectionLocalERKNS_3RayIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"struct.vox::SurfaceRayIntersection2") align 8 %0, ptr noundef nonnull align 8 dereferenceable(232) %1, ptr noundef nonnull align 8 dereferenceable(32) %2) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.anon.32, align 1
  %5 = alloca %"class.std::function.34", align 8
  %6 = alloca %"struct.vox::Point", align 8
  %7 = alloca %"struct.vox::Vector", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.19", align 8
  %10 = alloca %"struct.vox::SurfaceRayIntersection2", 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
  %11 = getelementptr inbounds i8, ptr %1, i64 104
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  call void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_3RayIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet224closestIntersectionLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  %12 = invoke { ptr, double } @_ZNK3vox4Bvh2ISt10shared_ptrINS_16ImplicitSurface2EEE19closestIntersectionERKNS_3RayIdLm2EEERKSt8functionIFdRKS3_S8_EE(ptr noundef nonnull align 8 dereferenceable(120) %11, ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %13 unwind label %25

13:                                               ; preds = %3
  %14 = extractvalue { ptr, double } %12, 0
  %15 = extractvalue { ptr, double } %12, 1
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  call void @_ZN3vox23SurfaceRayIntersection2C2Ev(ptr noundef nonnull align 8 dereferenceable(48) %0)
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  store double %15, ptr %16, align 8, !tbaa !5
  %17 = icmp ne ptr %14, null
  %18 = zext i1 %17 to i8
  store i8 %18, ptr %0, align 8, !tbaa !13
  br i1 %17, label %19, label %27

19:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  call void @_ZNK3vox3RayIdLm2EE7pointAtEd(ptr dead_on_unwind nonnull writable sret(%"struct.vox::Point") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %2, double noundef %15)
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox5PointIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #6
  %22 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %14) #6
  call void @_ZNK3vox8Surface213closestNormalERKNS_5PointIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"struct.vox::Vector") align 8 %7, ptr noundef nonnull align 8 dereferenceable(49) %22, ptr noundef nonnull align 8 dereferenceable(16) %20)
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN3vox6VectorIdLm2EEaSERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #6
  br label %27

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

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

.lr.ph:                                           ; preds = %27
  %32 = getelementptr inbounds i8, ptr %10, i64 8
  br label %33

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

33:                                               ; preds = %.lr.ph, %41
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %10) #6
  %35 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN3vox16ImplicitSurface2ELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %34) #6
  call void @_ZNK3vox8Surface219closestIntersectionERKNS_3RayIdLm2EEE(ptr dead_on_unwind nonnull writable sret(%"struct.vox::SurfaceRayIntersection2") align 8 %10, ptr noundef nonnull align 8 dereferenceable(49) %35, ptr noundef nonnull align 8 dereferenceable(32) %2)
  %36 = load double, ptr %32, align 8, !tbaa !5
  %37 = load double, ptr %16, align 8, !tbaa !5
  %38 = fcmp olt double %36, %37
  br i1 %38, label %39, label %41

39:                                               ; preds = %33
  %40 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN3vox23SurfaceRayIntersection2aSERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(48) %10)
  br label %41

41:                                               ; preds = %39, %33
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %10) #6
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %43 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKSt10shared_ptrIN3vox16ImplicitSurface2EESt6vectorIS4_SaIS4_EEEEbRKNS_17__normal_iteratorIT_T0_EESF_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  br i1 %43, label %33, label %._crit_edge
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFdRKSt10shared_ptrIN3vox16ImplicitSurface2EERKNS1_3RayIdLm2EEEEEC2IRKZNKS1_19ImplicitSurfaceSet224closestIntersectionLocalES9_E3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN3vox23SurfaceRayIntersection2C2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK3vox3RayIdLm2EE7pointAtEd(ptr dead_on_unwind noalias writable sret(%"struct.vox::Point") align 8, ptr noundef nonnull align 8 dereferenceable(32), double noundef) local_unnamed_addr #2 align 2

declare void @_ZNK3vox8Surface219closestIntersectionERKNS_3RayIdLm2EEE(ptr dead_on_unwind writable sret(%"struct.vox::SurfaceRayIntersection2") align 8, ptr noundef nonnull align 8 dereferenceable(49), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN3vox23SurfaceRayIntersection2aSERKS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #5 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!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, !10, i64 8}
!6 = !{!"_ZTSN3vox23SurfaceRayIntersection2E", !7, i64 0, !10, i64 8, !11, i64 16, !12, i64 32}
!7 = !{!"bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTSN3vox5PointIdLm2EEE", !10, i64 0, !10, i64 8}
!12 = !{!"_ZTSN3vox6VectorIdLm2EEE", !10, i64 0, !10, i64 8}
!13 = !{!6, !7, i64 0}


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