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

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

%struct.GridIndex = type { i32, i32, i32 }

; 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 @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148), i64, i32) #1 align 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) #2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN16MACVelocityField32_getExtrapolatedVelocityForFaceUEiiiiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef nonnull align 8 dereferenceable(36) %5) #1 align 2 {
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca [6 x %struct.GridIndex], align 16
  %15 = alloca %struct.GridIndex, align 4
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca %struct.GridIndex, align 4
  %20 = alloca { i64, i32 }, align 4
  %21 = alloca %struct.GridIndex, align 4
  %22 = alloca { i64, i32 }, align 4
  %23 = alloca %struct.GridIndex, align 4
  %24 = alloca { i64, i32 }, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store i32 %4, ptr %12, align 4, !tbaa !9
  store ptr %5, ptr %13, align 8, !tbaa !5
  %26 = load ptr, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 72, ptr %14) #5
  %27 = getelementptr inbounds [6 x %struct.GridIndex], ptr %14, i32 0, i32 0
  %28 = getelementptr inbounds %struct.GridIndex, ptr %27, i64 6
  br label %29

29:                                               ; preds = %29, %6
  %30 = phi ptr [ %27, %6 ], [ %31, %29 ]
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %30)
  %31 = getelementptr inbounds %struct.GridIndex, ptr %30, i64 1
  %32 = icmp eq ptr %31, %28
  br i1 %32, label %33, label %29

33:                                               ; preds = %29
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = load i32, ptr %11, align 4, !tbaa !9
  %37 = getelementptr inbounds [6 x %struct.GridIndex], ptr %14, i64 0, i64 0
  call void @_ZN6Grid3d24getNeighbourGridIndices6EiiiP9GridIndex(i32 noundef %34, i32 noundef %35, i32 noundef %36, ptr noundef %37)
  call void @llvm.lifetime.start.p0(i64 12, ptr %15) #5
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %15)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store double 0.000000e+00, ptr %16, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %72, %33
  %39 = load i32, ptr %18, align 4, !tbaa !9
  %40 = icmp slt i32 %39, 6
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %75

42:                                               ; preds = %38
  %43 = load i32, ptr %18, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [6 x %struct.GridIndex], ptr %14, i64 0, i64 %44
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %45, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %15, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %20, ptr align 4 %19, i64 12, i1 false)
  %46 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 0
  %47 = load i64, ptr %46, align 4
  %48 = getelementptr inbounds { i64, i32 }, ptr %20, i32 0, i32 1
  %49 = load i32, ptr %48, align 4
  %50 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %26, i64 %47, i32 %49)
  br i1 %50, label %51, label %71

51:                                               ; preds = %42
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %15, i64 12, i1 false), !tbaa.struct !13
  %52 = load i32, ptr %12, align 4, !tbaa !9
  %53 = sub nsw i32 %52, 1
  %54 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %21, i64 12, i1 false)
  %55 = getelementptr inbounds { i64, i32 }, ptr %22, i32 0, i32 0
  %56 = load i64, ptr %55, align 4
  %57 = getelementptr inbounds { i64, i32 }, ptr %22, i32 0, i32 1
  %58 = load i32, ptr %57, align 4
  %59 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %26, i64 %56, i32 %58, i32 noundef %53, ptr noundef nonnull align 8 dereferenceable(36) %54)
  br i1 %59, label %60, label %71

60:                                               ; preds = %51
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %15, i64 12, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %61 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 0
  %62 = load i64, ptr %61, align 4
  %63 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 1
  %64 = load i32, ptr %63, align 4
  %65 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %26, i64 %62, i32 %64)
  %66 = fpext float %65 to double
  %67 = load double, ptr %16, align 8, !tbaa !11
  %68 = fadd double %67, %66
  store double %68, ptr %16, align 8, !tbaa !11
  %69 = load double, ptr %17, align 8, !tbaa !11
  %70 = fadd double %69, 1.000000e+00
  store double %70, ptr %17, align 8, !tbaa !11
  br label %71

71:                                               ; preds = %60, %51, %42
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %18, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %18, align 4, !tbaa !9
  br label %38, !llvm.loop !14

75:                                               ; preds = %41
  %76 = load double, ptr %16, align 8, !tbaa !11
  %77 = fcmp oeq double %76, 0.000000e+00
  br i1 %77, label %78, label %79

78:                                               ; preds = %75
  store double 0.000000e+00, ptr %7, align 8
  store i32 1, ptr %25, align 4
  br label %83

79:                                               ; preds = %75
  %80 = load double, ptr %16, align 8, !tbaa !11
  %81 = load double, ptr %17, align 8, !tbaa !11
  %82 = fdiv double %80, %81
  store double %82, ptr %7, align 8
  store i32 1, ptr %25, align 4
  br label %83

83:                                               ; preds = %79, %78
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %14) #5
  %84 = load double, ptr %7, align 8
  ret double %84
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 8, i64 4, !9}
!14 = distinct !{!14, !15}
!15 = !{!"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"

%struct.GridIndex = type { i32, i32, i32 }

; 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 @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148), i64, i32) local_unnamed_addr #1 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZN16MACVelocityField32_getExtrapolatedVelocityForFaceUEiiiiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef nonnull align 8 dereferenceable(36) %5) local_unnamed_addr #1 align 2 {
  %7 = alloca [6 x %struct.GridIndex], align 16
  %8 = alloca %struct.GridIndex, align 8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %7) #5
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %7)
  %.ptr.1 = getelementptr inbounds i8, ptr %7, i64 12
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %7, i64 24
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %7, i64 36
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %7, i64 48
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %7, i64 60
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5)
  call void @_ZN6Grid3d24getNeighbourGridIndices6EiiiP9GridIndex(i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef nonnull %7)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #5
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %8)
  %.sroa.210.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  %9 = add nsw i32 %4, -1
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 16 dereferenceable(12) %7, i64 12, i1 false), !tbaa.struct !5
  %.sroa.09.0.copyload = load i64, ptr %8, align 8
  %.sroa.210.0.copyload = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %10 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.09.0.copyload, i32 %.sroa.210.0.copyload)
  br i1 %10, label %11, label %18

11:                                               ; preds = %6
  %.sroa.05.0.copyload = load i64, ptr %8, align 8
  %.sroa.26.0.copyload = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %12 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.05.0.copyload, i32 %.sroa.26.0.copyload, i32 noundef %9, ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %12, label %13, label %18

13:                                               ; preds = %11
  %.sroa.01.0.copyload = load i64, ptr %8, align 8
  %.sroa.22.0.copyload = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %14 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.01.0.copyload, i32 %.sroa.22.0.copyload)
  %15 = fpext float %14 to double
  %16 = fadd double %15, 0.000000e+00
  %17 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %16, i64 1
  br label %18

18:                                               ; preds = %6, %11, %13
  %19 = phi <2 x double> [ %17, %13 ], [ zeroinitializer, %11 ], [ zeroinitializer, %6 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.1, i64 12, i1 false), !tbaa.struct !5
  %.sroa.09.0.copyload.1 = load i64, ptr %8, align 8
  %.sroa.210.0.copyload.1 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %20 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.09.0.copyload.1, i32 %.sroa.210.0.copyload.1)
  br i1 %20, label %21, label %28

21:                                               ; preds = %18
  %.sroa.05.0.copyload.1 = load i64, ptr %8, align 8
  %.sroa.26.0.copyload.1 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %22 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.05.0.copyload.1, i32 %.sroa.26.0.copyload.1, i32 noundef %9, ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %22, label %23, label %28

23:                                               ; preds = %21
  %.sroa.01.0.copyload.1 = load i64, ptr %8, align 8
  %.sroa.22.0.copyload.1 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %24 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.01.0.copyload.1, i32 %.sroa.22.0.copyload.1)
  %25 = fpext float %24 to double
  %26 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %25, i64 1
  %27 = fadd <2 x double> %19, %26
  br label %28

28:                                               ; preds = %23, %21, %18
  %29 = phi <2 x double> [ %27, %23 ], [ %19, %21 ], [ %19, %18 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 8 dereferenceable(12) %.ptr.2, i64 12, i1 false), !tbaa.struct !5
  %.sroa.09.0.copyload.2 = load i64, ptr %8, align 8
  %.sroa.210.0.copyload.2 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %30 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.09.0.copyload.2, i32 %.sroa.210.0.copyload.2)
  br i1 %30, label %31, label %38

31:                                               ; preds = %28
  %.sroa.05.0.copyload.2 = load i64, ptr %8, align 8
  %.sroa.26.0.copyload.2 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %32 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.05.0.copyload.2, i32 %.sroa.26.0.copyload.2, i32 noundef %9, ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %32, label %33, label %38

33:                                               ; preds = %31
  %.sroa.01.0.copyload.2 = load i64, ptr %8, align 8
  %.sroa.22.0.copyload.2 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %34 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.01.0.copyload.2, i32 %.sroa.22.0.copyload.2)
  %35 = fpext float %34 to double
  %36 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %35, i64 1
  %37 = fadd <2 x double> %29, %36
  br label %38

38:                                               ; preds = %33, %31, %28
  %39 = phi <2 x double> [ %37, %33 ], [ %29, %31 ], [ %29, %28 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.3, i64 12, i1 false), !tbaa.struct !5
  %.sroa.09.0.copyload.3 = load i64, ptr %8, align 8
  %.sroa.210.0.copyload.3 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %40 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.09.0.copyload.3, i32 %.sroa.210.0.copyload.3)
  br i1 %40, label %41, label %48

41:                                               ; preds = %38
  %.sroa.05.0.copyload.3 = load i64, ptr %8, align 8
  %.sroa.26.0.copyload.3 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %42 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.05.0.copyload.3, i32 %.sroa.26.0.copyload.3, i32 noundef %9, ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %42, label %43, label %48

43:                                               ; preds = %41
  %.sroa.01.0.copyload.3 = load i64, ptr %8, align 8
  %.sroa.22.0.copyload.3 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %44 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.01.0.copyload.3, i32 %.sroa.22.0.copyload.3)
  %45 = fpext float %44 to double
  %46 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %45, i64 1
  %47 = fadd <2 x double> %39, %46
  br label %48

48:                                               ; preds = %43, %41, %38
  %49 = phi <2 x double> [ %47, %43 ], [ %39, %41 ], [ %39, %38 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 16 dereferenceable(12) %.ptr.4, i64 12, i1 false), !tbaa.struct !5
  %.sroa.09.0.copyload.4 = load i64, ptr %8, align 8
  %.sroa.210.0.copyload.4 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %50 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.09.0.copyload.4, i32 %.sroa.210.0.copyload.4)
  br i1 %50, label %51, label %58

51:                                               ; preds = %48
  %.sroa.05.0.copyload.4 = load i64, ptr %8, align 8
  %.sroa.26.0.copyload.4 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %52 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.05.0.copyload.4, i32 %.sroa.26.0.copyload.4, i32 noundef %9, ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %52, label %53, label %58

53:                                               ; preds = %51
  %.sroa.01.0.copyload.4 = load i64, ptr %8, align 8
  %.sroa.22.0.copyload.4 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %54 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.01.0.copyload.4, i32 %.sroa.22.0.copyload.4)
  %55 = fpext float %54 to double
  %56 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %55, i64 1
  %57 = fadd <2 x double> %49, %56
  br label %58

58:                                               ; preds = %53, %51, %48
  %59 = phi <2 x double> [ %57, %53 ], [ %49, %51 ], [ %49, %48 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %8, ptr noundef nonnull align 4 dereferenceable(12) %.ptr.5, i64 12, i1 false), !tbaa.struct !5
  %.sroa.09.0.copyload.5 = load i64, ptr %8, align 8
  %.sroa.210.0.copyload.5 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %60 = call noundef zeroext i1 @_ZN16MACVelocityField15isIndexInRangeUE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.09.0.copyload.5, i32 %.sroa.210.0.copyload.5)
  br i1 %60, label %61, label %68

61:                                               ; preds = %58
  %.sroa.05.0.copyload.5 = load i64, ptr %8, align 8
  %.sroa.26.0.copyload.5 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %62 = call noundef zeroext i1 @_ZN16MACVelocityField27_isFaceBorderingLayerIndexUE9GridIndexiR7Array3dIiE(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.05.0.copyload.5, i32 %.sroa.26.0.copyload.5, i32 noundef %9, ptr noundef nonnull align 8 dereferenceable(36) %5)
  br i1 %62, label %63, label %68

63:                                               ; preds = %61
  %.sroa.01.0.copyload.5 = load i64, ptr %8, align 8
  %.sroa.22.0.copyload.5 = load i32, ptr %.sroa.210.0..sroa_idx, align 8, !tbaa !6
  %64 = call noundef float @_ZN16MACVelocityField1UE9GridIndex(ptr noundef nonnull align 8 dereferenceable(148) %0, i64 %.sroa.01.0.copyload.5, i32 %.sroa.22.0.copyload.5)
  %65 = fpext float %64 to double
  %66 = insertelement <2 x double> <double 1.000000e+00, double poison>, double %65, i64 1
  %67 = fadd <2 x double> %59, %66
  br label %68

68:                                               ; preds = %63, %61, %58
  %69 = phi <2 x double> [ %67, %63 ], [ %59, %61 ], [ %59, %58 ]
  %70 = extractelement <2 x double> %69, i64 1
  %71 = fcmp oeq double %70, 0.000000e+00
  %72 = extractelement <2 x double> %69, i64 0
  %73 = fdiv double %70, %72
  %.0 = select i1 %71, double 0.000000e+00, double %73
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %7) #5
  ret double %.0
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{i64 0, i64 4, !6, i64 4, i64 4, !6, i64 8, i64 4, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass