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

; 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 }
%struct.GridIndex = type { i32, i32, i32 }
%class.GridIndexVector = type { i32, i32, i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.SphericalFluidSource = type { %class.FluidSource, %"class.vmath::vec3", double }
%class.FluidSource = type { ptr, %"class.vmath::vec3", %"class.vmath::vec3", i8, i8, i32 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

declare void @_ZN5vmathmiERKNS_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)) #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN20SphericalFluidSource20_getOverlappingCellsER15GridIndexVectord(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, double noundef %2) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca %struct.GridIndex, align 4
  %12 = alloca %struct.GridIndex, align 4
  %13 = alloca %"class.vmath::vec3", align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca %"class.vmath::vec3", align 4
  %19 = alloca %"class.vmath::vec3", align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca %"class.vmath::vec3", align 4
  %25 = alloca %"class.vmath::vec3", align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store double %2, ptr %6, align 8, !tbaa !9
  %26 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %class.GridIndexVector, ptr %27, i32 0, i32 0
  %29 = load i32, ptr %28, align 8, !tbaa !11
  store i32 %29, ptr %7, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %class.GridIndexVector, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 4, !tbaa !19
  store i32 %32, ptr %8, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.GridIndexVector, ptr %33, i32 0, i32 2
  %35 = load i32, ptr %34, align 8, !tbaa !20
  store i32 %35, ptr %9, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %36 = getelementptr inbounds %class.SphericalFluidSource, ptr %26, i32 0, i32 2
  %37 = load double, ptr %36, align 8, !tbaa !21
  store double %37, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 12, ptr %11) #8
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %11)
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #8
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %12)
  %38 = getelementptr inbounds %class.SphericalFluidSource, ptr %26, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 8 %38, i64 12, i1 false), !tbaa.struct !28
  %39 = load double, ptr %10, align 8, !tbaa !9
  %40 = load double, ptr %6, align 8, !tbaa !9
  %41 = load i32, ptr %7, align 4, !tbaa !18
  %42 = load i32, ptr %8, align 4, !tbaa !18
  %43 = load i32, ptr %9, align 4, !tbaa !18
  invoke void @_ZN6Grid3d18getGridIndexBoundsEN5vmath4vec3EddiiiP9GridIndexS3_(ptr noundef %13, double noundef %39, double noundef %40, i32 noundef %41, i32 noundef %42, i32 noundef %43, ptr noundef %11, ptr noundef %12)
          to label %44 unwind label %57

44:                                               ; preds = %3
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %45 = load double, ptr %10, align 8, !tbaa !9
  %46 = load double, ptr %10, align 8, !tbaa !9
  %47 = fmul double %45, %46
  store double %47, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %18) #8
  call void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18)
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %19)
          to label %48 unwind label %61

48:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %49 = getelementptr inbounds %struct.GridIndex, ptr %11, i32 0, i32 2
  %50 = load i32, ptr %49, align 4, !tbaa !30
  store i32 %50, ptr %20, align 4, !tbaa !18
  br label %51

51:                                               ; preds = %125, %48
  %52 = load i32, ptr %20, align 4, !tbaa !18
  %53 = getelementptr inbounds %struct.GridIndex, ptr %12, i32 0, i32 2
  %54 = load i32, ptr %53, align 4, !tbaa !30
  %55 = icmp sle i32 %52, %54
  br i1 %55, label %65, label %56

56:                                               ; preds = %51
  store i32 2, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %128

57:                                               ; preds = %3
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %14, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %15, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %13) #8
  br label %130

61:                                               ; preds = %44
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %14, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %15, align 4
  br label %129

65:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  %66 = getelementptr inbounds %struct.GridIndex, ptr %11, i32 0, i32 1
  %67 = load i32, ptr %66, align 4, !tbaa !32
  store i32 %67, ptr %22, align 4, !tbaa !18
  br label %68

68:                                               ; preds = %121, %65
  %69 = load i32, ptr %22, align 4, !tbaa !18
  %70 = getelementptr inbounds %struct.GridIndex, ptr %12, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !32
  %72 = icmp sle i32 %69, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %68
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %124

74:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  %75 = getelementptr inbounds %struct.GridIndex, ptr %11, i32 0, i32 0
  %76 = load i32, ptr %75, align 4, !tbaa !33
  store i32 %76, ptr %23, align 4, !tbaa !18
  br label %77

77:                                               ; preds = %116, %74
  %78 = load i32, ptr %23, align 4, !tbaa !18
  %79 = getelementptr inbounds %struct.GridIndex, ptr %12, i32 0, i32 0
  %80 = load i32, ptr %79, align 4, !tbaa !33
  %81 = icmp sle i32 %78, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %77
  store i32 8, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %120

83:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 12, ptr %24) #8
  %84 = load i32, ptr %23, align 4, !tbaa !18
  %85 = load i32, ptr %22, align 4, !tbaa !18
  %86 = load i32, ptr %20, align 4, !tbaa !18
  %87 = load double, ptr %6, align 8, !tbaa !9
  invoke void @_ZN6Grid3d21GridIndexToCellCenterEiiid(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %24, i32 noundef %84, i32 noundef %85, i32 noundef %86, double noundef %87)
          to label %88 unwind label %103

88:                                               ; preds = %83
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %24, i64 12, i1 false), !tbaa.struct !28
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %24) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %25) #8
  %89 = getelementptr inbounds %class.SphericalFluidSource, ptr %26, i32 0, i32 1
  invoke void @_ZN5vmathmiERKNS_4vec3ES2_(ptr dead_on_unwind writable sret(%"class.vmath::vec3") align 4 %25, ptr noundef nonnull align 4 dereferenceable(12) %18, ptr noundef nonnull align 4 dereferenceable(12) %89)
          to label %90 unwind label %107

90:                                               ; preds = %88
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %25, i64 12, i1 false), !tbaa.struct !28
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %25) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #8
  %91 = invoke noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %19, ptr noundef nonnull align 4 dereferenceable(12) %19)
          to label %92 unwind label %111

92:                                               ; preds = %90
  %93 = fpext float %91 to double
  store double %93, ptr %17, align 8, !tbaa !9
  %94 = load double, ptr %17, align 8, !tbaa !9
  %95 = load double, ptr %16, align 8, !tbaa !9
  %96 = fcmp olt double %94, %95
  br i1 %96, label %97, label %115

97:                                               ; preds = %92
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = load i32, ptr %23, align 4, !tbaa !18
  %100 = load i32, ptr %22, align 4, !tbaa !18
  %101 = load i32, ptr %20, align 4, !tbaa !18
  invoke void @_ZN15GridIndexVector9push_backEiii(ptr noundef nonnull align 8 dereferenceable(40) %98, i32 noundef %99, i32 noundef %100, i32 noundef %101)
          to label %102 unwind label %111

102:                                              ; preds = %97
  br label %115

103:                                              ; preds = %83
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %14, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  br label %119

107:                                              ; preds = %88
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %14, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #8
  br label %119

111:                                              ; preds = %97, %90
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %14, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %15, align 4
  br label %119

115:                                              ; preds = %102, %92
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %23, align 4, !tbaa !18
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %23, align 4, !tbaa !18
  br label %77, !llvm.loop !34

119:                                              ; preds = %111, %107, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %19) #8
  br label %129

120:                                              ; preds = %82
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %22, align 4, !tbaa !18
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %22, align 4, !tbaa !18
  br label %68, !llvm.loop !36

124:                                              ; preds = %73
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %20, align 4, !tbaa !18
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %20, align 4, !tbaa !18
  br label %51, !llvm.loop !37

128:                                              ; preds = %56
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %19) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  ret void

129:                                              ; preds = %119, %61
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %18) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %130

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

131:                                              ; preds = %130
  %132 = load ptr, ptr %14, align 8
  %133 = load i32, ptr %15, 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 nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #5 align 2

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #7

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN15GridIndexVector9push_backEiii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef, i32 noundef) #6 align 2

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


; 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 }
%struct.GridIndex = type { i32, i32, i32 }

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

declare i32 @__gxx_personality_v0(...)

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

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

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

declare void @_ZN5vmathmiERKNS_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 #0

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN20SphericalFluidSource20_getOverlappingCellsER15GridIndexVectord(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(40) %1, double noundef %2) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %struct.GridIndex, align 4
  %5 = alloca %struct.GridIndex, 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
  %10 = alloca %"class.vmath::vec3", align 4
  %11 = load i32, ptr %1, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %1, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !15
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load i32, ptr %14, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  %17 = load double, ptr %16, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #8
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #8
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %5)
  %18 = getelementptr inbounds i8, ptr %0, i64 40
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %6, ptr noundef nonnull align 8 dereferenceable(12) %18, i64 12, i1 false), !tbaa.struct !25
  invoke void @_ZN6Grid3d18getGridIndexBoundsEN5vmath4vec3EddiiiP9GridIndexS3_(ptr noundef nonnull %6, double noundef %17, double noundef %2, i32 noundef %11, i32 noundef %13, i32 noundef %15, ptr noundef nonnull %4, ptr noundef nonnull %5)
          to label %19 unwind label %31

19:                                               ; preds = %3
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %6) #8
  %20 = fmul double %17, %17
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #8
  call void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #8
  invoke void @_ZN5vmath4vec3C1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %21 unwind label %33

21:                                               ; preds = %19
  %22 = getelementptr inbounds i8, ptr %4, i64 8
  %23 = load i32, ptr %22, align 4, !tbaa !27
  %24 = getelementptr inbounds i8, ptr %5, i64 8
  %25 = load i32, ptr %24, align 4, !tbaa !27
  %.not46 = icmp sgt i32 %23, %25
  br i1 %.not46, label %._crit_edge51, label %.lr.ph50

.lr.ph50:                                         ; preds = %21
  %26 = getelementptr inbounds i8, ptr %4, i64 4
  %27 = getelementptr inbounds i8, ptr %5, i64 4
  %28 = load i32, ptr %26, align 4, !tbaa !29
  %29 = load i32, ptr %27, align 4, !tbaa !29
  %30 = icmp sgt i32 %28, %29
  br i1 %30, label %._crit_edge51, label %.lr.ph50.split

._crit_edge51:                                    ; preds = %._crit_edge45, %.lr.ph50, %21
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  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 @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #8
  ret void

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

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

.lr.ph50.split:                                   ; preds = %.lr.ph50, %._crit_edge45
  %35 = phi i32 [ %42, %._crit_edge45 ], [ %25, %.lr.ph50 ]
  %36 = phi i32 [ %43, %._crit_edge45 ], [ %29, %.lr.ph50 ]
  %37 = phi i32 [ %44, %._crit_edge45 ], [ %29, %.lr.ph50 ]
  %.02947 = phi i32 [ %45, %._crit_edge45 ], [ %23, %.lr.ph50 ]
  %38 = load i32, ptr %26, align 4, !tbaa !29
  %.not3441 = icmp sgt i32 %38, %37
  br i1 %.not3441, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %.lr.ph50.split
  %39 = load i32, ptr %4, align 4, !tbaa !30
  %40 = load i32, ptr %5, align 4, !tbaa !30
  %41 = icmp sgt i32 %39, %40
  br i1 %41, label %._crit_edge45, label %.lr.ph44.split

._crit_edge45.loopexit52:                         ; preds = %._crit_edge
  %.pre54 = load i32, ptr %24, align 4, !tbaa !27
  br label %._crit_edge45

._crit_edge45:                                    ; preds = %.lr.ph44, %._crit_edge45.loopexit52, %.lr.ph50.split
  %42 = phi i32 [ %.pre54, %._crit_edge45.loopexit52 ], [ %35, %.lr.ph50.split ], [ %35, %.lr.ph44 ]
  %43 = phi i32 [ %49, %._crit_edge45.loopexit52 ], [ %36, %.lr.ph50.split ], [ %36, %.lr.ph44 ]
  %44 = phi i32 [ %49, %._crit_edge45.loopexit52 ], [ %37, %.lr.ph50.split ], [ %37, %.lr.ph44 ]
  %45 = add nsw i32 %.02947, 1
  %.not.not = icmp slt i32 %.02947, %42
  br i1 %.not.not, label %.lr.ph50.split, label %._crit_edge51, !llvm.loop !31

.lr.ph44.split:                                   ; preds = %.lr.ph44, %._crit_edge
  %46 = phi i32 [ %49, %._crit_edge ], [ %36, %.lr.ph44 ]
  %47 = phi i32 [ %50, %._crit_edge ], [ %40, %.lr.ph44 ]
  %.02842 = phi i32 [ %51, %._crit_edge ], [ %38, %.lr.ph44 ]
  %48 = load i32, ptr %4, align 4, !tbaa !30
  %.not3539 = icmp sgt i32 %48, %47
  br i1 %.not3539, label %._crit_edge, label %.lr.ph

._crit_edge.loopexit:                             ; preds = %64
  %.pre = load i32, ptr %27, align 4, !tbaa !29
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph44.split
  %49 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %46, %.lr.ph44.split ]
  %50 = phi i32 [ %66, %._crit_edge.loopexit ], [ %47, %.lr.ph44.split ]
  %51 = add nsw i32 %.02842, 1
  %.not34.not = icmp slt i32 %.02842, %49
  br i1 %.not34.not, label %.lr.ph44.split, label %._crit_edge45.loopexit52, !llvm.loop !34

.lr.ph:                                           ; preds = %.lr.ph44.split, %64
  %.040 = phi i32 [ %65, %64 ], [ %48, %.lr.ph44.split ]
  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 %.040, i32 noundef %.02842, i32 noundef %.02947, double noundef %2)
          to label %52 unwind label %58

52:                                               ; preds = %.lr.ph
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %9, i64 12, i1 false), !tbaa.struct !25
  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.start.p0(i64 12, ptr nonnull %10) #8
  invoke void @_ZN5vmathmiERKNS_4vec3ES2_(ptr dead_on_unwind nonnull writable sret(%"class.vmath::vec3") align 4 %10, ptr noundef nonnull align 4 dereferenceable(12) %7, ptr noundef nonnull align 4 dereferenceable(12) %18)
          to label %53 unwind label %60

53:                                               ; preds = %52
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %10, i64 12, i1 false), !tbaa.struct !25
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %10) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #8
  %54 = call noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %8)
  %55 = fpext float %54 to double
  %56 = fcmp ogt double %20, %55
  br i1 %56, label %57, label %64

57:                                               ; preds = %53
  invoke void @_ZN15GridIndexVector9push_backEiii(ptr noundef nonnull align 8 dereferenceable(40) %1, i32 noundef %.040, i32 noundef %.02842, i32 noundef %.02947)
          to label %64 unwind label %62

58:                                               ; preds = %.lr.ph
  %59 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #8
  br label %67

60:                                               ; preds = %52
  %61 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #8
  br label %67

62:                                               ; preds = %57
  %63 = landingpad { ptr, i32 }
          cleanup
  br label %67

64:                                               ; preds = %53, %57
  %65 = add nsw i32 %.040, 1
  %66 = load i32, ptr %5, align 4, !tbaa !30
  %.not35.not = icmp slt i32 %.040, %66
  br i1 %.not35.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !35

67:                                               ; preds = %62, %60, %58
  %.pn = phi { ptr, i32 } [ %63, %62 ], [ %61, %60 ], [ %59, %58 ]
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %8) #8
  br label %68

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

69:                                               ; preds = %68, %31
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %68 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn.pn.pn
}

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

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

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZN5vmath3dotERKNS_4vec3ES2_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #7

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

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


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