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

@.str.55 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [20 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: noreturn
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
declare dso_local i32 @png_read_chunk_header(ptr noalias noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @png_zlib_inflate(ptr noalias noundef, i32 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) #2

; Function Attrs: nounwind uwtable
define dso_local void @png_read_IDAT_data(ptr noalias noundef %0, ptr noundef %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca [1024 x i8], align 16
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.png_struct_def, ptr %14, i32 0, i32 19
  %16 = getelementptr inbounds %struct.z_stream_s, ptr %15, i32 0, i32 3
  store ptr %13, ptr %16, align 8, !tbaa !11
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.png_struct_def, ptr %17, i32 0, i32 19
  %19 = getelementptr inbounds %struct.z_stream_s, ptr %18, i32 0, i32 4
  store i32 0, ptr %19, align 8, !tbaa !22
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %3
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %22, %3
  br label %24

24:                                               ; preds = %189, %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 1024, ptr %8) #4
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.png_struct_def, ptr %25, i32 0, i32 19
  %27 = getelementptr inbounds %struct.z_stream_s, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !23
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %84

30:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  br label %31

31:                                               ; preds = %49, %30
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.png_struct_def, ptr %32, i32 0, i32 50
  %34 = load i32, ptr %33, align 8, !tbaa !24
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %50

36:                                               ; preds = %31
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = call i32 @png_crc_finish(ptr noundef %37, i32 noundef 0)
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = call i32 @png_read_chunk_header(ptr noundef %39)
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.png_struct_def, ptr %41, i32 0, i32 50
  store i32 %40, ptr %42, align 8, !tbaa !24
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.png_struct_def, ptr %43, i32 0, i32 44
  %45 = load i32, ptr %44, align 8, !tbaa !25
  %46 = icmp ne i32 %45, 1229209940
  br i1 %46, label %47, label %49

47:                                               ; preds = %36
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %48, ptr noundef @.str.55) #5
  unreachable

49:                                               ; preds = %36
  br label %31, !llvm.loop !26

50:                                               ; preds = %31
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.png_struct_def, ptr %51, i32 0, i32 140
  %53 = load i32, ptr %52, align 8, !tbaa !28
  store i32 %53, ptr %9, align 4, !tbaa !29
  %54 = load i32, ptr %9, align 4, !tbaa !29
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.png_struct_def, ptr %55, i32 0, i32 50
  %57 = load i32, ptr %56, align 8, !tbaa !24
  %58 = icmp ugt i32 %54, %57
  br i1 %58, label %59, label %63

59:                                               ; preds = %50
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.png_struct_def, ptr %60, i32 0, i32 50
  %62 = load i32, ptr %61, align 8, !tbaa !24
  store i32 %62, ptr %9, align 4, !tbaa !29
  br label %63

63:                                               ; preds = %59, %50
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !29
  %66 = zext i32 %65 to i64
  %67 = call ptr @png_read_buffer(ptr noundef %64, i64 noundef %66, i32 noundef 0)
  store ptr %67, ptr %10, align 8, !tbaa !5
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = load i32, ptr %9, align 4, !tbaa !29
  call void @png_crc_read(ptr noundef %68, ptr noundef %69, i32 noundef %70)
  %71 = load i32, ptr %9, align 4, !tbaa !29
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.png_struct_def, ptr %72, i32 0, i32 50
  %74 = load i32, ptr %73, align 8, !tbaa !24
  %75 = sub i32 %74, %71
  store i32 %75, ptr %73, align 8, !tbaa !24
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.png_struct_def, ptr %77, i32 0, i32 19
  %79 = getelementptr inbounds %struct.z_stream_s, ptr %78, i32 0, i32 0
  store ptr %76, ptr %79, align 8, !tbaa !30
  %80 = load i32, ptr %9, align 4, !tbaa !29
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.png_struct_def, ptr %81, i32 0, i32 19
  %83 = getelementptr inbounds %struct.z_stream_s, ptr %82, i32 0, i32 1
  store i32 %80, ptr %83, align 8, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %84

84:                                               ; preds = %63, %24
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %104

87:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 -1, ptr %11, align 4, !tbaa !29
  %88 = load i32, ptr %11, align 4, !tbaa !29
  %89 = zext i32 %88 to i64
  %90 = load i64, ptr %6, align 8, !tbaa !9
  %91 = icmp ugt i64 %89, %90
  br i1 %91, label %92, label %95

92:                                               ; preds = %87
  %93 = load i64, ptr %6, align 8, !tbaa !9
  %94 = trunc i64 %93 to i32
  store i32 %94, ptr %11, align 4, !tbaa !29
  br label %95

95:                                               ; preds = %92, %87
  %96 = load i32, ptr %11, align 4, !tbaa !29
  %97 = zext i32 %96 to i64
  %98 = load i64, ptr %6, align 8, !tbaa !9
  %99 = sub i64 %98, %97
  store i64 %99, ptr %6, align 8, !tbaa !9
  %100 = load i32, ptr %11, align 4, !tbaa !29
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.png_struct_def, ptr %101, i32 0, i32 19
  %103 = getelementptr inbounds %struct.z_stream_s, ptr %102, i32 0, i32 4
  store i32 %100, ptr %103, align 8, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %112

104:                                              ; preds = %84
  %105 = getelementptr inbounds [1024 x i8], ptr %8, i64 0, i64 0
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.png_struct_def, ptr %106, i32 0, i32 19
  %108 = getelementptr inbounds %struct.z_stream_s, ptr %107, i32 0, i32 3
  store ptr %105, ptr %108, align 8, !tbaa !11
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.png_struct_def, ptr %109, i32 0, i32 19
  %111 = getelementptr inbounds %struct.z_stream_s, ptr %110, i32 0, i32 4
  store i32 1024, ptr %111, align 8, !tbaa !22
  br label %112

112:                                              ; preds = %104, %95
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = call i32 @png_zlib_inflate(ptr noundef %113, i32 noundef 0)
  store i32 %114, ptr %7, align 4, !tbaa !29
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = icmp ne ptr %115, null
  br i1 %116, label %117, label %125

117:                                              ; preds = %112
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.png_struct_def, ptr %118, i32 0, i32 19
  %120 = getelementptr inbounds %struct.z_stream_s, ptr %119, i32 0, i32 4
  %121 = load i32, ptr %120, align 8, !tbaa !22
  %122 = zext i32 %121 to i64
  %123 = load i64, ptr %6, align 8, !tbaa !9
  %124 = add i64 %123, %122
  store i64 %124, ptr %6, align 8, !tbaa !9
  br label %134

125:                                              ; preds = %112
  %126 = load ptr, ptr %4, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.png_struct_def, ptr %126, i32 0, i32 19
  %128 = getelementptr inbounds %struct.z_stream_s, ptr %127, i32 0, i32 4
  %129 = load i32, ptr %128, align 8, !tbaa !22
  %130 = zext i32 %129 to i64
  %131 = sub i64 1024, %130
  %132 = load i64, ptr %6, align 8, !tbaa !9
  %133 = add i64 %132, %131
  store i64 %133, ptr %6, align 8, !tbaa !9
  br label %134

134:                                              ; preds = %125, %117
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.png_struct_def, ptr %135, i32 0, i32 19
  %137 = getelementptr inbounds %struct.z_stream_s, ptr %136, i32 0, i32 4
  store i32 0, ptr %137, align 8, !tbaa !22
  %138 = load i32, ptr %7, align 4, !tbaa !29
  %139 = icmp eq i32 %138, 1
  br i1 %139, label %140, label %165

140:                                              ; preds = %134
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.png_struct_def, ptr %141, i32 0, i32 19
  %143 = getelementptr inbounds %struct.z_stream_s, ptr %142, i32 0, i32 3
  store ptr null, ptr %143, align 8, !tbaa !11
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_struct_def, ptr %144, i32 0, i32 15
  %146 = load i32, ptr %145, align 4, !tbaa !31
  %147 = or i32 %146, 8
  store i32 %147, ptr %145, align 4, !tbaa !31
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.png_struct_def, ptr %148, i32 0, i32 16
  %150 = load i32, ptr %149, align 8, !tbaa !32
  %151 = or i32 %150, 8
  store i32 %151, ptr %149, align 8, !tbaa !32
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.png_struct_def, ptr %152, i32 0, i32 19
  %154 = getelementptr inbounds %struct.z_stream_s, ptr %153, i32 0, i32 1
  %155 = load i32, ptr %154, align 8, !tbaa !23
  %156 = icmp ugt i32 %155, 0
  br i1 %156, label %162, label %157

157:                                              ; preds = %140
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.png_struct_def, ptr %158, i32 0, i32 50
  %160 = load i32, ptr %159, align 8, !tbaa !24
  %161 = icmp ugt i32 %160, 0
  br i1 %161, label %162, label %164

162:                                              ; preds = %157, %140
  %163 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %163, ptr noundef @.str.56)
  br label %164

164:                                              ; preds = %162, %157
  store i32 2, ptr %12, align 4
  br label %186

165:                                              ; preds = %134
  %166 = load i32, ptr %7, align 4, !tbaa !29
  %167 = icmp ne i32 %166, 0
  br i1 %167, label %168, label %185

168:                                              ; preds = %165
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = load i32, ptr %7, align 4, !tbaa !29
  call void @png_zstream_error(ptr noundef %169, i32 noundef %170)
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = icmp ne ptr %171, null
  br i1 %172, label %173, label %179

173:                                              ; preds = %168
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  %175 = load ptr, ptr %4, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.png_struct_def, ptr %175, i32 0, i32 19
  %177 = getelementptr inbounds %struct.z_stream_s, ptr %176, i32 0, i32 6
  %178 = load ptr, ptr %177, align 8, !tbaa !33
  call void @png_chunk_error(ptr noundef %174, ptr noundef %178) #5
  unreachable

179:                                              ; preds = %168
  %180 = load ptr, ptr %4, align 8, !tbaa !5
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.png_struct_def, ptr %181, i32 0, i32 19
  %183 = getelementptr inbounds %struct.z_stream_s, ptr %182, i32 0, i32 6
  %184 = load ptr, ptr %183, align 8, !tbaa !33
  call void @png_chunk_benign_error(ptr noundef %180, ptr noundef %184)
  store i32 1, ptr %12, align 4
  br label %186

185:                                              ; preds = %165
  store i32 0, ptr %12, align 4
  br label %186

186:                                              ; preds = %185, %179, %164
  call void @llvm.lifetime.end.p0(i64 1024, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  %187 = load i32, ptr %12, align 4
  switch i32 %187, label %204 [
    i32 0, label %188
    i32 2, label %192
    i32 1, label %203
  ]

188:                                              ; preds = %186
  br label %189

189:                                              ; preds = %188
  %190 = load i64, ptr %6, align 8, !tbaa !9
  %191 = icmp ugt i64 %190, 0
  br i1 %191, label %24, label %192, !llvm.loop !34

192:                                              ; preds = %189, %186
  %193 = load i64, ptr %6, align 8, !tbaa !9
  %194 = icmp ugt i64 %193, 0
  br i1 %194, label %195, label %203

195:                                              ; preds = %192
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %200

198:                                              ; preds = %195
  %199 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %199, ptr noundef @.str.55) #5
  unreachable

200:                                              ; preds = %195
  %201 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %201, ptr noundef @.str.57)
  br label %202

202:                                              ; preds = %200
  br label %203

203:                                              ; preds = %202, %192, %186
  ret void

204:                                              ; preds = %186
  unreachable
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 344}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !10, 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, !13, i64 300, !13, i64 304, !13, i64 308, !13, i64 312, !14, i64 320, !6, i64 432, !13, i64 440, !13, i64 444, !13, i64 448, !13, i64 452, !13, i64 456, !13, i64 460, !13, i64 464, !13, i64 468, !13, i64 472, !13, i64 476, !13, i64 480, !13, i64 484, !13, i64 488, !13, i64 492, !13, i64 496, !13, i64 500, !13, i64 504, !13, i64 508, !13, i64 512, !13, i64 516, !10, i64 520, !13, i64 528, !13, i64 532, !13, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !10, i64 576, !13, i64 584, !13, i64 588, !6, i64 592, !15, i64 600, !13, 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, !13, i64 632, !16, i64 636, !16, i64 646, !6, i64 656, !13, i64 664, !13, i64 668, !13, i64 672, !13, 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, !13, i64 840, !13, i64 844, !10, i64 848, !10, i64 856, !10, i64 864, !10, i64 872, !13, i64 880, !13, i64 884, !6, i64 888, !6, i64 896, !13, i64 904, !7, i64 908, !13, i64 940, !6, i64 944, !6, i64 952, !13, i64 960, !13, i64 964, !6, i64 968, !7, i64 976, !7, i64 977, !15, i64 978, !15, i64 980, !13, 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, !13, i64 1052, !13, i64 1056, !13, i64 1060, !10, i64 1064, !18, i64 1072, !10, i64 1104, !6, i64 1112, !10, i64 1120, !13, i64 1128, !13, i64 1132, !6, i64 1136, !7, i64 1144, !19, i64 1176}
!13 = !{!"int", !7, i64 0}
!14 = !{!"z_stream_s", !6, i64 0, !13, i64 8, !10, i64 16, !6, i64 24, !13, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !13, i64 88, !10, i64 96, !10, 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, !10, i64 16, !7, i64 24}
!19 = !{!"png_colorspace", !13, i64 0, !20, i64 4, !21, i64 36, !15, i64 72, !15, i64 74}
!20 = !{!"png_xy", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28}
!21 = !{!"png_XYZ", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32}
!22 = !{!12, !13, i64 352}
!23 = !{!12, !13, i64 328}
!24 = !{!12, !13, i64 584}
!25 = !{!12, !13, i64 536}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!12, !13, i64 1128}
!29 = !{!13, !13, i64 0}
!30 = !{!12, !6, i64 320}
!31 = !{!12, !13, i64 300}
!32 = !{!12, !13, i64 304}
!33 = !{!12, !6, i64 368}
!34 = distinct !{!34, !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.55 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [20 x i8], align 1

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

; Function Attrs: noreturn
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
declare dso_local i32 @png_read_chunk_header(ptr noalias noundef) local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_read_IDAT_data(ptr noalias noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = alloca [1024 x i8], align 16
  %5 = getelementptr inbounds i8, ptr %0, i64 320
  %6 = getelementptr inbounds i8, ptr %0, i64 344
  store ptr %1, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 352
  store i32 0, ptr %7, align 8, !tbaa !20
  %8 = icmp eq ptr %1, null
  %9 = getelementptr inbounds i8, ptr %0, i64 328
  %10 = getelementptr inbounds i8, ptr %0, i64 584
  %11 = getelementptr inbounds i8, ptr %0, i64 536
  %12 = getelementptr inbounds i8, ptr %0, i64 1128
  br i1 %8, label %.split.us, label %.split

.split.us:                                        ; preds = %3, %28
  %.1.us = phi i64 [ %27, %28 ], [ 0, %3 ]
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #5
  %13 = load i32, ptr %9, align 8, !tbaa !21
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %.preheader.us.preheader, label %23

.preheader.us.preheader:                          ; preds = %.split.us
  %.pre124 = load i32, ptr %10, align 8, !tbaa !22
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %29
  %15 = phi i32 [ %.pre124, %.preheader.us.preheader ], [ %31, %29 ]
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %29, label %17

17:                                               ; preds = %.preheader.us
  %18 = load i32, ptr %12, align 8, !tbaa !23
  %spec.select75.us = call i32 @llvm.umin.i32(i32 %18, i32 %15)
  %19 = zext i32 %spec.select75.us to i64
  %20 = call ptr @png_read_buffer(ptr noundef nonnull %0, i64 noundef %19, i32 noundef 0)
  call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %20, i32 noundef %spec.select75.us)
  %21 = load i32, ptr %10, align 8, !tbaa !22
  %22 = sub i32 %21, %spec.select75.us
  store i32 %22, ptr %10, align 8, !tbaa !22
  store ptr %20, ptr %5, align 8, !tbaa !24
  store i32 %spec.select75.us, ptr %9, align 8, !tbaa !21
  br label %23

23:                                               ; preds = %17, %.split.us
  store ptr %4, ptr %6, align 8, !tbaa !5
  store i32 1024, ptr %7, align 8, !tbaa !20
  %24 = call i32 @png_zlib_inflate(ptr noundef nonnull %0, i32 noundef 0)
  %25 = load i32, ptr %7, align 8, !tbaa !20
  %26 = zext i32 %25 to i64
  %reass.sub.us = add i64 %.1.us, 1024
  %27 = sub i64 %reass.sub.us, %26
  store i32 0, ptr %7, align 8, !tbaa !20
  switch i32 %24, label %.split98.us [
    i32 1, label %.split100.us
    i32 0, label %28
  ]

28:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  %cond.us = icmp eq i64 %27, 0
  br i1 %cond.us, label %.loopexit, label %.split.us

29:                                               ; preds = %.preheader.us
  %30 = call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %31 = call i32 @png_read_chunk_header(ptr noundef nonnull %0)
  store i32 %31, ptr %10, align 8, !tbaa !22
  %32 = load i32, ptr %11, align 8, !tbaa !25
  %.not74.us = icmp eq i32 %32, 1229209940
  br i1 %.not74.us, label %.preheader.us, label %.split104.us, !llvm.loop !26

.split:                                           ; preds = %3, %64
  %.1 = phi i64 [ %52, %64 ], [ %2, %3 ]
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %4) #5
  %33 = load i32, ptr %9, align 8, !tbaa !21
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %.preheader.preheader, label %47

.preheader.preheader:                             ; preds = %.split
  %.pre = load i32, ptr %10, align 8, !tbaa !22
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %37
  %35 = phi i32 [ %.pre, %.preheader.preheader ], [ %39, %37 ]
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %41

37:                                               ; preds = %.preheader
  %38 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %39 = tail call i32 @png_read_chunk_header(ptr noundef nonnull %0)
  store i32 %39, ptr %10, align 8, !tbaa !22
  %40 = load i32, ptr %11, align 8, !tbaa !25
  %.not74 = icmp eq i32 %40, 1229209940
  br i1 %.not74, label %.preheader, label %.split104.us, !llvm.loop !26

.split104.us:                                     ; preds = %37, %29
  call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.55) #6
  unreachable

41:                                               ; preds = %.preheader
  %42 = load i32, ptr %12, align 8, !tbaa !23
  %spec.select75 = tail call i32 @llvm.umin.i32(i32 %42, i32 %35)
  %43 = zext i32 %spec.select75 to i64
  %44 = tail call ptr @png_read_buffer(ptr noundef nonnull %0, i64 noundef %43, i32 noundef 0)
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %44, i32 noundef %spec.select75)
  %45 = load i32, ptr %10, align 8, !tbaa !22
  %46 = sub i32 %45, %spec.select75
  store i32 %46, ptr %10, align 8, !tbaa !22
  store ptr %44, ptr %5, align 8, !tbaa !24
  store i32 %spec.select75, ptr %9, align 8, !tbaa !21
  br label %47

47:                                               ; preds = %41, %.split
  %spec.select7684 = tail call i64 @llvm.umin.i64(i64 %.1, i64 4294967295)
  %spec.select76 = trunc nuw i64 %spec.select7684 to i32
  %48 = sub i64 %.1, %spec.select7684
  store i32 %spec.select76, ptr %7, align 8, !tbaa !20
  %49 = tail call i32 @png_zlib_inflate(ptr noundef nonnull %0, i32 noundef 0)
  %50 = load i32, ptr %7, align 8, !tbaa !20
  %51 = zext i32 %50 to i64
  %52 = add i64 %48, %51
  store i32 0, ptr %7, align 8, !tbaa !20
  switch i32 %49, label %.split98.us [
    i32 1, label %.split100.us
    i32 0, label %64
  ]

.split100.us:                                     ; preds = %47, %23
  %.us-phi102 = phi i64 [ %27, %23 ], [ %52, %47 ]
  store ptr null, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %0, i64 300
  %54 = load <2 x i32>, ptr %53, align 4, !tbaa !28
  %55 = or <2 x i32> %54, <i32 8, i32 8>
  store <2 x i32> %55, ptr %53, align 4, !tbaa !28
  %56 = load i32, ptr %9, align 8, !tbaa !21
  %.not70 = icmp eq i32 %56, 0
  br i1 %.not70, label %57, label %59

57:                                               ; preds = %.split100.us
  %58 = load i32, ptr %10, align 8, !tbaa !22
  %.not71 = icmp eq i32 %58, 0
  br i1 %.not71, label %65, label %59

59:                                               ; preds = %57, %.split100.us
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.56) #5
  br label %65

.split98.us:                                      ; preds = %47, %23
  %.us-phi = phi i32 [ %24, %23 ], [ %49, %47 ]
  call void @png_zstream_error(ptr noundef nonnull %0, i32 noundef %.us-phi) #5
  %60 = getelementptr inbounds i8, ptr %0, i64 368
  %61 = load ptr, ptr %60, align 8, !tbaa !29
  br i1 %8, label %63, label %62

62:                                               ; preds = %.split98.us
  call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef %61) #6
  unreachable

63:                                               ; preds = %.split98.us
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef %61) #5
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  br label %.loopexit

64:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  %cond = icmp eq i64 %52, 0
  br i1 %cond, label %.loopexit, label %.split

65:                                               ; preds = %59, %57
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %4) #5
  %.not73 = icmp eq i64 %.us-phi102, 0
  br i1 %.not73, label %.loopexit, label %66

66:                                               ; preds = %65
  br i1 %8, label %68, label %67

67:                                               ; preds = %66
  call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.55) #6
  unreachable

68:                                               ; preds = %66
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.57) #5
  br label %.loopexit

.loopexit:                                        ; preds = %64, %28, %63, %68, %65
  ret void
}

declare void @png_zstream_error(ptr noundef, i32 noundef) local_unnamed_addr #3

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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 344}
!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 = !{!6, !11, i64 352}
!21 = !{!6, !11, i64 328}
!22 = !{!6, !11, i64 584}
!23 = !{!6, !11, i64 1128}
!24 = !{!6, !9, i64 320}
!25 = !{!6, !11, i64 536}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!11, !11, i64 0}
!29 = !{!6, !9, i64 368}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass