; LLVM IR from Try/Tempest :: Engine/thirdparty/libpng (pngrutil)

; 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.png_struct_def = type { [1 x %struct.__jmp_buf_tag], ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, i32, %struct.z_stream_s, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, ptr, ptr, ptr, ptr, i64, i32, i32, ptr, i16, i32, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, i32, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_color_8_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i64, i64, i64, i32, i32, ptr, ptr, i32, [29 x i8], i32, ptr, ptr, i32, i32, ptr, i8, i8, i16, i16, i32, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i32, i32, i32, i64, %struct.png_unknown_chunk_t, i64, ptr, i64, i32, i32, ptr, [4 x ptr], %struct.png_colorspace }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.z_stream_s = type { ptr, i32, i64, ptr, i32, i64, ptr, ptr, ptr, ptr, ptr, i32, i64, i64 }
%struct.png_color_8_struct = type { i8, i8, i8, i8, i8 }
%struct.png_color_16_struct = type { i8, i16, i16, i16, i16 }
%struct.png_unknown_chunk_t = type { [5 x i8], ptr, i64, i8 }
%struct.png_colorspace = type { i32, %struct.png_xy, %struct.png_XYZ, i16, i16 }
%struct.png_xy = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_XYZ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.png_info_def = type { i32, i32, i32, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], %struct.png_colorspace, ptr, ptr, i32, i32, i32, ptr, %struct.png_time_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, %struct.png_color_16_struct, i32, i32, i8, i32, i32, i8, i32, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, i8, i8, i32, ptr, i32, ptr, i32, i8, ptr, ptr, ptr }
%struct.png_time_struct = type { i16, i8, i8, i8, i8, i8 }

@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [13 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @png_crc_read(ptr noalias noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @png_crc_finish(ptr noalias noundef, i32 noundef) #1

; Function Attrs: noreturn
declare void @png_chunk_error(ptr noundef, ptr noundef) #2

declare void @png_chunk_benign_error(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden ptr @png_read_buffer(ptr noalias noundef, i64 noundef, i32 noundef) #1

declare noalias ptr @png_malloc_warn(ptr noundef, i64 noundef) #3

declare void @png_free(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_pCAL(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 15
  %20 = load i32, ptr %19, align 4, !tbaa !11
  %21 = and i32 %20, 1
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %3
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %24, ptr noundef @.str.7) #5
  unreachable

25:                                               ; preds = %3
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.png_struct_def, ptr %26, i32 0, i32 15
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = and i32 %28, 4
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %36

31:                                               ; preds = %25
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = call i32 @png_crc_finish(ptr noundef %32, i32 noundef %33)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %35, ptr noundef @.str.5)
  store i32 1, ptr %17, align 4
  br label %352

36:                                               ; preds = %25
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %50

39:                                               ; preds = %36
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.png_info_def, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !22
  %43 = and i32 %42, 1024
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %50

45:                                               ; preds = %39
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load i32, ptr %6, align 4, !tbaa !9
  %48 = call i32 @png_crc_finish(ptr noundef %46, i32 noundef %47)
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %49, ptr noundef @.str.8)
  store i32 1, ptr %17, align 4
  br label %352

50:                                               ; preds = %39, %36
  br label %51

51:                                               ; preds = %50
  br label %52

52:                                               ; preds = %51
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = load i32, ptr %6, align 4, !tbaa !9
  %55 = add i32 %54, 1
  %56 = zext i32 %55 to i64
  %57 = call ptr @png_read_buffer(ptr noundef %53, i64 noundef %56, i32 noundef 2)
  store ptr %57, ptr %11, align 8, !tbaa !5
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %65

60:                                               ; preds = %52
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = call i32 @png_crc_finish(ptr noundef %61, i32 noundef %62)
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %64, ptr noundef @.str.17)
  store i32 1, ptr %17, align 4
  br label %352

65:                                               ; preds = %52
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = load i32, ptr %6, align 4, !tbaa !9
  call void @png_crc_read(ptr noundef %66, ptr noundef %67, i32 noundef %68)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = call i32 @png_crc_finish(ptr noundef %69, i32 noundef 0)
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  store i32 1, ptr %17, align 4
  br label %352

73:                                               ; preds = %65
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = load i32, ptr %6, align 4, !tbaa !9
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds i8, ptr %74, i64 %76
  store i8 0, ptr %77, align 1, !tbaa !25
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %78, ptr %12, align 8, !tbaa !5
  br label %79

79:                                               ; preds = %84, %73
  %80 = load ptr, ptr %12, align 8, !tbaa !5
  %81 = load i8, ptr %80, align 1, !tbaa !25
  %82 = icmp ne i8 %81, 0
  br i1 %82, label %83, label %87

83:                                               ; preds = %79
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i32 1
  store ptr %86, ptr %12, align 8, !tbaa !5
  br label %79, !llvm.loop !26

87:                                               ; preds = %79
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = zext i32 %89 to i64
  %91 = getelementptr inbounds i8, ptr %88, i64 %90
  store ptr %91, ptr %14, align 8, !tbaa !5
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = ptrtoint ptr %92 to i64
  %95 = ptrtoint ptr %93 to i64
  %96 = sub i64 %94, %95
  %97 = icmp sle i64 %96, 12
  br i1 %97, label %98, label %100

98:                                               ; preds = %87
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %99, ptr noundef @.str.6)
  store i32 1, ptr %17, align 4
  br label %352

100:                                              ; preds = %87
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = getelementptr inbounds i8, ptr %101, i64 1
  %103 = load i8, ptr %102, align 1, !tbaa !25
  %104 = zext i8 %103 to i32
  %105 = and i32 %104, 128
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %137

107:                                              ; preds = %100
  %108 = load ptr, ptr %12, align 8, !tbaa !5
  %109 = getelementptr inbounds i8, ptr %108, i64 1
  %110 = load i8, ptr %109, align 1, !tbaa !25
  %111 = zext i8 %110 to i32
  %112 = shl i32 %111, 24
  %113 = load ptr, ptr %12, align 8, !tbaa !5
  %114 = getelementptr inbounds i8, ptr %113, i64 1
  %115 = getelementptr inbounds i8, ptr %114, i64 1
  %116 = load i8, ptr %115, align 1, !tbaa !25
  %117 = zext i8 %116 to i32
  %118 = shl i32 %117, 16
  %119 = add i32 %112, %118
  %120 = load ptr, ptr %12, align 8, !tbaa !5
  %121 = getelementptr inbounds i8, ptr %120, i64 1
  %122 = getelementptr inbounds i8, ptr %121, i64 2
  %123 = load i8, ptr %122, align 1, !tbaa !25
  %124 = zext i8 %123 to i32
  %125 = shl i32 %124, 8
  %126 = add i32 %119, %125
  %127 = load ptr, ptr %12, align 8, !tbaa !5
  %128 = getelementptr inbounds i8, ptr %127, i64 1
  %129 = getelementptr inbounds i8, ptr %128, i64 3
  %130 = load i8, ptr %129, align 1, !tbaa !25
  %131 = zext i8 %130 to i32
  %132 = add i32 %126, %131
  %133 = xor i32 %132, -1
  %134 = add i32 %133, 1
  %135 = and i32 %134, 2147483647
  %136 = sub nsw i32 0, %135
  br label %163

137:                                              ; preds = %100
  %138 = load ptr, ptr %12, align 8, !tbaa !5
  %139 = getelementptr inbounds i8, ptr %138, i64 1
  %140 = load i8, ptr %139, align 1, !tbaa !25
  %141 = zext i8 %140 to i32
  %142 = shl i32 %141, 24
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  %144 = getelementptr inbounds i8, ptr %143, i64 1
  %145 = getelementptr inbounds i8, ptr %144, i64 1
  %146 = load i8, ptr %145, align 1, !tbaa !25
  %147 = zext i8 %146 to i32
  %148 = shl i32 %147, 16
  %149 = add i32 %142, %148
  %150 = load ptr, ptr %12, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 1
  %152 = getelementptr inbounds i8, ptr %151, i64 2
  %153 = load i8, ptr %152, align 1, !tbaa !25
  %154 = zext i8 %153 to i32
  %155 = shl i32 %154, 8
  %156 = add i32 %149, %155
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = getelementptr inbounds i8, ptr %157, i64 1
  %159 = getelementptr inbounds i8, ptr %158, i64 3
  %160 = load i8, ptr %159, align 1, !tbaa !25
  %161 = zext i8 %160 to i32
  %162 = add i32 %156, %161
  br label %163

163:                                              ; preds = %137, %107
  %164 = phi i32 [ %136, %107 ], [ %162, %137 ]
  store i32 %164, ptr %7, align 4, !tbaa !9
  %165 = load ptr, ptr %12, align 8, !tbaa !5
  %166 = getelementptr inbounds i8, ptr %165, i64 5
  %167 = load i8, ptr %166, align 1, !tbaa !25
  %168 = zext i8 %167 to i32
  %169 = and i32 %168, 128
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %201

171:                                              ; preds = %163
  %172 = load ptr, ptr %12, align 8, !tbaa !5
  %173 = getelementptr inbounds i8, ptr %172, i64 5
  %174 = load i8, ptr %173, align 1, !tbaa !25
  %175 = zext i8 %174 to i32
  %176 = shl i32 %175, 24
  %177 = load ptr, ptr %12, align 8, !tbaa !5
  %178 = getelementptr inbounds i8, ptr %177, i64 5
  %179 = getelementptr inbounds i8, ptr %178, i64 1
  %180 = load i8, ptr %179, align 1, !tbaa !25
  %181 = zext i8 %180 to i32
  %182 = shl i32 %181, 16
  %183 = add i32 %176, %182
  %184 = load ptr, ptr %12, align 8, !tbaa !5
  %185 = getelementptr inbounds i8, ptr %184, i64 5
  %186 = getelementptr inbounds i8, ptr %185, i64 2
  %187 = load i8, ptr %186, align 1, !tbaa !25
  %188 = zext i8 %187 to i32
  %189 = shl i32 %188, 8
  %190 = add i32 %183, %189
  %191 = load ptr, ptr %12, align 8, !tbaa !5
  %192 = getelementptr inbounds i8, ptr %191, i64 5
  %193 = getelementptr inbounds i8, ptr %192, i64 3
  %194 = load i8, ptr %193, align 1, !tbaa !25
  %195 = zext i8 %194 to i32
  %196 = add i32 %190, %195
  %197 = xor i32 %196, -1
  %198 = add i32 %197, 1
  %199 = and i32 %198, 2147483647
  %200 = sub nsw i32 0, %199
  br label %227

201:                                              ; preds = %163
  %202 = load ptr, ptr %12, align 8, !tbaa !5
  %203 = getelementptr inbounds i8, ptr %202, i64 5
  %204 = load i8, ptr %203, align 1, !tbaa !25
  %205 = zext i8 %204 to i32
  %206 = shl i32 %205, 24
  %207 = load ptr, ptr %12, align 8, !tbaa !5
  %208 = getelementptr inbounds i8, ptr %207, i64 5
  %209 = getelementptr inbounds i8, ptr %208, i64 1
  %210 = load i8, ptr %209, align 1, !tbaa !25
  %211 = zext i8 %210 to i32
  %212 = shl i32 %211, 16
  %213 = add i32 %206, %212
  %214 = load ptr, ptr %12, align 8, !tbaa !5
  %215 = getelementptr inbounds i8, ptr %214, i64 5
  %216 = getelementptr inbounds i8, ptr %215, i64 2
  %217 = load i8, ptr %216, align 1, !tbaa !25
  %218 = zext i8 %217 to i32
  %219 = shl i32 %218, 8
  %220 = add i32 %213, %219
  %221 = load ptr, ptr %12, align 8, !tbaa !5
  %222 = getelementptr inbounds i8, ptr %221, i64 5
  %223 = getelementptr inbounds i8, ptr %222, i64 3
  %224 = load i8, ptr %223, align 1, !tbaa !25
  %225 = zext i8 %224 to i32
  %226 = add i32 %220, %225
  br label %227

227:                                              ; preds = %201, %171
  %228 = phi i32 [ %200, %171 ], [ %226, %201 ]
  store i32 %228, ptr %8, align 4, !tbaa !9
  %229 = load ptr, ptr %12, align 8, !tbaa !5
  %230 = getelementptr inbounds i8, ptr %229, i64 9
  %231 = load i8, ptr %230, align 1, !tbaa !25
  store i8 %231, ptr %9, align 1, !tbaa !25
  %232 = load ptr, ptr %12, align 8, !tbaa !5
  %233 = getelementptr inbounds i8, ptr %232, i64 10
  %234 = load i8, ptr %233, align 1, !tbaa !25
  store i8 %234, ptr %10, align 1, !tbaa !25
  %235 = load ptr, ptr %12, align 8, !tbaa !5
  %236 = getelementptr inbounds i8, ptr %235, i64 11
  store ptr %236, ptr %13, align 8, !tbaa !5
  %237 = load i8, ptr %9, align 1, !tbaa !25
  %238 = zext i8 %237 to i32
  %239 = icmp eq i32 %238, 0
  br i1 %239, label %240, label %244

240:                                              ; preds = %227
  %241 = load i8, ptr %10, align 1, !tbaa !25
  %242 = zext i8 %241 to i32
  %243 = icmp ne i32 %242, 2
  br i1 %243, label %268, label %244

244:                                              ; preds = %240, %227
  %245 = load i8, ptr %9, align 1, !tbaa !25
  %246 = zext i8 %245 to i32
  %247 = icmp eq i32 %246, 1
  br i1 %247, label %248, label %252

248:                                              ; preds = %244
  %249 = load i8, ptr %10, align 1, !tbaa !25
  %250 = zext i8 %249 to i32
  %251 = icmp ne i32 %250, 3
  br i1 %251, label %268, label %252

252:                                              ; preds = %248, %244
  %253 = load i8, ptr %9, align 1, !tbaa !25
  %254 = zext i8 %253 to i32
  %255 = icmp eq i32 %254, 2
  br i1 %255, label %256, label %260

256:                                              ; preds = %252
  %257 = load i8, ptr %10, align 1, !tbaa !25
  %258 = zext i8 %257 to i32
  %259 = icmp ne i32 %258, 3
  br i1 %259, label %268, label %260

260:                                              ; preds = %256, %252
  %261 = load i8, ptr %9, align 1, !tbaa !25
  %262 = zext i8 %261 to i32
  %263 = icmp eq i32 %262, 3
  br i1 %263, label %264, label %270

264:                                              ; preds = %260
  %265 = load i8, ptr %10, align 1, !tbaa !25
  %266 = zext i8 %265 to i32
  %267 = icmp ne i32 %266, 4
  br i1 %267, label %268, label %270

268:                                              ; preds = %264, %256, %248, %240
  %269 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %269, ptr noundef @.str.30)
  store i32 1, ptr %17, align 4
  br label %352

270:                                              ; preds = %264, %260
  %271 = load i8, ptr %9, align 1, !tbaa !25
  %272 = zext i8 %271 to i32
  %273 = icmp sge i32 %272, 4
  br i1 %273, label %274, label %276

274:                                              ; preds = %270
  %275 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %275, ptr noundef @.str.31)
  br label %276

276:                                              ; preds = %274, %270
  br label %277

277:                                              ; preds = %276
  %278 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %278, ptr %12, align 8, !tbaa !5
  br label %279

279:                                              ; preds = %284, %277
  %280 = load ptr, ptr %12, align 8, !tbaa !5
  %281 = load i8, ptr %280, align 1, !tbaa !25
  %282 = icmp ne i8 %281, 0
  br i1 %282, label %283, label %287

283:                                              ; preds = %279
  br label %284

284:                                              ; preds = %283
  %285 = load ptr, ptr %12, align 8, !tbaa !5
  %286 = getelementptr inbounds i8, ptr %285, i32 1
  store ptr %286, ptr %12, align 8, !tbaa !5
  br label %279, !llvm.loop !28

287:                                              ; preds = %279
  %288 = load ptr, ptr %4, align 8, !tbaa !5
  %289 = load i8, ptr %10, align 1, !tbaa !25
  %290 = zext i8 %289 to i64
  %291 = mul i64 %290, 8
  %292 = call noalias ptr @png_malloc_warn(ptr noundef %288, i64 noundef %291)
  store ptr %292, ptr %15, align 8, !tbaa !5
  %293 = load ptr, ptr %15, align 8, !tbaa !5
  %294 = icmp eq ptr %293, null
  br i1 %294, label %295, label %297

295:                                              ; preds = %287
  %296 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %296, ptr noundef @.str.17)
  store i32 1, ptr %17, align 4
  br label %352

297:                                              ; preds = %287
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %298

298:                                              ; preds = %335, %297
  %299 = load i32, ptr %16, align 4, !tbaa !9
  %300 = load i8, ptr %10, align 1, !tbaa !25
  %301 = zext i8 %300 to i32
  %302 = icmp slt i32 %299, %301
  br i1 %302, label %303, label %338

303:                                              ; preds = %298
  %304 = load ptr, ptr %12, align 8, !tbaa !5
  %305 = getelementptr inbounds i8, ptr %304, i32 1
  store ptr %305, ptr %12, align 8, !tbaa !5
  %306 = load ptr, ptr %12, align 8, !tbaa !5
  %307 = load ptr, ptr %15, align 8, !tbaa !5
  %308 = load i32, ptr %16, align 4, !tbaa !9
  %309 = sext i32 %308 to i64
  %310 = getelementptr inbounds ptr, ptr %307, i64 %309
  store ptr %306, ptr %310, align 8, !tbaa !5
  br label %311

311:                                              ; preds = %323, %303
  %312 = load ptr, ptr %12, align 8, !tbaa !5
  %313 = load ptr, ptr %14, align 8, !tbaa !5
  %314 = icmp ule ptr %312, %313
  br i1 %314, label %315, label %320

315:                                              ; preds = %311
  %316 = load ptr, ptr %12, align 8, !tbaa !5
  %317 = load i8, ptr %316, align 1, !tbaa !25
  %318 = zext i8 %317 to i32
  %319 = icmp ne i32 %318, 0
  br label %320

320:                                              ; preds = %315, %311
  %321 = phi i1 [ false, %311 ], [ %319, %315 ]
  br i1 %321, label %322, label %326

322:                                              ; preds = %320
  br label %323

323:                                              ; preds = %322
  %324 = load ptr, ptr %12, align 8, !tbaa !5
  %325 = getelementptr inbounds i8, ptr %324, i32 1
  store ptr %325, ptr %12, align 8, !tbaa !5
  br label %311, !llvm.loop !29

326:                                              ; preds = %320
  %327 = load ptr, ptr %12, align 8, !tbaa !5
  %328 = load ptr, ptr %14, align 8, !tbaa !5
  %329 = icmp ugt ptr %327, %328
  br i1 %329, label %330, label %334

330:                                              ; preds = %326
  %331 = load ptr, ptr %4, align 8, !tbaa !5
  %332 = load ptr, ptr %15, align 8, !tbaa !5
  call void @png_free(ptr noundef %331, ptr noundef %332)
  %333 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %333, ptr noundef @.str.32)
  store i32 1, ptr %17, align 4
  br label %352

334:                                              ; preds = %326
  br label %335

335:                                              ; preds = %334
  %336 = load i32, ptr %16, align 4, !tbaa !9
  %337 = add nsw i32 %336, 1
  store i32 %337, ptr %16, align 4, !tbaa !9
  br label %298, !llvm.loop !30

338:                                              ; preds = %298
  %339 = load ptr, ptr %4, align 8, !tbaa !5
  %340 = load ptr, ptr %5, align 8, !tbaa !5
  %341 = load ptr, ptr %11, align 8, !tbaa !5
  %342 = load i32, ptr %7, align 4, !tbaa !9
  %343 = load i32, ptr %8, align 4, !tbaa !9
  %344 = load i8, ptr %9, align 1, !tbaa !25
  %345 = zext i8 %344 to i32
  %346 = load i8, ptr %10, align 1, !tbaa !25
  %347 = zext i8 %346 to i32
  %348 = load ptr, ptr %13, align 8, !tbaa !5
  %349 = load ptr, ptr %15, align 8, !tbaa !5
  call void @png_set_pCAL(ptr noundef %339, ptr noundef %340, ptr noundef %341, i32 noundef %342, i32 noundef %343, i32 noundef %345, i32 noundef %347, ptr noundef %348, ptr noundef %349)
  %350 = load ptr, ptr %4, align 8, !tbaa !5
  %351 = load ptr, ptr %15, align 8, !tbaa !5
  call void @png_free(ptr noundef %350, ptr noundef %351)
  store i32 0, ptr %17, align 4
  br label %352

352:                                              ; preds = %338, %330, %295, %268, %98, %72, %60, %45, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %353 = load i32, ptr %17, align 4
  switch i32 %353, label %355 [
    i32 0, label %354
    i32 1, label %354
  ]

354:                                              ; preds = %352, %352
  ret void

355:                                              ; preds = %352
  unreachable
}

declare void @png_set_pCAL(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { noreturn "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 = { "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 }
attributes #5 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 300}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !13, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !14, i64 320, !6, i64 432, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !10, i64 460, !10, i64 464, !10, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !10, i64 488, !10, i64 492, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !10, i64 512, !10, i64 516, !13, i64 520, !10, i64 528, !10, i64 532, !10, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !13, i64 576, !10, i64 584, !10, i64 588, !6, i64 592, !15, i64 600, !10, i64 604, !15, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !15, i64 626, !7, i64 628, !10, i64 632, !16, i64 636, !16, i64 646, !6, i64 656, !10, i64 664, !10, i64 668, !10, i64 672, !10, i64 676, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !17, i64 728, !17, i64 733, !6, i64 744, !16, i64 752, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !10, i64 840, !10, i64 844, !13, i64 848, !13, i64 856, !13, i64 864, !13, i64 872, !10, i64 880, !10, i64 884, !6, i64 888, !6, i64 896, !10, i64 904, !7, i64 908, !10, i64 940, !6, i64 944, !6, i64 952, !10, i64 960, !10, i64 964, !6, i64 968, !7, i64 976, !7, i64 977, !15, i64 978, !15, i64 980, !10, i64 984, !7, i64 988, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !6, i64 1040, !7, i64 1048, !10, i64 1052, !10, i64 1056, !10, i64 1060, !13, i64 1064, !18, i64 1072, !13, i64 1104, !6, i64 1112, !13, i64 1120, !10, i64 1128, !10, i64 1132, !6, i64 1136, !7, i64 1144, !19, i64 1176}
!13 = !{!"long", !7, i64 0}
!14 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !13, i64 16, !6, i64 24, !10, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !13, i64 96, !13, i64 104}
!15 = !{!"short", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !13, i64 16, !7, i64 24}
!19 = !{!"png_colorspace", !10, i64 0, !20, i64 4, !21, i64 36, !15, i64 72, !15, i64 74}
!20 = !{!"png_xy", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!21 = !{!"png_XYZ", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!22 = !{!23, !10, i64 8}
!23 = !{!"png_info_def", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !6, i64 24, !15, i64 32, !15, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !19, i64 52, !6, i64 128, !6, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !6, i64 160, !24, i64 168, !17, i64 176, !6, i64 184, !16, i64 192, !16, i64 202, !10, i64 212, !10, i64 216, !7, i64 220, !10, i64 224, !10, i64 228, !7, i64 232, !10, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !10, i64 272, !10, i64 276, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !10, i64 300, !6, i64 304, !10, i64 312, !6, i64 320, !10, i64 328, !7, i64 332, !6, i64 336, !6, i64 344, !6, i64 352}
!24 = !{!"png_time_struct", !15, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = distinct !{!29, !27}
!30 = distinct !{!30, !27}


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

@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @png_crc_read(ptr noalias noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @png_crc_finish(ptr noalias noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: noreturn
declare void @png_chunk_error(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @png_chunk_benign_error(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @png_read_buffer(ptr noalias noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

declare noalias ptr @png_malloc_warn(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @png_free(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_pCAL(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 300
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = and i32 %5, 1
  %7 = icmp eq i32 %6, 0
  br i1 %7, label %8, label %9

8:                                                ; preds = %3
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.7) #3
  unreachable

9:                                                ; preds = %3
  %10 = and i32 %5, 4
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %13, label %11

11:                                               ; preds = %9
  %12 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.5) #4
  br label %149

13:                                               ; preds = %9
  %.not112 = icmp eq ptr %1, null
  br i1 %.not112, label %20, label %14

14:                                               ; preds = %13
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load i32, ptr %15, align 8, !tbaa !20
  %17 = and i32 %16, 1024
  %.not113 = icmp eq i32 %17, 0
  br i1 %.not113, label %20, label %18

18:                                               ; preds = %14
  %19 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.8) #4
  br label %149

20:                                               ; preds = %14, %13
  %21 = add i32 %2, 1
  %22 = zext i32 %21 to i64
  %23 = tail call ptr @png_read_buffer(ptr noundef nonnull %0, i64 noundef %22, i32 noundef 2)
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %27

25:                                               ; preds = %20
  %26 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.17) #4
  br label %149

27:                                               ; preds = %20
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %23, i32 noundef %2)
  %28 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %.not114 = icmp eq i32 %28, 0
  br i1 %.not114, label %29, label %149

29:                                               ; preds = %27
  %30 = zext i32 %2 to i64
  %31 = getelementptr inbounds i8, ptr %23, i64 %30
  store i8 0, ptr %31, align 1, !tbaa !23
  br label %32

32:                                               ; preds = %32, %29
  %.0107 = phi ptr [ %23, %29 ], [ %34, %32 ]
  %33 = load i8, ptr %.0107, align 1, !tbaa !23
  %.not115 = icmp eq i8 %33, 0
  %34 = getelementptr inbounds i8, ptr %.0107, i64 1
  br i1 %.not115, label %35, label %32, !llvm.loop !24

35:                                               ; preds = %32
  %36 = ptrtoint ptr %31 to i64
  %37 = ptrtoint ptr %.0107 to i64
  %38 = sub i64 %36, %37
  %39 = icmp slt i64 %38, 13
  br i1 %39, label %40, label %41

40:                                               ; preds = %35
  tail call void @png_chunk_benign_error(ptr noundef %0, ptr noundef nonnull @.str.6) #4
  br label %149

41:                                               ; preds = %35
  %42 = load i8, ptr %34, align 1, !tbaa !23
  %43 = zext i8 %42 to i32
  %.not116 = icmp sgt i8 %42, -1
  br i1 %.not116, label %60, label %44

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %.0107, i64 2
  %46 = load i8, ptr %45, align 1, !tbaa !23
  %47 = zext i8 %46 to i32
  %.neg117 = mul i32 %47, 2147418112
  %48 = shl nuw i32 %43, 24
  %49 = getelementptr inbounds i8, ptr %.0107, i64 3
  %50 = load i8, ptr %49, align 1, !tbaa !23
  %51 = zext i8 %50 to i32
  %52 = shl nuw nsw i32 %51, 8
  %53 = or disjoint i32 %52, %48
  %54 = getelementptr inbounds i8, ptr %.0107, i64 4
  %55 = load i8, ptr %54, align 1, !tbaa !23
  %56 = zext i8 %55 to i32
  %57 = or disjoint i32 %53, %56
  %.neg121 = sub i32 %.neg117, %57
  %58 = and i32 %.neg121, 2147483647
  %59 = sub nsw i32 0, %58
  br label %76

60:                                               ; preds = %41
  %61 = shl nuw nsw i32 %43, 24
  %62 = getelementptr inbounds i8, ptr %.0107, i64 2
  %63 = load i8, ptr %62, align 1, !tbaa !23
  %64 = zext i8 %63 to i32
  %65 = shl nuw nsw i32 %64, 16
  %66 = or disjoint i32 %65, %61
  %67 = getelementptr inbounds i8, ptr %.0107, i64 3
  %68 = load i8, ptr %67, align 1, !tbaa !23
  %69 = zext i8 %68 to i32
  %70 = shl nuw nsw i32 %69, 8
  %71 = or disjoint i32 %66, %70
  %72 = getelementptr inbounds i8, ptr %.0107, i64 4
  %73 = load i8, ptr %72, align 1, !tbaa !23
  %74 = zext i8 %73 to i32
  %75 = or disjoint i32 %71, %74
  br label %76

76:                                               ; preds = %60, %44
  %77 = phi i32 [ %59, %44 ], [ %75, %60 ]
  %78 = getelementptr inbounds i8, ptr %.0107, i64 5
  %79 = load i8, ptr %78, align 1, !tbaa !23
  %80 = zext i8 %79 to i32
  %.not122 = icmp sgt i8 %79, -1
  br i1 %.not122, label %97, label %81

81:                                               ; preds = %76
  %82 = getelementptr inbounds i8, ptr %.0107, i64 6
  %83 = load i8, ptr %82, align 1, !tbaa !23
  %84 = zext i8 %83 to i32
  %.neg123 = mul i32 %84, 2147418112
  %85 = shl nuw i32 %80, 24
  %86 = getelementptr inbounds i8, ptr %.0107, i64 7
  %87 = load i8, ptr %86, align 1, !tbaa !23
  %88 = zext i8 %87 to i32
  %89 = shl nuw nsw i32 %88, 8
  %90 = or disjoint i32 %89, %85
  %91 = getelementptr inbounds i8, ptr %.0107, i64 8
  %92 = load i8, ptr %91, align 1, !tbaa !23
  %93 = zext i8 %92 to i32
  %94 = or disjoint i32 %90, %93
  %.neg127 = sub i32 %.neg123, %94
  %95 = and i32 %.neg127, 2147483647
  %96 = sub nsw i32 0, %95
  br label %113

97:                                               ; preds = %76
  %98 = shl nuw nsw i32 %80, 24
  %99 = getelementptr inbounds i8, ptr %.0107, i64 6
  %100 = load i8, ptr %99, align 1, !tbaa !23
  %101 = zext i8 %100 to i32
  %102 = shl nuw nsw i32 %101, 16
  %103 = or disjoint i32 %102, %98
  %104 = getelementptr inbounds i8, ptr %.0107, i64 7
  %105 = load i8, ptr %104, align 1, !tbaa !23
  %106 = zext i8 %105 to i32
  %107 = shl nuw nsw i32 %106, 8
  %108 = or disjoint i32 %103, %107
  %109 = getelementptr inbounds i8, ptr %.0107, i64 8
  %110 = load i8, ptr %109, align 1, !tbaa !23
  %111 = zext i8 %110 to i32
  %112 = or disjoint i32 %108, %111
  br label %113

113:                                              ; preds = %97, %81
  %114 = phi i32 [ %96, %81 ], [ %112, %97 ]
  %115 = getelementptr inbounds i8, ptr %.0107, i64 9
  %116 = load i8, ptr %115, align 1, !tbaa !23
  %117 = getelementptr inbounds i8, ptr %.0107, i64 10
  %118 = load i8, ptr %117, align 1, !tbaa !23
  %119 = getelementptr inbounds i8, ptr %.0107, i64 11
  %120 = zext i8 %116 to i32
  %121 = icmp eq i8 %116, 0
  %122 = zext i8 %118 to i32
  %123 = icmp ne i8 %118, 2
  %or.cond = select i1 %121, i1 %123, i1 false
  br i1 %or.cond, label %131, label %124

124:                                              ; preds = %113
  %125 = icmp ne i8 %118, 3
  %126 = add i8 %116, -1
  %127 = icmp ult i8 %126, 2
  %or.cond131 = select i1 %127, i1 %125, i1 false
  br i1 %or.cond131, label %131, label %128

128:                                              ; preds = %124
  %129 = icmp eq i8 %116, 3
  %130 = icmp ne i8 %118, 4
  %or.cond11 = select i1 %129, i1 %130, i1 false
  br i1 %or.cond11, label %131, label %132

131:                                              ; preds = %128, %124, %113
  tail call void @png_chunk_benign_error(ptr noundef %0, ptr noundef nonnull @.str.30) #4
  br label %149

132:                                              ; preds = %128
  %133 = icmp ugt i8 %116, 3
  br i1 %133, label %134, label %.preheader150

134:                                              ; preds = %132
  tail call void @png_chunk_benign_error(ptr noundef %0, ptr noundef nonnull @.str.31) #4
  br label %.preheader150

.preheader150:                                    ; preds = %132, %134
  br label %135

135:                                              ; preds = %.preheader150, %135
  %.1 = phi ptr [ %137, %135 ], [ %119, %.preheader150 ]
  %136 = load i8, ptr %.1, align 1, !tbaa !23
  %.not128 = icmp eq i8 %136, 0
  %137 = getelementptr inbounds i8, ptr %.1, i64 1
  br i1 %.not128, label %138, label %135, !llvm.loop !26

138:                                              ; preds = %135
  %139 = zext i8 %118 to i64
  %140 = shl nuw nsw i64 %139, 3
  %141 = tail call noalias ptr @png_malloc_warn(ptr noundef %0, i64 noundef %140) #4
  %142 = icmp eq ptr %141, null
  br i1 %142, label %143, label %.preheader

.preheader:                                       ; preds = %138
  %.not140 = icmp eq i8 %118, 0
  br i1 %.not140, label %._crit_edge139, label %.lr.ph138.preheader

.lr.ph138.preheader:                              ; preds = %.preheader
  %wide.trip.count = zext i8 %118 to i64
  br label %.lr.ph138

143:                                              ; preds = %138
  tail call void @png_chunk_benign_error(ptr noundef %0, ptr noundef nonnull @.str.17) #4
  br label %149

.lr.ph138:                                        ; preds = %.lr.ph138.preheader, %.critedge
  %indvars.iv = phi i64 [ 0, %.lr.ph138.preheader ], [ %indvars.iv.next, %.critedge ]
  %.2136 = phi ptr [ %.1, %.lr.ph138.preheader ], [ %.3134, %.critedge ]
  %144 = getelementptr inbounds i8, ptr %.2136, i64 1
  %145 = getelementptr inbounds ptr, ptr %141, i64 %indvars.iv
  store ptr %144, ptr %145, align 8, !tbaa !27
  %.not129133 = icmp ugt ptr %144, %31
  br i1 %.not129133, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph138, %147
  %.3134 = phi ptr [ %148, %147 ], [ %144, %.lr.ph138 ]
  %146 = load i8, ptr %.3134, align 1, !tbaa !23
  %.not130 = icmp eq i8 %146, 0
  br i1 %.not130, label %.critedge, label %147

147:                                              ; preds = %.lr.ph
  %148 = getelementptr inbounds i8, ptr %.3134, i64 1
  %.not129 = icmp ugt ptr %148, %31
  br i1 %.not129, label %._crit_edge, label %.lr.ph, !llvm.loop !28

._crit_edge:                                      ; preds = %.lr.ph138, %147
  tail call void @png_free(ptr noundef %0, ptr noundef nonnull %141) #4
  tail call void @png_chunk_benign_error(ptr noundef %0, ptr noundef nonnull @.str.32) #4
  br label %149

.critedge:                                        ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge139, label %.lr.ph138, !llvm.loop !29

._crit_edge139:                                   ; preds = %.critedge, %.preheader
  tail call void @png_set_pCAL(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %23, i32 noundef %77, i32 noundef %114, i32 noundef %120, i32 noundef %122, ptr noundef nonnull %119, ptr noundef nonnull %141) #4
  tail call void @png_free(ptr noundef %0, ptr noundef nonnull %141) #4
  br label %149

149:                                              ; preds = %27, %._crit_edge139, %._crit_edge, %143, %131, %40, %25, %18, %11
  ret void
}

declare void @png_set_pCAL(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn "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 = { "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 = { noreturn nounwind }
attributes #4 = { 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, !11, i64 300}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !10, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !9, i64 272, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !11, i64 304, !11, i64 308, !11, i64 312, !12, i64 320, !9, i64 432, !11, i64 440, !11, i64 444, !11, i64 448, !11, i64 452, !11, i64 456, !11, i64 460, !11, i64 464, !11, i64 468, !11, i64 472, !11, i64 476, !11, i64 480, !11, i64 484, !11, i64 488, !11, i64 492, !11, i64 496, !11, i64 500, !11, i64 504, !11, i64 508, !11, i64 512, !11, i64 516, !10, i64 520, !11, i64 528, !11, i64 532, !11, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !9, i64 568, !10, i64 576, !11, i64 584, !11, i64 588, !9, i64 592, !13, i64 600, !11, i64 604, !13, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !13, i64 626, !7, i64 628, !11, i64 632, !14, i64 636, !14, i64 646, !9, i64 656, !11, i64 664, !11, i64 668, !11, i64 672, !11, i64 676, !9, i64 680, !9, i64 688, !9, i64 696, !9, i64 704, !9, i64 712, !9, i64 720, !15, i64 728, !15, i64 733, !9, i64 744, !14, i64 752, !9, i64 768, !9, i64 776, !9, i64 784, !9, i64 792, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !11, i64 840, !11, i64 844, !10, i64 848, !10, i64 856, !10, i64 864, !10, i64 872, !11, i64 880, !11, i64 884, !9, i64 888, !9, i64 896, !11, i64 904, !7, i64 908, !11, i64 940, !9, i64 944, !9, i64 952, !11, i64 960, !11, i64 964, !9, i64 968, !7, i64 976, !7, i64 977, !13, i64 978, !13, i64 980, !11, i64 984, !7, i64 988, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !9, i64 1040, !7, i64 1048, !11, i64 1052, !11, i64 1056, !11, i64 1060, !10, i64 1064, !16, i64 1072, !10, i64 1104, !9, i64 1112, !10, i64 1120, !11, i64 1128, !11, i64 1132, !9, i64 1136, !7, i64 1144, !17, i64 1176}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!"z_stream_s", !9, i64 0, !11, i64 8, !10, i64 16, !9, i64 24, !11, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !11, i64 88, !10, i64 96, !10, i64 104}
!13 = !{!"short", !7, i64 0}
!14 = !{!"png_color_16_struct", !7, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8}
!15 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!16 = !{!"png_unknown_chunk_t", !7, i64 0, !9, i64 8, !10, i64 16, !7, i64 24}
!17 = !{!"png_colorspace", !11, i64 0, !18, i64 4, !19, i64 36, !13, i64 72, !13, i64 74}
!18 = !{!"png_xy", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!19 = !{!"png_XYZ", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!20 = !{!21, !11, i64 8}
!21 = !{!"png_info_def", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 16, !9, i64 24, !13, i64 32, !13, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !17, i64 52, !9, i64 128, !9, i64 136, !11, i64 144, !11, i64 148, !11, i64 152, !9, i64 160, !22, i64 168, !15, i64 176, !9, i64 184, !14, i64 192, !14, i64 202, !11, i64 212, !11, i64 216, !7, i64 220, !11, i64 224, !11, i64 228, !7, i64 232, !11, i64 236, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !11, i64 272, !11, i64 276, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !9, i64 304, !11, i64 312, !9, i64 320, !11, i64 328, !7, i64 332, !9, i64 336, !9, i64 344, !9, i64 352}
!22 = !{!"png_time_struct", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = !{!9, !9, i64 0}
!28 = distinct !{!28, !25}
!29 = distinct !{!29, !25}


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