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

@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 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

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

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

21:                                               ; preds = %3
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.png_struct_def, ptr %22, i32 0, i32 15
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = and i32 %24, 2
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %21
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %28, ptr noundef @.str.8) #5
  unreachable

29:                                               ; preds = %21
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.png_struct_def, ptr %30, i32 0, i32 15
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = and i32 %32, 4
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %40

35:                                               ; preds = %29
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = call i32 @png_crc_finish(ptr noundef %36, i32 noundef %37)
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %39, ptr noundef @.str.5)
  store i32 1, ptr %12, align 4
  br label %184

40:                                               ; preds = %29
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.png_struct_def, ptr %43, i32 0, i32 15
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = or i32 %45, 2
  store i32 %46, ptr %44, align 4, !tbaa !11
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.png_struct_def, ptr %47, i32 0, i32 61
  %49 = load i8, ptr %48, align 1, !tbaa !22
  %50 = zext i8 %49 to i32
  %51 = and i32 %50, 2
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %58

53:                                               ; preds = %42
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !9
  %56 = call i32 @png_crc_finish(ptr noundef %54, i32 noundef %55)
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %57, ptr noundef @.str.9)
  store i32 1, ptr %12, align 4
  br label %184

58:                                               ; preds = %42
  %59 = load i32, ptr %6, align 4, !tbaa !9
  %60 = icmp ugt i32 %59, 768
  br i1 %60, label %65, label %61

61:                                               ; preds = %58
  %62 = load i32, ptr %6, align 4, !tbaa !9
  %63 = urem i32 %62, 3
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %79

65:                                               ; preds = %61, %58
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = load i32, ptr %6, align 4, !tbaa !9
  %68 = call i32 @png_crc_finish(ptr noundef %66, i32 noundef %67)
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.png_struct_def, ptr %69, i32 0, i32 61
  %71 = load i8, ptr %70, align 1, !tbaa !22
  %72 = zext i8 %71 to i32
  %73 = icmp ne i32 %72, 3
  br i1 %73, label %74, label %76

74:                                               ; preds = %65
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %75, ptr noundef @.str.6)
  br label %78

76:                                               ; preds = %65
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_error(ptr noundef %77, ptr noundef @.str.6) #5
  unreachable

78:                                               ; preds = %74
  store i32 1, ptr %12, align 4
  br label %184

79:                                               ; preds = %61
  %80 = load i32, ptr %6, align 4, !tbaa !9
  %81 = sdiv i32 %80, 3
  store i32 %81, ptr %9, align 4, !tbaa !9
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.png_struct_def, ptr %82, i32 0, i32 61
  %84 = load i8, ptr %83, align 1, !tbaa !22
  %85 = zext i8 %84 to i32
  %86 = icmp eq i32 %85, 3
  br i1 %86, label %87, label %93

87:                                               ; preds = %79
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.png_struct_def, ptr %88, i32 0, i32 62
  %90 = load i8, ptr %89, align 8, !tbaa !23
  %91 = zext i8 %90 to i32
  %92 = shl i32 1, %91
  store i32 %92, ptr %8, align 4, !tbaa !9
  br label %94

93:                                               ; preds = %79
  store i32 256, ptr %8, align 4, !tbaa !9
  br label %94

94:                                               ; preds = %93, %87
  %95 = load i32, ptr %9, align 4, !tbaa !9
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = icmp sgt i32 %95, %96
  br i1 %97, label %98, label %100

98:                                               ; preds = %94
  %99 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %99, ptr %9, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %98, %94
  store i32 0, ptr %10, align 4, !tbaa !9
  %101 = getelementptr inbounds [256 x %struct.png_color_struct], ptr %7, i64 0, i64 0
  store ptr %101, ptr %11, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %121, %100
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %106, label %126

106:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 3, ptr %13) #4
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 0
  call void @png_crc_read(ptr noundef %107, ptr noundef %108, i32 noundef 3)
  %109 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 0
  %110 = load i8, ptr %109, align 1, !tbaa !24
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.png_color_struct, ptr %111, i32 0, i32 0
  store i8 %110, ptr %112, align 1, !tbaa !25
  %113 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 1
  %114 = load i8, ptr %113, align 1, !tbaa !24
  %115 = load ptr, ptr %11, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.png_color_struct, ptr %115, i32 0, i32 1
  store i8 %114, ptr %116, align 1, !tbaa !27
  %117 = getelementptr inbounds [3 x i8], ptr %13, i64 0, i64 2
  %118 = load i8, ptr %117, align 1, !tbaa !24
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.png_color_struct, ptr %119, i32 0, i32 2
  store i8 %118, ptr %120, align 1, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 3, ptr %13) #4
  br label %121

121:                                              ; preds = %106
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %10, align 4, !tbaa !9
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.png_color_struct, ptr %124, i32 1
  store ptr %125, ptr %11, align 8, !tbaa !5
  br label %102, !llvm.loop !29

126:                                              ; preds = %102
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = load i32, ptr %6, align 4, !tbaa !9
  %129 = load i32, ptr %9, align 4, !tbaa !9
  %130 = mul i32 %129, 3
  %131 = sub i32 %128, %130
  %132 = call i32 @png_crc_finish(ptr noundef %127, i32 noundef %131)
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds [256 x %struct.png_color_struct], ptr %7, i64 0, i64 0
  %136 = load i32, ptr %9, align 4, !tbaa !9
  call void @png_set_PLTE(ptr noundef %133, ptr noundef %134, ptr noundef %135, i32 noundef %136)
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.png_struct_def, ptr %137, i32 0, i32 55
  %139 = load i16, ptr %138, align 8, !tbaa !31
  %140 = zext i16 %139 to i32
  %141 = icmp sgt i32 %140, 0
  br i1 %141, label %151, label %142

142:                                              ; preds = %126
  %143 = load ptr, ptr %5, align 8, !tbaa !5
  %144 = icmp ne ptr %143, null
  br i1 %144, label %145, label %161

145:                                              ; preds = %142
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.png_info_def, ptr %146, i32 0, i32 2
  %148 = load i32, ptr %147, align 8, !tbaa !32
  %149 = and i32 %148, 16
  %150 = icmp ne i32 %149, 0
  br i1 %150, label %151, label %161

151:                                              ; preds = %145, %126
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.png_struct_def, ptr %152, i32 0, i32 55
  store i16 0, ptr %153, align 8, !tbaa !31
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = icmp ne ptr %154, null
  br i1 %155, label %156, label %159

156:                                              ; preds = %151
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.png_info_def, ptr %157, i32 0, i32 6
  store i16 0, ptr %158, align 2, !tbaa !35
  br label %159

159:                                              ; preds = %156, %151
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %160, ptr noundef @.str.10)
  br label %161

161:                                              ; preds = %159, %145, %142
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = icmp ne ptr %162, null
  br i1 %163, label %164, label %172

164:                                              ; preds = %161
  %165 = load ptr, ptr %5, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.png_info_def, ptr %165, i32 0, i32 2
  %167 = load i32, ptr %166, align 8, !tbaa !32
  %168 = and i32 %167, 64
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %172

170:                                              ; preds = %164
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %171, ptr noundef @.str.11)
  br label %172

172:                                              ; preds = %170, %164, %161
  %173 = load ptr, ptr %5, align 8, !tbaa !5
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %183

175:                                              ; preds = %172
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.png_info_def, ptr %176, i32 0, i32 2
  %178 = load i32, ptr %177, align 8, !tbaa !32
  %179 = and i32 %178, 32
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %183

181:                                              ; preds = %175
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %182, ptr noundef @.str.12)
  br label %183

183:                                              ; preds = %181, %175, %172
  store i32 0, ptr %12, align 4
  br label %184

184:                                              ; preds = %183, %78, %53, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 768, ptr %7) #4
  %185 = load i32, ptr %12, align 4
  switch i32 %185, label %187 [
    i32 0, label %186
    i32 1, label %186
  ]

186:                                              ; preds = %184, %184
  ret void

187:                                              ; preds = %184
  unreachable
}

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

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

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 300}
!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, !7, i64 615}
!23 = !{!12, !7, i64 616}
!24 = !{!7, !7, i64 0}
!25 = !{!26, !7, i64 0}
!26 = !{!"png_color_struct", !7, i64 0, !7, i64 1, !7, i64 2}
!27 = !{!26, !7, i64 1}
!28 = !{!26, !7, i64 2}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!12, !15, i64 608}
!32 = !{!33, !10, i64 8}
!33 = !{!"png_info_def", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !6, i64 24, !15, i64 32, !15, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !19, i64 52, !6, i64 128, !6, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !6, i64 160, !34, i64 168, !17, i64 176, !6, i64 184, !16, i64 192, !16, i64 202, !10, i64 212, !10, i64 216, !7, i64 220, !10, i64 224, !10, i64 228, !7, i64 232, !10, i64 236, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !10, i64 272, !10, i64 276, !6, i64 280, !6, i64 288, !7, i64 296, !7, i64 297, !10, i64 300, !6, i64 304, !10, i64 312, !6, i64 320, !10, i64 328, !7, i64 332, !6, i64 336, !6, i64 344, !6, i64 352}
!34 = !{!"png_time_struct", !15, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!35 = !{!33, !15, i64 34}


; 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_color_struct = type { i8, i8, i8 }

@.str.5 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [19 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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_PLTE(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca [256 x %struct.png_color_struct], align 16
  %5 = alloca [3 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %4) #5
  %6 = getelementptr inbounds i8, ptr %0, i64 300
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = and i32 %7, 1
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %11

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

11:                                               ; preds = %3
  %12 = and i32 %7, 2
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %14, label %13

13:                                               ; preds = %11
  tail call void @png_chunk_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.8) #6
  unreachable

14:                                               ; preds = %11
  %15 = and i32 %7, 4
  %.not58 = icmp eq i32 %15, 0
  br i1 %.not58, label %18, label %16

16:                                               ; preds = %14
  %17 = 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.5) #5
  br label %.critedge

18:                                               ; preds = %14
  %19 = or disjoint i32 %7, 2
  store i32 %19, ptr %6, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 615
  %21 = load i8, ptr %20, align 1, !tbaa !20
  %22 = and i8 %21, 2
  %23 = icmp eq i8 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %18
  %25 = 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.9) #5
  br label %.critedge

26:                                               ; preds = %18
  %27 = icmp ult i32 %2, 769
  %28 = urem i32 %2, 3
  %.not59 = icmp eq i32 %28, 0
  %or.cond = and i1 %27, %.not59
  br i1 %or.cond, label %34, label %29

29:                                               ; preds = %26
  %30 = tail call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef %2)
  %31 = load i8, ptr %20, align 1, !tbaa !20
  %.not67 = icmp eq i8 %31, 3
  br i1 %.not67, label %33, label %32

32:                                               ; preds = %29
  tail call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.6) #5
  br label %.critedge

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

34:                                               ; preds = %26
  %.lhs.trunc = trunc nuw i32 %2 to i16
  %35 = udiv i16 %.lhs.trunc, 3
  %.zext = zext nneg i16 %35 to i32
  %36 = icmp eq i8 %21, 3
  br i1 %36, label %37, label %42

37:                                               ; preds = %34
  %38 = getelementptr inbounds i8, ptr %0, i64 616
  %39 = load i8, ptr %38, align 8, !tbaa !21
  %40 = zext nneg i8 %39 to i32
  %41 = shl nuw i32 1, %40
  br label %42

42:                                               ; preds = %34, %37
  %.054 = phi i32 [ %41, %37 ], [ 256, %34 ]
  %spec.select = tail call i32 @llvm.smin.i32(i32 %.054, i32 %.zext)
  %43 = icmp sgt i32 %spec.select, 0
  br i1 %43, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %42
  %44 = getelementptr inbounds i8, ptr %5, i64 1
  %45 = getelementptr inbounds i8, ptr %5, i64 2
  br label %46

46:                                               ; preds = %.lr.ph, %46
  %.076 = phi ptr [ %4, %.lr.ph ], [ %53, %46 ]
  %.05275 = phi i32 [ 0, %.lr.ph ], [ %52, %46 ]
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %5) #5
  call void @png_crc_read(ptr noundef %0, ptr noundef nonnull %5, i32 noundef 3)
  %47 = load i8, ptr %5, align 1, !tbaa !22
  store i8 %47, ptr %.076, align 1, !tbaa !23
  %48 = load i8, ptr %44, align 1, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %.076, i64 1
  store i8 %48, ptr %49, align 1, !tbaa !25
  %50 = load i8, ptr %45, align 1, !tbaa !22
  %51 = getelementptr inbounds i8, ptr %.076, i64 2
  store i8 %50, ptr %51, align 1, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %5) #5
  %52 = add nuw nsw i32 %.05275, 1
  %53 = getelementptr inbounds i8, ptr %.076, i64 3
  %exitcond.not = icmp eq i32 %52, %spec.select
  br i1 %exitcond.not, label %._crit_edge, label %46, !llvm.loop !27

._crit_edge:                                      ; preds = %46, %42
  %.neg = mul i32 %spec.select, -3
  %54 = add i32 %.neg, %2
  %55 = call i32 @png_crc_finish(ptr noundef %0, i32 noundef %54)
  call void @png_set_PLTE(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %4, i32 noundef %spec.select) #5
  %56 = getelementptr inbounds i8, ptr %0, i64 608
  %57 = load i16, ptr %56, align 8, !tbaa !29
  %.not60 = icmp eq i16 %57, 0
  br i1 %.not60, label %58, label %63

58:                                               ; preds = %._crit_edge
  %.not61 = icmp eq ptr %1, null
  br i1 %.not61, label %.critedge, label %59

59:                                               ; preds = %58
  %60 = getelementptr inbounds i8, ptr %1, i64 8
  %61 = load i32, ptr %60, align 8, !tbaa !30
  %62 = and i32 %61, 16
  %.not62 = icmp eq i32 %62, 0
  br i1 %.not62, label %.thread71, label %.thread

.thread:                                          ; preds = %59
  store i16 0, ptr %56, align 8, !tbaa !29
  br label %64

63:                                               ; preds = %._crit_edge
  store i16 0, ptr %56, align 8, !tbaa !29
  %.not63 = icmp eq ptr %1, null
  br i1 %.not63, label %.thread73, label %64

.thread73:                                        ; preds = %63
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.10) #5
  br label %.critedge

64:                                               ; preds = %63, %.thread
  %65 = getelementptr inbounds i8, ptr %1, i64 34
  store i16 0, ptr %65, align 2, !tbaa !33
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.10) #5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %1, i64 8
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !30
  br label %.thread71

.thread71:                                        ; preds = %59, %64
  %66 = phi i32 [ %61, %59 ], [ %.pre, %64 ]
  %67 = getelementptr inbounds i8, ptr %1, i64 8
  %68 = and i32 %66, 64
  %.not65 = icmp eq i32 %68, 0
  br i1 %.not65, label %70, label %69

69:                                               ; preds = %.thread71
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.11) #5
  br label %70

70:                                               ; preds = %.thread71, %69
  %71 = load i32, ptr %67, align 8, !tbaa !30
  %72 = and i32 %71, 32
  %.not66 = icmp eq i32 %72, 0
  br i1 %.not66, label %.critedge, label %73

73:                                               ; preds = %70
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.12) #5
  br label %.critedge

.critedge:                                        ; preds = %58, %.thread73, %70, %73, %32, %24, %16
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %4) #5
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 300}
!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, !7, i64 615}
!21 = !{!6, !7, i64 616}
!22 = !{!7, !7, i64 0}
!23 = !{!24, !7, i64 0}
!24 = !{!"png_color_struct", !7, i64 0, !7, i64 1, !7, i64 2}
!25 = !{!24, !7, i64 1}
!26 = !{!24, !7, i64 2}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!6, !13, i64 608}
!30 = !{!31, !11, i64 8}
!31 = !{!"png_info_def", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 16, !9, i64 24, !13, i64 32, !13, i64 34, !7, i64 36, !7, i64 37, !7, i64 38, !7, i64 39, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !17, i64 52, !9, i64 128, !9, i64 136, !11, i64 144, !11, i64 148, !11, i64 152, !9, i64 160, !32, i64 168, !15, i64 176, !9, i64 184, !14, i64 192, !14, i64 202, !11, i64 212, !11, i64 216, !7, i64 220, !11, i64 224, !11, i64 228, !7, i64 232, !11, i64 236, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !11, i64 272, !11, i64 276, !9, i64 280, !9, i64 288, !7, i64 296, !7, i64 297, !11, i64 300, !9, i64 304, !11, i64 312, !9, i64 320, !11, i64 328, !7, i64 332, !9, i64 336, !9, i64 344, !9, i64 352}
!32 = !{!"png_time_struct", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6}
!33 = !{!31, !13, i64 34}


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