; 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 }
%struct.png_info_struct = type { i64, i64, i64, i64, ptr, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, [8 x i8], float, i8, i32, i32, ptr, %struct.png_time_struct, %struct.png_color_8_struct, ptr, %struct.png_color_16_struct, %struct.png_color_16_struct, i64, i64, i8, i64, i64, i8, ptr, float, float, float, float, float, float, float, float, ptr, i64, i64, ptr, ptr, i8, i8, i64, ptr, i64, ptr, ptr, i64, i8, ptr, i64, i8, double, double, ptr, ptr, ptr, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
%struct.png_time_struct = type { i16, i8, i8, i8, i8, i8 }

@.str.53 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.60 = 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
declare dso_local void @png_crc_read(ptr noundef, ptr noundef, i64 noundef) #2

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_iCCP(ptr 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 ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 12
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = and i64 %20, 1
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %25, label %23

23:                                               ; preds = %3
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_error(ptr noundef %24, ptr noundef @.str.53)
  br label %46

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

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

36:                                               ; preds = %25
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.png_struct_def, ptr %37, i32 0, i32 12
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %40 = and i64 %39, 2
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %36
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %43, ptr noundef @.str.55)
  br label %44

44:                                               ; preds = %42, %36
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45, %23
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %60

49:                                               ; preds = %46
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.png_info_struct, ptr %50, i32 0, i32 2
  %52 = load i64, ptr %51, align 8, !tbaa !21
  %53 = and i64 %52, 4096
  %54 = icmp ne i64 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %49
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %56, ptr noundef @.str.56)
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = load i64, ptr %6, align 8, !tbaa !9
  %59 = call i32 @png_crc_finish(ptr noundef %57, i64 noundef %58)
  store i32 1, ptr %17, align 4
  br label %187

60:                                               ; preds = %49, %46
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %63 = add i64 %62, 1
  %64 = call ptr @png_malloc(ptr noundef %61, i64 noundef %63)
  store ptr %64, ptr %7, align 8, !tbaa !5
  %65 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %65, ptr %14, align 8, !tbaa !9
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load i64, ptr %14, align 8, !tbaa !9
  call void @png_crc_read(ptr noundef %66, ptr noundef %67, i64 noundef %68)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = load i64, ptr %11, align 8, !tbaa !9
  %71 = call i32 @png_crc_finish(ptr noundef %69, i64 noundef %70)
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %76

73:                                               ; preds = %60
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %74, ptr noundef %75)
  store i32 1, ptr %17, align 4
  br label %187

76:                                               ; preds = %60
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load i64, ptr %14, align 8, !tbaa !9
  %79 = getelementptr inbounds i8, ptr %77, i64 %78
  store i8 0, ptr %79, align 1, !tbaa !25
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %80, ptr %10, align 8, !tbaa !5
  br label %81

81:                                               ; preds = %86, %76
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = load i8, ptr %82, align 1, !tbaa !25
  %84 = icmp ne i8 %83, 0
  br i1 %84, label %85, label %89

85:                                               ; preds = %81
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i32 1
  store ptr %88, ptr %10, align 8, !tbaa !5
  br label %81, !llvm.loop !26

89:                                               ; preds = %81
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = getelementptr inbounds i8, ptr %90, i32 1
  store ptr %91, ptr %10, align 8, !tbaa !5
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = load i64, ptr %14, align 8, !tbaa !9
  %95 = getelementptr inbounds i8, ptr %93, i64 %94
  %96 = getelementptr inbounds i8, ptr %95, i64 -1
  %97 = icmp uge ptr %92, %96
  br i1 %97, label %98, label %102

98:                                               ; preds = %89
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %99, ptr noundef %100)
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %101, ptr noundef @.str.57)
  store i32 1, ptr %17, align 4
  br label %187

102:                                              ; preds = %89
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds i8, ptr %103, i32 1
  store ptr %104, ptr %10, align 8, !tbaa !5
  %105 = load i8, ptr %103, align 1, !tbaa !25
  store i8 %105, ptr %8, align 1, !tbaa !25
  %106 = load i8, ptr %8, align 1, !tbaa !25
  %107 = icmp ne i8 %106, 0
  br i1 %107, label %108, label %110

108:                                              ; preds = %102
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %109, ptr noundef @.str.58)
  store i8 0, ptr %8, align 1, !tbaa !25
  br label %110

110:                                              ; preds = %108, %102
  %111 = load ptr, ptr %10, align 8, !tbaa !5
  %112 = load ptr, ptr %7, align 8, !tbaa !5
  %113 = ptrtoint ptr %111 to i64
  %114 = ptrtoint ptr %112 to i64
  %115 = sub i64 %113, %114
  store i64 %115, ptr %15, align 8, !tbaa !9
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = load i8, ptr %8, align 1, !tbaa !25
  %118 = zext i8 %117 to i32
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = load i64, ptr %14, align 8, !tbaa !9
  %121 = load i64, ptr %15, align 8, !tbaa !9
  %122 = call ptr @png_decompress_chunk(ptr noundef %116, i32 noundef %118, ptr noundef %119, i64 noundef %120, i64 noundef %121, ptr noundef %16)
  store ptr %122, ptr %7, align 8, !tbaa !5
  %123 = load i64, ptr %16, align 8, !tbaa !9
  %124 = load i64, ptr %15, align 8, !tbaa !9
  %125 = sub i64 %123, %124
  store i64 %125, ptr %13, align 8, !tbaa !9
  %126 = load i64, ptr %15, align 8, !tbaa !9
  %127 = load i64, ptr %16, align 8, !tbaa !9
  %128 = icmp ugt i64 %126, %127
  br i1 %128, label %132, label %129

129:                                              ; preds = %110
  %130 = load i64, ptr %13, align 8, !tbaa !9
  %131 = icmp ult i64 %130, 4
  br i1 %131, label %132, label %136

132:                                              ; preds = %129, %110
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %133, ptr noundef %134)
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %135, ptr noundef @.str.59)
  store i32 1, ptr %17, align 4
  br label %187

136:                                              ; preds = %129
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = load i64, ptr %15, align 8, !tbaa !9
  %139 = getelementptr inbounds i8, ptr %137, i64 %138
  store ptr %139, ptr %9, align 8, !tbaa !5
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = load i8, ptr %140, align 1, !tbaa !25
  %142 = zext i8 %141 to i32
  %143 = shl i32 %142, 24
  %144 = load ptr, ptr %9, align 8, !tbaa !5
  %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 = or i32 %143, %148
  %150 = load ptr, ptr %9, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 2
  %152 = load i8, ptr %151, align 1, !tbaa !25
  %153 = zext i8 %152 to i32
  %154 = shl i32 %153, 8
  %155 = or i32 %149, %154
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  %157 = getelementptr inbounds i8, ptr %156, i64 3
  %158 = load i8, ptr %157, align 1, !tbaa !25
  %159 = zext i8 %158 to i32
  %160 = or i32 %155, %159
  %161 = sext i32 %160 to i64
  store i64 %161, ptr %12, align 8, !tbaa !9
  %162 = load i64, ptr %12, align 8, !tbaa !9
  %163 = load i64, ptr %13, align 8, !tbaa !9
  %164 = icmp ult i64 %162, %163
  br i1 %164, label %165, label %167

165:                                              ; preds = %136
  %166 = load i64, ptr %12, align 8, !tbaa !9
  store i64 %166, ptr %13, align 8, !tbaa !9
  br label %167

167:                                              ; preds = %165, %136
  %168 = load i64, ptr %12, align 8, !tbaa !9
  %169 = load i64, ptr %13, align 8, !tbaa !9
  %170 = icmp ugt i64 %168, %169
  br i1 %170, label %171, label %175

171:                                              ; preds = %167
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %172, ptr noundef %173)
  %174 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_warning(ptr noundef %174, ptr noundef @.str.60)
  store i32 1, ptr %17, align 4
  br label %187

175:                                              ; preds = %167
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = load ptr, ptr %7, align 8, !tbaa !5
  %179 = load i8, ptr %8, align 1, !tbaa !25
  %180 = zext i8 %179 to i32
  %181 = load ptr, ptr %7, align 8, !tbaa !5
  %182 = load i64, ptr %15, align 8, !tbaa !9
  %183 = getelementptr inbounds i8, ptr %181, i64 %182
  %184 = load i64, ptr %13, align 8, !tbaa !9
  call void @png_set_iCCP(ptr noundef %176, ptr noundef %177, ptr noundef %178, i32 noundef %180, ptr noundef %183, i64 noundef %184)
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_free(ptr noundef %185, ptr noundef %186)
  store i32 0, ptr %17, align 4
  br label %187

187:                                              ; preds = %175, %171, %132, %98, %73, %55, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %188 = load i32, ptr %17, align 4
  switch i32 %188, label %190 [
    i32 0, label %189
    i32 1, label %189
  ]

189:                                              ; preds = %187, %187
  ret void

190:                                              ; preds = %187
  unreachable
}

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

declare void @png_set_iCCP(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef) #1

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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 280}
!12 = !{!"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, !10, i64 280, !10, i64 288, !10, i64 296, !13, i64 304, !6, i64 416, !10, i64 424, !14, i64 432, !14, i64 436, !14, i64 440, !14, i64 444, !14, 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, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !15, i64 568, !10, i64 592, !10, i64 600, !6, i64 608, !16, i64 616, !16, 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, !16, i64 638, !7, i64 640, !17, i64 644, !18, i64 648, !18, i64 658, !6, i64 672, !10, i64 680, !10, i64 688, !14, i64 696, !17, i64 700, !17, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !19, i64 760, !19, i64 765, !6, i64 776, !18, 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, !10, i64 872, !10, i64 880, !10, i64 888, !10, i64 896, !10, i64 904, !10, i64 912, !14, i64 920, !14, i64 924, !10, i64 928, !10, 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, !10, i64 1040, !6, i64 1048, !6, i64 1056, !14, i64 1064, !6, i64 1072, !7, i64 1080, !16, i64 1082, !16, i64 1084, !16, i64 1086, !10, i64 1088, !10, i64 1096, !7, i64 1104, !7, i64 1105, !10, i64 1112, !10, 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, !10, i64 1192, !10, i64 1200, !20, i64 1208, !10, i64 1240, !10, i64 1248}
!13 = !{!"z_stream_s", !6, i64 0, !14, i64 8, !10, i64 16, !6, i64 24, !14, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !10, i64 96, !10, i64 104}
!14 = !{!"int", !7, i64 0}
!15 = !{!"png_row_info_struct", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19}
!16 = !{!"short", !7, i64 0}
!17 = !{!"float", !7, i64 0}
!18 = !{!"png_color_16_struct", !7, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !16, i64 8}
!19 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!20 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !10, i64 16, !7, i64 24}
!21 = !{!22, !10, i64 16}
!22 = !{!"png_info_struct", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !16, i64 40, !16, i64 42, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52, !17, i64 60, !7, i64 64, !14, i64 68, !14, i64 72, !6, i64 80, !23, i64 88, !19, i64 96, !6, i64 104, !18, i64 112, !18, i64 122, !10, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 168, !7, i64 176, !6, i64 184, !17, i64 192, !17, i64 196, !17, i64 200, !17, i64 204, !17, i64 208, !17, i64 212, !17, i64 216, !17, i64 220, !6, i64 224, !10, i64 232, !10, i64 240, !6, i64 248, !6, i64 256, !7, i64 264, !7, i64 265, !10, i64 272, !6, i64 280, !10, i64 288, !6, i64 296, !6, i64 304, !10, i64 312, !7, i64 320, !6, i64 328, !10, i64 336, !7, i64 344, !24, i64 352, !24, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456}
!23 = !{!"png_time_struct", !16, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!24 = !{!"double", !7, i64 0}
!25 = !{!7, !7, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"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"

@.str.53 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.55 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.56 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.57 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.58 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.60 = 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
declare dso_local void @png_crc_read(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_iCCP(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #2 {
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 280
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = and i64 %6, 1
  %.not = icmp eq i64 %7, 0
  br i1 %.not, label %8, label %9

8:                                                ; preds = %3
  tail call void @png_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.53) #3
  br label %16

9:                                                ; preds = %3
  %10 = and i64 %6, 4
  %.not82 = icmp eq i64 %10, 0
  br i1 %.not82, label %13, label %11

11:                                               ; preds = %9
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.54) #3
  %12 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i64 noundef %2)
  br label %73

13:                                               ; preds = %9
  %14 = and i64 %6, 2
  %.not83 = icmp eq i64 %14, 0
  br i1 %.not83, label %16, label %15

15:                                               ; preds = %13
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.55) #3
  br label %16

16:                                               ; preds = %15, %13, %8
  %.not84 = icmp eq ptr %1, null
  br i1 %.not84, label %23, label %17

17:                                               ; preds = %16
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load i64, ptr %18, align 8, !tbaa !19
  %20 = and i64 %19, 4096
  %.not85 = icmp eq i64 %20, 0
  br i1 %.not85, label %23, label %21

21:                                               ; preds = %17
  tail call void @png_warning(ptr noundef nonnull %0, ptr noundef nonnull @.str.56) #3
  %22 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i64 noundef %2)
  br label %73

23:                                               ; preds = %17, %16
  %24 = add i64 %2, 1
  %25 = tail call ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %24) #3
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef %25, i64 noundef %2)
  %26 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i64 noundef 0)
  %.not86 = icmp eq i32 %26, 0
  br i1 %.not86, label %28, label %27

27:                                               ; preds = %23
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef %25) #3
  br label %73

28:                                               ; preds = %23
  %29 = getelementptr inbounds i8, ptr %25, i64 %2
  store i8 0, ptr %29, align 1, !tbaa !23
  br label %30

30:                                               ; preds = %30, %28
  %.075 = phi ptr [ %25, %28 ], [ %32, %30 ]
  %31 = load i8, ptr %.075, align 1, !tbaa !23
  %.not87 = icmp eq i8 %31, 0
  %32 = getelementptr inbounds i8, ptr %.075, i64 1
  br i1 %.not87, label %33, label %30, !llvm.loop !24

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %29, i64 -1
  %.not88 = icmp ult ptr %32, %34
  br i1 %.not88, label %36, label %35

35:                                               ; preds = %33
  tail call void @png_free(ptr noundef %0, ptr noundef %25) #3
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.57) #3
  br label %73

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %.075, i64 2
  %38 = load i8, ptr %32, align 1, !tbaa !23
  %.not89 = icmp eq i8 %38, 0
  br i1 %.not89, label %40, label %39

39:                                               ; preds = %36
  tail call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.58) #3
  br label %40

40:                                               ; preds = %39, %36
  %41 = ptrtoint ptr %37 to i64
  %42 = ptrtoint ptr %25 to i64
  %43 = sub i64 %41, %42
  %44 = call ptr @png_decompress_chunk(ptr noundef %0, i32 noundef 0, ptr noundef %25, i64 noundef %2, i64 noundef %43, ptr noundef nonnull %4)
  %45 = load i64, ptr %4, align 8, !tbaa !26
  %46 = sub i64 %45, %43
  %47 = icmp ugt i64 %43, %45
  %48 = icmp ult i64 %46, 4
  %or.cond = or i1 %47, %48
  br i1 %or.cond, label %49, label %50

49:                                               ; preds = %40
  call void @png_free(ptr noundef %0, ptr noundef %44) #3
  call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.59) #3
  br label %73

50:                                               ; preds = %40
  %51 = getelementptr inbounds i8, ptr %44, i64 %43
  %52 = load i8, ptr %51, align 1, !tbaa !23
  %53 = zext i8 %52 to i32
  %54 = shl nuw i32 %53, 24
  %55 = getelementptr inbounds i8, ptr %51, i64 1
  %56 = load i8, ptr %55, align 1, !tbaa !23
  %57 = zext i8 %56 to i32
  %58 = shl nuw nsw i32 %57, 16
  %59 = or disjoint i32 %58, %54
  %60 = getelementptr inbounds i8, ptr %51, i64 2
  %61 = load i8, ptr %60, align 1, !tbaa !23
  %62 = zext i8 %61 to i32
  %63 = shl nuw nsw i32 %62, 8
  %64 = or disjoint i32 %59, %63
  %65 = getelementptr inbounds i8, ptr %51, i64 3
  %66 = load i8, ptr %65, align 1, !tbaa !23
  %67 = zext i8 %66 to i32
  %68 = or disjoint i32 %64, %67
  %69 = sext i32 %68 to i64
  %70 = icmp ult i64 %46, %69
  br i1 %70, label %71, label %72

71:                                               ; preds = %50
  call void @png_free(ptr noundef %0, ptr noundef nonnull %44) #3
  call void @png_warning(ptr noundef %0, ptr noundef nonnull @.str.60) #3
  br label %73

72:                                               ; preds = %50
  call void @png_set_iCCP(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %44, i32 noundef 0, ptr noundef nonnull %51, i64 noundef %69) #3
  call void @png_free(ptr noundef %0, ptr noundef nonnull %44) #3
  br label %73

73:                                               ; preds = %72, %71, %49, %35, %27, %21, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret void
}

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

declare void @png_set_iCCP(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

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 = { 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, !10, i64 280}
!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 = !{!20, !10, i64 16}
!20 = !{!"png_info_struct", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !9, i64 32, !14, i64 40, !14, i64 42, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52, !15, i64 60, !7, i64 64, !12, i64 68, !12, i64 72, !9, i64 80, !21, i64 88, !17, i64 96, !9, i64 104, !16, i64 112, !16, i64 122, !10, i64 136, !10, i64 144, !7, i64 152, !10, i64 160, !10, i64 168, !7, i64 176, !9, i64 184, !15, i64 192, !15, i64 196, !15, i64 200, !15, i64 204, !15, i64 208, !15, i64 212, !15, i64 216, !15, i64 220, !9, i64 224, !10, i64 232, !10, i64 240, !9, i64 248, !9, i64 256, !7, i64 264, !7, i64 265, !10, i64 272, !9, i64 280, !10, i64 288, !9, i64 296, !9, i64 304, !10, i64 312, !7, i64 320, !9, i64 328, !10, i64 336, !7, i64 344, !22, i64 352, !22, i64 360, !9, i64 368, !9, i64 376, !9, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456}
!21 = !{!"png_time_struct", !14, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!22 = !{!"double", !7, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!10, !10, i64 0}


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