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

; 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.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 @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 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 uwtable
define dso_local void @_ZN14FluidBrickGrid16_mergeBrickGridsEv(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.0, 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 %struct.Brick, align 4
  %13 = alloca %struct.Brick, 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) #3
  %16 = getelementptr inbounds %class.FluidBrickGrid, ptr %15, i32 0, i32 8
  %17 = getelementptr inbounds [3 x %class.Array3d.0], ptr %16, i64 0, i64 0
  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 40, ptr %4) #3
  %18 = getelementptr inbounds %class.FluidBrickGrid, ptr %15, i32 0, i32 8
  %19 = getelementptr inbounds [3 x %class.Array3d.0], ptr %18, i64 0, i64 1
  invoke void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef nonnull align 8 dereferenceable(40) %19)
          to label %20 unwind label %27

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

21:                                               ; preds = %102, %20
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 2
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %31, label %26

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

27:                                               ; preds = %1
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %5, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %6, align 4
  br label %114

31:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %98, %31
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 1
  %35 = load i32, ptr %34, align 4, !tbaa !16
  %36 = icmp slt i32 %33, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %93, %38
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = getelementptr inbounds %class.Array3d.0, ptr %3, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !17
  %43 = icmp slt i32 %40, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %97

45:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %46 = load i32, ptr %10, align 4, !tbaa !9
  %47 = load i32, ptr %9, align 4, !tbaa !9
  %48 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %49 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %3, i32 noundef %46, i32 noundef %47, i32 noundef %48)
          to label %50 unwind label %79

50:                                               ; preds = %45
  %51 = trunc i64 %49 to i40
  store i40 %51, ptr %11, align 4
  %52 = getelementptr inbounds %struct.Brick, ptr %11, i32 0, i32 1
  %53 = load i8, ptr %52, align 4, !tbaa !18, !range !19, !noundef !20
  %54 = trunc i8 %53 to i1
  br i1 %54, label %65, label %55

55:                                               ; preds = %50
  %56 = load i32, ptr %10, align 4, !tbaa !9
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef %56, i32 noundef %57, i32 noundef %58)
          to label %60 unwind label %83

60:                                               ; preds = %55
  %61 = trunc i64 %59 to i40
  store i40 %61, ptr %12, align 4
  %62 = getelementptr inbounds %struct.Brick, ptr %12, i32 0, i32 1
  %63 = load i8, ptr %62, align 4, !tbaa !18, !range !19, !noundef !20
  %64 = trunc i8 %63 to i1
  br label %65

65:                                               ; preds = %60, %50
  %66 = phi i1 [ false, %50 ], [ %64, %60 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br i1 %66, label %67, label %92

67:                                               ; preds = %65
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = load i32, ptr %7, align 4, !tbaa !9
  %71 = load i32, ptr %10, align 4, !tbaa !9
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = load i32, ptr %7, align 4, !tbaa !9
  %74 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %4, i32 noundef %71, i32 noundef %72, i32 noundef %73)
          to label %75 unwind label %88

75:                                               ; preds = %67
  %76 = trunc i64 %74 to i40
  store i40 %76, ptr %13, align 4
  %77 = load i64, ptr %13, align 4
  invoke void @_ZN7Array3dI5BrickE3setEiiiS0_(ptr noundef nonnull align 8 dereferenceable(40) %3, i32 noundef %68, i32 noundef %69, i32 noundef %70, i64 %77)
          to label %78 unwind label %88

78:                                               ; preds = %75
  br label %92

79:                                               ; preds = %45
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %5, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %6, align 4
  br label %87

83:                                               ; preds = %55
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %5, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %87

87:                                               ; preds = %83, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %96

88:                                               ; preds = %75, %67
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %5, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %6, align 4
  br label %96

92:                                               ; preds = %78, %65
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %10, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %10, align 4, !tbaa !9
  br label %39, !llvm.loop !21

96:                                               ; preds = %88, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  br label %113

97:                                               ; preds = %44
  br label %98

98:                                               ; preds = %97
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %9, align 4, !tbaa !9
  br label %32, !llvm.loop !23

101:                                              ; preds = %37
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %7, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %7, align 4, !tbaa !9
  br label %21, !llvm.loop !24

105:                                              ; preds = %26
  %106 = getelementptr inbounds %class.FluidBrickGrid, ptr %15, i32 0, i32 8
  %107 = getelementptr inbounds [3 x %class.Array3d.0], ptr %106, i64 0, i64 0
  invoke void @_ZN7Array3dI5BrickEaSERKS1_(ptr dead_on_unwind writable sret(%class.Array3d.0) align 8 %14, ptr noundef nonnull align 8 dereferenceable(40) %107, ptr noundef nonnull align 8 dereferenceable(40) %3)
          to label %108 unwind label %109

108:                                              ; preds = %105
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %14) #3
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %4) #3
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #3
  ret void

109:                                              ; preds = %105
  %110 = landingpad { ptr, i32 }
          cleanup
  %111 = extractvalue { ptr, i32 } %110, 0
  store ptr %111, ptr %5, align 8
  %112 = extractvalue { ptr, i32 } %110, 1
  store i32 %112, ptr %6, align 4
  br label %113

113:                                              ; preds = %109, %96
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #3
  br label %114

114:                                              ; preds = %113, %27
  call void @llvm.lifetime.end.p0(i64 40, ptr %4) #3
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr %3) #3
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %5, align 8
  %117 = load i32, ptr %6, align 4
  %118 = insertvalue { ptr, i32 } poison, ptr %116, 0
  %119 = insertvalue { ptr, i32 } %118, i32 %117, 1
  resume { ptr, i32 } %119
}

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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, !10, i64 8}
!12 = !{!"_ZTS7Array3dI5BrickE", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !13, i64 24, !14, i64 28, !10, i64 36}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTS5Brick", !15, i64 0, !13, i64 4}
!15 = !{!"float", !7, i64 0}
!16 = !{!12, !10, i64 4}
!17 = !{!12, !10, i64 0}
!18 = !{!14, !13, i64 4}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = distinct !{!24, !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] }>

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 @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #2 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 uwtable
define dso_local void @_ZN14FluidBrickGrid16_mergeBrickGridsEv(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.0, align 8
  %4 = alloca %class.Array3d.0, align 8
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %2) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 152
  call void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %2, ptr noundef nonnull align 8 dereferenceable(40) %5)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 192
  invoke void @_ZN7Array3dI5BrickEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(40) %3, ptr noundef nonnull align 8 dereferenceable(40) %6)
          to label %.preheader39 unwind label %19

.preheader39:                                     ; preds = %1
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.preheader38.lr.ph, label %._crit_edge45

.preheader38.lr.ph:                               ; preds = %.preheader39
  %10 = getelementptr inbounds i8, ptr %2, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.preheader38, label %._crit_edge45

.preheader38:                                     ; preds = %.preheader38.lr.ph, %._crit_edge42
  %13 = phi i32 [ %24, %._crit_edge42 ], [ %8, %.preheader38.lr.ph ]
  %14 = phi i32 [ %25, %._crit_edge42 ], [ %11, %.preheader38.lr.ph ]
  %15 = phi i32 [ %26, %._crit_edge42 ], [ %11, %.preheader38.lr.ph ]
  %.02743 = phi i32 [ %27, %._crit_edge42 ], [ 0, %.preheader38.lr.ph ]
  %16 = icmp sgt i32 %15, 0
  %17 = load i32, ptr %2, align 8
  %18 = icmp sgt i32 %17, 0
  %or.cond = select i1 %16, i1 %18, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge42

._crit_edge45:                                    ; preds = %._crit_edge42, %.preheader38.lr.ph, %.preheader39
  invoke void @_ZN7Array3dI5BrickEaSERKS1_(ptr dead_on_unwind nonnull writable sret(%class.Array3d.0) align 8 %4, ptr noundef nonnull align 8 dereferenceable(40) %5, ptr noundef nonnull align 8 dereferenceable(40) %2)
          to label %52 unwind label %53

19:                                               ; preds = %1
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %56

.preheader:                                       ; preds = %.preheader38, %._crit_edge
  %21 = phi i32 [ %29, %._crit_edge ], [ %14, %.preheader38 ]
  %22 = phi i32 [ %30, %._crit_edge ], [ %17, %.preheader38 ]
  %.02841 = phi i32 [ %31, %._crit_edge ], [ 0, %.preheader38 ]
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

._crit_edge42.loopexit:                           ; preds = %._crit_edge
  %.pre48 = load i32, ptr %7, align 8, !tbaa !5
  br label %._crit_edge42

._crit_edge42:                                    ; preds = %._crit_edge42.loopexit, %.preheader38
  %24 = phi i32 [ %.pre48, %._crit_edge42.loopexit ], [ %13, %.preheader38 ]
  %25 = phi i32 [ %29, %._crit_edge42.loopexit ], [ %14, %.preheader38 ]
  %26 = phi i32 [ %29, %._crit_edge42.loopexit ], [ %15, %.preheader38 ]
  %27 = add nuw nsw i32 %.02743, 1
  %28 = icmp slt i32 %27, %24
  br i1 %28, label %.preheader38, label %._crit_edge45, !llvm.loop !15

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %29 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %21, %.preheader ]
  %30 = phi i32 [ %50, %._crit_edge.loopexit ], [ %22, %.preheader ]
  %31 = add nuw nsw i32 %.02841, 1
  %32 = icmp slt i32 %31, %29
  br i1 %32, label %.preheader, label %._crit_edge42.loopexit, !llvm.loop !18

.lr.ph:                                           ; preds = %.preheader, %.critedge
  %.02940 = phi i32 [ %49, %.critedge ], [ 0, %.preheader ]
  %33 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %2, i32 noundef %.02940, i32 noundef %.02841, i32 noundef %.02743)
          to label %34 unwind label %43

34:                                               ; preds = %.lr.ph
  %35 = and i64 %33, 4294967296
  %.not = icmp eq i64 %35, 0
  br i1 %.not, label %36, label %.critedge

36:                                               ; preds = %34
  %37 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %3, i32 noundef %.02940, i32 noundef %.02841, i32 noundef %.02743)
          to label %38 unwind label %45

38:                                               ; preds = %36
  %39 = and i64 %37, 4294967296
  %.not33 = icmp eq i64 %39, 0
  br i1 %.not33, label %.critedge, label %40

40:                                               ; preds = %38
  %41 = invoke i64 @_ZN7Array3dI5BrickEclEiii(ptr noundef nonnull align 8 dereferenceable(40) %3, i32 noundef %.02940, i32 noundef %.02841, i32 noundef %.02743)
          to label %42 unwind label %47

42:                                               ; preds = %40
  %.sroa.0.0.insert.ext = and i64 %41, 1099511627775
  invoke void @_ZN7Array3dI5BrickE3setEiiiS0_(ptr noundef nonnull align 8 dereferenceable(40) %2, i32 noundef %.02940, i32 noundef %.02841, i32 noundef %.02743, i64 %.sroa.0.0.insert.ext)
          to label %.critedge unwind label %47

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

45:                                               ; preds = %36
  %46 = landingpad { ptr, i32 }
          cleanup
  br label %55

47:                                               ; preds = %42, %40
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %55

.critedge:                                        ; preds = %34, %38, %42
  %49 = add nuw nsw i32 %.02940, 1
  %50 = load i32, ptr %2, align 8, !tbaa !19
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !20

52:                                               ; preds = %._crit_edge45
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #3
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #3
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #3
  ret void

53:                                               ; preds = %._crit_edge45
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %55

55:                                               ; preds = %47, %45, %43, %53
  %.pn34.pn = phi { ptr, i32 } [ %54, %53 ], [ %48, %47 ], [ %46, %45 ], [ %44, %43 ]
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #3
  br label %56

56:                                               ; preds = %55, %19
  %.pn34.pn.pn = phi { ptr, i32 } [ %.pn34.pn, %55 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #3
  call void @_ZN7Array3dI5BrickED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #3
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #3
  resume { ptr, i32 } %.pn34.pn.pn
}

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { 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 8}
!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 = distinct !{!15, !16, !17}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !16, !17}
!19 = !{!6, !7, i64 0}
!20 = distinct !{!20, !16}


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