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

; 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.CTargaHead = type { i8, i8, i8, [2 x i8], [2 x i8], i8, i16, i16, i16, i16, i8, i8 }
%struct.CShape = type { i32, i32, i32 }
%class.CTargaRLC = type <{ i32, i8, i8, [4 x i8], [2 x i8] }>

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@_ZTI6CError = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11ReadFileTGAR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.CTargaHead, align 2
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i8, align 1
  %12 = alloca i32, align 4
  %13 = alloca [256 x [3 x i8]], align 16
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i8, align 1
  %21 = alloca i8, align 1
  %22 = alloca %struct.CShape, align 4
  %23 = alloca %struct.CShape, align 4
  %24 = alloca { i64, i32 }, align 4
  %25 = alloca %class.CTargaRLC, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca ptr, align 8
  %32 = alloca i32, align 4
  %33 = 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 8, ptr %5) #10
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = call noalias ptr @fopen(ptr noundef %34, ptr noundef @.str)
  store ptr %35, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %46

38:                                               ; preds = %2
  %39 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %39, ptr noundef @.str.1, ptr noundef %40)
          to label %41 unwind label %42

41:                                               ; preds = %38
  call void @__cxa_throw(ptr %39, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

42:                                               ; preds = %38
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %6, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %7, align 4
  call void @__cxa_free_exception(ptr %39) #10
  br label %463

46:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 18, ptr %8) #10
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call i64 @fread(ptr noundef %8, i64 noundef 18, i64 noundef 1, ptr noundef %47)
  %49 = trunc i64 %48 to i32
  %50 = icmp ne i32 %49, 1
  br i1 %50, label %51, label %59

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

54:                                               ; preds = %51
  call void @__cxa_throw(ptr %52, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

55:                                               ; preds = %51
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %6, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %7, align 4
  call void @__cxa_free_exception(ptr %52) #10
  br label %462

59:                                               ; preds = %46
  %60 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 0
  %61 = load i8, ptr %60, align 2, !tbaa !9
  %62 = zext i8 %61 to i32
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %64, label %94

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  %65 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 0
  %66 = load i8, ptr %65, align 2, !tbaa !9
  %67 = zext i8 %66 to i64
  %68 = call noalias noundef nonnull ptr @_Znam(i64 noundef %67) #12
  store ptr %68, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 0
  %71 = load i8, ptr %70, align 2, !tbaa !9
  %72 = zext i8 %71 to i64
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = call i64 @fread(ptr noundef %69, i64 noundef 1, i64 noundef %72, ptr noundef %73)
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %10, align 4, !tbaa !12
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = icmp eq ptr %76, null
  br i1 %77, label %79, label %78

78:                                               ; preds = %64
  call void @_ZdlPvm(ptr noundef %76, i64 noundef 1) #13
  br label %79

79:                                               ; preds = %78, %64
  %80 = load i32, ptr %10, align 4, !tbaa !12
  %81 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 0
  %82 = load i8, ptr %81, align 2, !tbaa !9
  %83 = zext i8 %82 to i32
  %84 = icmp ne i32 %80, %83
  br i1 %84, label %85, label %93

85:                                               ; preds = %79
  %86 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %86, ptr noundef @.str.2, ptr noundef %87)
          to label %88 unwind label %89

88:                                               ; preds = %85
  call void @__cxa_throw(ptr %86, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

89:                                               ; preds = %85
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %6, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %7, align 4
  call void @__cxa_free_exception(ptr %86) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  br label %462

93:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  br label %94

94:                                               ; preds = %93, %59
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #10
  %95 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 11
  %96 = load i8, ptr %95, align 1, !tbaa !14
  %97 = zext i8 %96 to i32
  %98 = and i32 %97, 32
  %99 = icmp ne i32 %98, 0
  %100 = zext i1 %99 to i8
  store i8 %100, ptr %11, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #10
  %101 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 10
  %102 = load i8, ptr %101, align 2, !tbaa !17
  %103 = zext i8 %102 to i32
  %104 = add nsw i32 %103, 7
  %105 = sdiv i32 %104, 8
  store i32 %105, ptr %12, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 768, ptr %13) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #10
  store i32 0, ptr %14, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #10
  store i8 0, ptr %15, align 1, !tbaa !15
  %106 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 1
  %107 = load i8, ptr %106, align 1, !tbaa !18
  %108 = zext i8 %107 to i32
  %109 = icmp eq i32 %108, 1
  br i1 %109, label %110, label %201

110:                                              ; preds = %94
  %111 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 4
  %112 = getelementptr inbounds [2 x i8], ptr %111, i64 0, i64 1
  %113 = load i8, ptr %112, align 1, !tbaa !19
  %114 = zext i8 %113 to i32
  %115 = shl i32 %114, 8
  %116 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 4
  %117 = getelementptr inbounds [2 x i8], ptr %116, i64 0, i64 0
  %118 = load i8, ptr %117, align 1, !tbaa !19
  %119 = zext i8 %118 to i32
  %120 = add nsw i32 %115, %119
  store i32 %120, ptr %14, align 4, !tbaa !12
  %121 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 5
  %122 = load i8, ptr %121, align 1, !tbaa !20
  %123 = zext i8 %122 to i32
  %124 = icmp ne i32 %123, 24
  br i1 %124, label %125, label %133

125:                                              ; preds = %110
  %126 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %126, ptr noundef @.str.3, ptr noundef %127)
          to label %128 unwind label %129

128:                                              ; preds = %125
  call void @__cxa_throw(ptr %126, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

129:                                              ; preds = %125
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %6, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %7, align 4
  call void @__cxa_free_exception(ptr %126) #10
  br label %461

133:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #10
  %134 = load i32, ptr %12, align 4, !tbaa !12
  %135 = load i32, ptr %14, align 4, !tbaa !12
  %136 = mul nsw i32 %134, %135
  store i32 %136, ptr %16, align 4, !tbaa !12
  %137 = load i32, ptr %16, align 4, !tbaa !12
  %138 = icmp sgt i32 %137, 768
  br i1 %138, label %139, label %147

139:                                              ; preds = %133
  %140 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %140, ptr noundef @.str.4, ptr noundef %141)
          to label %142 unwind label %143

142:                                              ; preds = %139
  call void @__cxa_throw(ptr %140, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

143:                                              ; preds = %139
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %6, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %7, align 4
  call void @__cxa_free_exception(ptr %140) #10
  br label %200

147:                                              ; preds = %133
  %148 = getelementptr inbounds [256 x [3 x i8]], ptr %13, i64 0, i64 0
  %149 = load i32, ptr %16, align 4, !tbaa !12
  %150 = sext i32 %149 to i64
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = call i64 @fread(ptr noundef %148, i64 noundef 1, i64 noundef %150, ptr noundef %151)
  %153 = trunc i64 %152 to i32
  %154 = load i32, ptr %16, align 4, !tbaa !12
  %155 = icmp ne i32 %153, %154
  br i1 %155, label %156, label %164

156:                                              ; preds = %147
  %157 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %157, ptr noundef @.str.5, ptr noundef %158)
          to label %159 unwind label %160

159:                                              ; preds = %156
  call void @__cxa_throw(ptr %157, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

160:                                              ; preds = %156
  %161 = landingpad { ptr, i32 }
          cleanup
  %162 = extractvalue { ptr, i32 } %161, 0
  store ptr %162, ptr %6, align 8
  %163 = extractvalue { ptr, i32 } %161, 1
  store i32 %163, ptr %7, align 4
  call void @__cxa_free_exception(ptr %157) #10
  br label %200

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

165:                                              ; preds = %192, %164
  %166 = load i32, ptr %17, align 4, !tbaa !12
  %167 = load i32, ptr %14, align 4, !tbaa !12
  %168 = icmp slt i32 %166, %167
  br i1 %168, label %169, label %195

169:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #10
  store i32 0, ptr %18, align 4, !tbaa !12
  br label %170

170:                                              ; preds = %187, %169
  %171 = load i32, ptr %18, align 4, !tbaa !12
  %172 = icmp slt i32 %171, 3
  br i1 %172, label %174, label %173

173:                                              ; preds = %170
  store i32 5, ptr %19, align 4
  br label %190

174:                                              ; preds = %170
  %175 = load i32, ptr %17, align 4, !tbaa !12
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [256 x [3 x i8]], ptr %13, i64 0, i64 %176
  %178 = load i32, ptr %18, align 4, !tbaa !12
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [3 x i8], ptr %177, i64 0, i64 %179
  %181 = load i8, ptr %180, align 1, !tbaa !19
  %182 = zext i8 %181 to i32
  %183 = load i32, ptr %17, align 4, !tbaa !12
  %184 = icmp ne i32 %182, %183
  br i1 %184, label %185, label %186

185:                                              ; preds = %174
  store i32 5, ptr %19, align 4
  br label %190

186:                                              ; preds = %174
  br label %187

187:                                              ; preds = %186
  %188 = load i32, ptr %18, align 4, !tbaa !12
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %18, align 4, !tbaa !12
  br label %170, !llvm.loop !21

190:                                              ; preds = %185, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #10
  br label %191

191:                                              ; preds = %190
  br label %192

192:                                              ; preds = %191
  %193 = load i32, ptr %17, align 4, !tbaa !12
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %17, align 4, !tbaa !12
  br label %165, !llvm.loop !23

195:                                              ; preds = %165
  %196 = load i32, ptr %17, align 4, !tbaa !12
  %197 = load i32, ptr %14, align 4, !tbaa !12
  %198 = icmp eq i32 %196, %197
  %199 = zext i1 %198 to i8
  store i8 %199, ptr %15, align 1, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  br label %201

200:                                              ; preds = %160, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  br label %461

201:                                              ; preds = %195, %94
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #10
  %202 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %203 = load i8, ptr %202, align 2, !tbaa !24
  %204 = zext i8 %203 to i32
  %205 = icmp eq i32 %204, 3
  br i1 %205, label %228, label %206

206:                                              ; preds = %201
  %207 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %208 = load i8, ptr %207, align 2, !tbaa !24
  %209 = zext i8 %208 to i32
  %210 = icmp eq i32 %209, 11
  br i1 %210, label %228, label %211

211:                                              ; preds = %206
  %212 = load i8, ptr %15, align 1, !tbaa !15, !range !25, !noundef !26
  %213 = trunc i8 %212 to i1
  br i1 %213, label %214, label %226

214:                                              ; preds = %211
  %215 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %216 = load i8, ptr %215, align 2, !tbaa !24
  %217 = zext i8 %216 to i32
  %218 = icmp eq i32 %217, 1
  br i1 %218, label %224, label %219

219:                                              ; preds = %214
  %220 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %221 = load i8, ptr %220, align 2, !tbaa !24
  %222 = zext i8 %221 to i32
  %223 = icmp eq i32 %222, 9
  br label %224

224:                                              ; preds = %219, %214
  %225 = phi i1 [ true, %214 ], [ %223, %219 ]
  br label %226

226:                                              ; preds = %224, %211
  %227 = phi i1 [ false, %211 ], [ %225, %224 ]
  br label %228

228:                                              ; preds = %226, %206, %201
  %229 = phi i1 [ true, %206 ], [ true, %201 ], [ %227, %226 ]
  %230 = zext i1 %229 to i8
  store i8 %230, ptr %20, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #10
  %231 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %232 = load i8, ptr %231, align 2, !tbaa !24
  %233 = zext i8 %232 to i32
  %234 = icmp eq i32 %233, 3
  br i1 %234, label %250, label %235

235:                                              ; preds = %228
  %236 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %237 = load i8, ptr %236, align 2, !tbaa !24
  %238 = zext i8 %237 to i32
  %239 = icmp eq i32 %238, 2
  br i1 %239, label %250, label %240

240:                                              ; preds = %235
  %241 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 2
  %242 = load i8, ptr %241, align 2, !tbaa !24
  %243 = zext i8 %242 to i32
  %244 = icmp eq i32 %243, 2
  br i1 %244, label %245, label %248

245:                                              ; preds = %240
  %246 = load i8, ptr %20, align 1, !tbaa !15, !range !25, !noundef !26
  %247 = trunc i8 %246 to i1
  br label %248

248:                                              ; preds = %245, %240
  %249 = phi i1 [ false, %240 ], [ %247, %245 ]
  br label %250

250:                                              ; preds = %248, %235, %228
  %251 = phi i1 [ true, %235 ], [ true, %228 ], [ %249, %248 ]
  %252 = zext i1 %251 to i8
  store i8 %252, ptr %21, align 1, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 12, ptr %22) #10
  %253 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 8
  %254 = load i16, ptr %253, align 2, !tbaa !27
  %255 = sext i16 %254 to i32
  %256 = getelementptr inbounds %struct.CTargaHead, ptr %8, i32 0, i32 9
  %257 = load i16, ptr %256, align 2, !tbaa !28
  %258 = sext i16 %257 to i32
  %259 = load i8, ptr %20, align 1, !tbaa !15, !range !25, !noundef !26
  %260 = trunc i8 %259 to i1
  %261 = zext i1 %260 to i64
  %262 = select i1 %260, i32 1, i32 4
  call void @_ZN6CShapeC2Eiii(ptr noundef nonnull align 4 dereferenceable(12) %22, i32 noundef %255, i32 noundef %258, i32 noundef %262)
  %263 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %23, ptr align 4 %22, i64 12, i1 false), !tbaa.struct !29
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 4 %23, i64 12, i1 false)
  %264 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 0
  %265 = load i64, ptr %264, align 4
  %266 = getelementptr inbounds { i64, i32 }, ptr %24, i32 0, i32 1
  %267 = load i32, ptr %266, align 4
  call void @_ZN8CImageOfIhE10ReAllocateE6CShapeb(ptr noundef nonnull align 8 dereferenceable(76) %263, i64 %265, i32 %267, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %25) #10
  %268 = load i8, ptr %21, align 1, !tbaa !15, !range !25, !noundef !26
  %269 = trunc i8 %268 to i1
  %270 = xor i1 %269, true
  call void @_ZN9CTargaRLCC2Eb(ptr noundef nonnull align 4 dereferenceable(10) %25, i1 noundef zeroext %270)
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #10
  store i32 0, ptr %26, align 4, !tbaa !12
  br label %271

271:                                              ; preds = %443, %250
  %272 = load i32, ptr %26, align 4, !tbaa !12
  %273 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 1
  %274 = load i32, ptr %273, align 4, !tbaa !30
  %275 = icmp slt i32 %272, %274
  br i1 %275, label %277, label %276

276:                                              ; preds = %271
  store i32 8, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #10
  br label %447

277:                                              ; preds = %271
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #10
  %278 = load i8, ptr %11, align 1, !tbaa !15, !range !25, !noundef !26
  %279 = trunc i8 %278 to i1
  br i1 %279, label %280, label %286

280:                                              ; preds = %277
  %281 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 1
  %282 = load i32, ptr %281, align 4, !tbaa !30
  %283 = sub nsw i32 %282, 1
  %284 = load i32, ptr %26, align 4, !tbaa !12
  %285 = sub nsw i32 %283, %284
  br label %288

286:                                              ; preds = %277
  %287 = load i32, ptr %26, align 4, !tbaa !12
  br label %288

288:                                              ; preds = %286, %280
  %289 = phi i32 [ %285, %280 ], [ %287, %286 ]
  store i32 %289, ptr %27, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #10
  %290 = load ptr, ptr %3, align 8, !tbaa !5
  %291 = load i32, ptr %27, align 4, !tbaa !12
  %292 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %290, i32 noundef 0, i32 noundef %291, i32 noundef 0)
  store ptr %292, ptr %28, align 8, !tbaa !5
  %293 = load i32, ptr %12, align 4, !tbaa !12
  %294 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 2
  %295 = load i32, ptr %294, align 4, !tbaa !32
  %296 = icmp eq i32 %293, %295
  br i1 %296, label %297, label %323

297:                                              ; preds = %288
  %298 = load i8, ptr %21, align 1, !tbaa !15, !range !25, !noundef !26
  %299 = trunc i8 %298 to i1
  br i1 %299, label %300, label %323

300:                                              ; preds = %297
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #10
  %301 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 0
  %302 = load i32, ptr %301, align 4, !tbaa !33
  %303 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 2
  %304 = load i32, ptr %303, align 4, !tbaa !32
  %305 = mul nsw i32 %302, %304
  store i32 %305, ptr %29, align 4, !tbaa !12
  %306 = load ptr, ptr %28, align 8, !tbaa !5
  %307 = load i32, ptr %29, align 4, !tbaa !12
  %308 = sext i32 %307 to i64
  %309 = load ptr, ptr %5, align 8, !tbaa !5
  %310 = call i64 @fread(ptr noundef %306, i64 noundef 1, i64 noundef %308, ptr noundef %309)
  %311 = trunc i64 %310 to i32
  %312 = load i32, ptr %29, align 4, !tbaa !12
  %313 = icmp ne i32 %311, %312
  br i1 %313, label %314, label %322

314:                                              ; preds = %300
  %315 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %316 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %315, ptr noundef @.str.2, ptr noundef %316)
          to label %317 unwind label %318

317:                                              ; preds = %314
  call void @__cxa_throw(ptr %315, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

318:                                              ; preds = %314
  %319 = landingpad { ptr, i32 }
          cleanup
  %320 = extractvalue { ptr, i32 } %319, 0
  store ptr %320, ptr %6, align 8
  %321 = extractvalue { ptr, i32 } %319, 1
  store i32 %321, ptr %7, align 4
  call void @__cxa_free_exception(ptr %315) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #10
  br label %446

322:                                              ; preds = %300
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #10
  br label %442

323:                                              ; preds = %297, %288
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #10
  store i32 0, ptr %30, align 4, !tbaa !12
  br label %324

324:                                              ; preds = %433, %323
  %325 = load i32, ptr %30, align 4, !tbaa !12
  %326 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 0
  %327 = load i32, ptr %326, align 4, !tbaa !33
  %328 = icmp slt i32 %325, %327
  br i1 %328, label %330, label %329

329:                                              ; preds = %324
  store i32 11, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #10
  br label %441

330:                                              ; preds = %324
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #10
  %331 = load i32, ptr %12, align 4, !tbaa !12
  %332 = load ptr, ptr %5, align 8, !tbaa !5
  %333 = call noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10) %25, i32 noundef %331, ptr noundef %332)
  store ptr %333, ptr %31, align 8, !tbaa !5
  %334 = load i32, ptr %12, align 4, !tbaa !12
  %335 = icmp eq i32 %334, 1
  br i1 %335, label %336, label %346

336:                                              ; preds = %330
  %337 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 2
  %338 = load i32, ptr %337, align 4, !tbaa !32
  %339 = icmp eq i32 %338, 1
  br i1 %339, label %340, label %346

340:                                              ; preds = %336
  %341 = load ptr, ptr %31, align 8, !tbaa !5
  %342 = getelementptr inbounds i8, ptr %341, i64 0
  %343 = load i8, ptr %342, align 1, !tbaa !19
  %344 = load ptr, ptr %28, align 8, !tbaa !5
  %345 = getelementptr inbounds i8, ptr %344, i64 0
  store i8 %343, ptr %345, align 1, !tbaa !19
  br label %432

346:                                              ; preds = %336, %330
  %347 = load i32, ptr %12, align 4, !tbaa !12
  %348 = icmp eq i32 %347, 1
  br i1 %348, label %349, label %387

349:                                              ; preds = %346
  %350 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 2
  %351 = load i32, ptr %350, align 4, !tbaa !32
  %352 = icmp eq i32 %351, 4
  br i1 %352, label %353, label %387

353:                                              ; preds = %349
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #10
  store i32 0, ptr %32, align 4, !tbaa !12
  br label %354

354:                                              ; preds = %381, %353
  %355 = load i32, ptr %32, align 4, !tbaa !12
  %356 = icmp slt i32 %355, 3
  br i1 %356, label %358, label %357

357:                                              ; preds = %354
  store i32 14, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #10
  br label %384

358:                                              ; preds = %354
  %359 = load i8, ptr %20, align 1, !tbaa !15, !range !25, !noundef !26
  %360 = trunc i8 %359 to i1
  br i1 %360, label %361, label %365

361:                                              ; preds = %358
  %362 = load ptr, ptr %31, align 8, !tbaa !5
  %363 = getelementptr inbounds i8, ptr %362, i64 0
  %364 = load i8, ptr %363, align 1, !tbaa !19
  br label %375

365:                                              ; preds = %358
  %366 = load ptr, ptr %31, align 8, !tbaa !5
  %367 = getelementptr inbounds i8, ptr %366, i64 0
  %368 = load i8, ptr %367, align 1, !tbaa !19
  %369 = zext i8 %368 to i64
  %370 = getelementptr inbounds [256 x [3 x i8]], ptr %13, i64 0, i64 %369
  %371 = load i32, ptr %32, align 4, !tbaa !12
  %372 = sext i32 %371 to i64
  %373 = getelementptr inbounds [3 x i8], ptr %370, i64 0, i64 %372
  %374 = load i8, ptr %373, align 1, !tbaa !19
  br label %375

375:                                              ; preds = %365, %361
  %376 = phi i8 [ %364, %361 ], [ %374, %365 ]
  %377 = load ptr, ptr %28, align 8, !tbaa !5
  %378 = load i32, ptr %32, align 4, !tbaa !12
  %379 = sext i32 %378 to i64
  %380 = getelementptr inbounds i8, ptr %377, i64 %379
  store i8 %376, ptr %380, align 1, !tbaa !19
  br label %381

381:                                              ; preds = %375
  %382 = load i32, ptr %32, align 4, !tbaa !12
  %383 = add nsw i32 %382, 1
  store i32 %383, ptr %32, align 4, !tbaa !12
  br label %354, !llvm.loop !34

384:                                              ; preds = %357
  %385 = load ptr, ptr %28, align 8, !tbaa !5
  %386 = getelementptr inbounds i8, ptr %385, i64 3
  store i8 -1, ptr %386, align 1, !tbaa !19
  br label %431

387:                                              ; preds = %349, %346
  %388 = load i32, ptr %12, align 4, !tbaa !12
  %389 = icmp eq i32 %388, 3
  br i1 %389, label %393, label %390

390:                                              ; preds = %387
  %391 = load i32, ptr %12, align 4, !tbaa !12
  %392 = icmp eq i32 %391, 4
  br i1 %392, label %393, label %422

393:                                              ; preds = %390, %387
  %394 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 2
  %395 = load i32, ptr %394, align 4, !tbaa !32
  %396 = icmp eq i32 %395, 4
  br i1 %396, label %397, label %422

397:                                              ; preds = %393
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #10
  store i32 0, ptr %33, align 4, !tbaa !12
  br label %398

398:                                              ; preds = %412, %397
  %399 = load i32, ptr %33, align 4, !tbaa !12
  %400 = load i32, ptr %12, align 4, !tbaa !12
  %401 = icmp slt i32 %399, %400
  br i1 %401, label %402, label %415

402:                                              ; preds = %398
  %403 = load ptr, ptr %31, align 8, !tbaa !5
  %404 = load i32, ptr %33, align 4, !tbaa !12
  %405 = sext i32 %404 to i64
  %406 = getelementptr inbounds i8, ptr %403, i64 %405
  %407 = load i8, ptr %406, align 1, !tbaa !19
  %408 = load ptr, ptr %28, align 8, !tbaa !5
  %409 = load i32, ptr %33, align 4, !tbaa !12
  %410 = sext i32 %409 to i64
  %411 = getelementptr inbounds i8, ptr %408, i64 %410
  store i8 %407, ptr %411, align 1, !tbaa !19
  br label %412

412:                                              ; preds = %402
  %413 = load i32, ptr %33, align 4, !tbaa !12
  %414 = add nsw i32 %413, 1
  store i32 %414, ptr %33, align 4, !tbaa !12
  br label %398, !llvm.loop !35

415:                                              ; preds = %398
  %416 = load i32, ptr %33, align 4, !tbaa !12
  %417 = icmp eq i32 %416, 3
  br i1 %417, label %418, label %421

418:                                              ; preds = %415
  %419 = load ptr, ptr %28, align 8, !tbaa !5
  %420 = getelementptr inbounds i8, ptr %419, i64 3
  store i8 -1, ptr %420, align 1, !tbaa !19
  br label %421

421:                                              ; preds = %418, %415
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #10
  br label %430

422:                                              ; preds = %393, %390
  %423 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %424 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %423, ptr noundef @.str.6, ptr noundef %424)
          to label %425 unwind label %426

425:                                              ; preds = %422
  call void @__cxa_throw(ptr %423, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

426:                                              ; preds = %422
  %427 = landingpad { ptr, i32 }
          cleanup
  %428 = extractvalue { ptr, i32 } %427, 0
  store ptr %428, ptr %6, align 8
  %429 = extractvalue { ptr, i32 } %427, 1
  store i32 %429, ptr %7, align 4
  call void @__cxa_free_exception(ptr %423) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #10
  br label %446

430:                                              ; preds = %421
  br label %431

431:                                              ; preds = %430, %384
  br label %432

432:                                              ; preds = %431, %340
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #10
  br label %433

433:                                              ; preds = %432
  %434 = load i32, ptr %30, align 4, !tbaa !12
  %435 = add nsw i32 %434, 1
  store i32 %435, ptr %30, align 4, !tbaa !12
  %436 = getelementptr inbounds %struct.CShape, ptr %22, i32 0, i32 2
  %437 = load i32, ptr %436, align 4, !tbaa !32
  %438 = load ptr, ptr %28, align 8, !tbaa !5
  %439 = sext i32 %437 to i64
  %440 = getelementptr inbounds i8, ptr %438, i64 %439
  store ptr %440, ptr %28, align 8, !tbaa !5
  br label %324, !llvm.loop !36

441:                                              ; preds = %329
  br label %442

442:                                              ; preds = %441, %322
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #10
  br label %443

443:                                              ; preds = %442
  %444 = load i32, ptr %26, align 4, !tbaa !12
  %445 = add nsw i32 %444, 1
  store i32 %445, ptr %26, align 4, !tbaa !12
  br label %271, !llvm.loop !37

446:                                              ; preds = %426, %318
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #10
  br label %460

447:                                              ; preds = %276
  %448 = load ptr, ptr %5, align 8, !tbaa !5
  %449 = call i32 @fclose(ptr noundef %448)
  %450 = icmp ne i32 %449, 0
  br i1 %450, label %451, label %459

451:                                              ; preds = %447
  %452 = call ptr @__cxa_allocate_exception(i64 1032) #10
  %453 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %452, ptr noundef @.str.7, ptr noundef %453)
          to label %454 unwind label %455

454:                                              ; preds = %451
  call void @__cxa_throw(ptr %452, ptr @_ZTI6CError, ptr @_ZNSt9exceptionD2Ev) #11
  unreachable

455:                                              ; preds = %451
  %456 = landingpad { ptr, i32 }
          cleanup
  %457 = extractvalue { ptr, i32 } %456, 0
  store ptr %457, ptr %6, align 8
  %458 = extractvalue { ptr, i32 } %456, 1
  store i32 %458, ptr %7, align 4
  call void @__cxa_free_exception(ptr %452) #10
  br label %460

459:                                              ; preds = %447
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #10
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 768, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 18, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #10
  ret void

460:                                              ; preds = %455, %446
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #10
  call void @llvm.lifetime.end.p0(i64 12, ptr %22) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #10
  br label %461

461:                                              ; preds = %460, %200, %129
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 768, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #10
  br label %462

462:                                              ; preds = %461, %89, %55
  call void @llvm.lifetime.end.p0(i64 18, ptr %8) #10
  br label %463

463:                                              ; preds = %462, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #10
  br label %464

464:                                              ; preds = %463
  %465 = load ptr, ptr %6, align 8
  %466 = load i32, ptr %7, align 4
  %467 = insertvalue { ptr, i32 } poison, ptr %465, 0
  %468 = insertvalue { ptr, i32 } %467, i32 %466, 1
  resume { ptr, i32 } %468
}

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

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

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 #3 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 #4

declare void @__cxa_throw(ptr, ptr, ptr)

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #6

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CShapeC2Eiii(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8CImageOfIhE10ReAllocateE6CShapeb(ptr noundef nonnull align 8 dereferenceable(76), i64, i32, i1 noundef zeroext) #7 align 2

; 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) #8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9CTargaRLCC2Eb(ptr noundef nonnull align 4 dereferenceable(10), i1 noundef zeroext) unnamed_addr #3 align 2

; 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) #9 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10), i32 noundef, ptr noundef) #7 align 2

declare i32 @fclose(ptr noundef) #2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 = { nobuiltin allocsize(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 = { nobuiltin 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 #7 = { inlinehint 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #9 = { 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 #10 = { nounwind }
attributes #11 = { noreturn }
attributes #12 = { builtin allocsize(0) }
attributes #13 = { builtin 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, !7, i64 0}
!10 = !{!"_ZTS10CTargaHead", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 5, !7, i64 7, !11, i64 8, !11, i64 10, !11, i64 12, !11, i64 14, !7, i64 16, !7, i64 17}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !7, i64 17}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!10, !7, i64 16}
!18 = !{!10, !7, i64 1}
!19 = !{!7, !7, i64 0}
!20 = !{!10, !7, i64 7}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!10, !7, i64 2}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = !{!10, !11, i64 12}
!28 = !{!10, !11, i64 14}
!29 = !{i64 0, i64 4, !12, i64 4, i64 4, !12, i64 8, i64 4, !12}
!30 = !{!31, !13, i64 4}
!31 = !{!"_ZTS6CShape", !13, i64 0, !13, i64 4, !13, i64 8}
!32 = !{!31, !13, i64 8}
!33 = !{!31, !13, i64 0}
!34 = distinct !{!34, !22}
!35 = distinct !{!35, !22}
!36 = distinct !{!36, !22}
!37 = distinct !{!37, !22}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.CTargaHead = type { i8, i8, i8, [2 x i8], [2 x i8], i8, i16, i16, i16, i16, i8, i8 }
%struct.CShape = type { i32, i32, i32 }
%class.CTargaRLC = type <{ i32, i8, i8, [4 x i8], [2 x i8] }>

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@_ZTI6CError = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.2 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11ReadFileTGAR8CImageOfIhEPKc(ptr noundef nonnull align 8 dereferenceable(76) %0, ptr noundef %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.CTargaHead, align 2
  %4 = alloca [256 x [3 x i8]], align 16
  %5 = alloca %struct.CShape, align 8
  %6 = alloca %class.CTargaRLC, align 4
  %7 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str)
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %11

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

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 18, ptr nonnull %3) #9
  %12 = call i64 @fread(ptr noundef nonnull %3, i64 noundef 18, i64 noundef 1, ptr noundef nonnull %7)
  %13 = and i64 %12, 4294967295
  %.not = icmp eq i64 %13, 1
  br i1 %.not, label %16, label %14

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

16:                                               ; preds = %11
  %17 = load i8, ptr %3, align 2, !tbaa !5
  %.not112 = icmp eq i8 %17, 0
  br i1 %.not112, label %26, label %18

18:                                               ; preds = %16
  %19 = zext i8 %17 to i64
  %20 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %19) #11
  %21 = tail call i64 @fread(ptr noundef nonnull %20, i64 noundef 1, i64 noundef %19, ptr noundef nonnull %7)
  %22 = trunc i64 %21 to i32
  tail call void @_ZdlPvm(ptr noundef nonnull %20, i64 noundef 1) #12
  %23 = zext i8 %17 to i32
  %.not113 = icmp eq i32 %22, %23
  br i1 %.not113, label %26, label %24

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

26:                                               ; preds = %18, %16
  %27 = getelementptr inbounds i8, ptr %3, i64 17
  %28 = load i8, ptr %27, align 1, !tbaa !10
  %.fr194 = freeze i8 %28
  %29 = and i8 %.fr194, 32
  %.not114 = icmp eq i8 %29, 0
  %30 = getelementptr inbounds i8, ptr %3, i64 16
  %31 = load i8, ptr %30, align 2, !tbaa !11
  %.fr = freeze i8 %31
  %32 = zext i8 %.fr to i32
  %33 = add nuw nsw i32 %32, 7
  %34 = lshr i32 %33, 3
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %4) #9
  %35 = getelementptr inbounds i8, ptr %3, i64 1
  %36 = load i8, ptr %35, align 1, !tbaa !12
  %37 = icmp eq i8 %36, 1
  br i1 %37, label %38, label %.thread

38:                                               ; preds = %26
  %39 = getelementptr inbounds i8, ptr %3, i64 7
  %40 = load i8, ptr %39, align 1, !tbaa !13
  %.not115 = icmp eq i8 %40, 24
  br i1 %.not115, label %43, label %41

41:                                               ; preds = %38
  %42 = tail call ptr @__cxa_allocate_exception(i64 1032) #9
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %42, ptr noundef nonnull @.str.3, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %42, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

43:                                               ; preds = %38
  %44 = getelementptr inbounds i8, ptr %3, i64 6
  %45 = load i8, ptr %44, align 2, !tbaa !14
  %46 = zext i8 %45 to i32
  %47 = shl nuw nsw i32 %46, 8
  %48 = getelementptr inbounds i8, ptr %3, i64 5
  %49 = load i8, ptr %48, align 1, !tbaa !14
  %50 = zext i8 %49 to i32
  %51 = or disjoint i32 %47, %50
  %52 = mul nuw nsw i32 %51, %34
  %53 = icmp ugt i32 %52, 768
  br i1 %53, label %54, label %56

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

56:                                               ; preds = %43
  %57 = zext nneg i32 %52 to i64
  %58 = call i64 @fread(ptr noundef nonnull %4, i64 noundef 1, i64 noundef %57, ptr noundef nonnull %7)
  %59 = trunc i64 %58 to i32
  %.not116 = icmp eq i32 %52, %59
  br i1 %.not116, label %.thread, label %60

60:                                               ; preds = %56
  %61 = tail call ptr @__cxa_allocate_exception(i64 1032) #9
  tail call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %61, ptr noundef nonnull @.str.5, ptr noundef %1)
  tail call void @__cxa_throw(ptr nonnull %61, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

.thread:                                          ; preds = %56, %26
  %.sink257 = phi i8 [ -9, %26 ], [ -11, %56 ]
  %.sink255 = phi i8 [ 3, %26 ], [ 1, %56 ]
  %62 = getelementptr inbounds i8, ptr %3, i64 2
  %63 = load i8, ptr %62, align 2
  %.fr259 = freeze i8 %63
  %64 = and i8 %.fr259, %.sink257
  %spec.select = icmp eq i8 %64, %.sink255
  %65 = and i8 %.fr259, -2
  %or.cond7 = icmp ne i8 %65, 2
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %5) #9
  %66 = getelementptr inbounds i8, ptr %3, i64 12
  %67 = load i16, ptr %66, align 2, !tbaa !15
  %68 = sext i16 %67 to i32
  %69 = getelementptr inbounds i8, ptr %3, i64 14
  %70 = load i16, ptr %69, align 2, !tbaa !16
  %71 = sext i16 %70 to i32
  %72 = select i1 %spec.select, i32 1, i32 4
  call void @_ZN6CShapeC2Eiii(ptr noundef nonnull align 4 dereferenceable(12) %5, i32 noundef %68, i32 noundef %71, i32 noundef %72)
  %.sroa.046.0.copyload = load i64, ptr %5, align 8
  %.sroa.247.0..sroa_idx = getelementptr inbounds i8, ptr %5, i64 8
  %.sroa.247.0.copyload = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !17
  call void @_ZN8CImageOfIhE10ReAllocateE6CShapeb(ptr noundef nonnull align 8 dereferenceable(76) %0, i64 %.sroa.046.0.copyload, i32 %.sroa.247.0.copyload, i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #9
  call void @_ZN9CTargaRLCC2Eb(ptr noundef nonnull align 4 dereferenceable(10) %6, i1 noundef zeroext %or.cond7)
  %73 = getelementptr inbounds i8, ptr %5, i64 4
  %74 = load i32, ptr %73, align 4, !tbaa !19
  %75 = icmp sgt i32 %74, 0
  br i1 %75, label %.lr.ph149, label %._crit_edge150

.lr.ph149:                                        ; preds = %.thread
  %76 = icmp eq i32 %34, 1
  %.not189 = icmp eq i8 %.fr, 0
  br i1 %76, label %.lr.ph149.split.us, label %.lr.ph149.split

.lr.ph149.split.us:                               ; preds = %.lr.ph149, %.loopexit.us
  %77 = phi i32 [ %90, %.loopexit.us ], [ %74, %.lr.ph149 ]
  %.0104147.us = phi i32 [ %89, %.loopexit.us ], [ 0, %.lr.ph149 ]
  %78 = xor i32 %.0104147.us, -1
  %79 = add i32 %77, %78
  %80 = select i1 %.not114, i32 %.0104147.us, i32 %79
  %81 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %80, i32 noundef 0)
  %82 = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !21
  %83 = icmp ne i32 %82, 1
  %brmerge121.us = or i1 %83, %or.cond7
  %84 = load i32, ptr %5, align 8, !tbaa !22
  br i1 %brmerge121.us, label %.preheader127.us, label %85

85:                                               ; preds = %.lr.ph149.split.us
  %86 = sext i32 %84 to i64
  %87 = call i64 @fread(ptr noundef %81, i64 noundef 1, i64 noundef %86, ptr noundef nonnull %7)
  %88 = trunc i64 %87 to i32
  %.not118.us = icmp eq i32 %84, %88
  br i1 %.not118.us, label %.loopexit.us, label %.split160.us

.loopexit.us:                                     ; preds = %111, %128, %.preheader127.us, %85
  %89 = add nuw nsw i32 %.0104147.us, 1
  %90 = load i32, ptr %73, align 4, !tbaa !19
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %.lr.ph149.split.us, label %._crit_edge150, !llvm.loop !23

.lr.ph138.split.us158.split:                      ; preds = %.lr.ph138.us, %111
  %.0100137.us151 = phi i32 [ %112, %111 ], [ 0, %.lr.ph138.us ]
  %.0102136.us152 = phi ptr [ %115, %111 ], [ %81, %.lr.ph138.us ]
  %92 = call noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10) %6, i32 noundef 1, ptr noundef nonnull %7)
  %93 = load i32, ptr %.sroa.247.0..sroa_idx, align 8
  switch i32 %93, label %.split140.us [
    i32 1, label %109
    i32 4, label %.preheader.us.preheader
  ]

.preheader.us.preheader:                          ; preds = %.lr.ph138.split.us158.split
  %94 = load i8, ptr %92, align 1, !tbaa !14
  %95 = zext i8 %94 to i64
  %96 = getelementptr inbounds [256 x [3 x i8]], ptr %4, i64 0, i64 %95, i64 0
  %97 = load i8, ptr %96, align 1, !tbaa !14
  store i8 %97, ptr %.0102136.us152, align 1, !tbaa !14
  %98 = load i8, ptr %92, align 1, !tbaa !14
  %99 = zext i8 %98 to i64
  %100 = getelementptr inbounds [256 x [3 x i8]], ptr %4, i64 0, i64 %99, i64 1
  %101 = load i8, ptr %100, align 1, !tbaa !14
  %102 = getelementptr inbounds i8, ptr %.0102136.us152, i64 1
  store i8 %101, ptr %102, align 1, !tbaa !14
  %103 = load i8, ptr %92, align 1, !tbaa !14
  %104 = zext i8 %103 to i64
  %105 = getelementptr inbounds [256 x [3 x i8]], ptr %4, i64 0, i64 %104, i64 2
  %106 = load i8, ptr %105, align 1, !tbaa !14
  %107 = getelementptr inbounds i8, ptr %.0102136.us152, i64 2
  store i8 %106, ptr %107, align 1, !tbaa !14
  %108 = getelementptr inbounds i8, ptr %.0102136.us152, i64 3
  store i8 -1, ptr %108, align 1, !tbaa !14
  br label %111

109:                                              ; preds = %.lr.ph138.split.us158.split
  %110 = load i8, ptr %92, align 1, !tbaa !14
  store i8 %110, ptr %.0102136.us152, align 1, !tbaa !14
  br label %111

111:                                              ; preds = %.preheader.us.preheader, %109
  %112 = add nuw nsw i32 %.0100137.us151, 1
  %113 = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !21
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i8, ptr %.0102136.us152, i64 %114
  %116 = load i32, ptr %5, align 8, !tbaa !22
  %117 = icmp slt i32 %112, %116
  br i1 %117, label %.lr.ph138.split.us158.split, label %.loopexit.us, !llvm.loop !25

.preheader127.us:                                 ; preds = %.lr.ph149.split.us
  %118 = icmp sgt i32 %84, 0
  br i1 %118, label %.lr.ph138.us, label %.loopexit.us

.lr.ph138.us:                                     ; preds = %.preheader127.us
  br i1 %spec.select, label %.lr.ph138.split.us158.split.us, label %.lr.ph138.split.us158.split

.lr.ph138.split.us158.split.us:                   ; preds = %.lr.ph138.us, %128
  %.0100137.us151.us = phi i32 [ %129, %128 ], [ 0, %.lr.ph138.us ]
  %.0102136.us152.us = phi ptr [ %132, %128 ], [ %81, %.lr.ph138.us ]
  %119 = call noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10) %6, i32 noundef 1, ptr noundef nonnull %7)
  %120 = load i32, ptr %.sroa.247.0..sroa_idx, align 8
  switch i32 %120, label %.split140.us [
    i32 1, label %126
    i32 4, label %.preheader.us.us.preheader
  ]

.preheader.us.us.preheader:                       ; preds = %.lr.ph138.split.us158.split.us
  %121 = load i8, ptr %119, align 1, !tbaa !14
  store i8 %121, ptr %.0102136.us152.us, align 1, !tbaa !14
  %122 = getelementptr inbounds i8, ptr %.0102136.us152.us, i64 1
  store i8 %121, ptr %122, align 1, !tbaa !14
  %123 = load i8, ptr %119, align 1, !tbaa !14
  %124 = getelementptr inbounds i8, ptr %.0102136.us152.us, i64 2
  store i8 %123, ptr %124, align 1, !tbaa !14
  %125 = getelementptr inbounds i8, ptr %.0102136.us152.us, i64 3
  store i8 -1, ptr %125, align 1, !tbaa !14
  br label %128

126:                                              ; preds = %.lr.ph138.split.us158.split.us
  %127 = load i8, ptr %119, align 1, !tbaa !14
  store i8 %127, ptr %.0102136.us152.us, align 1, !tbaa !14
  br label %128

128:                                              ; preds = %.preheader.us.us.preheader, %126
  %129 = add nuw nsw i32 %.0100137.us151.us, 1
  %130 = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !21
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i8, ptr %.0102136.us152.us, i64 %131
  %133 = load i32, ptr %5, align 8, !tbaa !22
  %134 = icmp slt i32 %129, %133
  br i1 %134, label %.lr.ph138.split.us158.split.us, label %.loopexit.us, !llvm.loop !25

.lr.ph149.split:                                  ; preds = %.lr.ph149
  %135 = add nsw i32 %34, -3
  %or.cond15 = icmp ult i32 %135, 2
  br i1 %or.cond15, label %.lr.ph149.split.split.us.preheader, label %.lr.ph149.split.split

.lr.ph149.split.split.us.preheader:               ; preds = %.lr.ph149.split
  %wide.trip.count = zext nneg i32 %34 to i64
  %136 = icmp eq i32 %34, 3
  %137 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i8 %.fr, 57
  %xtraiter = and i64 %wide.trip.count, 3
  %138 = icmp ult i64 %137, 3
  %unroll_iter = and i64 %wide.trip.count, 4
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph149.split.split.us

.lr.ph149.split.split.us:                         ; preds = %.lr.ph149.split.split.us.preheader, %.loopexit.us165
  %139 = phi i32 [ %153, %.loopexit.us165 ], [ %74, %.lr.ph149.split.split.us.preheader ]
  %.0104147.us161 = phi i32 [ %152, %.loopexit.us165 ], [ 0, %.lr.ph149.split.split.us.preheader ]
  %140 = xor i32 %.0104147.us161, -1
  %141 = add i32 %139, %140
  %142 = select i1 %.not114, i32 %.0104147.us161, i32 %141
  %143 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %142, i32 noundef 0)
  %144 = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !21
  %145 = icmp ne i32 %34, %144
  %brmerge121.us162 = or i1 %145, %or.cond7
  %146 = load i32, ptr %5, align 8, !tbaa !22
  br i1 %brmerge121.us162, label %.preheader127.us164, label %147

147:                                              ; preds = %.lr.ph149.split.split.us
  %148 = mul nsw i32 %146, %34
  %149 = sext i32 %148 to i64
  %150 = call i64 @fread(ptr noundef %143, i64 noundef 1, i64 noundef %149, ptr noundef nonnull %7)
  %151 = trunc i64 %150 to i32
  %.not118.us163 = icmp eq i32 %148, %151
  br i1 %.not118.us163, label %.loopexit.us165, label %.split160.us

.loopexit.us165:                                  ; preds = %185, %.preheader126.us.us169, %.preheader127.us164, %147
  %152 = add nuw nsw i32 %.0104147.us161, 1
  %153 = load i32, ptr %73, align 4, !tbaa !19
  %154 = icmp slt i32 %152, %153
  br i1 %154, label %.lr.ph149.split.split.us, label %._crit_edge150, !llvm.loop !23

.preheader127.us164:                              ; preds = %.lr.ph149.split.split.us
  %155 = icmp sgt i32 %146, 0
  br i1 %155, label %.lr.ph138.us166, label %.loopexit.us165

.lr.ph138.us166:                                  ; preds = %.preheader127.us164
  br i1 %.not189, label %.lr.ph138.split.us.split.split.us172, label %.lr.ph138.split.us.split.split.us.us

.lr.ph138.split.us.split.split.us172:             ; preds = %.lr.ph138.us166, %.preheader126.us.us169
  %.0100137.us.us167 = phi i32 [ %159, %.preheader126.us.us169 ], [ 0, %.lr.ph138.us166 ]
  %156 = call noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10) %6, i32 noundef %34, ptr noundef nonnull %7)
  %157 = load i32, ptr %.sroa.247.0..sroa_idx, align 8
  %158 = icmp eq i32 %157, 4
  br i1 %158, label %.preheader126.us.us169, label %.split140.us

.preheader126.us.us169:                           ; preds = %.lr.ph138.split.us.split.split.us172
  %159 = add nuw nsw i32 %.0100137.us.us167, 1
  %160 = load i32, ptr %5, align 8, !tbaa !22
  %161 = icmp slt i32 %159, %160
  br i1 %161, label %.lr.ph138.split.us.split.split.us172, label %.loopexit.us165, !llvm.loop !25

.lr.ph138.split.us.split.split.us.us:             ; preds = %.lr.ph138.us166, %185
  %.0100137.us.us144.us = phi i32 [ %186, %185 ], [ 0, %.lr.ph138.us166 ]
  %.0102136.us.us145.us = phi ptr [ %189, %185 ], [ %143, %.lr.ph138.us166 ]
  %162 = call noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10) %6, i32 noundef %34, ptr noundef nonnull %7)
  %163 = load i32, ptr %.sroa.247.0..sroa_idx, align 8
  %164 = icmp eq i32 %163, 4
  br i1 %164, label %iter.check, label %.split140.us

iter.check:                                       ; preds = %.lr.ph138.split.us.split.split.us.us
  %165 = ptrtoint ptr %162 to i64
  %.0102136.us.us145.us247 = ptrtoint ptr %.0102136.us.us145.us to i64
  %166 = sub i64 %.0102136.us.us145.us247, %165
  %diff.check = icmp ult i64 %166, 16
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %.preheader126.us.us.us.preheader, label %vector.main.loop.iter.check

.preheader126.us.us.us.preheader:                 ; preds = %iter.check
  br i1 %138, label %._crit_edge133.us.us.us.unr-lcssa, label %.preheader126.us.us.us

vector.main.loop.iter.check:                      ; preds = %iter.check
  %min.iters.check248 = icmp ult i8 %.fr, 121
  br i1 %min.iters.check248, label %vec.epilog.vector.body, label %vector.body

vector.body:                                      ; preds = %vector.main.loop.iter.check, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.main.loop.iter.check ]
  %167 = getelementptr inbounds i8, ptr %162, i64 %index
  %wide.load = load <16 x i8>, ptr %167, align 1, !tbaa !14
  %168 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %index
  store <16 x i8> %wide.load, ptr %168, align 1, !tbaa !14
  %index.next = add nuw i64 %index, 16
  br label %vector.body, !llvm.loop !26

vec.epilog.vector.body:                           ; preds = %vector.main.loop.iter.check, %vec.epilog.vector.body
  %index251 = phi i64 [ %index.next253, %vec.epilog.vector.body ], [ 0, %vector.main.loop.iter.check ]
  %169 = getelementptr inbounds i8, ptr %162, i64 %index251
  %wide.load252 = load <8 x i8>, ptr %169, align 1, !tbaa !14
  %170 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %index251
  store <8 x i8> %wide.load252, ptr %170, align 1, !tbaa !14
  %index.next253 = add nuw i64 %index251, 8
  br label %vec.epilog.vector.body, !llvm.loop !29

171:                                              ; preds = %._crit_edge133.us.us.us
  %172 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 3
  store i8 -1, ptr %172, align 1, !tbaa !14
  br label %185

.preheader126.us.us.us:                           ; preds = %.preheader126.us.us.us.preheader, %.preheader126.us.us.us
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.preheader126.us.us.us ], [ 0, %.preheader126.us.us.us.preheader ]
  %niter = phi i64 [ %niter.next.3, %.preheader126.us.us.us ], [ 0, %.preheader126.us.us.us.preheader ]
  %173 = getelementptr inbounds i8, ptr %162, i64 %indvars.iv
  %174 = load i8, ptr %173, align 1, !tbaa !14
  %175 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %indvars.iv
  store i8 %174, ptr %175, align 1, !tbaa !14
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %176 = getelementptr inbounds i8, ptr %162, i64 %indvars.iv.next
  %177 = load i8, ptr %176, align 1, !tbaa !14
  %178 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %indvars.iv.next
  store i8 %177, ptr %178, align 1, !tbaa !14
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %179 = getelementptr inbounds i8, ptr %162, i64 %indvars.iv.next.1
  %180 = load i8, ptr %179, align 1, !tbaa !14
  %181 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %indvars.iv.next.1
  store i8 %180, ptr %181, align 1, !tbaa !14
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %182 = getelementptr inbounds i8, ptr %162, i64 %indvars.iv.next.2
  %183 = load i8, ptr %182, align 1, !tbaa !14
  %184 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %indvars.iv.next.2
  store i8 %183, ptr %184, align 1, !tbaa !14
  %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 %._crit_edge133.us.us.us.unr-lcssa, label %.preheader126.us.us.us, !llvm.loop !30

185:                                              ; preds = %._crit_edge133.us.us.us, %171
  %186 = add nuw nsw i32 %.0100137.us.us144.us, 1
  %187 = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !21
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %188
  %190 = load i32, ptr %5, align 8, !tbaa !22
  %191 = icmp slt i32 %186, %190
  br i1 %191, label %.lr.ph138.split.us.split.split.us.us, label %.loopexit.us165, !llvm.loop !25

._crit_edge133.us.us.us.unr-lcssa:                ; preds = %.preheader126.us.us.us, %.preheader126.us.us.us.preheader
  %indvars.iv.unr = phi i64 [ 0, %.preheader126.us.us.us.preheader ], [ %indvars.iv.next.3, %.preheader126.us.us.us ]
  br i1 %lcmp.mod.not, label %._crit_edge133.us.us.us, label %.preheader126.us.us.us.epil

.preheader126.us.us.us.epil:                      ; preds = %._crit_edge133.us.us.us.unr-lcssa, %.preheader126.us.us.us.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.preheader126.us.us.us.epil ], [ %indvars.iv.unr, %._crit_edge133.us.us.us.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader126.us.us.us.epil ], [ 0, %._crit_edge133.us.us.us.unr-lcssa ]
  %192 = getelementptr inbounds i8, ptr %162, i64 %indvars.iv.epil
  %193 = load i8, ptr %192, align 1, !tbaa !14
  %194 = getelementptr inbounds i8, ptr %.0102136.us.us145.us, i64 %indvars.iv.epil
  store i8 %193, ptr %194, align 1, !tbaa !14
  %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 %._crit_edge133.us.us.us, label %.preheader126.us.us.us.epil, !llvm.loop !31

._crit_edge133.us.us.us:                          ; preds = %.preheader126.us.us.us.epil, %._crit_edge133.us.us.us.unr-lcssa
  br i1 %136, label %171, label %185

.lr.ph149.split.split:                            ; preds = %.lr.ph149.split
  br i1 %or.cond7, label %.lr.ph149.split.split.split.us, label %.lr.ph149.split.split.split

.lr.ph149.split.split.split.us:                   ; preds = %.lr.ph149.split.split
  br i1 %.not114, label %.preheader127.us177.us, label %.preheader127.us177

.preheader127.us177.us:                           ; preds = %.lr.ph149.split.split.split.us, %.loopexit.us178.us
  %.0104147.us175.us = phi i32 [ %198, %.loopexit.us178.us ], [ 0, %.lr.ph149.split.split.split.us ]
  %195 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %.0104147.us175.us, i32 noundef 0)
  %196 = load i32, ptr %5, align 8, !tbaa !22
  %197 = icmp sgt i32 %196, 0
  br i1 %197, label %.lr.ph138.split.us.split.us, label %.loopexit.us178.us

.loopexit.us178.us:                               ; preds = %.preheader127.us177.us
  %198 = add nuw nsw i32 %.0104147.us175.us, 1
  %199 = load i32, ptr %73, align 4, !tbaa !19
  %200 = icmp slt i32 %198, %199
  br i1 %200, label %.preheader127.us177.us, label %._crit_edge150, !llvm.loop !23

.preheader127.us177:                              ; preds = %.lr.ph149.split.split.split.us, %.loopexit.us178
  %201 = phi i32 [ %208, %.loopexit.us178 ], [ %74, %.lr.ph149.split.split.split.us ]
  %.0104147.us175 = phi i32 [ %207, %.loopexit.us178 ], [ 0, %.lr.ph149.split.split.split.us ]
  %202 = xor i32 %.0104147.us175, -1
  %203 = add i32 %201, %202
  %204 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %203, i32 noundef 0)
  %205 = load i32, ptr %5, align 8, !tbaa !22
  %206 = icmp sgt i32 %205, 0
  br i1 %206, label %.lr.ph138.split.us.split.us, label %.loopexit.us178

.loopexit.us178:                                  ; preds = %.preheader127.us177
  %207 = add nuw nsw i32 %.0104147.us175, 1
  %208 = load i32, ptr %73, align 4, !tbaa !19
  %209 = icmp slt i32 %207, %208
  br i1 %209, label %.preheader127.us177, label %._crit_edge150, !llvm.loop !23

._crit_edge150:                                   ; preds = %.loopexit, %.loopexit.us178, %.loopexit.us178.us, %.loopexit.us165, %.loopexit.us, %.thread
  %210 = call i32 @fclose(ptr noundef nonnull %7)
  %.not117 = icmp eq i32 %210, 0
  br i1 %.not117, label %232, label %230

.lr.ph149.split.split.split:                      ; preds = %.lr.ph149.split.split, %.loopexit
  %211 = phi i32 [ %228, %.loopexit ], [ %74, %.lr.ph149.split.split ]
  %.0104147 = phi i32 [ %227, %.loopexit ], [ 0, %.lr.ph149.split.split ]
  %212 = xor i32 %.0104147, -1
  %213 = add i32 %211, %212
  %214 = select i1 %.not114, i32 %.0104147, i32 %213
  %215 = call noundef ptr @_ZN6CImage12PixelAddressEiii(ptr noundef nonnull align 8 dereferenceable(76) %0, i32 noundef 0, i32 noundef %214, i32 noundef 0)
  %216 = load i32, ptr %.sroa.247.0..sroa_idx, align 8, !tbaa !21
  %.not192 = icmp eq i32 %34, %216
  %217 = load i32, ptr %5, align 8, !tbaa !22
  br i1 %.not192, label %220, label %.preheader127

.preheader127:                                    ; preds = %.lr.ph149.split.split.split
  %218 = icmp sgt i32 %217, 0
  br i1 %218, label %.lr.ph138.split.us.split.us, label %.loopexit

.lr.ph138.split.us.split.us:                      ; preds = %.preheader127, %.preheader127.us177, %.preheader127.us177.us
  %219 = call noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10) %6, i32 noundef %34, ptr noundef nonnull %7)
  br label %.split140.us

220:                                              ; preds = %.lr.ph149.split.split.split
  %221 = mul nsw i32 %217, %34
  %222 = sext i32 %221 to i64
  %223 = call i64 @fread(ptr noundef %215, i64 noundef 1, i64 noundef %222, ptr noundef nonnull %7)
  %224 = trunc i64 %223 to i32
  %.not118 = icmp eq i32 %221, %224
  br i1 %.not118, label %.loopexit, label %.split160.us

.split160.us:                                     ; preds = %220, %147, %85
  %225 = call ptr @__cxa_allocate_exception(i64 1032) #9
  call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %225, ptr noundef nonnull @.str.2, ptr noundef %1)
  call void @__cxa_throw(ptr nonnull %225, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

.split140.us:                                     ; preds = %.lr.ph138.split.us.split.split.us.us, %.lr.ph138.split.us.split.split.us172, %.lr.ph138.split.us158.split, %.lr.ph138.split.us158.split.us, %.lr.ph138.split.us.split.us
  %226 = call ptr @__cxa_allocate_exception(i64 1032) #9
  call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %226, ptr noundef nonnull @.str.6, ptr noundef %1)
  call void @__cxa_throw(ptr nonnull %226, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

.loopexit:                                        ; preds = %.preheader127, %220
  %227 = add nuw nsw i32 %.0104147, 1
  %228 = load i32, ptr %73, align 4, !tbaa !19
  %229 = icmp slt i32 %227, %228
  br i1 %229, label %.lr.ph149.split.split.split, label %._crit_edge150, !llvm.loop !23

230:                                              ; preds = %._crit_edge150
  %231 = call ptr @__cxa_allocate_exception(i64 1032) #9
  call void @_ZN6CErrorC2EPKcS1_(ptr noundef nonnull align 8 dereferenceable(1032) %231, ptr noundef nonnull @.str.7, ptr noundef %1)
  call void @__cxa_throw(ptr nonnull %231, ptr nonnull @_ZTI6CError, ptr nonnull @_ZNSt9exceptionD2Ev) #10
  unreachable

232:                                              ; preds = %._crit_edge150
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 18, ptr nonnull %3) #9
  ret void
}

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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 #3 align 2

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6CShapeC2Eiii(ptr noundef nonnull align 4 dereferenceable(12), i32 noundef, i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8CImageOfIhE10ReAllocateE6CShapeb(ptr noundef nonnull align 8 dereferenceable(76), i64, i32, i1 noundef zeroext) local_unnamed_addr #7 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9CTargaRLCC2Eb(ptr noundef nonnull align 4 dereferenceable(10), i1 noundef zeroext) unnamed_addr #3 align 2

; 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 #8 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZN9CTargaRLC8getBytesEiP8_IO_FILE(ptr noundef nonnull align 4 dereferenceable(10), i32 noundef, ptr noundef) local_unnamed_addr #7 align 2

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "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 = { nobuiltin allocsize(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 = { nobuiltin 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 #7 = { inlinehint 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 = { 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 #9 = { nounwind }
attributes #10 = { noreturn }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { builtin 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 = !{!"_ZTS10CTargaHead", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 5, !7, i64 7, !9, i64 8, !9, i64 10, !9, i64 12, !9, i64 14, !7, i64 16, !7, i64 17}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"short", !7, i64 0}
!10 = !{!6, !7, i64 17}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 1}
!13 = !{!6, !7, i64 7}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !9, i64 12}
!16 = !{!6, !9, i64 14}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!20, !18, i64 4}
!20 = !{!"_ZTS6CShape", !18, i64 0, !18, i64 4, !18, i64 8}
!21 = !{!20, !18, i64 8}
!22 = !{!20, !18, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = distinct !{!26, !24, !27, !28}
!27 = !{!"llvm.loop.isvectorized", i32 1}
!28 = !{!"llvm.loop.unroll.runtime.disable"}
!29 = distinct !{!29, !24, !27, !28}
!30 = distinct !{!30, !24, !27}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.unroll.disable"}


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