; LLVM IR from mkazhdan/DMG :: Util/PNG (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, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i64, i64, i64, %struct.z_stream_s, ptr, i64, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.png_row_info_struct, i64, i64, ptr, i16, i16, [5 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i8, float, %struct.png_color_16_struct, %struct.png_color_16_struct, ptr, i64, i64, i32, float, float, 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, i64, i64, i64, i64, i64, i64, i32, i32, i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, i32, ptr, i8, i16, i16, i16, i64, i64, i8, i8, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i64, i64, %struct.png_unknown_chunk_t, i64, i64 }
%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_row_info_struct = type { i64, i64, i8, i8, i8, i8 }
%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 }

@png_decompress_chunk.msg = external hidden constant [31 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [33 x i8], align 1

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

declare void @png_error(ptr noundef, ptr noundef) #1

; 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
define dso_local ptr @png_decompress_chunk(ptr noundef %0, i32 noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4, ptr noundef %5) #2 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca [52 x i8], align 16
  %18 = alloca [50 x i8], align 16
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i64 %3, ptr %10, align 8, !tbaa !11
  store i64 %4, ptr %11, align 8, !tbaa !11
  store ptr %5, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %321

21:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  %22 = load ptr, ptr %9, align 8, !tbaa !5
  %23 = load i64, ptr %11, align 8, !tbaa !11
  %24 = getelementptr inbounds i8, ptr %22, i64 %23
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.png_struct_def, ptr %25, i32 0, i32 15
  %27 = getelementptr inbounds %struct.z_stream_s, ptr %26, i32 0, i32 0
  store ptr %24, ptr %27, align 8, !tbaa !13
  %28 = load i64, ptr %10, align 8, !tbaa !11
  %29 = load i64, ptr %11, align 8, !tbaa !11
  %30 = sub i64 %28, %29
  %31 = trunc i64 %30 to i32
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.png_struct_def, ptr %32, i32 0, i32 15
  %34 = getelementptr inbounds %struct.z_stream_s, ptr %33, i32 0, i32 1
  store i32 %31, ptr %34, align 8, !tbaa !22
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.png_struct_def, ptr %35, i32 0, i32 16
  %37 = load ptr, ptr %36, align 8, !tbaa !23
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.png_struct_def, ptr %38, i32 0, i32 15
  %40 = getelementptr inbounds %struct.z_stream_s, ptr %39, i32 0, i32 3
  store ptr %37, ptr %40, align 8, !tbaa !24
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 17
  %43 = load i64, ptr %42, align 8, !tbaa !25
  %44 = trunc i64 %43 to i32
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.png_struct_def, ptr %45, i32 0, i32 15
  %47 = getelementptr inbounds %struct.z_stream_s, ptr %46, i32 0, i32 4
  store i32 %44, ptr %47, align 8, !tbaa !26
  store i64 0, ptr %14, align 8, !tbaa !11
  store ptr null, ptr %13, align 8, !tbaa !5
  br label %48

48:                                               ; preds = %255, %21
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.png_struct_def, ptr %49, i32 0, i32 15
  %51 = getelementptr inbounds %struct.z_stream_s, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 8, !tbaa !22
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %256

54:                                               ; preds = %48
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_struct_def, ptr %55, i32 0, i32 15
  %57 = call i32 @inflate(ptr noundef %56, i32 noundef 1)
  store i32 %57, ptr %15, align 4, !tbaa !9
  %58 = load i32, ptr %15, align 4, !tbaa !9
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %127

60:                                               ; preds = %54
  %61 = load i32, ptr %15, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 1
  br i1 %62, label %63, label %127

63:                                               ; preds = %60
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.png_struct_def, ptr %64, i32 0, i32 15
  %66 = getelementptr inbounds %struct.z_stream_s, ptr %65, i32 0, i32 6
  %67 = load ptr, ptr %66, align 8, !tbaa !27
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %75

69:                                               ; preds = %63
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.png_struct_def, ptr %71, i32 0, i32 15
  %73 = getelementptr inbounds %struct.z_stream_s, ptr %72, i32 0, i32 6
  %74 = load ptr, ptr %73, align 8, !tbaa !27
  call void @png_warning(ptr noundef %70, ptr noundef %74)
  br label %77

75:                                               ; preds = %63
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_warning(ptr noundef %76, ptr noundef @png_decompress_chunk.msg)
  br label %77

77:                                               ; preds = %75, %69
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.png_struct_def, ptr %78, i32 0, i32 15
  %80 = call i32 @inflateReset(ptr noundef %79)
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 15
  %83 = getelementptr inbounds %struct.z_stream_s, ptr %82, i32 0, i32 1
  store i32 0, ptr %83, align 8, !tbaa !22
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = icmp eq ptr %84, null
  br i1 %85, label %86, label %103

86:                                               ; preds = %77
  %87 = load i64, ptr %11, align 8, !tbaa !11
  %88 = add i64 %87, 31
  %89 = add i64 %88, 1
  store i64 %89, ptr %14, align 8, !tbaa !11
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load i64, ptr %14, align 8, !tbaa !11
  %92 = call ptr @png_malloc_warn(ptr noundef %90, i64 noundef %91)
  store ptr %92, ptr %13, align 8, !tbaa !5
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = icmp eq ptr %93, null
  br i1 %94, label %95, label %99

95:                                               ; preds = %86
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_free(ptr noundef %96, ptr noundef %97)
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_error(ptr noundef %98, ptr noundef @.str.2)
  br label %99

99:                                               ; preds = %95, %86
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = load i64, ptr %11, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %100, ptr align 1 %101, i64 %102, i1 false)
  br label %103

103:                                              ; preds = %99, %77
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  %105 = load i64, ptr %14, align 8, !tbaa !11
  %106 = sub i64 %105, 1
  %107 = getelementptr inbounds i8, ptr %104, i64 %106
  store i8 0, ptr %107, align 1, !tbaa !28
  %108 = load i64, ptr %10, align 8, !tbaa !11
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = ptrtoint ptr %109 to i64
  %112 = ptrtoint ptr %110 to i64
  %113 = sub i64 %111, %112
  %114 = sub i64 %108, %113
  %115 = sub i64 %114, 1
  store i64 %115, ptr %14, align 8, !tbaa !11
  %116 = load i64, ptr %14, align 8, !tbaa !11
  %117 = icmp ugt i64 31, %116
  br i1 %117, label %118, label %120

118:                                              ; preds = %103
  %119 = load i64, ptr %14, align 8, !tbaa !11
  br label %121

120:                                              ; preds = %103
  br label %121

121:                                              ; preds = %120, %118
  %122 = phi i64 [ %119, %118 ], [ 31, %120 ]
  store i64 %122, ptr %14, align 8, !tbaa !11
  %123 = load ptr, ptr %13, align 8, !tbaa !5
  %124 = load i64, ptr %11, align 8, !tbaa !11
  %125 = getelementptr inbounds i8, ptr %123, i64 %124
  %126 = load i64, ptr %14, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %125, ptr align 16 @png_decompress_chunk.msg, i64 %126, i1 false)
  br label %256

127:                                              ; preds = %60, %54
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.png_struct_def, ptr %128, i32 0, i32 15
  %130 = getelementptr inbounds %struct.z_stream_s, ptr %129, i32 0, i32 4
  %131 = load i32, ptr %130, align 8, !tbaa !26
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %136

133:                                              ; preds = %127
  %134 = load i32, ptr %15, align 4, !tbaa !9
  %135 = icmp eq i32 %134, 1
  br i1 %135, label %136, label %255

136:                                              ; preds = %133, %127
  %137 = load ptr, ptr %13, align 8, !tbaa !5
  %138 = icmp eq ptr %137, null
  br i1 %138, label %139, label %177

139:                                              ; preds = %136
  %140 = load i64, ptr %11, align 8, !tbaa !11
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.png_struct_def, ptr %141, i32 0, i32 17
  %143 = load i64, ptr %142, align 8, !tbaa !25
  %144 = add i64 %140, %143
  %145 = load ptr, ptr %7, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.png_struct_def, ptr %145, i32 0, i32 15
  %147 = getelementptr inbounds %struct.z_stream_s, ptr %146, i32 0, i32 4
  %148 = load i32, ptr %147, align 8, !tbaa !26
  %149 = zext i32 %148 to i64
  %150 = sub i64 %144, %149
  store i64 %150, ptr %14, align 8, !tbaa !11
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = load i64, ptr %14, align 8, !tbaa !11
  %153 = add i64 %152, 1
  %154 = call ptr @png_malloc_warn(ptr noundef %151, i64 noundef %153)
  store ptr %154, ptr %13, align 8, !tbaa !5
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  %156 = icmp eq ptr %155, null
  br i1 %156, label %157, label %161

157:                                              ; preds = %139
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_free(ptr noundef %158, ptr noundef %159)
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_error(ptr noundef %160, ptr noundef @.str.3)
  br label %161

161:                                              ; preds = %157, %139
  %162 = load ptr, ptr %13, align 8, !tbaa !5
  %163 = load i64, ptr %11, align 8, !tbaa !11
  %164 = getelementptr inbounds i8, ptr %162, i64 %163
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.png_struct_def, ptr %165, i32 0, i32 16
  %167 = load ptr, ptr %166, align 8, !tbaa !23
  %168 = load i64, ptr %14, align 8, !tbaa !11
  %169 = load i64, ptr %11, align 8, !tbaa !11
  %170 = sub i64 %168, %169
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %164, ptr align 1 %167, i64 %170, i1 false)
  %171 = load ptr, ptr %13, align 8, !tbaa !5
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = load i64, ptr %11, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %171, ptr align 1 %172, i64 %173, i1 false)
  %174 = load ptr, ptr %13, align 8, !tbaa !5
  %175 = load i64, ptr %14, align 8, !tbaa !11
  %176 = getelementptr inbounds i8, ptr %174, i64 %175
  store i8 0, ptr %176, align 1, !tbaa !28
  br label %236

177:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %178 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %178, ptr %16, align 8, !tbaa !5
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  %180 = load i64, ptr %14, align 8, !tbaa !11
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.png_struct_def, ptr %181, i32 0, i32 17
  %183 = load i64, ptr %182, align 8, !tbaa !25
  %184 = add i64 %180, %183
  %185 = load ptr, ptr %7, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.png_struct_def, ptr %185, i32 0, i32 15
  %187 = getelementptr inbounds %struct.z_stream_s, ptr %186, i32 0, i32 4
  %188 = load i32, ptr %187, align 8, !tbaa !26
  %189 = zext i32 %188 to i64
  %190 = sub i64 %184, %189
  %191 = add i64 %190, 1
  %192 = call ptr @png_malloc_warn(ptr noundef %179, i64 noundef %191)
  store ptr %192, ptr %13, align 8, !tbaa !5
  %193 = load ptr, ptr %13, align 8, !tbaa !5
  %194 = icmp eq ptr %193, null
  br i1 %194, label %195, label %201

195:                                              ; preds = %177
  %196 = load ptr, ptr %7, align 8, !tbaa !5
  %197 = load ptr, ptr %16, align 8, !tbaa !5
  call void @png_free(ptr noundef %196, ptr noundef %197)
  %198 = load ptr, ptr %7, align 8, !tbaa !5
  %199 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_free(ptr noundef %198, ptr noundef %199)
  %200 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_error(ptr noundef %200, ptr noundef @.str.4)
  br label %201

201:                                              ; preds = %195, %177
  %202 = load ptr, ptr %13, align 8, !tbaa !5
  %203 = load ptr, ptr %16, align 8, !tbaa !5
  %204 = load i64, ptr %14, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %202, ptr align 1 %203, i64 %204, i1 false)
  %205 = load ptr, ptr %7, align 8, !tbaa !5
  %206 = load ptr, ptr %16, align 8, !tbaa !5
  call void @png_free(ptr noundef %205, ptr noundef %206)
  %207 = load ptr, ptr %13, align 8, !tbaa !5
  %208 = load i64, ptr %14, align 8, !tbaa !11
  %209 = getelementptr inbounds i8, ptr %207, i64 %208
  %210 = load ptr, ptr %7, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.png_struct_def, ptr %210, i32 0, i32 16
  %212 = load ptr, ptr %211, align 8, !tbaa !23
  %213 = load ptr, ptr %7, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.png_struct_def, ptr %213, i32 0, i32 17
  %215 = load i64, ptr %214, align 8, !tbaa !25
  %216 = load ptr, ptr %7, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.png_struct_def, ptr %216, i32 0, i32 15
  %218 = getelementptr inbounds %struct.z_stream_s, ptr %217, i32 0, i32 4
  %219 = load i32, ptr %218, align 8, !tbaa !26
  %220 = zext i32 %219 to i64
  %221 = sub i64 %215, %220
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %209, ptr align 1 %212, i64 %221, i1 false)
  %222 = load ptr, ptr %7, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.png_struct_def, ptr %222, i32 0, i32 17
  %224 = load i64, ptr %223, align 8, !tbaa !25
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.png_struct_def, ptr %225, i32 0, i32 15
  %227 = getelementptr inbounds %struct.z_stream_s, ptr %226, i32 0, i32 4
  %228 = load i32, ptr %227, align 8, !tbaa !26
  %229 = zext i32 %228 to i64
  %230 = sub i64 %224, %229
  %231 = load i64, ptr %14, align 8, !tbaa !11
  %232 = add i64 %231, %230
  store i64 %232, ptr %14, align 8, !tbaa !11
  %233 = load ptr, ptr %13, align 8, !tbaa !5
  %234 = load i64, ptr %14, align 8, !tbaa !11
  %235 = getelementptr inbounds i8, ptr %233, i64 %234
  store i8 0, ptr %235, align 1, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %236

236:                                              ; preds = %201, %161
  %237 = load i32, ptr %15, align 4, !tbaa !9
  %238 = icmp eq i32 %237, 1
  br i1 %238, label %239, label %240

239:                                              ; preds = %236
  br label %256

240:                                              ; preds = %236
  %241 = load ptr, ptr %7, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.png_struct_def, ptr %241, i32 0, i32 16
  %243 = load ptr, ptr %242, align 8, !tbaa !23
  %244 = load ptr, ptr %7, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.png_struct_def, ptr %244, i32 0, i32 15
  %246 = getelementptr inbounds %struct.z_stream_s, ptr %245, i32 0, i32 3
  store ptr %243, ptr %246, align 8, !tbaa !24
  %247 = load ptr, ptr %7, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.png_struct_def, ptr %247, i32 0, i32 17
  %249 = load i64, ptr %248, align 8, !tbaa !25
  %250 = trunc i64 %249 to i32
  %251 = load ptr, ptr %7, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.png_struct_def, ptr %251, i32 0, i32 15
  %253 = getelementptr inbounds %struct.z_stream_s, ptr %252, i32 0, i32 4
  store i32 %250, ptr %253, align 8, !tbaa !26
  br label %254

254:                                              ; preds = %240
  br label %255

255:                                              ; preds = %254, %133
  br label %48, !llvm.loop !29

256:                                              ; preds = %239, %121, %48
  %257 = load i32, ptr %15, align 4, !tbaa !9
  %258 = icmp ne i32 %257, 1
  br i1 %258, label %259, label %309

259:                                              ; preds = %256
  call void @llvm.lifetime.start.p0(i64 52, ptr %17) #5
  %260 = load i32, ptr %15, align 4, !tbaa !9
  %261 = icmp eq i32 %260, -5
  br i1 %261, label %262, label %268

262:                                              ; preds = %259
  %263 = getelementptr inbounds [52 x i8], ptr %17, i64 0, i64 0
  %264 = load ptr, ptr %7, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.png_struct_def, ptr %264, i32 0, i32 43
  %266 = getelementptr inbounds [5 x i8], ptr %265, i64 0, i64 0
  %267 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %263, i64 noundef 52, ptr noundef @.str.5, ptr noundef %266) #5
  br label %284

268:                                              ; preds = %259
  %269 = load i32, ptr %15, align 4, !tbaa !9
  %270 = icmp eq i32 %269, -3
  br i1 %270, label %271, label %277

271:                                              ; preds = %268
  %272 = getelementptr inbounds [52 x i8], ptr %17, i64 0, i64 0
  %273 = load ptr, ptr %7, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct.png_struct_def, ptr %273, i32 0, i32 43
  %275 = getelementptr inbounds [5 x i8], ptr %274, i64 0, i64 0
  %276 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %272, i64 noundef 52, ptr noundef @.str.6, ptr noundef %275) #5
  br label %283

277:                                              ; preds = %268
  %278 = getelementptr inbounds [52 x i8], ptr %17, i64 0, i64 0
  %279 = load ptr, ptr %7, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.png_struct_def, ptr %279, i32 0, i32 43
  %281 = getelementptr inbounds [5 x i8], ptr %280, i64 0, i64 0
  %282 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %278, i64 noundef 52, ptr noundef @.str.7, ptr noundef %281) #5
  br label %283

283:                                              ; preds = %277, %271
  br label %284

284:                                              ; preds = %283, %262
  %285 = load ptr, ptr %7, align 8, !tbaa !5
  %286 = getelementptr inbounds [52 x i8], ptr %17, i64 0, i64 0
  call void @png_warning(ptr noundef %285, ptr noundef %286)
  %287 = load i64, ptr %11, align 8, !tbaa !11
  store i64 %287, ptr %14, align 8, !tbaa !11
  %288 = load ptr, ptr %13, align 8, !tbaa !5
  %289 = icmp eq ptr %288, null
  br i1 %289, label %290, label %305

290:                                              ; preds = %284
  %291 = load ptr, ptr %7, align 8, !tbaa !5
  %292 = load i64, ptr %14, align 8, !tbaa !11
  %293 = add i64 %292, 1
  %294 = call ptr @png_malloc_warn(ptr noundef %291, i64 noundef %293)
  store ptr %294, ptr %13, align 8, !tbaa !5
  %295 = load ptr, ptr %13, align 8, !tbaa !5
  %296 = icmp eq ptr %295, null
  br i1 %296, label %297, label %301

297:                                              ; preds = %290
  %298 = load ptr, ptr %7, align 8, !tbaa !5
  %299 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_free(ptr noundef %298, ptr noundef %299)
  %300 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_error(ptr noundef %300, ptr noundef @.str.8)
  br label %301

301:                                              ; preds = %297, %290
  %302 = load ptr, ptr %13, align 8, !tbaa !5
  %303 = load ptr, ptr %9, align 8, !tbaa !5
  %304 = load i64, ptr %11, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %302, ptr align 1 %303, i64 %304, i1 false)
  br label %305

305:                                              ; preds = %301, %284
  %306 = load ptr, ptr %13, align 8, !tbaa !5
  %307 = load i64, ptr %14, align 8, !tbaa !11
  %308 = getelementptr inbounds i8, ptr %306, i64 %307
  store i8 0, ptr %308, align 1, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 52, ptr %17) #5
  br label %309

309:                                              ; preds = %305, %256
  %310 = load ptr, ptr %7, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.png_struct_def, ptr %310, i32 0, i32 15
  %312 = call i32 @inflateReset(ptr noundef %311)
  %313 = load ptr, ptr %7, align 8, !tbaa !5
  %314 = getelementptr inbounds %struct.png_struct_def, ptr %313, i32 0, i32 15
  %315 = getelementptr inbounds %struct.z_stream_s, ptr %314, i32 0, i32 1
  store i32 0, ptr %315, align 8, !tbaa !22
  %316 = load ptr, ptr %7, align 8, !tbaa !5
  %317 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_free(ptr noundef %316, ptr noundef %317)
  %318 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %318, ptr %9, align 8, !tbaa !5
  %319 = load i64, ptr %14, align 8, !tbaa !11
  %320 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %319, ptr %320, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %332

321:                                              ; preds = %6
  call void @llvm.lifetime.start.p0(i64 50, ptr %18) #5
  %322 = getelementptr inbounds [50 x i8], ptr %18, i64 0, i64 0
  %323 = load i32, ptr %8, align 4, !tbaa !9
  %324 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %322, i64 noundef 50, ptr noundef @.str.9, i32 noundef %323) #5
  %325 = load ptr, ptr %7, align 8, !tbaa !5
  %326 = getelementptr inbounds [50 x i8], ptr %18, i64 0, i64 0
  call void @png_warning(ptr noundef %325, ptr noundef %326)
  %327 = load ptr, ptr %9, align 8, !tbaa !5
  %328 = load i64, ptr %11, align 8, !tbaa !11
  %329 = getelementptr inbounds i8, ptr %327, i64 %328
  store i8 0, ptr %329, align 1, !tbaa !28
  %330 = load i64, ptr %11, align 8, !tbaa !11
  %331 = load ptr, ptr %12, align 8, !tbaa !5
  store i64 %330, ptr %331, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 50, ptr %18) #5
  br label %332

332:                                              ; preds = %321, %309
  %333 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  ret ptr %333
}

declare i32 @inflate(ptr noundef, i32 noundef) #1

declare void @png_warning(ptr noundef, ptr noundef) #1

declare i32 @inflateReset(ptr noundef) #1

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

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

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 304}
!14 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !7, i64 272, !7, i64 273, !12, i64 280, !12, i64 288, !12, i64 296, !15, i64 304, !6, i64 416, !12, i64 424, !10, i64 432, !10, i64 436, !10, i64 440, !10, i64 444, !10, i64 448, !12, i64 456, !12, i64 464, !12, i64 472, !12, i64 480, !12, i64 488, !12, i64 496, !12, i64 504, !12, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !16, i64 568, !12, i64 592, !12, i64 600, !6, i64 608, !17, i64 616, !17, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !17, i64 638, !7, i64 640, !18, i64 644, !19, i64 648, !19, i64 658, !6, i64 672, !12, i64 680, !12, i64 688, !10, i64 696, !18, i64 700, !18, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !20, i64 760, !20, i64 765, !6, i64 776, !19, i64 784, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !6, i64 864, !12, i64 872, !12, i64 880, !12, i64 888, !12, i64 896, !12, i64 904, !12, i64 912, !10, i64 920, !10, i64 924, !12, i64 928, !12, i64 936, !6, i64 944, !6, i64 952, !6, i64 960, !6, i64 968, !6, i64 976, !7, i64 984, !7, i64 985, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !12, i64 1040, !6, i64 1048, !6, i64 1056, !10, i64 1064, !6, i64 1072, !7, i64 1080, !17, i64 1082, !17, i64 1084, !17, i64 1086, !12, i64 1088, !12, i64 1096, !7, i64 1104, !7, i64 1105, !12, i64 1112, !12, i64 1120, !6, i64 1128, !6, i64 1136, !6, i64 1144, !6, i64 1152, !6, i64 1160, !6, i64 1168, !6, i64 1176, !7, i64 1184, !12, i64 1192, !12, i64 1200, !21, i64 1208, !12, i64 1240, !12, i64 1248}
!15 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !12, i64 16, !6, i64 24, !10, i64 32, !12, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !12, i64 96, !12, i64 104}
!16 = !{!"png_row_info_struct", !12, i64 0, !12, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!17 = !{!"short", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"png_color_16_struct", !7, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !17, i64 8}
!20 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!21 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !12, i64 16, !7, i64 24}
!22 = !{!14, !10, i64 312}
!23 = !{!14, !6, i64 416}
!24 = !{!14, !6, i64 328}
!25 = !{!14, !12, i64 424}
!26 = !{!14, !10, i64 336}
!27 = !{!14, !6, i64 352}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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

@png_decompress_chunk.msg = external hidden constant [31 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [33 x i8], align 1

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

declare void @png_error(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @png_decompress_chunk(ptr noundef %0, i32 noundef %1, ptr noundef %2, i64 noundef %3, i64 noundef %4, ptr nocapture noundef writeonly %5) local_unnamed_addr #2 {
  %7 = alloca [52 x i8], align 16
  %8 = alloca [50 x i8], align 16
  %9 = icmp eq i32 %1, 0
  br i1 %9, label %10, label %107

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %2, i64 %4
  %12 = getelementptr inbounds i8, ptr %0, i64 304
  store ptr %11, ptr %12, align 8, !tbaa !5
  %13 = sub i64 %3, %4
  %14 = trunc i64 %13 to i32
  %15 = getelementptr inbounds i8, ptr %0, i64 312
  store i32 %14, ptr %15, align 8, !tbaa !19
  %16 = getelementptr inbounds i8, ptr %0, i64 416
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %0, i64 328
  store ptr %17, ptr %18, align 8, !tbaa !21
  %19 = getelementptr inbounds i8, ptr %0, i64 424
  %20 = load i64, ptr %19, align 8, !tbaa !22
  %21 = trunc i64 %20 to i32
  %22 = getelementptr inbounds i8, ptr %0, i64 336
  store i32 %21, ptr %22, align 8, !tbaa !23
  %.not168 = icmp eq i32 %14, 0
  br i1 %.not168, label %.thread152, label %.lr.ph

.thread152:                                       ; preds = %80, %10
  %.0134.lcssa = phi ptr [ null, %10 ], [ %.3137, %80 ]
  call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %7) #6
  br label %94

.lr.ph:                                           ; preds = %10, %80
  %.0132170 = phi i64 [ %.3, %80 ], [ 0, %10 ]
  %.0134169 = phi ptr [ %.3137, %80 ], [ null, %10 ]
  %23 = tail call i32 @inflate(ptr noundef nonnull %12, i32 noundef 1) #6
  %or.cond = icmp ugt i32 %23, 1
  br i1 %or.cond, label %24, label %35

24:                                               ; preds = %.lr.ph
  %25 = getelementptr inbounds i8, ptr %0, i64 352
  %26 = load ptr, ptr %25, align 8, !tbaa !24
  %.not144 = icmp eq ptr %26, null
  %png_decompress_chunk.msg. = select i1 %.not144, ptr @png_decompress_chunk.msg, ptr %26
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull %png_decompress_chunk.msg.) #6
  %27 = tail call i32 @inflateReset(ptr noundef nonnull %12) #6
  store i32 0, ptr %15, align 8, !tbaa !19
  %28 = icmp eq ptr %.0134169, null
  br i1 %28, label %29, label %82

29:                                               ; preds = %24
  %30 = add i64 %4, 32
  %31 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %30) #6
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %2) #6
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.2) #6
  br label %34

34:                                               ; preds = %33, %29
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %31, ptr align 1 %2, i64 %4, i1 false)
  br label %82

35:                                               ; preds = %.lr.ph
  %36 = load i32, ptr %22, align 8, !tbaa !23
  %37 = icmp eq i32 %36, 0
  %38 = icmp eq i32 %23, 1
  %or.cond3 = or i1 %38, %37
  br i1 %or.cond3, label %39, label %80

39:                                               ; preds = %35
  %40 = icmp eq ptr %.0134169, null
  %41 = load i64, ptr %19, align 8, !tbaa !22
  %42 = zext i32 %36 to i64
  br i1 %40, label %43, label %55

43:                                               ; preds = %39
  %44 = sub i64 %4, %42
  %45 = add i64 %44, %41
  %46 = add i64 %45, 1
  %47 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %46) #6
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %50

49:                                               ; preds = %43
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %2) #6
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.3) #6
  br label %50

50:                                               ; preds = %49, %43
  %51 = getelementptr inbounds i8, ptr %47, i64 %4
  %52 = load ptr, ptr %16, align 8, !tbaa !20
  %53 = sub i64 %45, %4
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %51, ptr align 1 %52, i64 %53, i1 false)
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %47, ptr align 1 %2, i64 %4, i1 false)
  %54 = getelementptr inbounds i8, ptr %47, i64 %45
  br label %75

55:                                               ; preds = %39
  %56 = add i64 %.0132170, 1
  %57 = sub i64 %56, %42
  %58 = add i64 %57, %41
  %59 = tail call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %58) #6
  %60 = icmp eq ptr %59, null
  br i1 %60, label %61, label %62

61:                                               ; preds = %55
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %.0134169) #6
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %2) #6
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.4) #6
  br label %62

62:                                               ; preds = %61, %55
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %59, ptr nonnull align 1 %.0134169, i64 %.0132170, i1 false)
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %.0134169) #6
  %63 = getelementptr inbounds i8, ptr %59, i64 %.0132170
  %64 = load ptr, ptr %16, align 8, !tbaa !20
  %65 = load i64, ptr %19, align 8, !tbaa !22
  %66 = load i32, ptr %22, align 8, !tbaa !23
  %67 = zext i32 %66 to i64
  %68 = sub i64 %65, %67
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %63, ptr align 1 %64, i64 %68, i1 false)
  %69 = load i64, ptr %19, align 8, !tbaa !22
  %70 = load i32, ptr %22, align 8, !tbaa !23
  %71 = zext i32 %70 to i64
  %72 = sub i64 %69, %71
  %73 = add i64 %72, %.0132170
  %74 = getelementptr inbounds i8, ptr %59, i64 %73
  br label %75

75:                                               ; preds = %62, %50
  %.sink = phi ptr [ %74, %62 ], [ %54, %50 ]
  %.2136 = phi ptr [ %59, %62 ], [ %47, %50 ]
  %.2 = phi i64 [ %73, %62 ], [ %45, %50 ]
  store i8 0, ptr %.sink, align 1, !tbaa !25
  br i1 %38, label %.loopexit, label %76

76:                                               ; preds = %75
  %77 = load ptr, ptr %16, align 8, !tbaa !20
  store ptr %77, ptr %18, align 8, !tbaa !21
  %78 = load i64, ptr %19, align 8, !tbaa !22
  %79 = trunc i64 %78 to i32
  store i32 %79, ptr %22, align 8, !tbaa !23
  br label %80

80:                                               ; preds = %35, %76
  %.3137 = phi ptr [ %.2136, %76 ], [ %.0134169, %35 ]
  %.3 = phi i64 [ %.2, %76 ], [ %.0132170, %35 ]
  %81 = load i32, ptr %15, align 8, !tbaa !19
  %.not = icmp eq i32 %81, 0
  br i1 %.not, label %.thread152, label %.lr.ph, !llvm.loop !26

82:                                               ; preds = %24, %34
  %.1135 = phi ptr [ %31, %34 ], [ %.0134169, %24 ]
  %.1133 = phi i64 [ %30, %34 ], [ %.0132170, %24 ]
  %83 = add i64 %.1133, -1
  %84 = getelementptr inbounds i8, ptr %.1135, i64 %83
  store i8 0, ptr %84, align 1, !tbaa !25
  %85 = ptrtoint ptr %.1135 to i64
  %86 = ptrtoint ptr %2 to i64
  %.neg = add i64 %86, -1
  %87 = add i64 %.neg, %3
  %88 = sub i64 %87, %85
  %89 = tail call i64 @llvm.umin.i64(i64 %88, i64 31)
  %90 = getelementptr inbounds i8, ptr %.1135, i64 %4
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %90, ptr nonnull align 16 @png_decompress_chunk.msg, i64 %89, i1 false)
  call void @llvm.lifetime.start.p0(i64 52, ptr nonnull %7) #6
  switch i32 %23, label %94 [
    i32 -5, label %.thread158
    i32 -3, label %91
  ]

91:                                               ; preds = %82
  br label %.thread158

.thread158:                                       ; preds = %82, %91
  %.str.6.sink = phi ptr [ @.str.6, %91 ], [ @.str.5, %82 ]
  %92 = getelementptr inbounds i8, ptr %0, i64 620
  %93 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %7, i64 noundef 52, ptr noundef nonnull %.str.6.sink, ptr noundef nonnull %92) #6
  call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull %7) #6
  br label %104

94:                                               ; preds = %82, %.thread152
  %.4138.ph156 = phi ptr [ %.0134.lcssa, %.thread152 ], [ %.1135, %82 ]
  %95 = getelementptr inbounds i8, ptr %0, i64 620
  %96 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %7, i64 noundef 52, ptr noundef nonnull @.str.7, ptr noundef nonnull %95) #6
  call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull %7) #6
  %97 = icmp eq ptr %.4138.ph156, null
  br i1 %97, label %98, label %104

98:                                               ; preds = %94
  %99 = add i64 %4, 1
  %100 = call ptr @png_malloc_warn(ptr noundef nonnull %0, i64 noundef %99) #6
  %101 = icmp eq ptr %100, null
  br i1 %101, label %102, label %103

102:                                              ; preds = %98
  call void @png_free(ptr noundef nonnull %0, ptr noundef %2) #6
  call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.8) #6
  br label %103

103:                                              ; preds = %102, %98
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %100, ptr align 1 %2, i64 %4, i1 false)
  br label %104

104:                                              ; preds = %.thread158, %103, %94
  %.5139 = phi ptr [ %100, %103 ], [ %.4138.ph156, %94 ], [ %.1135, %.thread158 ]
  %105 = getelementptr inbounds i8, ptr %.5139, i64 %4
  store i8 0, ptr %105, align 1, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 52, ptr nonnull %7) #6
  br label %.loopexit

.loopexit:                                        ; preds = %75, %104
  %.6 = phi ptr [ %.5139, %104 ], [ %.2136, %75 ]
  %.5 = phi i64 [ %4, %104 ], [ %.2, %75 ]
  %106 = call i32 @inflateReset(ptr noundef nonnull %12) #6
  store i32 0, ptr %15, align 8, !tbaa !19
  call void @png_free(ptr noundef nonnull %0, ptr noundef %2) #6
  store i64 %.5, ptr %5, align 8, !tbaa !28
  br label %110

107:                                              ; preds = %6
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %8) #6
  %108 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %8, i64 noundef 50, ptr noundef nonnull @.str.9, i32 noundef %1) #6
  call void @png_warning(ptr noundef %0, ptr noundef nonnull %8) #6
  %109 = getelementptr inbounds i8, ptr %2, i64 %4
  store i8 0, ptr %109, align 1, !tbaa !25
  store i64 %4, ptr %5, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %8) #6
  br label %110

110:                                              ; preds = %107, %.loopexit
  %.0 = phi ptr [ %.6, %.loopexit ], [ %2, %107 ]
  ret ptr %.0
}

declare i32 @inflate(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @png_warning(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @inflateReset(ptr noundef) local_unnamed_addr #1

declare ptr @png_malloc_warn(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress 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) #3

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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, !9, i64 304}
!6 = !{!"png_struct_def", !7, i64 0, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !7, i64 272, !7, i64 273, !10, i64 280, !10, i64 288, !10, i64 296, !11, i64 304, !9, i64 416, !10, i64 424, !12, i64 432, !12, i64 436, !12, i64 440, !12, i64 444, !12, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !9, i64 520, !9, i64 528, !9, i64 536, !9, i64 544, !9, i64 552, !9, i64 560, !13, i64 568, !10, i64 592, !10, i64 600, !9, i64 608, !14, i64 616, !14, i64 618, !7, i64 620, !7, i64 625, !7, i64 626, !7, i64 627, !7, i64 628, !7, i64 629, !7, i64 630, !7, i64 631, !7, i64 632, !7, i64 633, !7, i64 634, !7, i64 635, !7, i64 636, !14, i64 638, !7, i64 640, !15, i64 644, !16, i64 648, !16, i64 658, !9, i64 672, !10, i64 680, !10, i64 688, !12, i64 696, !15, i64 700, !15, i64 704, !9, i64 712, !9, i64 720, !9, i64 728, !9, i64 736, !9, i64 744, !9, i64 752, !17, i64 760, !17, i64 765, !9, i64 776, !16, i64 784, !9, i64 800, !9, i64 808, !9, i64 816, !9, i64 824, !9, i64 832, !9, i64 840, !9, i64 848, !9, i64 856, !9, i64 864, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !12, i64 920, !12, i64 924, !10, i64 928, !10, i64 936, !9, i64 944, !9, i64 952, !9, i64 960, !9, i64 968, !9, i64 976, !7, i64 984, !7, i64 985, !9, i64 992, !9, i64 1000, !9, i64 1008, !9, i64 1016, !9, i64 1024, !9, i64 1032, !10, i64 1040, !9, i64 1048, !9, i64 1056, !12, i64 1064, !9, i64 1072, !7, i64 1080, !14, i64 1082, !14, i64 1084, !14, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, i64 1120, !9, i64 1128, !9, i64 1136, !9, i64 1144, !9, i64 1152, !9, i64 1160, !9, i64 1168, !9, i64 1176, !7, i64 1184, !10, i64 1192, !10, i64 1200, !18, i64 1208, !10, i64 1240, !10, i64 1248}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!"z_stream_s", !9, i64 0, !12, i64 8, !10, i64 16, !9, i64 24, !12, i64 32, !10, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !12, i64 88, !10, i64 96, !10, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"png_row_info_struct", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!14 = !{!"short", !7, i64 0}
!15 = !{!"float", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !14, i64 2, !14, i64 4, !14, i64 6, !14, 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, !9, i64 8, !10, i64 16, !7, i64 24}
!19 = !{!6, !12, i64 312}
!20 = !{!6, !9, i64 416}
!21 = !{!6, !9, i64 328}
!22 = !{!6, !10, i64 424}
!23 = !{!6, !12, i64 336}
!24 = !{!6, !9, i64 352}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!10, !10, i64 0}


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