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

; 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.GridIndexVector = type { i32, i32, i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.GridIndex = type { i32, i32, i32 }
%class.FluidMaterialGrid = type { i32, i32, i32, %class.SubdividedArray3d }
%class.SubdividedArray3d = type { i32, i32, i32, i32, i32, i32, %class.Array3d, i32, double }
%class.Array3d = type { i32, i32, i32, ptr, i8, i8, i32 }

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11FluidSource8isActiveEv(ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

declare void @_ZN15GridIndexVectorC1Eiii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #6

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11FluidSource18getFluidOrAirCellsER17FluidMaterialGridd(ptr dead_on_unwind noalias writable sret(%class.GridIndexVector) align 8 %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(88) %2, double noundef %3) #7 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i1, align 1
  %13 = alloca i32, align 4
  %14 = alloca %class.GridIndexVector, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %struct.GridIndex, align 4
  %18 = alloca i32, align 4
  %19 = alloca %struct.GridIndex, align 4
  %20 = alloca { i64, i32 }, align 8
  %21 = alloca %struct.GridIndex, align 4
  %22 = alloca { i64, i32 }, align 4
  %23 = alloca %struct.GridIndex, align 4
  %24 = alloca { i64, i32 }, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store double %3, ptr %8, align 8, !tbaa !9
  %25 = load ptr, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %class.FluidMaterialGrid, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !11
  store i32 %28, ptr %9, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = getelementptr inbounds %class.FluidMaterialGrid, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !19
  store i32 %31, ptr %10, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %class.FluidMaterialGrid, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !20
  store i32 %34, ptr %11, align 4, !tbaa !18
  store i1 false, ptr %12, align 1
  %35 = load i32, ptr %9, align 4, !tbaa !18
  %36 = load i32, ptr %10, align 4, !tbaa !18
  %37 = load i32, ptr %11, align 4, !tbaa !18
  call void @_ZN15GridIndexVectorC1Eiii(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef %35, i32 noundef %36, i32 noundef %37)
  %38 = call noundef zeroext i1 @_ZN11FluidSource8isActiveEv(ptr noundef nonnull align 8 dereferenceable(40) %25)
  br i1 %38, label %40, label %39

39:                                               ; preds = %4
  store i1 true, ptr %12, align 1
  store i32 1, ptr %13, align 4
  br label %104

40:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 40, ptr %14) #8
  %41 = load i32, ptr %9, align 4, !tbaa !18
  %42 = load i32, ptr %10, align 4, !tbaa !18
  %43 = load i32, ptr %11, align 4, !tbaa !18
  invoke void @_ZN15GridIndexVectorC1Eiii(ptr noundef nonnull align 8 dereferenceable(40) %14, i32 noundef %41, i32 noundef %42, i32 noundef %43)
          to label %44 unwind label %58

44:                                               ; preds = %40
  %45 = load double, ptr %8, align 8, !tbaa !9
  %46 = load ptr, ptr %25, align 8, !tbaa !21
  %47 = getelementptr inbounds ptr, ptr %46, i64 6
  %48 = load ptr, ptr %47, align 8
  invoke void %48(ptr noundef nonnull align 8 dereferenceable(40) %25, ptr noundef nonnull align 8 dereferenceable(40) %14, double noundef %45)
          to label %49 unwind label %62

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #8
  invoke void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %17)
          to label %50 unwind label %66

50:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 0, ptr %18, align 4, !tbaa !18
  br label %51

51:                                               ; preds = %96, %50
  %52 = load i32, ptr %18, align 4, !tbaa !18
  %53 = zext i32 %52 to i64
  %54 = invoke noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %14)
          to label %55 unwind label %70

55:                                               ; preds = %51
  %56 = icmp ult i64 %53, %54
  br i1 %56, label %74, label %57

57:                                               ; preds = %55
  store i32 2, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %100

58:                                               ; preds = %40
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %15, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %16, align 4
  br label %103

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

66:                                               ; preds = %49
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %15, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %16, align 4
  br label %101

70:                                               ; preds = %85, %77, %51
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %15, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %16, align 4
  br label %99

74:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 12, ptr %19) #8
  %75 = load i32, ptr %18, align 4, !tbaa !18
  %76 = invoke { i64, i32 } @_ZN15GridIndexVectorixEi(ptr noundef nonnull align 8 dereferenceable(40) %14, i32 noundef %75)
          to label %77 unwind label %91

77:                                               ; preds = %74
  store { i64, i32 } %76, ptr %20, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 8 %20, i64 12, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %17, ptr align 4 %19, i64 12, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %21, ptr align 4 %17, i64 12, i1 false), !tbaa.struct !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %22, ptr align 4 %21, i64 12, i1 false)
  %79 = getelementptr inbounds { i64, i32 }, ptr %22, i32 0, i32 0
  %80 = load i64, ptr %79, align 4
  %81 = getelementptr inbounds { i64, i32 }, ptr %22, i32 0, i32 1
  %82 = load i32, ptr %81, align 4
  %83 = invoke noundef zeroext i1 @_ZN17FluidMaterialGrid11isCellSolidE9GridIndex(ptr noundef nonnull align 8 dereferenceable(88) %78, i64 %80, i32 %82)
          to label %84 unwind label %70

84:                                               ; preds = %77
  br i1 %83, label %95, label %85

85:                                               ; preds = %84
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %17, i64 12, i1 false), !tbaa.struct !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %86 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 0
  %87 = load i64, ptr %86, align 4
  %88 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 1
  %89 = load i32, ptr %88, align 4
  invoke void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 %87, i32 %89)
          to label %90 unwind label %70

90:                                               ; preds = %85
  br label %95

91:                                               ; preds = %74
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %15, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %19) #8
  br label %99

95:                                               ; preds = %90, %84
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %18, align 4, !tbaa !18
  %98 = add i32 %97, 1
  store i32 %98, ptr %18, align 4, !tbaa !18
  br label %51, !llvm.loop !24

99:                                               ; preds = %91, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %101

100:                                              ; preds = %57
  store i1 true, ptr %12, align 1
  store i32 1, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #8
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #8
  br label %104

101:                                              ; preds = %99, %66
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #8
  br label %102

102:                                              ; preds = %101, %62
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #8
  br label %103

103:                                              ; preds = %102, %58
  call void @llvm.lifetime.end.p0(i64 40, ptr %14) #8
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %108

104:                                              ; preds = %100, %39
  %105 = load i1, ptr %12, align 1
  br i1 %105, label %107, label %106

106:                                              ; preds = %104
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #8
  br label %107

107:                                              ; preds = %106, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  ret void

108:                                              ; preds = %103
  %109 = load ptr, ptr %15, align 8
  %110 = load i32, ptr %16, align 4
  %111 = insertvalue { ptr, i32 } poison, ptr %109, 0
  %112 = insertvalue { ptr, i32 } %111, i32 %110, 1
  resume { ptr, i32 } %112
}

declare noundef zeroext i1 @_ZN17FluidMaterialGrid11isCellSolidE9GridIndex(ptr noundef nonnull align 8 dereferenceable(88), i64, i32) #3

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS17FluidMaterialGrid", !13, i64 0, !13, i64 4, !13, i64 8, !14, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ZTS17SubdividedArray3dI8MaterialE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !15, i64 24, !13, i64 56, !10, i64 64}
!15 = !{!"_ZTS7Array3dI8MaterialE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !16, i64 24, !17, i64 25, !13, i64 28}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTS8Material", !7, i64 0}
!18 = !{!13, !13, i64 0}
!19 = !{!12, !13, i64 4}
!20 = !{!12, !13, i64 8}
!21 = !{!22, !22, i64 0}
!22 = !{!"vtable pointer", !8, i64 0}
!23 = !{i64 0, i64 4, !18, i64 4, i64 4, !18, i64 8, i64 4, !18}
!24 = distinct !{!24, !25}
!25 = !{!"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.GridIndexVector = type { i32, i32, i32, %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.GridIndex = type { i32, i32, i32 }

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN11FluidSource8isActiveEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #1 align 2

declare void @_ZN15GridIndexVectorC1Eiii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #2

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

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

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

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

; Function Attrs: nounwind
declare void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11FluidSource18getFluidOrAirCellsER17FluidMaterialGridd(ptr dead_on_unwind noalias nonnull writable sret(%class.GridIndexVector) align 8 %0, ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(88) %2, double noundef %3) local_unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.GridIndexVector, align 8
  %6 = alloca %struct.GridIndex, align 8
  %7 = load i32, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 4
  %9 = load i32, ptr %8, align 4, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !17
  tail call void @_ZN15GridIndexVectorC1Eiii(ptr noundef nonnull align 8 dereferenceable(40) %0, i32 noundef %7, i32 noundef %9, i32 noundef %11)
  %12 = tail call noundef zeroext i1 @_ZN11FluidSource8isActiveEv(ptr noundef nonnull align 8 dereferenceable(40) %1)
  br i1 %12, label %13, label %42

13:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #7
  invoke void @_ZN15GridIndexVectorC1Eiii(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef %7, i32 noundef %9, i32 noundef %11)
          to label %14 unwind label %20

14:                                               ; preds = %13
  %15 = load ptr, ptr %1, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %15, i64 48
  %17 = load ptr, ptr %16, align 8
  invoke void %17(ptr noundef nonnull align 8 dereferenceable(40) %1, ptr noundef nonnull align 8 dereferenceable(40) %5, double noundef %3)
          to label %18 unwind label %22

18:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #7
  call void @_ZN9GridIndexC2Ev(ptr noundef nonnull align 4 dereferenceable(12) %6)
  %19 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %5)
  %.not = icmp eq i64 %19, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %18
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  br label %26

._crit_edge:                                      ; preds = %34, %18
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #7
  br label %42

20:                                               ; preds = %13
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %41

22:                                               ; preds = %14
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %40

24:                                               ; preds = %31, %28
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %39

26:                                               ; preds = %.lr.ph, %34
  %.03034 = phi i32 [ 0, %.lr.ph ], [ %35, %34 ]
  %27 = invoke { i64, i32 } @_ZN15GridIndexVectorixEi(ptr noundef nonnull align 8 dereferenceable(40) %5, i32 noundef %.03034)
          to label %28 unwind label %32

28:                                               ; preds = %26
  %.fca.0.extract = extractvalue { i64, i32 } %27, 0
  %.fca.1.extract = extractvalue { i64, i32 } %27, 1
  store i64 %.fca.0.extract, ptr %6, align 8
  store i32 %.fca.1.extract, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !20
  %29 = invoke noundef zeroext i1 @_ZN17FluidMaterialGrid11isCellSolidE9GridIndex(ptr noundef nonnull align 8 dereferenceable(88) %2, i64 %.fca.0.extract, i32 %.fca.1.extract)
          to label %30 unwind label %24

30:                                               ; preds = %28
  br i1 %29, label %34, label %31

31:                                               ; preds = %30
  %.sroa.01.0.copyload = load i64, ptr %6, align 8
  %.sroa.22.0.copyload = load i32, ptr %.sroa.5.0..sroa_idx, align 8, !tbaa !20
  invoke void @_ZN15GridIndexVector9push_backE9GridIndex(ptr noundef nonnull align 8 dereferenceable(40) %0, i64 %.sroa.01.0.copyload, i32 %.sroa.22.0.copyload)
          to label %34 unwind label %24

32:                                               ; preds = %26
  %33 = landingpad { ptr, i32 }
          cleanup
  br label %39

34:                                               ; preds = %30, %31
  %35 = add i32 %.03034, 1
  %36 = zext i32 %35 to i64
  %37 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %5)
  %38 = icmp ugt i64 %37, %36
  br i1 %38, label %26, label %._crit_edge, !llvm.loop !21

39:                                               ; preds = %32, %24
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %33, %32 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #7
  br label %40

40:                                               ; preds = %39, %22
  %.pn.pn = phi { ptr, i32 } [ %.pn, %39 ], [ %23, %22 ]
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #7
  br label %41

41:                                               ; preds = %40, %20
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %40 ], [ %21, %20 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #7
  call void @_ZN15GridIndexVectorD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %0) #7
  resume { ptr, i32 } %.pn.pn.pn

42:                                               ; preds = %._crit_edge, %4
  ret void
}

declare noundef zeroext i1 @_ZN17FluidMaterialGrid11isCellSolidE9GridIndex(ptr noundef nonnull align 8 dereferenceable(88), i64, i32) local_unnamed_addr #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ZTS17FluidMaterialGrid", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS17SubdividedArray3dI8MaterialE", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !11, i64 24, !7, i64 56, !15, i64 64}
!11 = !{!"_ZTS7Array3dI8MaterialE", !7, i64 0, !7, i64 4, !7, i64 8, !12, i64 16, !13, i64 24, !14, i64 25, !7, i64 28}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"bool", !8, i64 0}
!14 = !{!"_ZTS8Material", !8, i64 0}
!15 = !{!"double", !8, i64 0}
!16 = !{!6, !7, i64 4}
!17 = !{!6, !7, i64 8}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !9, i64 0}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass