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

; 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.0 = type { i32, i32, i32, ptr, i8, [3 x i8], %struct.Brick, i32 }
%struct.Brick = type <{ float, i8, [3 x i8] }>
%class.Array3d.29 = type { i32, i32, i32, ptr, i8, i8, i32 }
%"class.std::vector.30" = type { %"struct.std::_Vector_base.31" }
%"struct.std::_Vector_base.31" = type { %"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl" }
%"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.FluidBrickGrid = type <{ i32, i32, i32, [4 x i8], double, %class.AABB, %class.Array3d, %class.Array3d.0, [3 x %class.Array3d.0], i32, [4 x i8], %class.Array3d.0, i8, [3 x i8], i32, i32, float, float, float, i32, i32, i8, [7 x i8] }>
%class.AABB = type { %"class.vmath::vec3", double, double, double }
%"class.vmath::vec3" = type { float, float, float }
%class.Array3d = type <{ i32, i32, i32, [4 x i8], ptr, i8, [3 x i8], %"struct.FluidBrickGrid::DensityNode", i32, [4 x i8] }>
%"struct.FluidBrickGrid::DensityNode" = type { float, float, float }

declare i32 @__gxx_personality_v0(...)

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

; 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 uwtable
declare dso_local i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbE3setEiiib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14FluidBrickGrid19_getbrickStructuresER7Array3dI5BrickERS0_IbERSt6vectorI15GridIndexVectorSaIS7_EE(ptr noundef nonnull align 8 dereferenceable(353), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14FluidBrickGrid34_removeBrickStructureFromBrickGridER15GridIndexVectorR7Array3dI5BrickE(ptr noundef nonnull align 8 dereferenceable(353), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorI15GridIndexVectorSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14FluidBrickGrid27_removeSmallBrickStructuresEv(ptr noundef nonnull align 8 dereferenceable(353) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %class.Array3d.0, align 8
  %4 = alloca %class.Array3d.29, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.Brick, align 4
  %12 = alloca %"class.std::vector.30", align 8
  %13 = alloca i32, align 4
  %14 = alloca %class.Array3d.0, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr %3) #4
  %16 = getelementptr inbounds %class.FluidBrickGrid, ptr %15, i32 0, i32 8
  %17 = getelementptr inbounds [3 x %class.Array3d.0], ptr %16, i64 0, i64 1
  call void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(40) %17)
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #4
  %18 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 0
  %19 = load i32, ptr %18, align 8, !tbaa !9
  %20 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !16
  invoke void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef %19, i32 noundef %21, i32 noundef %23, i1 noundef zeroext false)
          to label %24 unwind label %31

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

25:                                               ; preds = %82, %24
  %26 = load i32, ptr %7, align 4, !tbaa !17
  %27 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 2
  %28 = load i32, ptr %27, align 8, !tbaa !16
  %29 = icmp slt i32 %26, %28
  br i1 %29, label %35, label %30

30:                                               ; preds = %25
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %85

31:                                               ; preds = %1
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %5, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %6, align 4
  br label %126

35:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !17
  br label %36

36:                                               ; preds = %78, %35
  %37 = load i32, ptr %9, align 4, !tbaa !17
  %38 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = icmp slt i32 %37, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %36
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %81

42:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !17
  br label %43

43:                                               ; preds = %73, %42
  %44 = load i32, ptr %10, align 4, !tbaa !17
  %45 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !9
  %47 = icmp slt i32 %44, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %43
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %77

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %50 = load i32, ptr %10, align 4, !tbaa !17
  %51 = load i32, ptr %9, align 4, !tbaa !17
  %52 = load i32, ptr %7, align 4, !tbaa !17
  %53 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %3, i32 noundef %50, i32 noundef %51, i32 noundef %52)
          to label %54 unwind label %64

54:                                               ; preds = %49
  %55 = trunc i64 %53 to i40
  store i40 %55, ptr %11, align 4
  %56 = getelementptr inbounds %struct.Brick, ptr %11, i32 0, i32 1
  %57 = load i8, ptr %56, align 4, !tbaa !18, !range !19, !noundef !20
  %58 = trunc i8 %57 to i1
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br i1 %58, label %59, label %72

59:                                               ; preds = %54
  %60 = load i32, ptr %10, align 4, !tbaa !17
  %61 = load i32, ptr %9, align 4, !tbaa !17
  %62 = load i32, ptr %7, align 4, !tbaa !17
  invoke void @_ZN7Array3dIbE3setEiiib(ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef %60, i32 noundef %61, i32 noundef %62, i1 noundef zeroext true)
          to label %63 unwind label %68

63:                                               ; preds = %59
  br label %72

64:                                               ; preds = %49
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %5, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %76

68:                                               ; preds = %59
  %69 = landingpad { ptr, i32 }
          cleanup
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %5, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %6, align 4
  br label %76

72:                                               ; preds = %63, %54
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %10, align 4, !tbaa !17
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %10, align 4, !tbaa !17
  br label %43, !llvm.loop !21

76:                                               ; preds = %68, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %125

77:                                               ; preds = %48
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %9, align 4, !tbaa !17
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %9, align 4, !tbaa !17
  br label %36, !llvm.loop !23

81:                                               ; preds = %41
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %7, align 4, !tbaa !17
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %7, align 4, !tbaa !17
  br label %25, !llvm.loop !24

85:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #4
  call void @_ZNSt6vectorI15GridIndexVectorSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  invoke void @_ZN14FluidBrickGrid19_getbrickStructuresER7Array3dI5BrickERS0_IbERSt6vectorI15GridIndexVectorSaIS7_EE(ptr noundef nonnull align 8 dereferenceable(353) %15, ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %86 unwind label %93

86:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !17
  br label %87

87:                                               ; preds = %117, %86
  %88 = load i32, ptr %13, align 4, !tbaa !17
  %89 = zext i32 %88 to i64
  %90 = call noundef i64 @_ZNKSt6vectorI15GridIndexVectorSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  %91 = icmp ult i64 %89, %90
  br i1 %91, label %97, label %92

92:                                               ; preds = %87
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %120

93:                                               ; preds = %120, %85
  %94 = landingpad { ptr, i32 }
          cleanup
  %95 = extractvalue { ptr, i32 } %94, 0
  store ptr %95, ptr %5, align 8
  %96 = extractvalue { ptr, i32 } %94, 1
  store i32 %96, ptr %6, align 4
  br label %124

97:                                               ; preds = %87
  %98 = load i32, ptr %13, align 4, !tbaa !17
  %99 = zext i32 %98 to i64
  %100 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorI15GridIndexVectorSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %99) #4
  %101 = invoke noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %100)
          to label %102 unwind label %112

102:                                              ; preds = %97
  %103 = getelementptr inbounds %class.FluidBrickGrid, ptr %15, i32 0, i32 19
  %104 = load i32, ptr %103, align 8, !tbaa !25
  %105 = zext i32 %104 to i64
  %106 = icmp ult i64 %101, %105
  br i1 %106, label %107, label %116

107:                                              ; preds = %102
  %108 = load i32, ptr %13, align 4, !tbaa !17
  %109 = zext i32 %108 to i64
  %110 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorI15GridIndexVectorSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %109) #4
  invoke void @_ZN14FluidBrickGrid34_removeBrickStructureFromBrickGridER15GridIndexVectorR7Array3dI5BrickE(ptr noundef nonnull align 8 dereferenceable(353) %15, ptr noundef nonnull align 8 dereferenceable(40) %110, ptr noundef nonnull align 8 dereferenceable(40) %3)
          to label %111 unwind label %112

111:                                              ; preds = %107
  br label %116

112:                                              ; preds = %107, %97
  %113 = landingpad { ptr, i32 }
          cleanup
  %114 = extractvalue { ptr, i32 } %113, 0
  store ptr %114, ptr %5, align 8
  %115 = extractvalue { ptr, i32 } %113, 1
  store i32 %115, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %124

116:                                              ; preds = %111, %102
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %13, align 4, !tbaa !17
  %119 = add i32 %118, 1
  store i32 %119, ptr %13, align 4, !tbaa !17
  br label %87, !llvm.loop !32

120:                                              ; preds = %92
  %121 = getelementptr inbounds %class.FluidBrickGrid, ptr %15, i32 0, i32 8
  %122 = getelementptr inbounds [3 x %class.Array3d.0], ptr %121, i64 0, i64 1
  invoke void @_ZN7Array3dI5BrickEaSERKS1_(ptr dead_on_unwind writable sret(%class.Array3d.0) align 8 %14, ptr noundef nonnull align 8 dereferenceable(40) %122, ptr noundef nonnull align 8 dereferenceable(40) %3)
          to label %123 unwind label %93

123:                                              ; preds = %120
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #4
  call void @_ZNSt6vectorI15GridIndexVectorSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #4
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #4
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #4
  ret void

124:                                              ; preds = %112, %93
  call void @_ZNSt6vectorI15GridIndexVectorSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #4
  br label %125

125:                                              ; preds = %124, %76
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #4
  br label %126

126:                                              ; preds = %125, %31
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #4
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #4
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr %5, align 8
  %129 = load i32, ptr %6, align 4
  %130 = insertvalue { ptr, i32 } poison, ptr %128, 0
  %131 = insertvalue { ptr, i32 } %130, i32 %129, 1
  resume { ptr, i32 } %131
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nounwind }

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

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


; 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.0 = type { i32, i32, i32, ptr, i8, [3 x i8], %struct.Brick, i32 }
%struct.Brick = type <{ float, i8, [3 x i8] }>
%class.Array3d.29 = type { i32, i32, i32, ptr, i8, i8, i32 }
%"class.std::vector.30" = type { %"struct.std::_Vector_base.31" }
%"struct.std::_Vector_base.31" = type { %"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl" }
%"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl" = type { %"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl_data" }
%"struct.std::_Vector_base<GridIndexVector, std::allocator<GridIndexVector>>::_Vector_impl_data" = type { ptr, ptr, ptr }

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbE3setEiiib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14FluidBrickGrid19_getbrickStructuresER7Array3dI5BrickERS0_IbERSt6vectorI15GridIndexVectorSaIS7_EE(ptr noundef nonnull align 8 dereferenceable(353), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN14FluidBrickGrid34_removeBrickStructureFromBrickGridER15GridIndexVectorR7Array3dI5BrickE(ptr noundef nonnull align 8 dereferenceable(353), ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorI15GridIndexVectorSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 align 2

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN14FluidBrickGrid27_removeSmallBrickStructuresEv(ptr noundef nonnull align 8 dereferenceable(353) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %class.Array3d.0, align 8
  %3 = alloca %class.Array3d.29, align 8
  %4 = alloca %"class.std::vector.30", align 8
  %5 = alloca %class.Array3d.0, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %2) #4
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  call void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(40) %6)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #4
  %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 !14
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !15
  invoke void @_ZN7Array3dIbEC2Eiiib(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef %7, i32 noundef %9, i32 noundef %11, i1 noundef zeroext false)
          to label %.preheader35 unwind label %24

.preheader35:                                     ; preds = %1
  %12 = load i32, ptr %10, align 8, !tbaa !15
  %13 = icmp sgt i32 %12, 0
  %14 = load i32, ptr %8, align 4
  %15 = icmp sgt i32 %14, 0
  %or.cond = select i1 %13, i1 %15, i1 false
  br i1 %or.cond, label %.preheader34, label %._crit_edge41

.preheader34:                                     ; preds = %.preheader35, %._crit_edge38
  %16 = phi i32 [ %29, %._crit_edge38 ], [ %12, %.preheader35 ]
  %17 = phi i32 [ %30, %._crit_edge38 ], [ %14, %.preheader35 ]
  %18 = phi i32 [ %31, %._crit_edge38 ], [ %14, %.preheader35 ]
  %.02539 = phi i32 [ %32, %._crit_edge38 ], [ 0, %.preheader35 ]
  %19 = icmp sgt i32 %18, 0
  %20 = load i32, ptr %2, align 8
  %21 = icmp sgt i32 %20, 0
  %or.cond52 = select i1 %19, i1 %21, i1 false
  br i1 %or.cond52, label %.preheader33, label %._crit_edge38

._crit_edge41:                                    ; preds = %._crit_edge38, %.preheader35
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #4
  call void @_ZNSt6vectorI15GridIndexVectorSaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  invoke void @_ZN14FluidBrickGrid19_getbrickStructuresER7Array3dI5BrickERS0_IbERSt6vectorI15GridIndexVectorSaIS7_EE(ptr noundef nonnull align 8 dereferenceable(353) %0, ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(24) %4)
          to label %.preheader unwind label %50

.preheader:                                       ; preds = %._crit_edge41
  %22 = call noundef i64 @_ZNKSt6vectorI15GridIndexVectorSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %.not45 = icmp eq i64 %22, 0
  br i1 %.not45, label %._crit_edge44, label %.lr.ph43

.lr.ph43:                                         ; preds = %.preheader
  %23 = getelementptr inbounds i8, ptr %0, i64 344
  br label %52

24:                                               ; preds = %1
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %71

.preheader33:                                     ; preds = %.preheader34, %._crit_edge
  %26 = phi i32 [ %34, %._crit_edge ], [ %17, %.preheader34 ]
  %27 = phi i32 [ %35, %._crit_edge ], [ %20, %.preheader34 ]
  %.02437 = phi i32 [ %36, %._crit_edge ], [ 0, %.preheader34 ]
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge38.loopexit:                           ; preds = %._crit_edge
  %.pre48 = load i32, ptr %10, align 8, !tbaa !15
  br label %._crit_edge38

._crit_edge38:                                    ; preds = %._crit_edge38.loopexit, %.preheader34
  %29 = phi i32 [ %.pre48, %._crit_edge38.loopexit ], [ %16, %.preheader34 ]
  %30 = phi i32 [ %34, %._crit_edge38.loopexit ], [ %17, %.preheader34 ]
  %31 = phi i32 [ %34, %._crit_edge38.loopexit ], [ %18, %.preheader34 ]
  %32 = add nuw nsw i32 %.02539, 1
  %33 = icmp slt i32 %32, %29
  br i1 %33, label %.preheader34, label %._crit_edge41, !llvm.loop !16

._crit_edge.loopexit:                             ; preds = %46
  %.pre = load i32, ptr %8, align 4, !tbaa !14
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader33
  %34 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %26, %.preheader33 ]
  %35 = phi i32 [ %48, %._crit_edge.loopexit ], [ %27, %.preheader33 ]
  %36 = add nuw nsw i32 %.02437, 1
  %37 = icmp slt i32 %36, %34
  br i1 %37, label %.preheader33, label %._crit_edge38.loopexit, !llvm.loop !19

.lr.ph:                                           ; preds = %.preheader33, %46
  %.02336 = phi i32 [ %47, %46 ], [ 0, %.preheader33 ]
  %38 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %2, i32 noundef %.02336, i32 noundef %.02437, i32 noundef %.02539)
          to label %39 unwind label %42

39:                                               ; preds = %.lr.ph
  %40 = and i64 %38, 4294967296
  %.not = icmp eq i64 %40, 0
  br i1 %.not, label %46, label %41

41:                                               ; preds = %39
  invoke void @_ZN7Array3dIbE3setEiiib(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef %.02336, i32 noundef %.02437, i32 noundef %.02539, i1 noundef zeroext true)
          to label %46 unwind label %44

42:                                               ; preds = %.lr.ph
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %70

44:                                               ; preds = %41
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %70

46:                                               ; preds = %39, %41
  %47 = add nuw nsw i32 %.02336, 1
  %48 = load i32, ptr %2, align 8, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !20

._crit_edge44:                                    ; preds = %63, %.preheader
  invoke void @_ZN7Array3dI5BrickEaSERKS1_(ptr dead_on_unwind nonnull writable sret(%class.Array3d.0) align 8 %5, ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %68 unwind label %50

50:                                               ; preds = %._crit_edge44, %._crit_edge41
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %69

52:                                               ; preds = %.lr.ph43, %63
  %53 = phi i64 [ 0, %.lr.ph43 ], [ %65, %63 ]
  %.042 = phi i32 [ 0, %.lr.ph43 ], [ %64, %63 ]
  %54 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorI15GridIndexVectorSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %53) #4
  %55 = call noundef i64 @_ZN15GridIndexVector4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %54)
  %56 = load i32, ptr %23, align 8, !tbaa !21
  %57 = zext i32 %56 to i64
  %58 = icmp ult i64 %55, %57
  br i1 %58, label %59, label %63

59:                                               ; preds = %52
  %60 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorI15GridIndexVectorSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %53) #4
  invoke void @_ZN14FluidBrickGrid34_removeBrickStructureFromBrickGridER15GridIndexVectorR7Array3dI5BrickE(ptr noundef nonnull align 8 dereferenceable(353) %0, ptr noundef nonnull align 8 dereferenceable(40) %60, ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %63 unwind label %61

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

63:                                               ; preds = %52, %59
  %64 = add i32 %.042, 1
  %65 = zext i32 %64 to i64
  %66 = call noundef i64 @_ZNKSt6vectorI15GridIndexVectorSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  %67 = icmp ugt i64 %66, %65
  br i1 %67, label %52, label %._crit_edge44, !llvm.loop !28

68:                                               ; preds = %._crit_edge44
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %5) #4
  call void @_ZNSt6vectorI15GridIndexVectorSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #4
  ret void

69:                                               ; preds = %61, %50
  %.pn = phi { ptr, i32 } [ %62, %61 ], [ %51, %50 ]
  call void @_ZNSt6vectorI15GridIndexVectorSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #4
  br label %70

70:                                               ; preds = %42, %44, %69
  %.pn29.pn = phi { ptr, i32 } [ %.pn, %69 ], [ %45, %44 ], [ %43, %42 ]
  call void @_ZN7Array3dIbED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #4
  br label %71

71:                                               ; preds = %70, %24
  %.pn29.pn.pn = phi { ptr, i32 } [ %.pn29.pn, %70 ], [ %25, %24 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #4
  resume { ptr, i32 } %.pn29.pn.pn
}

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { 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 = !{!"_ZTS7Array3dI5BrickE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !11, i64 24, !12, i64 28, !7, i64 36}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!"_ZTS5Brick", !13, i64 0, !11, i64 4}
!13 = !{!"float", !8, i64 0}
!14 = !{!6, !7, i64 4}
!15 = !{!6, !7, i64 8}
!16 = distinct !{!16, !17, !18}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
!19 = distinct !{!19, !17, !18}
!20 = distinct !{!20, !17}
!21 = !{!22, !7, i64 344}
!22 = !{!"_ZTS14FluidBrickGrid", !7, i64 0, !7, i64 4, !7, i64 8, !23, i64 16, !24, i64 24, !26, i64 64, !6, i64 112, !8, i64 152, !7, i64 272, !6, i64 280, !11, i64 320, !7, i64 324, !7, i64 328, !13, i64 332, !13, i64 336, !13, i64 340, !7, i64 344, !7, i64 348, !11, i64 352}
!23 = !{!"double", !8, i64 0}
!24 = !{!"_ZTS4AABB", !25, i64 0, !23, i64 16, !23, i64 24, !23, i64 32}
!25 = !{!"_ZTSN5vmath4vec3E", !13, i64 0, !13, i64 4, !13, i64 8}
!26 = !{!"_ZTS7Array3dIN14FluidBrickGrid11DensityNodeEE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !11, i64 24, !27, i64 28, !7, i64 40}
!27 = !{!"_ZTSN14FluidBrickGrid11DensityNodeE", !13, i64 0, !13, i64 4, !13, i64 8}
!28 = distinct !{!28, !17}


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