; 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.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.15", i32, [4 x i8] }>
%"class.std::vector.15" = type { %"struct.std::_Vector_base.16" }
%"struct.std::_Vector_base.16" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Array3d.20 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [7 x i8], %"class.std::vector.10", i32, [4 x i8] }>
%"class.std::vector.10" = type { %"struct.std::_Vector_base.11" }
%"struct.std::_Vector_base.11" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl" = type { %"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" }
%"struct.std::_Vector_base<double, std::allocator<double>>::_Vector_impl_data" = type { ptr, ptr, ptr }

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

declare void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5utils17_getTriangleGridZER12TriangleMeshdR7Array3dISt6vectorIiSaIiEEE(ptr noundef nonnull align 8 dereferenceable(232), double noundef, ptr noundef nonnull align 8 dereferenceable(60)) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(24)) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN5utils13_randomDoubleEdd(double noundef, double noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dISt6vectorIiSaIiEEEC2Eiii(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, i32 noundef, i32 noundef) #3 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5utils23_getCollisionGridZSubd2ER12TriangleMeshdR7Array3dISt6vectorIdSaIdEEES7_(ptr noundef nonnull align 8 dereferenceable(232) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(60) %2, ptr noundef nonnull align 8 dereferenceable(60) %3) #3 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %class.Array3d, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca double, align 8
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca ptr, align 8
  %15 = alloca %"class.vmath::vec3", align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca %"class.vmath::vec3", align 4
  %21 = alloca %"class.vmath::vec3", align 4
  %22 = alloca %"class.vmath::vec3", align 4
  %23 = alloca %"class.vmath::vec3", align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca %"class.vmath::vec3", align 4
  %29 = alloca %"class.vmath::vec3", align 4
  %30 = alloca %"class.vmath::vec3", align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %9) #8
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = getelementptr inbounds %class.Array3d.20, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %class.Array3d.20, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 4, !tbaa !19
  call void @_ZN7Array3dISt6vectorIiSaIiEEEC2Eiii(ptr noundef nonnull align 8 dereferenceable(60) %9, i32 noundef %33, i32 noundef %36, i32 noundef 1)
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load double, ptr %6, align 8, !tbaa !9
  invoke void @_ZN5utils17_getTriangleGridZER12TriangleMeshdR7Array3dISt6vectorIiSaIiEEE(ptr noundef nonnull align 8 dereferenceable(232) %37, double noundef %38, ptr noundef nonnull align 8 dereferenceable(60) %9)
          to label %39 unwind label %66

39:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = fmul double 5.000000e-02, %40
  store double %41, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #8
  %42 = load double, ptr %12, align 8, !tbaa !9
  %43 = load double, ptr %12, align 8, !tbaa !9
  %44 = fneg double %43
  %45 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %42, double noundef %44)
  %46 = fptrunc double %45 to float
  %47 = load double, ptr %12, align 8, !tbaa !9
  %48 = load double, ptr %12, align 8, !tbaa !9
  %49 = fneg double %48
  %50 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %47, double noundef %49)
  %51 = fptrunc double %50 to float
  %52 = load double, ptr %12, align 8, !tbaa !9
  %53 = load double, ptr %12, align 8, !tbaa !9
  %54 = fneg double %53
  %55 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %52, double noundef %54)
  %56 = fptrunc double %55 to float
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %13, float noundef %46, float noundef %51, float noundef %56)
          to label %57 unwind label %70

57:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %15)
          to label %58 unwind label %74

58:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !20
  br label %59

59:                                               ; preds = %136, %58
  %60 = load i32, ptr %17, align 4, !tbaa !20
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %class.Array3d.20, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !19
  %64 = icmp slt i32 %60, %63
  br i1 %64, label %78, label %65

65:                                               ; preds = %59
  store i32 2, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %139

66:                                               ; preds = %4
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %10, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %11, align 4
  br label %248

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

74:                                               ; preds = %57
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %10, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %11, align 4
  br label %246

78:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !20
  br label %79

79:                                               ; preds = %118, %78
  %80 = load i32, ptr %19, align 4, !tbaa !20
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %class.Array3d.20, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 8, !tbaa !11
  %84 = icmp slt i32 %80, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %79
  store i32 5, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %135

86:                                               ; preds = %79
  %87 = load i32, ptr %19, align 4, !tbaa !20
  %88 = load i32, ptr %17, align 4, !tbaa !20
  %89 = invoke noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %9, i32 noundef %87, i32 noundef %88, i32 noundef 0)
          to label %90 unwind label %95

90:                                               ; preds = %86
  store ptr %89, ptr %16, align 8, !tbaa !5
  %91 = load ptr, ptr %16, align 8, !tbaa !5
  %92 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %91) #8
  %93 = icmp eq i64 %92, 0
  br i1 %93, label %94, label %99

94:                                               ; preds = %90
  br label %118

95:                                               ; preds = %104, %99, %86
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %10, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %11, align 4
  br label %134

99:                                               ; preds = %90
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = load i32, ptr %19, align 4, !tbaa !20
  %102 = load i32, ptr %17, align 4, !tbaa !20
  %103 = invoke noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %100, i32 noundef %101, i32 noundef %102, i32 noundef 0)
          to label %104 unwind label %95

104:                                              ; preds = %99
  store ptr %103, ptr %14, align 8, !tbaa !5
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  %107 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %106) #8
  invoke void @_ZNSt6vectorIdSaIdEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %105, i64 noundef %107)
          to label %108 unwind label %95

108:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 12, ptr %20) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %21) #8
  %109 = load i32, ptr %19, align 4, !tbaa !20
  %110 = load i32, ptr %17, align 4, !tbaa !20
  %111 = load double, ptr %6, align 8, !tbaa !9
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %21, i32 noundef %109, i32 noundef %110, i32 noundef -1, double noundef %111)
          to label %112 unwind label %121

112:                                              ; preds = %108
  invoke void @_ZN5vmathplERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %20, ptr noundef nonnull align 4 dereferenceable(12) %21, ptr noundef nonnull align 4 dereferenceable(12) %13)
          to label %113 unwind label %125

113:                                              ; preds = %112
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %20, i64 12, i1 false), !tbaa.struct !21
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %20) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %21) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %20) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %15, i64 12, i1 false), !tbaa.struct !21
  %114 = load ptr, ptr %16, align 8, !tbaa !5
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef %22, ptr noundef nonnull align 8 dereferenceable(24) %114, ptr noundef nonnull align 8 dereferenceable(232) %115, ptr noundef nonnull align 8 dereferenceable(24) %116)
          to label %117 unwind label %130

117:                                              ; preds = %113
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %22) #8
  br label %118

118:                                              ; preds = %117, %94
  %119 = load i32, ptr %19, align 4, !tbaa !20
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %19, align 4, !tbaa !20
  br label %79, !llvm.loop !24

121:                                              ; preds = %108
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %10, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %11, align 4
  br label %129

125:                                              ; preds = %112
  %126 = landingpad { ptr, i32 }
          cleanup
  %127 = extractvalue { ptr, i32 } %126, 0
  store ptr %127, ptr %10, align 8
  %128 = extractvalue { ptr, i32 } %126, 1
  store i32 %128, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %21) #8
  br label %129

129:                                              ; preds = %125, %121
  call void @llvm.lifetime.end.p0(i64 12, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %20) #8
  br label %134

130:                                              ; preds = %113
  %131 = landingpad { ptr, i32 }
          cleanup
  %132 = extractvalue { ptr, i32 } %131, 0
  store ptr %132, ptr %10, align 8
  %133 = extractvalue { ptr, i32 } %131, 1
  store i32 %133, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %22) #8
  br label %134

134:                                              ; preds = %130, %129, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %245

135:                                              ; preds = %85
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %17, align 4, !tbaa !20
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %17, align 4, !tbaa !20
  br label %59, !llvm.loop !26

139:                                              ; preds = %65
  %140 = load double, ptr %6, align 8, !tbaa !9
  %141 = fmul double 2.500000e-02, %140
  store double %141, ptr %12, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %23) #8
  %142 = load double, ptr %12, align 8, !tbaa !9
  %143 = load double, ptr %12, align 8, !tbaa !9
  %144 = fneg double %143
  %145 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %142, double noundef %144)
  %146 = fptrunc double %145 to float
  %147 = load double, ptr %12, align 8, !tbaa !9
  %148 = load double, ptr %12, align 8, !tbaa !9
  %149 = fneg double %148
  %150 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %147, double noundef %149)
  %151 = fptrunc double %150 to float
  %152 = load double, ptr %12, align 8, !tbaa !9
  %153 = load double, ptr %12, align 8, !tbaa !9
  %154 = fneg double %153
  %155 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %152, double noundef %154)
  %156 = fptrunc double %155 to float
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %23, float noundef %146, float noundef %151, float noundef %156)
          to label %157 unwind label %165

157:                                              ; preds = %139
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %23, i64 12, i1 false), !tbaa.struct !21
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %23) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 0, ptr %24, align 4, !tbaa !20
  br label %158

158:                                              ; preds = %241, %157
  %159 = load i32, ptr %24, align 4, !tbaa !20
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %class.Array3d.20, ptr %160, i32 0, i32 1
  %162 = load i32, ptr %161, align 4, !tbaa !19
  %163 = icmp slt i32 %159, %162
  br i1 %163, label %169, label %164

164:                                              ; preds = %158
  store i32 8, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %244

165:                                              ; preds = %139
  %166 = landingpad { ptr, i32 }
          cleanup
  %167 = extractvalue { ptr, i32 } %166, 0
  store ptr %167, ptr %10, align 8
  %168 = extractvalue { ptr, i32 } %166, 1
  store i32 %168, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %23) #8
  br label %245

169:                                              ; preds = %158
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #8
  store i32 0, ptr %25, align 4, !tbaa !20
  br label %170

170:                                              ; preds = %223, %169
  %171 = load i32, ptr %25, align 4, !tbaa !20
  %172 = load ptr, ptr %8, align 8, !tbaa !5
  %173 = getelementptr inbounds %class.Array3d.20, ptr %172, i32 0, i32 0
  %174 = load i32, ptr %173, align 8, !tbaa !11
  %175 = icmp slt i32 %171, %174
  br i1 %175, label %177, label %176

176:                                              ; preds = %170
  store i32 11, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  br label %240

177:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  %178 = load i32, ptr %25, align 4, !tbaa !20
  %179 = sitofp i32 %178 to double
  %180 = fmul double 5.000000e-01, %179
  %181 = call double @llvm.floor.f64(double %180)
  %182 = fptosi double %181 to i32
  store i32 %182, ptr %26, align 4, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  %183 = load i32, ptr %24, align 4, !tbaa !20
  %184 = sitofp i32 %183 to double
  %185 = fmul double 5.000000e-01, %184
  %186 = call double @llvm.floor.f64(double %185)
  %187 = fptosi double %186 to i32
  store i32 %187, ptr %27, align 4, !tbaa !20
  %188 = load i32, ptr %26, align 4, !tbaa !20
  %189 = load i32, ptr %27, align 4, !tbaa !20
  %190 = invoke noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %9, i32 noundef %188, i32 noundef %189, i32 noundef 0)
          to label %191 unwind label %196

191:                                              ; preds = %177
  store ptr %190, ptr %16, align 8, !tbaa !5
  %192 = load ptr, ptr %16, align 8, !tbaa !5
  %193 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %192) #8
  %194 = icmp eq i64 %193, 0
  br i1 %194, label %195, label %200

195:                                              ; preds = %191
  store i32 13, ptr %18, align 4
  br label %220

196:                                              ; preds = %205, %200, %177
  %197 = landingpad { ptr, i32 }
          cleanup
  %198 = extractvalue { ptr, i32 } %197, 0
  store ptr %198, ptr %10, align 8
  %199 = extractvalue { ptr, i32 } %197, 1
  store i32 %199, ptr %11, align 4
  br label %239

200:                                              ; preds = %191
  %201 = load ptr, ptr %8, align 8, !tbaa !5
  %202 = load i32, ptr %25, align 4, !tbaa !20
  %203 = load i32, ptr %24, align 4, !tbaa !20
  %204 = invoke noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %201, i32 noundef %202, i32 noundef %203, i32 noundef 0)
          to label %205 unwind label %196

205:                                              ; preds = %200
  store ptr %204, ptr %14, align 8, !tbaa !5
  %206 = load ptr, ptr %14, align 8, !tbaa !5
  %207 = load ptr, ptr %16, align 8, !tbaa !5
  %208 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %207) #8
  invoke void @_ZNSt6vectorIdSaIdEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %206, i64 noundef %208)
          to label %209 unwind label %196

209:                                              ; preds = %205
  call void @llvm.lifetime.start.p0(i64 12, ptr %28) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %29) #8
  %210 = load i32, ptr %25, align 4, !tbaa !20
  %211 = load i32, ptr %24, align 4, !tbaa !20
  %212 = load double, ptr %6, align 8, !tbaa !9
  %213 = fmul double 5.000000e-01, %212
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %29, i32 noundef %210, i32 noundef %211, i32 noundef -1, double noundef %213)
          to label %214 unwind label %226

214:                                              ; preds = %209
  invoke void @_ZN5vmathplERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %28, ptr noundef nonnull align 4 dereferenceable(12) %29, ptr noundef nonnull align 4 dereferenceable(12) %13)
          to label %215 unwind label %230

215:                                              ; preds = %214
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %28, i64 12, i1 false), !tbaa.struct !21
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %28) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %29) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %28) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %30, ptr align 4 %15, i64 12, i1 false), !tbaa.struct !21
  %216 = load ptr, ptr %16, align 8, !tbaa !5
  %217 = load ptr, ptr %5, align 8, !tbaa !5
  %218 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef %30, ptr noundef nonnull align 8 dereferenceable(24) %216, ptr noundef nonnull align 8 dereferenceable(232) %217, ptr noundef nonnull align 8 dereferenceable(24) %218)
          to label %219 unwind label %235

219:                                              ; preds = %215
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %30) #8
  store i32 0, ptr %18, align 4
  br label %220

220:                                              ; preds = %219, %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  %221 = load i32, ptr %18, align 4
  switch i32 %221, label %254 [
    i32 0, label %222
    i32 13, label %223
  ]

222:                                              ; preds = %220
  br label %223

223:                                              ; preds = %222, %220
  %224 = load i32, ptr %25, align 4, !tbaa !20
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %25, align 4, !tbaa !20
  br label %170, !llvm.loop !27

226:                                              ; preds = %209
  %227 = landingpad { ptr, i32 }
          cleanup
  %228 = extractvalue { ptr, i32 } %227, 0
  store ptr %228, ptr %10, align 8
  %229 = extractvalue { ptr, i32 } %227, 1
  store i32 %229, ptr %11, align 4
  br label %234

230:                                              ; preds = %214
  %231 = landingpad { ptr, i32 }
          cleanup
  %232 = extractvalue { ptr, i32 } %231, 0
  store ptr %232, ptr %10, align 8
  %233 = extractvalue { ptr, i32 } %231, 1
  store i32 %233, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %29) #8
  br label %234

234:                                              ; preds = %230, %226
  call void @llvm.lifetime.end.p0(i64 12, ptr %29) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %28) #8
  br label %239

235:                                              ; preds = %215
  %236 = landingpad { ptr, i32 }
          cleanup
  %237 = extractvalue { ptr, i32 } %236, 0
  store ptr %237, ptr %10, align 8
  %238 = extractvalue { ptr, i32 } %236, 1
  store i32 %238, ptr %11, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %30) #8
  br label %239

239:                                              ; preds = %235, %234, %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %245

240:                                              ; preds = %176
  br label %241

241:                                              ; preds = %240
  %242 = load i32, ptr %24, align 4, !tbaa !20
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %24, align 4, !tbaa !20
  br label %158, !llvm.loop !28

244:                                              ; preds = %164
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %15) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %9) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #8
  ret void

245:                                              ; preds = %239, %165, %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %15) #8
  br label %246

246:                                              ; preds = %245, %74
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  br label %247

247:                                              ; preds = %246, %70
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %248

248:                                              ; preds = %247, %66
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %9) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr %9) #8
  br label %249

249:                                              ; preds = %248
  %250 = load ptr, ptr %10, align 8
  %251 = load i32, ptr %11, align 4
  %252 = insertvalue { ptr, i32 } poison, ptr %250, 0
  %253 = insertvalue { ptr, i32 } %252, i32 %251, 1
  resume { ptr, i32 } %253

254:                                              ; preds = %220
  unreachable
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS7Array3dISt6vectorIdSaIdEEE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !14, i64 24, !15, i64 32, !13, i64 56}
!13 = !{!"int", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"_ZTSSt6vectorIdSaIdEE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!19 = !{!12, !13, i64 4}
!20 = !{!13, !13, i64 0}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 4, !22}
!22 = !{!23, !23, i64 0}
!23 = !{!"float", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}
!28 = distinct !{!28, !25}


; 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.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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5utils17_getTriangleGridZER12TriangleMeshdR7Array3dISt6vectorIiSaIiEEE(ptr noundef nonnull align 8 dereferenceable(232), double noundef, ptr noundef nonnull align 8 dereferenceable(60)) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(232), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZN5utils13_randomDoubleEdd(double noundef, double noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dISt6vectorIiSaIiEEEC2Eiii(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5utils23_getCollisionGridZSubd2ER12TriangleMeshdR7Array3dISt6vectorIdSaIdEEES7_(ptr noundef nonnull align 8 dereferenceable(232) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(60) %2, ptr noundef nonnull align 8 dereferenceable(60) %3) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.Array3d, align 8
  %6 = alloca %"class.vmath::vec3", align 4
  %7 = alloca %"class.vmath::vec3", align 4
  %8 = alloca %"class.vmath::vec3", align 4
  %9 = alloca %"class.vmath::vec3", align 4
  %10 = alloca %"class.vmath::vec3", align 4
  %11 = alloca %"class.vmath::vec3", align 4
  %12 = alloca %"class.vmath::vec3", align 4
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca %"class.vmath::vec3", align 4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #8
  %15 = load i32, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %2, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !16
  call void @_ZN7Array3dISt6vectorIiSaIiEEEC2Eiii(ptr noundef nonnull align 8 dereferenceable(60) %5, i32 noundef %15, i32 noundef %17, i32 noundef 1)
  invoke void @_ZN5utils17_getTriangleGridZER12TriangleMeshdR7Array3dISt6vectorIiSaIiEEE(ptr noundef nonnull align 8 dereferenceable(232) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(60) %5)
          to label %18 unwind label %43

18:                                               ; preds = %4
  %19 = fmul double %1, 5.000000e-02
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #8
  %20 = fneg double %19
  %21 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %19, double noundef %20)
  %22 = fptrunc double %21 to float
  %23 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %19, double noundef %20)
  %24 = fptrunc double %23 to float
  %25 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %19, double noundef %20)
  %26 = fptrunc double %25 to float
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %6, float noundef %22, float noundef %24, float noundef %26)
          to label %27 unwind label %45

27:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
          to label %.preheader85 unwind label %47

.preheader85:                                     ; preds = %27
  %28 = load i32, ptr %16, align 4, !tbaa !16
  %29 = icmp sgt i32 %28, 0
  %30 = load i32, ptr %2, align 8
  %31 = icmp sgt i32 %30, 0
  %or.cond = select i1 %29, i1 %31, i1 false
  br i1 %or.cond, label %.preheader84, label %._crit_edge88

.preheader84:                                     ; preds = %.preheader85, %._crit_edge
  %32 = phi i32 [ %49, %._crit_edge ], [ %28, %.preheader85 ]
  %33 = phi i32 [ %50, %._crit_edge ], [ %30, %.preheader85 ]
  %.07287 = phi i32 [ %51, %._crit_edge ], [ 0, %.preheader85 ]
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph, label %._crit_edge

._crit_edge88:                                    ; preds = %._crit_edge, %.preheader85
  %35 = fmul double %1, 2.500000e-02
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %11) #8
  %36 = fneg double %35
  %37 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %35, double noundef %36)
  %38 = fptrunc double %37 to float
  %39 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %35, double noundef %36)
  %40 = fptrunc double %39 to float
  %41 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %35, double noundef %36)
  %42 = fptrunc double %41 to float
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %11, float noundef %38, float noundef %40, float noundef %42)
          to label %78 unwind label %92

43:                                               ; preds = %4
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %131

45:                                               ; preds = %18
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %130

47:                                               ; preds = %27
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %129

._crit_edge.loopexit:                             ; preds = %67
  %.pre = load i32, ptr %16, align 4, !tbaa !16
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader84
  %49 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %32, %.preheader84 ]
  %50 = phi i32 [ %69, %._crit_edge.loopexit ], [ %33, %.preheader84 ]
  %51 = add nuw nsw i32 %.07287, 1
  %52 = icmp slt i32 %51, %49
  br i1 %52, label %.preheader84, label %._crit_edge88, !llvm.loop !17

.lr.ph:                                           ; preds = %.preheader84, %67
  %.07186 = phi i32 [ %68, %67 ], [ 0, %.preheader84 ]
  %53 = invoke noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %5, i32 noundef %.07186, i32 noundef %.07287, i32 noundef 0)
          to label %54 unwind label %57

54:                                               ; preds = %.lr.ph
  %55 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #8
  %56 = icmp eq i64 %55, 0
  br i1 %56, label %67, label %59

57:                                               ; preds = %61, %59, %.lr.ph
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %128

59:                                               ; preds = %54
  %60 = invoke noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %2, i32 noundef %.07186, i32 noundef %.07287, i32 noundef 0)
          to label %61 unwind label %57

61:                                               ; preds = %59
  %62 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #8
  invoke void @_ZNSt6vectorIdSaIdEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef %62)
          to label %63 unwind label %57

63:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #8
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %9, i32 noundef %.07186, i32 noundef %.07287, i32 noundef -1, double noundef %1)
          to label %64 unwind label %71

64:                                               ; preds = %63
  invoke void @_ZN5vmathplERKNS_4vec3ES2_(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %8, ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %65 unwind label %73

65:                                               ; preds = %64
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %8, i64 12, i1 false), !tbaa.struct !20
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %7, i64 12, i1 false), !tbaa.struct !20
  invoke void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef nonnull %10, ptr noundef nonnull align 8 dereferenceable(24) %53, ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(24) %60)
          to label %66 unwind label %76

66:                                               ; preds = %65
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #8
  br label %67

67:                                               ; preds = %54, %66
  %68 = add nuw nsw i32 %.07186, 1
  %69 = load i32, ptr %2, align 8, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !23

71:                                               ; preds = %63
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %75

73:                                               ; preds = %64
  %74 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #8
  br label %75

75:                                               ; preds = %73, %71
  %.pn76 = phi { ptr, i32 } [ %74, %73 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  br label %128

76:                                               ; preds = %65
  %77 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #8
  br label %128

78:                                               ; preds = %._crit_edge88
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %11, i64 12, i1 false), !tbaa.struct !20
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #8
  %79 = getelementptr inbounds i8, ptr %3, i64 4
  %80 = load i32, ptr %79, align 4, !tbaa !16
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %.preheader.lr.ph, label %._crit_edge93

.preheader.lr.ph:                                 ; preds = %78
  %82 = fmul double %1, 5.000000e-01
  %83 = load i32, ptr %3, align 8, !tbaa !5
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.preheader, label %._crit_edge93

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge91
  %85 = phi i32 [ %94, %._crit_edge91 ], [ %80, %.preheader.lr.ph ]
  %86 = phi i32 [ %95, %._crit_edge91 ], [ %83, %.preheader.lr.ph ]
  %.07092 = phi i32 [ %96, %._crit_edge91 ], [ 0, %.preheader.lr.ph ]
  %87 = icmp sgt i32 %86, 0
  br i1 %87, label %.lr.ph90, label %._crit_edge91

.lr.ph90:                                         ; preds = %.preheader
  %88 = uitofp nneg i32 %.07092 to double
  %89 = fmul double %88, 5.000000e-01
  %90 = call double @llvm.floor.f64(double %89)
  %91 = fptosi double %90 to i32
  br label %98

._crit_edge93:                                    ; preds = %._crit_edge91, %.preheader.lr.ph, %78
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #8
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %5) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #8
  ret void

92:                                               ; preds = %._crit_edge88
  %93 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %11) #8
  br label %128

._crit_edge91.loopexit:                           ; preds = %117
  %.pre96 = load i32, ptr %79, align 4, !tbaa !16
  br label %._crit_edge91

._crit_edge91:                                    ; preds = %._crit_edge91.loopexit, %.preheader
  %94 = phi i32 [ %.pre96, %._crit_edge91.loopexit ], [ %85, %.preheader ]
  %95 = phi i32 [ %119, %._crit_edge91.loopexit ], [ %86, %.preheader ]
  %96 = add nuw nsw i32 %.07092, 1
  %97 = icmp slt i32 %96, %94
  br i1 %97, label %.preheader, label %._crit_edge93, !llvm.loop !24

98:                                               ; preds = %.lr.ph90, %117
  %.06989 = phi i32 [ 0, %.lr.ph90 ], [ %118, %117 ]
  %99 = uitofp nneg i32 %.06989 to double
  %100 = fmul double %99, 5.000000e-01
  %101 = call double @llvm.floor.f64(double %100)
  %102 = fptosi double %101 to i32
  %103 = invoke noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %5, i32 noundef %102, i32 noundef %91, i32 noundef 0)
          to label %104 unwind label %107

104:                                              ; preds = %98
  %105 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %103) #8
  %106 = icmp eq i64 %105, 0
  br i1 %106, label %117, label %109

107:                                              ; preds = %111, %109, %98
  %108 = landingpad { ptr, i32 }
          cleanup
  br label %128

109:                                              ; preds = %104
  %110 = invoke noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %3, i32 noundef %.06989, i32 noundef %.07092, i32 noundef 0)
          to label %111 unwind label %107

111:                                              ; preds = %109
  %112 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %103) #8
  invoke void @_ZNSt6vectorIdSaIdEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %110, i64 noundef %112)
          to label %113 unwind label %107

113:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %12) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %13) #8
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %13, i32 noundef %.06989, i32 noundef %.07092, i32 noundef -1, double noundef %82)
          to label %114 unwind label %121

114:                                              ; preds = %113
  invoke void @_ZN5vmathplERKNS_4vec3ES2_(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %12, ptr noundef nonnull align 4 dereferenceable(12) %13, ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %115 unwind label %123

115:                                              ; preds = %114
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %12, i64 12, i1 false), !tbaa.struct !20
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %12) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %14, ptr noundef nonnull align 4 dereferenceable(12) %7, i64 12, i1 false), !tbaa.struct !20
  invoke void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef nonnull %14, ptr noundef nonnull align 8 dereferenceable(24) %103, ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(24) %110)
          to label %116 unwind label %126

116:                                              ; preds = %115
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #8
  br label %117

117:                                              ; preds = %104, %116
  %118 = add nuw nsw i32 %.06989, 1
  %119 = load i32, ptr %3, align 8, !tbaa !5
  %120 = icmp slt i32 %118, %119
  br i1 %120, label %98, label %._crit_edge91.loopexit, !llvm.loop !25

121:                                              ; preds = %113
  %122 = landingpad { ptr, i32 }
          cleanup
  br label %125

123:                                              ; preds = %114
  %124 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  br label %125

125:                                              ; preds = %123, %121
  %.pn = phi { ptr, i32 } [ %124, %123 ], [ %122, %121 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %13) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %12) #8
  br label %128

126:                                              ; preds = %115
  %127 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %14) #8
  br label %128

128:                                              ; preds = %107, %125, %126, %57, %75, %76, %92
  %.pn78.pn = phi { ptr, i32 } [ %93, %92 ], [ %77, %76 ], [ %.pn76, %75 ], [ %58, %57 ], [ %127, %126 ], [ %.pn, %125 ], [ %108, %107 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #8
  br label %129

129:                                              ; preds = %128, %47
  %.pn78.pn.pn = phi { ptr, i32 } [ %.pn78.pn, %128 ], [ %48, %47 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #8
  br label %130

130:                                              ; preds = %129, %45
  %.pn78.pn.pn.pn = phi { ptr, i32 } [ %.pn78.pn.pn, %129 ], [ %46, %45 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #8
  br label %131

131:                                              ; preds = %130, %43
  %.pn78.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn78.pn.pn.pn, %130 ], [ %44, %43 ]
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %5) #8
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #8
  resume { ptr, i32 } %.pn78.pn.pn.pn.pn
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTS7Array3dISt6vectorIdSaIdEEE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !7, i64 56}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTSSt6vectorIdSaIdEE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIdSaIdEE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIdSaIdEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!16 = !{!6, !7, i64 4}
!17 = distinct !{!17, !18, !19}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = !{i64 0, i64 4, !21, i64 4, i64 4, !21, i64 8, i64 4, !21}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !8, i64 0}
!23 = distinct !{!23, !18}
!24 = distinct !{!24, !18, !19}
!25 = distinct !{!25, !18}


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