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

; 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.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.vmath::vec3" = type { float, float, float }
%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
define dso_local void @_ZN5utils18_getCollisionGridZER12TriangleMeshdR7Array3dISt6vectorIdSaIdEEE(ptr noundef nonnull align 8 dereferenceable(232) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(60) %2) #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.Array3d, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca %"class.vmath::vec3", align 4
  %12 = alloca ptr, align 8
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"class.vmath::vec3", align 4
  %19 = alloca %"class.vmath::vec3", align 4
  %20 = alloca %"class.vmath::vec3", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 64, ptr %7) #7
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %class.Array3d.20, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !11
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %class.Array3d.20, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !19
  call void @_ZN7Array3dISt6vectorIiSaIiEEEC2Eiii(ptr noundef nonnull align 8 dereferenceable(60) %7, i32 noundef %23, i32 noundef %26, i32 noundef 1)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load double, ptr %5, align 8, !tbaa !9
  invoke void @_ZN5utils17_getTriangleGridZER12TriangleMeshdR7Array3dISt6vectorIiSaIiEEE(ptr noundef nonnull align 8 dereferenceable(232) %27, double noundef %28, ptr noundef nonnull align 8 dereferenceable(60) %7)
          to label %29 unwind label %55

29:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %30 = load double, ptr %5, align 8, !tbaa !9
  %31 = fmul double 5.000000e-02, %30
  store double %31, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #7
  %32 = load double, ptr %10, align 8, !tbaa !9
  %33 = load double, ptr %10, align 8, !tbaa !9
  %34 = fneg double %33
  %35 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %32, double noundef %34)
  %36 = fptrunc double %35 to float
  %37 = load double, ptr %10, align 8, !tbaa !9
  %38 = load double, ptr %10, align 8, !tbaa !9
  %39 = fneg double %38
  %40 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %37, double noundef %39)
  %41 = fptrunc double %40 to float
  %42 = load double, ptr %10, align 8, !tbaa !9
  %43 = load double, ptr %10, 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
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %11, float noundef %36, float noundef %41, float noundef %46)
          to label %47 unwind label %59

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

48:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !20
  br label %49

49:                                               ; preds = %124, %48
  %50 = load i32, ptr %15, align 4, !tbaa !20
  %51 = getelementptr inbounds %class.Array3d, ptr %7, i32 0, i32 1
  %52 = load i32, ptr %51, align 4, !tbaa !21
  %53 = icmp slt i32 %50, %52
  br i1 %53, label %67, label %54

54:                                               ; preds = %49
  store i32 2, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %127

55:                                               ; preds = %3
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %8, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %9, align 4
  br label %130

59:                                               ; preds = %29
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %8, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %9, align 4
  br label %129

63:                                               ; preds = %47
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %8, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %9, align 4
  br label %128

67:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !20
  br label %68

68:                                               ; preds = %106, %67
  %69 = load i32, ptr %17, align 4, !tbaa !20
  %70 = getelementptr inbounds %class.Array3d, ptr %7, i32 0, i32 0
  %71 = load i32, ptr %70, align 8, !tbaa !27
  %72 = icmp slt i32 %69, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %68
  store i32 5, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %123

74:                                               ; preds = %68
  %75 = load i32, ptr %17, align 4, !tbaa !20
  %76 = load i32, ptr %15, align 4, !tbaa !20
  %77 = invoke noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %7, i32 noundef %75, i32 noundef %76, i32 noundef 0)
          to label %78 unwind label %83

78:                                               ; preds = %74
  store ptr %77, ptr %14, align 8, !tbaa !5
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %79) #7
  %81 = icmp eq i64 %80, 0
  br i1 %81, label %82, label %87

82:                                               ; preds = %78
  br label %106

83:                                               ; preds = %92, %87, %74
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %8, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %9, align 4
  br label %122

87:                                               ; preds = %78
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = load i32, ptr %17, align 4, !tbaa !20
  %90 = load i32, ptr %15, align 4, !tbaa !20
  %91 = invoke noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %88, i32 noundef %89, i32 noundef %90, i32 noundef 0)
          to label %92 unwind label %83

92:                                               ; preds = %87
  store ptr %91, ptr %12, align 8, !tbaa !5
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %94) #7
  invoke void @_ZNSt6vectorIdSaIdEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %93, i64 noundef %95)
          to label %96 unwind label %83

96:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #7
  %97 = load i32, ptr %17, align 4, !tbaa !20
  %98 = load i32, ptr %15, align 4, !tbaa !20
  %99 = load double, ptr %5, align 8, !tbaa !9
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %19, i32 noundef %97, i32 noundef %98, i32 noundef -1, double noundef %99)
          to label %100 unwind label %109

100:                                              ; preds = %96
  invoke void @_ZN5vmathplERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %18, ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %11)
          to label %101 unwind label %113

101:                                              ; preds = %100
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %18, i64 12, i1 false), !tbaa.struct !28
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %19) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %13, i64 12, i1 false), !tbaa.struct !28
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  invoke void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef %20, ptr noundef nonnull align 8 dereferenceable(24) %102, ptr noundef nonnull align 8 dereferenceable(232) %103, ptr noundef nonnull align 8 dereferenceable(24) %104)
          to label %105 unwind label %118

105:                                              ; preds = %101
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %20) #7
  br label %106

106:                                              ; preds = %105, %82
  %107 = load i32, ptr %17, align 4, !tbaa !20
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %17, align 4, !tbaa !20
  br label %68, !llvm.loop !31

109:                                              ; preds = %96
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %8, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %9, align 4
  br label %117

113:                                              ; preds = %100
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %8, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %9, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %19) #7
  br label %117

117:                                              ; preds = %113, %109
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #7
  br label %122

118:                                              ; preds = %101
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %8, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %9, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %20) #7
  br label %122

122:                                              ; preds = %118, %117, %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #7
  br label %128

123:                                              ; preds = %73
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %15, align 4, !tbaa !20
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %15, align 4, !tbaa !20
  br label %49, !llvm.loop !33

127:                                              ; preds = %54
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %7) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #7
  ret void

128:                                              ; preds = %122, %63
  call void @llvm.lifetime.end.p0(i64 12, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #7
  br label %129

129:                                              ; preds = %128, %59
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %130

130:                                              ; preds = %129, %55
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %7) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr %7) #7
  br label %131

131:                                              ; preds = %130
  %132 = load ptr, ptr %8, align 8
  %133 = load i32, ptr %9, align 4
  %134 = insertvalue { ptr, i32 } poison, ptr %132, 0
  %135 = insertvalue { ptr, i32 } %134, i32 %133, 1
  resume { ptr, i32 } %135
}

; 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

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 = { 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 = !{!22, !13, i64 4}
!22 = !{!"_ZTS7Array3dISt6vectorIiSaIiEEE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !14, i64 24, !23, i64 32, !13, i64 56}
!23 = !{!"_ZTSSt6vectorIiSaIiEE", !24, i64 0}
!24 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!27 = !{!22, !13, i64 0}
!28 = !{i64 0, i64 4, !29, i64 4, i64 4, !29, i64 8, i64 4, !29}
!29 = !{!30, !30, i64 0}
!30 = !{!"float", !7, i64 0}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}


; 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.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.vmath::vec3" = type { float, float, float }

; 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
define dso_local void @_ZN5utils18_getCollisionGridZER12TriangleMeshdR7Array3dISt6vectorIdSaIdEEE(ptr noundef nonnull align 8 dereferenceable(232) %0, double noundef %1, ptr noundef nonnull align 8 dereferenceable(60) %2) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.Array3d, align 8
  %5 = alloca %"class.vmath::vec3", align 4
  %6 = alloca %"class.vmath::vec3", align 4
  %7 = alloca %"class.vmath::vec3", align 4
  %8 = alloca %"class.vmath::vec3", align 4
  %9 = alloca %"class.vmath::vec3", align 4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #7
  %10 = load i32, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %2, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !16
  call void @_ZN7Array3dISt6vectorIiSaIiEEEC2Eiii(ptr noundef nonnull align 8 dereferenceable(60) %4, i32 noundef %10, i32 noundef %12, 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) %4)
          to label %13 unwind label %31

13:                                               ; preds = %3
  %14 = fmul double %1, 5.000000e-02
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  %15 = fneg double %14
  %16 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %14, double noundef %15)
  %17 = fptrunc double %16 to float
  %18 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %14, double noundef %15)
  %19 = fptrunc double %18 to float
  %20 = call noundef double @_ZN5utils13_randomDoubleEdd(double noundef %14, double noundef %15)
  %21 = fptrunc double %20 to float
  invoke void @_ZN5vmath4vec3C1Efff(ptr noundef nonnull align 4 dereferenceable(12) %5, float noundef %17, float noundef %19, float noundef %21)
          to label %22 unwind label %33

22:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
          to label %.preheader43 unwind label %35

.preheader43:                                     ; preds = %22
  %23 = getelementptr inbounds i8, ptr %4, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !17
  %25 = icmp sgt i32 %24, 0
  %26 = load i32, ptr %4, align 8
  %27 = icmp sgt i32 %26, 0
  %or.cond = select i1 %25, i1 %27, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge46

.preheader:                                       ; preds = %.preheader43, %._crit_edge
  %28 = phi i32 [ %37, %._crit_edge ], [ %24, %.preheader43 ]
  %29 = phi i32 [ %38, %._crit_edge ], [ %26, %.preheader43 ]
  %.03045 = phi i32 [ %39, %._crit_edge ], [ 0, %.preheader43 ]
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph, label %._crit_edge

._crit_edge46:                                    ; preds = %._crit_edge, %.preheader43
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %4) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #7
  ret void

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

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

35:                                               ; preds = %22
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %67

._crit_edge.loopexit:                             ; preds = %55
  %.pre = load i32, ptr %23, align 4, !tbaa !17
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %37 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %28, %.preheader ]
  %38 = phi i32 [ %57, %._crit_edge.loopexit ], [ %29, %.preheader ]
  %39 = add nuw nsw i32 %.03045, 1
  %40 = icmp slt i32 %39, %37
  br i1 %40, label %.preheader, label %._crit_edge46, !llvm.loop !23

.lr.ph:                                           ; preds = %.preheader, %55
  %.044 = phi i32 [ %56, %55 ], [ 0, %.preheader ]
  %41 = invoke noundef ptr @_ZN7Array3dISt6vectorIiSaIiEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %4, i32 noundef %.044, i32 noundef %.03045, i32 noundef 0)
          to label %42 unwind label %45

42:                                               ; preds = %.lr.ph
  %43 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #7
  %44 = icmp eq i64 %43, 0
  br i1 %44, label %55, label %47

45:                                               ; preds = %49, %47, %.lr.ph
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %66

47:                                               ; preds = %42
  %48 = invoke noundef ptr @_ZN7Array3dISt6vectorIdSaIdEEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(60) %2, i32 noundef %.044, i32 noundef %.03045, i32 noundef 0)
          to label %49 unwind label %45

49:                                               ; preds = %47
  %50 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #7
  invoke void @_ZNSt6vectorIdSaIdEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %48, i64 noundef %50)
          to label %51 unwind label %45

51:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #7
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %8, i32 noundef %.044, i32 noundef %.03045, i32 noundef -1, double noundef %1)
          to label %52 unwind label %59

52:                                               ; preds = %51
  invoke void @_ZN5vmathplERKNS_4vec3ES2_(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %7, ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %5)
          to label %53 unwind label %61

53:                                               ; preds = %52
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %7, i64 12, i1 false), !tbaa.struct !26
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %6, i64 12, i1 false), !tbaa.struct !26
  invoke void @_ZN5utils23_getTriangleCollisionsZEN5vmath4vec3ERSt6vectorIiSaIiEER12TriangleMeshRS2_IdSaIdEE(ptr noundef nonnull %9, ptr noundef nonnull align 8 dereferenceable(24) %41, ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef nonnull align 8 dereferenceable(24) %48)
          to label %54 unwind label %64

54:                                               ; preds = %53
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #7
  br label %55

55:                                               ; preds = %42, %54
  %56 = add nuw nsw i32 %.044, 1
  %57 = load i32, ptr %4, align 8, !tbaa !29
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !30

59:                                               ; preds = %51
  %60 = landingpad { ptr, i32 }
          cleanup
  br label %63

61:                                               ; preds = %52
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #7
  br label %63

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

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

66:                                               ; preds = %64, %63, %45
  %.pn38 = phi { ptr, i32 } [ %65, %64 ], [ %.pn, %63 ], [ %46, %45 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #7
  br label %67

67:                                               ; preds = %66, %35
  %.pn38.pn = phi { ptr, i32 } [ %.pn38, %66 ], [ %36, %35 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #7
  br label %68

68:                                               ; preds = %67, %33
  %.pn38.pn.pn = phi { ptr, i32 } [ %.pn38.pn, %67 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br label %69

69:                                               ; preds = %68, %31
  %.pn38.pn.pn.pn = phi { ptr, i32 } [ %.pn38.pn.pn, %68 ], [ %32, %31 ]
  call void @_ZN7Array3dISt6vectorIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(60) %4) #7
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn38.pn.pn.pn
}

; 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

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 = { 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 = !{!18, !7, i64 4}
!18 = !{!"_ZTS7Array3dISt6vectorIiSaIiEEE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !11, i64 24, !19, i64 32, !7, i64 56}
!19 = !{!"_ZTSSt6vectorIiSaIiEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!23 = distinct !{!23, !24, !25}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!"llvm.loop.unswitch.partial.disable"}
!26 = !{i64 0, i64 4, !27, i64 4, i64 4, !27, i64 8, i64 4, !27}
!27 = !{!28, !28, i64 0}
!28 = !{!"float", !8, i64 0}
!29 = !{!18, !7, i64 0}
!30 = distinct !{!30, !24}


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