; LLVM IR from cornell-zhang/rosetta :: optical-flow/imageLib/ImageIO.ll (Z12WriteFilePGM8CImageOfIhEPKc)

; 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.CShape = type { i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTI6CError = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTIf = external constant ptr
@.str.25 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [37 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

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare ptr @__cxa_allocate_exception(i64)

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

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76), i32 noundef, i32 noundef, i32 noundef) #5 align 2

declare i32 @fclose(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i32 } @_ZN6CImage5ShapeEv(ptr noundef nonnull align 8 dereferenceable(76)) #2 align 2

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #6

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #7 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12WriteFilePGM8CImageOfIhEPKc(ptr noundef %0, ptr noundef %1) #7 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.CShape, align 4
  %6 = alloca { i64, i32 }, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.std::vector", align 8
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %5) #8
  %21 = call { i64, i32 } @_ZN6CImage5ShapeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  store { i64, i32 } %21, ptr %6, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 8 %6, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %22 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 2
  %23 = load i32, ptr %22, align 4, !tbaa !9
  store i32 %23, ptr %7, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %25 = call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIf) #8
  %26 = zext i1 %25 to i32
  store i32 %26, ptr %8, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call noundef ptr @strrchr(ptr noundef %27, i32 noundef 46) #9
  store ptr %28, ptr %9, align 8, !tbaa !5
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = call i32 @strcmp(ptr noundef %29, ptr noundef @.str.18) #9
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %43

32:                                               ; preds = %2
  %33 = load i32, ptr %7, align 4, !tbaa !12
  %34 = icmp ne i32 %33, 1
  br i1 %34, label %35, label %43

35:                                               ; preds = %32
  %36 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %36, ptr noundef @.str.25, ptr noundef %37)
          to label %38 unwind label %39

38:                                               ; preds = %35
  call void @__cxa_throw(ptr %36, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

39:                                               ; preds = %35
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %10, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %11, align 4
  call void @__cxa_free_exception(ptr %36) #8
  br label %282

43:                                               ; preds = %32, %2
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call i32 @strcmp(ptr noundef %44, ptr noundef @.str.20) #9
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %61

47:                                               ; preds = %43
  %48 = load i32, ptr %7, align 4, !tbaa !12
  %49 = icmp ne i32 %48, 3
  br i1 %49, label %50, label %61

50:                                               ; preds = %47
  %51 = load i32, ptr %7, align 4, !tbaa !12
  %52 = icmp ne i32 %51, 4
  br i1 %52, label %53, label %61

53:                                               ; preds = %50
  %54 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %54, ptr noundef @.str.26, ptr noundef %55)
          to label %56 unwind label %57

56:                                               ; preds = %53
  call void @__cxa_throw(ptr %54, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

57:                                               ; preds = %53
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %10, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %11, align 4
  call void @__cxa_free_exception(ptr %54) #8
  br label %282

61:                                               ; preds = %50, %47, %43
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = call i32 @strcmp(ptr noundef %62, ptr noundef @.str.21) #9
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %76

65:                                               ; preds = %61
  %66 = load i32, ptr %8, align 4, !tbaa !12
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %76, label %68

68:                                               ; preds = %65
  %69 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %69, ptr noundef @.str.27, ptr noundef %70)
          to label %71 unwind label %72

71:                                               ; preds = %68
  call void @__cxa_throw(ptr %69, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

72:                                               ; preds = %68
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %10, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %11, align 4
  call void @__cxa_free_exception(ptr %69) #8
  br label %282

76:                                               ; preds = %65, %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = call noalias ptr @fopen(ptr noundef %77, ptr noundef @.str.9)
  store ptr %78, ptr %12, align 8, !tbaa !5
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = icmp eq ptr %79, null
  br i1 %80, label %81, label %89

81:                                               ; preds = %76
  %82 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %82, ptr noundef @.str.28, ptr noundef %83)
          to label %84 unwind label %85

84:                                               ; preds = %81
  call void @__cxa_throw(ptr %82, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

85:                                               ; preds = %81
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %10, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %11, align 4
  call void @__cxa_free_exception(ptr %82) #8
  br label %281

89:                                               ; preds = %76
  %90 = load i32, ptr %7, align 4, !tbaa !12
  %91 = icmp eq i32 %90, 1
  br i1 %91, label %95, label %92

92:                                               ; preds = %89
  %93 = load i32, ptr %8, align 4, !tbaa !12
  %94 = icmp ne i32 %93, 0
  br i1 %94, label %95, label %161

95:                                               ; preds = %92, %89
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = load i32, ptr %8, align 4, !tbaa !12
  %98 = icmp ne i32 %97, 0
  %99 = zext i1 %98 to i64
  %100 = select i1 %98, i32 9, i32 5
  %101 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 0
  %102 = load i32, ptr %101, align 4, !tbaa !13
  %103 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !14
  %105 = load i32, ptr %8, align 4, !tbaa !12
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %110

107:                                              ; preds = %95
  %108 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 2
  %109 = load i32, ptr %108, align 4, !tbaa !9
  br label %111

110:                                              ; preds = %95
  br label %111

111:                                              ; preds = %110, %107
  %112 = phi i32 [ %109, %107 ], [ 255, %110 ]
  %113 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %96, ptr noundef @.str.29, i32 noundef %100, i32 noundef %102, i32 noundef %104, i32 noundef %112) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %114 = load i32, ptr %8, align 4, !tbaa !12
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %124

116:                                              ; preds = %111
  %117 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 0
  %118 = load i32, ptr %117, align 4, !tbaa !13
  %119 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 2
  %120 = load i32, ptr %119, align 4, !tbaa !9
  %121 = mul nsw i32 %118, %120
  %122 = sext i32 %121 to i64
  %123 = mul i64 %122, 4
  br label %128

124:                                              ; preds = %111
  %125 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 0
  %126 = load i32, ptr %125, align 4, !tbaa !13
  %127 = sext i32 %126 to i64
  br label %128

128:                                              ; preds = %124, %116
  %129 = phi i64 [ %123, %116 ], [ %127, %124 ]
  %130 = trunc i64 %129 to i32
  store i32 %130, ptr %13, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !12
  br label %131

131:                                              ; preds = %157, %128
  %132 = load i32, ptr %14, align 4, !tbaa !12
  %133 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !14
  %135 = icmp slt i32 %132, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %160

137:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %138 = load i32, ptr %14, align 4, !tbaa !12
  %139 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %138, i32 noundef 0)
  store ptr %139, ptr %15, align 8, !tbaa !5
  %140 = load ptr, ptr %15, align 8, !tbaa !5
  %141 = load i32, ptr %13, align 4, !tbaa !12
  %142 = sext i32 %141 to i64
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  %144 = call i64 @fwrite(ptr noundef %140, i64 noundef 1, i64 noundef %142, ptr noundef %143)
  %145 = trunc i64 %144 to i32
  %146 = load i32, ptr %13, align 4, !tbaa !12
  %147 = icmp ne i32 %145, %146
  br i1 %147, label %148, label %156

148:                                              ; preds = %137
  %149 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %149, ptr noundef @.str.30, ptr noundef %150)
          to label %151 unwind label %152

151:                                              ; preds = %148
  call void @__cxa_throw(ptr %149, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

152:                                              ; preds = %148
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %10, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %11, align 4
  call void @__cxa_free_exception(ptr %149) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %281

156:                                              ; preds = %137
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %14, align 4, !tbaa !12
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %14, align 4, !tbaa !12
  br label %131, !llvm.loop !15

160:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %268

161:                                              ; preds = %92
  %162 = load i32, ptr %7, align 4, !tbaa !12
  %163 = icmp eq i32 %162, 3
  br i1 %163, label %167, label %164

164:                                              ; preds = %161
  %165 = load i32, ptr %7, align 4, !tbaa !12
  %166 = icmp eq i32 %165, 4
  br i1 %166, label %167, label %258

167:                                              ; preds = %164, %161
  %168 = load ptr, ptr %12, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 0
  %170 = load i32, ptr %169, align 4, !tbaa !13
  %171 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 1
  %172 = load i32, ptr %171, align 4, !tbaa !14
  %173 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %168, ptr noundef @.str.31, i32 noundef %170, i32 noundef %172, i32 noundef 255) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %174 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 0
  %175 = load i32, ptr %174, align 4, !tbaa !13
  %176 = mul nsw i32 %175, 3
  store i32 %176, ptr %16, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #8
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #8
  %177 = load i32, ptr %16, align 4, !tbaa !12
  %178 = sext i32 %177 to i64
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %178)
          to label %179 unwind label %186

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

180:                                              ; preds = %251, %179
  %181 = load i32, ptr %18, align 4, !tbaa !12
  %182 = getelementptr inbounds %struct.CShape, ptr %5, i32 0, i32 1
  %183 = load i32, ptr %182, align 4, !tbaa !14
  %184 = icmp slt i32 %181, %183
  br i1 %184, label %190, label %185

185:                                              ; preds = %180
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %256

186:                                              ; preds = %167
  %187 = landingpad { ptr, i32 }
          cleanup
  %188 = extractvalue { ptr, i32 } %187, 0
  store ptr %188, ptr %10, align 8
  %189 = extractvalue { ptr, i32 } %187, 1
  store i32 %189, ptr %11, align 4
  br label %257

190:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %191 = load i32, ptr %18, align 4, !tbaa !12
  %192 = invoke noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %191, i32 noundef 0)
          to label %193 unwind label %224

193:                                              ; preds = %190
  store ptr %192, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !12
  br label %194

194:                                              ; preds = %198, %193
  %195 = load i32, ptr %20, align 4, !tbaa !12
  %196 = load i32, ptr %16, align 4, !tbaa !12
  %197 = icmp slt i32 %195, %196
  br i1 %197, label %198, label %228

198:                                              ; preds = %194
  %199 = load ptr, ptr %19, align 8, !tbaa !5
  %200 = getelementptr inbounds i8, ptr %199, i64 2
  %201 = load i8, ptr %200, align 1, !tbaa !17
  %202 = load i32, ptr %20, align 4, !tbaa !12
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %20, align 4, !tbaa !12
  %204 = sext i32 %202 to i64
  %205 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %204) #8
  store i8 %201, ptr %205, align 1, !tbaa !17
  %206 = load ptr, ptr %19, align 8, !tbaa !5
  %207 = getelementptr inbounds i8, ptr %206, i64 1
  %208 = load i8, ptr %207, align 1, !tbaa !17
  %209 = load i32, ptr %20, align 4, !tbaa !12
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %20, align 4, !tbaa !12
  %211 = sext i32 %209 to i64
  %212 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %211) #8
  store i8 %208, ptr %212, align 1, !tbaa !17
  %213 = load ptr, ptr %19, align 8, !tbaa !5
  %214 = getelementptr inbounds i8, ptr %213, i64 0
  %215 = load i8, ptr %214, align 1, !tbaa !17
  %216 = load i32, ptr %20, align 4, !tbaa !12
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %20, align 4, !tbaa !12
  %218 = sext i32 %216 to i64
  %219 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef %218) #8
  store i8 %215, ptr %219, align 1, !tbaa !17
  %220 = load i32, ptr %7, align 4, !tbaa !12
  %221 = load ptr, ptr %19, align 8, !tbaa !5
  %222 = sext i32 %220 to i64
  %223 = getelementptr inbounds i8, ptr %221, i64 %222
  store ptr %223, ptr %19, align 8, !tbaa !5
  br label %194, !llvm.loop !18

224:                                              ; preds = %190
  %225 = landingpad { ptr, i32 }
          cleanup
  %226 = extractvalue { ptr, i32 } %225, 0
  store ptr %226, ptr %10, align 8
  %227 = extractvalue { ptr, i32 } %225, 1
  store i32 %227, ptr %11, align 4
  br label %255

228:                                              ; preds = %194
  %229 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %17, i64 noundef 0) #8
  %230 = load i32, ptr %16, align 4, !tbaa !12
  %231 = sext i32 %230 to i64
  %232 = load ptr, ptr %12, align 8, !tbaa !5
  %233 = invoke i64 @fwrite(ptr noundef %229, i64 noundef 1, i64 noundef %231, ptr noundef %232)
          to label %234 unwind label %242

234:                                              ; preds = %228
  %235 = trunc i64 %233 to i32
  %236 = load i32, ptr %16, align 4, !tbaa !12
  %237 = icmp ne i32 %235, %236
  br i1 %237, label %238, label %250

238:                                              ; preds = %234
  %239 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %240 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %239, ptr noundef @.str.30, ptr noundef %240)
          to label %241 unwind label %246

241:                                              ; preds = %238
  invoke void @__cxa_throw(ptr %239, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
          to label %288 unwind label %242

242:                                              ; preds = %241, %228
  %243 = landingpad { ptr, i32 }
          cleanup
  %244 = extractvalue { ptr, i32 } %243, 0
  store ptr %244, ptr %10, align 8
  %245 = extractvalue { ptr, i32 } %243, 1
  store i32 %245, ptr %11, align 4
  br label %254

246:                                              ; preds = %238
  %247 = landingpad { ptr, i32 }
          cleanup
  %248 = extractvalue { ptr, i32 } %247, 0
  store ptr %248, ptr %10, align 8
  %249 = extractvalue { ptr, i32 } %247, 1
  store i32 %249, ptr %11, align 4
  call void @__cxa_free_exception(ptr %239) #8
  br label %254

250:                                              ; preds = %234
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %251

251:                                              ; preds = %250
  %252 = load i32, ptr %18, align 4, !tbaa !12
  %253 = add nsw i32 %252, 1
  store i32 %253, ptr %18, align 4, !tbaa !12
  br label %180, !llvm.loop !19

254:                                              ; preds = %246, %242
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %255

255:                                              ; preds = %254, %224
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  br label %257

256:                                              ; preds = %185
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %267

257:                                              ; preds = %255, %186
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %281

258:                                              ; preds = %164
  %259 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %260 = load ptr, ptr %4, align 8, !tbaa !5
  %261 = load i32, ptr %7, align 4, !tbaa !12
  invoke void @_ZN6CErrorC2EPKcS1_i(ptr noundef nonnull align 8 dereferenceable(1032) %259, ptr noundef @.str.32, ptr noundef %260, i32 noundef %261)
          to label %262 unwind label %263

262:                                              ; preds = %258
  call void @__cxa_throw(ptr %259, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

263:                                              ; preds = %258
  %264 = landingpad { ptr, i32 }
          cleanup
  %265 = extractvalue { ptr, i32 } %264, 0
  store ptr %265, ptr %10, align 8
  %266 = extractvalue { ptr, i32 } %264, 1
  store i32 %266, ptr %11, align 4
  call void @__cxa_free_exception(ptr %259) #8
  br label %281

267:                                              ; preds = %256
  br label %268

268:                                              ; preds = %267, %160
  %269 = load ptr, ptr %12, align 8, !tbaa !5
  %270 = call i32 @fclose(ptr noundef %269)
  %271 = icmp ne i32 %270, 0
  br i1 %271, label %272, label %280

272:                                              ; preds = %268
  %273 = call ptr @__cxa_allocate_exception(i64 1032) #8
  %274 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %273, ptr noundef @.str.33, ptr noundef %274)
          to label %275 unwind label %276

275:                                              ; preds = %272
  call void @__cxa_throw(ptr %273, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #10
  unreachable

276:                                              ; preds = %272
  %277 = landingpad { ptr, i32 }
          cleanup
  %278 = extractvalue { ptr, i32 } %277, 0
  store ptr %278, ptr %10, align 8
  %279 = extractvalue { ptr, i32 } %277, 1
  store i32 %279, ptr %11, align 4
  call void @__cxa_free_exception(ptr %273) #8
  br label %281

280:                                              ; preds = %268
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #8
  ret void

281:                                              ; preds = %276, %263, %257, %152, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %282

282:                                              ; preds = %281, %72, %57, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %5) #8
  br label %283

283:                                              ; preds = %282
  %284 = load ptr, ptr %10, align 8
  %285 = load i32, ptr %11, align 4
  %286 = insertvalue { ptr, i32 } poison, ptr %284, 0
  %287 = insertvalue { ptr, i32 } %286, i32 %285, 1
  resume { ptr, i32 } %287

288:                                              ; preds = %241
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #5 align 2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CErrorC2EPKcS1_i(ptr noundef nonnull align 8 dereferenceable(1032), ptr noundef, ptr noundef, i32 noundef) unnamed_addr #2 align 2

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

!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 8}
!10 = !{!"_ZTS6CShape", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!10, !11, i64 4}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!7, !7, i64 0}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}


; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@_ZTI6CError = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZTIf = external constant ptr
@.str.25 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [37 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: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @_ZNSt9exceptionD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local { i64, i32 } @_ZN6CImage5ShapeEv(ptr noundef nonnull align 8 dereferenceable(76)) local_unnamed_addr #2 align 2

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strrchr(ptr noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #6 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z12WriteFilePGM8CImageOfIhEPKc(ptr noundef nonnull %0, ptr noundef %1) local_unnamed_addr #6 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::vector", align 8
  %4 = tail call { i64, i32 } @_ZN6CImage5ShapeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %.fca.0.extract = extractvalue { i64, i32 } %4, 0
  %.fca.1.extract = extractvalue { i64, i32 } %4, 1
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76) %0)
  %6 = tail call noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) @_ZTIf) #7
  %7 = tail call noundef ptr @strrchr(ptr noundef nonnull dereferenceable(1) %1, i32 noundef 46) #8
  %8 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.18) #8
  %9 = icmp eq i32 %8, 0
  %10 = icmp ne i32 %.fca.1.extract, 1
  %or.cond = select i1 %9, i1 %10, i1 false
  br i1 %or.cond, label %11, label %13

11:                                               ; preds = %2
  %12 = tail call ptr @__cxa_allocate_exception(i64 1032) #7
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %12, ptr noundef nonnull @.str.25, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %12, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

13:                                               ; preds = %2
  %14 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.20) #8
  %15 = icmp eq i32 %14, 0
  %16 = add i32 %.fca.1.extract, -5
  %17 = icmp ult i32 %16, -2
  %or.cond5 = select i1 %15, i1 %17, i1 false
  br i1 %or.cond5, label %18, label %20

18:                                               ; preds = %13
  %19 = tail call ptr @__cxa_allocate_exception(i64 1032) #7
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %19, ptr noundef nonnull @.str.26, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

20:                                               ; preds = %13
  %21 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %7, ptr noundef nonnull dereferenceable(1) @.str.21) #8
  %22 = icmp ne i32 %21, 0
  %or.cond7 = or i1 %6, %22
  br i1 %or.cond7, label %25, label %23

23:                                               ; preds = %20
  %24 = tail call ptr @__cxa_allocate_exception(i64 1032) #7
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %24, ptr noundef nonnull @.str.27, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %24, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

25:                                               ; preds = %20
  %26 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.9)
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %30

28:                                               ; preds = %25
  %29 = tail call ptr @__cxa_allocate_exception(i64 1032) #7
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %29, ptr noundef nonnull @.str.28, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %29, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

30:                                               ; preds = %25
  %31 = icmp eq i32 %.fca.1.extract, 1
  %or.cond9 = or i1 %31, %6
  br i1 %or.cond9, label %32, label %55

32:                                               ; preds = %30
  %33 = select i1 %6, i32 9, i32 5
  %.sroa.055.0.extract.trunc = trunc i64 %.fca.0.extract to i32
  %.sroa.055.4.extract.shift = lshr i64 %.fca.0.extract, 32
  %.sroa.055.4.extract.trunc = trunc nuw i64 %.sroa.055.4.extract.shift to i32
  %34 = select i1 %6, i32 %.fca.1.extract, i32 255
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %26, ptr noundef nonnull @.str.29, i32 noundef %33, i32 noundef %.sroa.055.0.extract.trunc, i32 noundef %.sroa.055.4.extract.trunc, i32 noundef %34) #7
  br i1 %6, label %36, label %40

36:                                               ; preds = %32
  %37 = mul nsw i32 %.fca.1.extract, %.sroa.055.0.extract.trunc
  %38 = sext i32 %37 to i64
  %39 = shl nsw i64 %38, 2
  br label %42

40:                                               ; preds = %32
  %sext = shl i64 %.fca.0.extract, 32
  %41 = ashr exact i64 %sext, 32
  br label %42

42:                                               ; preds = %40, %36
  %43 = phi i64 [ %39, %36 ], [ %41, %40 ]
  %44 = trunc i64 %43 to i32
  %45 = icmp sgt i32 %.sroa.055.4.extract.trunc, 0
  br i1 %45, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %42
  %sext94 = shl i64 %43, 32
  %46 = ashr exact i64 %sext94, 32
  br label %49

47:                                               ; preds = %49
  %48 = add nuw nsw i32 %.089101, 1
  %exitcond106.not = icmp eq i32 %48, %.sroa.055.4.extract.trunc
  br i1 %exitcond106.not, label %.loopexit, label %49, !llvm.loop !5

49:                                               ; preds = %.lr.ph, %47
  %.089101 = phi i32 [ 0, %.lr.ph ], [ %48, %47 ]
  %50 = tail call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %.089101, i32 noundef 0)
  %51 = tail call i64 @fwrite(ptr noundef %50, i64 noundef 1, i64 noundef %46, ptr noundef nonnull %26)
  %52 = trunc i64 %51 to i32
  %.not95 = icmp eq i32 %52, %44
  br i1 %.not95, label %47, label %53

53:                                               ; preds = %49
  %54 = tail call ptr @__cxa_allocate_exception(i64 1032) #7
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %54, ptr noundef nonnull @.str.30, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %54, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

55:                                               ; preds = %30
  %56 = add i32 %.fca.1.extract, -3
  %or.cond11 = icmp ult i32 %56, 2
  br i1 %or.cond11, label %57, label %96

57:                                               ; preds = %55
  %.sroa.055.0.extract.trunc61 = trunc i64 %.fca.0.extract to i32
  %.sroa.055.4.extract.shift68 = lshr i64 %.fca.0.extract, 32
  %.sroa.055.4.extract.trunc69 = trunc nuw i64 %.sroa.055.4.extract.shift68 to i32
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %26, ptr noundef nonnull @.str.31, i32 noundef %.sroa.055.0.extract.trunc61, i32 noundef %.sroa.055.4.extract.trunc69, i32 noundef 255) #7
  %59 = mul nsw i32 %.sroa.055.0.extract.trunc61, 3
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  call void @_ZNSt6vectorIhSaIhEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %60 = sext i32 %59 to i64
  invoke void @_ZNSt6vectorIhSaIhEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %60)
          to label %.preheader unwind label %86

.preheader:                                       ; preds = %57
  %61 = icmp sgt i32 %.sroa.055.4.extract.trunc69, 0
  br i1 %61, label %.lr.ph99, label %._crit_edge100

.lr.ph99:                                         ; preds = %.preheader
  %62 = icmp sgt i32 %.sroa.055.0.extract.trunc61, 0
  %63 = zext nneg i32 %.fca.1.extract to i64
  br i1 %62, label %.lr.ph.us, label %.lr.ph99.split

.lr.ph.us:                                        ; preds = %.lr.ph99, %65
  %.08698.us = phi i32 [ %66, %65 ], [ 0, %.lr.ph99 ]
  %64 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %.08698.us, i32 noundef 0)
  br label %67

65:                                               ; preds = %._crit_edge.us
  %66 = add nuw nsw i32 %.08698.us, 1
  %exitcond105.not = icmp eq i32 %66, %.sroa.055.4.extract.trunc69
  br i1 %exitcond105.not, label %._crit_edge100, label %.lr.ph.us, !llvm.loop !7

67:                                               ; preds = %.lr.ph.us, %67
  %indvars.iv = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next, %67 ]
  %.08596.us = phi ptr [ %64, %.lr.ph.us ], [ %78, %67 ]
  %68 = getelementptr inbounds i8, ptr %.08596.us, i64 2
  %69 = load i8, ptr %68, align 1, !tbaa !8
  %70 = add nuw nsw i64 %indvars.iv, 1
  %71 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv) #7
  store i8 %69, ptr %71, align 1, !tbaa !8
  %72 = getelementptr inbounds i8, ptr %.08596.us, i64 1
  %73 = load i8, ptr %72, align 1, !tbaa !8
  %74 = add nuw nsw i64 %indvars.iv, 2
  %75 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %70) #7
  store i8 %73, ptr %75, align 1, !tbaa !8
  %76 = load i8, ptr %.08596.us, align 1, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 3
  %77 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %74) #7
  store i8 %76, ptr %77, align 1, !tbaa !8
  %78 = getelementptr inbounds i8, ptr %.08596.us, i64 %63
  %79 = trunc nuw i64 %indvars.iv.next to i32
  %80 = icmp sgt i32 %59, %79
  br i1 %80, label %67, label %._crit_edge.us, !llvm.loop !11

._crit_edge.us:                                   ; preds = %67
  %81 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0) #7
  %82 = call i64 @fwrite(ptr noundef nonnull %81, i64 noundef 1, i64 noundef %60, ptr noundef nonnull %26)
  %83 = trunc i64 %82 to i32
  %.not.us = icmp eq i32 %59, %83
  br i1 %.not.us, label %65, label %.split.us

84:                                               ; preds = %.lr.ph99.split
  %85 = add nuw nsw i32 %.08698, 1
  %exitcond.not = icmp eq i32 %85, %.sroa.055.4.extract.trunc69
  br i1 %exitcond.not, label %._crit_edge100, label %.lr.ph99.split, !llvm.loop !7

._crit_edge100:                                   ; preds = %84, %65, %.preheader
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  br label %.loopexit

86:                                               ; preds = %57
  %87 = landingpad { ptr, i32 }
          cleanup
  br label %95

.lr.ph99.split:                                   ; preds = %.lr.ph99, %84
  %.08698 = phi i32 [ %85, %84 ], [ 0, %.lr.ph99 ]
  %88 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %.08698, i32 noundef 0)
  %89 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef 0) #7
  %90 = call i64 @fwrite(ptr noundef nonnull %89, i64 noundef 1, i64 noundef %60, ptr noundef nonnull %26)
  %91 = trunc i64 %90 to i32
  %.not = icmp eq i32 %59, %91
  br i1 %.not, label %84, label %.split.us

.split.us:                                        ; preds = %.lr.ph99.split, %._crit_edge.us
  %92 = call ptr @__cxa_allocate_exception(i64 1032) #7
  call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %92, ptr noundef nonnull @.str.30, ptr noundef %1)
  invoke void @__cxa_throw(ptr nonnull %92, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
          to label %102 unwind label %93

93:                                               ; preds = %.split.us
  %94 = landingpad { ptr, i32 }
          cleanup
  br label %95

95:                                               ; preds = %93, %86
  %.pn = phi { ptr, i32 } [ %94, %93 ], [ %87, %86 ]
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn

96:                                               ; preds = %55
  %97 = tail call ptr @__cxa_allocate_exception(i64 1032) #7
  tail call void @_ZN6CErrorC2EPKcS1_i(ptr noundef nonnull align 8 dereferenceable(1032) %97, ptr noundef nonnull @.str.32, ptr noundef %1, i32 noundef %.fca.1.extract)
  tail call void @__cxa_throw(ptr nonnull %97, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

.loopexit:                                        ; preds = %47, %42, %._crit_edge100
  %98 = call i32 @fclose(ptr noundef nonnull %26)
  %.not93 = icmp eq i32 %98, 0
  br i1 %.not93, label %101, label %99

99:                                               ; preds = %.loopexit
  %100 = call ptr @__cxa_allocate_exception(i64 1032) #7
  call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %100, ptr noundef nonnull @.str.33, ptr noundef %1)
  call void @__cxa_throw(ptr nonnull %100, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #9
  unreachable

101:                                              ; preds = %.loopexit
  ret void

102:                                              ; preds = %.split.us
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN6CImage7PixTypeEv(ptr noundef nonnull align 8 dereferenceable(76)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt9type_infoeqERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CErrorC2EPKcS1_i(ptr noundef nonnull align 8 dereferenceable(1032), ptr noundef, ptr noundef, i32 noundef) unnamed_addr #2 align 2

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

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}


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