; 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.TriangleMesh = type { %"class.std::vector.24", %"class.std::vector.24", %"class.std::vector.24", %"class.std::vector.29", i32, i32, i32, double, %"class.std::vector.34", %"class.std::vector.39", %class.Array3d.44 }
%"class.std::vector.24" = type { %"struct.std::_Vector_base.25" }
%"struct.std::_Vector_base.25" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.29" = type { %"struct.std::_Vector_base.30" }
%"struct.std::_Vector_base.30" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.34" = type { %"struct.std::_Vector_base.35" }
%"struct.std::_Vector_base.35" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.39" = type { %"struct.std::_Vector_base.40" }
%"struct.std::_Vector_base.40" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Array3d.44 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.0", i32, [4 x i8] }>
%"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.23 = type { i32, i32, i32, ptr, i8, i8, i32 }
%class.Polygonizer3d = type <{ i32, i32, i32, [4 x i8], double, double, ptr, i8, [7 x i8], ptr, i8, [7 x i8] }>
%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.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.vmath::vec3" = type { float, float, float }
%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.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 @_ZN13Polygonizer3dC1EP11ScalarField(ptr noundef nonnull align 8 dereferenceable(57), ptr noundef) unnamed_addr #1

declare void @_ZN13Polygonizer3d17polygonizeSurfaceEv(ptr dead_on_unwind writable sret(%class.TriangleMesh) align 8, ptr noundef nonnull align 8 dereferenceable(57)) #1

; Function Attrs: nounwind
declare void @_ZN13Polygonizer3dD1Ev(ptr noundef nonnull align 8 dereferenceable(57)) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher28_getSubdividedGridDimensionsEPiS0_S0_Pd(ptr noundef nonnull align 8 dereferenceable(784), ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN25AnisotropicParticleMesher16_polygonizeSliceEiiR16FragmentedVectorIN5vmath4vec3EER8LevelSetR17FluidMaterialGrid(ptr dead_on_unwind noalias writable sret(%class.TriangleMesh) align 8 %0, ptr noundef nonnull align 8 dereferenceable(784) %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(448) %5, ptr noundef nonnull align 8 dereferenceable(88) %6) #4 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca double, align 8
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca %class.Array3d.23, align 8
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca %class.Polygonizer3d, align 8
  store ptr %0, ptr %8, align 8
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  %29 = load ptr, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  call void @_ZN25AnisotropicParticleMesher28_getSubdividedGridDimensionsEPiS0_S0_Pd(ptr noundef nonnull align 8 dereferenceable(784) %29, ptr noundef %15, ptr noundef %16, ptr noundef %17, ptr noundef %18)
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #5
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %31 = icmp eq i32 %30, 0
  %32 = zext i1 %31 to i8
  store i8 %32, ptr %19, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #5
  %33 = load i32, ptr %11, align 4, !tbaa !9
  %34 = load i32, ptr %15, align 4, !tbaa !9
  %35 = sub nsw i32 %34, 1
  %36 = icmp eq i32 %33, %35
  %37 = zext i1 %36 to i8
  store i8 %37, ptr %20, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #5
  %38 = load i8, ptr %19, align 1, !tbaa !11, !range !13, !noundef !14
  %39 = trunc i8 %38 to i1
  br i1 %39, label %44, label %40

40:                                               ; preds = %7
  %41 = load i8, ptr %20, align 1, !tbaa !11, !range !13, !noundef !14
  %42 = trunc i8 %41 to i1
  %43 = xor i1 %42, true
  br label %44

44:                                               ; preds = %40, %7
  %45 = phi i1 [ false, %7 ], [ %43, %40 ]
  %46 = zext i1 %45 to i8
  store i8 %46, ptr %21, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %47 = load i32, ptr %11, align 4, !tbaa !9
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = sub nsw i32 %47, %48
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %22, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %51 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %51, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %52 = load i32, ptr %17, align 4, !tbaa !9
  store i32 %52, ptr %24, align 4, !tbaa !9
  %53 = load i8, ptr %19, align 1, !tbaa !11, !range !13, !noundef !14
  %54 = trunc i8 %53 to i1
  br i1 %54, label %58, label %55

55:                                               ; preds = %44
  %56 = load i8, ptr %20, align 1, !tbaa !11, !range !13, !noundef !14
  %57 = trunc i8 %56 to i1
  br i1 %57, label %58, label %61

58:                                               ; preds = %55, %44
  %59 = load i32, ptr %22, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %22, align 4, !tbaa !9
  br label %68

61:                                               ; preds = %55
  %62 = load i8, ptr %21, align 1, !tbaa !11, !range !13, !noundef !14
  %63 = trunc i8 %62 to i1
  br i1 %63, label %64, label %67

64:                                               ; preds = %61
  %65 = load i32, ptr %22, align 4, !tbaa !9
  %66 = add nsw i32 %65, 2
  store i32 %66, ptr %22, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %64, %61
  br label %68

68:                                               ; preds = %67, %58
  %69 = load i32, ptr %10, align 4, !tbaa !9
  %70 = load i32, ptr %11, align 4, !tbaa !9
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN25AnisotropicParticleMesher24_computeSliceScalarFieldEiiR16FragmentedVectorIN5vmath4vec3EER8LevelSetR17FluidMaterialGrid(ptr noundef nonnull align 8 dereferenceable(784) %29, i32 noundef %69, i32 noundef %70, ptr noundef nonnull align 8 dereferenceable(48) %71, ptr noundef nonnull align 8 dereferenceable(448) %72, ptr noundef nonnull align 8 dereferenceable(88) %73)
  call void @llvm.lifetime.start.p0(i64 32, ptr %25) #5
  %74 = load i32, ptr %22, align 4, !tbaa !9
  %75 = load i32, ptr %23, align 4, !tbaa !9
  %76 = load i32, ptr %24, align 4, !tbaa !9
  call void @_ZN7Array3dIbEC2Eiii(ptr noundef nonnull align 8 dereferenceable(32) %25, i32 noundef %74, i32 noundef %75, i32 noundef %76)
  %77 = load i32, ptr %10, align 4, !tbaa !9
  %78 = load i32, ptr %11, align 4, !tbaa !9
  invoke void @_ZN25AnisotropicParticleMesher13_getSliceMaskEiiR7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(784) %29, i32 noundef %77, i32 noundef %78, ptr noundef nonnull align 8 dereferenceable(32) %25)
          to label %79 unwind label %84

79:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 64, ptr %28) #5
  %80 = getelementptr inbounds %class.AnisotropicParticleMesher, ptr %29, i32 0, i32 23
  invoke void @_ZN13Polygonizer3dC1EP11ScalarField(ptr noundef nonnull align 8 dereferenceable(57) %28, ptr noundef %80)
          to label %81 unwind label %88

81:                                               ; preds = %79
  invoke void @_ZN13Polygonizer3d18setSurfaceCellMaskEP7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(57) %28, ptr noundef %25)
          to label %82 unwind label %92

82:                                               ; preds = %81
  invoke void @_ZN13Polygonizer3d17polygonizeSurfaceEv(ptr dead_on_unwind writable sret(%class.TriangleMesh) align 8 %0, ptr noundef nonnull align 8 dereferenceable(57) %28)
          to label %83 unwind label %92

83:                                               ; preds = %82
  call void @_ZN13Polygonizer3dD1Ev(ptr noundef nonnull align 8 dereferenceable(57) %28) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %28) #5
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  ret void

84:                                               ; preds = %68
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %26, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %27, align 4
  br label %97

88:                                               ; preds = %79
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %26, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %27, align 4
  br label %96

92:                                               ; preds = %82, %81
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %26, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %27, align 4
  call void @_ZN13Polygonizer3dD1Ev(ptr noundef nonnull align 8 dereferenceable(57) %28) #5
  br label %96

96:                                               ; preds = %92, %88
  call void @llvm.lifetime.end.p0(i64 64, ptr %28) #5
  br label %97

97:                                               ; preds = %96, %84
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %25) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %26, align 8
  %100 = load i32, ptr %27, align 4
  %101 = insertvalue { ptr, i32 } poison, ptr %99, 0
  %102 = insertvalue { ptr, i32 } %101, i32 %100, 1
  resume { ptr, i32 } %102
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher24_computeSliceScalarFieldEiiR16FragmentedVectorIN5vmath4vec3EER8LevelSetR17FluidMaterialGrid(ptr noundef nonnull align 8 dereferenceable(784), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(448), ptr noundef nonnull align 8 dereferenceable(88)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Eiii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher13_getSliceMaskEiiR7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(784), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

declare void @_ZN13Polygonizer3d18setSurfaceCellMaskEP7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(57), ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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 = { 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 #3 = { 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 = { 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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


; 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.TriangleMesh = type { %"class.std::vector.24", %"class.std::vector.24", %"class.std::vector.24", %"class.std::vector.29", i32, i32, i32, double, %"class.std::vector.34", %"class.std::vector.39", %class.Array3d.44 }
%"class.std::vector.24" = type { %"struct.std::_Vector_base.25" }
%"struct.std::_Vector_base.25" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl" = type { %"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" }
%"struct.std::_Vector_base<vmath::vec3, std::allocator<vmath::vec3>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.29" = type { %"struct.std::_Vector_base.30" }
%"struct.std::_Vector_base.30" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl" = type { %"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Triangle, std::allocator<Triangle>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.34" = type { %"struct.std::_Vector_base.35" }
%"struct.std::_Vector_base.35" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.39" = type { %"struct.std::_Vector_base.40" }
%"struct.std::_Vector_base.40" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Array3d.44 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.0", i32, [4 x i8] }>
%"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.23 = type { i32, i32, i32, ptr, i8, i8, i32 }
%class.Polygonizer3d = type <{ i32, i32, i32, [4 x i8], double, double, ptr, i8, [7 x i8], ptr, i8, [7 x i8] }>

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 @_ZN13Polygonizer3dC1EP11ScalarField(ptr noundef nonnull align 8 dereferenceable(57), ptr noundef) unnamed_addr #1

declare void @_ZN13Polygonizer3d17polygonizeSurfaceEv(ptr dead_on_unwind writable sret(%class.TriangleMesh) align 8, ptr noundef nonnull align 8 dereferenceable(57)) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN13Polygonizer3dD1Ev(ptr noundef nonnull align 8 dereferenceable(57)) unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher28_getSubdividedGridDimensionsEPiS0_S0_Pd(ptr noundef nonnull align 8 dereferenceable(784), ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN25AnisotropicParticleMesher16_polygonizeSliceEiiR16FragmentedVectorIN5vmath4vec3EER8LevelSetR17FluidMaterialGrid(ptr dead_on_unwind noalias writable sret(%class.TriangleMesh) align 8 %0, ptr noundef nonnull align 8 dereferenceable(784) %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(448) %5, ptr noundef nonnull align 8 dereferenceable(88) %6) local_unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca %class.Array3d.23, align 8
  %13 = alloca %class.Polygonizer3d, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #5
  call void @_ZN25AnisotropicParticleMesher28_getSubdividedGridDimensionsEPiS0_S0_Pd(ptr noundef nonnull align 8 dereferenceable(784) %1, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %14 = icmp ne i32 %2, 0
  %15 = load i32, ptr %8, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  %17 = icmp ne i32 %16, %3
  %18 = select i1 %14, i1 %17, i1 false
  %19 = sub i32 %3, %2
  %20 = load i32, ptr %9, align 4, !tbaa !5
  %21 = load i32, ptr %10, align 4, !tbaa !5
  %.025.v = select i1 %18, i32 3, i32 2
  %.025 = add nsw i32 %19, %.025.v
  call void @_ZN25AnisotropicParticleMesher24_computeSliceScalarFieldEiiR16FragmentedVectorIN5vmath4vec3EER8LevelSetR17FluidMaterialGrid(ptr noundef nonnull align 8 dereferenceable(784) %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(448) %5, ptr noundef nonnull align 8 dereferenceable(88) %6)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %12) #5
  call void @_ZN7Array3dIbEC2Eiii(ptr noundef nonnull align 8 dereferenceable(32) %12, i32 noundef %.025, i32 noundef %20, i32 noundef %21)
  invoke void @_ZN25AnisotropicParticleMesher13_getSliceMaskEiiR7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(784) %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %22 unwind label %27

22:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %13) #5
  %23 = getelementptr inbounds i8, ptr %1, i64 480
  invoke void @_ZN13Polygonizer3dC1EP11ScalarField(ptr noundef nonnull align 8 dereferenceable(57) %13, ptr noundef nonnull %23)
          to label %24 unwind label %29

24:                                               ; preds = %22
  invoke void @_ZN13Polygonizer3d18setSurfaceCellMaskEP7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(57) %13, ptr noundef nonnull %12)
          to label %25 unwind label %31

25:                                               ; preds = %24
  invoke void @_ZN13Polygonizer3d17polygonizeSurfaceEv(ptr dead_on_unwind writable sret(%class.TriangleMesh) align 8 %0, ptr noundef nonnull align 8 dereferenceable(57) %13)
          to label %26 unwind label %31

26:                                               ; preds = %25
  call void @_ZN13Polygonizer3dD1Ev(ptr noundef nonnull align 8 dereferenceable(57) %13) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %13) #5
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  ret void

27:                                               ; preds = %7
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %34

29:                                               ; preds = %22
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %33

31:                                               ; preds = %25, %24
  %32 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN13Polygonizer3dD1Ev(ptr noundef nonnull align 8 dereferenceable(57) %13) #5
  br label %33

33:                                               ; preds = %31, %29
  %.pn = phi { ptr, i32 } [ %32, %31 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %13) #5
  br label %34

34:                                               ; preds = %33, %27
  %.pn.pn = phi { ptr, i32 } [ %.pn, %33 ], [ %28, %27 ]
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher24_computeSliceScalarFieldEiiR16FragmentedVectorIN5vmath4vec3EER8LevelSetR17FluidMaterialGrid(ptr noundef nonnull align 8 dereferenceable(784), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(448), ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Eiii(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN25AnisotropicParticleMesher13_getSliceMaskEiiR7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(784), i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4 align 2

declare void @_ZN13Polygonizer3d18setSurfaceCellMaskEP7Array3dIbE(ptr noundef nonnull align 8 dereferenceable(57), ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #3 align 2

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 = { 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 #3 = { 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 = { 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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass