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

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

%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>
%class.Array3d.0 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], %"class.vmath::vec3", i32, [4 x i8] }>
%"class.vmath::vec3" = type { float, float, float }
%struct.GridIndex = type { i32, i32, i32 }
%class.TurbulenceField = type { %class.Array3d, i32, i32, i32, double, double, [124 x %struct.GridIndex] }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15TurbulenceField16_getVelocityGridEP16MACVelocityFieldR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560), ptr noundef, ptr noundef nonnull align 8 dereferenceable(44)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZN15TurbulenceField30_calculateTurbulenceAtGridCellEiiiR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560), i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(44)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15TurbulenceField24calculateTurbulenceFieldEP16MACVelocityFieldR15GridIndexVector(ptr noundef nonnull align 8 dereferenceable(1560) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(40) %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %class.Array3d, align 8
  %8 = alloca %class.Array3d, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %class.Array3d.0, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca %struct.GridIndex, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.GridIndex, align 4
  %18 = alloca { i64, i32 }, align 8
  %19 = alloca double, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8
  %21 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 0
  call void @_ZN7Array3dIfE4fillEf(ptr noundef nonnull align 8 dereferenceable(36) %21, float noundef 0.000000e+00)
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 1
  %24 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 2
  %25 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 3
  call void @_ZN16MACVelocityField17getGridDimensionsEPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(148) %22, ptr noundef %23, ptr noundef %24, ptr noundef %25)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call noundef double @_ZN16MACVelocityField15getGridCellSizeEv(ptr noundef nonnull align 8 dereferenceable(148) %26)
  %28 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 4
  store double %27, ptr %28, align 8, !tbaa !9
  %29 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 4
  %30 = load double, ptr %29, align 8, !tbaa !9
  %31 = fmul double 2.000000e+00, %30
  %32 = fmul double 3.000000e+00, %31
  %33 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 4
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = fmul double 2.000000e+00, %34
  %36 = fmul double %32, %35
  %37 = call double @sqrt(double noundef %36) #7
  %38 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 5
  store double %37, ptr %38, align 8, !tbaa !16
  %39 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 0
  %40 = getelementptr inbounds %class.Array3d, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !17
  %42 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 1
  %43 = load i32, ptr %42, align 8, !tbaa !18
  %44 = icmp ne i32 %41, %43
  br i1 %44, label %59, label %45

45:                                               ; preds = %3
  %46 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 0
  %47 = getelementptr inbounds %class.Array3d, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !19
  %49 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 2
  %50 = load i32, ptr %49, align 4, !tbaa !20
  %51 = icmp ne i32 %48, %50
  br i1 %51, label %59, label %52

52:                                               ; preds = %45
  %53 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 0
  %54 = getelementptr inbounds %class.Array3d, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !21
  %56 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 3
  %57 = load i32, ptr %56, align 8, !tbaa !22
  %58 = icmp ne i32 %55, %57
  br i1 %58, label %59, label %72

59:                                               ; preds = %52, %45, %3
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #7
  %60 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 1
  %61 = load i32, ptr %60, align 8, !tbaa !18
  %62 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 2
  %63 = load i32, ptr %62, align 4, !tbaa !20
  %64 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 3
  %65 = load i32, ptr %64, align 8, !tbaa !22
  call void @_ZN7Array3dIfEC2Eiii(ptr noundef nonnull align 8 dereferenceable(36) %8, i32 noundef %61, i32 noundef %63, i32 noundef %65)
  %66 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 0
  invoke void @_ZN7Array3dIfEaSERKS0_(ptr dead_on_unwind writable sret(%class.Array3d) align 8 %7, ptr noundef nonnull align 8 dereferenceable(36) %66, ptr noundef nonnull align 8 dereferenceable(36) %8)
          to label %67 unwind label %68

67:                                               ; preds = %59
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %7) #7
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %8) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #7
  br label %72

68:                                               ; preds = %59
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %9, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %10, align 4
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %8) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #7
  br label %162

72:                                               ; preds = %67, %52
  call void @llvm.lifetime.start.p0(i64 48, ptr %11) #7
  %73 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 1
  %74 = load i32, ptr %73, align 8, !tbaa !18
  %75 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 2
  %76 = load i32, ptr %75, align 4, !tbaa !20
  %77 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 3
  %78 = load i32, ptr %77, align 8, !tbaa !22
  call void @_ZN7Array3dIN5vmath4vec3EEC2Eiii(ptr noundef nonnull align 8 dereferenceable(44) %11, i32 noundef %74, i32 noundef %76, i32 noundef %78)
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  invoke void @_ZN15TurbulenceField16_getVelocityGridEP16MACVelocityFieldR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560) %20, ptr noundef %79, ptr noundef nonnull align 8 dereferenceable(44) %11)
          to label %80 unwind label %91

80:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store double 0.000000e+00, ptr %12, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store double 0.000000e+00, ptr %13, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %81 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #7
  store double %81, ptr %14, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #7
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %15)
          to label %82 unwind label %95

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

83:                                               ; preds = %149, %82
  %84 = load i32, ptr %16, align 4, !tbaa !24
  %85 = zext i32 %84 to i64
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = invoke noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %86)
          to label %88 unwind label %99

88:                                               ; preds = %83
  %89 = icmp ult i64 %85, %87
  br i1 %89, label %103, label %90

90:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %153

91:                                               ; preds = %72
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %9, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %10, align 4
  br label %161

95:                                               ; preds = %153, %80
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %9, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %10, align 4
  br label %160

99:                                               ; preds = %83
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %9, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %10, align 4
  br label %152

103:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #7
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = load i32, ptr %16, align 4, !tbaa !24
  %106 = invoke { i64, i32 } @_ZN15GridIndexVectorixEi(ptr noundef nonnull align 8 dereferenceable(40) %104, i32 noundef %105)
          to label %107 unwind label %134

107:                                              ; preds = %103
  store { i64, i32 } %106, ptr %18, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 8 %18, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %17, i64 12, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %108 = getelementptr inbounds %struct.GridIndex, ptr %15, i32 0, i32 0
  %109 = load i32, ptr %108, align 4, !tbaa !26
  %110 = getelementptr inbounds %struct.GridIndex, ptr %15, i32 0, i32 1
  %111 = load i32, ptr %110, align 4, !tbaa !28
  %112 = getelementptr inbounds %struct.GridIndex, ptr %15, i32 0, i32 2
  %113 = load i32, ptr %112, align 4, !tbaa !29
  %114 = invoke noundef double @_ZN15TurbulenceField30_calculateTurbulenceAtGridCellEiiiR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560) %20, i32 noundef %109, i32 noundef %111, i32 noundef %113, ptr noundef nonnull align 8 dereferenceable(44) %11)
          to label %115 unwind label %138

115:                                              ; preds = %107
  store double %114, ptr %19, align 8, !tbaa !23
  %116 = getelementptr inbounds %class.TurbulenceField, ptr %20, i32 0, i32 0
  %117 = getelementptr inbounds %struct.GridIndex, ptr %15, i32 0, i32 0
  %118 = load i32, ptr %117, align 4, !tbaa !26
  %119 = getelementptr inbounds %struct.GridIndex, ptr %15, i32 0, i32 1
  %120 = load i32, ptr %119, align 4, !tbaa !28
  %121 = getelementptr inbounds %struct.GridIndex, ptr %15, i32 0, i32 2
  %122 = load i32, ptr %121, align 4, !tbaa !29
  %123 = load double, ptr %19, align 8, !tbaa !23
  %124 = fptrunc double %123 to float
  invoke void @_ZN7Array3dIfE3setEiiif(ptr noundef nonnull align 8 dereferenceable(36) %116, i32 noundef %118, i32 noundef %120, i32 noundef %122, float noundef %124)
          to label %125 unwind label %138

125:                                              ; preds = %115
  %126 = load double, ptr %19, align 8, !tbaa !23
  %127 = load double, ptr %12, align 8, !tbaa !23
  %128 = fadd double %127, %126
  store double %128, ptr %12, align 8, !tbaa !23
  %129 = load double, ptr %19, align 8, !tbaa !23
  %130 = load double, ptr %13, align 8, !tbaa !23
  %131 = fcmp ogt double %129, %130
  br i1 %131, label %132, label %142

132:                                              ; preds = %125
  %133 = load double, ptr %19, align 8, !tbaa !23
  store double %133, ptr %13, align 8, !tbaa !23
  br label %142

134:                                              ; preds = %103
  %135 = landingpad { ptr, i32 }
          cleanup
  %136 = extractvalue { ptr, i32 } %135, 0
  store ptr %136, ptr %9, align 8
  %137 = extractvalue { ptr, i32 } %135, 1
  store i32 %137, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #7
  br label %152

138:                                              ; preds = %115, %107
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %9, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %152

142:                                              ; preds = %132, %125
  %143 = load double, ptr %19, align 8, !tbaa !23
  %144 = load double, ptr %14, align 8, !tbaa !23
  %145 = fcmp olt double %143, %144
  br i1 %145, label %146, label %148

146:                                              ; preds = %142
  %147 = load double, ptr %19, align 8, !tbaa !23
  store double %147, ptr %14, align 8, !tbaa !23
  br label %148

148:                                              ; preds = %146, %142
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %16, align 4, !tbaa !24
  %151 = add i32 %150, 1
  store i32 %151, ptr %16, align 4, !tbaa !24
  br label %83, !llvm.loop !30

152:                                              ; preds = %138, %134, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %160

153:                                              ; preds = %90
  %154 = load ptr, ptr %6, align 8, !tbaa !5
  %155 = invoke noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %154)
          to label %156 unwind label %95

156:                                              ; preds = %153
  %157 = uitofp i64 %155 to double
  %158 = load double, ptr %12, align 8, !tbaa !23
  %159 = fdiv double %158, %157
  store double %159, ptr %12, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @_ZN7Array3dIN5vmath4vec3EED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %11) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #7
  ret void

160:                                              ; preds = %152, %95
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %161

161:                                              ; preds = %160, %91
  call void @_ZN7Array3dIN5vmath4vec3EED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %11) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %11) #7
  br label %162

162:                                              ; preds = %161, %68
  %163 = load ptr, ptr %9, align 8
  %164 = load i32, ptr %10, align 4
  %165 = insertvalue { ptr, i32 } poison, ptr %163, 0
  %166 = insertvalue { ptr, i32 } %165, i32 %164, 1
  resume { ptr, i32 } %166
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIfE4fillEf(ptr noundef nonnull align 8 dereferenceable(36), float noundef) #0 align 2

declare void @_ZN16MACVelocityField17getGridDimensionsEPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(148), ptr noundef, ptr noundef, ptr noundef) #4

declare noundef double @_ZN16MACVelocityField15getGridCellSizeEv(ptr noundef nonnull align 8 dereferenceable(148)) #4

; Function Attrs: nounwind
declare double @sqrt(double noundef) #5

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIfEaSERKS0_(ptr dead_on_unwind noalias writable sret(%class.Array3d) align 8, ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 8 dereferenceable(36)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIN5vmath4vec3EEC2Eiii(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #6 align 2

declare { i64, i32 } @_ZN15GridIndexVectorixEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIfE3setEiiif(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef, float noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIN5vmath4vec3EED2Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #0 align 2

attributes #0 = { 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 #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 = { "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 = { 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 #6 = { 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 #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, !15, i64 56}
!10 = !{!"_ZTS15TurbulenceField", !11, i64 0, !12, i64 40, !12, i64 44, !12, i64 48, !15, i64 56, !15, i64 64, !7, i64 72}
!11 = !{!"_ZTS7Array3dIfE", !12, i64 0, !12, i64 4, !12, i64 8, !6, i64 16, !13, i64 24, !14, i64 28, !12, i64 32}
!12 = !{!"int", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!10, !15, i64 64}
!17 = !{!10, !12, i64 0}
!18 = !{!10, !12, i64 40}
!19 = !{!10, !12, i64 4}
!20 = !{!10, !12, i64 44}
!21 = !{!10, !12, i64 8}
!22 = !{!10, !12, i64 48}
!23 = !{!15, !15, i64 0}
!24 = !{!12, !12, i64 0}
!25 = !{i64 0, i64 4, !24, i64 4, i64 4, !24, i64 8, i64 4, !24}
!26 = !{!27, !12, i64 0}
!27 = !{!"_ZTS9GridIndex", !12, i64 0, !12, i64 4, !12, i64 8}
!28 = !{!27, !12, i64 4}
!29 = !{!27, !12, i64 8}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


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

%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>
%class.Array3d.0 = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], %"class.vmath::vec3", i32, [4 x i8] }>
%"class.vmath::vec3" = type { float, float, float }
%struct.GridIndex = type { i32, i32, i32 }

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15TurbulenceField16_getVelocityGridEP16MACVelocityFieldR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560), ptr noundef, ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #1 align 2

; 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 uwtable
declare dso_local noundef double @_ZN15TurbulenceField30_calculateTurbulenceAtGridCellEiiiR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560), i32 noundef, i32 noundef, i32 noundef, ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15TurbulenceField24calculateTurbulenceFieldEP16MACVelocityFieldR15GridIndexVector(ptr noundef nonnull align 8 dereferenceable(1560) %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(40) %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %class.Array3d, align 8
  %5 = alloca %class.Array3d, align 8
  %6 = alloca %class.Array3d.0, align 8
  %7 = alloca %struct.GridIndex, align 8
  tail call void @_ZN7Array3dIfE4fillEf(ptr noundef nonnull align 8 dereferenceable(36) %0, float noundef 0.000000e+00)
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = getelementptr inbounds i8, ptr %0, i64 44
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZN16MACVelocityField17getGridDimensionsEPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(148) %1, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %11 = tail call noundef double @_ZN16MACVelocityField15getGridCellSizeEv(ptr noundef nonnull align 8 dereferenceable(148) %1)
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  store double %11, ptr %12, align 8, !tbaa !5
  %13 = fmul double %11, 2.000000e+00
  %14 = fmul double %13, 3.000000e+00
  %15 = fmul double %13, %14
  %16 = tail call double @sqrt(double noundef %15) #6
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  store double %16, ptr %17, align 8, !tbaa !15
  %18 = load i32, ptr %0, align 8, !tbaa !16
  %19 = load i32, ptr %8, align 8, !tbaa !17
  %.not = icmp eq i32 %18, %19
  %.pre = load i32, ptr %9, align 4, !tbaa !18
  br i1 %.not, label %20, label %._crit_edge42

._crit_edge42:                                    ; preds = %3
  %.pre43 = load i32, ptr %10, align 8, !tbaa !19
  br label %25

20:                                               ; preds = %3
  %21 = getelementptr inbounds i8, ptr %0, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !20
  %.not33 = icmp eq i32 %22, %.pre
  %.pre44 = load i32, ptr %10, align 8, !tbaa !19
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  %24 = load i32, ptr %23, align 8
  %.not34 = icmp eq i32 %24, %.pre44
  %or.cond = select i1 %.not33, i1 %.not34, i1 false
  br i1 %or.cond, label %30, label %25

25:                                               ; preds = %._crit_edge42, %20
  %26 = phi i32 [ %.pre43, %._crit_edge42 ], [ %.pre44, %20 ]
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #6
  call void @_ZN7Array3dIfEC2Eiii(ptr noundef nonnull align 8 dereferenceable(36) %5, i32 noundef %19, i32 noundef %.pre, i32 noundef %26)
  invoke void @_ZN7Array3dIfEaSERKS0_(ptr dead_on_unwind nonnull writable sret(%class.Array3d) align 8 %4, ptr noundef nonnull align 8 dereferenceable(36) %0, ptr noundef nonnull align 8 dereferenceable(36) %5)
          to label %27 unwind label %28

27:                                               ; preds = %25
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %4) #6
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #6
  %.pre45 = load i32, ptr %8, align 8, !tbaa !17
  %.pre46 = load i32, ptr %9, align 4, !tbaa !18
  %.pre47 = load i32, ptr %10, align 8, !tbaa !19
  br label %30

28:                                               ; preds = %25
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7Array3dIfED2Ev(ptr noundef nonnull align 8 dereferenceable(36) %5) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #6
  br label %64

30:                                               ; preds = %20, %27
  %31 = phi i32 [ %.pre47, %27 ], [ %.pre44, %20 ]
  %32 = phi i32 [ %.pre46, %27 ], [ %.pre, %20 ]
  %33 = phi i32 [ %.pre45, %27 ], [ %18, %20 ]
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #6
  call void @_ZN7Array3dIN5vmath4vec3EEC2Eiii(ptr noundef nonnull align 8 dereferenceable(44) %6, i32 noundef %33, i32 noundef %32, i32 noundef %31)
  invoke void @_ZN15TurbulenceField16_getVelocityGridEP16MACVelocityFieldR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560) %0, ptr noundef nonnull %1, ptr noundef nonnull align 8 dereferenceable(44) %6)
          to label %34 unwind label %39

34:                                               ; preds = %30
  %35 = call noundef double @_ZNSt14numeric_limitsIdE8infinityEv() #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %7) #6
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
  %36 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2)
  %.not41 = icmp eq i64 %36, 0
  br i1 %.not41, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %34
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %7, i64 8
  %37 = getelementptr inbounds i8, ptr %7, i64 4
  br label %41

._crit_edge:                                      ; preds = %53, %34
  %38 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %7) #6
  call void @_ZN7Array3dIN5vmath4vec3EED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %6) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #6
  ret void

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

41:                                               ; preds = %.lr.ph, %53
  %.03038 = phi i32 [ 0, %.lr.ph ], [ %54, %53 ]
  %42 = invoke { i64, i32 } @_ZN15GridIndexVectorixEi(ptr noundef nonnull align 8 dereferenceable(40) %2, i32 noundef %.03038)
          to label %43 unwind label %58

43:                                               ; preds = %41
  %.fca.0.extract = extractvalue { i64, i32 } %42, 0
  %.fca.1.extract = extractvalue { i64, i32 } %42, 1
  store i64 %.fca.0.extract, ptr %7, align 8
  store i32 %.fca.1.extract, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !21
  %44 = trunc i64 %.fca.0.extract to i32
  %45 = lshr i64 %.fca.0.extract, 32
  %46 = trunc nuw i64 %45 to i32
  %47 = invoke noundef double @_ZN15TurbulenceField30_calculateTurbulenceAtGridCellEiiiR7Array3dIN5vmath4vec3EE(ptr noundef nonnull align 8 dereferenceable(1560) %0, i32 noundef %44, i32 noundef %46, i32 noundef %.fca.1.extract, ptr noundef nonnull align 8 dereferenceable(44) %6)
          to label %48 unwind label %60

48:                                               ; preds = %43
  %49 = load i32, ptr %7, align 8, !tbaa !22
  %50 = load i32, ptr %37, align 4, !tbaa !24
  %51 = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !25
  %52 = fptrunc double %47 to float
  invoke void @_ZN7Array3dIfE3setEiiif(ptr noundef nonnull align 8 dereferenceable(36) %0, i32 noundef %49, i32 noundef %50, i32 noundef %51, float noundef %52)
          to label %53 unwind label %60

53:                                               ; preds = %48
  %54 = add i32 %.03038, 1
  %55 = zext i32 %54 to i64
  %56 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %2)
  %57 = icmp ugt i64 %56, %55
  br i1 %57, label %41, label %._crit_edge, !llvm.loop !26

58:                                               ; preds = %41
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %62

60:                                               ; preds = %48, %43
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %62

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

63:                                               ; preds = %62, %39
  %.pn.pn = phi { ptr, i32 } [ %.pn, %62 ], [ %40, %39 ]
  call void @_ZN7Array3dIN5vmath4vec3EED2Ev(ptr noundef nonnull align 8 dereferenceable(44) %6) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #6
  br label %64

64:                                               ; preds = %63, %28
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %63 ], [ %29, %28 ]
  resume { ptr, i32 } %.pn.pn.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIfE4fillEf(ptr noundef nonnull align 8 dereferenceable(36), float noundef) local_unnamed_addr #0 align 2

declare void @_ZN16MACVelocityField17getGridDimensionsEPiS0_S0_(ptr noundef nonnull align 8 dereferenceable(148), ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare noundef double @_ZN16MACVelocityField15getGridCellSizeEv(ptr noundef nonnull align 8 dereferenceable(148)) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIfEaSERKS0_(ptr dead_on_unwind noalias writable sret(%class.Array3d) align 8, ptr noundef nonnull align 8 dereferenceable(36), ptr noundef nonnull align 8 dereferenceable(36)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIN5vmath4vec3EEC2Eiii(ptr noundef nonnull align 8 dereferenceable(44), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNSt14numeric_limitsIdE8infinityEv() local_unnamed_addr #0 align 2

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

declare { i64, i32 } @_ZN15GridIndexVectorixEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7Array3dIN5vmath4vec3EED2Ev(ptr noundef nonnull align 8 dereferenceable(44)) unnamed_addr #0 align 2

attributes #0 = { 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 #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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(write) "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 = { 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, !14, i64 56}
!6 = !{!"_ZTS15TurbulenceField", !7, i64 0, !8, i64 40, !8, i64 44, !8, i64 48, !14, i64 56, !14, i64 64, !9, i64 72}
!7 = !{!"_ZTS7Array3dIfE", !8, i64 0, !8, i64 4, !8, i64 8, !11, i64 16, !12, i64 24, !13, i64 28, !8, i64 32}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{!"float", !9, i64 0}
!14 = !{!"double", !9, i64 0}
!15 = !{!6, !14, i64 64}
!16 = !{!6, !8, i64 0}
!17 = !{!6, !8, i64 40}
!18 = !{!6, !8, i64 44}
!19 = !{!6, !8, i64 48}
!20 = !{!6, !8, i64 4}
!21 = !{!8, !8, i64 0}
!22 = !{!23, !8, i64 0}
!23 = !{!"_ZTS9GridIndex", !8, i64 0, !8, i64 4, !8, i64 8}
!24 = !{!23, !8, i64 4}
!25 = !{!23, !8, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass