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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.GridPoint = type { %"class.vmath::vec3", %struct.GridPointReference }
%"class.vmath::vec3" = type { float, float, float }
%struct.GridPointReference = type { i32 }
%struct.GridIndex = type { i32, i32, i32 }
%"struct.SpatialPointGrid::CellNode" = type { i32, i32 }
%class.SpatialPointGrid = type { i32, i32, i32, double, %"class.std::vector", %"class.std::vector.0", %class.Array3d, %class.AABB }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl" }
%"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridPoint, std::allocator<GridPoint>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<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 = type { i32, i32, i32, ptr, i8, %"struct.SpatialPointGrid::CellNode", i32 }
%class.AABB = type { %"class.vmath::vec3", double, double, double }

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16SpatialPointGrid24_insertCellNodesIntoGridEv(ptr noundef nonnull align 8 dereferenceable(152) %0) #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.GridPoint, align 4
  %4 = alloca %struct.GridIndex, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %struct.GridIndex, align 4
  %9 = alloca %"class.vmath::vec3", align 4
  %10 = alloca { i64, i32 }, align 8
  %11 = alloca %"struct.SpatialPointGrid::CellNode", align 4
  %12 = alloca %struct.GridIndex, align 4
  %13 = alloca { i64, i32 }, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.GridIndex, align 4
  %17 = alloca %"class.vmath::vec3", align 4
  %18 = alloca { i64, i32 }, align 8
  %19 = alloca %struct.GridIndex, align 4
  %20 = alloca %"struct.SpatialPointGrid::CellNode", align 4
  %21 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %22 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #7
  call void @_ZN9GridPointC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %3)
  call void @llvm.lifetime.start.p0(i64 12, ptr %4) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %23 unwind label %31

23:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %119, %23
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 4
  %28 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %27) #7
  %29 = icmp ult i64 %26, %28
  br i1 %29, label %35, label %30

30:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %123

31:                                               ; preds = %1
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %5, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %6, align 4
  br label %124

35:                                               ; preds = %24
  %36 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 4
  %37 = load i32, ptr %7, align 4, !tbaa !9
  %38 = zext i32 %37 to i64
  %39 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorI9GridPointSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %36, i64 noundef %38) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 %39, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 12, ptr %8) #7
  %40 = getelementptr inbounds %struct.GridPoint, ptr %3, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %40, i64 12, i1 false), !tbaa.struct !14
  %41 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 3
  %42 = load double, ptr %41, align 8, !tbaa !15
  %43 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef %9, double noundef %42)
          to label %44 unwind label %74

44:                                               ; preds = %35
  store { i64, i32 } %43, ptr %10, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %8, ptr align 8 %10, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %4, ptr align 4 %8, i64 12, i1 false), !tbaa.struct !31
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %45 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %4, i64 12, i1 false), !tbaa.struct !31
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %12, i64 12, i1 false)
  %46 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 0
  %47 = load i64, ptr %46, align 4
  %48 = getelementptr inbounds { i64, i32 }, ptr %13, i32 0, i32 1
  %49 = load i32, ptr %48, align 4
  %50 = invoke i64 @_ZN7Array3dIN16SpatialPointGrid8CellNodeEEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %45, i64 %47, i32 %49)
          to label %51 unwind label %78

51:                                               ; preds = %44
  store i64 %50, ptr %11, align 4
  %52 = getelementptr inbounds %"struct.SpatialPointGrid::CellNode", ptr %11, i32 0, i32 0
  %53 = load i32, ptr %52, align 4, !tbaa !32
  %54 = icmp eq i32 %53, -1
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br i1 %54, label %55, label %118

55:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %56 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %56, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %101, %55
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 4
  %61 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #7
  %62 = icmp ult i64 %59, %61
  br i1 %62, label %63, label %102

63:                                               ; preds = %57
  %64 = load i32, ptr %15, align 4, !tbaa !9
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %15, align 4, !tbaa !9
  %66 = load i32, ptr %7, align 4, !tbaa !9
  %67 = add i32 %66, 1
  store i32 %67, ptr %7, align 4, !tbaa !9
  %68 = load i32, ptr %7, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 4
  %71 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %70) #7
  %72 = icmp eq i64 %69, %71
  br i1 %72, label %73, label %82

73:                                               ; preds = %63
  br label %102

74:                                               ; preds = %35
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %5, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %6, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %9) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %8) #7
  br label %122

78:                                               ; preds = %44
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %5, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %122

82:                                               ; preds = %63
  %83 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 4
  %84 = load i32, ptr %7, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorI9GridPointSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %83, i64 noundef %85) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 %86, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #7
  %87 = getelementptr inbounds %struct.GridPoint, ptr %3, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %87, i64 12, i1 false), !tbaa.struct !14
  %88 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 3
  %89 = load double, ptr %88, align 8, !tbaa !15
  %90 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef %17, double noundef %89)
          to label %91 unwind label %97

91:                                               ; preds = %82
  store { i64, i32 } %90, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 8 %18, i64 12, i1 false)
  %92 = invoke noundef zeroext i1 @_ZNK9GridIndexneERKS_(ptr noundef nonnull align 4 dereferenceable(12) %16, ptr noundef nonnull align 4 dereferenceable(12) %4)
          to label %93 unwind label %97

93:                                               ; preds = %91
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %17) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #7
  br i1 %92, label %94, label %101

94:                                               ; preds = %93
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = add i32 %95, -1
  store i32 %96, ptr %7, align 4, !tbaa !9
  br label %102

97:                                               ; preds = %91, %82
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %5, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %6, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %17) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #7
  br label %117

101:                                              ; preds = %93
  br label %57, !llvm.loop !33

102:                                              ; preds = %94, %73, %57
  %103 = getelementptr inbounds %class.SpatialPointGrid, ptr %22, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %4, i64 12, i1 false), !tbaa.struct !31
  %104 = load i32, ptr %14, align 4, !tbaa !9
  %105 = load i32, ptr %15, align 4, !tbaa !9
  invoke void @_ZN16SpatialPointGrid8CellNodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %20, i32 noundef %104, i32 noundef %105)
          to label %106 unwind label %113

106:                                              ; preds = %102
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %19, i64 12, i1 false)
  %107 = getelementptr inbounds { i64, i32 }, ptr %21, i32 0, i32 0
  %108 = load i64, ptr %107, align 4
  %109 = getelementptr inbounds { i64, i32 }, ptr %21, i32 0, i32 1
  %110 = load i32, ptr %109, align 4
  %111 = load i64, ptr %20, align 4
  invoke void @_ZN7Array3dIN16SpatialPointGrid8CellNodeEE3setE9GridIndexS1_(ptr noundef nonnull align 8 dereferenceable(40) %103, i64 %108, i32 %110, i64 %111)
          to label %112 unwind label %113

112:                                              ; preds = %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %118

113:                                              ; preds = %106, %102
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %5, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %6, align 4
  br label %117

117:                                              ; preds = %113, %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %122

118:                                              ; preds = %112, %51
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = add i32 %120, 1
  store i32 %121, ptr %7, align 4, !tbaa !9
  br label %24, !llvm.loop !35

122:                                              ; preds = %117, %78, %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %124

123:                                              ; preds = %30
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #7
  call void @_ZN9GridPointD2Ev(ptr noundef nonnull align 4 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #7
  ret void

124:                                              ; preds = %122, %31
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #7
  call void @_ZN9GridPointD2Ev(ptr noundef nonnull align 4 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #7
  br label %125

125:                                              ; preds = %124
  %126 = load ptr, ptr %5, align 8
  %127 = load i32, ptr %6, align 4
  %128 = insertvalue { ptr, i32 } poison, ptr %126, 0
  %129 = insertvalue { ptr, i32 } %128, i32 %127, 1
  resume { ptr, i32 } %129
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9GridPointC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9GridIndexneERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16SpatialPointGrid8CellNodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12, i64 12, i64 4, !9}
!12 = !{!13, !13, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12}
!15 = !{!16, !17, i64 16}
!16 = !{!"_ZTS16SpatialPointGrid", !10, i64 0, !10, i64 4, !10, i64 8, !17, i64 16, !18, i64 24, !22, i64 48, !26, i64 72, !29, i64 112}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTSSt6vectorI9GridPointSaIS0_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseI9GridPointSaIS0_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseI9GridPointSaIS0_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseI9GridPointSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSSt6vectorIiSaIiEE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!"_ZTS7Array3dIN16SpatialPointGrid8CellNodeEE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !27, i64 24, !28, i64 28, !10, i64 36}
!27 = !{!"bool", !7, i64 0}
!28 = !{!"_ZTSN16SpatialPointGrid8CellNodeE", !10, i64 0, !10, i64 4}
!29 = !{!"_ZTS4AABB", !30, i64 0, !17, i64 16, !17, i64 24, !17, i64 32}
!30 = !{!"_ZTSN5vmath4vec3E", !13, i64 0, !13, i64 4, !13, i64 8}
!31 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9}
!32 = !{!28, !10, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.GridPoint = type { %"class.vmath::vec3", %struct.GridPointReference }
%"class.vmath::vec3" = type { float, float, float }
%struct.GridPointReference = type { i32 }
%struct.GridIndex = type { i32, i32, i32 }
%"struct.SpatialPointGrid::CellNode" = type { i32, i32 }

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN16SpatialPointGrid24_insertCellNodesIntoGridEv(ptr noundef nonnull align 8 dereferenceable(152) %0) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %struct.GridPoint, align 4
  %3 = alloca %struct.GridIndex, align 8
  %4 = alloca %"class.vmath::vec3", align 4
  %5 = alloca %struct.GridIndex, align 8
  %6 = alloca %"class.vmath::vec3", align 4
  %7 = alloca %"struct.SpatialPointGrid::CellNode", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #7
  call void @_ZN9GridPointC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %2)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %3)
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  %.not = icmp eq i64 %9, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.517.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  %.sroa.24.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  br label %12

._crit_edge:                                      ; preds = %47, %1
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #7
  call void @_ZN9GridPointD2Ev(ptr noundef nonnull align 4 dereferenceable(16) %2) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #7
  ret void

12:                                               ; preds = %.lr.ph, %47
  %13 = phi i64 [ 0, %.lr.ph ], [ %49, %47 ]
  %.03139 = phi i32 [ 0, %.lr.ph ], [ %48, %47 ]
  %14 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorI9GridPointSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %13) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(16) %14, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %4, ptr noundef nonnull align 4 dereferenceable(12) %14, i64 12, i1 false)
  %15 = load double, ptr %10, align 8, !tbaa !12
  %16 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef nonnull %4, double noundef %15)
          to label %17 unwind label %31

17:                                               ; preds = %12
  %.fca.0.extract12 = extractvalue { i64, i32 } %16, 0
  %.fca.1.extract13 = extractvalue { i64, i32 } %16, 1
  store i64 %.fca.0.extract12, ptr %3, align 8
  store i32 %.fca.1.extract13, ptr %.sroa.517.0..sroa_idx, align 8, !tbaa !10
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %4) #7
  %.sroa.09.0.copyload = load i64, ptr %3, align 8
  %.sroa.210.0.copyload = load i32, ptr %.sroa.517.0..sroa_idx, align 8, !tbaa !10
  %18 = invoke i64 @_ZN7Array3dIN16SpatialPointGrid8CellNodeEEclE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %11, i64 %.sroa.09.0.copyload, i32 %.sroa.210.0.copyload)
          to label %19 unwind label %33

19:                                               ; preds = %17
  %20 = and i64 %18, 4294967295
  %21 = icmp eq i64 %20, 4294967295
  br i1 %21, label %.preheader, label %47

.preheader:                                       ; preds = %19, %39
  %.033 = phi i32 [ %26, %39 ], [ 0, %19 ]
  %.132 = phi i32 [ %27, %39 ], [ %.03139, %19 ]
  %22 = zext i32 %.132 to i64
  %23 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  %24 = icmp ugt i64 %23, %22
  br i1 %24, label %25, label %43

25:                                               ; preds = %.preheader
  %26 = add nuw nsw i32 %.033, 1
  %27 = add i32 %.132, 1
  %28 = zext i32 %27 to i64
  %29 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  %30 = icmp eq i64 %29, %28
  br i1 %30, label %43, label %35

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

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

35:                                               ; preds = %25
  %36 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt6vectorI9GridPointSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %28) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(16) %36, i64 16, i1 false), !tbaa.struct !5
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #7
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 4 dereferenceable(12) %36, i64 12, i1 false)
  %37 = load double, ptr %10, align 8, !tbaa !12
  %38 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef nonnull %6, double noundef %37)
          to label %39 unwind label %41

39:                                               ; preds = %35
  %.fca.0.extract = extractvalue { i64, i32 } %38, 0
  %.fca.1.extract = extractvalue { i64, i32 } %38, 1
  store i64 %.fca.0.extract, ptr %5, align 8
  store i32 %.fca.1.extract, ptr %.sroa.24.0..sroa_idx, align 8
  %40 = call noundef zeroext i1 @_ZNK9GridIndexneERKS_(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %3)
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br i1 %40, label %43, label %.preheader, !llvm.loop !29

41:                                               ; preds = %35
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #7
  br label %52

43:                                               ; preds = %39, %25, %.preheader
  %.134 = phi i32 [ %26, %25 ], [ %.033, %.preheader ], [ %26, %39 ]
  %.2 = phi i32 [ %27, %25 ], [ %.132, %.preheader ], [ %.132, %39 ]
  %.sroa.01.0.copyload = load i64, ptr %3, align 8
  %.sroa.22.0.copyload = load i32, ptr %.sroa.517.0..sroa_idx, align 8, !tbaa !10
  call void @_ZN16SpatialPointGrid8CellNodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef %.03139, i32 noundef %.134)
  %44 = load i64, ptr %7, align 8
  invoke void @_ZN7Array3dIN16SpatialPointGrid8CellNodeEE3setE9GridIndexS1_(ptr noundef nonnull align 8 dereferenceable(40) %11, i64 %.sroa.01.0.copyload, i32 %.sroa.22.0.copyload, i64 %44)
          to label %47 unwind label %45

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

47:                                               ; preds = %43, %19
  %.3 = phi i32 [ %.03139, %19 ], [ %.2, %43 ]
  %48 = add i32 %.3, 1
  %49 = zext i32 %48 to i64
  %50 = call noundef i64 @_ZNKSt6vectorI9GridPointSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #7
  %51 = icmp ugt i64 %50, %49
  br i1 %51, label %12, label %._crit_edge, !llvm.loop !31

52:                                               ; preds = %41, %45, %33, %31
  %.pn.pn = phi { ptr, i32 } [ %34, %33 ], [ %32, %31 ], [ %46, %45 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #7
  call void @_ZN9GridPointD2Ev(ptr noundef nonnull align 4 dereferenceable(16) %2) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #7
  resume { ptr, i32 } %.pn.pn
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9GridPointC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK9GridIndexneERKS_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN16SpatialPointGrid8CellNodeC2Eii(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, i32 noundef) unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6, i64 12, i64 4, !10}
!6 = !{!7, !7, i64 0}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !14, i64 16}
!13 = !{!"_ZTS16SpatialPointGrid", !11, i64 0, !11, i64 4, !11, i64 8, !14, i64 16, !15, i64 24, !20, i64 48, !24, i64 72, !27, i64 112}
!14 = !{!"double", !8, i64 0}
!15 = !{!"_ZTSSt6vectorI9GridPointSaIS0_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseI9GridPointSaIS0_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseI9GridPointSaIS0_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseI9GridPointSaIS0_EE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"any pointer", !8, i64 0}
!20 = !{!"_ZTSSt6vectorIiSaIiEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!24 = !{!"_ZTS7Array3dIN16SpatialPointGrid8CellNodeEE", !11, i64 0, !11, i64 4, !11, i64 8, !19, i64 16, !25, i64 24, !26, i64 28, !11, i64 36}
!25 = !{!"bool", !8, i64 0}
!26 = !{!"_ZTSN16SpatialPointGrid8CellNodeE", !11, i64 0, !11, i64 4}
!27 = !{!"_ZTS4AABB", !28, i64 0, !14, i64 16, !14, i64 24, !14, i64 32}
!28 = !{!"_ZTSN5vmath4vec3E", !7, i64 0, !7, i64 4, !7, i64 8}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


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