; LLVM IR from Wilson-ZheLin/Introduction-to-Digital-Image-Processing :: 8. Erosion, Dilation, Opening and Closing Operations, Boundary Extraction and Connect_ec5503cd (Z15SeparateBubblesP5Image)

; 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.Image = type { i32, i32, i32, ptr, [15 x [100 x i8]], i32 }

@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1

; 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 void @_Z12SavePNMImageP5ImagePc(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15SeparateBubblesP5Image(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %19, ptr noundef @.str.9)
  store ptr %20, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %21, ptr noundef @.str.9)
  store ptr %22, ptr %7, align 8, !tbaa !5
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %23, ptr noundef @.str.9)
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Image, ptr %25, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  store ptr %27, ptr %3, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Image, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  store ptr %30, ptr %4, align 8, !tbaa !5
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.Image, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  store ptr %33, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.Image, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !12
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.Image, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !13
  %40 = mul nsw i32 %36, %39
  store i32 %40, ptr %9, align 4, !tbaa !14
  %41 = load i32, ptr %9, align 4, !tbaa !14
  %42 = zext i32 %41 to i64
  %43 = call ptr @llvm.stacksave.p0()
  store ptr %43, ptr %10, align 8
  %44 = alloca i32, i64 %42, align 16
  store i64 %42, ptr %11, align 8
  %45 = load i32, ptr %9, align 4, !tbaa !14
  %46 = zext i32 %45 to i64
  %47 = alloca i32, i64 %46, align 16
  store i64 %46, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !14
  br label %48

48:                                               ; preds = %72, %1
  %49 = load i32, ptr %13, align 4, !tbaa !14
  %50 = load i32, ptr %9, align 4, !tbaa !14
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %75

53:                                               ; preds = %48
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = load i32, ptr %13, align 4, !tbaa !14
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i8, ptr %54, i64 %56
  store i8 0, ptr %57, align 1, !tbaa !15
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load i32, ptr %13, align 4, !tbaa !14
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i8, ptr %58, i64 %60
  store i8 0, ptr %61, align 1, !tbaa !15
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load i32, ptr %13, align 4, !tbaa !14
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i8, ptr %62, i64 %64
  store i8 0, ptr %65, align 1, !tbaa !15
  %66 = load i32, ptr %13, align 4, !tbaa !14
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i32, ptr %47, i64 %67
  store i32 0, ptr %68, align 4, !tbaa !14
  %69 = load i32, ptr %13, align 4, !tbaa !14
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %44, i64 %70
  store i32 0, ptr %71, align 4, !tbaa !14
  br label %72

72:                                               ; preds = %53
  %73 = load i32, ptr %13, align 4, !tbaa !14
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %13, align 4, !tbaa !14
  br label %48, !llvm.loop !16

75:                                               ; preds = %52
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef %76, ptr noundef %47, i32 noundef 1, i32 noundef 1, i32 noundef 1)
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef %77, ptr noundef %47, i32 noundef 200, i32 noundef 781, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  store i32 7, ptr %14, align 4, !tbaa !14
  br label %78

78:                                               ; preds = %120, %75
  %79 = load i32, ptr %14, align 4, !tbaa !14
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.Image, ptr %80, i32 0, i32 1
  %82 = load i32, ptr %81, align 4, !tbaa !13
  %83 = sub nsw i32 %82, 7
  %84 = sub nsw i32 %83, 1
  %85 = icmp slt i32 %79, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %78
  store i32 5, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %123

87:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 7, ptr %16, align 4, !tbaa !14
  br label %88

88:                                               ; preds = %116, %87
  %89 = load i32, ptr %16, align 4, !tbaa !14
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.Image, ptr %90, i32 0, i32 0
  %92 = load i32, ptr %91, align 8, !tbaa !12
  %93 = sub nsw i32 %92, 7
  %94 = sub nsw i32 %93, 3
  %95 = icmp slt i32 %89, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %88
  store i32 8, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  br label %119

97:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = load i32, ptr %16, align 4, !tbaa !14
  %100 = load i32, ptr %14, align 4, !tbaa !14
  %101 = call noundef i32 @_Z3DFSP5ImagePiii(ptr noundef %98, ptr noundef %44, i32 noundef %99, i32 noundef %100)
  store i32 %101, ptr %17, align 4, !tbaa !14
  %102 = load i32, ptr %17, align 4, !tbaa !14
  %103 = icmp sgt i32 %102, 350
  br i1 %103, label %104, label %111

104:                                              ; preds = %97
  %105 = load i32, ptr %17, align 4, !tbaa !14
  %106 = icmp slt i32 %105, 450
  br i1 %106, label %107, label %111

107:                                              ; preds = %104
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = load i32, ptr %16, align 4, !tbaa !14
  %110 = load i32, ptr %14, align 4, !tbaa !14
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef %108, ptr noundef %47, i32 noundef %109, i32 noundef %110, i32 noundef 2)
  br label %115

111:                                              ; preds = %104, %97
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  %113 = load i32, ptr %16, align 4, !tbaa !14
  %114 = load i32, ptr %14, align 4, !tbaa !14
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef %112, ptr noundef %47, i32 noundef %113, i32 noundef %114, i32 noundef 3)
  br label %115

115:                                              ; preds = %111, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %16, align 4, !tbaa !14
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %16, align 4, !tbaa !14
  br label %88, !llvm.loop !18

119:                                              ; preds = %96
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %14, align 4, !tbaa !14
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %14, align 4, !tbaa !14
  br label %78, !llvm.loop !19

123:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i32 0, ptr %18, align 4, !tbaa !14
  br label %124

124:                                              ; preds = %163, %123
  %125 = load i32, ptr %18, align 4, !tbaa !14
  %126 = load i32, ptr %9, align 4, !tbaa !14
  %127 = icmp slt i32 %125, %126
  br i1 %127, label %129, label %128

128:                                              ; preds = %124
  store i32 11, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  br label %166

129:                                              ; preds = %124
  %130 = load i32, ptr %18, align 4, !tbaa !14
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i32, ptr %47, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !14
  %134 = icmp eq i32 %133, 1
  br i1 %134, label %135, label %140

135:                                              ; preds = %129
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = load i32, ptr %18, align 4, !tbaa !14
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds i8, ptr %136, i64 %138
  store i8 -1, ptr %139, align 1, !tbaa !15
  br label %140

140:                                              ; preds = %135, %129
  %141 = load i32, ptr %18, align 4, !tbaa !14
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds i32, ptr %47, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !14
  %145 = icmp eq i32 %144, 2
  br i1 %145, label %146, label %151

146:                                              ; preds = %140
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = load i32, ptr %18, align 4, !tbaa !14
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i8, ptr %147, i64 %149
  store i8 -1, ptr %150, align 1, !tbaa !15
  br label %151

151:                                              ; preds = %146, %140
  %152 = load i32, ptr %18, align 4, !tbaa !14
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds i32, ptr %47, i64 %153
  %155 = load i32, ptr %154, align 4, !tbaa !14
  %156 = icmp eq i32 %155, 3
  br i1 %156, label %157, label %162

157:                                              ; preds = %151
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = load i32, ptr %18, align 4, !tbaa !14
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds i8, ptr %158, i64 %160
  store i8 -1, ptr %161, align 1, !tbaa !15
  br label %162

162:                                              ; preds = %157, %151
  br label %163

163:                                              ; preds = %162
  %164 = load i32, ptr %18, align 4, !tbaa !14
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %18, align 4, !tbaa !14
  br label %124, !llvm.loop !20

166:                                              ; preds = %128
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %167, ptr noundef @.str.17)
  %168 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %168, ptr noundef @.str.18)
  %169 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %169, ptr noundef @.str.19)
  %170 = load ptr, ptr %10, align 8
  call void @llvm.stackrestore.p0(ptr %170)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef, ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3DFSP5ImagePiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
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, !6, i64 16}
!10 = !{!"_ZTS5Image", !11, i64 0, !11, i64 4, !11, i64 8, !6, i64 16, !7, i64 24, !11, i64 1524}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!11, !11, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}


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

@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12SavePNMImageP5ImagePc(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_Z15SeparateBubblesP5Image(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %0, ptr noundef nonnull @.str.9)
  %3 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %0, ptr noundef nonnull @.str.9)
  %4 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %0, ptr noundef nonnull @.str.9)
  %5 = getelementptr inbounds i8, ptr %2, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %3, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %4, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = load i32, ptr %0, align 8, !tbaa !11
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !12
  %14 = mul nsw i32 %13, %11
  %15 = zext i32 %14 to i64
  %16 = alloca i32, i64 %15, align 16
  %17 = alloca i32, i64 %15, align 16
  %18 = icmp sgt i32 %14, 0
  br i1 %18, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %1
  %min.iters.check = icmp ult i32 %14, 60
  br i1 %min.iters.check, label %.lr.ph.preheader123, label %vector.memcheck

.lr.ph.preheader123:                              ; preds = %middle.block, %vector.memcheck, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %15, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader123
  %19 = getelementptr inbounds i8, ptr %6, i64 %indvars.iv.ph
  store i8 0, ptr %19, align 1, !tbaa !13
  %20 = getelementptr inbounds i8, ptr %8, i64 %indvars.iv.ph
  store i8 0, ptr %20, align 1, !tbaa !13
  %21 = getelementptr inbounds i8, ptr %10, i64 %indvars.iv.ph
  store i8 0, ptr %21, align 1, !tbaa !13
  %22 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.ph
  store i32 0, ptr %22, align 16, !tbaa !14
  %23 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv.ph
  store i32 0, ptr %23, align 16, !tbaa !14
  %indvars.iv.next.prol = or disjoint i64 %indvars.iv.ph, 1
  br label %.lr.ph.prol.loopexit

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader123
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader123 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %24 = add nsw i64 %15, -1
  %25 = icmp eq i64 %indvars.iv.ph, %24
  br i1 %25, label %._crit_edge, label %.lr.ph

vector.memcheck:                                  ; preds = %.lr.ph.preheader
  %scevgep = getelementptr i8, ptr %6, i64 %15
  %scevgep79 = getelementptr i8, ptr %8, i64 %15
  %scevgep80 = getelementptr i8, ptr %10, i64 %15
  %26 = shl nuw nsw i64 %15, 2
  %scevgep81 = getelementptr i8, ptr %17, i64 %26
  %scevgep82 = getelementptr i8, ptr %16, i64 %26
  %27 = insertelement <4 x ptr> poison, ptr %6, i64 0
  %28 = shufflevector <4 x ptr> %27, <4 x ptr> poison, <4 x i32> zeroinitializer
  %29 = insertelement <4 x ptr> poison, ptr %scevgep79, i64 0
  %30 = insertelement <4 x ptr> %29, ptr %scevgep80, i64 1
  %31 = insertelement <4 x ptr> %30, ptr %scevgep81, i64 2
  %32 = insertelement <4 x ptr> %31, ptr %scevgep82, i64 3
  %33 = icmp ult <4 x ptr> %28, %32
  %34 = insertelement <4 x ptr> poison, ptr %8, i64 0
  %35 = insertelement <4 x ptr> %34, ptr %10, i64 1
  %36 = insertelement <4 x ptr> %35, ptr %17, i64 2
  %37 = insertelement <4 x ptr> %36, ptr %16, i64 3
  %38 = insertelement <4 x ptr> poison, ptr %scevgep, i64 0
  %39 = shufflevector <4 x ptr> %38, <4 x ptr> poison, <4 x i32> zeroinitializer
  %40 = icmp ult <4 x ptr> %37, %39
  %41 = and <4 x i1> %33, %40
  %bound094 = icmp ult ptr %8, %scevgep80
  %bound195 = icmp ult ptr %10, %scevgep79
  %found.conflict96 = and i1 %bound094, %bound195
  %bound098 = icmp ult ptr %8, %scevgep81
  %bound199 = icmp ult ptr %17, %scevgep79
  %found.conflict100 = and i1 %bound098, %bound199
  %bound0102 = icmp ult ptr %8, %scevgep82
  %bound1103 = icmp ult ptr %16, %scevgep79
  %found.conflict104 = and i1 %bound0102, %bound1103
  %bound0106 = icmp ult ptr %10, %scevgep81
  %bound1107 = icmp ult ptr %17, %scevgep80
  %found.conflict108 = and i1 %bound0106, %bound1107
  %bound0110 = icmp ult ptr %10, %scevgep82
  %bound1111 = icmp ult ptr %16, %scevgep80
  %found.conflict112 = and i1 %bound0110, %bound1111
  %bound0114 = icmp ult ptr %17, %scevgep82
  %bound1115 = icmp ult ptr %16, %scevgep81
  %found.conflict116 = and i1 %bound0114, %bound1115
  %42 = bitcast <4 x i1> %41 to i4
  %43 = icmp ne i4 %42, 0
  %op.rdx = or i1 %43, %found.conflict96
  %op.rdx118 = or i1 %found.conflict100, %found.conflict104
  %op.rdx119 = or i1 %found.conflict108, %found.conflict112
  %op.rdx120 = or i1 %op.rdx, %op.rdx118
  %op.rdx121 = or i1 %op.rdx119, %found.conflict116
  %op.rdx122 = or i1 %op.rdx120, %op.rdx121
  br i1 %op.rdx122, label %.lr.ph.preheader123, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %15, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %44 = getelementptr inbounds i8, ptr %6, i64 %index
  %45 = getelementptr inbounds i8, ptr %44, i64 4
  store <4 x i8> zeroinitializer, ptr %44, align 1, !tbaa !13, !alias.scope !15, !noalias !18
  store <4 x i8> zeroinitializer, ptr %45, align 1, !tbaa !13, !alias.scope !15, !noalias !18
  %46 = getelementptr inbounds i8, ptr %8, i64 %index
  %47 = getelementptr inbounds i8, ptr %46, i64 4
  store <4 x i8> zeroinitializer, ptr %46, align 1, !tbaa !13, !alias.scope !23, !noalias !24
  store <4 x i8> zeroinitializer, ptr %47, align 1, !tbaa !13, !alias.scope !23, !noalias !24
  %48 = getelementptr inbounds i8, ptr %10, i64 %index
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  store <4 x i8> zeroinitializer, ptr %48, align 1, !tbaa !13, !alias.scope !25, !noalias !26
  store <4 x i8> zeroinitializer, ptr %49, align 1, !tbaa !13, !alias.scope !25, !noalias !26
  %50 = getelementptr inbounds i32, ptr %17, i64 %index
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  store <4 x i32> zeroinitializer, ptr %50, align 16, !tbaa !14, !alias.scope !27, !noalias !28
  store <4 x i32> zeroinitializer, ptr %51, align 16, !tbaa !14, !alias.scope !27, !noalias !28
  %52 = getelementptr inbounds i32, ptr %16, i64 %index
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  store <4 x i32> zeroinitializer, ptr %52, align 16, !tbaa !14, !alias.scope !28
  store <4 x i32> zeroinitializer, ptr %53, align 16, !tbaa !14, !alias.scope !28
  %index.next = add nuw i64 %index, 8
  %54 = icmp eq i64 %index.next, %n.vec
  br i1 %54, label %middle.block, label %vector.body, !llvm.loop !29

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %15
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader123

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %1
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef nonnull %0, ptr noundef nonnull %17, i32 noundef 1, i32 noundef 1, i32 noundef 1)
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef nonnull %0, ptr noundef nonnull %17, i32 noundef 200, i32 noundef 781, i32 noundef 1)
  %55 = load i32, ptr %12, align 4, !tbaa !12
  %56 = icmp sgt i32 %55, 15
  br i1 %56, label %.preheader60.lr.ph, label %.preheader

.preheader60.lr.ph:                               ; preds = %._crit_edge
  %57 = load i32, ptr %0, align 8, !tbaa !11
  %58 = icmp sgt i32 %57, 17
  br i1 %58, label %.preheader60, label %.preheader

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %59 = getelementptr inbounds i8, ptr %6, i64 %indvars.iv
  store i8 0, ptr %59, align 1, !tbaa !13
  %60 = getelementptr inbounds i8, ptr %8, i64 %indvars.iv
  store i8 0, ptr %60, align 1, !tbaa !13
  %61 = getelementptr inbounds i8, ptr %10, i64 %indvars.iv
  store i8 0, ptr %61, align 1, !tbaa !13
  %62 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv
  store i32 0, ptr %62, align 4, !tbaa !14
  %63 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv
  store i32 0, ptr %63, align 4, !tbaa !14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %64 = getelementptr inbounds i8, ptr %6, i64 %indvars.iv.next
  store i8 0, ptr %64, align 1, !tbaa !13
  %65 = getelementptr inbounds i8, ptr %8, i64 %indvars.iv.next
  store i8 0, ptr %65, align 1, !tbaa !13
  %66 = getelementptr inbounds i8, ptr %10, i64 %indvars.iv.next
  store i8 0, ptr %66, align 1, !tbaa !13
  %67 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.next
  store i32 0, ptr %67, align 4, !tbaa !14
  %68 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv.next
  store i32 0, ptr %68, align 4, !tbaa !14
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, %15
  br i1 %exitcond.not.1, label %._crit_edge, label %.lr.ph, !llvm.loop !33

.preheader60:                                     ; preds = %.preheader60.lr.ph, %._crit_edge64
  %69 = phi i32 [ %73, %._crit_edge64 ], [ %55, %.preheader60.lr.ph ]
  %70 = phi i32 [ %74, %._crit_edge64 ], [ %57, %.preheader60.lr.ph ]
  %.05865 = phi i32 [ %75, %._crit_edge64 ], [ 7, %.preheader60.lr.ph ]
  %71 = icmp sgt i32 %70, 17
  br i1 %71, label %.lr.ph63, label %._crit_edge64

.preheader:                                       ; preds = %._crit_edge64, %.preheader60.lr.ph, %._crit_edge
  br i1 %18, label %.lr.ph67.preheader, label %._crit_edge68

.lr.ph67.preheader:                               ; preds = %.preheader
  %xtraiter124 = and i64 %15, 1
  %72 = icmp eq i32 %14, 1
  br i1 %72, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67.preheader.new

.lr.ph67.preheader.new:                           ; preds = %.lr.ph67.preheader
  %unroll_iter = and i64 %15, 2147483646
  br label %.lr.ph67

._crit_edge64.loopexit:                           ; preds = %.lr.ph63
  %.pre = load i32, ptr %12, align 4, !tbaa !12
  br label %._crit_edge64

._crit_edge64:                                    ; preds = %._crit_edge64.loopexit, %.preheader60
  %73 = phi i32 [ %.pre, %._crit_edge64.loopexit ], [ %69, %.preheader60 ]
  %74 = phi i32 [ %81, %._crit_edge64.loopexit ], [ %70, %.preheader60 ]
  %75 = add nuw nsw i32 %.05865, 1
  %76 = add nsw i32 %73, -8
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %.preheader60, label %.preheader, !llvm.loop !34

.lr.ph63:                                         ; preds = %.preheader60, %.lr.ph63
  %.05762 = phi i32 [ %80, %.lr.ph63 ], [ 7, %.preheader60 ]
  %78 = call noundef i32 @_Z3DFSP5ImagePiii(ptr noundef nonnull %0, ptr noundef nonnull %16, i32 noundef %.05762, i32 noundef %.05865)
  %79 = add i32 %78, -351
  %or.cond = icmp ult i32 %79, 99
  %. = select i1 %or.cond, i32 2, i32 3
  call void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef nonnull %0, ptr noundef nonnull %17, i32 noundef %.05762, i32 noundef %.05865, i32 noundef %.)
  %80 = add nuw nsw i32 %.05762, 1
  %81 = load i32, ptr %0, align 8, !tbaa !11
  %82 = add nsw i32 %81, -10
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %.lr.ph63, label %._crit_edge64.loopexit, !llvm.loop !36

._crit_edge68.loopexit.unr-lcssa:                 ; preds = %.thread76.1, %.lr.ph67.preheader
  %indvars.iv71.unr = phi i64 [ 0, %.lr.ph67.preheader ], [ %indvars.iv.next72.1, %.thread76.1 ]
  %lcmp.mod125.not = icmp eq i64 %xtraiter124, 0
  br i1 %lcmp.mod125.not, label %._crit_edge68, label %.lr.ph67.epil

.lr.ph67.epil:                                    ; preds = %._crit_edge68.loopexit.unr-lcssa
  %84 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv71.unr
  %85 = load i32, ptr %84, align 4, !tbaa !14
  switch i32 %85, label %._crit_edge68 [
    i32 1, label %.thread76.sink.split.epil
    i32 2, label %87
    i32 3, label %86
  ]

86:                                               ; preds = %.lr.ph67.epil
  br label %.thread76.sink.split.epil

87:                                               ; preds = %.lr.ph67.epil
  br label %.thread76.sink.split.epil

.thread76.sink.split.epil:                        ; preds = %87, %86, %.lr.ph67.epil
  %.sink78.epil = phi ptr [ %8, %87 ], [ %10, %86 ], [ %6, %.lr.ph67.epil ]
  %88 = getelementptr inbounds i8, ptr %.sink78.epil, i64 %indvars.iv71.unr
  store i8 -1, ptr %88, align 1, !tbaa !13
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %._crit_edge68.loopexit.unr-lcssa, %.thread76.sink.split.epil, %.lr.ph67.epil, %.preheader
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %2, ptr noundef nonnull @.str.17)
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %3, ptr noundef nonnull @.str.18)
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %4, ptr noundef nonnull @.str.19)
  ret void

.lr.ph67:                                         ; preds = %.thread76.1, %.lr.ph67.preheader.new
  %indvars.iv71 = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %indvars.iv.next72.1, %.thread76.1 ]
  %niter = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %niter.next.1, %.thread76.1 ]
  %89 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv71
  %90 = load i32, ptr %89, align 8, !tbaa !14
  switch i32 %90, label %.thread76 [
    i32 1, label %.thread76.sink.split
    i32 2, label %91
    i32 3, label %92
  ]

91:                                               ; preds = %.lr.ph67
  br label %.thread76.sink.split

92:                                               ; preds = %.lr.ph67
  br label %.thread76.sink.split

.thread76.sink.split:                             ; preds = %.lr.ph67, %92, %91
  %.sink78 = phi ptr [ %8, %91 ], [ %10, %92 ], [ %6, %.lr.ph67 ]
  %93 = getelementptr inbounds i8, ptr %.sink78, i64 %indvars.iv71
  store i8 -1, ptr %93, align 1, !tbaa !13
  br label %.thread76

.thread76:                                        ; preds = %.thread76.sink.split, %.lr.ph67
  %indvars.iv.next72 = or disjoint i64 %indvars.iv71, 1
  %94 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.next72
  %95 = load i32, ptr %94, align 4, !tbaa !14
  switch i32 %95, label %.thread76.1 [
    i32 1, label %.thread76.sink.split.1
    i32 2, label %97
    i32 3, label %96
  ]

96:                                               ; preds = %.thread76
  br label %.thread76.sink.split.1

97:                                               ; preds = %.thread76
  br label %.thread76.sink.split.1

.thread76.sink.split.1:                           ; preds = %97, %96, %.thread76
  %.sink78.1 = phi ptr [ %8, %97 ], [ %10, %96 ], [ %6, %.thread76 ]
  %98 = getelementptr inbounds i8, ptr %.sink78.1, i64 %indvars.iv.next72
  store i8 -1, ptr %98, align 1, !tbaa !13
  br label %.thread76.1

.thread76.1:                                      ; preds = %.thread76.sink.split.1, %.thread76
  %indvars.iv.next72.1 = add nuw nsw i64 %indvars.iv71, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67, !llvm.loop !37
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3DFSP5ImagePiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14DFS_MarkPixelsP5ImagePiiii(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

attributes #0 = { 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" }

!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, !10, i64 16}
!6 = !{!"_ZTS5Image", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !8, i64 24, !7, i64 1524}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!8, !8, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16}
!16 = distinct !{!16, !17}
!17 = distinct !{!17, !"LVerDomain"}
!18 = !{!19, !20, !21, !22}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !17}
!21 = distinct !{!21, !17}
!22 = distinct !{!22, !17}
!23 = !{!19}
!24 = !{!20, !21, !22}
!25 = !{!20}
!26 = !{!21, !22}
!27 = !{!21}
!28 = !{!22}
!29 = distinct !{!29, !30, !31, !32}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!"llvm.loop.isvectorized", i32 1}
!32 = !{!"llvm.loop.unroll.runtime.disable"}
!33 = distinct !{!33, !30, !31}
!34 = distinct !{!34, !30, !35}
!35 = !{!"llvm.loop.unswitch.partial.disable"}
!36 = distinct !{!36, !30}
!37 = distinct !{!37, !30}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass