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

; 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.35 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], i32, i32, [4 x i8] }>
%struct.GridIndex = type { i32, i32, i32 }
%"class.vmath::vec3" = type { float, float, float }
%class.FluidBrickGrid = type <{ i32, i32, i32, [4 x i8], double, %class.AABB, %class.Array3d, %class.Array3d.0, [3 x %class.Array3d.0], i32, [4 x i8], %class.Array3d.0, i8, [3 x i8], i32, i32, float, float, float, i32, i32, i8, [7 x i8] }>
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], %"struct.FluidBrickGrid::DensityNode", i32, [4 x i8] }>
%"struct.FluidBrickGrid::DensityNode" = type { float, float, float }
%class.Array3d.0 = type { i32, i32, i32, ptr, i8, [3 x i8], %struct.Brick, i32 }
%struct.Brick = type <{ float, i8, [3 x i8] }>

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) #0

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

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64, i32, i32 noundef, i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7Array3dIN14FluidBrickGrid11DensityNodeEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) #5 align 2

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

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

33:                                               ; preds = %80, %32
  %34 = load i32, ptr %9, align 4, !tbaa !23
  %35 = zext i32 %34 to i64
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %36) #8
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %44, label %39

39:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %84

40:                                               ; preds = %2
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %7, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %8, align 4
  br label %163

44:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 12, ptr %10) #8
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = load i32, ptr %9, align 4, !tbaa !23
  %47 = zext i32 %46 to i64
  %48 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %45, i64 noundef %47) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %48, i64 12, i1 false), !tbaa.struct !24
  %49 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 4
  %50 = load double, ptr %49, align 8, !tbaa !26
  %51 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef %11, double noundef %50)
          to label %52 unwind label %71

52:                                               ; preds = %44
  store { i64, i32 } %51, ptr %12, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 8 %12, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 %10, i64 12, i1 false), !tbaa.struct !27
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !27
  %53 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 0
  %54 = load i32, ptr %53, align 8, !tbaa !9
  %55 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 1
  %56 = load i32, ptr %55, align 4, !tbaa !21
  %57 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 2
  %58 = load i32, ptr %57, align 8, !tbaa !22
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %14, ptr align 4 %13, i64 12, i1 false)
  %59 = getelementptr inbounds { i64, i32 }, ptr %14, i32 0, i32 0
  %60 = load i64, ptr %59, align 4
  %61 = getelementptr inbounds { i64, i32 }, ptr %14, i32 0, i32 1
  %62 = load i32, ptr %61, align 4
  %63 = invoke noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64 %60, i32 %62, i32 noundef %54, i32 noundef %56, i32 noundef %58)
          to label %64 unwind label %75

64:                                               ; preds = %52
  br i1 %63, label %65, label %79

65:                                               ; preds = %64
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %6, i64 12, i1 false), !tbaa.struct !27
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %15, i64 12, i1 false)
  %66 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 0
  %67 = load i64, ptr %66, align 4
  %68 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 1
  %69 = load i32, ptr %68, align 4
  invoke void @_ZN7Array3dIiE3addE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(36) %5, i64 %67, i32 %69, i32 noundef 1)
          to label %70 unwind label %75

70:                                               ; preds = %65
  br label %79

71:                                               ; preds = %44
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %7, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %8, align 4
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %11) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %10) #8
  br label %83

75:                                               ; preds = %65, %52
  %76 = landingpad { ptr, i32 }
          cleanup
  %77 = extractvalue { ptr, i32 } %76, 0
  store ptr %77, ptr %7, align 8
  %78 = extractvalue { ptr, i32 } %76, 1
  store i32 %78, ptr %8, align 4
  br label %83

79:                                               ; preds = %70, %64
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %9, align 4, !tbaa !23
  %82 = add i32 %81, 1
  store i32 %82, ptr %9, align 4, !tbaa !23
  br label %33, !llvm.loop !28

83:                                               ; preds = %75, %71
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %163

84:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %85 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 14
  %86 = load i32, ptr %85, align 4, !tbaa !30
  %87 = sitofp i32 %86 to double
  store double %87, ptr %17, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %88 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 15
  %89 = load i32, ptr %88, align 8, !tbaa !32
  %90 = sitofp i32 %89 to double
  store double %90, ptr %18, align 8, !tbaa !31
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !23
  br label %91

91:                                               ; preds = %159, %84
  %92 = load i32, ptr %20, align 4, !tbaa !23
  %93 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 2
  %94 = load i32, ptr %93, align 8, !tbaa !22
  %95 = icmp slt i32 %92, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %91
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %162

97:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  store i32 0, ptr %22, align 4, !tbaa !23
  br label %98

98:                                               ; preds = %155, %97
  %99 = load i32, ptr %22, align 4, !tbaa !23
  %100 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 1
  %101 = load i32, ptr %100, align 4, !tbaa !21
  %102 = icmp slt i32 %99, %101
  br i1 %102, label %104, label %103

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

104:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  store i32 0, ptr %23, align 4, !tbaa !23
  br label %105

105:                                              ; preds = %151, %104
  %106 = load i32, ptr %23, align 4, !tbaa !23
  %107 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 0
  %108 = load i32, ptr %107, align 8, !tbaa !9
  %109 = icmp slt i32 %106, %108
  br i1 %109, label %111, label %110

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

111:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #8
  %112 = load i32, ptr %23, align 4, !tbaa !23
  %113 = load i32, ptr %22, align 4, !tbaa !23
  %114 = load i32, ptr %20, align 4, !tbaa !23
  %115 = invoke noundef i32 @_ZN7Array3dIiEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %5, i32 noundef %112, i32 noundef %113, i32 noundef %114)
          to label %116 unwind label %146

116:                                              ; preds = %111
  %117 = sitofp i32 %115 to double
  %118 = load double, ptr %17, align 8, !tbaa !31
  %119 = fsub double %117, %118
  %120 = load double, ptr %18, align 8, !tbaa !31
  %121 = load double, ptr %17, align 8, !tbaa !31
  %122 = fsub double %120, %121
  %123 = fdiv double %119, %122
  store double %123, ptr %24, align 8, !tbaa !31
  %124 = load double, ptr %24, align 8, !tbaa !31
  %125 = call double @llvm.maxnum.f64(double 0.000000e+00, double %124)
  store double %125, ptr %24, align 8, !tbaa !31
  %126 = load double, ptr %24, align 8, !tbaa !31
  %127 = call double @llvm.minnum.f64(double 1.000000e+00, double %126)
  store double %127, ptr %24, align 8, !tbaa !31
  %128 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 6
  %129 = load i32, ptr %23, align 4, !tbaa !23
  %130 = load i32, ptr %22, align 4, !tbaa !23
  %131 = load i32, ptr %20, align 4, !tbaa !23
  %132 = invoke noundef ptr @_ZN7Array3dIN14FluidBrickGrid11DensityNodeEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(44) %128, i32 noundef %129, i32 noundef %130, i32 noundef %131)
          to label %133 unwind label %146

133:                                              ; preds = %116
  store ptr %132, ptr %19, align 8, !tbaa !5
  %134 = load double, ptr %24, align 8, !tbaa !31
  %135 = fptrunc double %134 to float
  %136 = load ptr, ptr %19, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.FluidBrickGrid::DensityNode", ptr %136, i32 0, i32 1
  store float %135, ptr %137, align 4, !tbaa !33
  %138 = getelementptr inbounds %class.FluidBrickGrid, ptr %25, i32 0, i32 20
  %139 = load i32, ptr %138, align 4, !tbaa !34
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %141, label %150

141:                                              ; preds = %133
  %142 = load double, ptr %24, align 8, !tbaa !31
  %143 = fptrunc double %142 to float
  %144 = load ptr, ptr %19, align 8, !tbaa !5
  %145 = getelementptr inbounds %"struct.FluidBrickGrid::DensityNode", ptr %144, i32 0, i32 0
  store float %143, ptr %145, align 4, !tbaa !35
  br label %150

146:                                              ; preds = %116, %111
  %147 = landingpad { ptr, i32 }
          cleanup
  %148 = extractvalue { ptr, i32 } %147, 0
  store ptr %148, ptr %7, align 8
  %149 = extractvalue { ptr, i32 } %147, 1
  store i32 %149, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  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 @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %163

150:                                              ; preds = %141, %133
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #8
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %23, align 4, !tbaa !23
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %23, align 4, !tbaa !23
  br label %105, !llvm.loop !36

154:                                              ; preds = %110
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %22, align 4, !tbaa !23
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %22, align 4, !tbaa !23
  br label %98, !llvm.loop !37

158:                                              ; preds = %103
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %20, align 4, !tbaa !23
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %20, align 4, !tbaa !23
  br label %91, !llvm.loop !38

162:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #8
  call void @_ZN7Array3dIiED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #8
  ret void

163:                                              ; preds = %146, %83, %40
  call void @llvm.lifetime.end.p0(i64 12, ptr %6) #8
  call void @_ZN7Array3dIiED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #8
  br label %164

164:                                              ; preds = %163
  %165 = load ptr, ptr %7, align 8
  %166 = load i32, ptr %8, align 4
  %167 = insertvalue { ptr, i32 } poison, ptr %165, 0
  %168 = insertvalue { ptr, i32 } %167, i32 %166, 1
  resume { ptr, i32 } %168
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIiEC2Eiiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #5 align 2

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIiE3addE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(36), i64, i32, i32 noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Array3dIiEclEiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef) #5 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIiED2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #3 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS14FluidBrickGrid", !11, i64 0, !11, i64 4, !11, i64 8, !12, i64 16, !13, i64 24, !16, i64 64, !19, i64 112, !7, i64 152, !11, i64 272, !19, i64 280, !17, i64 320, !11, i64 324, !11, i64 328, !15, i64 332, !15, i64 336, !15, i64 340, !11, i64 344, !11, i64 348, !17, i64 352}
!11 = !{!"int", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"_ZTS4AABB", !14, i64 0, !12, i64 16, !12, i64 24, !12, i64 32}
!14 = !{!"_ZTSN5vmath4vec3E", !15, i64 0, !15, i64 4, !15, i64 8}
!15 = !{!"float", !7, i64 0}
!16 = !{!"_ZTS7Array3dIN14FluidBrickGrid11DensityNodeEE", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !17, i64 24, !18, i64 28, !11, i64 40}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTSN14FluidBrickGrid11DensityNodeE", !15, i64 0, !15, i64 4, !15, i64 8}
!19 = !{!"_ZTS7Array3dI5BrickE", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !17, i64 24, !20, i64 28, !11, i64 36}
!20 = !{!"_ZTS5Brick", !15, i64 0, !17, i64 4}
!21 = !{!10, !11, i64 4}
!22 = !{!10, !11, i64 8}
!23 = !{!11, !11, i64 0}
!24 = !{i64 0, i64 4, !25, i64 4, i64 4, !25, i64 8, i64 4, !25}
!25 = !{!15, !15, i64 0}
!26 = !{!10, !12, i64 16}
!27 = !{i64 0, i64 4, !23, i64 4, i64 4, !23, i64 8, i64 4, !23}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!10, !11, i64 324}
!31 = !{!12, !12, i64 0}
!32 = !{!10, !11, i64 328}
!33 = !{!18, !15, i64 4}
!34 = !{!10, !11, i64 348}
!35 = !{!18, !15, i64 0}
!36 = distinct !{!36, !29}
!37 = distinct !{!37, !29}
!38 = distinct !{!38, !29}


; 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.35 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], i32, i32, [4 x i8] }>
%struct.GridIndex = type { i32, i32, i32 }
%"class.vmath::vec3" = type { float, float, float }

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) #0

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

; 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 nounwind uwtable
declare dso_local void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64, i32, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7Array3dIN14FluidBrickGrid11DensityNodeEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14FluidBrickGrid22_updateTargetDensitiesERSt6vectorIN5vmath4vec3ESaIS2_EE(ptr noundef nonnull align 8 dereferenceable(353) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.Array3d.35, align 8
  %4 = alloca %struct.GridIndex, align 8
  %5 = alloca %"class.vmath::vec3", align 4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #8
  %6 = load i32, ptr %0, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 4
  %8 = load i32, ptr %7, align 4, !tbaa !20
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !21
  call void @_ZN7Array3dIiEC2Eiiii(ptr noundef nonnull align 8 dereferenceable(36) %3, i32 noundef %6, i32 noundef %8, i32 noundef %10, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #8
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %4)
  %11 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %.not = icmp eq i64 %11, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %4, i64 8
  br label %26

._crit_edge:                                      ; preds = %41, %2
  %13 = getelementptr inbounds i8, ptr %0, i64 324
  %14 = load i32, ptr %13, align 4, !tbaa !22
  %15 = sitofp i32 %14 to double
  %16 = load i32, ptr %9, align 8, !tbaa !21
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.preheader46.lr.ph, label %._crit_edge55

.preheader46.lr.ph:                               ; preds = %._crit_edge
  %18 = getelementptr inbounds i8, ptr %0, i64 328
  %19 = load i32, ptr %18, align 8, !tbaa !23
  %20 = sitofp i32 %19 to double
  %21 = getelementptr inbounds i8, ptr %0, i64 64
  %22 = fsub double %20, %15
  %23 = getelementptr inbounds i8, ptr %0, i64 348
  %24 = load i32, ptr %7, align 4, !tbaa !20
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.preheader46, label %._crit_edge55

26:                                               ; preds = %.lr.ph, %41
  %27 = phi i64 [ 0, %.lr.ph ], [ %43, %41 ]
  %.04247 = phi i32 [ 0, %.lr.ph ], [ %42, %41 ]
  %28 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorIN5vmath4vec3ESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %27) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, ptr noundef nonnull align 4 dereferenceable(12) %28, i64 12, i1 false), !tbaa.struct !24
  %29 = load double, ptr %12, align 8, !tbaa !26
  %30 = invoke { i64, i32 } @_ZN6Grid3d19positionToGridIndexEN5vmath4vec3Ed(ptr noundef nonnull %5, double noundef %29)
          to label %31 unwind label %37

31:                                               ; preds = %26
  %.fca.0.extract = extractvalue { i64, i32 } %30, 0
  %.fca.1.extract = extractvalue { i64, i32 } %30, 1
  store i64 %.fca.0.extract, ptr %4, align 8
  store i32 %.fca.1.extract, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !27
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #8
  %.sroa.024.0.copyload = load i64, ptr %4, align 8
  %.sroa.225.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !27
  %32 = load i32, ptr %0, align 8, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !20
  %34 = load i32, ptr %9, align 8, !tbaa !21
  %35 = call noundef zeroext i1 @_ZN6Grid3d18isGridIndexInRangeE9GridIndexiii(i64 %.sroa.024.0.copyload, i32 %.sroa.225.0.copyload, i32 noundef %32, i32 noundef %33, i32 noundef %34)
  br i1 %35, label %36, label %41

36:                                               ; preds = %31
  %.sroa.020.0.copyload = load i64, ptr %4, align 8
  %.sroa.221.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !27
  invoke void @_ZN7Array3dIiE3addE9GridIndexi(ptr noundef nonnull align 8 dereferenceable(36) %3, i64 %.sroa.020.0.copyload, i32 %.sroa.221.0.copyload, i32 noundef 1)
          to label %41 unwind label %39

37:                                               ; preds = %26
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5vmath4vec3D1Ev(ptr noundef nonnull align 4 dereferenceable(12) %5) #8
  br label %84

39:                                               ; preds = %36
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %84

41:                                               ; preds = %31, %36
  %42 = add i32 %.04247, 1
  %43 = zext i32 %42 to i64
  %44 = call noundef i64 @_ZNKSt6vectorIN5vmath4vec3ESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #8
  %45 = icmp ugt i64 %44, %43
  br i1 %45, label %26, label %._crit_edge, !llvm.loop !28

.preheader46:                                     ; preds = %.preheader46.lr.ph, %._crit_edge52
  %46 = phi i32 [ %55, %._crit_edge52 ], [ %16, %.preheader46.lr.ph ]
  %47 = phi i32 [ %56, %._crit_edge52 ], [ %24, %.preheader46.lr.ph ]
  %48 = phi i32 [ %57, %._crit_edge52 ], [ %24, %.preheader46.lr.ph ]
  %.03853 = phi i32 [ %58, %._crit_edge52 ], [ 0, %.preheader46.lr.ph ]
  %49 = icmp sgt i32 %48, 0
  %50 = load i32, ptr %0, align 8
  %51 = icmp sgt i32 %50, 0
  %or.cond = select i1 %49, i1 %51, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge52

._crit_edge55:                                    ; preds = %._crit_edge52, %.preheader46.lr.ph, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #8
  call void @_ZN7Array3dIiED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %3) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  ret void

.preheader:                                       ; preds = %.preheader46, %._crit_edge50
  %52 = phi i32 [ %60, %._crit_edge50 ], [ %47, %.preheader46 ]
  %53 = phi i32 [ %61, %._crit_edge50 ], [ %50, %.preheader46 ]
  %.03751 = phi i32 [ %62, %._crit_edge50 ], [ 0, %.preheader46 ]
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph49, label %._crit_edge50

._crit_edge52.loopexit:                           ; preds = %._crit_edge50
  %.pre58 = load i32, ptr %9, align 8, !tbaa !21
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %._crit_edge52.loopexit, %.preheader46
  %55 = phi i32 [ %.pre58, %._crit_edge52.loopexit ], [ %46, %.preheader46 ]
  %56 = phi i32 [ %60, %._crit_edge52.loopexit ], [ %47, %.preheader46 ]
  %57 = phi i32 [ %60, %._crit_edge52.loopexit ], [ %48, %.preheader46 ]
  %58 = add nuw nsw i32 %.03853, 1
  %59 = icmp slt i32 %58, %55
  br i1 %59, label %.preheader46, label %._crit_edge55, !llvm.loop !30

._crit_edge50.loopexit:                           ; preds = %80
  %.pre = load i32, ptr %7, align 4, !tbaa !20
  br label %._crit_edge50

._crit_edge50:                                    ; preds = %._crit_edge50.loopexit, %.preheader
  %60 = phi i32 [ %.pre, %._crit_edge50.loopexit ], [ %52, %.preheader ]
  %61 = phi i32 [ %82, %._crit_edge50.loopexit ], [ %53, %.preheader ]
  %62 = add nuw nsw i32 %.03751, 1
  %63 = icmp slt i32 %62, %60
  br i1 %63, label %.preheader, label %._crit_edge52.loopexit, !llvm.loop !32

.lr.ph49:                                         ; preds = %.preheader, %80
  %.048 = phi i32 [ %81, %80 ], [ 0, %.preheader ]
  %64 = invoke noundef i32 @_ZN7Array3dIiEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %3, i32 noundef %.048, i32 noundef %.03751, i32 noundef %.03853)
          to label %65 unwind label %78

65:                                               ; preds = %.lr.ph49
  %66 = invoke noundef ptr @_ZN7Array3dIN14FluidBrickGrid11DensityNodeEE10getPointerEiii(ptr noundef nonnull align 8 dereferenceable(44) %21, i32 noundef %.048, i32 noundef %.03751, i32 noundef %.03853)
          to label %67 unwind label %78

67:                                               ; preds = %65
  %68 = sitofp i32 %64 to double
  %69 = fsub double %68, %15
  %70 = fdiv double %69, %22
  %71 = call double @llvm.maxnum.f64(double %70, double 0.000000e+00)
  %72 = call double @llvm.minnum.f64(double %71, double 1.000000e+00)
  %73 = fptrunc double %72 to float
  %74 = getelementptr inbounds i8, ptr %66, i64 4
  store float %73, ptr %74, align 4, !tbaa !33
  %75 = load i32, ptr %23, align 4, !tbaa !34
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %80

77:                                               ; preds = %67
  store float %73, ptr %66, align 4, !tbaa !35
  br label %80

78:                                               ; preds = %65, %.lr.ph49
  %79 = landingpad { ptr, i32 }
          cleanup
  br label %84

80:                                               ; preds = %77, %67
  %81 = add nuw nsw i32 %.048, 1
  %82 = load i32, ptr %0, align 8, !tbaa !5
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %.lr.ph49, label %._crit_edge50.loopexit, !llvm.loop !36

84:                                               ; preds = %37, %39, %78
  %.pn.pn = phi { ptr, i32 } [ %79, %78 ], [ %40, %39 ], [ %38, %37 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #8
  call void @_ZN7Array3dIiED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %3) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIiEC2Eiiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef, i32 noundef) unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN7Array3dIiEclEiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIiED2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #3 align 2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTS14FluidBrickGrid", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !11, i64 24, !14, i64 64, !18, i64 112, !8, i64 152, !7, i64 272, !18, i64 280, !16, i64 320, !7, i64 324, !7, i64 328, !13, i64 332, !13, i64 336, !13, i64 340, !7, i64 344, !7, i64 348, !16, i64 352}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"_ZTS4AABB", !12, i64 0, !10, i64 16, !10, i64 24, !10, i64 32}
!12 = !{!"_ZTSN5vmath4vec3E", !13, i64 0, !13, i64 4, !13, i64 8}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_ZTS7Array3dIN14FluidBrickGrid11DensityNodeEE", !7, i64 0, !7, i64 4, !7, i64 8, !15, i64 16, !16, i64 24, !17, i64 28, !7, i64 40}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"bool", !8, i64 0}
!17 = !{!"_ZTSN14FluidBrickGrid11DensityNodeE", !13, i64 0, !13, i64 4, !13, i64 8}
!18 = !{!"_ZTS7Array3dI5BrickE", !7, i64 0, !7, i64 4, !7, i64 8, !15, i64 16, !16, i64 24, !19, i64 28, !7, i64 36}
!19 = !{!"_ZTS5Brick", !13, i64 0, !16, i64 4}
!20 = !{!6, !7, i64 4}
!21 = !{!6, !7, i64 8}
!22 = !{!6, !7, i64 324}
!23 = !{!6, !7, i64 328}
!24 = !{i64 0, i64 4, !25, i64 4, i64 4, !25, i64 8, i64 4, !25}
!25 = !{!13, !13, i64 0}
!26 = !{!6, !10, i64 16}
!27 = !{!7, !7, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = distinct !{!30, !29, !31}
!31 = !{!"llvm.loop.unswitch.partial.disable"}
!32 = distinct !{!32, !29, !31}
!33 = !{!17, !13, i64 4}
!34 = !{!6, !7, i64 348}
!35 = !{!17, !13, i64 0}
!36 = distinct !{!36, !29}


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