; LLVM IR from SourangshuGhosh/Fluid-Simulation-for-Computer-Graphics :: src/levelset.ll (ZN8LevelSet41_calculateUnsignedDistanceSquaredForLayerER15GridIndexVector)

; 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.GridIndex = type { i32, i32, i32 }
%class.LevelSet = type { i32, i32, i32, double, i32, %class.TriangleMesh, %class.Array3d.20, %class.Array3d.22, %class.Array3d.24, %"class.std::vector.10", double, i32, %class.Array3d.24 }
%class.TriangleMesh = type { %"class.std::vector", %"class.std::vector", %"class.std::vector", %"class.std::vector.0", i32, i32, i32, double, %"class.std::vector.5", %"class.std::vector.10", %class.Array3d }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = 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.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.15", i32, [4 x i8] }>
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = 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.20 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>
%class.Array3d.22 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], i32, i32, [4 x i8] }>
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = 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.24 = type { i32, i32, i32, ptr, i8, i8, i32 }

; 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) #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40), i64, i32) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN8LevelSet25_minDistToTriangleSquaredE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(448), i64, i32, i32 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32), i64, i32) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36), i64, i32) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LevelSet16_setLevelSetCellE9GridIndexdi(ptr noundef nonnull align 8 dereferenceable(448), i64, i32, double noundef, i32 noundef) #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64, i32, i32 noundef, i32 noundef, i32 noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Array3dIiEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36), i64, i32) #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8LevelSet41_calculateUnsignedDistanceSquaredForLayerER15GridIndexVector(ptr noundef nonnull align 8 dereferenceable(448) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.GridIndex, align 4
  %6 = alloca %struct.GridIndex, align 4
  %7 = alloca [6 x %struct.GridIndex], align 16
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca %struct.GridIndex, align 4
  %11 = alloca { i64, i32 }, align 8
  %12 = alloca %struct.GridIndex, align 4
  %13 = alloca { i64, i32 }, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.GridIndex, align 4
  %16 = alloca { i64, i32 }, align 4
  %17 = alloca %struct.GridIndex, align 4
  %18 = alloca { i64, i32 }, align 4
  %19 = alloca i32, align 4
  %20 = alloca %struct.GridIndex, align 4
  %21 = alloca { i64, i32 }, align 4
  %22 = alloca %struct.GridIndex, align 4
  %23 = alloca { i64, i32 }, align 4
  %24 = alloca %struct.GridIndex, align 4
  %25 = alloca { i64, i32 }, align 4
  %26 = alloca %struct.GridIndex, align 4
  %27 = alloca { i64, i32 }, align 4
  %28 = alloca %struct.GridIndex, align 4
  %29 = alloca { i64, i32 }, align 4
  %30 = alloca %struct.GridIndex, align 4
  %31 = alloca { i64, i32 }, align 4
  %32 = alloca %struct.GridIndex, align 4
  %33 = alloca { i64, i32 }, align 4
  %34 = alloca %struct.GridIndex, align 4
  %35 = alloca { i64, i32 }, align 4
  %36 = alloca %struct.GridIndex, align 4
  %37 = alloca { i64, i32 }, align 4
  %38 = alloca %struct.GridIndex, align 4
  %39 = alloca { i64, i32 }, align 4
  %40 = alloca %struct.GridIndex, align 4
  %41 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %5)
  call void @llvm.lifetime.start.p0(i64 12, ptr %6) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
  call void @llvm.lifetime.start.p0(i64 72, ptr %7) #7
  %43 = getelementptr inbounds [6 x %struct.GridIndex], ptr %7, i32 0, i32 0
  %44 = getelementptr inbounds %struct.GridIndex, ptr %43, i64 6
  br label %45

45:                                               ; preds = %45, %2
  %46 = phi ptr [ %43, %2 ], [ %47, %45 ]
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %46)
  %47 = getelementptr inbounds %struct.GridIndex, ptr %46, i64 1
  %48 = icmp eq ptr %47, %44
  br i1 %48, label %49, label %45

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store double 0x3EB0C6F7A0B5ED8D, ptr %9, align 8, !tbaa !9
  br label %50

50:                                               ; preds = %176, %49
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = call noundef zeroext i1 @_ZN15GridIndexVector5emptyEv(ptr noundef nonnull align 8 dereferenceable(40) %51)
  %53 = xor i1 %52, true
  br i1 %53, label %54, label %177

54:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #7
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = call { i64, i32 } @_ZN15GridIndexVector4backEv(ptr noundef nonnull align 8 dereferenceable(40) %55)
  store { i64, i32 } %56, ptr %11, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 8 %11, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %10, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #7
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN15GridIndexVector8pop_backEv(ptr noundef nonnull align 8 dereferenceable(40) %57)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !11
  %58 = getelementptr inbounds [6 x %struct.GridIndex], ptr %7, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %12, i64 12, i1 false)
  %59 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 0
  %60 = load i64, ptr %59, align 4
  %61 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 1
  %62 = load i32, ptr %61, align 4
  call void @_ZN8LevelSet25_getNeighbourGridIndices6E9GridIndexPS0_(ptr noundef nonnull align 8 dereferenceable(448) %42, i64 %60, i32 %62, ptr noundef %58)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !12
  br label %63

63:                                               ; preds = %160, %54
  %64 = load i32, ptr %14, align 4, !tbaa !12
  %65 = icmp slt i32 %64, 6
  br i1 %65, label %67, label %66

66:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %163

67:                                               ; preds = %63
  %68 = load i32, ptr %14, align 4, !tbaa !12
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [6 x %struct.GridIndex], ptr %7, i64 0, i64 %69
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %70, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  %71 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 0
  %72 = load i32, ptr %71, align 8, !tbaa !14
  %73 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !43
  %75 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 2
  %76 = load i32, ptr %75, align 8, !tbaa !44
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %15, i64 12, i1 false)
  %77 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 0
  %78 = load i64, ptr %77, align 4
  %79 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 1
  %80 = load i32, ptr %79, align 4
  %81 = call noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64 %78, i32 %80, i32 noundef %72, i32 noundef %74, i32 noundef %76)
  br i1 %81, label %82, label %159

82:                                               ; preds = %67
  %83 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %17, i64 12, i1 false)
  %84 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 0
  %85 = load i64, ptr %84, align 4
  %86 = getelementptr inbounds { i64, i32 }, ptr %18, i32 0, i32 1
  %87 = load i32, ptr %86, align 4
  %88 = call noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %83, i64 %85, i32 %87)
  br i1 %88, label %89, label %159

89:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  %90 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %20, i64 12, i1 false)
  %91 = getelementptr inbounds { i64, i32 }, ptr %21, i32 0, i32 0
  %92 = load i64, ptr %91, align 4
  %93 = getelementptr inbounds { i64, i32 }, ptr %21, i32 0, i32 1
  %94 = load i32, ptr %93, align 4
  %95 = call noundef i32 @_ZN7Array3dIiEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %90, i64 %92, i32 %94)
  store i32 %95, ptr %19, align 4, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  %96 = load i32, ptr %19, align 4, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %22, i64 12, i1 false)
  %97 = getelementptr inbounds { i64, i32 }, ptr %23, i32 0, i32 0
  %98 = load i64, ptr %97, align 4
  %99 = getelementptr inbounds { i64, i32 }, ptr %23, i32 0, i32 1
  %100 = load i32, ptr %99, align 4
  %101 = call noundef double @_ZN8LevelSet25_minDistToTriangleSquaredE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(448) %42, i64 %98, i32 %100, i32 noundef %96)
  store double %101, ptr %8, align 8, !tbaa !9
  %102 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %24, i64 12, i1 false)
  %103 = getelementptr inbounds { i64, i32 }, ptr %25, i32 0, i32 0
  %104 = load i64, ptr %103, align 4
  %105 = getelementptr inbounds { i64, i32 }, ptr %25, i32 0, i32 1
  %106 = load i32, ptr %105, align 4
  %107 = call noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %102, i64 %104, i32 %106)
  br i1 %107, label %108, label %118

108:                                              ; preds = %89
  %109 = load double, ptr %8, align 8, !tbaa !9
  %110 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %27, ptr align 4 %26, i64 12, i1 false)
  %111 = getelementptr inbounds { i64, i32 }, ptr %27, i32 0, i32 0
  %112 = load i64, ptr %111, align 4
  %113 = getelementptr inbounds { i64, i32 }, ptr %27, i32 0, i32 1
  %114 = load i32, ptr %113, align 4
  %115 = call noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %110, i64 %112, i32 %114)
  %116 = fpext float %115 to double
  %117 = fcmp olt double %109, %116
  br i1 %117, label %118, label %125

118:                                              ; preds = %108, %89
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %28, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !11
  %119 = load double, ptr %8, align 8, !tbaa !9
  %120 = load i32, ptr %19, align 4, !tbaa !12
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %29, ptr align 4 %28, i64 12, i1 false)
  %121 = getelementptr inbounds { i64, i32 }, ptr %29, i32 0, i32 0
  %122 = load i64, ptr %121, align 4
  %123 = getelementptr inbounds { i64, i32 }, ptr %29, i32 0, i32 1
  %124 = load i32, ptr %123, align 4
  call void @_ZN8LevelSet16_setLevelSetCellE9GridIndexdi(ptr noundef nonnull align 8 dereferenceable(448) %42, i64 %122, i32 %124, double noundef %119, i32 noundef %120)
  br label %125

125:                                              ; preds = %118, %108
  %126 = load double, ptr %8, align 8, !tbaa !9
  %127 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 4 %30, i64 12, i1 false)
  %128 = getelementptr inbounds { i64, i32 }, ptr %31, i32 0, i32 0
  %129 = load i64, ptr %128, align 4
  %130 = getelementptr inbounds { i64, i32 }, ptr %31, i32 0, i32 1
  %131 = load i32, ptr %130, align 4
  %132 = call noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %127, i64 %129, i32 %131)
  %133 = fpext float %132 to double
  %134 = fcmp olt double %126, %133
  br i1 %134, label %135, label %158

135:                                              ; preds = %125
  %136 = load double, ptr %8, align 8, !tbaa !9
  %137 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %33, ptr align 4 %32, i64 12, i1 false)
  %138 = getelementptr inbounds { i64, i32 }, ptr %33, i32 0, i32 0
  %139 = load i64, ptr %138, align 4
  %140 = getelementptr inbounds { i64, i32 }, ptr %33, i32 0, i32 1
  %141 = load i32, ptr %140, align 4
  %142 = call noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %137, i64 %139, i32 %141)
  %143 = fpext float %142 to double
  %144 = fsub double %136, %143
  %145 = call double @llvm.fabs.f64(double %144)
  %146 = load double, ptr %9, align 8, !tbaa !9
  %147 = fcmp ogt double %145, %146
  br i1 %147, label %148, label %158

148:                                              ; preds = %135
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %34, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %35, ptr align 4 %34, i64 12, i1 false)
  %149 = getelementptr inbounds { i64, i32 }, ptr %35, i32 0, i32 0
  %150 = load i64, ptr %149, align 4
  %151 = getelementptr inbounds { i64, i32 }, ptr %35, i32 0, i32 1
  %152 = load i32, ptr %151, align 4
  call void @_ZN8LevelSet18_resetLevelSetCellE9GridIndex(ptr noundef nonnull align 8 dereferenceable(448) %42, i64 %150, i32 %152)
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %36, i64 12, i1 false)
  %154 = getelementptr inbounds { i64, i32 }, ptr %37, i32 0, i32 0
  %155 = load i64, ptr %154, align 4
  %156 = getelementptr inbounds { i64, i32 }, ptr %37, i32 0, i32 1
  %157 = load i32, ptr %156, align 4
  call void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %153, i64 %155, i32 %157)
  br label %158

158:                                              ; preds = %148, %135, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  br label %159

159:                                              ; preds = %158, %82, %67
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %14, align 4, !tbaa !12
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %14, align 4, !tbaa !12
  br label %63, !llvm.loop !45

163:                                              ; preds = %66
  %164 = getelementptr inbounds %class.LevelSet, ptr %42, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %38, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %39, ptr align 4 %38, i64 12, i1 false)
  %165 = getelementptr inbounds { i64, i32 }, ptr %39, i32 0, i32 0
  %166 = load i64, ptr %165, align 4
  %167 = getelementptr inbounds { i64, i32 }, ptr %39, i32 0, i32 1
  %168 = load i32, ptr %167, align 4
  %169 = call noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %164, i64 %166, i32 %168)
  br i1 %169, label %176, label %170

170:                                              ; preds = %163
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %40, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %41, ptr align 4 %40, i64 12, i1 false)
  %172 = getelementptr inbounds { i64, i32 }, ptr %41, i32 0, i32 0
  %173 = load i64, ptr %172, align 4
  %174 = getelementptr inbounds { i64, i32 }, ptr %41, i32 0, i32 1
  %175 = load i32, ptr %174, align 4
  call void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %171, i64 %173, i32 %175)
  br label %176

176:                                              ; preds = %170, %163
  br label %50, !llvm.loop !47

177:                                              ; preds = %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #7
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN15GridIndexVector5emptyEv(ptr noundef nonnull align 8 dereferenceable(40)) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN15GridIndexVector4backEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

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

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"_ZTS8LevelSet", !13, i64 0, !13, i64 4, !13, i64 8, !10, i64 16, !13, i64 24, !16, i64 32, !39, i64 264, !41, i64 304, !42, i64 344, !29, i64 376, !10, i64 400, !13, i64 408, !42, i64 416}
!16 = !{!"_ZTS12TriangleMesh", !17, i64 0, !17, i64 24, !17, i64 48, !21, i64 72, !13, i64 96, !13, i64 100, !13, i64 104, !10, i64 112, !25, i64 120, !29, i64 144, !33, i64 168}
!17 = !{!"_ZTSSt6vectorIN5vmath4vec3ESaIS1_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN5vmath4vec3ESaIS1_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!"_ZTSSt6vectorI8TriangleSaIS0_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseI8TriangleSaIS0_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !26, i64 0}
!26 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!29 = !{!"_ZTSSt6vectorIdSaIdEE", !30, i64 0}
!30 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!33 = !{!"_ZTS7Array3dISt6vectorIiSaIiEEE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !34, i64 24, !35, i64 32, !13, i64 56}
!34 = !{!"bool", !7, i64 0}
!35 = !{!"_ZTSSt6vectorIiSaIiEE", !36, i64 0}
!36 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !37, i64 0}
!37 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !38, i64 0}
!38 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!39 = !{!"_ZTS7Array3dIfE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !34, i64 24, !40, i64 28, !13, i64 32}
!40 = !{!"float", !7, i64 0}
!41 = !{!"_ZTS7Array3dIiE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !34, i64 24, !13, i64 28, !13, i64 32}
!42 = !{!"_ZTS7Array3dIbE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !34, i64 24, !34, i64 25, !13, i64 28}
!43 = !{!15, !13, i64 4}
!44 = !{!15, !13, i64 8}
!45 = distinct !{!45, !46}
!46 = !{!"llvm.loop.mustprogress"}
!47 = distinct !{!47, !46}


; 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.GridIndex = type { i32, i32, i32 }

; 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) #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40), i64, i32) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN8LevelSet25_minDistToTriangleSquaredE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(448), i64, i32, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32), i64, i32) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36), i64, i32) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8LevelSet16_setLevelSetCellE9GridIndexdi(ptr noundef nonnull align 8 dereferenceable(448), i64, i32, double noundef, i32 noundef) local_unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64, i32, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Array3dIiEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36), i64, i32) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8LevelSet41_calculateUnsignedDistanceSquaredForLayerER15GridIndexVector(ptr noundef nonnull align 8 dereferenceable(448) %0, ptr noundef nonnull align 8 dereferenceable(40) %1) local_unnamed_addr #4 align 2 {
.preheader:
  %2 = alloca %struct.GridIndex, align 8
  %3 = alloca %struct.GridIndex, align 8
  %4 = alloca [6 x %struct.GridIndex], align 16
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %3)
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %4) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
  %.ptr.1 = getelementptr inbounds i8, ptr %4, i64 12
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %4, i64 24
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %4, i64 36
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %4, i64 48
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %4, i64 60
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5)
  %5 = call noundef zeroext i1 @_ZN15GridIndexVector5emptyEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  br i1 %5, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.251.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = getelementptr inbounds i8, ptr %0, i64 344
  %9 = getelementptr inbounds i8, ptr %0, i64 304
  %10 = getelementptr inbounds i8, ptr %0, i64 264
  br label %11

11:                                               ; preds = %.lr.ph, %45
  %12 = call { i64, i32 } @_ZN15GridIndexVector4backEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %.fca.0.extract = extractvalue { i64, i32 } %12, 0
  %.fca.1.extract = extractvalue { i64, i32 } %12, 1
  store i64 %.fca.0.extract, ptr %2, align 8
  store i32 %.fca.1.extract, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN15GridIndexVector8pop_backEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  %.sroa.057.0.copyload = load i64, ptr %2, align 8
  %.sroa.258.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN8LevelSet25_getNeighbourGridIndices6E9GridIndexPS0_(ptr noundef nonnull align 8 dereferenceable(448) %0, i64 %.sroa.057.0.copyload, i32 %.sroa.258.0.copyload, ptr noundef nonnull %4)
  br label %15

13:                                               ; preds = %43
  %.sroa.05.0.copyload = load i64, ptr %2, align 8
  %.sroa.26.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 %.sroa.05.0.copyload, i32 %.sroa.26.0.copyload)
  br i1 %14, label %45, label %44

15:                                               ; preds = %11, %43
  %indvars.iv = phi i64 [ 0, %11 ], [ %indvars.iv.next, %43 ]
  %16 = getelementptr inbounds [6 x %struct.GridIndex], ptr %4, i64 0, i64 %indvars.iv
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %3, ptr noundef nonnull align 4 dereferenceable(12) %16, i64 12, i1 false), !tbaa.struct !9
  %.sroa.050.0.copyload = load i64, ptr %3, align 8
  %.sroa.251.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  %17 = load i32, ptr %0, align 8, !tbaa !10
  %18 = load i32, ptr %6, align 4, !tbaa !41
  %19 = load i32, ptr %7, align 8, !tbaa !42
  %20 = call noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64 %.sroa.050.0.copyload, i32 %.sroa.251.0.copyload, i32 noundef %17, i32 noundef %18, i32 noundef %19)
  br i1 %20, label %21, label %43

21:                                               ; preds = %15
  %.sroa.046.0.copyload = load i64, ptr %3, align 8
  %.sroa.247.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  %22 = call noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 %.sroa.046.0.copyload, i32 %.sroa.247.0.copyload)
  br i1 %22, label %23, label %43

23:                                               ; preds = %21
  %.sroa.041.0.copyload = load i64, ptr %3, align 8
  %.sroa.242.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  %24 = call noundef i32 @_ZN7Array3dIiEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %9, i64 %.sroa.041.0.copyload, i32 %.sroa.242.0.copyload)
  %.sroa.037.0.copyload = load i64, ptr %3, align 8
  %.sroa.238.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  %25 = call noundef double @_ZN8LevelSet25_minDistToTriangleSquaredE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(448) %0, i64 %.sroa.037.0.copyload, i32 %.sroa.238.0.copyload, i32 noundef %24)
  %.sroa.033.0.copyload = load i64, ptr %2, align 8
  %.sroa.234.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  %26 = call noundef zeroext i1 @_ZN7Array3dIbEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(32) %8, i64 %.sroa.033.0.copyload, i32 %.sroa.234.0.copyload)
  br i1 %26, label %27, label %31

27:                                               ; preds = %23
  %.sroa.029.0.copyload = load i64, ptr %2, align 8
  %.sroa.230.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  %28 = call noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %10, i64 %.sroa.029.0.copyload, i32 %.sroa.230.0.copyload)
  %29 = fpext float %28 to double
  %30 = fcmp olt double %25, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %27, %23
  %.sroa.025.0.copyload = load i64, ptr %2, align 8
  %.sroa.226.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN8LevelSet16_setLevelSetCellE9GridIndexdi(ptr noundef nonnull align 8 dereferenceable(448) %0, i64 %.sroa.025.0.copyload, i32 %.sroa.226.0.copyload, double noundef %25, i32 noundef %24)
  br label %32

32:                                               ; preds = %31, %27
  %.sroa.021.0.copyload = load i64, ptr %3, align 8
  %.sroa.222.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  %33 = call noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %10, i64 %.sroa.021.0.copyload, i32 %.sroa.222.0.copyload)
  %34 = fpext float %33 to double
  %35 = fcmp olt double %25, %34
  br i1 %35, label %36, label %43

36:                                               ; preds = %32
  %.sroa.017.0.copyload = load i64, ptr %3, align 8
  %.sroa.218.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  %37 = call noundef float @_ZN7Array3dIfEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(36) %10, i64 %.sroa.017.0.copyload, i32 %.sroa.218.0.copyload)
  %38 = fpext float %37 to double
  %39 = fsub double %25, %38
  %40 = call double @llvm.fabs.f64(double %39)
  %41 = fcmp ogt double %40, 0x3EB0C6F7A0B5ED8D
  br i1 %41, label %42, label %43

42:                                               ; preds = %36
  %.sroa.013.0.copyload = load i64, ptr %3, align 8
  %.sroa.214.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN8LevelSet18_resetLevelSetCellE9GridIndex(ptr noundef nonnull align 8 dereferenceable(448) %0, i64 %.sroa.013.0.copyload, i32 %.sroa.214.0.copyload)
  %.sroa.09.0.copyload = load i64, ptr %3, align 8
  %.sroa.210.0.copyload = load i32, ptr %.sroa.251.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 %.sroa.09.0.copyload, i32 %.sroa.210.0.copyload)
  br label %43

43:                                               ; preds = %32, %36, %42, %15, %21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 6
  br i1 %exitcond.not, label %13, label %15, !llvm.loop !43

44:                                               ; preds = %13
  %.sroa.01.0.copyload = load i64, ptr %2, align 8
  %.sroa.22.0.copyload = load i32, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !5
  call void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 %.sroa.01.0.copyload, i32 %.sroa.22.0.copyload)
  br label %45

45:                                               ; preds = %44, %13
  %46 = call noundef zeroext i1 @_ZN15GridIndexVector5emptyEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  br i1 %46, label %._crit_edge, label %11, !llvm.loop !45

._crit_edge:                                      ; preds = %45, %.preheader
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #7
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN15GridIndexVector5emptyEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN15GridIndexVector4backEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

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

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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"}
!9 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5}
!10 = !{!11, !6, i64 0}
!11 = !{!"_ZTS8LevelSet", !6, i64 0, !6, i64 4, !6, i64 8, !12, i64 16, !6, i64 24, !13, i64 32, !37, i64 264, !39, i64 304, !40, i64 344, !27, i64 376, !12, i64 400, !6, i64 408, !40, i64 416}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTS12TriangleMesh", !14, i64 0, !14, i64 24, !14, i64 48, !19, i64 72, !6, i64 96, !6, i64 100, !6, i64 104, !12, i64 112, !23, i64 120, !27, i64 144, !31, i64 168}
!14 = !{!"_ZTSSt6vectorIN5vmath4vec3ESaIS1_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIN5vmath4vec3ESaIS1_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN5vmath4vec3ESaIS1_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!"_ZTSSt6vectorI8TriangleSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseI8TriangleSaIS0_EE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseI8TriangleSaIS0_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!23 = !{!"_ZTSSt6vectorIS_IiSaIiEESaIS1_EE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseISt6vectorIiSaIiEESaIS2_EE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!27 = !{!"_ZTSSt6vectorIdSaIdEE", !28, i64 0}
!28 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!31 = !{!"_ZTS7Array3dISt6vectorIiSaIiEEE", !6, i64 0, !6, i64 4, !6, i64 8, !18, i64 16, !32, i64 24, !33, i64 32, !6, i64 56}
!32 = !{!"bool", !7, i64 0}
!33 = !{!"_ZTSSt6vectorIiSaIiEE", !34, i64 0}
!34 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !35, i64 0}
!35 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !36, i64 0}
!36 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !18, i64 0, !18, i64 8, !18, i64 16}
!37 = !{!"_ZTS7Array3dIfE", !6, i64 0, !6, i64 4, !6, i64 8, !18, i64 16, !32, i64 24, !38, i64 28, !6, i64 32}
!38 = !{!"float", !7, i64 0}
!39 = !{!"_ZTS7Array3dIiE", !6, i64 0, !6, i64 4, !6, i64 8, !18, i64 16, !32, i64 24, !6, i64 28, !6, i64 32}
!40 = !{!"_ZTS7Array3dIbE", !6, i64 0, !6, i64 4, !6, i64 8, !18, i64 16, !32, i64 24, !32, i64 25, !6, i64 28}
!41 = !{!11, !6, i64 4}
!42 = !{!11, !6, i64 8}
!43 = distinct !{!43, !44}
!44 = !{!"llvm.loop.mustprogress"}
!45 = distinct !{!45, !44}


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