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

; 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.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 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%struct.GridIndex = type { i32, i32, i32 }
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl" }
%"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.25" = type { %"struct.std::_Vector_base.26" }
%"struct.std::_Vector_base.26" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.GridIndex_t = type { i32, i32, i32 }

@_ZN9CBindings7SUCCESSE = external global i32, align 4

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

declare void @_ZN12TriangleMeshC1Ev(ptr noundef nonnull align 8 dereferenceable(232)) unnamed_addr #1

declare void @_ZN5utils20structToTriangleMeshERNS_14TriangleMesh_tER12TriangleMesh(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(232)) #1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef, double noundef) #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 @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) 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) #2

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

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

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

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

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

; 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 @_ZN12TriangleMeshD1Ev(ptr noundef nonnull align 8 dereferenceable(232)) unnamed_addr #4

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI9GridIndexSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #5 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) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI9GridIndexSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @utils_get_triangle_mesh_cells_subd2(ptr noundef %0, double noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, ptr noundef %5, ptr noundef %6) #6 personality ptr @__gxx_personality_v0 {
  %8 = alloca ptr, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca %class.TriangleMesh, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %class.AABB, align 8
  %19 = alloca %struct.GridIndex, align 4
  %20 = alloca %"class.vmath::vec3", align 4
  %21 = alloca { i64, i32 }, align 8
  %22 = alloca %"class.vmath::vec3", align 4
  %23 = alloca %struct.GridIndex, align 4
  %24 = alloca { i64, i32 }, align 4
  %25 = alloca %"class.vmath::vec3", align 4
  %26 = alloca i32, align 4
  %27 = alloca %struct.GridIndex, align 4
  %28 = alloca %struct.GridIndex, align 4
  %29 = alloca %class.AABB, align 8
  %30 = alloca %"class.std::vector.20", align 8
  %31 = alloca %"class.std::vector.25", align 8
  %32 = alloca %struct.GridIndex, align 4
  %33 = alloca i32, align 4
  %34 = alloca %struct.GridIndex_t, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store double %1, ptr %9, align 8, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store i32 %4, ptr %12, align 4, !tbaa !11
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 232, ptr %15) #7
  call void @_ZN12TriangleMeshC1Ev(ptr noundef nonnull align 8 dereferenceable(232) %15)
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN5utils20structToTriangleMeshERNS_14TriangleMesh_tER12TriangleMesh(ptr noundef nonnull align 8 dereferenceable(24) %35, ptr noundef nonnull align 8 dereferenceable(232) %15)
          to label %36 unwind label %86

36:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 40, ptr %18) #7
  %37 = getelementptr inbounds %class.TriangleMesh, ptr %15, i32 0, i32 0
  invoke void @_ZN4AABBC1ERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(40) %18, ptr noundef nonnull align 8 dereferenceable(24) %37)
          to label %38 unwind label %90

38:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #7
  %39 = getelementptr inbounds %class.AABB, ptr %18, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 8 %39, i64 12, i1 false), !tbaa.struct !13
  %40 = load double, ptr %9, align 8, !tbaa !9
  %41 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef %20, double noundef %40)
          to label %42 unwind label %94

42:                                               ; preds = %38
  store { i64, i32 } %41, ptr %21, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 8 %21, i64 12, i1 false)
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %20) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %19, i64 12, i1 false), !tbaa.struct !16
  %43 = load double, ptr %9, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %44 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 0
  %45 = load i64, ptr %44, align 4
  %46 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 1
  %47 = load i32, ptr %46, align 4
  invoke void @_ZN6Grid3d19GridIndexToPositionE9GridIndexd(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %22, i64 %45, i32 %47, double noundef %43)
          to label %48 unwind label %98

48:                                               ; preds = %42
  invoke void @_ZN5vmathngERKNS_4vec3E(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %25, ptr noundef nonnull align 4 dereferenceable(12) %22)
          to label %49 unwind label %102

49:                                               ; preds = %48
  invoke void @_ZN12TriangleMesh9translateEN5vmath4vec3E(ptr noundef nonnull align 8 dereferenceable(232) %15, ptr noundef %25)
          to label %50 unwind label %106

50:                                               ; preds = %49
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %25) #7
  %51 = getelementptr inbounds %class.AABB, ptr %18, i32 0, i32 0
  %52 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN5vmathmIERNS_4vec3ERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %51, ptr noundef nonnull align 4 dereferenceable(12) %22)
          to label %53 unwind label %102

53:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #7
  %54 = call noundef i32 @_ZNSt14numeric_limitsIiE3maxEv() #7
  store i32 %54, ptr %26, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %27)
          to label %55 unwind label %110

55:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 12, ptr %28) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %28)
          to label %56 unwind label %114

56:                                               ; preds = %55
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %29, ptr align 8 %18, i64 40, i1 false), !tbaa.struct !17
  %57 = load double, ptr %9, align 8, !tbaa !9
  %58 = load i32, ptr %26, align 4, !tbaa !11
  %59 = load i32, ptr %26, align 4, !tbaa !11
  %60 = load i32, ptr %26, align 4, !tbaa !11
  invoke void @_ZN6Grid3d18getGridIndexBoundsE4AABBdiiiP9GridIndexS2_(ptr noundef %29, double noundef %57, i32 noundef %58, i32 noundef %59, i32 noundef %60, ptr noundef %27, ptr noundef %28)
          to label %61 unwind label %118

61:                                               ; preds = %56
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %29) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %30) #7
  call void @_ZNSt6vectorI9GridIndexSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %30) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr %31) #7
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %31) #7
  %62 = load i32, ptr %12, align 4, !tbaa !11
  %63 = sext i32 %62 to i64
  invoke void @_ZNSt6vectorI9GridIndexSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %63)
          to label %64 unwind label %122

64:                                               ; preds = %61
  %65 = load i32, ptr %12, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  invoke void @_ZNSt6vectorIhSaIhEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %66)
          to label %67 unwind label %122

67:                                               ; preds = %64
  %68 = getelementptr inbounds %struct.GridIndex, ptr %28, i32 0, i32 0
  %69 = load i32, ptr %68, align 4, !tbaa !18
  %70 = add nsw i32 %69, 1
  %71 = getelementptr inbounds %struct.GridIndex, ptr %28, i32 0, i32 1
  %72 = load i32, ptr %71, align 4, !tbaa !20
  %73 = add nsw i32 %72, 1
  %74 = getelementptr inbounds %struct.GridIndex, ptr %28, i32 0, i32 2
  %75 = load i32, ptr %74, align 4, !tbaa !21
  %76 = add nsw i32 %75, 1
  %77 = load double, ptr %9, align 8, !tbaa !9
  invoke void @_ZN5utils31getCellsInsideTriangleMeshSubd2ER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EERS2_IhSaIhEE(ptr noundef nonnull align 8 dereferenceable(232) %15, i32 noundef %70, i32 noundef %73, i32 noundef %76, double noundef %77, ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 8 dereferenceable(24) %31)
          to label %78 unwind label %122

78:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 12, ptr %32) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %32)
          to label %79 unwind label %126

79:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #7
  store i32 0, ptr %33, align 4, !tbaa !11
  br label %80

80:                                               ; preds = %164, %79
  %81 = load i32, ptr %33, align 4, !tbaa !11
  %82 = zext i32 %81 to i64
  %83 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %30) #7
  %84 = icmp ult i64 %82, %83
  br i1 %84, label %130, label %85

85:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #7
  br label %167

86:                                               ; preds = %7
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %16, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %17, align 4
  br label %180

90:                                               ; preds = %36
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %16, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %17, align 4
  br label %179

94:                                               ; preds = %38
  %95 = landingpad { ptr, i32 }
          cleanup
  %96 = extractvalue { ptr, i32 } %95, 0
  store ptr %96, ptr %16, align 8
  %97 = extractvalue { ptr, i32 } %95, 1
  store i32 %97, ptr %17, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %20) #7
  br label %178

98:                                               ; preds = %42
  %99 = landingpad { ptr, i32 }
          cleanup
  %100 = extractvalue { ptr, i32 } %99, 0
  store ptr %100, ptr %16, align 8
  %101 = extractvalue { ptr, i32 } %99, 1
  store i32 %101, ptr %17, align 4
  br label %177

102:                                              ; preds = %50, %48
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %16, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %17, align 4
  br label %176

106:                                              ; preds = %49
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %16, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %17, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %25) #7
  br label %176

110:                                              ; preds = %53
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %16, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %17, align 4
  br label %175

114:                                              ; preds = %55
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %16, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %17, align 4
  br label %174

118:                                              ; preds = %56
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %16, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %17, align 4
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %29) #7
  br label %174

122:                                              ; preds = %67, %64, %61
  %123 = landingpad { ptr, i32 }
          cleanup
  %124 = extractvalue { ptr, i32 } %123, 0
  store ptr %124, ptr %16, align 8
  %125 = extractvalue { ptr, i32 } %123, 1
  store i32 %125, ptr %17, align 4
  br label %173

126:                                              ; preds = %78
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %16, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %32) #7
  br label %173

130:                                              ; preds = %80
  %131 = load i32, ptr %33, align 4, !tbaa !11
  %132 = zext i32 %131 to i64
  %133 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %30, i64 noundef %132) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %32, ptr align 4 %133, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.start.p0(i64 12, ptr %34) #7
  %134 = getelementptr inbounds %struct.GridIndex_t, ptr %34, i32 0, i32 0
  %135 = getelementptr inbounds %struct.GridIndex, ptr %32, i32 0, i32 0
  %136 = load i32, ptr %135, align 4, !tbaa !18
  %137 = getelementptr inbounds %struct.GridIndex, ptr %19, i32 0, i32 0
  %138 = load i32, ptr %137, align 4, !tbaa !18
  %139 = add nsw i32 %136, %138
  store i32 %139, ptr %134, align 4, !tbaa !22
  %140 = getelementptr inbounds %struct.GridIndex_t, ptr %34, i32 0, i32 1
  %141 = getelementptr inbounds %struct.GridIndex, ptr %32, i32 0, i32 1
  %142 = load i32, ptr %141, align 4, !tbaa !20
  %143 = getelementptr inbounds %struct.GridIndex, ptr %19, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !20
  %145 = add nsw i32 %142, %144
  store i32 %145, ptr %140, align 4, !tbaa !24
  %146 = getelementptr inbounds %struct.GridIndex_t, ptr %34, i32 0, i32 2
  %147 = getelementptr inbounds %struct.GridIndex, ptr %32, i32 0, i32 2
  %148 = load i32, ptr %147, align 4, !tbaa !21
  %149 = getelementptr inbounds %struct.GridIndex, ptr %19, i32 0, i32 2
  %150 = load i32, ptr %149, align 4, !tbaa !21
  %151 = add nsw i32 %148, %150
  store i32 %151, ptr %146, align 4, !tbaa !25
  %152 = load ptr, ptr %10, align 8, !tbaa !5
  %153 = load i32, ptr %33, align 4, !tbaa !11
  %154 = zext i32 %153 to i64
  %155 = getelementptr inbounds %struct.GridIndex_t, ptr %152, i64 %154
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %155, ptr align 4 %34, i64 12, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 12, ptr %34) #7
  %156 = load i32, ptr %33, align 4, !tbaa !11
  %157 = zext i32 %156 to i64
  %158 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %31, i64 noundef %157) #7
  %159 = load i8, ptr %158, align 1, !tbaa !26
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = load i32, ptr %33, align 4, !tbaa !11
  %162 = zext i32 %161 to i64
  %163 = getelementptr inbounds i8, ptr %160, i64 %162
  store i8 %159, ptr %163, align 1, !tbaa !26
  br label %164

164:                                              ; preds = %130
  %165 = load i32, ptr %33, align 4, !tbaa !11
  %166 = add i32 %165, 1
  store i32 %166, ptr %33, align 4, !tbaa !11
  br label %80, !llvm.loop !27

167:                                              ; preds = %85
  %168 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %30) #7
  %169 = trunc i64 %168 to i32
  %170 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 %169, ptr %170, align 4, !tbaa !11
  %171 = load i32, ptr @_ZN9CBindings7SUCCESSE, align 4, !tbaa !11
  %172 = load ptr, ptr %14, align 8, !tbaa !5
  store i32 %171, ptr %172, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 12, ptr %32) #7
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %31) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  call void @_ZNSt6vectorI9GridIndexSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %30) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %30) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %22) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %18) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #7
  call void @_ZN12TriangleMeshD1Ev(ptr noundef nonnull align 8 dereferenceable(232) %15) #7
  call void @llvm.lifetime.end.p0(i64 232, ptr %15) #7
  ret void

173:                                              ; preds = %126, %122
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %31) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %31) #7
  call void @_ZNSt6vectorI9GridIndexSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %30) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %30) #7
  br label %174

174:                                              ; preds = %173, %118, %114
  call void @llvm.lifetime.end.p0(i64 12, ptr %28) #7
  br label %175

175:                                              ; preds = %174, %110
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #7
  br label %176

176:                                              ; preds = %175, %106, %102
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %22) #7
  br label %177

177:                                              ; preds = %176, %98
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #7
  br label %178

178:                                              ; preds = %177, %94
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %18) #7
  br label %179

179:                                              ; preds = %178, %90
  call void @llvm.lifetime.end.p0(i64 40, ptr %18) #7
  br label %180

180:                                              ; preds = %179, %86
  call void @_ZN12TriangleMeshD1Ev(ptr noundef nonnull align 8 dereferenceable(232) %15) #7
  call void @llvm.lifetime.end.p0(i64 232, ptr %15) #7
  br label %181

181:                                              ; preds = %180
  %182 = load ptr, ptr %16, align 8
  %183 = load i32, ptr %17, align 4
  %184 = insertvalue { ptr, i32 } poison, ptr %182, 0
  %185 = insertvalue { ptr, i32 } %184, i32 %183, 1
  resume { ptr, i32 } %185
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 2

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

declare void @_ZN5utils31getCellsInsideTriangleMeshSubd2ER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EERS2_IhSaIhEE(ptr noundef nonnull align 8 dereferenceable(232), i32 noundef, i32 noundef, i32 noundef, double noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14}
!14 = !{!15, !15, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11}
!17 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14, i64 16, i64 8, !9, i64 24, i64 8, !9, i64 32, i64 8, !9}
!18 = !{!19, !12, i64 0}
!19 = !{!"_ZTS9GridIndex", !12, i64 0, !12, i64 4, !12, i64 8}
!20 = !{!19, !12, i64 4}
!21 = !{!19, !12, i64 8}
!22 = !{!23, !12, i64 0}
!23 = !{!"_ZTS11GridIndex_t", !12, i64 0, !12, i64 4, !12, i64 8}
!24 = !{!23, !12, i64 4}
!25 = !{!23, !12, i64 8}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"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.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 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%struct.GridIndex = type { i32, i32, i32 }
%"class.std::vector.20" = type { %"struct.std::_Vector_base.21" }
%"struct.std::_Vector_base.21" = type { %"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl" }
%"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridIndex, std::allocator<GridIndex>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.25" = type { %"struct.std::_Vector_base.26" }
%"struct.std::_Vector_base.26" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.GridIndex_t = type { i32, i32, i32 }

@_ZN9CBindings7SUCCESSE = external local_unnamed_addr global i32, align 4

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

declare void @_ZN12TriangleMeshC1Ev(ptr noundef nonnull align 8 dereferenceable(232)) unnamed_addr #1

declare void @_ZN5utils20structToTriangleMeshERNS_14TriangleMesh_tER12TriangleMesh(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(232)) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef, double noundef) local_unnamed_addr #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 @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12)) 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 #2

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 #1

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

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

; 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 #2

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

; 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 @_ZN12TriangleMeshD1Ev(ptr noundef nonnull align 8 dereferenceable(232)) unnamed_addr #4

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

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 #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI9GridIndexSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 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 #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI9GridIndexSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @utils_get_triangle_mesh_cells_subd2(ptr noundef %0, double noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, i32 noundef %4, ptr nocapture noundef writeonly %5, ptr nocapture noundef writeonly %6) local_unnamed_addr #6 personality ptr @__gxx_personality_v0 {
  %8 = alloca %class.TriangleMesh, align 8
  %9 = alloca %class.AABB, align 8
  %10 = alloca %"class.vmath::vec3", align 4
  %11 = alloca %"class.vmath::vec3", align 4
  %12 = alloca %"class.vmath::vec3", align 4
  %13 = alloca %struct.GridIndex, align 4
  %14 = alloca %struct.GridIndex, align 4
  %15 = alloca %class.AABB, align 8
  %16 = alloca %"class.std::vector.20", align 8
  %17 = alloca %"class.std::vector.25", align 8
  %18 = alloca %struct.GridIndex, align 4
  call void @llvm.lifetime.start.p0(i64 232, ptr nonnull %8) #7
  call void @_ZN12TriangleMeshC1Ev(ptr noundef nonnull align 8 dereferenceable(232) %8)
  invoke void @_ZN5utils20structToTriangleMeshERNS_14TriangleMesh_tER12TriangleMesh(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(232) %8)
          to label %19 unwind label %48

19:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %9) #7
  invoke void @_ZN4AABBC1ERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(40) %9, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %20 unwind label %50

20:                                               ; preds = %19
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 8 dereferenceable(12) %9, i64 12, i1 false), !tbaa.struct !5
  %21 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef nonnull %10, double noundef %1)
          to label %22 unwind label %52

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

23:                                               ; preds = %22
  invoke void @_ZN5vmathngERKNS_4vec3E(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %12, ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %24 unwind label %56

24:                                               ; preds = %23
  invoke void @_ZN12TriangleMesh9translateEN5vmath4vec3E(ptr noundef nonnull align 8 dereferenceable(232) %8, ptr noundef nonnull %12)
          to label %25 unwind label %58

25:                                               ; preds = %24
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #7
  %26 = invoke noundef nonnull align 4 dereferenceable(12) ptr @_ZN5vmathmIERNS_4vec3ERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %27 unwind label %56

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

29:                                               ; preds = %27
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %15) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %16) #7
  call void @_ZNSt6vectorI9GridIndexSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %17) #7
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  %30 = sext i32 %4 to i64
  invoke void @_ZNSt6vectorI9GridIndexSaIS0_EE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %30)
          to label %31 unwind label %62

31:                                               ; preds = %29
  invoke void @_ZNSt6vectorIhSaIhEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %30)
          to label %32 unwind label %62

32:                                               ; preds = %31
  %33 = load i32, ptr %14, align 4, !tbaa !13
  %34 = add nsw i32 %33, 1
  %35 = getelementptr inbounds i8, ptr %14, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = add nsw i32 %36, 1
  %38 = getelementptr inbounds i8, ptr %14, i64 8
  %39 = load i32, ptr %38, align 4, !tbaa !17
  %40 = add nsw i32 %39, 1
  invoke void @_ZN5utils31getCellsInsideTriangleMeshSubd2ER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EERS2_IhSaIhEE(ptr noundef nonnull align 8 dereferenceable(232) %8, i32 noundef %34, i32 noundef %37, i32 noundef %40, double noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %41 unwind label %62

41:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %18) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %18)
  %42 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  %.not = icmp eq i64 %42, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %41
  %.sroa.014.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  %43 = getelementptr inbounds i8, ptr %18, i64 4
  %.sroa.014.4.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.014.4.extract.trunc = trunc nuw i64 %.sroa.014.4.extract.shift to i32
  %44 = getelementptr inbounds i8, ptr %18, i64 8
  br label %64

._crit_edge:                                      ; preds = %64, %41
  %45 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  %46 = trunc i64 %45 to i32
  store i32 %46, ptr %5, align 4, !tbaa !18
  %47 = load i32, ptr @_ZN9CBindings7SUCCESSE, align 4, !tbaa !18
  store i32 %47, ptr %6, align 4, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %18) #7
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #7
  call void @_ZNSt6vectorI9GridIndexSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #7
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %9) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %9) #7
  call void @_ZN12TriangleMeshD1Ev(ptr noundef nonnull align 8 dereferenceable(232) %8) #7
  call void @llvm.lifetime.end.p0(i64 232, ptr nonnull %8) #7
  ret void

48:                                               ; preds = %7
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %86

50:                                               ; preds = %19
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %85

52:                                               ; preds = %20
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #7
  br label %84

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

56:                                               ; preds = %25, %23
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %82

58:                                               ; preds = %24
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #7
  br label %82

60:                                               ; preds = %27
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %15) #7
  br label %81

62:                                               ; preds = %32, %31, %29
  %63 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %17) #7
  call void @_ZNSt6vectorI9GridIndexSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %16) #7
  br label %81

64:                                               ; preds = %.lr.ph, %64
  %65 = phi i64 [ 0, %.lr.ph ], [ %78, %64 ]
  %.03543 = phi i32 [ 0, %.lr.ph ], [ %77, %64 ]
  %66 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorI9GridIndexSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %16, i64 noundef %65) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %18, ptr noundef nonnull align 4 dereferenceable(12) %66, i64 12, i1 false), !tbaa.struct !19
  %67 = load i32, ptr %18, align 4, !tbaa !13
  %68 = add nsw i32 %67, %.sroa.014.0.extract.trunc
  %69 = load i32, ptr %43, align 4, !tbaa !16
  %70 = add nsw i32 %69, %.sroa.014.4.extract.trunc
  %71 = load i32, ptr %44, align 4, !tbaa !17
  %72 = add nsw i32 %71, %.fca.1.extract
  %73 = getelementptr inbounds %struct.GridIndex_t, ptr %2, i64 %65
  store i32 %68, ptr %73, align 4, !tbaa !18
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %73, i64 4
  store i32 %70, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !18
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %73, i64 8
  store i32 %72, ptr %.sroa.5.0..sroa_idx, align 4, !tbaa !18
  %74 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %65) #7
  %75 = load i8, ptr %74, align 1, !tbaa !20
  %76 = getelementptr inbounds i8, ptr %3, i64 %65
  store i8 %75, ptr %76, align 1, !tbaa !20
  %77 = add i32 %.03543, 1
  %78 = zext i32 %77 to i64
  %79 = call noundef i64 @_ZNKSt6vectorI9GridIndexSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  %80 = icmp ugt i64 %79, %78
  br i1 %80, label %64, label %._crit_edge, !llvm.loop !21

81:                                               ; preds = %62, %60
  %.pn = phi { ptr, i32 } [ %63, %62 ], [ %61, %60 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %14) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #7
  br label %82

82:                                               ; preds = %81, %58, %56
  %.pn.pn = phi { ptr, i32 } [ %.pn, %81 ], [ %57, %56 ], [ %59, %58 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #7
  br label %83

83:                                               ; preds = %82, %54
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %82 ], [ %55, %54 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #7
  br label %84

84:                                               ; preds = %83, %52
  %.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn, %83 ], [ %53, %52 ]
  call void @_ZN4AABBD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %9) #7
  br label %85

85:                                               ; preds = %84, %50
  %.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn, %84 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %9) #7
  br label %86

86:                                               ; preds = %85, %48
  %.pn.pn.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn.pn.pn.pn, %85 ], [ %49, %48 ]
  call void @_ZN12TriangleMeshD1Ev(ptr noundef nonnull align 8 dereferenceable(232) %8) #7
  call void @llvm.lifetime.end.p0(i64 232, ptr nonnull %8) #7
  resume { ptr, i32 } %.pn.pn.pn.pn.pn.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 2

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

declare void @_ZN5utils31getCellsInsideTriangleMeshSubd2ER12TriangleMeshiiidRSt6vectorI9GridIndexSaIS3_EERS2_IhSaIhEE(ptr noundef nonnull align 8 dereferenceable(232), i32 noundef, i32 noundef, i32 noundef, double noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 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 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 = !{!15, !15, i64 0}
!19 = !{i64 0, i64 4, !18, i64 4, i64 4, !18, i64 8, i64 4, !18}
!20 = !{!8, !8, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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