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

; 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.MACVelocityField = type <{ float, i32, i32, i32, double, %class.Array3d, %class.Array3d, %class.Array3d, i32, [4 x i8] }>
%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], float, i32, [4 x i8] }>

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Grid3d16isPositionInGridEddddiii(double noundef, double noundef, double noundef, double noundef, i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Grid3d19positionToGridIndexEddddPiS0_S0_(double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Grid3d19GridIndexToPositionEiiidPdS0_S0_(i32 noundef, i32 noundef, i32 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN16MACVelocityField19_interpolateLinearUEddd(ptr noundef nonnull align 8 dereferenceable(148) %0, double noundef %1, double noundef %2, double noundef %3) #1 align 2 {
  %5 = alloca double, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca [8 x double], align 16
  store ptr %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !9
  store double %2, ptr %8, align 8, !tbaa !9
  store double %3, ptr %9, align 8, !tbaa !9
  %21 = load ptr, ptr %6, align 8
  %22 = load double, ptr %7, align 8, !tbaa !9
  %23 = load double, ptr %8, align 8, !tbaa !9
  %24 = load double, ptr %9, align 8, !tbaa !9
  %25 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 4
  %26 = load double, ptr %25, align 8, !tbaa !11
  %27 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !17
  %29 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !18
  %31 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 3
  %32 = load i32, ptr %31, align 4, !tbaa !19
  %33 = call noundef zeroext i1 @_ZN6Grid3d16isPositionInGridEddddiii(double noundef %22, double noundef %23, double noundef %24, double noundef %26, i32 noundef %28, i32 noundef %30, i32 noundef %32)
  br i1 %33, label %35, label %34

34:                                               ; preds = %4
  store double 0.000000e+00, ptr %5, align 8
  br label %213

35:                                               ; preds = %4
  %36 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 4
  %37 = load double, ptr %36, align 8, !tbaa !11
  %38 = load double, ptr %8, align 8, !tbaa !9
  %39 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %37, double %38)
  store double %39, ptr %8, align 8, !tbaa !9
  %40 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 4
  %41 = load double, ptr %40, align 8, !tbaa !11
  %42 = load double, ptr %9, align 8, !tbaa !9
  %43 = call double @llvm.fmuladd.f64(double -5.000000e-01, double %41, double %42)
  store double %43, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %44 = load double, ptr %7, align 8, !tbaa !9
  %45 = load double, ptr %8, align 8, !tbaa !9
  %46 = load double, ptr %9, align 8, !tbaa !9
  %47 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 4
  %48 = load double, ptr %47, align 8, !tbaa !11
  call void @_ZN6Grid3d19positionToGridIndexEddddPiS0_S0_(double noundef %44, double noundef %45, double noundef %46, double noundef %48, ptr noundef %10, ptr noundef %11, ptr noundef %12)
  %49 = load i32, ptr %10, align 4, !tbaa !20
  %50 = load i32, ptr %11, align 4, !tbaa !20
  %51 = load i32, ptr %12, align 4, !tbaa !20
  %52 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 4
  %53 = load double, ptr %52, align 8, !tbaa !11
  call void @_ZN6Grid3d19GridIndexToPositionEiiidPdS0_S0_(i32 noundef %49, i32 noundef %50, i32 noundef %51, double noundef %53, ptr noundef %13, ptr noundef %14, ptr noundef %15)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %54 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 4
  %55 = load double, ptr %54, align 8, !tbaa !11
  %56 = fdiv double 1.000000e+00, %55
  store double %56, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %57 = load double, ptr %7, align 8, !tbaa !9
  %58 = load double, ptr %13, align 8, !tbaa !9
  %59 = fsub double %57, %58
  %60 = load double, ptr %16, align 8, !tbaa !9
  %61 = fmul double %59, %60
  store double %61, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %62 = load double, ptr %8, align 8, !tbaa !9
  %63 = load double, ptr %14, align 8, !tbaa !9
  %64 = fsub double %62, %63
  %65 = load double, ptr %16, align 8, !tbaa !9
  %66 = fmul double %64, %65
  store double %66, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %67 = load double, ptr %9, align 8, !tbaa !9
  %68 = load double, ptr %15, align 8, !tbaa !9
  %69 = fsub double %67, %68
  %70 = load double, ptr %16, align 8, !tbaa !9
  %71 = fmul double %69, %70
  store double %71, ptr %19, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 64, ptr %20) #6
  call void @llvm.memset.p0.i64(ptr align 16 %20, i8 0, i64 64, i1 false)
  %72 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %73 = load i32, ptr %10, align 4, !tbaa !20
  %74 = load i32, ptr %11, align 4, !tbaa !20
  %75 = load i32, ptr %12, align 4, !tbaa !20
  %76 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %72, i32 noundef %73, i32 noundef %74, i32 noundef %75)
  br i1 %76, label %77, label %85

77:                                               ; preds = %35
  %78 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %79 = load i32, ptr %10, align 4, !tbaa !20
  %80 = load i32, ptr %11, align 4, !tbaa !20
  %81 = load i32, ptr %12, align 4, !tbaa !20
  %82 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %78, i32 noundef %79, i32 noundef %80, i32 noundef %81)
  %83 = fpext float %82 to double
  %84 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 0
  store double %83, ptr %84, align 16, !tbaa !9
  br label %85

85:                                               ; preds = %77, %35
  %86 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %87 = load i32, ptr %10, align 4, !tbaa !20
  %88 = add nsw i32 %87, 1
  %89 = load i32, ptr %11, align 4, !tbaa !20
  %90 = load i32, ptr %12, align 4, !tbaa !20
  %91 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %86, i32 noundef %88, i32 noundef %89, i32 noundef %90)
  br i1 %91, label %92, label %101

92:                                               ; preds = %85
  %93 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %94 = load i32, ptr %10, align 4, !tbaa !20
  %95 = add nsw i32 %94, 1
  %96 = load i32, ptr %11, align 4, !tbaa !20
  %97 = load i32, ptr %12, align 4, !tbaa !20
  %98 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %93, i32 noundef %95, i32 noundef %96, i32 noundef %97)
  %99 = fpext float %98 to double
  %100 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 1
  store double %99, ptr %100, align 8, !tbaa !9
  br label %101

101:                                              ; preds = %92, %85
  %102 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %103 = load i32, ptr %10, align 4, !tbaa !20
  %104 = load i32, ptr %11, align 4, !tbaa !20
  %105 = add nsw i32 %104, 1
  %106 = load i32, ptr %12, align 4, !tbaa !20
  %107 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %102, i32 noundef %103, i32 noundef %105, i32 noundef %106)
  br i1 %107, label %108, label %117

108:                                              ; preds = %101
  %109 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %110 = load i32, ptr %10, align 4, !tbaa !20
  %111 = load i32, ptr %11, align 4, !tbaa !20
  %112 = add nsw i32 %111, 1
  %113 = load i32, ptr %12, align 4, !tbaa !20
  %114 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %109, i32 noundef %110, i32 noundef %112, i32 noundef %113)
  %115 = fpext float %114 to double
  %116 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 2
  store double %115, ptr %116, align 16, !tbaa !9
  br label %117

117:                                              ; preds = %108, %101
  %118 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %119 = load i32, ptr %10, align 4, !tbaa !20
  %120 = load i32, ptr %11, align 4, !tbaa !20
  %121 = load i32, ptr %12, align 4, !tbaa !20
  %122 = add nsw i32 %121, 1
  %123 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %118, i32 noundef %119, i32 noundef %120, i32 noundef %122)
  br i1 %123, label %124, label %133

124:                                              ; preds = %117
  %125 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %126 = load i32, ptr %10, align 4, !tbaa !20
  %127 = load i32, ptr %11, align 4, !tbaa !20
  %128 = load i32, ptr %12, align 4, !tbaa !20
  %129 = add nsw i32 %128, 1
  %130 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %125, i32 noundef %126, i32 noundef %127, i32 noundef %129)
  %131 = fpext float %130 to double
  %132 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 3
  store double %131, ptr %132, align 8, !tbaa !9
  br label %133

133:                                              ; preds = %124, %117
  %134 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %135 = load i32, ptr %10, align 4, !tbaa !20
  %136 = add nsw i32 %135, 1
  %137 = load i32, ptr %11, align 4, !tbaa !20
  %138 = load i32, ptr %12, align 4, !tbaa !20
  %139 = add nsw i32 %138, 1
  %140 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %134, i32 noundef %136, i32 noundef %137, i32 noundef %139)
  br i1 %140, label %141, label %151

141:                                              ; preds = %133
  %142 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %143 = load i32, ptr %10, align 4, !tbaa !20
  %144 = add nsw i32 %143, 1
  %145 = load i32, ptr %11, align 4, !tbaa !20
  %146 = load i32, ptr %12, align 4, !tbaa !20
  %147 = add nsw i32 %146, 1
  %148 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %142, i32 noundef %144, i32 noundef %145, i32 noundef %147)
  %149 = fpext float %148 to double
  %150 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 4
  store double %149, ptr %150, align 16, !tbaa !9
  br label %151

151:                                              ; preds = %141, %133
  %152 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %153 = load i32, ptr %10, align 4, !tbaa !20
  %154 = load i32, ptr %11, align 4, !tbaa !20
  %155 = add nsw i32 %154, 1
  %156 = load i32, ptr %12, align 4, !tbaa !20
  %157 = add nsw i32 %156, 1
  %158 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %152, i32 noundef %153, i32 noundef %155, i32 noundef %157)
  br i1 %158, label %159, label %169

159:                                              ; preds = %151
  %160 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %161 = load i32, ptr %10, align 4, !tbaa !20
  %162 = load i32, ptr %11, align 4, !tbaa !20
  %163 = add nsw i32 %162, 1
  %164 = load i32, ptr %12, align 4, !tbaa !20
  %165 = add nsw i32 %164, 1
  %166 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %160, i32 noundef %161, i32 noundef %163, i32 noundef %165)
  %167 = fpext float %166 to double
  %168 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 5
  store double %167, ptr %168, align 8, !tbaa !9
  br label %169

169:                                              ; preds = %159, %151
  %170 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %171 = load i32, ptr %10, align 4, !tbaa !20
  %172 = add nsw i32 %171, 1
  %173 = load i32, ptr %11, align 4, !tbaa !20
  %174 = add nsw i32 %173, 1
  %175 = load i32, ptr %12, align 4, !tbaa !20
  %176 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %170, i32 noundef %172, i32 noundef %174, i32 noundef %175)
  br i1 %176, label %177, label %187

177:                                              ; preds = %169
  %178 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %179 = load i32, ptr %10, align 4, !tbaa !20
  %180 = add nsw i32 %179, 1
  %181 = load i32, ptr %11, align 4, !tbaa !20
  %182 = add nsw i32 %181, 1
  %183 = load i32, ptr %12, align 4, !tbaa !20
  %184 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %178, i32 noundef %180, i32 noundef %182, i32 noundef %183)
  %185 = fpext float %184 to double
  %186 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 6
  store double %185, ptr %186, align 16, !tbaa !9
  br label %187

187:                                              ; preds = %177, %169
  %188 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %189 = load i32, ptr %10, align 4, !tbaa !20
  %190 = add nsw i32 %189, 1
  %191 = load i32, ptr %11, align 4, !tbaa !20
  %192 = add nsw i32 %191, 1
  %193 = load i32, ptr %12, align 4, !tbaa !20
  %194 = add nsw i32 %193, 1
  %195 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %188, i32 noundef %190, i32 noundef %192, i32 noundef %194)
  br i1 %195, label %196, label %207

196:                                              ; preds = %187
  %197 = getelementptr inbounds %class.MACVelocityField, ptr %21, i32 0, i32 5
  %198 = load i32, ptr %10, align 4, !tbaa !20
  %199 = add nsw i32 %198, 1
  %200 = load i32, ptr %11, align 4, !tbaa !20
  %201 = add nsw i32 %200, 1
  %202 = load i32, ptr %12, align 4, !tbaa !20
  %203 = add nsw i32 %202, 1
  %204 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %197, i32 noundef %199, i32 noundef %201, i32 noundef %203)
  %205 = fpext float %204 to double
  %206 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 7
  store double %205, ptr %206, align 8, !tbaa !9
  br label %207

207:                                              ; preds = %196, %187
  %208 = getelementptr inbounds [8 x double], ptr %20, i64 0, i64 0
  %209 = load double, ptr %17, align 8, !tbaa !9
  %210 = load double, ptr %18, align 8, !tbaa !9
  %211 = load double, ptr %19, align 8, !tbaa !9
  %212 = call noundef double @_ZN13Interpolation20trilinearInterpolateEPdddd(ptr noundef %208, double noundef %209, double noundef %210, double noundef %211)
  store double %212, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 64, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %213

213:                                              ; preds = %207, %34
  %214 = load double, ptr %5, align 8
  ret double %214
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef) #3 align 2

declare noundef double @_ZN13Interpolation20trilinearInterpolateEPdddd(ptr noundef, double noundef, double noundef, double noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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, !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, !10, i64 16}
!12 = !{!"_ZTS16MACVelocityField", !13, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !10, i64 16, !15, i64 24, !15, i64 64, !15, i64 104, !14, i64 144}
!13 = !{!"float", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS7Array3dIfE", !14, i64 0, !14, i64 4, !14, i64 8, !6, i64 16, !16, i64 24, !13, i64 28, !14, i64 32}
!16 = !{!"bool", !7, i64 0}
!17 = !{!12, !14, i64 4}
!18 = !{!12, !14, i64 8}
!19 = !{!12, !14, i64 12}
!20 = !{!14, !14, i64 0}


; 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"

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN6Grid3d16isPositionInGridEddddiii(double noundef, double noundef, double noundef, double noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6Grid3d19positionToGridIndexEddddPiS0_S0_(double noundef, double noundef, double noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN16MACVelocityField19_interpolateLinearUEddd(ptr noundef nonnull align 8 dereferenceable(148) %0, double noundef %1, double noundef %2, double noundef %3) local_unnamed_addr #1 align 2 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca [8 x double], align 16
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 12
  %19 = load i32, ptr %18, align 4, !tbaa !17
  %20 = tail call noundef zeroext i1 @_ZN6Grid3d16isPositionInGridEddddiii(double noundef %1, double noundef %2, double noundef %3, double noundef %13, i32 noundef %15, i32 noundef %17, i32 noundef %19)
  br i1 %20, label %21, label %161

21:                                               ; preds = %4
  %22 = load double, ptr %12, align 8, !tbaa !5
  %23 = tail call double @llvm.fmuladd.f64(double %22, double -5.000000e-01, double %2)
  %24 = tail call double @llvm.fmuladd.f64(double %22, double -5.000000e-01, double %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @_ZN6Grid3d19positionToGridIndexEddddPiS0_S0_(double noundef %1, double noundef %23, double noundef %24, double noundef %22, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7)
  %25 = load i32, ptr %5, align 4, !tbaa !18
  %26 = load i32, ptr %6, align 4, !tbaa !18
  %27 = load i32, ptr %7, align 4, !tbaa !18
  %28 = load double, ptr %12, align 8, !tbaa !5
  call void @_ZN6Grid3d19GridIndexToPositionEiiidPdS0_S0_(i32 noundef %25, i32 noundef %26, i32 noundef %27, double noundef %28, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %29 = load double, ptr %12, align 8, !tbaa !5
  %30 = fdiv double 1.000000e+00, %29
  %31 = load double, ptr %8, align 8, !tbaa !19
  %32 = fsub double %1, %31
  %33 = fmul double %30, %32
  %34 = load double, ptr %9, align 8, !tbaa !19
  %35 = fsub double %23, %34
  %36 = fmul double %30, %35
  %37 = load double, ptr %10, align 8, !tbaa !19
  %38 = fsub double %24, %37
  %39 = fmul double %30, %38
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %11) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(64) %11, i8 0, i64 64, i1 false)
  %40 = getelementptr inbounds i8, ptr %0, i64 24
  %41 = load i32, ptr %5, align 4, !tbaa !18
  %42 = load i32, ptr %6, align 4, !tbaa !18
  %43 = load i32, ptr %7, align 4, !tbaa !18
  %44 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %41, i32 noundef %42, i32 noundef %43)
  br i1 %44, label %45, label %51

45:                                               ; preds = %21
  %46 = load i32, ptr %5, align 4, !tbaa !18
  %47 = load i32, ptr %6, align 4, !tbaa !18
  %48 = load i32, ptr %7, align 4, !tbaa !18
  %49 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %46, i32 noundef %47, i32 noundef %48)
  %50 = fpext float %49 to double
  store double %50, ptr %11, align 16, !tbaa !19
  br label %51

51:                                               ; preds = %45, %21
  %52 = load i32, ptr %5, align 4, !tbaa !18
  %53 = add nsw i32 %52, 1
  %54 = load i32, ptr %6, align 4, !tbaa !18
  %55 = load i32, ptr %7, align 4, !tbaa !18
  %56 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %53, i32 noundef %54, i32 noundef %55)
  br i1 %56, label %57, label %65

57:                                               ; preds = %51
  %58 = load i32, ptr %5, align 4, !tbaa !18
  %59 = add nsw i32 %58, 1
  %60 = load i32, ptr %6, align 4, !tbaa !18
  %61 = load i32, ptr %7, align 4, !tbaa !18
  %62 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %59, i32 noundef %60, i32 noundef %61)
  %63 = fpext float %62 to double
  %64 = getelementptr inbounds i8, ptr %11, i64 8
  store double %63, ptr %64, align 8, !tbaa !19
  br label %65

65:                                               ; preds = %57, %51
  %66 = load i32, ptr %5, align 4, !tbaa !18
  %67 = load i32, ptr %6, align 4, !tbaa !18
  %68 = add nsw i32 %67, 1
  %69 = load i32, ptr %7, align 4, !tbaa !18
  %70 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %66, i32 noundef %68, i32 noundef %69)
  br i1 %70, label %71, label %79

71:                                               ; preds = %65
  %72 = load i32, ptr %5, align 4, !tbaa !18
  %73 = load i32, ptr %6, align 4, !tbaa !18
  %74 = add nsw i32 %73, 1
  %75 = load i32, ptr %7, align 4, !tbaa !18
  %76 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %72, i32 noundef %74, i32 noundef %75)
  %77 = fpext float %76 to double
  %78 = getelementptr inbounds i8, ptr %11, i64 16
  store double %77, ptr %78, align 16, !tbaa !19
  br label %79

79:                                               ; preds = %71, %65
  %80 = load i32, ptr %5, align 4, !tbaa !18
  %81 = load i32, ptr %6, align 4, !tbaa !18
  %82 = load i32, ptr %7, align 4, !tbaa !18
  %83 = add nsw i32 %82, 1
  %84 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %80, i32 noundef %81, i32 noundef %83)
  br i1 %84, label %85, label %93

85:                                               ; preds = %79
  %86 = load i32, ptr %5, align 4, !tbaa !18
  %87 = load i32, ptr %6, align 4, !tbaa !18
  %88 = load i32, ptr %7, align 4, !tbaa !18
  %89 = add nsw i32 %88, 1
  %90 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %86, i32 noundef %87, i32 noundef %89)
  %91 = fpext float %90 to double
  %92 = getelementptr inbounds i8, ptr %11, i64 24
  store double %91, ptr %92, align 8, !tbaa !19
  br label %93

93:                                               ; preds = %85, %79
  %94 = load i32, ptr %5, align 4, !tbaa !18
  %95 = add nsw i32 %94, 1
  %96 = load i32, ptr %6, align 4, !tbaa !18
  %97 = load i32, ptr %7, align 4, !tbaa !18
  %98 = add nsw i32 %97, 1
  %99 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %95, i32 noundef %96, i32 noundef %98)
  br i1 %99, label %100, label %109

100:                                              ; preds = %93
  %101 = load i32, ptr %5, align 4, !tbaa !18
  %102 = add nsw i32 %101, 1
  %103 = load i32, ptr %6, align 4, !tbaa !18
  %104 = load i32, ptr %7, align 4, !tbaa !18
  %105 = add nsw i32 %104, 1
  %106 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %102, i32 noundef %103, i32 noundef %105)
  %107 = fpext float %106 to double
  %108 = getelementptr inbounds i8, ptr %11, i64 32
  store double %107, ptr %108, align 16, !tbaa !19
  br label %109

109:                                              ; preds = %100, %93
  %110 = load i32, ptr %5, align 4, !tbaa !18
  %111 = load i32, ptr %6, align 4, !tbaa !18
  %112 = add nsw i32 %111, 1
  %113 = load i32, ptr %7, align 4, !tbaa !18
  %114 = add nsw i32 %113, 1
  %115 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %110, i32 noundef %112, i32 noundef %114)
  br i1 %115, label %116, label %125

116:                                              ; preds = %109
  %117 = load i32, ptr %5, align 4, !tbaa !18
  %118 = load i32, ptr %6, align 4, !tbaa !18
  %119 = add nsw i32 %118, 1
  %120 = load i32, ptr %7, align 4, !tbaa !18
  %121 = add nsw i32 %120, 1
  %122 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %117, i32 noundef %119, i32 noundef %121)
  %123 = fpext float %122 to double
  %124 = getelementptr inbounds i8, ptr %11, i64 40
  store double %123, ptr %124, align 8, !tbaa !19
  br label %125

125:                                              ; preds = %116, %109
  %126 = load i32, ptr %5, align 4, !tbaa !18
  %127 = add nsw i32 %126, 1
  %128 = load i32, ptr %6, align 4, !tbaa !18
  %129 = add nsw i32 %128, 1
  %130 = load i32, ptr %7, align 4, !tbaa !18
  %131 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %127, i32 noundef %129, i32 noundef %130)
  br i1 %131, label %132, label %141

132:                                              ; preds = %125
  %133 = load i32, ptr %5, align 4, !tbaa !18
  %134 = add nsw i32 %133, 1
  %135 = load i32, ptr %6, align 4, !tbaa !18
  %136 = add nsw i32 %135, 1
  %137 = load i32, ptr %7, align 4, !tbaa !18
  %138 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %134, i32 noundef %136, i32 noundef %137)
  %139 = fpext float %138 to double
  %140 = getelementptr inbounds i8, ptr %11, i64 48
  store double %139, ptr %140, align 16, !tbaa !19
  br label %141

141:                                              ; preds = %132, %125
  %142 = load i32, ptr %5, align 4, !tbaa !18
  %143 = add nsw i32 %142, 1
  %144 = load i32, ptr %6, align 4, !tbaa !18
  %145 = add nsw i32 %144, 1
  %146 = load i32, ptr %7, align 4, !tbaa !18
  %147 = add nsw i32 %146, 1
  %148 = call noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %143, i32 noundef %145, i32 noundef %147)
  br i1 %148, label %149, label %159

149:                                              ; preds = %141
  %150 = load i32, ptr %5, align 4, !tbaa !18
  %151 = add nsw i32 %150, 1
  %152 = load i32, ptr %6, align 4, !tbaa !18
  %153 = add nsw i32 %152, 1
  %154 = load i32, ptr %7, align 4, !tbaa !18
  %155 = add nsw i32 %154, 1
  %156 = call noundef float @_ZN7Array3dIfEclEiii(ptr noundef nonnull align 8 dereferenceable(36) %40, i32 noundef %151, i32 noundef %153, i32 noundef %155)
  %157 = fpext float %156 to double
  %158 = getelementptr inbounds i8, ptr %11, i64 56
  store double %157, ptr %158, align 8, !tbaa !19
  br label %159

159:                                              ; preds = %149, %141
  %160 = call noundef double @_ZN13Interpolation20trilinearInterpolateEPdddd(ptr noundef nonnull %11, double noundef %33, double noundef %36, double noundef %39)
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %161

161:                                              ; preds = %4, %159
  %.0 = phi double [ %160, %159 ], [ 0.000000e+00, %4 ]
  ret double %.0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7Array3dIfE14isIndexInRangeEiii(ptr noundef nonnull align 8 dereferenceable(36), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3 align 2

declare noundef double @_ZN13Interpolation20trilinearInterpolateEPdddd(ptr noundef, double noundef, double noundef, double noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { "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, !11, i64 16}
!6 = !{!"_ZTS16MACVelocityField", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !11, i64 16, !12, i64 24, !12, i64 64, !12, i64 104, !10, i64 144}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"_ZTS7Array3dIfE", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !14, i64 24, !7, i64 28, !10, i64 32}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{!6, !10, i64 4}
!16 = !{!6, !10, i64 8}
!17 = !{!6, !10, i64 12}
!18 = !{!10, !10, i64 0}
!19 = !{!11, !11, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass