; 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_text_struct = type { i32, ptr, ptr, i64, i64, ptr, ptr }
%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.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.43 = 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

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

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

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

declare i32 @png_set_text_2(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

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

17:                                               ; preds = %3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 134
  %20 = load i32, ptr %19, align 4, !tbaa !11
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %26

22:                                               ; preds = %17
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = call i32 @png_crc_finish(ptr noundef %23, i32 noundef %24)
  store i32 1, ptr %10, align 4
  br label %179

26:                                               ; preds = %17
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.png_struct_def, ptr %27, i32 0, i32 134
  %29 = load i32, ptr %28, align 4, !tbaa !11
  %30 = add i32 %29, -1
  store i32 %30, ptr %28, align 4, !tbaa !11
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %37

32:                                               ; preds = %26
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = call i32 @png_crc_finish(ptr noundef %33, i32 noundef %34)
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %36, ptr noundef @.str.38)
  store i32 1, ptr %10, align 4
  br label %179

37:                                               ; preds = %26
  br label %38

38:                                               ; preds = %37, %3
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.png_struct_def, ptr %39, i32 0, i32 15
  %41 = load i32, ptr %40, align 4, !tbaa !22
  %42 = and i32 %41, 1
  %43 = icmp eq i32 %42, 0
  br i1 %43, label %44, label %46

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

46:                                               ; preds = %38
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.png_struct_def, ptr %47, i32 0, i32 15
  %49 = load i32, ptr %48, align 4, !tbaa !22
  %50 = and i32 %49, 4
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %57

52:                                               ; preds = %46
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.png_struct_def, ptr %53, i32 0, i32 15
  %55 = load i32, ptr %54, align 4, !tbaa !22
  %56 = or i32 %55, 8
  store i32 %56, ptr %54, align 4, !tbaa !22
  br label %57

57:                                               ; preds = %52, %46
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = call ptr @png_read_buffer(ptr noundef %58, i64 noundef %60, i32 noundef 2)
  store ptr %61, ptr %8, align 8, !tbaa !5
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %69

64:                                               ; preds = %57
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = call i32 @png_crc_finish(ptr noundef %65, i32 noundef %66)
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %68, ptr noundef @.str.17)
  store i32 1, ptr %10, align 4
  br label %179

69:                                               ; preds = %57
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = load i32, ptr %6, align 4, !tbaa !9
  call void @png_crc_read(ptr noundef %70, ptr noundef %71, i32 noundef %72)
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = call i32 @png_crc_finish(ptr noundef %73, i32 noundef 0)
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %69
  store i32 1, ptr %10, align 4
  br label %179

77:                                               ; preds = %69
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %93, %77
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = icmp ult i32 %79, %80
  br i1 %81, label %82, label %90

82:                                               ; preds = %78
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = zext i32 %84 to i64
  %86 = getelementptr inbounds i8, ptr %83, i64 %85
  %87 = load i8, ptr %86, align 1, !tbaa !23
  %88 = zext i8 %87 to i32
  %89 = icmp ne i32 %88, 0
  br label %90

90:                                               ; preds = %82, %78
  %91 = phi i1 [ false, %78 ], [ %89, %82 ]
  br i1 %91, label %92, label %96

92:                                               ; preds = %90
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = add i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !9
  br label %78, !llvm.loop !24

96:                                               ; preds = %90
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = icmp ugt i32 %97, 79
  br i1 %98, label %102, label %99

99:                                               ; preds = %96
  %100 = load i32, ptr %9, align 4, !tbaa !9
  %101 = icmp ult i32 %100, 1
  br i1 %101, label %102, label %103

102:                                              ; preds = %99, %96
  store ptr @.str.19, ptr %7, align 8, !tbaa !5
  br label %172

103:                                              ; preds = %99
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = add i32 %104, 3
  %106 = load i32, ptr %6, align 4, !tbaa !9
  %107 = icmp ugt i32 %105, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %103
  store ptr @.str.40, ptr %7, align 8, !tbaa !5
  br label %171

109:                                              ; preds = %103
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = load i32, ptr %9, align 4, !tbaa !9
  %112 = add i32 %111, 1
  %113 = zext i32 %112 to i64
  %114 = getelementptr inbounds i8, ptr %110, i64 %113
  %115 = load i8, ptr %114, align 1, !tbaa !23
  %116 = zext i8 %115 to i32
  %117 = icmp ne i32 %116, 0
  br i1 %117, label %118, label %119

118:                                              ; preds = %109
  store ptr @.str.41, ptr %7, align 8, !tbaa !5
  br label %170

119:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 -1, ptr %11, align 8, !tbaa !26
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = load i32, ptr %6, align 4, !tbaa !9
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = add i32 %122, 2
  %124 = call i32 @png_decompress_chunk(ptr noundef %120, i32 noundef %121, i32 noundef %123, ptr noundef %11, i32 noundef 1)
  %125 = icmp eq i32 %124, 1
  br i1 %125, label %126, label %164

126:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 56, ptr %12) #4
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.png_struct_def, ptr %127, i32 0, i32 138
  %129 = load ptr, ptr %128, align 8, !tbaa !27
  %130 = icmp eq ptr %129, null
  br i1 %130, label %131, label %132

131:                                              ; preds = %126
  store ptr @.str.42, ptr %7, align 8, !tbaa !5
  br label %163

132:                                              ; preds = %126
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.png_struct_def, ptr %133, i32 0, i32 138
  %135 = load ptr, ptr %134, align 8, !tbaa !27
  store ptr %135, ptr %8, align 8, !tbaa !5
  %136 = load ptr, ptr %8, align 8, !tbaa !5
  %137 = load i64, ptr %11, align 8, !tbaa !26
  %138 = load i32, ptr %9, align 4, !tbaa !9
  %139 = add i32 %138, 2
  %140 = zext i32 %139 to i64
  %141 = add i64 %137, %140
  %142 = getelementptr inbounds i8, ptr %136, i64 %141
  store i8 0, ptr %142, align 1, !tbaa !23
  %143 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 0
  store i32 0, ptr %143, align 8, !tbaa !28
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 1
  store ptr %144, ptr %145, align 8, !tbaa !30
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = load i32, ptr %9, align 4, !tbaa !9
  %148 = zext i32 %147 to i64
  %149 = getelementptr inbounds i8, ptr %146, i64 %148
  %150 = getelementptr inbounds i8, ptr %149, i64 2
  %151 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 2
  store ptr %150, ptr %151, align 8, !tbaa !31
  %152 = load i64, ptr %11, align 8, !tbaa !26
  %153 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 3
  store i64 %152, ptr %153, align 8, !tbaa !32
  %154 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 4
  store i64 0, ptr %154, align 8, !tbaa !33
  %155 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 5
  store ptr null, ptr %155, align 8, !tbaa !34
  %156 = getelementptr inbounds %struct.png_text_struct, ptr %12, i32 0, i32 6
  store ptr null, ptr %156, align 8, !tbaa !35
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = call i32 @png_set_text_2(ptr noundef %157, ptr noundef %158, ptr noundef %12, i32 noundef 1)
  %160 = icmp ne i32 %159, 0
  br i1 %160, label %161, label %162

161:                                              ; preds = %132
  store ptr @.str.43, ptr %7, align 8, !tbaa !5
  br label %162

162:                                              ; preds = %161, %132
  br label %163

163:                                              ; preds = %162, %131
  call void @llvm.lifetime.end.p0(i64 56, ptr %12) #4
  br label %169

164:                                              ; preds = %119
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.png_struct_def, ptr %165, i32 0, i32 19
  %167 = getelementptr inbounds %struct.z_stream_s, ptr %166, i32 0, i32 6
  %168 = load ptr, ptr %167, align 8, !tbaa !36
  store ptr %168, ptr %7, align 8, !tbaa !5
  br label %169

169:                                              ; preds = %164, %163
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %170

170:                                              ; preds = %169, %118
  br label %171

171:                                              ; preds = %170, %108
  br label %172

172:                                              ; preds = %171, %102
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %178

175:                                              ; preds = %172
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %176, ptr noundef %177)
  br label %178

178:                                              ; preds = %175, %172
  store i32 0, ptr %10, align 4
  br label %179

179:                                              ; preds = %178, %76, %64, %32, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  %180 = load i32, ptr %10, align 4
  switch i32 %180, label %182 [
    i32 0, label %181
    i32 1, label %181
  ]

181:                                              ; preds = %179, %179
  ret void

182:                                              ; preds = %179
  unreachable
}

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 1060}
!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 300}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!13, !13, i64 0}
!27 = !{!12, !6, i64 1112}
!28 = !{!29, !10, i64 0}
!29 = !{!"png_text_struct", !10, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !13, i64 32, !6, i64 40, !6, i64 48}
!30 = !{!29, !6, i64 8}
!31 = !{!29, !6, i64 16}
!32 = !{!29, !13, i64 24}
!33 = !{!29, !13, i64 32}
!34 = !{!29, !6, i64 40}
!35 = !{!29, !6, i64 48}
!36 = !{!12, !6, i64 368}


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

%struct.png_text_struct = type { i32, ptr, ptr, i64, i64, ptr, ptr }

@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.43 = 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: 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 noalias noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: noreturn
declare void @png_chunk_error(ptr noundef, ptr 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 #1

declare i32 @png_set_text_2(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_zTXt(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca i64, align 8
  %5 = alloca %struct.png_text_struct, align 8
  %6 = getelementptr inbounds i8, ptr %0, i64 1060
  %7 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %7, label %10 [
    i32 0, label %15
    i32 1, label %8
  ]

8:                                                ; preds = %3
  %9 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  br label %72

10:                                               ; preds = %3
  %11 = add i32 %7, -1
  store i32 %11, ptr %6, align 4, !tbaa !5
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %15

13:                                               ; preds = %10
  %14 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.38) #5
  br label %72

15:                                               ; preds = %3, %10
  %16 = getelementptr inbounds i8, ptr %0, i64 300
  %17 = load i32, ptr %16, align 4, !tbaa !20
  %18 = and i32 %17, 1
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %21

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

21:                                               ; preds = %15
  %22 = and i32 %17, 4
  %.not54 = icmp eq i32 %22, 0
  br i1 %.not54, label %25, label %23

23:                                               ; preds = %21
  %24 = or i32 %17, 8
  store i32 %24, ptr %16, align 4, !tbaa !20
  br label %25

25:                                               ; preds = %23, %21
  %26 = zext i32 %2 to i64
  %27 = tail call ptr @png_read_buffer(ptr noundef nonnull %0, i64 noundef %26, i32 noundef 2)
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %25
  %30 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.17) #5
  br label %72

31:                                               ; preds = %25
  tail call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %27, i32 noundef %2)
  %32 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %.not55 = icmp eq i32 %32, 0
  br i1 %.not55, label %.preheader, label %72

.preheader:                                       ; preds = %31
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %35
  %indvars.iv = phi i64 [ %indvars.iv.next, %35 ], [ 0, %.preheader ]
  %33 = getelementptr inbounds i8, ptr %27, i64 %indvars.iv
  %34 = load i8, ptr %33, align 1, !tbaa !21
  %.not56 = icmp eq i8 %34, 0
  br i1 %.not56, label %.critedge.split.loop.exit, label %35

35:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %26
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !22

.critedge.split.loop.exit:                        ; preds = %.lr.ph
  %36 = trunc nuw i64 %indvars.iv to i32
  br label %.critedge

.critedge:                                        ; preds = %35, %.critedge.split.loop.exit
  %.0.lcssa = phi i32 [ %36, %.critedge.split.loop.exit ], [ %2, %35 ]
  %37 = add i32 %.0.lcssa, -80
  %or.cond = icmp ult i32 %37, -79
  br i1 %or.cond, label %.thread, label %38

38:                                               ; preds = %.critedge
  %39 = add nuw nsw i32 %.0.lcssa, 3
  %40 = icmp ugt i32 %39, %2
  br i1 %40, label %.thread, label %41

41:                                               ; preds = %38
  %42 = zext nneg i32 %.0.lcssa to i64
  %43 = getelementptr inbounds i8, ptr %27, i64 %42
  %44 = getelementptr inbounds i8, ptr %43, i64 1
  %45 = load i8, ptr %44, align 1, !tbaa !21
  %.not57 = icmp eq i8 %45, 0
  br i1 %.not57, label %46, label %.thread

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i64 -1, ptr %4, align 8, !tbaa !24
  %47 = add nuw nsw i32 %.0.lcssa, 2
  %48 = call i32 @png_decompress_chunk(ptr noundef %0, i32 noundef %2, i32 noundef %47, ptr noundef nonnull %4, i32 noundef 1)
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %68

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %5) #5
  %51 = getelementptr inbounds i8, ptr %0, i64 1112
  %52 = load ptr, ptr %51, align 8, !tbaa !25
  %53 = icmp eq ptr %52, null
  br i1 %53, label %67, label %54

54:                                               ; preds = %50
  %55 = load i64, ptr %4, align 8, !tbaa !24
  %56 = zext nneg i32 %47 to i64
  %57 = getelementptr i8, ptr %52, i64 %55
  %58 = getelementptr i8, ptr %57, i64 %56
  store i8 0, ptr %58, align 1, !tbaa !21
  store i32 0, ptr %5, align 8, !tbaa !26
  %59 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %52, ptr %59, align 8, !tbaa !28
  %60 = getelementptr inbounds i8, ptr %52, i64 %42
  %61 = getelementptr inbounds i8, ptr %60, i64 2
  %62 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %61, ptr %62, align 8, !tbaa !29
  %63 = load i64, ptr %4, align 8, !tbaa !24
  %64 = getelementptr inbounds i8, ptr %5, i64 24
  store i64 %63, ptr %64, align 8, !tbaa !30
  %65 = getelementptr inbounds i8, ptr %5, i64 32
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %65, i8 0, i64 24, i1 false)
  %66 = call i32 @png_set_text_2(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %5, i32 noundef 1) #5
  %.not58 = icmp eq i32 %66, 0
  %spec.select = select i1 %.not58, ptr null, ptr @.str.43
  br label %67

67:                                               ; preds = %54, %50
  %.049 = phi ptr [ @.str.42, %50 ], [ %spec.select, %54 ]
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %5) #5
  br label %71

68:                                               ; preds = %46
  %69 = getelementptr inbounds i8, ptr %0, i64 368
  %70 = load ptr, ptr %69, align 8, !tbaa !31
  br label %71

71:                                               ; preds = %67, %68
  %.1 = phi ptr [ %.049, %67 ], [ %70, %68 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %.not59 = icmp eq ptr %.1, null
  br i1 %.not59, label %72, label %.thread

.thread:                                          ; preds = %.preheader, %41, %38, %.critedge, %71
  %.262 = phi ptr [ %.1, %71 ], [ @.str.41, %41 ], [ @.str.40, %38 ], [ @.str.19, %.critedge ], [ @.str.19, %.preheader ]
  call void @png_chunk_benign_error(ptr noundef %0, ptr noundef nonnull %.262) #5
  br label %72

72:                                               ; preds = %71, %.thread, %31, %29, %13, %8
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { noreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !11, i64 1060}
!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 300}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!10, !10, i64 0}
!25 = !{!6, !9, i64 1112}
!26 = !{!27, !11, i64 0}
!27 = !{!"png_text_struct", !11, i64 0, !9, i64 8, !9, i64 16, !10, i64 24, !10, i64 32, !9, i64 40, !9, i64 48}
!28 = !{!27, !9, i64 8}
!29 = !{!27, !9, i64 16}
!30 = !{!27, !10, i64 24}
!31 = !{!6, !9, i64 368}


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