; LLVM IR from Wilson-ZheLin/Introduction-to-Digital-Image-Processing :: 10. Otus, Moving Average, and Region Growing/src/main.ll (Z14region_growingP5Image)

; 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.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [19 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
define dso_local void @_Z14region_growingP5Image(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 i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca [256 x float], align 16
  %12 = alloca i32, align 4
  %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
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = 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 4, ptr %8) #3
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Image, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !9
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.Image, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 4, !tbaa !12
  %29 = mul nsw i32 %25, %28
  store i32 %29, ptr %8, align 4, !tbaa !13
  %30 = load i32, ptr %8, align 4, !tbaa !13
  %31 = zext i32 %30 to i64
  %32 = call ptr @llvm.stacksave.p0()
  store ptr %32, ptr %9, align 8
  %33 = alloca i32, i64 %31, align 16
  store i64 %31, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 1024, ptr %11) #3
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %34, ptr noundef @.str.6)
  store ptr %35, ptr %6, align 8, !tbaa !5
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef %36, ptr noundef @.str.6)
  store ptr %37, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.Image, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  store ptr %40, ptr %3, align 8, !tbaa !5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Image, ptr %41, i32 0, i32 3
  %43 = load ptr, ptr %42, align 8, !tbaa !14
  store ptr %43, ptr %4, align 8, !tbaa !5
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.Image, ptr %44, i32 0, i32 3
  %46 = load ptr, ptr %45, align 8, !tbaa !14
  store ptr %46, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !13
  br label %47

47:                                               ; preds = %55, %1
  %48 = load i32, ptr %12, align 4, !tbaa !13
  %49 = icmp slt i32 %48, 256
  br i1 %49, label %51, label %50

50:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %58

51:                                               ; preds = %47
  %52 = load i32, ptr %12, align 4, !tbaa !13
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %53
  store float 0.000000e+00, ptr %54, align 4, !tbaa !15
  br label %55

55:                                               ; preds = %51
  %56 = load i32, ptr %12, align 4, !tbaa !13
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %12, align 4, !tbaa !13
  br label %47, !llvm.loop !17

58:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  store i32 0, ptr %13, align 4, !tbaa !13
  br label %59

59:                                               ; preds = %76, %58
  %60 = load i32, ptr %13, align 4, !tbaa !13
  %61 = load i32, ptr %8, align 4, !tbaa !13
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = load i32, ptr %13, align 4, !tbaa !13
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i8, ptr %65, i64 %67
  %69 = load i8, ptr %68, align 1, !tbaa !19
  %70 = zext i8 %69 to i32
  store i32 %70, ptr %14, align 4, !tbaa !13
  %71 = load i32, ptr %14, align 4, !tbaa !13
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %72
  %74 = load float, ptr %73, align 4, !tbaa !15
  %75 = fadd float %74, 1.000000e+00
  store float %75, ptr %73, align 4, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %76

76:                                               ; preds = %64
  %77 = load i32, ptr %13, align 4, !tbaa !13
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %13, align 4, !tbaa !13
  br label %59, !llvm.loop !20

79:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 256, ptr %15, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  store i32 0, ptr %16, align 4, !tbaa !13
  br label %80

80:                                               ; preds = %88, %79
  %81 = load i32, ptr %16, align 4, !tbaa !13
  %82 = sitofp i32 %81 to double
  %83 = load i32, ptr %8, align 4, !tbaa !13
  %84 = sitofp i32 %83 to float
  %85 = fpext float %84 to double
  %86 = fmul double %85, 4.000000e-03
  %87 = fcmp olt double %82, %86
  br i1 %87, label %88, label %99

88:                                               ; preds = %80
  %89 = load i32, ptr %15, align 4, !tbaa !13
  %90 = add nsw i32 %89, -1
  store i32 %90, ptr %15, align 4, !tbaa !13
  %91 = load i32, ptr %15, align 4, !tbaa !13
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [256 x float], ptr %11, i64 0, i64 %92
  %94 = load float, ptr %93, align 4, !tbaa !15
  %95 = load i32, ptr %16, align 4, !tbaa !13
  %96 = sitofp i32 %95 to float
  %97 = fadd float %96, %94
  %98 = fptosi float %97 to i32
  store i32 %98, ptr %16, align 4, !tbaa !13
  br label %80, !llvm.loop !21

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

100:                                              ; preds = %125, %99
  %101 = load i32, ptr %17, align 4, !tbaa !13
  %102 = load i32, ptr %8, align 4, !tbaa !13
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %128

105:                                              ; preds = %100
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = load i32, ptr %17, align 4, !tbaa !13
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i8, ptr %106, i64 %108
  %110 = load i8, ptr %109, align 1, !tbaa !19
  %111 = zext i8 %110 to i32
  %112 = load i32, ptr %15, align 4, !tbaa !13
  %113 = icmp sge i32 %111, %112
  br i1 %113, label %114, label %119

114:                                              ; preds = %105
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = load i32, ptr %17, align 4, !tbaa !13
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds i8, ptr %115, i64 %117
  store i8 -1, ptr %118, align 1, !tbaa !19
  br label %124

119:                                              ; preds = %105
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = load i32, ptr %17, align 4, !tbaa !13
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i8, ptr %120, i64 %122
  store i8 0, ptr %123, align 1, !tbaa !19
  br label %124

124:                                              ; preds = %119, %114
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %17, align 4, !tbaa !13
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %17, align 4, !tbaa !13
  br label %100, !llvm.loop !22

128:                                              ; preds = %104
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %129, ptr noundef @.str.7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i32 0, ptr %18, align 4, !tbaa !13
  br label %130

130:                                              ; preds = %152, %128
  %131 = load i32, ptr %18, align 4, !tbaa !13
  %132 = load i32, ptr %8, align 4, !tbaa !13
  %133 = icmp slt i32 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  br label %155

135:                                              ; preds = %130
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = load i32, ptr %18, align 4, !tbaa !13
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds i8, ptr %136, i64 %138
  %140 = load i8, ptr %139, align 1, !tbaa !19
  %141 = zext i8 %140 to i32
  %142 = icmp eq i32 %141, 255
  br i1 %142, label %143, label %147

143:                                              ; preds = %135
  %144 = load i32, ptr %18, align 4, !tbaa !13
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i32, ptr %33, i64 %145
  store i32 1, ptr %146, align 4, !tbaa !13
  br label %151

147:                                              ; preds = %135
  %148 = load i32, ptr %18, align 4, !tbaa !13
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i32, ptr %33, i64 %149
  store i32 2, ptr %150, align 4, !tbaa !13
  br label %151

151:                                              ; preds = %147, %143
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %18, align 4, !tbaa !13
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %18, align 4, !tbaa !13
  br label %130, !llvm.loop !23

155:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  store i32 0, ptr %19, align 4, !tbaa !13
  br label %156

156:                                              ; preds = %179, %155
  %157 = load i32, ptr %19, align 4, !tbaa !13
  %158 = load ptr, ptr %2, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.Image, ptr %158, i32 0, i32 1
  %160 = load i32, ptr %159, align 4, !tbaa !12
  %161 = icmp slt i32 %157, %160
  br i1 %161, label %163, label %162

162:                                              ; preds = %156
  store i32 16, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  br label %182

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

164:                                              ; preds = %175, %163
  %165 = load i32, ptr %21, align 4, !tbaa !13
  %166 = load ptr, ptr %2, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.Image, ptr %166, i32 0, i32 0
  %168 = load i32, ptr %167, align 8, !tbaa !9
  %169 = icmp slt i32 %165, %168
  br i1 %169, label %171, label %170

170:                                              ; preds = %164
  store i32 19, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  br label %178

171:                                              ; preds = %164
  %172 = load ptr, ptr %2, align 8, !tbaa !5
  %173 = load i32, ptr %21, align 4, !tbaa !13
  %174 = load i32, ptr %19, align 4, !tbaa !13
  call void @_Z14DFS_MarkPixelsP5ImagePiii(ptr noundef %172, ptr noundef %33, i32 noundef %173, i32 noundef %174)
  br label %175

175:                                              ; preds = %171
  %176 = load i32, ptr %21, align 4, !tbaa !13
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %21, align 4, !tbaa !13
  br label %164, !llvm.loop !24

178:                                              ; preds = %170
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %19, align 4, !tbaa !13
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %19, align 4, !tbaa !13
  br label %156, !llvm.loop !25

182:                                              ; preds = %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  store i32 0, ptr %22, align 4, !tbaa !13
  br label %183

183:                                              ; preds = %205, %182
  %184 = load i32, ptr %22, align 4, !tbaa !13
  %185 = load i32, ptr %8, align 4, !tbaa !13
  %186 = icmp slt i32 %184, %185
  br i1 %186, label %188, label %187

187:                                              ; preds = %183
  store i32 22, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  br label %208

188:                                              ; preds = %183
  %189 = load i32, ptr %22, align 4, !tbaa !13
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds i32, ptr %33, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !13
  %193 = icmp eq i32 %192, 3
  br i1 %193, label %194, label %199

194:                                              ; preds = %188
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = load i32, ptr %22, align 4, !tbaa !13
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds i8, ptr %195, i64 %197
  store i8 -1, ptr %198, align 1, !tbaa !19
  br label %204

199:                                              ; preds = %188
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = load i32, ptr %22, align 4, !tbaa !13
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds i8, ptr %200, i64 %202
  store i8 0, ptr %203, align 1, !tbaa !19
  br label %204

204:                                              ; preds = %199, %194
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %22, align 4, !tbaa !13
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %22, align 4, !tbaa !13
  br label %183, !llvm.loop !26

208:                                              ; preds = %187
  %209 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %209, ptr noundef @.str.8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 1024, ptr %11) #3
  %210 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %210)
  call void @llvm.lifetime.end.p0(i64 4, 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

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

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

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

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


; 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.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [19 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z14region_growingP5Image(ptr noundef %0) local_unnamed_addr #1 {
.preheader71:
  %1 = alloca [256 x float], align 16
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 4
  %4 = load i32, ptr %3, align 4, !tbaa !11
  %5 = mul i32 %4, %2
  %6 = zext i32 %5 to i64
  %7 = alloca i32, i64 %6, align 16
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %1) #3
  %8 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef nonnull %0, ptr noundef nonnull @.str.6)
  %9 = tail call noundef ptr @_Z14CreateNewImageP5ImagePc(ptr noundef nonnull %0, ptr noundef nonnull @.str.6)
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = ptrtoint ptr %11 to i64
  %13 = getelementptr inbounds i8, ptr %8, i64 16
  %14 = load ptr, ptr %13, align 8, !tbaa !12
  %15 = ptrtoint ptr %14 to i64
  %16 = getelementptr inbounds i8, ptr %9, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1024) %1, i8 0, i64 1024, i1 false), !tbaa !13
  %18 = icmp sgt i32 %5, 0
  br i1 %18, label %.lr.ph.preheader, label %.preheader70

.lr.ph.preheader:                                 ; preds = %.preheader71
  %xtraiter = and i64 %6, 3
  %19 = icmp ult i32 %5, 4
  br i1 %19, label %.preheader70.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %6, 2147483644
  br label %.lr.ph

.preheader70.loopexit.unr-lcssa:                  ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.3, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader70, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader70.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %.preheader70.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph.epil ], [ 0, %.preheader70.loopexit.unr-lcssa ]
  %20 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.epil
  %21 = load i8, ptr %20, align 1, !tbaa !15
  %22 = zext i8 %21 to i64
  %23 = getelementptr inbounds [256 x float], ptr %1, i64 0, i64 %22
  %24 = load float, ptr %23, align 4, !tbaa !13
  %25 = fadd float %24, 1.000000e+00
  store float %25, ptr %23, align 4, !tbaa !13
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader70, label %.lr.ph.epil, !llvm.loop !16

.preheader70:                                     ; preds = %.preheader70.loopexit.unr-lcssa, %.lr.ph.epil, %.preheader71
  %26 = sitofp i32 %5 to float
  %27 = fpext float %26 to double
  %28 = fmul double %27, 4.000000e-03
  %29 = fcmp ogt double %28, 0.000000e+00
  br i1 %29, label %.lr.ph76, label %.preheader69

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.3, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.3, %.lr.ph ]
  %30 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv
  %31 = load i8, ptr %30, align 1, !tbaa !15
  %32 = zext i8 %31 to i64
  %33 = getelementptr inbounds [256 x float], ptr %1, i64 0, i64 %32
  %34 = load float, ptr %33, align 4, !tbaa !13
  %35 = fadd float %34, 1.000000e+00
  store float %35, ptr %33, align 4, !tbaa !13
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %36 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.next
  %37 = load i8, ptr %36, align 1, !tbaa !15
  %38 = zext i8 %37 to i64
  %39 = getelementptr inbounds [256 x float], ptr %1, i64 0, i64 %38
  %40 = load float, ptr %39, align 4, !tbaa !13
  %41 = fadd float %40, 1.000000e+00
  store float %41, ptr %39, align 4, !tbaa !13
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %42 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.next.1
  %43 = load i8, ptr %42, align 1, !tbaa !15
  %44 = zext i8 %43 to i64
  %45 = getelementptr inbounds [256 x float], ptr %1, i64 0, i64 %44
  %46 = load float, ptr %45, align 4, !tbaa !13
  %47 = fadd float %46, 1.000000e+00
  store float %47, ptr %45, align 4, !tbaa !13
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %48 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.next.2
  %49 = load i8, ptr %48, align 1, !tbaa !15
  %50 = zext i8 %49 to i64
  %51 = getelementptr inbounds [256 x float], ptr %1, i64 0, i64 %50
  %52 = load float, ptr %51, align 4, !tbaa !13
  %53 = fadd float %52, 1.000000e+00
  store float %53, ptr %51, align 4, !tbaa !13
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader70.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !18

.preheader69.loopexit:                            ; preds = %.lr.ph76
  %54 = trunc nsw i64 %indvars.iv.next93 to i32
  br label %.preheader69

.preheader69:                                     ; preds = %.preheader69.loopexit, %.preheader70
  %.063.lcssa = phi i32 [ 256, %.preheader70 ], [ %54, %.preheader69.loopexit ]
  br i1 %18, label %iter.check, label %._crit_edge.thread

iter.check:                                       ; preds = %.preheader69
  %min.iters.check = icmp ult i32 %5, 8
  %55 = sub i64 %15, %12
  %diff.check = icmp ult i64 %55, 16
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %.lr.ph78.preheader, label %vector.main.loop.iter.check

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check114 = icmp ult i32 %5, 16
  br i1 %min.iters.check114, label %vec.epilog.ph, label %vector.ph

vector.ph:                                        ; preds = %vector.main.loop.iter.check
  %n.vec = and i64 %6, 2147483632
  %broadcast.splatinsert = insertelement <16 x i32> poison, i32 %.063.lcssa, i64 0
  %broadcast.splat = shufflevector <16 x i32> %broadcast.splatinsert, <16 x i32> poison, <16 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %56 = getelementptr inbounds i8, ptr %11, i64 %index
  %wide.load = load <16 x i8>, ptr %56, align 1, !tbaa !15
  %57 = zext <16 x i8> %wide.load to <16 x i32>
  %58 = icmp sle <16 x i32> %broadcast.splat, %57
  %59 = sext <16 x i1> %58 to <16 x i8>
  %60 = getelementptr inbounds i8, ptr %14, i64 %index
  store <16 x i8> %59, ptr %60, align 1
  %index.next = add nuw i64 %index, 16
  %61 = icmp eq i64 %index.next, %n.vec
  br i1 %61, label %middle.block, label %vector.body, !llvm.loop !20

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %6
  br i1 %cmp.n, label %._crit_edge, label %vec.epilog.iter.check

vec.epilog.iter.check:                            ; preds = %middle.block
  %n.vec.remaining = and i64 %6, 8
  %min.epilog.iters.check.not.not = icmp eq i64 %n.vec.remaining, 0
  br i1 %min.epilog.iters.check.not.not, label %.lr.ph78.preheader, label %vec.epilog.ph

.lr.ph78.preheader:                               ; preds = %vec.epilog.middle.block, %iter.check, %vec.epilog.iter.check
  %indvars.iv95.ph = phi i64 [ 0, %iter.check ], [ %n.vec, %vec.epilog.iter.check ], [ %n.vec116, %vec.epilog.middle.block ]
  %xtraiter158 = and i64 %6, 3
  %lcmp.mod159.not = icmp eq i64 %xtraiter158, 0
  br i1 %lcmp.mod159.not, label %.lr.ph78.prol.loopexit, label %.lr.ph78.prol

.lr.ph78.prol:                                    ; preds = %.lr.ph78.preheader, %.lr.ph78.prol
  %indvars.iv95.prol = phi i64 [ %indvars.iv.next96.prol, %.lr.ph78.prol ], [ %indvars.iv95.ph, %.lr.ph78.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph78.prol ], [ 0, %.lr.ph78.preheader ]
  %62 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv95.prol
  %63 = load i8, ptr %62, align 1, !tbaa !15
  %64 = zext i8 %63 to i32
  %.not.prol = icmp sle i32 %.063.lcssa, %64
  %spec.select.prol = sext i1 %.not.prol to i8
  %65 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv95.prol
  store i8 %spec.select.prol, ptr %65, align 1
  %indvars.iv.next96.prol = add nuw nsw i64 %indvars.iv95.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter158
  br i1 %prol.iter.cmp.not, label %.lr.ph78.prol.loopexit, label %.lr.ph78.prol, !llvm.loop !23

.lr.ph78.prol.loopexit:                           ; preds = %.lr.ph78.prol, %.lr.ph78.preheader
  %indvars.iv95.unr = phi i64 [ %indvars.iv95.ph, %.lr.ph78.preheader ], [ %indvars.iv.next96.prol, %.lr.ph78.prol ]
  %66 = sub nsw i64 %indvars.iv95.ph, %6
  %67 = icmp ugt i64 %66, -4
  br i1 %67, label %._crit_edge, label %.lr.ph78

vec.epilog.ph:                                    ; preds = %vector.main.loop.iter.check, %vec.epilog.iter.check
  %vec.epilog.resume.val = phi i64 [ %n.vec, %vec.epilog.iter.check ], [ 0, %vector.main.loop.iter.check ]
  %n.vec116 = and i64 %6, 2147483640
  %broadcast.splatinsert119 = insertelement <8 x i32> poison, i32 %.063.lcssa, i64 0
  %broadcast.splat120 = shufflevector <8 x i32> %broadcast.splatinsert119, <8 x i32> poison, <8 x i32> zeroinitializer
  br label %vec.epilog.vector.body

vec.epilog.vector.body:                           ; preds = %vec.epilog.vector.body, %vec.epilog.ph
  %index117 = phi i64 [ %vec.epilog.resume.val, %vec.epilog.ph ], [ %index.next121, %vec.epilog.vector.body ]
  %68 = getelementptr inbounds i8, ptr %11, i64 %index117
  %wide.load118 = load <8 x i8>, ptr %68, align 1, !tbaa !15
  %69 = zext <8 x i8> %wide.load118 to <8 x i32>
  %70 = icmp sle <8 x i32> %broadcast.splat120, %69
  %71 = sext <8 x i1> %70 to <8 x i8>
  %72 = getelementptr inbounds i8, ptr %14, i64 %index117
  store <8 x i8> %71, ptr %72, align 1
  %index.next121 = add nuw i64 %index117, 8
  %73 = icmp eq i64 %index.next121, %n.vec116
  br i1 %73, label %vec.epilog.middle.block, label %vec.epilog.vector.body, !llvm.loop !24

vec.epilog.middle.block:                          ; preds = %vec.epilog.vector.body
  %cmp.n122 = icmp eq i64 %n.vec116, %6
  br i1 %cmp.n122, label %._crit_edge, label %.lr.ph78.preheader

._crit_edge.thread:                               ; preds = %.preheader69
  tail call void @_Z12SavePNMImageP5ImagePc(ptr noundef %8, ptr noundef nonnull @.str.7)
  br label %.preheader68

.lr.ph76:                                         ; preds = %.preheader70, %.lr.ph76
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %.lr.ph76 ], [ 256, %.preheader70 ]
  %.06275 = phi i32 [ %78, %.lr.ph76 ], [ 0, %.preheader70 ]
  %indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
  %74 = getelementptr inbounds [256 x float], ptr %1, i64 0, i64 %indvars.iv.next93
  %75 = load float, ptr %74, align 4, !tbaa !13
  %76 = sitofp i32 %.06275 to float
  %77 = fadd float %75, %76
  %78 = fptosi float %77 to i32
  %79 = sitofp i32 %78 to double
  %80 = fcmp ogt double %28, %79
  br i1 %80, label %.lr.ph76, label %.preheader69.loopexit, !llvm.loop !25

._crit_edge:                                      ; preds = %.lr.ph78.prol.loopexit, %.lr.ph78, %vec.epilog.middle.block, %middle.block
  tail call void @_Z12SavePNMImageP5ImagePc(ptr noundef %8, ptr noundef nonnull @.str.7)
  br i1 %18, label %.lr.ph81.preheader, label %.preheader68

.lr.ph81.preheader:                               ; preds = %._crit_edge
  %min.iters.check126 = icmp ult i32 %5, 8
  br i1 %min.iters.check126, label %.lr.ph81.preheader157, label %vector.memcheck123

.lr.ph81.preheader157:                            ; preds = %middle.block125, %vector.memcheck123, %.lr.ph81.preheader
  %indvars.iv100.ph = phi i64 [ 0, %vector.memcheck123 ], [ 0, %.lr.ph81.preheader ], [ %n.vec129, %middle.block125 ]
  %xtraiter160 = and i64 %6, 3
  %lcmp.mod161.not = icmp eq i64 %xtraiter160, 0
  br i1 %lcmp.mod161.not, label %.lr.ph81.prol.loopexit, label %.lr.ph81.prol

.lr.ph81.prol:                                    ; preds = %.lr.ph81.preheader157, %.lr.ph81.prol
  %indvars.iv100.prol = phi i64 [ %indvars.iv.next101.prol, %.lr.ph81.prol ], [ %indvars.iv100.ph, %.lr.ph81.preheader157 ]
  %prol.iter162 = phi i64 [ %prol.iter162.next, %.lr.ph81.prol ], [ 0, %.lr.ph81.preheader157 ]
  %81 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv100.prol
  %82 = load i8, ptr %81, align 1, !tbaa !15
  %83 = icmp eq i8 %82, -1
  %spec.select112.prol = select i1 %83, i32 1, i32 2
  %84 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv100.prol
  store i32 %spec.select112.prol, ptr %84, align 4
  %indvars.iv.next101.prol = add nuw nsw i64 %indvars.iv100.prol, 1
  %prol.iter162.next = add i64 %prol.iter162, 1
  %prol.iter162.cmp.not = icmp eq i64 %prol.iter162.next, %xtraiter160
  br i1 %prol.iter162.cmp.not, label %.lr.ph81.prol.loopexit, label %.lr.ph81.prol, !llvm.loop !26

.lr.ph81.prol.loopexit:                           ; preds = %.lr.ph81.prol, %.lr.ph81.preheader157
  %indvars.iv100.unr = phi i64 [ %indvars.iv100.ph, %.lr.ph81.preheader157 ], [ %indvars.iv.next101.prol, %.lr.ph81.prol ]
  %85 = sub nsw i64 %indvars.iv100.ph, %6
  %86 = icmp ugt i64 %85, -4
  br i1 %86, label %.preheader68, label %.lr.ph81

vector.memcheck123:                               ; preds = %.lr.ph81.preheader
  %87 = shl nuw nsw i64 %6, 2
  %scevgep = getelementptr i8, ptr %7, i64 %87
  %scevgep124 = getelementptr i8, ptr %14, i64 %6
  %bound0 = icmp ult ptr %7, %scevgep124
  %bound1 = icmp ult ptr %14, %scevgep
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph81.preheader157, label %vector.ph127

vector.ph127:                                     ; preds = %vector.memcheck123
  %n.vec129 = and i64 %6, 2147483640
  br label %vector.body131

vector.body131:                                   ; preds = %vector.body131, %vector.ph127
  %index132 = phi i64 [ 0, %vector.ph127 ], [ %index.next135, %vector.body131 ]
  %88 = getelementptr inbounds i8, ptr %14, i64 %index132
  %89 = getelementptr inbounds i8, ptr %88, i64 4
  %wide.load133 = load <4 x i8>, ptr %88, align 1, !tbaa !15, !alias.scope !27
  %wide.load134 = load <4 x i8>, ptr %89, align 1, !tbaa !15, !alias.scope !27
  %90 = icmp eq <4 x i8> %wide.load133, <i8 -1, i8 -1, i8 -1, i8 -1>
  %91 = icmp eq <4 x i8> %wide.load134, <i8 -1, i8 -1, i8 -1, i8 -1>
  %92 = select <4 x i1> %90, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
  %93 = select <4 x i1> %91, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
  %94 = getelementptr inbounds i32, ptr %7, i64 %index132
  %95 = getelementptr inbounds i8, ptr %94, i64 16
  store <4 x i32> %92, ptr %94, align 16, !alias.scope !30, !noalias !27
  store <4 x i32> %93, ptr %95, align 16, !alias.scope !30, !noalias !27
  %index.next135 = add nuw i64 %index132, 8
  %96 = icmp eq i64 %index.next135, %n.vec129
  br i1 %96, label %middle.block125, label %vector.body131, !llvm.loop !32

middle.block125:                                  ; preds = %vector.body131
  %cmp.n136 = icmp eq i64 %n.vec129, %6
  br i1 %cmp.n136, label %.preheader68, label %.lr.ph81.preheader157

.lr.ph78:                                         ; preds = %.lr.ph78.prol.loopexit, %.lr.ph78
  %indvars.iv95 = phi i64 [ %indvars.iv.next96.3, %.lr.ph78 ], [ %indvars.iv95.unr, %.lr.ph78.prol.loopexit ]
  %97 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv95
  %98 = load i8, ptr %97, align 1, !tbaa !15
  %99 = zext i8 %98 to i32
  %.not = icmp sle i32 %.063.lcssa, %99
  %spec.select = sext i1 %.not to i8
  %100 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv95
  store i8 %spec.select, ptr %100, align 1
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %101 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.next96
  %102 = load i8, ptr %101, align 1, !tbaa !15
  %103 = zext i8 %102 to i32
  %.not.1 = icmp sle i32 %.063.lcssa, %103
  %spec.select.1 = sext i1 %.not.1 to i8
  %104 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next96
  store i8 %spec.select.1, ptr %104, align 1
  %indvars.iv.next96.1 = add nuw nsw i64 %indvars.iv95, 2
  %105 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.next96.1
  %106 = load i8, ptr %105, align 1, !tbaa !15
  %107 = zext i8 %106 to i32
  %.not.2 = icmp sle i32 %.063.lcssa, %107
  %spec.select.2 = sext i1 %.not.2 to i8
  %108 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next96.1
  store i8 %spec.select.2, ptr %108, align 1
  %indvars.iv.next96.2 = add nuw nsw i64 %indvars.iv95, 3
  %109 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv.next96.2
  %110 = load i8, ptr %109, align 1, !tbaa !15
  %111 = zext i8 %110 to i32
  %.not.3 = icmp sle i32 %.063.lcssa, %111
  %spec.select.3 = sext i1 %.not.3 to i8
  %112 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next96.2
  store i8 %spec.select.3, ptr %112, align 1
  %indvars.iv.next96.3 = add nuw nsw i64 %indvars.iv95, 4
  %exitcond99.not.3 = icmp eq i64 %indvars.iv.next96.3, %6
  br i1 %exitcond99.not.3, label %._crit_edge, label %.lr.ph78, !llvm.loop !33

.preheader68:                                     ; preds = %.lr.ph81.prol.loopexit, %.lr.ph81, %middle.block125, %._crit_edge.thread, %._crit_edge
  %113 = load i32, ptr %3, align 4, !tbaa !11
  %114 = icmp sgt i32 %113, 0
  br i1 %114, label %.preheader67.lr.ph, label %.preheader

.preheader67.lr.ph:                               ; preds = %.preheader68
  %115 = load i32, ptr %0, align 8, !tbaa !5
  %116 = icmp sgt i32 %115, 0
  br i1 %116, label %.preheader67, label %.preheader

.lr.ph81:                                         ; preds = %.lr.ph81.prol.loopexit, %.lr.ph81
  %indvars.iv100 = phi i64 [ %indvars.iv.next101.3, %.lr.ph81 ], [ %indvars.iv100.unr, %.lr.ph81.prol.loopexit ]
  %117 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv100
  %118 = load i8, ptr %117, align 1, !tbaa !15
  %119 = icmp eq i8 %118, -1
  %spec.select112 = select i1 %119, i32 1, i32 2
  %120 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv100
  store i32 %spec.select112, ptr %120, align 4
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %121 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next101
  %122 = load i8, ptr %121, align 1, !tbaa !15
  %123 = icmp eq i8 %122, -1
  %spec.select112.1 = select i1 %123, i32 1, i32 2
  %124 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv.next101
  store i32 %spec.select112.1, ptr %124, align 4
  %indvars.iv.next101.1 = add nuw nsw i64 %indvars.iv100, 2
  %125 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next101.1
  %126 = load i8, ptr %125, align 1, !tbaa !15
  %127 = icmp eq i8 %126, -1
  %spec.select112.2 = select i1 %127, i32 1, i32 2
  %128 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv.next101.1
  store i32 %spec.select112.2, ptr %128, align 4
  %indvars.iv.next101.2 = add nuw nsw i64 %indvars.iv100, 3
  %129 = getelementptr inbounds i8, ptr %14, i64 %indvars.iv.next101.2
  %130 = load i8, ptr %129, align 1, !tbaa !15
  %131 = icmp eq i8 %130, -1
  %spec.select112.3 = select i1 %131, i32 1, i32 2
  %132 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv.next101.2
  store i32 %spec.select112.3, ptr %132, align 4
  %indvars.iv.next101.3 = add nuw nsw i64 %indvars.iv100, 4
  %exitcond104.not.3 = icmp eq i64 %indvars.iv.next101.3, %6
  br i1 %exitcond104.not.3, label %.preheader68, label %.lr.ph81, !llvm.loop !34

.preheader67:                                     ; preds = %.preheader67.lr.ph, %._crit_edge84
  %133 = phi i32 [ %152, %._crit_edge84 ], [ %113, %.preheader67.lr.ph ]
  %134 = phi i32 [ %153, %._crit_edge84 ], [ %115, %.preheader67.lr.ph ]
  %.05985 = phi i32 [ %154, %._crit_edge84 ], [ 0, %.preheader67.lr.ph ]
  %135 = icmp sgt i32 %134, 0
  br i1 %135, label %.lr.ph83, label %._crit_edge84

.preheader:                                       ; preds = %._crit_edge84, %.preheader67.lr.ph, %.preheader68
  br i1 %18, label %.lr.ph87.preheader, label %._crit_edge88

.lr.ph87.preheader:                               ; preds = %.preheader
  %min.iters.check145 = icmp ult i32 %5, 8
  br i1 %min.iters.check145, label %.lr.ph87.preheader156, label %vector.memcheck137

.lr.ph87.preheader156:                            ; preds = %middle.block143, %vector.memcheck137, %.lr.ph87.preheader
  %indvars.iv105.ph = phi i64 [ 0, %vector.memcheck137 ], [ 0, %.lr.ph87.preheader ], [ %n.vec148, %middle.block143 ]
  %xtraiter163 = and i64 %6, 3
  %lcmp.mod164.not = icmp eq i64 %xtraiter163, 0
  br i1 %lcmp.mod164.not, label %.lr.ph87.prol.loopexit, label %.lr.ph87.prol

.lr.ph87.prol:                                    ; preds = %.lr.ph87.preheader156, %.lr.ph87.prol
  %indvars.iv105.prol = phi i64 [ %indvars.iv.next106.prol, %.lr.ph87.prol ], [ %indvars.iv105.ph, %.lr.ph87.preheader156 ]
  %prol.iter165 = phi i64 [ %prol.iter165.next, %.lr.ph87.prol ], [ 0, %.lr.ph87.preheader156 ]
  %136 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv105.prol
  %137 = load i32, ptr %136, align 4, !tbaa !35
  %138 = icmp eq i32 %137, 3
  %spec.select113.prol = sext i1 %138 to i8
  %139 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv105.prol
  store i8 %spec.select113.prol, ptr %139, align 1
  %indvars.iv.next106.prol = add nuw nsw i64 %indvars.iv105.prol, 1
  %prol.iter165.next = add i64 %prol.iter165, 1
  %prol.iter165.cmp.not = icmp eq i64 %prol.iter165.next, %xtraiter163
  br i1 %prol.iter165.cmp.not, label %.lr.ph87.prol.loopexit, label %.lr.ph87.prol, !llvm.loop !36

.lr.ph87.prol.loopexit:                           ; preds = %.lr.ph87.prol, %.lr.ph87.preheader156
  %indvars.iv105.unr = phi i64 [ %indvars.iv105.ph, %.lr.ph87.preheader156 ], [ %indvars.iv.next106.prol, %.lr.ph87.prol ]
  %140 = sub nsw i64 %indvars.iv105.ph, %6
  %141 = icmp ugt i64 %140, -4
  br i1 %141, label %._crit_edge88, label %.lr.ph87

vector.memcheck137:                               ; preds = %.lr.ph87.preheader
  %scevgep138 = getelementptr i8, ptr %17, i64 %6
  %142 = shl nuw nsw i64 %6, 2
  %scevgep139 = getelementptr i8, ptr %7, i64 %142
  %bound0140 = icmp ult ptr %17, %scevgep139
  %bound1141 = icmp ult ptr %7, %scevgep138
  %found.conflict142 = and i1 %bound0140, %bound1141
  br i1 %found.conflict142, label %.lr.ph87.preheader156, label %vector.ph146

vector.ph146:                                     ; preds = %vector.memcheck137
  %n.vec148 = and i64 %6, 2147483640
  br label %vector.body150

vector.body150:                                   ; preds = %vector.body150, %vector.ph146
  %index151 = phi i64 [ 0, %vector.ph146 ], [ %index.next154, %vector.body150 ]
  %143 = getelementptr inbounds i32, ptr %7, i64 %index151
  %144 = getelementptr inbounds i8, ptr %143, i64 16
  %wide.load152 = load <4 x i32>, ptr %143, align 16, !tbaa !35, !alias.scope !37
  %wide.load153 = load <4 x i32>, ptr %144, align 16, !tbaa !35, !alias.scope !37
  %145 = icmp eq <4 x i32> %wide.load152, <i32 3, i32 3, i32 3, i32 3>
  %146 = icmp eq <4 x i32> %wide.load153, <i32 3, i32 3, i32 3, i32 3>
  %147 = sext <4 x i1> %145 to <4 x i8>
  %148 = sext <4 x i1> %146 to <4 x i8>
  %149 = getelementptr inbounds i8, ptr %17, i64 %index151
  %150 = getelementptr inbounds i8, ptr %149, i64 4
  store <4 x i8> %147, ptr %149, align 1, !alias.scope !40, !noalias !37
  store <4 x i8> %148, ptr %150, align 1, !alias.scope !40, !noalias !37
  %index.next154 = add nuw i64 %index151, 8
  %151 = icmp eq i64 %index.next154, %n.vec148
  br i1 %151, label %middle.block143, label %vector.body150, !llvm.loop !42

middle.block143:                                  ; preds = %vector.body150
  %cmp.n155 = icmp eq i64 %n.vec148, %6
  br i1 %cmp.n155, label %._crit_edge88, label %.lr.ph87.preheader156

._crit_edge84.loopexit:                           ; preds = %.lr.ph83
  %.pre = load i32, ptr %3, align 4, !tbaa !11
  br label %._crit_edge84

._crit_edge84:                                    ; preds = %._crit_edge84.loopexit, %.preheader67
  %152 = phi i32 [ %.pre, %._crit_edge84.loopexit ], [ %133, %.preheader67 ]
  %153 = phi i32 [ %157, %._crit_edge84.loopexit ], [ %134, %.preheader67 ]
  %154 = add nuw nsw i32 %.05985, 1
  %155 = icmp slt i32 %154, %152
  br i1 %155, label %.preheader67, label %.preheader, !llvm.loop !43

.lr.ph83:                                         ; preds = %.preheader67, %.lr.ph83
  %.05882 = phi i32 [ %156, %.lr.ph83 ], [ 0, %.preheader67 ]
  call void @_Z14DFS_MarkPixelsP5ImagePiii(ptr noundef nonnull %0, ptr noundef nonnull %7, i32 noundef %.05882, i32 noundef %.05985)
  %156 = add nuw nsw i32 %.05882, 1
  %157 = load i32, ptr %0, align 8, !tbaa !5
  %158 = icmp slt i32 %156, %157
  br i1 %158, label %.lr.ph83, label %._crit_edge84.loopexit, !llvm.loop !45

._crit_edge88:                                    ; preds = %.lr.ph87.prol.loopexit, %.lr.ph87, %middle.block143, %.preheader
  call void @_Z12SavePNMImageP5ImagePc(ptr noundef %9, ptr noundef nonnull @.str.8)
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %1) #3
  ret void

.lr.ph87:                                         ; preds = %.lr.ph87.prol.loopexit, %.lr.ph87
  %indvars.iv105 = phi i64 [ %indvars.iv.next106.3, %.lr.ph87 ], [ %indvars.iv105.unr, %.lr.ph87.prol.loopexit ]
  %159 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv105
  %160 = load i32, ptr %159, align 4, !tbaa !35
  %161 = icmp eq i32 %160, 3
  %spec.select113 = sext i1 %161 to i8
  %162 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv105
  store i8 %spec.select113, ptr %162, align 1
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %163 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv.next106
  %164 = load i32, ptr %163, align 4, !tbaa !35
  %165 = icmp eq i32 %164, 3
  %spec.select113.1 = sext i1 %165 to i8
  %166 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv.next106
  store i8 %spec.select113.1, ptr %166, align 1
  %indvars.iv.next106.1 = add nuw nsw i64 %indvars.iv105, 2
  %167 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv.next106.1
  %168 = load i32, ptr %167, align 4, !tbaa !35
  %169 = icmp eq i32 %168, 3
  %spec.select113.2 = sext i1 %169 to i8
  %170 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv.next106.1
  store i8 %spec.select113.2, ptr %170, align 1
  %indvars.iv.next106.2 = add nuw nsw i64 %indvars.iv105, 3
  %171 = getelementptr inbounds i32, ptr %7, i64 %indvars.iv.next106.2
  %172 = load i32, ptr %171, align 4, !tbaa !35
  %173 = icmp eq i32 %172, 3
  %spec.select113.3 = sext i1 %173 to i8
  %174 = getelementptr inbounds i8, ptr %17, i64 %indvars.iv.next106.2
  store i8 %spec.select113.3, ptr %174, align 1
  %indvars.iv.next106.3 = add nuw nsw i64 %indvars.iv105, 4
  %exitcond109.not.3 = icmp eq i64 %indvars.iv.next106.3, %6
  br i1 %exitcond109.not.3, label %._crit_edge88, label %.lr.ph87, !llvm.loop !46
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 0}
!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 4}
!12 = !{!6, !10, i64 16}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !8, i64 0}
!15 = !{!8, !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19, !21, !22}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = distinct !{!23, !17}
!24 = distinct !{!24, !19, !21, !22}
!25 = distinct !{!25, !19}
!26 = distinct !{!26, !17}
!27 = !{!28}
!28 = distinct !{!28, !29}
!29 = distinct !{!29, !"LVerDomain"}
!30 = !{!31}
!31 = distinct !{!31, !29}
!32 = distinct !{!32, !19, !21, !22}
!33 = distinct !{!33, !19, !21}
!34 = distinct !{!34, !19, !21}
!35 = !{!7, !7, i64 0}
!36 = distinct !{!36, !17}
!37 = !{!38}
!38 = distinct !{!38, !39}
!39 = distinct !{!39, !"LVerDomain"}
!40 = !{!41}
!41 = distinct !{!41, !39}
!42 = distinct !{!42, !19, !21, !22}
!43 = distinct !{!43, !19, !44}
!44 = !{!"llvm.loop.unswitch.partial.disable"}
!45 = distinct !{!45, !19}
!46 = distinct !{!46, !19, !21}


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