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

; 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.46 = external hidden unnamed_addr constant [42 x i8], align 1
@png_set_keep_unknown_chunks.chunks_to_ignore = external hidden constant [90 x i8], align 16
@.str.47 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [45 x i8], align 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) #0

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

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

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

declare void @png_app_error(ptr noundef, ptr noundef) #2

declare noalias ptr @png_malloc(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @png_set_keep_unknown_chunks(ptr noalias noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) #3 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %18, label %19

18:                                               ; preds = %4
  store i32 1, ptr %12, align 4
  br label %185

19:                                               ; preds = %4
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %25, label %22

22:                                               ; preds = %19
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = icmp sge i32 %23, 4
  br i1 %24, label %25, label %27

25:                                               ; preds = %22, %19
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_app_error(ptr noundef %26, ptr noundef @.str.46)
  store i32 1, ptr %12, align 4
  br label %185

27:                                               ; preds = %22
  %28 = load i32, ptr %8, align 4, !tbaa !9
  %29 = icmp sle i32 %28, 0
  br i1 %29, label %30, label %38

30:                                               ; preds = %27
  %31 = load i32, ptr %6, align 4, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.png_struct_def, ptr %32, i32 0, i32 115
  store i32 %31, ptr %33, align 8, !tbaa !11
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %30
  store i32 1, ptr %12, align 4
  br label %185

37:                                               ; preds = %30
  br label %38

38:                                               ; preds = %37, %27
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = icmp slt i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store ptr @png_set_keep_unknown_chunks.chunks_to_ignore, ptr %7, align 8, !tbaa !5
  store i32 18, ptr %10, align 4, !tbaa !9
  br label %49

42:                                               ; preds = %38
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_app_error(ptr noundef %46, ptr noundef @.str.47)
  store i32 1, ptr %12, align 4
  br label %185

47:                                               ; preds = %42
  %48 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %48, ptr %10, align 4, !tbaa !9
  br label %49

49:                                               ; preds = %47, %41
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.png_struct_def, ptr %50, i32 0, i32 116
  %52 = load i32, ptr %51, align 4, !tbaa !22
  store i32 %52, ptr %11, align 4, !tbaa !9
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.png_struct_def, ptr %53, i32 0, i32 117
  %55 = load ptr, ptr %54, align 8, !tbaa !23
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %58

57:                                               ; preds = %49
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %58

58:                                               ; preds = %57, %49
  %59 = load i32, ptr %10, align 4, !tbaa !9
  %60 = load i32, ptr %11, align 4, !tbaa !9
  %61 = add i32 %59, %60
  %62 = icmp ugt i32 %61, 858993459
  br i1 %62, label %63, label %65

63:                                               ; preds = %58
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_app_error(ptr noundef %64, ptr noundef @.str.48)
  store i32 1, ptr %12, align 4
  br label %185

65:                                               ; preds = %58
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %68, label %87

68:                                               ; preds = %65
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load i32, ptr %10, align 4, !tbaa !9
  %71 = load i32, ptr %11, align 4, !tbaa !9
  %72 = add i32 %70, %71
  %73 = mul i32 5, %72
  %74 = zext i32 %73 to i64
  %75 = call noalias ptr @png_malloc(ptr noundef %69, i64 noundef %74)
  store ptr %75, ptr %9, align 8, !tbaa !5
  %76 = load i32, ptr %11, align 4, !tbaa !9
  %77 = icmp ugt i32 %76, 0
  br i1 %77, label %78, label %86

78:                                               ; preds = %68
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.png_struct_def, ptr %80, i32 0, i32 117
  %82 = load ptr, ptr %81, align 8, !tbaa !23
  %83 = load i32, ptr %11, align 4, !tbaa !9
  %84 = mul i32 5, %83
  %85 = zext i32 %84 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %79, ptr align 1 %82, i64 %85, i1 false)
  br label %86

86:                                               ; preds = %78, %68
  br label %96

87:                                               ; preds = %65
  %88 = load i32, ptr %11, align 4, !tbaa !9
  %89 = icmp ugt i32 %88, 0
  br i1 %89, label %90, label %94

90:                                               ; preds = %87
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.png_struct_def, ptr %91, i32 0, i32 117
  %93 = load ptr, ptr %92, align 8, !tbaa !23
  store ptr %93, ptr %9, align 8, !tbaa !5
  br label %95

94:                                               ; preds = %87
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %95

95:                                               ; preds = %94, %90
  br label %96

96:                                               ; preds = %95, %86
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %160

99:                                               ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %114, %99
  %101 = load i32, ptr %15, align 4, !tbaa !9
  %102 = load i32, ptr %10, align 4, !tbaa !9
  %103 = icmp ult i32 %101, %102
  br i1 %103, label %104, label %117

104:                                              ; preds = %100
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = load i32, ptr %15, align 4, !tbaa !9
  %109 = mul i32 5, %108
  %110 = zext i32 %109 to i64
  %111 = getelementptr inbounds i8, ptr %107, i64 %110
  %112 = load i32, ptr %6, align 4, !tbaa !9
  %113 = call i32 @add_one_chunk(ptr noundef %105, i32 noundef %106, ptr noundef %111, i32 noundef %112)
  store i32 %113, ptr %11, align 4, !tbaa !9
  br label %114

114:                                              ; preds = %104
  %115 = load i32, ptr %15, align 4, !tbaa !9
  %116 = add i32 %115, 1
  store i32 %116, ptr %15, align 4, !tbaa !9
  br label %100, !llvm.loop !24

117:                                              ; preds = %100
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %15, align 4, !tbaa !9
  %118 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %118, ptr %14, align 8, !tbaa !5
  store ptr %118, ptr %13, align 8, !tbaa !5
  br label %119

119:                                              ; preds = %141, %117
  %120 = load i32, ptr %15, align 4, !tbaa !9
  %121 = load i32, ptr %11, align 4, !tbaa !9
  %122 = icmp ult i32 %120, %121
  br i1 %122, label %123, label %146

123:                                              ; preds = %119
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = getelementptr inbounds i8, ptr %124, i64 4
  %126 = load i8, ptr %125, align 1, !tbaa !26
  %127 = icmp ne i8 %126, 0
  br i1 %127, label %128, label %140

128:                                              ; preds = %123
  %129 = load ptr, ptr %14, align 8, !tbaa !5
  %130 = load ptr, ptr %13, align 8, !tbaa !5
  %131 = icmp ne ptr %129, %130
  br i1 %131, label %132, label %135

132:                                              ; preds = %128
  %133 = load ptr, ptr %14, align 8, !tbaa !5
  %134 = load ptr, ptr %13, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %133, ptr align 1 %134, i64 5, i1 false)
  br label %135

135:                                              ; preds = %132, %128
  %136 = load ptr, ptr %14, align 8, !tbaa !5
  %137 = getelementptr inbounds i8, ptr %136, i64 5
  store ptr %137, ptr %14, align 8, !tbaa !5
  %138 = load i32, ptr %10, align 4, !tbaa !9
  %139 = add i32 %138, 1
  store i32 %139, ptr %10, align 4, !tbaa !9
  br label %140

140:                                              ; preds = %135, %123
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %15, align 4, !tbaa !9
  %143 = add i32 %142, 1
  store i32 %143, ptr %15, align 4, !tbaa !9
  %144 = load ptr, ptr %13, align 8, !tbaa !5
  %145 = getelementptr inbounds i8, ptr %144, i64 5
  store ptr %145, ptr %13, align 8, !tbaa !5
  br label %119, !llvm.loop !27

146:                                              ; preds = %119
  %147 = load i32, ptr %10, align 4, !tbaa !9
  %148 = icmp eq i32 %147, 0
  br i1 %148, label %149, label %159

149:                                              ; preds = %146
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.png_struct_def, ptr %150, i32 0, i32 117
  %152 = load ptr, ptr %151, align 8, !tbaa !23
  %153 = load ptr, ptr %9, align 8, !tbaa !5
  %154 = icmp ne ptr %152, %153
  br i1 %154, label %155, label %158

155:                                              ; preds = %149
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = load ptr, ptr %9, align 8, !tbaa !5
  call void @png_free(ptr noundef %156, ptr noundef %157)
  br label %158

158:                                              ; preds = %155, %149
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %159

159:                                              ; preds = %158, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %161

160:                                              ; preds = %96
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %161

161:                                              ; preds = %160, %159
  %162 = load i32, ptr %10, align 4, !tbaa !9
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.png_struct_def, ptr %163, i32 0, i32 116
  store i32 %162, ptr %164, align 4, !tbaa !22
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.png_struct_def, ptr %165, i32 0, i32 117
  %167 = load ptr, ptr %166, align 8, !tbaa !23
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = icmp ne ptr %167, %168
  br i1 %169, label %170, label %184

170:                                              ; preds = %161
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.png_struct_def, ptr %171, i32 0, i32 117
  %173 = load ptr, ptr %172, align 8, !tbaa !23
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %180

175:                                              ; preds = %170
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.png_struct_def, ptr %177, i32 0, i32 117
  %179 = load ptr, ptr %178, align 8, !tbaa !23
  call void @png_free(ptr noundef %176, ptr noundef %179)
  br label %180

180:                                              ; preds = %175, %170
  %181 = load ptr, ptr %9, align 8, !tbaa !5
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.png_struct_def, ptr %182, i32 0, i32 117
  store ptr %181, ptr %183, align 8, !tbaa !23
  br label %184

184:                                              ; preds = %180, %161
  store i32 0, ptr %12, align 4
  br label %185

185:                                              ; preds = %184, %63, %45, %36, %25, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  %186 = load i32, ptr %12, align 4
  switch i32 %186, label %188 [
    i32 0, label %187
    i32 1, label %187
  ]

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

188:                                              ; preds = %185
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden i32 @add_one_chunk(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 960}
!12 = !{!"png_struct_def", !7, i64 0, !6, i64 200, !6, i64 208, !13, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !14, i64 320, !6, i64 432, !10, i64 440, !10, i64 444, !10, i64 448, !10, i64 452, !10, i64 456, !10, i64 460, !10, i64 464, !10, i64 468, !10, i64 472, !10, i64 476, !10, i64 480, !10, i64 484, !10, i64 488, !10, i64 492, !10, i64 496, !10, i64 500, !10, i64 504, !10, i64 508, !10, i64 512, !10, i64 516, !13, i64 520, !10, i64 528, !10, i64 532, !10, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !13, i64 576, !10, i64 584, !10, i64 588, !6, i64 592, !15, i64 600, !10, i64 604, !15, i64 608, !7, i64 610, !7, i64 611, !7, i64 612, !7, i64 613, !7, i64 614, !7, i64 615, !7, i64 616, !7, i64 617, !7, i64 618, !7, i64 619, !7, i64 620, !7, i64 621, !7, i64 622, !7, i64 623, !7, i64 624, !15, i64 626, !7, i64 628, !10, i64 632, !16, i64 636, !16, i64 646, !6, i64 656, !10, i64 664, !10, i64 668, !10, i64 672, !10, i64 676, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !17, i64 728, !17, i64 733, !6, i64 744, !16, i64 752, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !6, i64 832, !10, i64 840, !10, i64 844, !13, i64 848, !13, i64 856, !13, i64 864, !13, i64 872, !10, i64 880, !10, i64 884, !6, i64 888, !6, i64 896, !10, i64 904, !7, i64 908, !10, i64 940, !6, i64 944, !6, i64 952, !10, i64 960, !10, i64 964, !6, i64 968, !7, i64 976, !7, i64 977, !15, i64 978, !15, i64 980, !10, i64 984, !7, i64 988, !6, i64 992, !6, i64 1000, !6, i64 1008, !6, i64 1016, !6, i64 1024, !6, i64 1032, !6, i64 1040, !7, i64 1048, !10, i64 1052, !10, i64 1056, !10, i64 1060, !13, i64 1064, !18, i64 1072, !13, i64 1104, !6, i64 1112, !13, i64 1120, !10, i64 1128, !10, i64 1132, !6, i64 1136, !7, i64 1144, !19, i64 1176}
!13 = !{!"long", !7, i64 0}
!14 = !{!"z_stream_s", !6, i64 0, !10, i64 8, !13, i64 16, !6, i64 24, !10, i64 32, !13, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !10, i64 88, !13, i64 96, !13, i64 104}
!15 = !{!"short", !7, i64 0}
!16 = !{!"png_color_16_struct", !7, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !15, i64 8}
!17 = !{!"png_color_8_struct", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4}
!18 = !{!"png_unknown_chunk_t", !7, i64 0, !6, i64 8, !13, i64 16, !7, i64 24}
!19 = !{!"png_colorspace", !10, i64 0, !20, i64 4, !21, i64 36, !15, i64 72, !15, i64 74}
!20 = !{!"png_xy", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!21 = !{!"png_XYZ", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!22 = !{!12, !10, i64 964}
!23 = !{!12, !6, i64 968}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!7, !7, i64 0}
!27 = distinct !{!27, !25}


; 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.46 = external hidden unnamed_addr constant [42 x i8], align 1
@png_set_keep_unknown_chunks.chunks_to_ignore = external hidden constant [90 x i8], align 16
@.str.47 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [45 x i8], align 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) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @png_set_keep_unknown_chunks(ptr noalias noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = icmp eq ptr %0, null
  br i1 %5, label %71, label %6

6:                                                ; preds = %4
  %or.cond = icmp ugt i32 %1, 3
  br i1 %or.cond, label %7, label %8

7:                                                ; preds = %6
  tail call void @png_app_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.46) #3
  br label %71

8:                                                ; preds = %6
  %9 = icmp slt i32 %3, 1
  br i1 %9, label %10, label %13

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 960
  store i32 %1, ptr %11, align 8, !tbaa !5
  %12 = icmp eq i32 %3, 0
  br i1 %12, label %71, label %.thread

13:                                               ; preds = %8
  %14 = icmp eq ptr %2, null
  br i1 %14, label %15, label %.thread

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

.thread:                                          ; preds = %10, %13
  %.071 = phi ptr [ %2, %13 ], [ @png_set_keep_unknown_chunks.chunks_to_ignore, %10 ]
  %.066 = phi i32 [ %3, %13 ], [ 18, %10 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 964
  %17 = load i32, ptr %16, align 4, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %0, i64 968
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = icmp eq ptr %19, null
  %spec.store.select = select i1 %20, i32 0, i32 %17
  %21 = add i32 %spec.store.select, %.066
  %22 = icmp ugt i32 %21, 858993459
  br i1 %22, label %23, label %24

23:                                               ; preds = %.thread
  tail call void @png_app_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.48) #3
  br label %71

24:                                               ; preds = %.thread
  %.not = icmp eq i32 %1, 0
  br i1 %.not, label %33, label %25

25:                                               ; preds = %24
  %26 = mul nuw i32 %21, 5
  %27 = zext i32 %26 to i64
  %28 = tail call noalias ptr @png_malloc(ptr noundef nonnull %0, i64 noundef %27) #3
  %.not80 = icmp eq i32 %spec.store.select, 0
  br i1 %.not80, label %34, label %29

29:                                               ; preds = %25
  %30 = load ptr, ptr %18, align 8, !tbaa !21
  %31 = mul i32 %spec.store.select, 5
  %32 = zext i32 %31 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %28, ptr align 1 %30, i64 %32, i1 false)
  br label %34

33:                                               ; preds = %24
  %.not79 = icmp eq i32 %spec.store.select, 0
  br i1 %.not79, label %thread-pre-split, label %34

34:                                               ; preds = %33, %25, %29
  %.068 = phi ptr [ %28, %29 ], [ %28, %25 ], [ %19, %33 ]
  %.not81 = icmp eq ptr %.068, null
  br i1 %.not81, label %thread-pre-split, label %.preheader90.preheader

.preheader90.preheader:                           ; preds = %34
  %wide.trip.count = zext nneg i32 %.066 to i64
  br label %.preheader90

.preheader:                                       ; preds = %.preheader90
  %.not98 = icmp eq i32 %39, 0
  br i1 %.not98, label %._crit_edge.thread, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader
  %xtraiter = and i32 %39, 1
  %35 = icmp eq i32 %39, 1
  br i1 %35, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i32 %39, -2
  br label %.lr.ph

.preheader90:                                     ; preds = %.preheader90.preheader, %.preheader90
  %indvars.iv = phi i64 [ 0, %.preheader90.preheader ], [ %indvars.iv.next, %.preheader90 ]
  %.06591 = phi i32 [ %spec.store.select, %.preheader90.preheader ], [ %39, %.preheader90 ]
  %36 = mul i64 %indvars.iv, 5
  %37 = and i64 %36, 4294967295
  %38 = getelementptr inbounds i8, ptr %.071, i64 %37
  %39 = tail call i32 @add_one_chunk(ptr noundef nonnull %.068, i32 noundef %.06591, ptr noundef nonnull %38, i32 noundef %1)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.preheader90, !llvm.loop !22

.lr.ph:                                           ; preds = %55, %.lr.ph.preheader.new
  %.06296 = phi ptr [ %.068, %.lr.ph.preheader.new ], [ %.163.1, %55 ]
  %.06494 = phi ptr [ %.068, %.lr.ph.preheader.new ], [ %56, %55 ]
  %.16793 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %.2.1, %55 ]
  %niter = phi i32 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %55 ]
  %40 = getelementptr inbounds i8, ptr %.06494, i64 4
  %41 = load i8, ptr %40, align 1, !tbaa !24
  %.not85 = icmp eq i8 %41, 0
  br i1 %.not85, label %.lr.ph.1, label %42

42:                                               ; preds = %.lr.ph
  %.not86 = icmp eq ptr %.06296, %.06494
  br i1 %.not86, label %44, label %43

43:                                               ; preds = %42
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %.06296, ptr noundef nonnull align 1 dereferenceable(5) %.06494, i64 5, i1 false)
  br label %44

44:                                               ; preds = %43, %42
  %45 = getelementptr inbounds i8, ptr %.06296, i64 5
  %46 = add i32 %.16793, 1
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %.lr.ph, %44
  %.2 = phi i32 [ %46, %44 ], [ %.16793, %.lr.ph ]
  %.163 = phi ptr [ %45, %44 ], [ %.06296, %.lr.ph ]
  %47 = getelementptr inbounds i8, ptr %.06494, i64 5
  %48 = getelementptr inbounds i8, ptr %.06494, i64 9
  %49 = load i8, ptr %48, align 1, !tbaa !24
  %.not85.1 = icmp eq i8 %49, 0
  br i1 %.not85.1, label %55, label %50

50:                                               ; preds = %.lr.ph.1
  %.not86.1 = icmp eq ptr %.163, %47
  br i1 %.not86.1, label %52, label %51

51:                                               ; preds = %50
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %.163, ptr noundef nonnull align 1 dereferenceable(5) %47, i64 5, i1 false)
  br label %52

52:                                               ; preds = %51, %50
  %53 = getelementptr inbounds i8, ptr %.163, i64 5
  %54 = add i32 %.2, 1
  br label %55

55:                                               ; preds = %52, %.lr.ph.1
  %.2.1 = phi i32 [ %54, %52 ], [ %.2, %.lr.ph.1 ]
  %.163.1 = phi ptr [ %53, %52 ], [ %.163, %.lr.ph.1 ]
  %56 = getelementptr inbounds i8, ptr %.06494, i64 10
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !25

._crit_edge.unr-lcssa:                            ; preds = %55, %.lr.ph.preheader
  %.2.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %.2.1, %55 ]
  %.06296.unr = phi ptr [ %.068, %.lr.ph.preheader ], [ %.163.1, %55 ]
  %.06494.unr = phi ptr [ %.068, %.lr.ph.preheader ], [ %56, %55 ]
  %.16793.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %.2.1, %55 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa
  %57 = getelementptr inbounds i8, ptr %.06494.unr, i64 4
  %58 = load i8, ptr %57, align 1, !tbaa !24
  %.not85.epil = icmp eq i8 %58, 0
  br i1 %.not85.epil, label %._crit_edge, label %59

59:                                               ; preds = %.lr.ph.epil
  %.not86.epil = icmp eq ptr %.06296.unr, %.06494.unr
  br i1 %.not86.epil, label %61, label %60

60:                                               ; preds = %59
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %.06296.unr, ptr noundef nonnull align 1 dereferenceable(5) %.06494.unr, i64 5, i1 false)
  br label %61

61:                                               ; preds = %60, %59
  %62 = add i32 %.16793.unr, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %61, %._crit_edge.unr-lcssa
  %.2.lcssa = phi i32 [ %.2.lcssa.ph, %._crit_edge.unr-lcssa ], [ %62, %61 ], [ %.16793.unr, %.lr.ph.epil ]
  %63 = icmp eq i32 %.2.lcssa, 0
  br i1 %63, label %._crit_edge.thread, label %thread-pre-split

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge
  %64 = load ptr, ptr %18, align 8, !tbaa !21
  %.not82 = icmp eq ptr %64, %.068
  br i1 %.not82, label %66, label %65

65:                                               ; preds = %._crit_edge.thread
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %.068) #3
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %33, %65, %._crit_edge, %34
  %.270.ph = phi ptr [ null, %34 ], [ null, %65 ], [ %.068, %._crit_edge ], [ null, %33 ]
  %.3.ph = phi i32 [ 0, %34 ], [ 0, %65 ], [ %.2.lcssa, %._crit_edge ], [ 0, %33 ]
  %.pr = load ptr, ptr %18, align 8, !tbaa !21
  br label %66

66:                                               ; preds = %thread-pre-split, %._crit_edge.thread
  %67 = phi ptr [ %.pr, %thread-pre-split ], [ %64, %._crit_edge.thread ]
  %.270 = phi ptr [ %.270.ph, %thread-pre-split ], [ null, %._crit_edge.thread ]
  %.3 = phi i32 [ %.3.ph, %thread-pre-split ], [ 0, %._crit_edge.thread ]
  store i32 %.3, ptr %16, align 4, !tbaa !20
  %.not83 = icmp eq ptr %67, %.270
  br i1 %.not83, label %71, label %68

68:                                               ; preds = %66
  %.not84 = icmp eq ptr %67, null
  br i1 %.not84, label %70, label %69

69:                                               ; preds = %68
  tail call void @png_free(ptr noundef nonnull %0, ptr noundef nonnull %67) #3
  br label %70

70:                                               ; preds = %69, %68
  store ptr %.270, ptr %18, align 8, !tbaa !21
  br label %71

71:                                               ; preds = %66, %70, %10, %4, %23, %15, %7
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree 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, !11, i64 960}
!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 964}
!21 = !{!6, !9, i64 968}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !23}


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