; 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_xy = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%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_XYZ = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@.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.13 = external hidden unnamed_addr constant [15 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 i32 @png_get_fixed_point(ptr noalias noundef, ptr noundef) #1

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

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

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

17:                                               ; preds = %3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.png_struct_def, ptr %18, i32 0, i32 15
  %20 = load i32, ptr %19, align 4, !tbaa !11
  %21 = and i32 %20, 6
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %28

23:                                               ; preds = %17
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = call i32 @png_crc_finish(ptr noundef %24, i32 noundef %25)
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %27, ptr noundef @.str.5)
  store i32 1, ptr %9, align 4
  br label %151

28:                                               ; preds = %17
  br label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 32
  br i1 %31, label %32, label %37

32:                                               ; preds = %29
  %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.6)
  store i32 1, ptr %9, align 4
  br label %151

37:                                               ; preds = %29
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  call void @png_crc_read(ptr noundef %38, ptr noundef %39, i32 noundef 32)
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = call i32 @png_crc_finish(ptr noundef %40, i32 noundef 0)
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %37
  store i32 1, ptr %9, align 4
  br label %151

44:                                               ; preds = %37
  %45 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %46 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %45)
  %47 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 6
  store i32 %46, ptr %47, align 4, !tbaa !22
  %48 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  %50 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %49)
  %51 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 7
  store i32 %50, ptr %51, align 4, !tbaa !23
  %52 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %53 = getelementptr inbounds i8, ptr %52, i64 8
  %54 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %53)
  %55 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 0
  store i32 %54, ptr %55, align 4, !tbaa !24
  %56 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %57 = getelementptr inbounds i8, ptr %56, i64 12
  %58 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %57)
  %59 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 1
  store i32 %58, ptr %59, align 4, !tbaa !25
  %60 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %61 = getelementptr inbounds i8, ptr %60, i64 16
  %62 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %61)
  %63 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 2
  store i32 %62, ptr %63, align 4, !tbaa !26
  %64 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %65 = getelementptr inbounds i8, ptr %64, i64 20
  %66 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %65)
  %67 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 3
  store i32 %66, ptr %67, align 4, !tbaa !27
  %68 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %69 = getelementptr inbounds i8, ptr %68, i64 24
  %70 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %69)
  %71 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 4
  store i32 %70, ptr %71, align 4, !tbaa !28
  %72 = getelementptr inbounds [32 x i8], ptr %7, i64 0, i64 0
  %73 = getelementptr inbounds i8, ptr %72, i64 28
  %74 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef %73)
  %75 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 5
  store i32 %74, ptr %75, align 4, !tbaa !29
  %76 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 6
  %77 = load i32, ptr %76, align 4, !tbaa !22
  %78 = icmp eq i32 %77, -1
  br i1 %78, label %107, label %79

79:                                               ; preds = %44
  %80 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 7
  %81 = load i32, ptr %80, align 4, !tbaa !23
  %82 = icmp eq i32 %81, -1
  br i1 %82, label %107, label %83

83:                                               ; preds = %79
  %84 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 0
  %85 = load i32, ptr %84, align 4, !tbaa !24
  %86 = icmp eq i32 %85, -1
  br i1 %86, label %107, label %87

87:                                               ; preds = %83
  %88 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 1
  %89 = load i32, ptr %88, align 4, !tbaa !25
  %90 = icmp eq i32 %89, -1
  br i1 %90, label %107, label %91

91:                                               ; preds = %87
  %92 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 2
  %93 = load i32, ptr %92, align 4, !tbaa !26
  %94 = icmp eq i32 %93, -1
  br i1 %94, label %107, label %95

95:                                               ; preds = %91
  %96 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 3
  %97 = load i32, ptr %96, align 4, !tbaa !27
  %98 = icmp eq i32 %97, -1
  br i1 %98, label %107, label %99

99:                                               ; preds = %95
  %100 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 4
  %101 = load i32, ptr %100, align 4, !tbaa !28
  %102 = icmp eq i32 %101, -1
  br i1 %102, label %107, label %103

103:                                              ; preds = %99
  %104 = getelementptr inbounds %struct.png_xy, ptr %8, i32 0, i32 5
  %105 = load i32, ptr %104, align 4, !tbaa !29
  %106 = icmp eq i32 %105, -1
  br i1 %106, label %107, label %109

107:                                              ; preds = %103, %99, %95, %91, %87, %83, %79, %44
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %108, ptr noundef @.str.13)
  store i32 1, ptr %9, align 4
  br label %151

109:                                              ; preds = %103
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.png_struct_def, ptr %110, i32 0, i32 144
  %112 = getelementptr inbounds %struct.png_colorspace, ptr %111, i32 0, i32 4
  %113 = load i16, ptr %112, align 2, !tbaa !30
  %114 = zext i16 %113 to i32
  %115 = and i32 %114, 32768
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %118

117:                                              ; preds = %109
  store i32 1, ptr %9, align 4
  br label %151

118:                                              ; preds = %109
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.png_struct_def, ptr %119, i32 0, i32 144
  %121 = getelementptr inbounds %struct.png_colorspace, ptr %120, i32 0, i32 4
  %122 = load i16, ptr %121, align 2, !tbaa !30
  %123 = zext i16 %122 to i32
  %124 = and i32 %123, 16
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %137

126:                                              ; preds = %118
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.png_struct_def, ptr %127, i32 0, i32 144
  %129 = getelementptr inbounds %struct.png_colorspace, ptr %128, i32 0, i32 4
  %130 = load i16, ptr %129, align 2, !tbaa !30
  %131 = zext i16 %130 to i32
  %132 = or i32 %131, 32768
  %133 = trunc i32 %132 to i16
  store i16 %133, ptr %129, align 2, !tbaa !30
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_colorspace_sync(ptr noundef %134, ptr noundef %135)
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  call void @png_chunk_benign_error(ptr noundef %136, ptr noundef @.str.8)
  store i32 1, ptr %9, align 4
  br label %151

137:                                              ; preds = %118
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.png_struct_def, ptr %138, i32 0, i32 144
  %140 = getelementptr inbounds %struct.png_colorspace, ptr %139, i32 0, i32 4
  %141 = load i16, ptr %140, align 2, !tbaa !30
  %142 = zext i16 %141 to i32
  %143 = or i32 %142, 16
  %144 = trunc i32 %143 to i16
  store i16 %144, ptr %140, align 2, !tbaa !30
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.png_struct_def, ptr %146, i32 0, i32 144
  %148 = call i32 @png_colorspace_set_chromaticities(ptr noundef %145, ptr noundef %147, ptr noundef %8, i32 noundef 1)
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  call void @png_colorspace_sync(ptr noundef %149, ptr noundef %150)
  store i32 0, ptr %9, align 4
  br label %151

151:                                              ; preds = %137, %126, %117, %107, %43, %32, %23
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #4
  %152 = load i32, ptr %9, align 4
  switch i32 %152, label %154 [
    i32 0, label %153
    i32 1, label %153
  ]

153:                                              ; preds = %151, %151
  ret void

154:                                              ; preds = %151
  unreachable
}

declare i32 @png_colorspace_set_chromaticities(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 = !{!20, !10, i64 24}
!23 = !{!20, !10, i64 28}
!24 = !{!20, !10, i64 0}
!25 = !{!20, !10, i64 4}
!26 = !{!20, !10, i64 8}
!27 = !{!20, !10, i64 12}
!28 = !{!20, !10, i64 16}
!29 = !{!20, !10, i64 20}
!30 = !{!12, !15, i64 1250}


; 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_xy = type { i32, i32, i32, i32, i32, i32, i32, i32 }

@.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.13 = external hidden unnamed_addr constant [15 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 i32 @png_get_fixed_point(ptr noalias noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local void @png_handle_cHRM(ptr noalias noundef %0, ptr noalias noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca [32 x i8], align 16
  %5 = alloca %struct.png_xy, align 4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  %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) #5
  unreachable

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

13:                                               ; preds = %11
  %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.5) #4
  br label %63

15:                                               ; preds = %11
  %.not43 = icmp eq i32 %2, 32
  br i1 %.not43, label %18, label %16

16:                                               ; preds = %15
  %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.6) #4
  br label %63

18:                                               ; preds = %15
  call void @png_crc_read(ptr noundef nonnull %0, ptr noundef nonnull %4, i32 noundef 32)
  %19 = call i32 @png_crc_finish(ptr noundef nonnull %0, i32 noundef 0)
  %.not44 = icmp eq i32 %19, 0
  br i1 %.not44, label %20, label %63

20:                                               ; preds = %18
  %21 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %4)
  %22 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 %21, ptr %22, align 4, !tbaa !20
  %23 = getelementptr inbounds i8, ptr %4, i64 4
  %24 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %23)
  %25 = getelementptr inbounds i8, ptr %5, i64 28
  store i32 %24, ptr %25, align 4, !tbaa !21
  %26 = getelementptr inbounds i8, ptr %4, i64 8
  %27 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %26)
  store i32 %27, ptr %5, align 4, !tbaa !22
  %28 = getelementptr inbounds i8, ptr %4, i64 12
  %29 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %28)
  %30 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 %29, ptr %30, align 4, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %4, i64 16
  %32 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %31)
  %33 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 %32, ptr %33, align 4, !tbaa !24
  %34 = getelementptr inbounds i8, ptr %4, i64 20
  %35 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %34)
  %36 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 %35, ptr %36, align 4, !tbaa !25
  %37 = getelementptr inbounds i8, ptr %4, i64 24
  %38 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %37)
  %39 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 %38, ptr %39, align 4, !tbaa !26
  %40 = getelementptr inbounds i8, ptr %4, i64 28
  %41 = call i32 @png_get_fixed_point(ptr noundef null, ptr noundef nonnull %40)
  %42 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 %41, ptr %42, align 4, !tbaa !27
  %43 = icmp eq i32 %21, -1
  %44 = icmp eq i32 %24, -1
  %or.cond = select i1 %43, i1 true, i1 %44
  %45 = icmp eq i32 %27, -1
  %or.cond5 = select i1 %or.cond, i1 true, i1 %45
  %46 = icmp eq i32 %29, -1
  %or.cond8 = select i1 %or.cond5, i1 true, i1 %46
  %47 = icmp eq i32 %32, -1
  %or.cond11 = select i1 %or.cond8, i1 true, i1 %47
  %48 = icmp eq i32 %35, -1
  %or.cond14 = select i1 %or.cond11, i1 true, i1 %48
  %49 = icmp eq i32 %38, -1
  %or.cond17 = select i1 %or.cond14, i1 true, i1 %49
  %50 = icmp eq i32 %41, -1
  %or.cond20 = select i1 %or.cond17, i1 true, i1 %50
  br i1 %or.cond20, label %51, label %52

51:                                               ; preds = %20
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.13) #4
  br label %63

52:                                               ; preds = %20
  %53 = getelementptr inbounds i8, ptr %0, i64 1176
  %54 = getelementptr inbounds i8, ptr %0, i64 1250
  %55 = load i16, ptr %54, align 2, !tbaa !28
  %.not45 = icmp sgt i16 %55, -1
  br i1 %.not45, label %56, label %63

56:                                               ; preds = %52
  %57 = and i16 %55, 16
  %.not46 = icmp eq i16 %57, 0
  br i1 %.not46, label %60, label %58

58:                                               ; preds = %56
  %59 = or disjoint i16 %55, -32768
  store i16 %59, ptr %54, align 2, !tbaa !28
  call void @png_colorspace_sync(ptr noundef nonnull %0, ptr noundef %1) #4
  call void @png_chunk_benign_error(ptr noundef nonnull %0, ptr noundef nonnull @.str.8) #4
  br label %63

60:                                               ; preds = %56
  %61 = or disjoint i16 %55, 16
  store i16 %61, ptr %54, align 2, !tbaa !28
  %62 = call i32 @png_colorspace_set_chromaticities(ptr noundef nonnull %0, ptr noundef nonnull %53, ptr noundef nonnull %5, i32 noundef 1) #4
  call void @png_colorspace_sync(ptr noundef nonnull %0, ptr noundef %1) #4
  br label %63

63:                                               ; preds = %52, %18, %60, %58, %51, %16, %13
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret void
}

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

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 = { nounwind }
attributes #5 = { 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 = !{!18, !11, i64 24}
!21 = !{!18, !11, i64 28}
!22 = !{!18, !11, i64 0}
!23 = !{!18, !11, i64 4}
!24 = !{!18, !11, i64 8}
!25 = !{!18, !11, i64 12}
!26 = !{!18, !11, i64 16}
!27 = !{!18, !11, i64 20}
!28 = !{!6, !13, i64 1250}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass