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

; 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 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%struct.GridIndex = type { i32, i32, i32 }
%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.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 = 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 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Grid3d18getGridIndexBoundsE4AABBdiiiP9GridIndexS2_(ptr noundef, double noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5utils26getCellsInsideTriangleMeshER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EE(ptr noundef nonnull align 8 dereferenceable(232), i32 noundef, i32 noundef, i32 noundef, double noundef, ptr noundef nonnull align 8 dereferenceable(24)) #5

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

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

declare void @_ZN4AABBC1ERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef, double noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Grid3d19GridIndexToPositionE9GridIndexd(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4, i64, i32, double noundef) #4

declare void @_ZN12TriangleMesh9translateEN5vmath4vec3E(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef) #6

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

declare noundef nonnull align 4 dereferenceable(12) ptr @_ZN5vmathmIERNS_4vec3ERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5utils26getCellsInsideTriangleMeshE12TriangleMeshdRSt6vectorI9GridIndexSaIS2_EE(ptr noundef %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #5 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.AABB, align 8
  %8 = alloca %struct.GridIndex, align 4
  %9 = alloca %"class.vmath::vec3", align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca { i64, i32 }, align 8
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca %struct.GridIndex, align 4
  %15 = alloca { i64, i32 }, align 4
  %16 = alloca %"class.vmath::vec3", align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.GridIndex, align 4
  %19 = alloca %struct.GridIndex, align 4
  %20 = alloca %class.AABB, align 8
  %21 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %7) #7
  %22 = getelementptr inbounds %class.TriangleMesh, ptr %0, i32 0, i32 0
  call void @_ZN4AABBC1ERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(40) %7, ptr noundef nonnull align 8 dereferenceable(24) %22)
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #7
  %23 = getelementptr inbounds %class.AABB, ptr %7, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 8 %23, i64 12, i1 false), !tbaa.struct !11
  %24 = load double, ptr %5, align 8, !tbaa !9
  %25 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef %9, double noundef %24)
          to label %26 unwind label %65

26:                                               ; preds = %3
  store { i64, i32 } %25, ptr %12, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %12, i64 12, i1 false)
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %8, i64 12, i1 false), !tbaa.struct !14
  %27 = load double, ptr %5, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %14, i64 12, i1 false)
  %28 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 0
  %29 = load i64, ptr %28, align 4
  %30 = getelementptr inbounds { i64, i32 }, ptr %15, i32 0, i32 1
  %31 = load i32, ptr %30, align 4
  invoke void @_ZN6Grid3d19GridIndexToPositionE9GridIndexd(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %13, i64 %29, i32 %31, double noundef %27)
          to label %32 unwind label %69

32:                                               ; preds = %26
  invoke void @_ZN5vmathngERKNS_4vec3E(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %16, ptr noundef nonnull align 4 dereferenceable(12) %13)
          to label %33 unwind label %73

33:                                               ; preds = %32
  invoke void @_ZN12TriangleMesh9translateEN5vmath4vec3E(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef %16)
          to label %34 unwind label %77

34:                                               ; preds = %33
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %16) #7
  %35 = getelementptr inbounds %class.AABB, ptr %7, i32 0, i32 0
  %36 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN5vmathmIERNS_4vec3ERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %35, ptr noundef nonnull align 4 dereferenceable(12) %13)
          to label %37 unwind label %73

37:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %38 = call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #7
  store i32 %38, ptr %17, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %18)
          to label %39 unwind label %81

39:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %19)
          to label %40 unwind label %85

40:                                               ; preds = %39
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %7, i64 40, i1 false), !tbaa.struct !17
  %41 = load double, ptr %5, align 8, !tbaa !9
  %42 = load i32, ptr %17, align 4, !tbaa !15
  %43 = load i32, ptr %17, align 4, !tbaa !15
  %44 = load i32, ptr %17, align 4, !tbaa !15
  invoke void @_ZN6Grid3d18getGridIndexBoundsE4AABBdiiiP9GridIndexS2_(ptr noundef %20, double noundef %41, i32 noundef %42, i32 noundef %43, i32 noundef %44, ptr noundef %18, ptr noundef %19)
          to label %45 unwind label %89

45:                                               ; preds = %40
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %20) #7
  %46 = getelementptr inbounds %struct.GridIndex, ptr %19, i32 0, i32 0
  %47 = load i32, ptr %46, align 4, !tbaa !18
  %48 = add nsw i32 %47, 1
  %49 = getelementptr inbounds %struct.GridIndex, ptr %19, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !20
  %51 = add nsw i32 %50, 1
  %52 = getelementptr inbounds %struct.GridIndex, ptr %19, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !21
  %54 = add nsw i32 %53, 1
  %55 = load double, ptr %5, align 8, !tbaa !9
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN5utils26getCellsInsideTriangleMeshER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EE(ptr noundef nonnull align 8 dereferenceable(232) %0, i32 noundef %48, i32 noundef %51, i32 noundef %54, double noundef %55, ptr noundef nonnull align 8 dereferenceable(24) %56)
          to label %57 unwind label %85

57:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  store i32 0, ptr %21, align 4, !tbaa !15
  br label %58

58:                                               ; preds = %136, %57
  %59 = load i32, ptr %21, align 4, !tbaa !15
  %60 = zext i32 %59 to i64
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %61) #7
  %63 = icmp ult i64 %60, %62
  br i1 %63, label %93, label %64

64:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %139

65:                                               ; preds = %3
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %10, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #7
  br label %144

69:                                               ; preds = %26
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %10, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %11, align 4
  br label %143

73:                                               ; preds = %34, %32
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %10, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %11, align 4
  br label %142

77:                                               ; preds = %33
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %10, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %16) #7
  br label %142

81:                                               ; preds = %37
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %10, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %11, align 4
  br label %141

85:                                               ; preds = %45, %39
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %10, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %11, align 4
  br label %140

89:                                               ; preds = %40
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %10, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %11, align 4
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %20) #7
  br label %140

93:                                               ; preds = %58
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = load i32, ptr %21, align 4, !tbaa !15
  %96 = zext i32 %95 to i64
  %97 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %94, i64 noundef %96) #7
  %98 = getelementptr inbounds %struct.GridIndex, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 4, !tbaa !18
  %100 = getelementptr inbounds %struct.GridIndex, ptr %8, i32 0, i32 0
  %101 = load i32, ptr %100, align 4, !tbaa !18
  %102 = add nsw i32 %99, %101
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = load i32, ptr %21, align 4, !tbaa !15
  %105 = zext i32 %104 to i64
  %106 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %105) #7
  %107 = getelementptr inbounds %struct.GridIndex, ptr %106, i32 0, i32 0
  store i32 %102, ptr %107, align 4, !tbaa !18
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = load i32, ptr %21, align 4, !tbaa !15
  %110 = zext i32 %109 to i64
  %111 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %108, i64 noundef %110) #7
  %112 = getelementptr inbounds %struct.GridIndex, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %112, align 4, !tbaa !20
  %114 = getelementptr inbounds %struct.GridIndex, ptr %8, i32 0, i32 1
  %115 = load i32, ptr %114, align 4, !tbaa !20
  %116 = add nsw i32 %113, %115
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = load i32, ptr %21, align 4, !tbaa !15
  %119 = zext i32 %118 to i64
  %120 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %117, i64 noundef %119) #7
  %121 = getelementptr inbounds %struct.GridIndex, ptr %120, i32 0, i32 1
  store i32 %116, ptr %121, align 4, !tbaa !20
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = load i32, ptr %21, align 4, !tbaa !15
  %124 = zext i32 %123 to i64
  %125 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %122, i64 noundef %124) #7
  %126 = getelementptr inbounds %struct.GridIndex, ptr %125, i32 0, i32 2
  %127 = load i32, ptr %126, align 4, !tbaa !21
  %128 = getelementptr inbounds %struct.GridIndex, ptr %8, i32 0, i32 2
  %129 = load i32, ptr %128, align 4, !tbaa !21
  %130 = add nsw i32 %127, %129
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = load i32, ptr %21, align 4, !tbaa !15
  %133 = zext i32 %132 to i64
  %134 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %131, i64 noundef %133) #7
  %135 = getelementptr inbounds %struct.GridIndex, ptr %134, i32 0, i32 2
  store i32 %130, ptr %135, align 4, !tbaa !21
  br label %136

136:                                              ; preds = %93
  %137 = load i32, ptr %21, align 4, !tbaa !15
  %138 = add i32 %137, 1
  store i32 %138, ptr %21, align 4, !tbaa !15
  br label %58, !llvm.loop !22

139:                                              ; preds = %64
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #7
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %7) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #7
  ret void

140:                                              ; preds = %89, %85
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  br label %141

141:                                              ; preds = %140, %81
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %142

142:                                              ; preds = %141, %77, %73
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #7
  br label %143

143:                                              ; preds = %142, %69
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  br label %144

144:                                              ; preds = %143, %65
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #7
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %7) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %7) #7
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %10, align 8
  %147 = load i32, ptr %11, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149
}

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


; 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 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%struct.GridIndex = type { i32, i32, i32 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Grid3d18getGridIndexBoundsE4AABBdiiiP9GridIndexS2_(ptr noundef, double noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5utils26getCellsInsideTriangleMeshER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EE(ptr noundef nonnull align 8 dereferenceable(232), i32 noundef, i32 noundef, i32 noundef, double noundef, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5

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

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

declare void @_ZN4AABBC1ERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef, double noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6Grid3d19GridIndexToPositionE9GridIndexd(ptr dead_on_unwind noalias writable sret(%"class.vmath::vec3") align 4, i64, i32, double noundef) local_unnamed_addr #4

declare void @_ZN12TriangleMesh9translateEN5vmath4vec3E(ptr noundef nonnull align 8 dereferenceable(232), ptr noundef) local_unnamed_addr #6

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

declare noundef nonnull align 4 dereferenceable(12) ptr @_ZN5vmathmIERNS_4vec3ERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5utils26getCellsInsideTriangleMeshE12TriangleMeshdRSt6vectorI9GridIndexSaIS2_EE(ptr noundef nonnull %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #5 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.AABB, align 8
  %5 = alloca %"class.vmath::vec3", align 4
  %6 = alloca %"class.vmath::vec3", align 4
  %7 = alloca %"class.vmath::vec3", align 4
  %8 = alloca %struct.GridIndex, align 4
  %9 = alloca %struct.GridIndex, align 4
  %10 = alloca %class.AABB, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #7
  call void @_ZN4AABBC1ERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(24) %0)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 8 dereferenceable(12) %4, i64 12, i1 false), !tbaa.struct !5
  %11 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef nonnull %5, double noundef %1)
          to label %12 unwind label %29

12:                                               ; preds = %3
  %.fca.0.extract = extractvalue { i64, i32 } %11, 0
  %.fca.1.extract = extractvalue { i64, i32 } %11, 1
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  invoke void @_ZN6Grid3d19GridIndexToPositionE9GridIndexd(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %6, i64 %.fca.0.extract, i32 %.fca.1.extract, double noundef %1)
          to label %13 unwind label %31

13:                                               ; preds = %12
  invoke void @_ZN5vmathngERKNS_4vec3E(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %7, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %14 unwind label %33

14:                                               ; preds = %13
  invoke void @_ZN12TriangleMesh9translateEN5vmath4vec3E(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull %7)
          to label %15 unwind label %35

15:                                               ; preds = %14
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #7
  %16 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN5vmathmIERNS_4vec3ERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %17 unwind label %33

17:                                               ; preds = %15
  %18 = call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %8)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %9)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %10, ptr noundef nonnull align 8 dereferenceable(40) %4, i64 40, i1 false), !tbaa.struct !10
  invoke void @_ZN6Grid3d18getGridIndexBoundsE4AABBdiiiP9GridIndexS2_(ptr noundef nonnull %10, double noundef %1, i32 noundef %18, i32 noundef %18, i32 noundef %18, ptr noundef nonnull %8, ptr noundef nonnull %9)
          to label %19 unwind label %39

19:                                               ; preds = %17
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #7
  %20 = load i32, ptr %9, align 4, !tbaa !13
  %21 = add nsw i32 %20, 1
  %22 = getelementptr inbounds i8, ptr %9, i64 4
  %23 = load i32, ptr %22, align 4, !tbaa !16
  %24 = add nsw i32 %23, 1
  %25 = getelementptr inbounds i8, ptr %9, i64 8
  %26 = load i32, ptr %25, align 4, !tbaa !17
  %27 = add nsw i32 %26, 1
  invoke void @_ZN5utils26getCellsInsideTriangleMeshER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EE(ptr noundef nonnull align 8 dereferenceable(232) %0, i32 noundef %21, i32 noundef %24, i32 noundef %27, double noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2)
          to label %.preheader unwind label %37

.preheader:                                       ; preds = %19
  %28 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %.not = icmp eq i64 %28, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %.sroa.016.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  %.sroa.016.4.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.016.4.extract.trunc = trunc nuw i64 %.sroa.016.4.extract.shift to i32
  br label %41

._crit_edge:                                      ; preds = %41, %.preheader
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  ret void

29:                                               ; preds = %3
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  br label %66

31:                                               ; preds = %12
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %65

33:                                               ; preds = %15, %13
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %64

35:                                               ; preds = %14
  %36 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #7
  br label %64

37:                                               ; preds = %19
  %38 = landingpad { ptr, i32 }
          cleanup
  br label %63

39:                                               ; preds = %17
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %10) #7
  br label %63

41:                                               ; preds = %.lr.ph, %41
  %42 = phi i64 [ 0, %.lr.ph ], [ %60, %41 ]
  %.041 = phi i32 [ 0, %.lr.ph ], [ %59, %41 ]
  %43 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %42) #7
  %44 = load i32, ptr %43, align 4, !tbaa !13
  %45 = add nsw i32 %44, %.sroa.016.0.extract.trunc
  %46 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %42) #7
  store i32 %45, ptr %46, align 4, !tbaa !13
  %47 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %42) #7
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = add nsw i32 %49, %.sroa.016.4.extract.trunc
  %51 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %42) #7
  %52 = getelementptr inbounds i8, ptr %51, i64 4
  store i32 %50, ptr %52, align 4, !tbaa !16
  %53 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %42) #7
  %54 = getelementptr inbounds i8, ptr %53, i64 8
  %55 = load i32, ptr %54, align 4, !tbaa !17
  %56 = add nsw i32 %55, %.fca.1.extract
  %57 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %42) #7
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  store i32 %56, ptr %58, align 4, !tbaa !17
  %59 = add i32 %.041, 1
  %60 = zext i32 %59 to i64
  %61 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  %62 = icmp ugt i64 %61, %60
  br i1 %62, label %41, label %._crit_edge, !llvm.loop !18

63:                                               ; preds = %39, %37
  %.pn = phi { ptr, i32 } [ %38, %37 ], [ %40, %39 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  br label %64

64:                                               ; preds = %63, %35, %33
  %.pn.pn = phi { ptr, i32 } [ %.pn, %63 ], [ %34, %33 ], [ %36, %35 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #7
  br label %65

65:                                               ; preds = %64, %31
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %64 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %66

66:                                               ; preds = %65, %29
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %65 ], [ %30, %29 ]
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn.pn.pn.pn
}

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


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