; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src (anisotropicparticlemesher)

; 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.vmath::vec3" = type { float, float, float }
%struct.GridPointReference = type { i32 }
%"struct.AnisotropicParticleMesher::SurfaceParticle" = type { %"class.vmath::vec3", %struct.GridPointReference, i32 }
%class.AnisotropicParticleMesher = type { double, double, double, double, double, double, double, double, i32, double, i32, double, i32, i32, i32, double, i32, double, %class.SpatialPointGrid, %class.FragmentedVector, %class.FragmentedVector.10, %class.FragmentedVector.10, %class.FragmentedVector.16, %class.ScalarField, i32, i32, i32, [4 x i8], %class.Array3d.22 }
%class.SpatialPointGrid = type { i32, i32, i32, double, %"class.std::vector", %"class.std::vector.0", %class.Array3d, %class.AABB }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl" }
%"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Array3d = type { i32, i32, i32, ptr, i8, %"struct.SpatialPointGrid::CellNode", i32 }
%"struct.SpatialPointGrid::CellNode" = type { i32, i32 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%class.FragmentedVector = type { %"class.std::vector.5", i32, i32, double, i32, i32 }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode, std::allocator<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode>>::_Vector_impl" }
%"struct.std::_Vector_base<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode, std::allocator<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode>>::_Vector_impl" = type { %"struct.std::_Vector_base<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode, std::allocator<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode>>::_Vector_impl_data" }
%"struct.std::_Vector_base<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode, std::allocator<FragmentedVector<AnisotropicParticleMesher::SurfaceParticle>::VectorNode>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.FragmentedVector.10 = type { %"class.std::vector.11", i32, i32, double, i32, i32 }
%"class.std::vector.11" = type { %"struct.std::_Vector_base.12" }
%"struct.std::_Vector_base.12" = type { %"struct.std::_Vector_base<FragmentedVector<GridPointReference>::VectorNode, std::allocator<FragmentedVector<GridPointReference>::VectorNode>>::_Vector_impl" }
%"struct.std::_Vector_base<FragmentedVector<GridPointReference>::VectorNode, std::allocator<FragmentedVector<GridPointReference>::VectorNode>>::_Vector_impl" = type { %"struct.std::_Vector_base<FragmentedVector<GridPointReference>::VectorNode, std::allocator<FragmentedVector<GridPointReference>::VectorNode>>::_Vector_impl_data" }
%"struct.std::_Vector_base<FragmentedVector<GridPointReference>::VectorNode, std::allocator<FragmentedVector<GridPointReference>::VectorNode>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.FragmentedVector.16 = type { %"class.std::vector.17", i32, i32, double, i32, i32 }
%"class.std::vector.17" = type { %"struct.std::_Vector_base.18" }
%"struct.std::_Vector_base.18" = type { %"struct.std::_Vector_base<FragmentedVector<vmath::vec3>::VectorNode, std::allocator<FragmentedVector<vmath::vec3>::VectorNode>>::_Vector_impl" }
%"struct.std::_Vector_base<FragmentedVector<vmath::vec3>::VectorNode, std::allocator<FragmentedVector<vmath::vec3>::VectorNode>>::_Vector_impl" = type { %"struct.std::_Vector_base<FragmentedVector<vmath::vec3>::VectorNode, std::allocator<FragmentedVector<vmath::vec3>::VectorNode>>::_Vector_impl_data" }
%"struct.std::_Vector_base<FragmentedVector<vmath::vec3>::VectorNode, std::allocator<FragmentedVector<vmath::vec3>::VectorNode>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.ScalarField = type { i32, i32, i32, double, double, double, double, double, double, double, double, i8, [7 x i8], %class.Array3d.22, %class.Array3d.23, %class.Array3d.22, %class.Array3d.23, i8, %"class.vmath::vec3" }
%class.Array3d.23 = type { i32, i32, i32, ptr, i8, i8, i32 }
%class.Array3d.22 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>

declare i32 @__gxx_personality_v0(...)

; 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 void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind
declare void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN16FragmentedVectorIN25AnisotropicParticleMesher15SurfaceParticleEEixEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher15SurfaceParticleC2Ev(ptr noundef nonnull align 4 dereferenceable(20)) unnamed_addr #5 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN25AnisotropicParticleMesher32_getWeightedMeanParticlePositionE18GridPointReferenceRSt6vectorIS0_SaIS0_EE(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4 %0, ptr noundef nonnull align 8 dereferenceable(784) %1, i32 %2, ptr noundef nonnull align 8 dereferenceable(24) %3) #5 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca %struct.GridPointReference, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %"struct.AnisotropicParticleMesher::SurfaceParticle", align 4
  %10 = alloca %"struct.AnisotropicParticleMesher::SurfaceParticle", align 4
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca %"class.vmath::vec3", align 4
  %19 = alloca %struct.GridPointReference, align 4
  %20 = alloca double, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %"class.vmath::vec3", align 4
  store ptr %0, ptr %5, align 8
  %24 = getelementptr inbounds %struct.GridPointReference, ptr %6, i32 0, i32 0
  store i32 %2, ptr %24, align 4
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 20, ptr %9) #8
  %26 = getelementptr inbounds %class.AnisotropicParticleMesher, ptr %25, i32 0, i32 19
  %27 = getelementptr inbounds %struct.GridPointReference, ptr %6, i32 0, i32 0
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = call noundef nonnull align 4 dereferenceable(20) ptr @_ZN16FragmentedVectorIN25AnisotropicParticleMesher15SurfaceParticleEEixEi(ptr noundef nonnull align 8 dereferenceable(48) %26, i32 noundef %28)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %29, i64 20, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.start.p0(i64 20, ptr %10) #8
  invoke void @_ZN25AnisotropicParticleMesher15SurfaceParticleC2Ev(ptr noundef nonnull align 4 dereferenceable(20) %10)
          to label %30 unwind label %40

30:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store double 0.000000e+00, ptr %13, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store double 0.000000e+00, ptr %14, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store double 0.000000e+00, ptr %15, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store double 0.000000e+00, ptr %16, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18)
          to label %31 unwind label %44

31:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  invoke void @_ZN18GridPointReferenceC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %19)
          to label %32 unwind label %48

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  store double 1.000000e-09, ptr %20, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #8
  store i32 0, ptr %21, align 4, !tbaa !15
  br label %33

33:                                               ; preds = %88, %32
  %34 = load i32, ptr %21, align 4, !tbaa !15
  %35 = zext i32 %34 to i64
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = call noundef i64 @_ZNKSt6vectorI18GridPointReferenceSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #8
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %52, label %39

39:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %95

40:                                               ; preds = %4
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %11, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %12, align 4
  br label %125

44:                                               ; preds = %30
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %11, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %12, align 4
  br label %124

48:                                               ; preds = %31
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %11, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %12, align 4
  br label %123

52:                                               ; preds = %33
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load i32, ptr %21, align 4, !tbaa !15
  %55 = zext i32 %54 to i64
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI18GridPointReferenceSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %55) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %56, i64 4, i1 false), !tbaa.struct !18
  %57 = getelementptr inbounds %class.AnisotropicParticleMesher, ptr %25, i32 0, i32 19
  %58 = getelementptr inbounds %struct.GridPointReference, ptr %19, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN16FragmentedVectorIN25AnisotropicParticleMesher15SurfaceParticleEEixEi(ptr noundef nonnull align 8 dereferenceable(48) %57, i32 noundef %59)
          to label %61 unwind label %91

61:                                               ; preds = %52
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %60, i64 20, i1 false), !tbaa.struct !12
  %62 = invoke noundef double @_ZN25AnisotropicParticleMesher15_evaluateKernelERNS_15SurfaceParticleES1_(ptr noundef nonnull align 8 dereferenceable(784) %25, ptr noundef nonnull align 4 dereferenceable(20) %9, ptr noundef nonnull align 4 dereferenceable(20) %10)
          to label %63 unwind label %91

63:                                               ; preds = %61
  store double %62, ptr %17, align 8, !tbaa !16
  %64 = load double, ptr %17, align 8, !tbaa !16
  %65 = getelementptr inbounds %"struct.AnisotropicParticleMesher::SurfaceParticle", ptr %10, i32 0, i32 0
  %66 = getelementptr inbounds %"class.vmath::vec3", ptr %65, i32 0, i32 0
  %67 = load float, ptr %66, align 4, !tbaa !19
  %68 = fpext float %67 to double
  %69 = load double, ptr %13, align 8, !tbaa !16
  %70 = call double @llvm.fmuladd.f64(double %64, double %68, double %69)
  store double %70, ptr %13, align 8, !tbaa !16
  %71 = load double, ptr %17, align 8, !tbaa !16
  %72 = getelementptr inbounds %"struct.AnisotropicParticleMesher::SurfaceParticle", ptr %10, i32 0, i32 0
  %73 = getelementptr inbounds %"class.vmath::vec3", ptr %72, i32 0, i32 1
  %74 = load float, ptr %73, align 4, !tbaa !22
  %75 = fpext float %74 to double
  %76 = load double, ptr %14, align 8, !tbaa !16
  %77 = call double @llvm.fmuladd.f64(double %71, double %75, double %76)
  store double %77, ptr %14, align 8, !tbaa !16
  %78 = load double, ptr %17, align 8, !tbaa !16
  %79 = getelementptr inbounds %"struct.AnisotropicParticleMesher::SurfaceParticle", ptr %10, i32 0, i32 0
  %80 = getelementptr inbounds %"class.vmath::vec3", ptr %79, i32 0, i32 2
  %81 = load float, ptr %80, align 4, !tbaa !23
  %82 = fpext float %81 to double
  %83 = load double, ptr %15, align 8, !tbaa !16
  %84 = call double @llvm.fmuladd.f64(double %78, double %82, double %83)
  store double %84, ptr %15, align 8, !tbaa !16
  %85 = load double, ptr %17, align 8, !tbaa !16
  %86 = load double, ptr %16, align 8, !tbaa !16
  %87 = fadd double %86, %85
  store double %87, ptr %16, align 8, !tbaa !16
  br label %88

88:                                               ; preds = %63
  %89 = load i32, ptr %21, align 4, !tbaa !15
  %90 = add i32 %89, 1
  store i32 %90, ptr %21, align 4, !tbaa !15
  br label %33, !llvm.loop !24

91:                                               ; preds = %61, %52
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %11, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  br label %122

95:                                               ; preds = %39
  %96 = load double, ptr %16, align 8, !tbaa !16
  %97 = load double, ptr %20, align 8, !tbaa !16
  %98 = fcmp olt double %96, %97
  br i1 %98, label %99, label %101

99:                                               ; preds = %95
  %100 = getelementptr inbounds %"struct.AnisotropicParticleMesher::SurfaceParticle", ptr %9, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr align 4 %100, i64 12, i1 false), !tbaa.struct !26
  store i32 1, ptr %22, align 4
  br label %121

101:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #8
  %102 = load double, ptr %13, align 8, !tbaa !16
  %103 = fptrunc double %102 to float
  %104 = load double, ptr %14, align 8, !tbaa !16
  %105 = fptrunc double %104 to float
  %106 = load double, ptr %15, align 8, !tbaa !16
  %107 = fptrunc double %106 to float
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %23, float noundef %103, float noundef %105, float noundef %107)
          to label %108 unwind label %112

108:                                              ; preds = %101
  %109 = load double, ptr %16, align 8, !tbaa !16
  %110 = fptrunc double %109 to float
  invoke void @_ZN5vmathdvERKNS_4vec3Ef(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %23, float noundef %110)
          to label %111 unwind label %116

111:                                              ; preds = %108
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %23) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  store i32 1, ptr %22, align 4
  br label %121

112:                                              ; preds = %101
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %11, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %12, align 4
  br label %120

116:                                              ; preds = %108
  %117 = landingpad { ptr, i32 }
          cleanup
  %118 = extractvalue { ptr, i32 } %117, 0
  store ptr %118, ptr %11, align 8
  %119 = extractvalue { ptr, i32 } %117, 1
  store i32 %119, ptr %12, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %23) #8
  br label %120

120:                                              ; preds = %116, %112
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  br label %122

121:                                              ; preds = %111, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %10) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #8
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %9) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %9) #8
  ret void

122:                                              ; preds = %120, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %123

123:                                              ; preds = %122, %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18) #8
  br label %124

124:                                              ; preds = %123, %44
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %10) #8
  br label %125

125:                                              ; preds = %124, %40
  call void @llvm.lifetime.end.p0(i64 20, ptr %10) #8
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %9) #8
  call void @llvm.lifetime.end.p0(i64 20, ptr %9) #8
  br label %126

126:                                              ; preds = %125
  %127 = load ptr, ptr %11, align 8
  %128 = load i32, ptr %12, align 4
  %129 = insertvalue { ptr, i32 } poison, ptr %127, 0
  %130 = insertvalue { ptr, i32 } %129, i32 %128, 1
  resume { ptr, i32 } %130
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN25AnisotropicParticleMesher15_evaluateKernelERNS_15SurfaceParticleES1_(ptr noundef nonnull align 8 dereferenceable(784), ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(20)) #5 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

declare void @_ZN5vmathdvERKNS_4vec3Ef(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 4 dereferenceable(12), float noundef) #1

declare void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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 0}
!10 = !{!"_ZTS18GridPointReference", !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13, i64 12, i64 4, !15, i64 16, i64 4, !15}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{i64 0, i64 4, !15}
!19 = !{!20, !14, i64 0}
!20 = !{!"_ZTSN25AnisotropicParticleMesher15SurfaceParticleE", !21, i64 0, !10, i64 12, !11, i64 16}
!21 = !{!"_ZTSN5vmath4vec3E", !14, i64 0, !14, i64 4, !14, i64 8}
!22 = !{!20, !14, i64 4}
!23 = !{!20, !14, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{i64 0, i64 4, !13, i64 4, i64 4, !13, i64 8, i64 4, !13}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.vmath::vec3" = type { float, float, float }
%"struct.AnisotropicParticleMesher::SurfaceParticle" = type { %"class.vmath::vec3", %struct.GridPointReference, i32 }
%struct.GridPointReference = type { i32 }

declare i32 @__gxx_personality_v0(...)

; 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 void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1

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

; Function Attrs: nounwind
declare void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(20) ptr @_ZN16FragmentedVectorIN25AnisotropicParticleMesher15SurfaceParticleEEixEi(ptr noundef nonnull align 8 dereferenceable(48), i32 noundef) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher15SurfaceParticleC2Ev(ptr noundef nonnull align 4 dereferenceable(20)) unnamed_addr #5 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN25AnisotropicParticleMesher32_getWeightedMeanParticlePositionE18GridPointReferenceRSt6vectorIS0_SaIS0_EE(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4 %0, ptr noundef nonnull align 8 dereferenceable(784) %1, i32 %2, ptr noundef nonnull align 8 dereferenceable(24) %3) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"struct.AnisotropicParticleMesher::SurfaceParticle", align 4
  %6 = alloca %"struct.AnisotropicParticleMesher::SurfaceParticle", align 4
  %7 = alloca %"class.vmath::vec3", align 4
  %8 = alloca %struct.GridPointReference, align 4
  %9 = alloca %"class.vmath::vec3", align 4
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %5) #9
  %10 = getelementptr inbounds i8, ptr %1, i64 288
  %11 = tail call noundef nonnull align 4 dereferenceable(20) ptr @_ZN16FragmentedVectorIN25AnisotropicParticleMesher15SurfaceParticleEEixEi(ptr noundef nonnull align 8 dereferenceable(48) %10, i32 noundef %2)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %5, ptr noundef nonnull align 4 dereferenceable(20) %11, i64 20, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %6) #9
  invoke void @_ZN25AnisotropicParticleMesher15SurfaceParticleC2Ev(ptr noundef nonnull align 4 dereferenceable(20) %6)
          to label %12 unwind label %17

12:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #9
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
          to label %13 unwind label %19

13:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #9
  call void @_ZN18GridPointReferenceC2Ev(ptr noundef nonnull align 4 dereferenceable(4) %8)
  %14 = call noundef i64 @_ZNKSt6vectorI18GridPointReferenceSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  %.not = icmp eq i64 %14, 0
  br i1 %.not, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %13
  %15 = getelementptr inbounds i8, ptr %6, i64 4
  br label %21

._crit_edge:                                      ; preds = %29
  %16 = fcmp olt double %38, 1.000000e-09
  br i1 %16, label %._crit_edge.thread, label %45

17:                                               ; preds = %4
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %62

19:                                               ; preds = %12
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %61

21:                                               ; preds = %.lr.ph, %29
  %22 = phi i64 [ 0, %.lr.ph ], [ %40, %29 ]
  %.044 = phi i32 [ 0, %.lr.ph ], [ %39, %29 ]
  %.02643 = phi double [ 0.000000e+00, %.lr.ph ], [ %38, %29 ]
  %.02940 = phi double [ 0.000000e+00, %.lr.ph ], [ %32, %29 ]
  %23 = phi <2 x double> [ zeroinitializer, %.lr.ph ], [ %37, %29 ]
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorI18GridPointReferenceSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %22) #9
  %25 = load i32, ptr %24, align 4, !tbaa !10
  store i32 %25, ptr %8, align 4, !tbaa !10
  %26 = invoke noundef nonnull align 4 dereferenceable(20) ptr @_ZN16FragmentedVectorIN25AnisotropicParticleMesher15SurfaceParticleEEixEi(ptr noundef nonnull align 8 dereferenceable(48) %10, i32 noundef %25)
          to label %27 unwind label %43

27:                                               ; preds = %21
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(20) %6, ptr noundef nonnull align 4 dereferenceable(20) %26, i64 20, i1 false), !tbaa.struct !5
  %28 = invoke noundef double @_ZN25AnisotropicParticleMesher15_evaluateKernelERNS_15SurfaceParticleES1_(ptr noundef nonnull align 8 dereferenceable(784) %1, ptr noundef nonnull align 4 dereferenceable(20) %5, ptr noundef nonnull align 4 dereferenceable(20) %6)
          to label %29 unwind label %43

29:                                               ; preds = %27
  %30 = load float, ptr %6, align 4, !tbaa !12
  %31 = fpext float %30 to double
  %32 = call double @llvm.fmuladd.f64(double %28, double %31, double %.02940)
  %33 = load <2 x float>, ptr %15, align 4, !tbaa !6
  %34 = fpext <2 x float> %33 to <2 x double>
  %35 = insertelement <2 x double> poison, double %28, i64 0
  %36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
  %37 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> %34, <2 x double> %23)
  %38 = fadd double %.02643, %28
  %39 = add i32 %.044, 1
  %40 = zext i32 %39 to i64
  %41 = call noundef i64 @_ZNKSt6vectorI18GridPointReferenceSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #9
  %42 = icmp ugt i64 %41, %40
  br i1 %42, label %21, label %._crit_edge, !llvm.loop !16

43:                                               ; preds = %27, %21
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %60

._crit_edge.thread:                               ; preds = %13, %._crit_edge
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %0, ptr noundef nonnull align 4 dereferenceable(12) %5, i64 12, i1 false), !tbaa.struct !18
  br label %59

45:                                               ; preds = %._crit_edge
  %46 = extractelement <2 x double> %37, i64 1
  %47 = fptrunc double %46 to float
  %48 = extractelement <2 x double> %37, i64 0
  %49 = fptrunc double %48 to float
  %50 = fptrunc double %32 to float
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #9
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %9, float noundef %50, float noundef %49, float noundef %47)
          to label %51 unwind label %54

51:                                               ; preds = %45
  %52 = fptrunc double %38 to float
  invoke void @_ZN5vmathdvERKNS_4vec3Ef(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %0, ptr noundef nonnull align 4 dereferenceable(12) %9, float noundef %52)
          to label %53 unwind label %56

53:                                               ; preds = %51
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #9
  br label %59

54:                                               ; preds = %45
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %58

56:                                               ; preds = %51
  %57 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #9
  br label %58

58:                                               ; preds = %56, %54
  %.pn = phi { ptr, i32 } [ %57, %56 ], [ %55, %54 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #9
  br label %60

59:                                               ; preds = %53, %._crit_edge.thread
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #9
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %6) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %6) #9
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %5) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #9
  ret void

60:                                               ; preds = %58, %43
  %.pn32 = phi { ptr, i32 } [ %44, %43 ], [ %.pn, %58 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #9
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #9
  br label %61

61:                                               ; preds = %60, %19
  %.pn32.pn = phi { ptr, i32 } [ %.pn32, %60 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #9
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %6) #9
  br label %62

62:                                               ; preds = %61, %17
  %.pn32.pn.pn = phi { ptr, i32 } [ %.pn32.pn, %61 ], [ %18, %17 ]
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %6) #9
  call void @_ZN25AnisotropicParticleMesher15SurfaceParticleD2Ev(ptr noundef nonnull align 4 dereferenceable(20) %5) #9
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %5) #9
  resume { ptr, i32 } %.pn32.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN25AnisotropicParticleMesher15_evaluateKernelERNS_15SurfaceParticleES1_(ptr noundef nonnull align 8 dereferenceable(784), ptr noundef nonnull align 4 dereferenceable(20), ptr noundef nonnull align 4 dereferenceable(20)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #7

declare void @_ZN5vmathdvERKNS_4vec3Ef(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4, ptr noundef nonnull align 4 dereferenceable(12), float noundef) local_unnamed_addr #1

declare void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12), float noundef, float noundef, float noundef) unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #8

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 4, !10, i64 16, i64 4, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"_ZTSN25AnisotropicParticleMesher15SurfaceParticleE", !14, i64 0, !15, i64 12, !11, i64 16}
!14 = !{!"_ZTSN5vmath4vec3E", !7, i64 0, !7, i64 4, !7, i64 8}
!15 = !{!"_ZTS18GridPointReference", !11, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6}


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